1178172Simp/*-
2178172Simp * Copyright (c) 1990 The Regents of the University of California.
3178172Simp * All rights reserved.
4178172Simp *
5178172Simp * This code is derived from software contributed to Berkeley by
6178172Simp * William Jolitz.
7178172Simp *
8178172Simp * Redistribution and use in source and binary forms, with or without
9178172Simp * modification, are permitted provided that the following conditions
10178172Simp * are met:
11178172Simp * 1. Redistributions of source code must retain the above copyright
12178172Simp *    notice, this list of conditions and the following disclaimer.
13178172Simp * 2. Redistributions in binary form must reproduce the above copyright
14178172Simp *    notice, this list of conditions and the following disclaimer in the
15178172Simp *    documentation and/or other materials provided with the distribution.
16178172Simp * 4. Neither the name of the University nor the names of its contributors
17178172Simp *    may be used to endorse or promote products derived from this software
18178172Simp *    without specific prior written permission.
19178172Simp *
20178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23178172Simp * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28178172Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30178172Simp * SUCH DAMAGE.
31178172Simp *
32178172Simp *	from: @(#)autoconf.c	7.1 (Berkeley) 5/9/91
33178172Simp */
34178172Simp
35178172Simp#include <sys/cdefs.h>
36178172Simp__FBSDID("$FreeBSD$");
37178172Simp
38178172Simp/*
39178172Simp * Setup the system to run on the current machine.
40178172Simp *
41178172Simp * Configure() is called at boot time and initializes the vba
42178172Simp * device tables and the memory controller monitoring.  Available
43178172Simp * devices are determined (from possibilities mentioned in ioconf.c),
44178172Simp * and the drivers are initialized.
45178172Simp */
46178172Simp#include "opt_bootp.h"
47178172Simp#include "opt_bus.h"
48178172Simp
49178172Simp#include <sys/param.h>
50178172Simp#include <sys/systm.h>
51178172Simp#include <sys/bus.h>
52178172Simp#include <sys/conf.h>
53178172Simp#include <sys/reboot.h>
54178172Simp#include <sys/kernel.h>
55178172Simp#include <sys/malloc.h>
56178172Simp#include <sys/mount.h>
57178172Simp#include <sys/cons.h>
58178172Simp
59178172Simp#include <sys/socket.h>
60178172Simp#include <net/if.h>
61178172Simp#include <net/if_dl.h>
62178172Simp#include <net/if_types.h>
63178172Simp#include <net/if_var.h>
64178172Simp#include <net/ethernet.h>
65178172Simp#include <netinet/in.h>
66178172Simp
67178172Simp#include <machine/cpufunc.h>
68178172Simp#include <machine/md_var.h>
69178172Simp
70178172Simpstatic void	configure_first(void *);
71178172Simpstatic void	configure(void *);
72178172Simpstatic void	configure_final(void *);
73178172Simp
74178172SimpSYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL);
75178172Simp/* SI_ORDER_SECOND is hookable */
76178172SimpSYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL);
77178172Simp/* SI_ORDER_MIDDLE is hookable */
78178172SimpSYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL);
79178172Simp
80178172Simp/*
81178172Simp * Determine i/o configuration for a machine.
82178172Simp */
83178172Simpstatic void
84178172Simpconfigure_first(dummy)
85178172Simp	void *dummy;
86178172Simp{
87178172Simp
88178172Simp	/* nexus0 is the top of the mips device tree */
89178172Simp	device_add_child(root_bus, "nexus", 0);
90178172Simp}
91178172Simp
92178172Simpstatic void
93178172Simpconfigure(dummy)
94178172Simp	void *dummy;
95178172Simp{
96178172Simp
97178172Simp	/* initialize new bus architecture */
98178172Simp	root_bus_configure();
99178172Simp}
100178172Simp
101178172Simpstatic void
102178172Simpconfigure_final(dummy)
103178172Simp	void *dummy;
104178172Simp{
105206834Sjmallett	intr_enable();
106178172Simp
107178172Simp	cninit_finish();
108178172Simp
109178172Simp	if (bootverbose)
110178172Simp		printf("Device configuration finished.\n");
111178172Simp
112178172Simp	cold = 0;
113178172Simp}
114