xref: /netbsd-src/sys/arch/sun3/sun3/autoconf.c (revision ae1bfcddc410612bc8c58b807e1830becb69a24c)
1 /*
2  * Copyright (c) 1993 Adam Glass
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *	This product includes software developed by Adam Glass.
16  * 4. The name of the Author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  * $Header: /cvsroot/src/sys/arch/sun3/sun3/autoconf.c,v 1.9 1994/05/20 04:26:18 gwr Exp $
32  */
33 /*
34  * Setup the system to run on the current machine.
35  *
36  * Configure() is called at boot time.  Available
37  * devices are determined (from possibilities mentioned in ioconf.c),
38  * and the drivers are initialized.
39  */
40 
41 #include <sys/param.h>
42 #include <sys/systm.h>
43 #include <sys/map.h>
44 #include <sys/buf.h>
45 #include <sys/dkstat.h>
46 #include <sys/conf.h>
47 #include <sys/dmap.h>
48 #include <sys/reboot.h>
49 #include <sys/device.h>
50 
51 #include <machine/autoconf.h>
52 #include <machine/vmparam.h>
53 #include <machine/cpu.h>
54 #include <machine/pte.h>
55 #include <machine/isr.h>
56 
57 extern void mainbusattach __P((struct device *, struct device *, void *));
58 
59 struct mainbus_softc {
60     struct device mainbus_dev;
61 };
62 
63 struct cfdriver mainbuscd =
64 { NULL, "mainbus", always_match, mainbusattach, DV_DULL,
65       sizeof(struct mainbus_softc), 0};
66 
67 void mainbusattach(parent, self, args)
68      struct device *parent;
69      struct device *self;
70      void *args;
71 {
72     struct cfdata *new_match;
73 
74     printf("\n");
75     while (1) {
76 	new_match = config_search(NULL, self, NULL);
77 	if (!new_match) break;
78 	config_attach(self, new_match, NULL, NULL);
79     }
80 }
81 
82 int nmi_intr(arg)
83      int arg;
84 {
85     printf("nmi interrupt received\n");
86     return 1;
87 }
88 
89 void configure()
90 {
91     int root_found;
92 
93     isr_init();
94     root_found = config_rootfound("mainbus", NULL);
95     if (!root_found)
96 	panic("configure: autoconfig failed, no device tree root found");
97     isr_add(7, nmi_intr, 0);
98     isr_cleanup();
99 }
100 
101 int always_match(parent, cf, args)
102      struct device *parent;
103      struct cfdata *cf;
104      void *args;
105 {
106     return 1;
107 }
108