1 /* $NetBSD: mainbus.c,v 1.7 2023/12/20 06:36:01 thorpej Exp $ */
2
3 /*-
4 * Copyright (c) 2008,2009 Frank Wille.
5 * All rights reserved.
6 *
7 * Written by Frank Wille for The NetBSD Project.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30 /*
31 * Copyright (c) 1994 Christian E. Hopps
32 * All rights reserved.
33 *
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by Christian E. Hopps.
45 * 4. The name of the author may not be used to endorse or promote products
46 * derived from this software without specific prior written permission
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
49 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
50 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
51 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
52 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 */
59
60 #include <sys/cdefs.h>
61 __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.7 2023/12/20 06:36:01 thorpej Exp $");
62
63 #include <sys/param.h>
64 #include <sys/device.h>
65 #include <sys/systm.h>
66 #include <sys/bus.h>
67
68 #include <machine/autoconf.h>
69
70 #include <amiga/amiga/cfdev.h>
71 #include <amiga/amiga/device.h>
72
73 #if 0
74 #include "mainbus.h"
75
76 #if NCPU == 0
77 #error A cpu device is now required
78 #endif
79 #endif
80
81 void mbattach(device_t, device_t, void *);
82 int mbprint(void *, const char *);
83 int mbmatch(device_t, cfdata_t, void *);
84
85 CFATTACH_DECL_NEW(mainbus, 0,
86 mbmatch, mbattach, NULL, NULL);
87
88 int
mbmatch(device_t parent,cfdata_t cfp,void * aux)89 mbmatch(device_t parent, cfdata_t cfp, void *aux)
90 {
91
92 return 1;
93 }
94
95 void
mbattach(device_t parent,device_t self,void * aux)96 mbattach(device_t parent, device_t self, void *aux)
97 {
98
99 printf("\n");
100
101 /*
102 * Always find the CPU
103 */
104 config_found(self, __UNCONST("cpu"), mbprint, CFARGS_NONE);
105
106 /*
107 * "find" all the things that should be there.
108 */
109 if (is_a3000() || is_a4000())
110 config_found(self, __UNCONST("a34kbbc"), simple_devprint,
111 CFARGS_NONE);
112 else
113 config_found(self, __UNCONST("a2kbbc"), simple_devprint,
114 CFARGS_NONE);
115 config_found(self, __UNCONST("ser"), simple_devprint, CFARGS_NONE);
116 config_found(self, __UNCONST("par"), simple_devprint, CFARGS_NONE);
117 config_found(self, __UNCONST("kbd"), simple_devprint, CFARGS_NONE);
118 config_found(self, __UNCONST("ms"), simple_devprint, CFARGS_NONE);
119 config_found(self, __UNCONST("grfcc"), simple_devprint, CFARGS_NONE);
120 config_found(self, __UNCONST("amidisplaycc"), simple_devprint,
121 CFARGS_NONE);
122 config_found(self, __UNCONST("fdc"), simple_devprint, CFARGS_NONE);
123 if (is_a4000() || is_a1200())
124 config_found(self, __UNCONST("wdc"), simple_devprint,
125 CFARGS_NONE);
126 if (is_a4000()) /* Try to configure A4000T SCSI */
127 config_found(self, __UNCONST("afsc"), simple_devprint,
128 CFARGS_NONE);
129 if (is_a3000())
130 config_found(self, __UNCONST("ahsc"), simple_devprint,
131 CFARGS_NONE);
132 if (is_a1200())
133 config_found(self, __UNCONST("pccard"), simple_devprint,
134 CFARGS_NONE);
135 config_found(self, __UNCONST("aucc"), simple_devprint, CFARGS_NONE);
136
137 config_found(self, __UNCONST("zbus"), simple_devprint, CFARGS_NONE);
138 }
139
140 int
mbprint(void * aux,const char * pnp)141 mbprint(void *aux, const char *pnp)
142 {
143
144 if (pnp)
145 aprint_normal("%s at %s", (char *)aux, pnp);
146 return UNCONF;
147 }
148