mainbus.c revision 1.1
1/*	$NetBSD: mainbus.c,v 1.1 2001/02/06 16:45:20 uch Exp $	*/
2
3/*
4 * Copyright (c) 1996 Christopher G. Demetriou.  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 * 3. All advertising materials mentioning features or use of this software
15 *    must display the following acknowledgement:
16 *      This product includes software developed by Christopher G. Demetriou
17 *	for the NetBSD Project.
18 * 4. The name of the author may not be used to endorse or promote products
19 *    derived from this software without specific prior written permission
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/shbvar.h>
38
39int	mainbus_match __P((struct device *, struct cfdata *, void *));
40void	mainbus_attach __P((struct device *, struct device *, void *));
41
42struct cfattach mainbus_ca = {
43	sizeof(struct device), mainbus_match, mainbus_attach
44};
45
46int	mainbus_print __P((void *, const char *));
47
48union mainbus_attach_args {
49	const char *mba_busname;		/* first elem of all */
50	struct shbus_attach_args mba_sba;
51#ifdef	TODO
52	struct pcibus_attach_args mba_pba;
53	struct eisabus_attach_args mba_eba;
54	struct isabus_attach_args mba_iba;
55#endif
56};
57
58/*
59 * This is set when the ISA bus is attached.  If it's not set by the
60 * time it's checked below, then mainbus attempts to attach an ISA.
61 */
62int	isa_has_been_seen;
63
64/*
65 * Probe for the mainbus; always succeeds.
66 */
67int
68mainbus_match(parent, cf, aux)
69	struct device *parent;
70	struct cfdata *cf;
71	void *aux;
72{
73
74	return 1;
75}
76
77/*
78 * Attach the mainbus.
79 */
80void
81mainbus_attach(parent, self, aux)
82	struct device *parent, *self;
83	void *aux;
84{
85	union mainbus_attach_args mba;
86
87	printf("\n");
88
89	mba.mba_sba.iba_busname = "shb";
90	mba.mba_sba.iba_iot = 0;
91	mba.mba_sba.iba_memt = 0;
92
93	config_found(self, &mba.mba_sba, mainbus_print);
94}
95
96int
97mainbus_print(aux, pnp)
98	void *aux;
99	const char *pnp;
100{
101	union mainbus_attach_args *mba = aux;
102
103	if (pnp)
104		printf("%s at %s", mba->mba_busname, pnp);
105#ifdef	TODO
106	if (!strcmp(mba->mba_busname, "pci"))
107		printf(" bus %d", mba->mba_pba.pba_bus);
108#endif
109	return (UNCONF);
110}
111