14Srgrimes/*- 24Srgrimes * Copyright (c) 1990 The Regents of the University of California. 34Srgrimes * All rights reserved. 44Srgrimes * 54Srgrimes * This code is derived from software contributed to Berkeley by 64Srgrimes * William Jolitz. 74Srgrimes * 84Srgrimes * Redistribution and use in source and binary forms, with or without 94Srgrimes * modification, are permitted provided that the following conditions 104Srgrimes * are met: 114Srgrimes * 1. Redistributions of source code must retain the above copyright 124Srgrimes * notice, this list of conditions and the following disclaimer. 134Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 144Srgrimes * notice, this list of conditions and the following disclaimer in the 154Srgrimes * documentation and/or other materials provided with the distribution. 164Srgrimes * 4. Neither the name of the University nor the names of its contributors 174Srgrimes * may be used to endorse or promote products derived from this software 184Srgrimes * without specific prior written permission. 194Srgrimes * 204Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 214Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 224Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 234Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 244Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 254Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 264Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 274Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 284Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 294Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304Srgrimes * SUCH DAMAGE. 314Srgrimes * 32122940Speter * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 334Srgrimes */ 344Srgrimes 35118031Sobrien#include <sys/cdefs.h> 36118031Sobrien__FBSDID("$FreeBSD$"); 37118031Sobrien 384Srgrimes/* 394Srgrimes * Setup the system to run on the current machine. 404Srgrimes * 418876Srgrimes * Configure() is called at boot time and initializes the vba 424Srgrimes * device tables and the memory controller monitoring. Available 434Srgrimes * devices are determined (from possibilities mentioned in ioconf.c), 444Srgrimes * and the drivers are initialized. 454Srgrimes */ 46131840Sbrian#include "opt_bootp.h" 4771785Speter#include "opt_isa.h" 4845720Speter#include "opt_bus.h" 4925164Speter 502056Swollman#include <sys/param.h> 512056Swollman#include <sys/systm.h> 5245720Speter#include <sys/bus.h> 532056Swollman#include <sys/conf.h> 542056Swollman#include <sys/reboot.h> 552056Swollman#include <sys/kernel.h> 5636809Sbde#include <sys/malloc.h> 5712604Sbde#include <sys/mount.h> 5849558Sphk#include <sys/cons.h> 594Srgrimes 6083651Speter#include <sys/socket.h> 6183651Speter#include <net/if.h> 6283651Speter#include <net/if_dl.h> 6383651Speter#include <net/if_types.h> 6483651Speter#include <net/if_var.h> 6583651Speter#include <net/ethernet.h> 6683651Speter#include <netinet/in.h> 6783651Speter 687090Sbde#include <machine/md_var.h> 6927288Sfsmp 7071785Speter#ifdef DEV_ISA 7150769Sdfr#include <isa/isavar.h> 7255117Sbde 7346915Speterdevice_t isa_bus_device = 0; 7455117Sbde#endif 7546915Speter 7692770Salfredstatic void configure_first(void *); 7792770Salfredstatic void configure(void *); 7892770Salfredstatic void configure_final(void *); 7912604Sbde 8042817SpeterSYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL); 8142817Speter/* SI_ORDER_SECOND is hookable */ 8242817SpeterSYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL); 8342817Speter/* SI_ORDER_MIDDLE is hookable */ 8442817SpeterSYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL); 8542817Speter 864Srgrimes/* 874Srgrimes * Determine i/o configuration for a machine. 884Srgrimes */ 8910665Sbdestatic void 9042817Speterconfigure_first(dummy) 9142817Speter void *dummy; 9242817Speter{ 93146794Smarcel 94146794Smarcel /* nexus0 is the top of the amd64 device tree */ 95146794Smarcel device_add_child(root_bus, "nexus", 0); 9642817Speter} 9742817Speter 9842817Speterstatic void 9910665Sbdeconfigure(dummy) 10010653Sdg void *dummy; 1014Srgrimes{ 1024Srgrimes 10329675Sgibbs /* 104122849Speter * Enable interrupts on the processor. The interrupts are still 105122849Speter * disabled in the interrupt controllers until interrupt handlers 106122849Speter * are registered. 10729675Sgibbs */ 10825172Speter enable_intr(); 10912791Sgibbs 11038779Snsouch /* initialize new bus architecture */ 11138779Snsouch root_bus_configure(); 11238779Snsouch 11371785Speter#ifdef DEV_ISA 11450184Speter /* 11550184Speter * Explicitly probe and attach ISA last. The isa bus saves 11650184Speter * it's device node at attach time for us here. 11750184Speter */ 11845720Speter if (isa_bus_device) 11950769Sdfr isa_probe_children(isa_bus_device); 12050769Sdfr#endif 12142817Speter} 12231337Sbde 12342817Speterstatic void 12442817Speterconfigure_final(dummy) 12542817Speter void *dummy; 12642817Speter{ 12722564Sbde 12887620Sguido cninit_finish(); 129122520Speter if (bootverbose) 130122520Speter printf("Device configuration finished.\n"); 13129675Sgibbs cold = 0; 13229675Sgibbs} 133