1 /* $NetBSD: mainbus.c,v 1.12 2021/08/07 16:19:00 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5 * All rights reserved.
6 *
7 * Author: Chris G. Demetriou
8 * DECstation port: Jonathan Stone
9 *
10 * Permission to use, copy, modify and distribute this software and
11 * its documentation is hereby granted, provided that both the copyright
12 * notice and this permission notice appear in all copies of the
13 * software, derivative works or modified versions, and any portions
14 * thereof, and that both notices appear in supporting documentation.
15 *
16 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19 *
20 * Carnegie Mellon requests users of this software to return to
21 *
22 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
23 * School of Computer Science
24 * Carnegie Mellon University
25 * Pittsburgh PA 15213-3890
26 *
27 * any improvements or extensions that they make and grant Carnegie the
28 * rights to redistribute these changes.
29 */
30
31 #include <sys/cdefs.h>
32 __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2021/08/07 16:19:00 thorpej Exp $");
33
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/device.h>
37 #include <sys/reboot.h>
38
39 #include <machine/autoconf.h>
40
41 /* Definition of the mainbus driver. */
42 static int mbmatch(device_t, cfdata_t, void *);
43 static void mbattach(device_t, device_t, void *);
44 static int mbprint(void *, const char *);
45
46 CFATTACH_DECL_NEW(mainbus, 0,
47 mbmatch, mbattach, NULL, NULL);
48
49 static bool mb_attached;
50
51 static int
mbmatch(device_t parent,cfdata_t cfdata,void * aux)52 mbmatch(device_t parent, cfdata_t cfdata, void *aux)
53 {
54
55 return !mb_attached;
56 }
57
58 static void
mbattach(device_t parent,device_t self,void * aux)59 mbattach(device_t parent, device_t self, void *aux)
60 {
61 struct confargs nca;
62
63 mb_attached = true;
64
65 aprint_normal("\n");
66
67 nca.ca_name = "cpu";
68 nca.ca_addr = 0;
69 config_found(self, &nca, mbprint, CFARGS_NONE);
70
71 nca.ca_name = "obio";
72 nca.ca_addr = 0;
73 config_found(self, &nca, NULL, CFARGS_NONE);
74
75 nca.ca_name = "isabus"; /* XXX */
76 nca.ca_addr = 0;
77 config_found(self, &nca, NULL, CFARGS_NONE);
78
79 }
80
81 static int
mbprint(void * aux,const char * pnp)82 mbprint(void *aux, const char *pnp)
83 {
84
85 if (pnp)
86 return QUIET;
87 return UNCONF;
88 }
89