1 /* $NetBSD: mainbus.c,v 1.4 2000/01/23 15:58:04 tsubai 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/param.h> 32 #include <sys/systm.h> 33 #include <sys/device.h> 34 #include <sys/reboot.h> 35 36 #include <machine/autoconf.h> 37 #include <machine/apbus.h> 38 39 struct mainbus_softc { 40 struct device sc_dev; 41 }; 42 43 /* Definition of the mainbus driver. */ 44 static int mbmatch __P((struct device *, struct cfdata *, void *)); 45 static void mbattach __P((struct device *, struct device *, void *)); 46 static int mbprint __P((void *, const char *)); 47 48 struct cfattach mainbus_ca = { 49 sizeof(struct mainbus_softc), mbmatch, mbattach 50 }; 51 52 /* There can be only one. */ 53 static int mainbus_found; 54 55 static int 56 mbmatch(parent, cf, aux) 57 struct device *parent; 58 struct cfdata *cf; 59 void *aux; 60 { 61 if (mainbus_found) 62 return 0; 63 64 return 1; 65 } 66 67 static void 68 mbattach(parent, self, aux) 69 struct device *parent; 70 struct device *self; 71 void *aux; 72 { 73 register struct device *mb = self; 74 struct confargs nca; 75 76 mainbus_found = 1; 77 printf("\n"); 78 79 nca.ca_name = "cpu"; 80 nca.ca_slot = 0; 81 nca.ca_offset = 0; 82 nca.ca_addr = 0; 83 config_found(mb, &nca, mbprint); 84 85 /* XXX */ 86 if (_sip != NULL) { 87 nca.ca_name = "ap"; 88 config_found(self, &nca, NULL); 89 } else { 90 nca.ca_name = "hb"; 91 config_found(self, &nca, NULL); 92 } 93 } 94 95 static int 96 mbprint(aux, pnp) 97 void *aux; 98 const char *pnp; 99 { 100 101 if (pnp) 102 return QUIET; 103 return UNCONF; 104 } 105