Annotation of src/sys/arch/i386/i386/autoconf.c, Revision 1.100.10.2
1.100.10.2! pgoyette 1: /* $NetBSD: autoconf.c,v 1.102 2017/04/22 04:29:31 nonaka 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.10.2! pgoyette 49: __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.102 2017/04/22 04:29:31 nonaka 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
1.100.10.1 pgoyette 77: #include <machine/i82489reg.h>
1.65 fvdl 78: #include <machine/i82489var.h>
79: #endif
80:
1.45 thorpej 81: #include "bios32.h"
82: #if NBIOS32 > 0
83: #include <machine/bios32.h>
1.89 jmcneill 84: /* XXX */
85: extern void platform_init(void);
1.45 thorpej 86: #endif
87:
88: #include "opt_pcibios.h"
89: #ifdef PCIBIOS
90: #include <dev/pci/pcireg.h>
91: #include <dev/pci/pcivar.h>
92: #include <i386/pci/pcibios.h>
93: #endif
94:
1.1 cgd 95: /*
96: * Determine i/o configuration for a machine.
97: */
1.19 mycroft 98: void
1.69 dsl 99: cpu_configure(void)
1.1 cgd 100: {
1.95 rmind 101: struct pcb *pcb;
1.1 cgd 102:
1.12 mycroft 103: startrtclock();
1.45 thorpej 104:
105: #if NBIOS32 > 0
106: bios32_init();
1.89 jmcneill 107: platform_init();
1.45 thorpej 108: #endif
109: #ifdef PCIBIOS
110: pcibios_init();
111: #endif
1.12 mycroft 112:
1.18 cgd 113: if (config_rootfound("mainbus", NULL) == NULL)
114: panic("configure: mainbus not configured");
1.12 mycroft 115:
1.65 fvdl 116: #ifdef INTRDEBUG
117: intr_printconfig();
118: #endif
1.12 mycroft 119:
1.64 fvdl 120: #if NIOAPIC > 0
121: ioapic_enable();
122: #endif
1.99 dsl 123: fpuinit(&cpu_info_primary);
1.64 fvdl 124: /* resync cr0 after FPU configuration */
1.95 rmind 125: pcb = lwp_getpcb(&lwp0);
126: pcb->pcb_cr0 = rcr0() & ~CR0_TS;
1.64 fvdl 127: #ifdef MULTIPROCESSOR
128: /* propagate this to the idle pcb's. */
1.86 yamt 129: cpu_init_idle_lwps();
1.64 fvdl 130: #endif
1.61 drochner 131:
1.12 mycroft 132: spl0();
1.65 fvdl 133: #if NLAPIC > 0
1.100.10.2! pgoyette 134: lapic_write_tpri(0);
1.65 fvdl 135: #endif
1.24 gwr 136: }
CVSweb <webmaster@jp.NetBSD.org>