1 /* $NetBSD: mainbus.c,v 1.5 2012/05/15 12:14:59 tsutsui Exp $ */ 2 3 /* 4 * Copyright (c) 2008 Tetsuya Isaki. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28 /* 29 * mainbus driver 30 */ 31 32 #include <sys/cdefs.h> 33 __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.5 2012/05/15 12:14:59 tsutsui Exp $"); 34 35 #include <sys/param.h> 36 #include <sys/systm.h> 37 #include <sys/device.h> 38 39 static int mainbus_match(device_t, cfdata_t, void *); 40 static void mainbus_attach(device_t, device_t, void *); 41 42 CFATTACH_DECL_NEW(mainbus, 0, 43 mainbus_match, mainbus_attach, NULL, NULL); 44 45 static int mainbus_attached; 46 47 static int 48 mainbus_match(device_t parent, cfdata_t cf, void *aux) 49 { 50 51 if (mainbus_attached) 52 return 0; 53 54 return 1; 55 } 56 57 /* 58 * "find" all the things that should be there. 59 */ 60 static void 61 mainbus_attach(device_t parent, device_t self, void *aux) 62 { 63 64 mainbus_attached = 1; 65 66 aprint_normal("\n"); 67 68 config_found(self, __UNCONST("intio") , NULL); 69 config_found(self, __UNCONST("grfbus") , NULL); 70 } 71