Annotation of src/sys/arch/i386/i386/autoconf.c, Revision 1.91.6.2
1.91.6.1 mjf 1: /* $NetBSD$ */
1.11 cgd 2:
1.1 cgd 3: /*-
4: * Copyright (c) 1990 The Regents of the University of California.
5: * All rights reserved.
6: *
7: * This code is derived from software contributed to Berkeley by
8: * William Jolitz.
9: *
10: * Redistribution and use in source and binary forms, with or without
11: * modification, are permitted provided that the following conditions
12: * are met:
13: * 1. Redistributions of source code must retain the above copyright
14: * notice, this list of conditions and the following disclaimer.
15: * 2. Redistributions in binary form must reproduce the above copyright
16: * notice, this list of conditions and the following disclaimer in the
17: * documentation and/or other materials provided with the distribution.
1.72 agc 18: * 3. Neither the name of the University nor the names of its contributors
1.1 cgd 19: * may be used to endorse or promote products derived from this software
20: * without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
33: *
1.11 cgd 34: * @(#)autoconf.c 7.1 (Berkeley) 5/9/91
1.1 cgd 35: */
36:
37: /*
38: * Setup the system to run on the current machine.
39: *
1.64 fvdl 40: * Configure() is called at boot time and initializes the vba
1.1 cgd 41: * device tables and the memory controller monitoring. Available
42: * devices are determined (from possibilities mentioned in ioconf.c),
43: * and the drivers are initialized.
1.80 thorpej 44: *
45: * Lots of this is now in x86/x86/x86_autoconf.c
1.1 cgd 46: */
1.59 lukem 47:
48: #include <sys/cdefs.h>
1.91.6.1 mjf 49: __KERNEL_RCSID(0, "$NetBSD$");
1.43 drochner 50:
51: #include "opt_compat_oldboot.h"
1.71 martin 52: #include "opt_multiprocessor.h"
1.43 drochner 53:
1.9 mycroft 54: #include <sys/param.h>
55: #include <sys/systm.h>
56: #include <sys/buf.h>
1.61 drochner 57: #include <sys/proc.h>
58: #include <sys/user.h>
1.1 cgd 59:
1.9 mycroft 60: #include <machine/pte.h>
1.20 christos 61: #include <machine/cpu.h>
1.64 fvdl 62: #include <machine/gdt.h>
1.61 drochner 63: #include <machine/pcb.h>
1.90 ad 64: #include <machine/cpufunc.h>
1.1 cgd 65:
1.64 fvdl 66: #include "ioapic.h"
1.65 fvdl 67: #include "lapic.h"
1.64 fvdl 68:
69: #if NIOAPIC > 0
70: #include <machine/i82093var.h>
71: #endif
72:
1.65 fvdl 73: #if NLAPIC > 0
74: #include <machine/i82489var.h>
75: #endif
76:
1.45 thorpej 77: #include "bios32.h"
78: #if NBIOS32 > 0
79: #include <machine/bios32.h>
1.89 jmcneill 80: /* XXX */
81: extern void platform_init(void);
1.45 thorpej 82: #endif
83:
84: #include "opt_pcibios.h"
85: #ifdef PCIBIOS
86: #include <dev/pci/pcireg.h>
87: #include <dev/pci/pcivar.h>
88: #include <i386/pci/pcibios.h>
89: #endif
90:
1.61 drochner 91: #include "opt_kvm86.h"
92: #ifdef KVM86
93: #include <machine/kvm86.h>
94: #endif
95:
1.85 daniel 96: #include "opt_viapadlock.h"
97:
1.1 cgd 98: /*
99: * Determine i/o configuration for a machine.
100: */
1.19 mycroft 101: void
1.69 dsl 102: cpu_configure(void)
1.1 cgd 103: {
104:
1.12 mycroft 105: startrtclock();
1.45 thorpej 106:
107: #if NBIOS32 > 0
108: bios32_init();
1.89 jmcneill 109: platform_init();
1.45 thorpej 110: #endif
111: #ifdef PCIBIOS
112: pcibios_init();
113: #endif
1.12 mycroft 114:
1.61 drochner 115: #ifdef KVM86
116: kvm86_init();
117: #endif
118:
1.18 cgd 119: if (config_rootfound("mainbus", NULL) == NULL)
120: panic("configure: mainbus not configured");
1.12 mycroft 121:
1.65 fvdl 122: #ifdef INTRDEBUG
123: intr_printconfig();
124: #endif
1.12 mycroft 125:
1.64 fvdl 126: #if NIOAPIC > 0
127: ioapic_enable();
128: #endif
129: /* resync cr0 after FPU configuration */
1.91.6.2! mjf 130: lwp0.l_addr->u_pcb.pcb_cr0 = rcr0() & ~CR0_TS;
1.64 fvdl 131: #ifdef MULTIPROCESSOR
132: /* propagate this to the idle pcb's. */
1.86 yamt 133: cpu_init_idle_lwps();
1.64 fvdl 134: #endif
1.61 drochner 135:
1.12 mycroft 136: spl0();
1.65 fvdl 137: #if NLAPIC > 0
138: lapic_tpr = 0;
139: #endif
1.85 daniel 140:
1.88 ad 141: #if defined(VIA_PADLOCK)
1.85 daniel 142: via_padlock_attach();
1.88 ad 143: #endif
1.24 gwr 144: }
CVSweb <webmaster@jp.NetBSD.org>