1 /* $NetBSD: mainbus.c,v 1.2 2000/01/07 05:13:08 nisimura Exp $ */ 2 3 /*- 4 * Copyright (c) 2000 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Tohru Nishimura. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. All advertising materials mentioning features or use of this software 19 * must display the following acknowledgement: 20 * This product includes software developed by the NetBSD 21 * Foundation, Inc. and its contributors. 22 * 4. Neither the name of The NetBSD Foundation nor the names of its 23 * contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 */ 38 39 #include <sys/cdefs.h> 40 41 __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.2 2000/01/07 05:13:08 nisimura Exp $"); 42 43 #include <sys/param.h> 44 #include <sys/systm.h> 45 #include <sys/device.h> 46 47 #include <machine/cpu.h> 48 #include <machine/autoconf.h> 49 50 static struct mainbus_attach_args devs[] = { 51 { "clock", 0x45000000, -1 }, /* Mostek/Dallas TimeKeeper */ 52 { "le", 0xf1000000, 3 }, /* Am7990 */ 53 { "sio", 0x51000000, 6 }, /* uPD7201A */ 54 { "fb", 0xc1100000, -1 }, /* BrookTree RAMDAC */ 55 { "spc", 0xe1000000, 2 }, /* MB89352 */ 56 #if 0 57 { "spc", 0xe1000040, 2 }, /* ditto */ 58 #endif 59 }; 60 61 static void mainbus_attach __P((struct device *, struct device *, void *)); 62 static int mainbus_match __P((struct device *, struct cfdata *, void *)); 63 static int mainbus_print __P((void *, const char *)); 64 65 const struct cfattach mainbus_ca = { 66 sizeof(struct device), mainbus_match, mainbus_attach 67 }; 68 69 static int 70 mainbus_match(parent, cf, args) 71 struct device *parent; 72 struct cfdata *cf; 73 void *args; 74 { 75 static int mainbus_matched; 76 77 if (mainbus_matched) 78 return (0); 79 80 return ((mainbus_matched = 1)); 81 } 82 83 static void 84 mainbus_attach(parent, self, args) 85 struct device *parent, *self; 86 void *args; 87 { 88 int i; 89 90 if (machtype == LUNA_II) 91 devs[1].ma_addr = 0xf0000000; 92 printf("\n"); 93 for (i = 0; i < sizeof(devs)/sizeof(devs[0]); i++) 94 config_found(self, (void *)&devs[i], mainbus_print); 95 } 96 97 static int 98 mainbus_print(aux, pnp) 99 void *aux; 100 const char *pnp; 101 { 102 struct mainbus_attach_args *ma = aux; 103 104 if (pnp) 105 printf("%s at %s", ma->ma_name, pnp); 106 107 return (UNCONF); 108 } 109