xref: /netbsd/sys/arch/luna68k/luna68k/mainbus.c (revision c4a72b64)
1 /* $NetBSD: mainbus.c,v 1.3 2002/10/02 05:31:47 thorpej 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.3 2002/10/02 05:31:47 thorpej 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 CFATTACH_DECL(mainbus, sizeof(struct device),
66     mainbus_match, mainbus_attach, NULL, NULL);
67 
68 static int
69 mainbus_match(parent, cf, args)
70 	struct device *parent;
71 	struct cfdata *cf;
72 	void *args;
73 {
74 	static int mainbus_matched;
75 
76 	if (mainbus_matched)
77 		return (0);
78 
79 	return ((mainbus_matched = 1));
80 }
81 
82 static void
83 mainbus_attach(parent, self, args)
84 	struct device *parent, *self;
85 	void *args;
86 {
87 	int i;
88 
89 	if (machtype == LUNA_II)
90 		devs[1].ma_addr = 0xf0000000;
91 	printf("\n");
92 	for (i = 0; i < sizeof(devs)/sizeof(devs[0]); i++)
93 		config_found(self, (void *)&devs[i], mainbus_print);
94 }
95 
96 static int
97 mainbus_print(aux, pnp)
98 	void *aux;
99 	const char *pnp;
100 {
101 	struct mainbus_attach_args *ma = aux;
102 
103 	if (pnp)
104 		printf("%s at %s", ma->ma_name, pnp);
105 
106 	return (UNCONF);
107 }
108