Annotation of src/sys/arch/i386/i386/autoconf.c, Revision 1.100
1.100 ! dsl 1: /* $NetBSD: autoconf.c,v 1.99 2014/01/26 19:16:17 dsl Exp $ */
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.100 ! dsl 49: __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.99 2014/01/26 19:16:17 dsl Exp $");
1.43 drochner 50:
51: #include "opt_compat_oldboot.h"
1.94 dyoung 52: #include "opt_intrdebug.h"
1.71 martin 53: #include "opt_multiprocessor.h"
1.43 drochner 54:
1.9 mycroft 55: #include <sys/param.h>
56: #include <sys/systm.h>
57: #include <sys/buf.h>
1.61 drochner 58: #include <sys/proc.h>
1.97 dholland 59: #include <sys/device.h>
1.1 cgd 60:
1.9 mycroft 61: #include <machine/pte.h>
1.20 christos 62: #include <machine/cpu.h>
1.64 fvdl 63: #include <machine/gdt.h>
1.94 dyoung 64: #include <machine/intr.h>
1.61 drochner 65: #include <machine/pcb.h>
1.90 ad 66: #include <machine/cpufunc.h>
1.100 ! dsl 67: #include <x86/fpu.h>
1.1 cgd 68:
1.64 fvdl 69: #include "ioapic.h"
1.65 fvdl 70: #include "lapic.h"
1.64 fvdl 71:
72: #if NIOAPIC > 0
73: #include <machine/i82093var.h>
74: #endif
75:
1.65 fvdl 76: #if NLAPIC > 0
77: #include <machine/i82489var.h>
78: #endif
79:
1.45 thorpej 80: #include "bios32.h"
81: #if NBIOS32 > 0
82: #include <machine/bios32.h>
1.89 jmcneill 83: /* XXX */
84: extern void platform_init(void);
1.45 thorpej 85: #endif
86:
87: #include "opt_pcibios.h"
88: #ifdef PCIBIOS
89: #include <dev/pci/pcireg.h>
90: #include <dev/pci/pcivar.h>
91: #include <i386/pci/pcibios.h>
92: #endif
93:
1.1 cgd 94: /*
95: * Determine i/o configuration for a machine.
96: */
1.19 mycroft 97: void
1.69 dsl 98: cpu_configure(void)
1.1 cgd 99: {
1.95 rmind 100: struct pcb *pcb;
1.1 cgd 101:
1.12 mycroft 102: startrtclock();
1.45 thorpej 103:
104: #if NBIOS32 > 0
105: bios32_init();
1.89 jmcneill 106: platform_init();
1.45 thorpej 107: #endif
108: #ifdef PCIBIOS
109: pcibios_init();
110: #endif
1.12 mycroft 111:
1.18 cgd 112: if (config_rootfound("mainbus", NULL) == NULL)
113: panic("configure: mainbus not configured");
1.12 mycroft 114:
1.65 fvdl 115: #ifdef INTRDEBUG
116: intr_printconfig();
117: #endif
1.12 mycroft 118:
1.64 fvdl 119: #if NIOAPIC > 0
120: ioapic_enable();
121: #endif
1.99 dsl 122: fpuinit(&cpu_info_primary);
1.64 fvdl 123: /* resync cr0 after FPU configuration */
1.95 rmind 124: pcb = lwp_getpcb(&lwp0);
125: pcb->pcb_cr0 = rcr0() & ~CR0_TS;
1.64 fvdl 126: #ifdef MULTIPROCESSOR
127: /* propagate this to the idle pcb's. */
1.86 yamt 128: cpu_init_idle_lwps();
1.64 fvdl 129: #endif
1.61 drochner 130:
1.12 mycroft 131: spl0();
1.65 fvdl 132: #if NLAPIC > 0
133: lapic_tpr = 0;
134: #endif
1.24 gwr 135: }
CVSweb <webmaster@jp.NetBSD.org>