mainbus.c revision 1.1.2.3 1 1.1.2.3 tron /* $NetBSD: mainbus.c,v 1.1.2.3 2006/05/24 15:47:55 tron Exp $ */
2 1.1.2.2 tron
3 1.1.2.2 tron /*
4 1.1.2.2 tron * Copyright 2002 Wasabi Systems, Inc.
5 1.1.2.2 tron * All rights reserved.
6 1.1.2.2 tron *
7 1.1.2.2 tron * Written by Simon Burge for Wasabi Systems, Inc.
8 1.1.2.2 tron *
9 1.1.2.2 tron * Redistribution and use in source and binary forms, with or without
10 1.1.2.2 tron * modification, are permitted provided that the following conditions
11 1.1.2.2 tron * are met:
12 1.1.2.2 tron * 1. Redistributions of source code must retain the above copyright
13 1.1.2.2 tron * notice, this list of conditions and the following disclaimer.
14 1.1.2.2 tron * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.2.2 tron * notice, this list of conditions and the following disclaimer in the
16 1.1.2.2 tron * documentation and/or other materials provided with the distribution.
17 1.1.2.2 tron * 3. All advertising materials mentioning features or use of this software
18 1.1.2.2 tron * must display the following acknowledgement:
19 1.1.2.2 tron * This product includes software developed for the NetBSD Project by
20 1.1.2.2 tron * Wasabi Systems, Inc.
21 1.1.2.2 tron * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 1.1.2.2 tron * or promote products derived from this software without specific prior
23 1.1.2.2 tron * written permission.
24 1.1.2.2 tron *
25 1.1.2.2 tron * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 1.1.2.2 tron * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.1.2.2 tron * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.1.2.2 tron * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 1.1.2.2 tron * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.1.2.2 tron * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.1.2.2 tron * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.1.2.2 tron * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.1.2.2 tron * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.1.2.2 tron * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.1.2.2 tron * POSSIBILITY OF SUCH DAMAGE.
36 1.1.2.2 tron */
37 1.1.2.2 tron
38 1.1.2.2 tron #include <sys/cdefs.h>
39 1.1.2.3 tron __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1.2.3 2006/05/24 15:47:55 tron Exp $");
40 1.1.2.2 tron
41 1.1.2.2 tron #include <sys/param.h>
42 1.1.2.2 tron #include <sys/systm.h>
43 1.1.2.2 tron #include <sys/device.h>
44 1.1.2.2 tron
45 1.1.2.2 tron #include <mips/cache.h>
46 1.1.2.2 tron #include <mips/cpuregs.h>
47 1.1.2.2 tron
48 1.1.2.2 tron #include "locators.h"
49 1.1.2.2 tron
50 1.1.2.2 tron static int mainbus_match(struct device *, struct cfdata *, void *);
51 1.1.2.2 tron static void mainbus_attach(struct device *, struct device *, void *);
52 1.1.2.2 tron static int mainbus_print(void *, const char *);
53 1.1.2.2 tron
54 1.1.2.2 tron CFATTACH_DECL(mainbus, sizeof(struct device),
55 1.1.2.2 tron mainbus_match, mainbus_attach, NULL, NULL);
56 1.1.2.2 tron
57 1.1.2.2 tron /* There can be only one. */
58 1.1.2.2 tron int mainbus_found;
59 1.1.2.2 tron
60 1.1.2.2 tron struct mainbusdev {
61 1.1.2.2 tron const char *md_name;
62 1.1.2.2 tron };
63 1.1.2.2 tron
64 1.1.2.2 tron struct mainbusdev mainbusdevs[] = {
65 1.1.2.2 tron { "cpu", },
66 1.1.2.2 tron { "arbus", },
67 1.1.2.2 tron { NULL, }
68 1.1.2.2 tron };
69 1.1.2.2 tron
70 1.1.2.2 tron static int
71 1.1.2.2 tron mainbus_match(parent, match, aux)
72 1.1.2.2 tron struct device *parent;
73 1.1.2.2 tron struct cfdata *match;
74 1.1.2.2 tron void *aux;
75 1.1.2.2 tron {
76 1.1.2.2 tron
77 1.1.2.2 tron if (mainbus_found)
78 1.1.2.2 tron return (0);
79 1.1.2.2 tron
80 1.1.2.2 tron return (1);
81 1.1.2.2 tron }
82 1.1.2.2 tron
83 1.1.2.2 tron static void
84 1.1.2.2 tron mainbus_attach(parent, self, aux)
85 1.1.2.2 tron struct device *parent;
86 1.1.2.2 tron struct device *self;
87 1.1.2.2 tron void *aux;
88 1.1.2.2 tron {
89 1.1.2.2 tron struct mainbusdev *md;
90 1.1.2.2 tron
91 1.1.2.2 tron mainbus_found = 1;
92 1.1.2.2 tron printf("\n");
93 1.1.2.2 tron
94 1.1.2.2 tron for (md = mainbusdevs; md->md_name != NULL; md++) {
95 1.1.2.2 tron config_found_ia(self, "mainbus", NULL, mainbus_print);
96 1.1.2.2 tron }
97 1.1.2.2 tron }
98 1.1.2.2 tron
99 1.1.2.2 tron static int
100 1.1.2.2 tron mainbus_print(void *aux, const char *pnp)
101 1.1.2.2 tron {
102 1.1.2.2 tron
103 1.1.2.2 tron return (UNCONF);
104 1.1.2.2 tron }
105