1 /* $NetBSD: mainbus.c,v 1.3 1996/10/13 03:47:52 christos Exp $ */ 2 3 /* 4 * Copyright (c) 1996 Gordon W. Ross 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. The name of the author may not be used to endorse or promote products 16 * derived from this software without specific prior written permission. 17 * 4. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed by Gordon Ross 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #include <sys/param.h> 34 #include <sys/systm.h> 35 #include <sys/device.h> 36 37 #include <machine/autoconf.h> 38 39 static int main_match __P((struct device *, void *, void *)); 40 static void main_attach __P((struct device *, struct device *, void *)); 41 42 struct cfattach mainbus_ca = { 43 sizeof(struct device), main_match, main_attach 44 }; 45 46 struct cfdriver mainbus_cd = { 47 NULL, "mainbus", DV_DULL 48 }; 49 50 /* 51 * Probe for the mainbus; always succeeds. 52 */ 53 static int 54 main_match(parent, match, aux) 55 struct device *parent; 56 void *match, *aux; 57 { 58 59 return 1; 60 } 61 62 /* 63 * Do "direct" configuration for the bus types on mainbus. 64 * This controls the order of autoconfig for important things 65 * used early. For example, idprom is used by Ether drivers. 66 */ 67 static int bus_order[] = { 68 BUS_OBIO, /* eeprom, clock */ 69 BUS_OBMEM, 70 BUS_VME16, 71 BUS_VME32 72 }; 73 #define BUS_ORDER_SZ (sizeof(bus_order)/sizeof(bus_order[0])) 74 75 static void 76 main_attach(parent, self, args) 77 struct device *parent; 78 struct device *self; 79 void *args; 80 { 81 struct confargs ca; 82 struct cfdata *new_match; 83 int i; 84 85 printf("\n"); 86 87 for (i = 0; i < BUS_ORDER_SZ; i++) { 88 ca.ca_bustype = bus_order[i]; 89 (void) config_found(self, &ca, NULL); 90 } 91 } 92