struct device * -> device_t, struct cfdata * -> cfdata_t CFATTACH_DECL(*, sizeof(struct device), -> CFATTACH_DECL_NEW(&, 0diff -r1.21 -r1.22 src/sys/arch/algor/dev/mainbus.c
(matt)
--- src/sys/arch/algor/dev/mainbus.c 2011/02/20 07:51:21 1.21
+++ src/sys/arch/algor/dev/mainbus.c 2011/06/05 17:03:18 1.22
@@ -1,260 +1,260 @@ | @@ -1,260 +1,260 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.21 2011/02/20 07:51:21 matt Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.22 2011/06/05 17:03:18 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe. | 8 | * by Jason R. Thorpe. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2011/02/20 07:51:21 matt Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.22 2011/06/05 17:03:18 matt Exp $"); | |
34 | 34 | |||
35 | #include "opt_algor_p4032.h" | 35 | #include "opt_algor_p4032.h" | |
36 | #include "opt_algor_p5064.h" | 36 | #include "opt_algor_p5064.h" | |
37 | #include "opt_algor_p6032.h" | 37 | #include "opt_algor_p6032.h" | |
38 | 38 | |||
39 | #include "opt_pci.h" | 39 | #include "opt_pci.h" | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/systm.h> | 42 | #include <sys/systm.h> | |
43 | #include <sys/conf.h> | 43 | #include <sys/conf.h> | |
44 | #include <sys/reboot.h> | 44 | #include <sys/reboot.h> | |
45 | #include <sys/device.h> | 45 | #include <sys/device.h> | |
46 | #include <sys/malloc.h> | 46 | #include <sys/malloc.h> | |
47 | #include <sys/extent.h> | 47 | #include <sys/extent.h> | |
48 | 48 | |||
49 | #include <machine/bus.h> | 49 | #include <machine/bus.h> | |
50 | #include <machine/autoconf.h> | 50 | #include <machine/autoconf.h> | |
51 | 51 | |||
52 | #include <mips/cache.h> | 52 | #include <mips/cache.h> | |
53 | 53 | |||
54 | #include <dev/pci/pcivar.h> | 54 | #include <dev/pci/pcivar.h> | |
55 | #include <dev/pci/pciconf.h> | 55 | #include <dev/pci/pciconf.h> | |
56 | 56 | |||
57 | #if defined(PCI_NETBSD_CONFIGURE) && defined(PCI_NETBSD_ENABLE_IDE) | 57 | #if defined(PCI_NETBSD_CONFIGURE) && defined(PCI_NETBSD_ENABLE_IDE) | |
58 | #if defined(ALGOR_P5064) || defined(ALGOR_P6032) | 58 | #if defined(ALGOR_P5064) || defined(ALGOR_P6032) | |
59 | #include <dev/pci/pciide_piix_reg.h> | 59 | #include <dev/pci/pciide_piix_reg.h> | |
60 | #endif /* ALGOR_P5064 || ALGOR_P6032 */ | 60 | #endif /* ALGOR_P5064 || ALGOR_P6032 */ | |
61 | #endif /* PCI_NETBSD_CONFIGURE && PCI_NETBSD_ENABLE_IDE */ | 61 | #endif /* PCI_NETBSD_CONFIGURE && PCI_NETBSD_ENABLE_IDE */ | |
62 | 62 | |||
63 | #include "locators.h" | 63 | #include "locators.h" | |
64 | #include "pci.h" | 64 | #include "pci.h" | |
65 | 65 | |||
66 | int mainbus_match(struct device *, struct cfdata *, void *); | 66 | int mainbus_match(device_t, cfdata_t, void *); | |
67 | void mainbus_attach(struct device *, struct device *, void *); | 67 | void mainbus_attach(device_t, device_t, void *); | |
68 | 68 | |||
69 | CFATTACH_DECL(mainbus, sizeof(struct device), | 69 | CFATTACH_DECL_NEW(mainbus, 0, | |
70 | mainbus_match, mainbus_attach, NULL, NULL); | 70 | mainbus_match, mainbus_attach, NULL, NULL); | |
71 | 71 | |||
72 | int mainbus_print(void *, const char *); | 72 | int mainbus_print(void *, const char *); | |
73 | int mainbus_submatch(struct device *, struct cfdata *, | 73 | int mainbus_submatch(device_t, cfdata_t, | |
74 | const int *, void *); | 74 | const int *, void *); | |
75 | 75 | |||
76 | /* There can be only one. */ | 76 | /* There can be only one. */ | |
77 | int mainbus_found; | 77 | int mainbus_found; | |
78 | 78 | |||
79 | struct mainbusdev { | 79 | struct mainbusdev { | |
80 | const char *md_name; | 80 | const char *md_name; | |
81 | bus_addr_t md_addr; | 81 | bus_addr_t md_addr; | |
82 | int md_irq; | 82 | int md_irq; | |
83 | }; | 83 | }; | |
84 | 84 | |||
85 | #if defined(ALGOR_P4032) | 85 | #if defined(ALGOR_P4032) | |
86 | #include <algor/algor/algor_p4032reg.h> | 86 | #include <algor/algor/algor_p4032reg.h> | |
87 | #include <algor/algor/algor_p4032var.h> | 87 | #include <algor/algor/algor_p4032var.h> | |
88 | 88 | |||
89 | struct mainbusdev mainbusdevs[] = { | 89 | struct mainbusdev mainbusdevs[] = { | |
90 | { "cpu", -1, -1 }, | 90 | { "cpu", -1, -1 }, | |
91 | { "mcclock", P4032_RTC, P4032_IRQ_RTC }, | 91 | { "mcclock", P4032_RTC, P4032_IRQ_RTC }, | |
92 | { "com", P4032_COM1, P4032_IRQ_COM1 }, | 92 | { "com", P4032_COM1, P4032_IRQ_COM1 }, | |
93 | { "com", P4032_COM2, P4032_IRQ_COM2 }, | 93 | { "com", P4032_COM2, P4032_IRQ_COM2 }, | |
94 | { "lpt", P4032_LPT, P4032_IRQ_LPT }, | 94 | { "lpt", P4032_LPT, P4032_IRQ_LPT }, | |
95 | { "pckbc", P4032_PCKBC, P4032_IRQ_PCKBC }, | 95 | { "pckbc", P4032_PCKBC, P4032_IRQ_PCKBC }, | |
96 | { "fdc", P4032_FDC, P4032_IRQ_FLOPPY }, | 96 | { "fdc", P4032_FDC, P4032_IRQ_FLOPPY }, | |
97 | { "vtpbc", P4032_V962PBC, -1 }, | 97 | { "vtpbc", P4032_V962PBC, -1 }, | |
98 | 98 | |||
99 | { NULL, 0, 0 }, | 99 | { NULL, 0, 0 }, | |
100 | }; | 100 | }; | |
101 | #endif /* ALGOR_P4032 */ | 101 | #endif /* ALGOR_P4032 */ | |
102 | 102 | |||
103 | #if defined(ALGOR_P5064) | 103 | #if defined(ALGOR_P5064) | |
104 | #include <algor/algor/algor_p5064reg.h> | 104 | #include <algor/algor/algor_p5064reg.h> | |
105 | #include <algor/algor/algor_p5064var.h> | 105 | #include <algor/algor/algor_p5064var.h> | |
106 | 106 | |||
107 | struct mainbusdev mainbusdevs[] = { | 107 | struct mainbusdev mainbusdevs[] = { | |
108 | { "cpu", -1, -1 }, | 108 | { "cpu", -1, -1 }, | |
109 | { "vtpbc", P5064_V360EPC, -1 }, | 109 | { "vtpbc", P5064_V360EPC, -1 }, | |
110 | 110 | |||
111 | { NULL, 0, 0 }, | 111 | { NULL, 0, 0 }, | |
112 | }; | 112 | }; | |
113 | #endif /* ALGOR_P5064 */ | 113 | #endif /* ALGOR_P5064 */ | |
114 | 114 | |||
115 | #if defined(ALGOR_P6032) | 115 | #if defined(ALGOR_P6032) | |
116 | #include <algor/algor/algor_p6032reg.h> | 116 | #include <algor/algor/algor_p6032reg.h> | |
117 | #include <algor/algor/algor_p6032var.h> | 117 | #include <algor/algor/algor_p6032var.h> | |
118 | 118 | |||
119 | struct mainbusdev mainbusdevs[] = { | 119 | struct mainbusdev mainbusdevs[] = { | |
120 | { "cpu", -1, -1 }, | 120 | { "cpu", -1, -1 }, | |
121 | { "bonito", BONITO_REG_BASE, -1 }, | 121 | { "bonito", BONITO_REG_BASE, -1 }, | |
122 | 122 | |||
123 | { NULL, 0, 0 }, | 123 | { NULL, 0, 0 }, | |
124 | }; | 124 | }; | |
125 | #endif /* ALGOR_P6032 */ | 125 | #endif /* ALGOR_P6032 */ | |
126 | 126 | |||
127 | int | 127 | int | |
128 | mainbus_match(struct device *parent, struct cfdata *cf, void *aux) | 128 | mainbus_match(device_t parent, cfdata_t cf, void *aux) | |
129 | { | 129 | { | |
130 | 130 | |||
131 | if (mainbus_found) | 131 | if (mainbus_found) | |
132 | return (0); | 132 | return (0); | |
133 | 133 | |||
134 | return (1); | 134 | return (1); | |
135 | } | 135 | } | |
136 | 136 | |||
137 | void | 137 | void | |
138 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 138 | mainbus_attach(device_t parent, device_t self, void *aux) | |
139 | { | 139 | { | |
140 | struct mainbus_attach_args ma; | 140 | struct mainbus_attach_args ma; | |
141 | struct mainbusdev *md; | 141 | struct mainbusdev *md; | |
142 | bus_space_tag_t st; | 142 | bus_space_tag_t st; | |
143 | #if defined(PCI_NETBSD_CONFIGURE) | 143 | #if defined(PCI_NETBSD_CONFIGURE) | |
144 | struct extent *ioext, *memext; | 144 | struct extent *ioext, *memext; | |
145 | pci_chipset_tag_t pc; | 145 | pci_chipset_tag_t pc; | |
146 | #if defined(PCI_NETBSD_ENABLE_IDE) | 146 | #if defined(PCI_NETBSD_ENABLE_IDE) | |
147 | pcitag_t idetag; | 147 | pcitag_t idetag; | |
148 | pcireg_t idetim; | 148 | pcireg_t idetim; | |
149 | #endif | 149 | #endif | |
150 | #endif | 150 | #endif | |
151 | 151 | |||
152 | mainbus_found = 1; | 152 | mainbus_found = 1; | |
153 | 153 | |||
154 | printf("\n"); | 154 | printf("\n"); | |
155 | 155 | |||
156 | #if NPCI > 0 && defined(PCI_NETBSD_CONFIGURE) | 156 | #if NPCI > 0 && defined(PCI_NETBSD_CONFIGURE) | |
157 | #if defined(ALGOR_P4032) | 157 | #if defined(ALGOR_P4032) | |
158 | /* | 158 | /* | |
159 | * Reserve the bottom 64K of the I/O space for ISA devices. | 159 | * Reserve the bottom 64K of the I/O space for ISA devices. | |
160 | */ | 160 | */ | |
161 | ioext = extent_create("pciio", 0x00010000, 0x000effff, | 161 | ioext = extent_create("pciio", 0x00010000, 0x000effff, | |
162 | M_DEVBUF, NULL, 0, EX_NOWAIT); | 162 | M_DEVBUF, NULL, 0, EX_NOWAIT); | |
163 | memext = extent_create("pcimem", 0x01000000, 0x07ffffff, | 163 | memext = extent_create("pcimem", 0x01000000, 0x07ffffff, | |
164 | M_DEVBUF, NULL, 0, EX_NOWAIT); | 164 | M_DEVBUF, NULL, 0, EX_NOWAIT); | |
165 | 165 | |||
166 | pc = &p4032_configuration.ac_pc; | 166 | pc = &p4032_configuration.ac_pc; | |
167 | #elif defined(ALGOR_P5064) | 167 | #elif defined(ALGOR_P5064) | |
168 | /* | 168 | /* | |
169 | * Reserve the bottom 512K of the I/O space for ISA devices. | 169 | * Reserve the bottom 512K of the I/O space for ISA devices. | |
170 | * According to the PMON sources, this is a work-around for | 170 | * According to the PMON sources, this is a work-around for | |
171 | * a bug in the ISA bridge. | 171 | * a bug in the ISA bridge. | |
172 | */ | 172 | */ | |
173 | ioext = extent_create("pciio", 0x00080000, 0x00ffffff, | 173 | ioext = extent_create("pciio", 0x00080000, 0x00ffffff, | |
174 | M_DEVBUF, NULL, 0, EX_NOWAIT); | 174 | M_DEVBUF, NULL, 0, EX_NOWAIT); | |
175 | memext = extent_create("pcimem", 0x01000000, 0x07ffffff, | 175 | memext = extent_create("pcimem", 0x01000000, 0x07ffffff, | |
176 | M_DEVBUF, NULL, 0, EX_NOWAIT); | 176 | M_DEVBUF, NULL, 0, EX_NOWAIT); | |
177 | 177 | |||
178 | pc = &p5064_configuration.ac_pc; | 178 | pc = &p5064_configuration.ac_pc; | |
179 | #if defined(PCI_NETBSD_ENABLE_IDE) | 179 | #if defined(PCI_NETBSD_ENABLE_IDE) | |
180 | idetag = pci_make_tag(pc, 0, 2, 1); | 180 | idetag = pci_make_tag(pc, 0, 2, 1); | |
181 | #endif | 181 | #endif | |
182 | #elif defined(ALGOR_P6032) | 182 | #elif defined(ALGOR_P6032) | |
183 | /* | 183 | /* | |
184 | * Reserve the bottom 64K of the I/O space for ISA devices. | 184 | * Reserve the bottom 64K of the I/O space for ISA devices. | |
185 | */ | 185 | */ | |
186 | ioext = extent_create("pciio", 0x00010000, 0x000effff, | 186 | ioext = extent_create("pciio", 0x00010000, 0x000effff, | |
187 | M_DEVBUF, NULL, 0, EX_NOWAIT); | 187 | M_DEVBUF, NULL, 0, EX_NOWAIT); | |
188 | memext = extent_create("pcimem", 0x01000000, 0x0affffff, | 188 | memext = extent_create("pcimem", 0x01000000, 0x0affffff, | |
189 | M_DEVBUF, NULL, 0, EX_NOWAIT); | 189 | M_DEVBUF, NULL, 0, EX_NOWAIT); | |
190 | 190 | |||
191 | pc = &p6032_configuration.ac_pc; | 191 | pc = &p6032_configuration.ac_pc; | |
192 | #if defined(PCI_NETBSD_ENABLE_IDE) | 192 | #if defined(PCI_NETBSD_ENABLE_IDE) | |
193 | idetag = pci_make_tag(pc, 0, 17, 1); | 193 | idetag = pci_make_tag(pc, 0, 17, 1); | |
194 | #endif | 194 | #endif | |
195 | #endif /* ALGOR_P4032 || ALGOR_P5064 || ALGOR_P6032 */ | 195 | #endif /* ALGOR_P4032 || ALGOR_P5064 || ALGOR_P6032 */ | |
196 | 196 | |||
197 | pci_configure_bus(pc, ioext, memext, NULL, 0, mips_cache_info.mci_dcache_align); | 197 | pci_configure_bus(pc, ioext, memext, NULL, 0, mips_cache_info.mci_dcache_align); | |
198 | extent_destroy(ioext); | 198 | extent_destroy(ioext); | |
199 | extent_destroy(memext); | 199 | extent_destroy(memext); | |
200 | 200 | |||
201 | #if defined(PCI_NETBSD_ENABLE_IDE) | 201 | #if defined(PCI_NETBSD_ENABLE_IDE) | |
202 | /* | 202 | /* | |
203 | * Perhaps PMON has not enabled the IDE controller. Easy to | 203 | * Perhaps PMON has not enabled the IDE controller. Easy to | |
204 | * fix -- just set the ENABLE bits for each channel in the | 204 | * fix -- just set the ENABLE bits for each channel in the | |
205 | * IDETIM register. Just clear all the bits for the channel | 205 | * IDETIM register. Just clear all the bits for the channel | |
206 | * except for the ENABLE bits -- the `pciide' driver will | 206 | * except for the ENABLE bits -- the `pciide' driver will | |
207 | * properly configure it later. | 207 | * properly configure it later. | |
208 | */ | 208 | */ | |
209 | idetim = 0; | 209 | idetim = 0; | |
210 | if (PCI_NETBSD_ENABLE_IDE & 0x01) | 210 | if (PCI_NETBSD_ENABLE_IDE & 0x01) | |
211 | idetim = PIIX_IDETIM_SET(idetim, PIIX_IDETIM_IDE, 0); | 211 | idetim = PIIX_IDETIM_SET(idetim, PIIX_IDETIM_IDE, 0); | |
212 | if (PCI_NETBSD_ENABLE_IDE & 0x02) | 212 | if (PCI_NETBSD_ENABLE_IDE & 0x02) | |
213 | idetim = PIIX_IDETIM_SET(idetim, PIIX_IDETIM_IDE, 1); | 213 | idetim = PIIX_IDETIM_SET(idetim, PIIX_IDETIM_IDE, 1); | |
214 | pci_conf_write(pc, idetag, PIIX_IDETIM, idetim); | 214 | pci_conf_write(pc, idetag, PIIX_IDETIM, idetim); | |
215 | #endif | 215 | #endif | |
216 | #endif /* NPCI > 0 && defined(PCI_NETBSD_CONFIGURE) */ | 216 | #endif /* NPCI > 0 && defined(PCI_NETBSD_CONFIGURE) */ | |
217 | 217 | |||
218 | #if defined(ALGOR_P4032) | 218 | #if defined(ALGOR_P4032) | |
219 | st = &p4032_configuration.ac_lociot; | 219 | st = &p4032_configuration.ac_lociot; | |
220 | #elif defined(ALGOR_P5064) | 220 | #elif defined(ALGOR_P5064) | |
221 | st = NULL; | 221 | st = NULL; | |
222 | #elif defined(ALGOR_P6032) | 222 | #elif defined(ALGOR_P6032) | |
223 | st = NULL; | 223 | st = NULL; | |
224 | #endif | 224 | #endif | |
225 | 225 | |||
226 | for (md = mainbusdevs; md->md_name != NULL; md++) { | 226 | for (md = mainbusdevs; md->md_name != NULL; md++) { | |
227 | ma.ma_name = md->md_name; | 227 | ma.ma_name = md->md_name; | |
228 | ma.ma_st = st; | 228 | ma.ma_st = st; | |
229 | ma.ma_addr = md->md_addr; | 229 | ma.ma_addr = md->md_addr; | |
230 | ma.ma_irq = md->md_irq; | 230 | ma.ma_irq = md->md_irq; | |
231 | (void) config_found_sm_loc(self, "mainbus", NULL, &ma, | 231 | (void) config_found_sm_loc(self, "mainbus", NULL, &ma, | |
232 | mainbus_print, mainbus_submatch); | 232 | mainbus_print, mainbus_submatch); | |
233 | } | 233 | } | |
234 | } | 234 | } | |
235 | 235 | |||
236 | int | 236 | int | |
237 | mainbus_print(void *aux, const char *pnp) | 237 | mainbus_print(void *aux, const char *pnp) | |
238 | { | 238 | { | |
239 | struct mainbus_attach_args *ma = aux; | 239 | struct mainbus_attach_args *ma = aux; | |
240 | 240 | |||
241 | if (pnp) | 241 | if (pnp) | |
242 | aprint_normal("%s at %s", ma->ma_name, pnp); | 242 | aprint_normal("%s at %s", ma->ma_name, pnp); | |
243 | if (ma->ma_addr != (bus_addr_t) -1) | 243 | if (ma->ma_addr != (bus_addr_t) -1) | |
244 | aprint_normal(" addr 0x%lx", ma->ma_addr); | 244 | aprint_normal(" addr 0x%lx", ma->ma_addr); | |
245 | 245 | |||
246 | return (UNCONF); | 246 | return (UNCONF); | |
247 | } | 247 | } | |
248 | 248 | |||
249 | int | 249 | int | |
250 | mainbus_submatch(struct device *parent, struct cfdata *cf, | 250 | mainbus_submatch(device_t parent, cfdata_t cf, | |
251 | const int *ldesc, void *aux) | 251 | const int *ldesc, void *aux) | |
252 | { | 252 | { | |
253 | struct mainbus_attach_args *ma = aux; | 253 | struct mainbus_attach_args *ma = aux; | |
254 | 254 | |||
255 | if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT && | 255 | if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT && | |
256 | cf->cf_loc[MAINBUSCF_ADDR] != ma->ma_addr) | 256 | cf->cf_loc[MAINBUSCF_ADDR] != ma->ma_addr) | |
257 | return (0); | 257 | return (0); | |
258 | 258 | |||
259 | return (config_match(parent, cf, aux)); | 259 | return (config_match(parent, cf, aux)); | |
260 | } | 260 | } |
--- src/sys/arch/amigappc/amigappc/cpu.c 2009/07/21 09:49:15 1.1
+++ src/sys/arch/amigappc/amigappc/cpu.c 2011/06/05 17:03:16 1.2
@@ -1,69 +1,69 @@ | @@ -1,69 +1,69 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.1 2009/07/21 09:49:15 phx Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.2 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2008,2009 Frank Wille. | 4 | * Copyright (c) 2008,2009 Frank Wille. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Frank Wille for The NetBSD Project. | 7 | * Written by Frank Wille for The NetBSD Project. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 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 | 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 | 20 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 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 | 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 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 | 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
28 | * POSSIBILITY OF SUCH DAMAGE. | 28 | * POSSIBILITY OF SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.1 2009/07/21 09:49:15 phx Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.2 2011/06/05 17:03:16 matt Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | 37 | |||
38 | #include <machine/autoconf.h> | 38 | #include <machine/autoconf.h> | |
39 | #include <machine/bus.h> | 39 | #include <machine/bus.h> | |
40 | #include <machine/cpu.h> | 40 | #include <machine/cpu.h> | |
41 | 41 | |||
42 | #include <amiga/amiga/device.h> | 42 | #include <amiga/amiga/device.h> | |
43 | 43 | |||
44 | int cpu_match(struct device *, struct cfdata *, void *); | 44 | int cpu_match(device_t, cfdata_t, void *); | |
45 | void cpu_attach(struct device *, struct device *, void *); | 45 | void cpu_attach(device_t, device_t, void *); | |
46 | 46 | |||
47 | CFATTACH_DECL(cpu, sizeof(struct device), | 47 | CFATTACH_DECL_NEW(cpu, 0, | |
48 | cpu_match, cpu_attach, NULL, NULL); | 48 | cpu_match, cpu_attach, NULL, NULL); | |
49 | 49 | |||
50 | extern struct cfdriver cpu_cd; | 50 | extern struct cfdriver cpu_cd; | |
51 | 51 | |||
52 | int | 52 | int | |
53 | cpu_match(struct device *parent, struct cfdata *cf, void *aux) | 53 | cpu_match(device_t parent, cfdata_t cf, void *aux) | |
54 | { | 54 | { | |
55 | 55 | |||
56 | if (strcmp((char *)aux, cpu_cd.cd_name) != 0) | 56 | if (strcmp((char *)aux, cpu_cd.cd_name) != 0) | |
57 | return 0; | 57 | return 0; | |
58 | if (amiga_realconfig == 0 || cpu_info[0].ci_dev != NULL) | 58 | if (amiga_realconfig == 0 || cpu_info[0].ci_dev != NULL) | |
59 | return 0; | 59 | return 0; | |
60 | return 1; | 60 | return 1; | |
61 | } | 61 | } | |
62 | 62 | |||
63 | void | 63 | void | |
64 | cpu_attach(struct device *parent, struct device *self, void *aux) | 64 | cpu_attach(device_t parent, device_t self, void *aux) | |
65 | { | 65 | { | |
66 | 66 | |||
67 | if (amiga_realconfig) | 67 | if (amiga_realconfig) | |
68 | (void)cpu_attach_common(self, 0); | 68 | (void)cpu_attach_common(self, 0); | |
69 | } | 69 | } |
--- src/sys/arch/amigappc/amigappc/mainbus.c 2010/05/21 12:52:14 1.2
+++ src/sys/arch/amigappc/amigappc/mainbus.c 2011/06/05 17:03:16 1.3
@@ -1,141 +1,141 @@ | @@ -1,141 +1,141 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.2 2010/05/21 12:52:14 phx Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.3 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2008,2009 Frank Wille. | 4 | * Copyright (c) 2008,2009 Frank Wille. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Frank Wille for The NetBSD Project. | 7 | * Written by Frank Wille for The NetBSD Project. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * | 17 | * | |
18 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 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 | 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 | 20 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 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 | 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 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 | 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
28 | * POSSIBILITY OF SUCH DAMAGE. | 28 | * POSSIBILITY OF SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | /* | 30 | /* | |
31 | * Copyright (c) 1994 Christian E. Hopps | 31 | * Copyright (c) 1994 Christian E. Hopps | |
32 | * All rights reserved. | 32 | * All rights reserved. | |
33 | * | 33 | * | |
34 | * Redistribution and use in source and binary forms, with or without | 34 | * Redistribution and use in source and binary forms, with or without | |
35 | * modification, are permitted provided that the following conditions | 35 | * modification, are permitted provided that the following conditions | |
36 | * are met: | 36 | * are met: | |
37 | * 1. Redistributions of source code must retain the above copyright | 37 | * 1. Redistributions of source code must retain the above copyright | |
38 | * notice, this list of conditions and the following disclaimer. | 38 | * notice, this list of conditions and the following disclaimer. | |
39 | * 2. Redistributions in binary form must reproduce the above copyright | 39 | * 2. Redistributions in binary form must reproduce the above copyright | |
40 | * notice, this list of conditions and the following disclaimer in the | 40 | * notice, this list of conditions and the following disclaimer in the | |
41 | * documentation and/or other materials provided with the distribution. | 41 | * documentation and/or other materials provided with the distribution. | |
42 | * 3. All advertising materials mentioning features or use of this software | 42 | * 3. All advertising materials mentioning features or use of this software | |
43 | * must display the following acknowledgement: | 43 | * must display the following acknowledgement: | |
44 | * This product includes software developed by Christian E. Hopps. | 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 | 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 | 46 | * derived from this software without specific prior written permission | |
47 | * | 47 | * | |
48 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 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 | 49 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
50 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 50 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
51 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 51 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
52 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 52 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
53 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 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 | 54 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
55 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 57 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
58 | */ | 58 | */ | |
59 | 59 | |||
60 | #include <sys/cdefs.h> | 60 | #include <sys/cdefs.h> | |
61 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.2 2010/05/21 12:52:14 phx Exp $"); | 61 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3 2011/06/05 17:03:16 matt Exp $"); | |
62 | 62 | |||
63 | #include <sys/param.h> | 63 | #include <sys/param.h> | |
64 | #include <sys/device.h> | 64 | #include <sys/device.h> | |
65 | #include <sys/malloc.h> | 65 | #include <sys/malloc.h> | |
66 | #include <sys/systm.h> | 66 | #include <sys/systm.h> | |
67 | 67 | |||
68 | #include <machine/autoconf.h> | 68 | #include <machine/autoconf.h> | |
69 | #include <machine/bus.h> | 69 | #include <machine/bus.h> | |
70 | 70 | |||
71 | #include <amiga/amiga/cfdev.h> | 71 | #include <amiga/amiga/cfdev.h> | |
72 | #include <amiga/amiga/device.h> | 72 | #include <amiga/amiga/device.h> | |
73 | 73 | |||
74 | #if 0 | 74 | #if 0 | |
75 | #include "mainbus.h" | 75 | #include "mainbus.h" | |
76 | 76 | |||
77 | #if NCPU == 0 | 77 | #if NCPU == 0 | |
78 | #error A cpu device is now required | 78 | #error A cpu device is now required | |
79 | #endif | 79 | #endif | |
80 | #endif | 80 | #endif | |
81 | 81 | |||
82 | void mbattach(struct device *, struct device *, void *); | 82 | void mbattach(device_t, device_t, void *); | |
83 | int mbprint(void *, const char *); | 83 | int mbprint(void *, const char *); | |
84 | int mbmatch(struct device *, struct cfdata *, void *); | 84 | int mbmatch(device_t, cfdata_t, void *); | |
85 | 85 | |||
86 | CFATTACH_DECL(mainbus, sizeof(struct device), | 86 | CFATTACH_DECL_NEW(mainbus, 0, | |
87 | mbmatch, mbattach, NULL, NULL); | 87 | mbmatch, mbattach, NULL, NULL); | |
88 | 88 | |||
89 | int | 89 | int | |
90 | mbmatch(struct device *parent, struct cfdata *cfp, void *aux) | 90 | mbmatch(device_t parent, cfdata_t cfp, void *aux) | |
91 | { | 91 | { | |
92 | 92 | |||
93 | return 1; | 93 | return 1; | |
94 | } | 94 | } | |
95 | 95 | |||
96 | void | 96 | void | |
97 | mbattach(struct device *parent, struct device *self, void *aux) | 97 | mbattach(device_t parent, device_t self, void *aux) | |
98 | { | 98 | { | |
99 | 99 | |||
100 | printf("\n"); | 100 | printf("\n"); | |
101 | 101 | |||
102 | /* | 102 | /* | |
103 | * Always find the CPU | 103 | * Always find the CPU | |
104 | */ | 104 | */ | |
105 | config_found_ia(self, "mainbus", __UNCONST("cpu"), mbprint); | 105 | config_found_ia(self, "mainbus", __UNCONST("cpu"), mbprint); | |
106 | 106 | |||
107 | /* | 107 | /* | |
108 | * "find" all the things that should be there. | 108 | * "find" all the things that should be there. | |
109 | */ | 109 | */ | |
110 | if (is_a3000() || is_a4000()) | 110 | if (is_a3000() || is_a4000()) | |
111 | config_found(self, __UNCONST("a34kbbc"), simple_devprint); | 111 | config_found(self, __UNCONST("a34kbbc"), simple_devprint); | |
112 | else | 112 | else | |
113 | config_found(self, __UNCONST("a2kbbc"), simple_devprint); | 113 | config_found(self, __UNCONST("a2kbbc"), simple_devprint); | |
114 | config_found(self, __UNCONST("ser"), simple_devprint); | 114 | config_found(self, __UNCONST("ser"), simple_devprint); | |
115 | config_found(self, __UNCONST("par"), simple_devprint); | 115 | config_found(self, __UNCONST("par"), simple_devprint); | |
116 | config_found(self, __UNCONST("kbd"), simple_devprint); | 116 | config_found(self, __UNCONST("kbd"), simple_devprint); | |
117 | config_found(self, __UNCONST("ms"), simple_devprint); | 117 | config_found(self, __UNCONST("ms"), simple_devprint); | |
118 | config_found(self, __UNCONST("grfcc"), simple_devprint); | 118 | config_found(self, __UNCONST("grfcc"), simple_devprint); | |
119 | config_found(self, __UNCONST("amidisplaycc"), simple_devprint); | 119 | config_found(self, __UNCONST("amidisplaycc"), simple_devprint); | |
120 | config_found(self, __UNCONST("fdc"), simple_devprint); | 120 | config_found(self, __UNCONST("fdc"), simple_devprint); | |
121 | if (is_a4000() || is_a1200()) | 121 | if (is_a4000() || is_a1200()) | |
122 | config_found(self, __UNCONST("wdc"), simple_devprint); | 122 | config_found(self, __UNCONST("wdc"), simple_devprint); | |
123 | if (is_a4000()) /* Try to configure A4000T SCSI */ | 123 | if (is_a4000()) /* Try to configure A4000T SCSI */ | |
124 | config_found(self, __UNCONST("afsc"), simple_devprint); | 124 | config_found(self, __UNCONST("afsc"), simple_devprint); | |
125 | if (is_a3000()) | 125 | if (is_a3000()) | |
126 | config_found(self, __UNCONST("ahsc"), simple_devprint); | 126 | config_found(self, __UNCONST("ahsc"), simple_devprint); | |
127 | if (is_a1200()) | 127 | if (is_a1200()) | |
128 | config_found(self, __UNCONST("pccard"), simple_devprint); | 128 | config_found(self, __UNCONST("pccard"), simple_devprint); | |
129 | config_found(self, __UNCONST("aucc"), simple_devprint); | 129 | config_found(self, __UNCONST("aucc"), simple_devprint); | |
130 | 130 | |||
131 | config_found(self, __UNCONST("zbus"), simple_devprint); | 131 | config_found(self, __UNCONST("zbus"), simple_devprint); | |
132 | } | 132 | } | |
133 | 133 | |||
134 | int | 134 | int | |
135 | mbprint(void *aux, const char *pnp) | 135 | mbprint(void *aux, const char *pnp) | |
136 | { | 136 | { | |
137 | 137 | |||
138 | if (pnp) | 138 | if (pnp) | |
139 | aprint_normal("%s at %s", (char *)aux, pnp); | 139 | aprint_normal("%s at %s", (char *)aux, pnp); | |
140 | return UNCONF; | 140 | return UNCONF; | |
141 | } | 141 | } |
--- src/sys/arch/arm/mainbus/cpu_mainbus.c 2009/03/14 15:36:02 1.10
+++ src/sys/arch/arm/mainbus/cpu_mainbus.c 2011/06/05 17:03:16 1.11
@@ -1,95 +1,95 @@ | @@ -1,95 +1,95 @@ | |||
1 | /* $NetBSD: cpu_mainbus.c,v 1.10 2009/03/14 15:36:02 dsl Exp $ */ | 1 | /* $NetBSD: cpu_mainbus.c,v 1.11 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1995 Mark Brinicombe. | 4 | * Copyright (c) 1995 Mark Brinicombe. | |
5 | * Copyright (c) 1995 Brini. | 5 | * Copyright (c) 1995 Brini. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * 3. All advertising materials mentioning features or use of this software | 16 | * 3. All advertising materials mentioning features or use of this software | |
17 | * must display the following acknowledgement: | 17 | * must display the following acknowledgement: | |
18 | * This product includes software developed by Brini. | 18 | * This product includes software developed by Brini. | |
19 | * 4. The name of the company nor the name of the author may be used to | 19 | * 4. The name of the company nor the name of the author may be used to | |
20 | * endorse or promote products derived from this software without specific | 20 | * endorse or promote products derived from this software without specific | |
21 | * prior written permission. | 21 | * prior written permission. | |
22 | * | 22 | * | |
23 | * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED | 23 | * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
26 | * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | 26 | * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
27 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 27 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
33 | * SUCH DAMAGE. | 33 | * SUCH DAMAGE. | |
34 | * | 34 | * | |
35 | * RiscBSD kernel project | 35 | * RiscBSD kernel project | |
36 | * | 36 | * | |
37 | * cpu.c | 37 | * cpu.c | |
38 | * | 38 | * | |
39 | * Probing and configuration for the master cpu | 39 | * Probing and configuration for the master cpu | |
40 | * | 40 | * | |
41 | * Created : 10/10/95 | 41 | * Created : 10/10/95 | |
42 | */ | 42 | */ | |
43 | 43 | |||
44 | #include <sys/cdefs.h> | 44 | #include <sys/cdefs.h> | |
45 | __KERNEL_RCSID(0, "$NetBSD: cpu_mainbus.c,v 1.10 2009/03/14 15:36:02 dsl Exp $"); | 45 | __KERNEL_RCSID(0, "$NetBSD: cpu_mainbus.c,v 1.11 2011/06/05 17:03:16 matt Exp $"); | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/systm.h> | 48 | #include <sys/systm.h> | |
49 | #include <sys/malloc.h> | 49 | #include <sys/malloc.h> | |
50 | #include <sys/device.h> | 50 | #include <sys/device.h> | |
51 | #include <sys/proc.h> | 51 | #include <sys/proc.h> | |
52 | #if 0 | 52 | #if 0 | |
53 | #include <sys/conf.h> | 53 | #include <sys/conf.h> | |
54 | #include <uvm/uvm_extern.h> | 54 | #include <uvm/uvm_extern.h> | |
55 | #include <machine/io.h> | 55 | #include <machine/io.h> | |
56 | #endif | 56 | #endif | |
57 | #include <machine/cpu.h> | 57 | #include <machine/cpu.h> | |
58 | #if 0 | 58 | #if 0 | |
59 | #include <arm/cpus.h> | 59 | #include <arm/cpus.h> | |
60 | #include <arm/undefined.h> | 60 | #include <arm/undefined.h> | |
61 | #endif | 61 | #endif | |
62 | 62 | |||
63 | /* | 63 | /* | |
64 | * Prototypes | 64 | * Prototypes | |
65 | */ | 65 | */ | |
66 | static int cpu_mainbus_match(struct device *, struct cfdata *, void *); | 66 | static int cpu_mainbus_match(device_t, cfdata_t, void *); | |
67 | static void cpu_mainbus_attach(struct device *, struct device *, void *); | 67 | static void cpu_mainbus_attach(device_t, device_t, void *); | |
68 | 68 | |||
69 | /* | 69 | /* | |
70 | * int cpumatch(struct device *parent, struct cfdata *cf, void *aux) | 70 | * int cpumatch(device_t parent, cfdata_t cf, void *aux) | |
71 | * | 71 | * | |
72 | * Probe for the main cpu. Currently all this does is return 1 to | 72 | * Probe for the main cpu. Currently all this does is return 1 to | |
73 | * indicate that the cpu was found. | 73 | * indicate that the cpu was found. | |
74 | */ | 74 | */ | |
75 | 75 | |||
76 | static int | 76 | static int | |
77 | cpu_mainbus_match(struct device *parent, struct cfdata *cf, void *aux) | 77 | cpu_mainbus_match(device_t parent, cfdata_t cf, void *aux) | |
78 | { | 78 | { | |
79 | return(1); | 79 | return(1); | |
80 | } | 80 | } | |
81 | 81 | |||
82 | /* | 82 | /* | |
83 | * void cpusattach(struct device *parent, struct device *dev, void *aux) | 83 | * void cpusattach(device_t parent, device_t dev, void *aux) | |
84 | * | 84 | * | |
85 | * Attach the main cpu | 85 | * Attach the main cpu | |
86 | */ | 86 | */ | |
87 | 87 | |||
88 | static void | 88 | static void | |
89 | cpu_mainbus_attach(struct device *parent, struct device *self, void *aux) | 89 | cpu_mainbus_attach(device_t parent, device_t self, void *aux) | |
90 | { | 90 | { | |
91 | cpu_attach(self); | 91 | cpu_attach(self); | |
92 | } | 92 | } | |
93 | 93 | |||
94 | CFATTACH_DECL(cpu_mainbus, sizeof(struct device), | 94 | CFATTACH_DECL_NEW(cpu_mainbus, 0, | |
95 | cpu_mainbus_match, cpu_mainbus_attach, NULL, NULL); | 95 | cpu_mainbus_match, cpu_mainbus_attach, NULL, NULL); |
--- src/sys/arch/arm/mainbus/mainbus.c 2009/03/14 15:36:02 1.16
+++ src/sys/arch/arm/mainbus/mainbus.c 2011/06/05 17:03:16 1.17
@@ -1,172 +1,172 @@ | @@ -1,172 +1,172 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.16 2009/03/14 15:36:02 dsl Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.17 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1994,1995 Mark Brinicombe. | 4 | * Copyright (c) 1994,1995 Mark Brinicombe. | |
5 | * Copyright (c) 1994 Brini. | 5 | * Copyright (c) 1994 Brini. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * 3. All advertising materials mentioning features or use of this software | 16 | * 3. All advertising materials mentioning features or use of this software | |
17 | * must display the following acknowledgement: | 17 | * must display the following acknowledgement: | |
18 | * This product includes software developed by Brini. | 18 | * This product includes software developed by Brini. | |
19 | * 4. The name of the company nor the name of the author may be used to | 19 | * 4. The name of the company nor the name of the author may be used to | |
20 | * endorse or promote products derived from this software without specific | 20 | * endorse or promote products derived from this software without specific | |
21 | * prior written permission. | 21 | * prior written permission. | |
22 | * | 22 | * | |
23 | * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED | 23 | * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 24 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 25 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
26 | * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | 26 | * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
27 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 27 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 28 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 29 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
33 | * SUCH DAMAGE. | 33 | * SUCH DAMAGE. | |
34 | * | 34 | * | |
35 | * RiscBSD kernel project | 35 | * RiscBSD kernel project | |
36 | * | 36 | * | |
37 | * mainbus.c | 37 | * mainbus.c | |
38 | * | 38 | * | |
39 | * mainbus configuration | 39 | * mainbus configuration | |
40 | * | 40 | * | |
41 | * Created : 15/12/94 | 41 | * Created : 15/12/94 | |
42 | */ | 42 | */ | |
43 | 43 | |||
44 | #include <sys/cdefs.h> | 44 | #include <sys/cdefs.h> | |
45 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.16 2009/03/14 15:36:02 dsl Exp $"); | 45 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.17 2011/06/05 17:03:16 matt Exp $"); | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/systm.h> | 48 | #include <sys/systm.h> | |
49 | #include <sys/kernel.h> | 49 | #include <sys/kernel.h> | |
50 | #include <sys/conf.h> | 50 | #include <sys/conf.h> | |
51 | #include <sys/malloc.h> | 51 | #include <sys/malloc.h> | |
52 | #include <sys/device.h> | 52 | #include <sys/device.h> | |
53 | 53 | |||
54 | #if defined(arm32) /* XXX */ | 54 | #if defined(arm32) /* XXX */ | |
55 | #include <machine/io.h> | 55 | #include <machine/io.h> | |
56 | #endif | 56 | #endif | |
57 | #include <machine/bus.h> | 57 | #include <machine/bus.h> | |
58 | #include <arm/mainbus/mainbus.h> | 58 | #include <arm/mainbus/mainbus.h> | |
59 | #include "locators.h" | 59 | #include "locators.h" | |
60 | 60 | |||
61 | /* | 61 | /* | |
62 | * mainbus is a root device so we a bus space tag to pass to children | 62 | * mainbus is a root device so we a bus space tag to pass to children | |
63 | * | 63 | * | |
64 | * The tag is provided by mainbus_io.c and mainbus_io_asm.S | 64 | * The tag is provided by mainbus_io.c and mainbus_io_asm.S | |
65 | */ | 65 | */ | |
66 | 66 | |||
67 | extern struct bus_space mainbus_bs_tag; | 67 | extern struct bus_space mainbus_bs_tag; | |
68 | 68 | |||
69 | /* Prototypes for functions provided */ | 69 | /* Prototypes for functions provided */ | |
70 | 70 | |||
71 | static int mainbusmatch(struct device *, struct cfdata *, void *); | 71 | static int mainbusmatch(device_t, cfdata_t, void *); | |
72 | static void mainbusattach(struct device *, struct device *, void *); | 72 | static void mainbusattach(device_t, device_t, void *); | |
73 | static int mainbusprint(void *aux, const char *mainbus); | 73 | static int mainbusprint(void *aux, const char *mainbus); | |
74 | static int mainbussearch(struct device *, struct cfdata *, | 74 | static int mainbussearch(device_t, cfdata_t, | |
75 | const int *, void *); | 75 | const int *, void *); | |
76 | 76 | |||
77 | /* attach and device structures for the device */ | 77 | /* attach and device structures for the device */ | |
78 | 78 | |||
79 | CFATTACH_DECL(mainbus, sizeof(struct device), | 79 | CFATTACH_DECL_NEW(mainbus, 0, | |
80 | mainbusmatch, mainbusattach, NULL, NULL); | 80 | mainbusmatch, mainbusattach, NULL, NULL); | |
81 | 81 | |||
82 | /* | 82 | /* | |
83 | * int mainbusmatch(struct device *parent, struct cfdata *cf, void *aux) | 83 | * int mainbusmatch(device_t parent, cfdata_t cf, void *aux) | |
84 | * | 84 | * | |
85 | * Always match for unit 0 | 85 | * Always match for unit 0 | |
86 | */ | 86 | */ | |
87 | 87 | |||
88 | static int | 88 | static int | |
89 | mainbusmatch(struct device *parent, struct cfdata *cf, void *aux) | 89 | mainbusmatch(device_t parent, cfdata_t cf, void *aux) | |
90 | { | 90 | { | |
91 | return (1); | 91 | return (1); | |
92 | } | 92 | } | |
93 | 93 | |||
94 | /* | 94 | /* | |
95 | * int mainbusprint(void *aux, const char *mainbus) | 95 | * int mainbusprint(void *aux, const char *mainbus) | |
96 | * | 96 | * | |
97 | * print routine used during config of children | 97 | * print routine used during config of children | |
98 | */ | 98 | */ | |
99 | 99 | |||
100 | static int | 100 | static int | |
101 | mainbusprint(void *aux, const char *mainbus) | 101 | mainbusprint(void *aux, const char *mainbus) | |
102 | { | 102 | { | |
103 | struct mainbus_attach_args *mb = aux; | 103 | struct mainbus_attach_args *mb = aux; | |
104 | 104 | |||
105 | if (mb->mb_iobase != MAINBUSCF_BASE_DEFAULT) | 105 | if (mb->mb_iobase != MAINBUSCF_BASE_DEFAULT) | |
106 | aprint_normal(" base 0x%x", mb->mb_iobase); | 106 | aprint_normal(" base 0x%x", mb->mb_iobase); | |
107 | if (mb->mb_iosize > 1) | 107 | if (mb->mb_iosize > 1) | |
108 | aprint_normal("-0x%x", mb->mb_iobase + mb->mb_iosize - 1); | 108 | aprint_normal("-0x%x", mb->mb_iobase + mb->mb_iosize - 1); | |
109 | if (mb->mb_irq != -1) | 109 | if (mb->mb_irq != -1) | |
110 | aprint_normal(" irq %d", mb->mb_irq); | 110 | aprint_normal(" irq %d", mb->mb_irq); | |
111 | if (mb->mb_drq != -1) | 111 | if (mb->mb_drq != -1) | |
112 | aprint_normal(" drq 0x%08x", mb->mb_drq); | 112 | aprint_normal(" drq 0x%08x", mb->mb_drq); | |
113 | 113 | |||
114 | /* XXXX print flags */ | 114 | /* XXXX print flags */ | |
115 | return (QUIET); | 115 | return (QUIET); | |
116 | } | 116 | } | |
117 | 117 | |||
118 | /* | 118 | /* | |
119 | * int mainbussearch(struct device *parent, struct device *self, void *aux) | 119 | * int mainbussearch(device_t parent, device_t self, void *aux) | |
120 | * | 120 | * | |
121 | * search routine used during the config of children | 121 | * search routine used during the config of children | |
122 | */ | 122 | */ | |
123 | 123 | |||
124 | static int | 124 | static int | |
125 | mainbussearch(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) | 125 | mainbussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux) | |
126 | { | 126 | { | |
127 | struct mainbus_attach_args mb; | 127 | struct mainbus_attach_args mb; | |
128 | int tryagain; | 128 | int tryagain; | |
129 | 129 | |||
130 | do { | 130 | do { | |
131 | if (cf->cf_loc[MAINBUSCF_BASE] == MAINBUSCF_BASE_DEFAULT) { | 131 | if (cf->cf_loc[MAINBUSCF_BASE] == MAINBUSCF_BASE_DEFAULT) { | |
132 | mb.mb_iobase = MAINBUSCF_BASE_DEFAULT; | 132 | mb.mb_iobase = MAINBUSCF_BASE_DEFAULT; | |
133 | mb.mb_iosize = 0; | 133 | mb.mb_iosize = 0; | |
134 | mb.mb_drq = MAINBUSCF_DACK_DEFAULT; | 134 | mb.mb_drq = MAINBUSCF_DACK_DEFAULT; | |
135 | mb.mb_irq = MAINBUSCF_IRQ_DEFAULT; | 135 | mb.mb_irq = MAINBUSCF_IRQ_DEFAULT; | |
136 | } else { | 136 | } else { | |
137 | mb.mb_iobase = cf->cf_loc[MAINBUSCF_BASE]; | 137 | mb.mb_iobase = cf->cf_loc[MAINBUSCF_BASE]; | |
138 | #if defined(arm32) && !defined(EB7500ATX) | 138 | #if defined(arm32) && !defined(EB7500ATX) | |
139 | mb.mb_iobase += IO_CONF_BASE; | 139 | mb.mb_iobase += IO_CONF_BASE; | |
140 | #endif | 140 | #endif | |
141 | mb.mb_iosize = cf->cf_loc[MAINBUSCF_SIZE]; | 141 | mb.mb_iosize = cf->cf_loc[MAINBUSCF_SIZE]; | |
142 | mb.mb_drq = cf->cf_loc[MAINBUSCF_DACK]; | 142 | mb.mb_drq = cf->cf_loc[MAINBUSCF_DACK]; | |
143 | mb.mb_irq = cf->cf_loc[MAINBUSCF_IRQ]; | 143 | mb.mb_irq = cf->cf_loc[MAINBUSCF_IRQ]; | |
144 | } | 144 | } | |
145 | mb.mb_iot = &mainbus_bs_tag; | 145 | mb.mb_iot = &mainbus_bs_tag; | |
146 | 146 | |||
147 | tryagain = 0; | 147 | tryagain = 0; | |
148 | if (config_match(parent, cf, &mb) > 0) { | 148 | if (config_match(parent, cf, &mb) > 0) { | |
149 | config_attach(parent, cf, &mb, mainbusprint); | 149 | config_attach(parent, cf, &mb, mainbusprint); | |
150 | /* tryagain = (cf->cf_fstate == FSTATE_STAR);*/ | 150 | /* tryagain = (cf->cf_fstate == FSTATE_STAR);*/ | |
151 | } | 151 | } | |
152 | } while (tryagain); | 152 | } while (tryagain); | |
153 | 153 | |||
154 | return (0); | 154 | return (0); | |
155 | } | 155 | } | |
156 | 156 | |||
157 | /* | 157 | /* | |
158 | * void mainbusattach(struct device *parent, struct device *self, void *aux) | 158 | * void mainbusattach(device_t parent, device_t self, void *aux) | |
159 | * | 159 | * | |
160 | * probe and attach all children | 160 | * probe and attach all children | |
161 | */ | 161 | */ | |
162 | 162 | |||
163 | static void | 163 | static void | |
164 | mainbusattach(struct device *parent, struct device *self, void *aux) | 164 | mainbusattach(device_t parent, device_t self, void *aux) | |
165 | { | 165 | { | |
166 | aprint_naive("\n"); | 166 | aprint_naive("\n"); | |
167 | aprint_normal("\n"); | 167 | aprint_normal("\n"); | |
168 | 168 | |||
169 | config_search_ia(mainbussearch, self, "mainbus", NULL); | 169 | config_search_ia(mainbussearch, self, "mainbus", NULL); | |
170 | } | 170 | } | |
171 | 171 | |||
172 | /* End of mainbus.c */ | 172 | /* End of mainbus.c */ |
--- src/sys/arch/emips/emips/mainbus.c 2011/01/26 01:18:50 1.1
+++ src/sys/arch/emips/emips/mainbus.c 2011/06/05 17:03:16 1.2
@@ -1,91 +1,91 @@ | @@ -1,91 +1,91 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.2 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1994, 1995 Carnegie-Mellon University. | 4 | * Copyright (c) 1994, 1995 Carnegie-Mellon University. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Author: Chris G. Demetriou | 7 | * Author: Chris G. Demetriou | |
8 | * DECstation port: Jonathan Stone | 8 | * DECstation port: Jonathan Stone | |
9 | * | 9 | * | |
10 | * Permission to use, copy, modify and distribute this software and | 10 | * Permission to use, copy, modify and distribute this software and | |
11 | * its documentation is hereby granted, provided that both the copyright | 11 | * its documentation is hereby granted, provided that both the copyright | |
12 | * notice and this permission notice appear in all copies of the | 12 | * notice and this permission notice appear in all copies of the | |
13 | * software, derivative works or modified versions, and any portions | 13 | * software, derivative works or modified versions, and any portions | |
14 | * thereof, and that both notices appear in supporting documentation. | 14 | * thereof, and that both notices appear in supporting documentation. | |
15 | * | 15 | * | |
16 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | 16 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
17 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND | 17 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND | |
18 | * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | 18 | * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
19 | * | 19 | * | |
20 | * Carnegie Mellon requests users of this software to return to | 20 | * Carnegie Mellon requests users of this software to return to | |
21 | * | 21 | * | |
22 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | 22 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
23 | * School of Computer Science | 23 | * School of Computer Science | |
24 | * Carnegie Mellon University | 24 | * Carnegie Mellon University | |
25 | * Pittsburgh PA 15213-3890 | 25 | * Pittsburgh PA 15213-3890 | |
26 | * | 26 | * | |
27 | * any improvements or extensions that they make and grant Carnegie the | 27 | * any improvements or extensions that they make and grant Carnegie the | |
28 | * rights to redistribute these changes. | 28 | * rights to redistribute these changes. | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1 2011/01/26 01:18:50 pooka Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.2 2011/06/05 17:03:16 matt Exp $"); | |
33 | 33 | |||
34 | #include <sys/param.h> | 34 | #include <sys/param.h> | |
35 | #include <sys/systm.h> | 35 | #include <sys/systm.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | 37 | |||
38 | #include <machine/sysconf.h> | 38 | #include <machine/sysconf.h> | |
39 | #include <machine/autoconf.h> | 39 | #include <machine/autoconf.h> | |
40 | 40 | |||
41 | /* Definition of the mainbus driver. */ | 41 | /* Definition of the mainbus driver. */ | |
42 | static int mbmatch(struct device *, struct cfdata *, void *); | 42 | static int mbmatch(device_t, cfdata_t, void *); | |
43 | static void mbattach(struct device *, struct device *, void *); | 43 | static void mbattach(device_t, device_t, void *); | |
44 | static int mbprint(void *, const char *); | 44 | static int mbprint(void *, const char *); | |
45 | 45 | |||
46 | CFATTACH_DECL(mainbus, sizeof(struct device), | 46 | CFATTACH_DECL_NEW(mainbus, 0, | |
47 | mbmatch, mbattach, NULL, NULL); | 47 | mbmatch, mbattach, NULL, NULL); | |
48 | 48 | |||
49 | static int mainbus_found; | 49 | static int mainbus_found; | |
50 | 50 | |||
51 | static int | 51 | static int | |
52 | mbmatch(struct device *parent, struct cfdata *cf, void *aux) | 52 | mbmatch(device_t parent, cfdata_t cf, void *aux) | |
53 | { | 53 | { | |
54 | 54 | |||
55 | if (mainbus_found) | 55 | if (mainbus_found) | |
56 | return (0); | 56 | return (0); | |
57 | 57 | |||
58 | return (1); | 58 | return (1); | |
59 | } | 59 | } | |
60 | 60 | |||
61 | int ncpus = 0; /* only support uniprocessors, for now */ | 61 | int ncpus = 0; /* only support uniprocessors, for now */ | |
62 | 62 | |||
63 | static void | 63 | static void | |
64 | mbattach(struct device *parent, struct device *self, void *aux) | 64 | mbattach(device_t parent, device_t self, void *aux) | |
65 | { | 65 | { | |
66 | struct mainbus_attach_args ma; | 66 | struct mainbus_attach_args ma; | |
67 | 67 | |||
68 | mainbus_found = 1; | 68 | mainbus_found = 1; | |
69 | 69 | |||
70 | printf("\n"); | 70 | printf("\n"); | |
71 | 71 | |||
72 | /* Interrupt initialization, phase 1 */ | 72 | /* Interrupt initialization, phase 1 */ | |
73 | intr_init(1); | 73 | intr_init(1); | |
74 | 74 | |||
75 | ma.ma_name = "cpu"; | 75 | ma.ma_name = "cpu"; | |
76 | ma.ma_slot = 0; | 76 | ma.ma_slot = 0; | |
77 | config_found(self, &ma, mbprint); | 77 | config_found(self, &ma, mbprint); | |
78 | 78 | |||
79 | ma.ma_name = platform.iobus; | 79 | ma.ma_name = platform.iobus; | |
80 | ma.ma_slot = 0; | 80 | ma.ma_slot = 0; | |
81 | config_found(self, &ma, mbprint); | 81 | config_found(self, &ma, mbprint); | |
82 | } | 82 | } | |
83 | 83 | |||
84 | static int | 84 | static int | |
85 | mbprint(void *aux, const char *pnp) | 85 | mbprint(void *aux, const char *pnp) | |
86 | { | 86 | { | |
87 | 87 | |||
88 | if (pnp) | 88 | if (pnp) | |
89 | return (QUIET); | 89 | return (QUIET); | |
90 | return (UNCONF); | 90 | return (UNCONF); | |
91 | } | 91 | } |
--- src/sys/arch/evbppc/ev64260/mainbus.c 2010/04/28 13:51:55 1.6
+++ src/sys/arch/evbppc/ev64260/mainbus.c 2011/06/05 17:03:18 1.7
@@ -1,147 +1,147 @@ | @@ -1,147 +1,147 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.6 2010/04/28 13:51:55 kiyohara Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.7 2011/06/05 17:03:18 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | 4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
15 | * must display the following acknowledgement: | 15 | * must display the following acknowledgement: | |
16 | * This product includes software developed by Christopher G. Demetriou | 16 | * This product includes software developed by Christopher G. Demetriou | |
17 | * for the NetBSD Project. | 17 | * for the NetBSD Project. | |
18 | * 4. The name of the author may not be used to endorse or promote products | 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 | 19 | * derived from this software without specific prior written permission | |
20 | * | 20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 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 | 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 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 | 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.6 2010/04/28 13:51:55 kiyohara Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.7 2011/06/05 17:03:18 matt Exp $"); | |
35 | 35 | |||
36 | #include "mainbus.h" | 36 | #include "mainbus.h" | |
37 | #include "opt_multiprocessor.h" | 37 | #include "opt_multiprocessor.h" | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/bus.h> | 40 | #include <sys/bus.h> | |
41 | #include <sys/device.h> | 41 | #include <sys/device.h> | |
42 | #include <sys/errno.h> | 42 | #include <sys/errno.h> | |
43 | 43 | |||
44 | #include <evbppc/ev64260/ev64260.h> | 44 | #include <evbppc/ev64260/ev64260.h> | |
45 | 45 | |||
46 | #include "locators.h" | 46 | #include "locators.h" | |
47 | 47 | |||
48 | #if NCPU == 0 | 48 | #if NCPU == 0 | |
49 | #error A cpu device is now required | 49 | #error A cpu device is now required | |
50 | #endif | 50 | #endif | |
51 | 51 | |||
52 | 52 | |||
53 | int mainbus_match(device_t, cfdata_t, void *); | 53 | int mainbus_match(device_t, cfdata_t, void *); | |
54 | void mainbus_attach(device_t, device_t, void *); | 54 | void mainbus_attach(device_t, device_t, void *); | |
55 | int mainbus_cfprint(void *, const char *); | 55 | int mainbus_cfprint(void *, const char *); | |
56 | 56 | |||
57 | CFATTACH_DECL(mainbus, sizeof(struct device), | 57 | CFATTACH_DECL_NEW(mainbus, 0, | |
58 | mainbus_match, mainbus_attach, NULL, NULL); | 58 | mainbus_match, mainbus_attach, NULL, NULL); | |
59 | 59 | |||
60 | /* | 60 | /* | |
61 | * Probe for the mainbus; always succeeds. | 61 | * Probe for the mainbus; always succeeds. | |
62 | */ | 62 | */ | |
63 | int | 63 | int | |
64 | mainbus_match(device_t parent, cfdata_t match, void *aux) | 64 | mainbus_match(device_t parent, cfdata_t match, void *aux) | |
65 | { | 65 | { | |
66 | 66 | |||
67 | return 1; | 67 | return 1; | |
68 | } | 68 | } | |
69 | 69 | |||
70 | /* | 70 | /* | |
71 | * Attach the mainbus. | 71 | * Attach the mainbus. | |
72 | */ | 72 | */ | |
73 | void | 73 | void | |
74 | mainbus_attach(device_t parent, device_t self, void *aux) | 74 | mainbus_attach(device_t parent, device_t self, void *aux) | |
75 | { | 75 | { | |
76 | struct mainbus_attach_args mba; | 76 | struct mainbus_attach_args mba; | |
77 | extern bus_addr_t gt_base; | 77 | extern bus_addr_t gt_base; | |
78 | 78 | |||
79 | printf("\n"); | 79 | printf("\n"); | |
80 | 80 | |||
81 | memset(&mba, 0, sizeof(mba)); | 81 | memset(&mba, 0, sizeof(mba)); | |
82 | 82 | |||
83 | /* | 83 | /* | |
84 | * Always find the CPU | 84 | * Always find the CPU | |
85 | */ | 85 | */ | |
86 | mba.mba_name = "cpu"; | 86 | mba.mba_name = "cpu"; | |
87 | mba.mba_unit = 0; | 87 | mba.mba_unit = 0; | |
88 | mba.mba_addr = MAINBUSCF_ADDR_DEFAULT; | 88 | mba.mba_addr = MAINBUSCF_ADDR_DEFAULT; | |
89 | config_found(self, &mba, mainbus_cfprint); | 89 | config_found(self, &mba, mainbus_cfprint); | |
90 | 90 | |||
91 | #ifdef MULTIPROCESSOR | 91 | #ifdef MULTIPROCESSOR | |
92 | /* | 92 | /* | |
93 | * Try for a second one... | 93 | * Try for a second one... | |
94 | */ | 94 | */ | |
95 | mba.mba_name = "cpu"; | 95 | mba.mba_name = "cpu"; | |
96 | mba.mba_unit = 1; | 96 | mba.mba_unit = 1; | |
97 | mba.mba_addr = MAINBUSCF_ADDR_DEFAULT; | 97 | mba.mba_addr = MAINBUSCF_ADDR_DEFAULT; | |
98 | config_found(self, &mba, mainbus_cfprint); | 98 | config_found(self, &mba, mainbus_cfprint); | |
99 | #endif | 99 | #endif | |
100 | 100 | |||
101 | /* | 101 | /* | |
102 | * Now try to configure the Discovery | 102 | * Now try to configure the Discovery | |
103 | */ | 103 | */ | |
104 | mba.mba_name = "gt"; | 104 | mba.mba_name = "gt"; | |
105 | mba.mba_unit = -1; | 105 | mba.mba_unit = -1; | |
106 | mba.mba_addr = gt_base; | 106 | mba.mba_addr = gt_base; | |
107 | config_found(self, &mba, mainbus_cfprint); | 107 | config_found(self, &mba, mainbus_cfprint); | |
108 | } | 108 | } | |
109 | 109 | |||
110 | int | 110 | int | |
111 | mainbus_cfprint(void *aux, const char *pnp) | 111 | mainbus_cfprint(void *aux, const char *pnp) | |
112 | { | 112 | { | |
113 | struct mainbus_attach_args *mba = aux; | 113 | struct mainbus_attach_args *mba = aux; | |
114 | 114 | |||
115 | if (pnp) | 115 | if (pnp) | |
116 | aprint_normal("%s at %s", mba->mba_name, pnp); | 116 | aprint_normal("%s at %s", mba->mba_name, pnp); | |
117 | if (mba->mba_unit != -1) | 117 | if (mba->mba_unit != -1) | |
118 | aprint_normal(" unit %d", mba->mba_unit); | 118 | aprint_normal(" unit %d", mba->mba_unit); | |
119 | if (mba->mba_addr != MAINBUSCF_ADDR_DEFAULT) | 119 | if (mba->mba_addr != MAINBUSCF_ADDR_DEFAULT) | |
120 | aprint_normal(" addr 0x%08x", mba->mba_addr); | 120 | aprint_normal(" addr 0x%08x", mba->mba_addr); | |
121 | return UNCONF; | 121 | return UNCONF; | |
122 | } | 122 | } | |
123 | 123 | |||
124 | 124 | |||
125 | static int cpu_match(device_t, cfdata_t, void *); | 125 | static int cpu_match(device_t, cfdata_t, void *); | |
126 | static void cpu_attach(device_t, device_t, void *); | 126 | static void cpu_attach(device_t, device_t, void *); | |
127 | 127 | |||
128 | CFATTACH_DECL(cpu, sizeof(struct device), cpu_match, cpu_attach, NULL, NULL); | 128 | CFATTACH_DECL_NEW(cpu, 0, cpu_match, cpu_attach, NULL, NULL); | |
129 | 129 | |||
130 | int | 130 | int | |
131 | cpu_match(device_t parent, cfdata_t cf, void *aux) | 131 | cpu_match(device_t parent, cfdata_t cf, void *aux) | |
132 | { | 132 | { | |
133 | struct mainbus_attach_args *mba = aux; | 133 | struct mainbus_attach_args *mba = aux; | |
134 | 134 | |||
135 | if (strcmp(mba->mba_name, "cpu") != 0) | 135 | if (strcmp(mba->mba_name, "cpu") != 0) | |
136 | return 0; | 136 | return 0; | |
137 | 137 | |||
138 | return 1; | 138 | return 1; | |
139 | } | 139 | } | |
140 | 140 | |||
141 | void | 141 | void | |
142 | cpu_attach(device_t parent, device_t self, void *aux) | 142 | cpu_attach(device_t parent, device_t self, void *aux) | |
143 | { | 143 | { | |
144 | struct mainbus_attach_args *mba = aux; | 144 | struct mainbus_attach_args *mba = aux; | |
145 | 145 | |||
146 | (void) cpu_attach_common(self, mba->mba_unit); | 146 | (void) cpu_attach_common(self, mba->mba_unit); | |
147 | } | 147 | } |
--- src/sys/arch/evbppc/pmppc/mainbus.c 2008/04/28 20:23:17 1.3
+++ src/sys/arch/evbppc/pmppc/mainbus.c 2011/06/05 17:03:18 1.4
@@ -1,179 +1,179 @@ | @@ -1,179 +1,179 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.3 2008/04/28 20:23:17 martin Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.4 2011/06/05 17:03:18 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at Sandburst Corp. | 8 | * by Lennart Augustsson (lennart@augustsson.net) at Sandburst Corp. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3 2008/04/28 20:23:17 martin Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4 2011/06/05 17:03:18 matt Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | 38 | |||
39 | #include <machine/bus.h> | 39 | #include <machine/bus.h> | |
40 | #include <machine/pmppc.h> | 40 | #include <machine/pmppc.h> | |
41 | #include <arch/evbppc/pmppc/dev/mainbus.h> | 41 | #include <arch/evbppc/pmppc/dev/mainbus.h> | |
42 | 42 | |||
43 | #include <dev/ic/cpc700reg.h> | 43 | #include <dev/ic/cpc700reg.h> | |
44 | 44 | |||
45 | #include "locators.h" | 45 | #include "locators.h" | |
46 | #include "mainbus.h" | 46 | #include "mainbus.h" | |
47 | 47 | |||
48 | #if NCPU == 0 | 48 | #if NCPU == 0 | |
49 | #error A cpu device is now required | 49 | #error A cpu device is now required | |
50 | #endif | 50 | #endif | |
51 | 51 | |||
52 | int mainbus_match(struct device *, struct cfdata *, void *); | 52 | int mainbus_match(device_t, cfdata_t, void *); | |
53 | void mainbus_attach(struct device *, struct device *, void *); | 53 | void mainbus_attach(device_t, device_t, void *); | |
54 | 54 | |||
55 | CFATTACH_DECL(mainbus, sizeof(struct device), | 55 | CFATTACH_DECL_NEW(mainbus, 0, | |
56 | mainbus_match, mainbus_attach, NULL, NULL); | 56 | mainbus_match, mainbus_attach, NULL, NULL); | |
57 | 57 | |||
58 | static int mainbus_print(void *, const char *); | 58 | static int mainbus_print(void *, const char *); | |
59 | 59 | |||
60 | /* | 60 | /* | |
61 | * Probe for the mainbus; always succeeds. | 61 | * Probe for the mainbus; always succeeds. | |
62 | */ | 62 | */ | |
63 | int | 63 | int | |
64 | mainbus_match(struct device *parent, struct cfdata *match, void *aux) | 64 | mainbus_match(device_t parent, cfdata_t match, void *aux) | |
65 | { | 65 | { | |
66 | 66 | |||
67 | return 1; | 67 | return 1; | |
68 | } | 68 | } | |
69 | 69 | |||
70 | static int | 70 | static int | |
71 | mainbus_submatch(struct device *parent, struct cfdata *cf, | 71 | mainbus_submatch(device_t parent, cfdata_t cf, | |
72 | const int *ldesc, void *aux) | 72 | const int *ldesc, void *aux) | |
73 | { | 73 | { | |
74 | struct mainbus_attach_args *maa = aux; | 74 | struct mainbus_attach_args *maa = aux; | |
75 | 75 | |||
76 | if (cf->cf_loc[MAINBUSCF_ADDR] != maa->mb_addr) | 76 | if (cf->cf_loc[MAINBUSCF_ADDR] != maa->mb_addr) | |
77 | return (0); | 77 | return (0); | |
78 | 78 | |||
79 | return (config_match(parent, cf, aux)); | 79 | return (config_match(parent, cf, aux)); | |
80 | } | 80 | } | |
81 | 81 | |||
82 | static int | 82 | static int | |
83 | mainbus_print(void *aux, const char *pnp) | 83 | mainbus_print(void *aux, const char *pnp) | |
84 | { | 84 | { | |
85 | struct mainbus_attach_args *mba = aux; | 85 | struct mainbus_attach_args *mba = aux; | |
86 | 86 | |||
87 | if (pnp) | 87 | if (pnp) | |
88 | aprint_normal("%s at %s", mba->mb_name, pnp); | 88 | aprint_normal("%s at %s", mba->mb_name, pnp); | |
89 | if (mba->mb_addr != MAINBUSCF_ADDR_DEFAULT) | 89 | if (mba->mb_addr != MAINBUSCF_ADDR_DEFAULT) | |
90 | aprint_normal(" addr 0x%08lx", mba->mb_addr); | 90 | aprint_normal(" addr 0x%08lx", mba->mb_addr); | |
91 | if (mba->mb_irq != MAINBUSCF_IRQ_DEFAULT) | 91 | if (mba->mb_irq != MAINBUSCF_IRQ_DEFAULT) | |
92 | aprint_normal(" irq %d", mba->mb_irq); | 92 | aprint_normal(" irq %d", mba->mb_irq); | |
93 | return (UNCONF); | 93 | return (UNCONF); | |
94 | } | 94 | } | |
95 | 95 | |||
96 | /* | 96 | /* | |
97 | * Attach the mainbus. | 97 | * Attach the mainbus. | |
98 | */ | 98 | */ | |
99 | void | 99 | void | |
100 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 100 | mainbus_attach(device_t parent, device_t self, void *aux) | |
101 | { | 101 | { | |
102 | struct mainbus_attach_args maa; | 102 | struct mainbus_attach_args maa; | |
103 | 103 | |||
104 | printf(": Artesyn PM/PPC\n"); | 104 | printf(": Artesyn PM/PPC\n"); | |
105 | printf("%s: %sPCI bus Monarch\n", self->dv_xname, | 105 | printf("%s: %sPCI bus Monarch\n", self->dv_xname, | |
106 | a_config.a_is_monarch ? "" : "not"); | 106 | a_config.a_is_monarch ? "" : "not"); | |
107 | printf("%s: boot from %s, %sECC, %s L2 cache\n", | 107 | printf("%s: boot from %s, %sECC, %s L2 cache\n", | |
108 | self->dv_xname, | 108 | self->dv_xname, | |
109 | a_config.a_boot_device == A_BOOT_ROM ? "ROM" : "flash", | 109 | a_config.a_boot_device == A_BOOT_ROM ? "ROM" : "flash", | |
110 | a_config.a_has_ecc ? "" : "no ", | 110 | a_config.a_has_ecc ? "" : "no ", | |
111 | a_config.a_l2_cache == A_CACHE_PARITY ? "parity" : | 111 | a_config.a_l2_cache == A_CACHE_PARITY ? "parity" : | |
112 | a_config.a_l2_cache == A_CACHE_NO_PARITY ? "no-parity" : "no"); | 112 | a_config.a_l2_cache == A_CACHE_NO_PARITY ? "no-parity" : "no"); | |
113 | 113 | |||
114 | maa.mb_bt = &pmppc_mem_tag; | 114 | maa.mb_bt = &pmppc_mem_tag; | |
115 | 115 | |||
116 | maa.mb_name = "cpu"; | 116 | maa.mb_name = "cpu"; | |
117 | maa.mb_addr = MAINBUSCF_ADDR_DEFAULT; | 117 | maa.mb_addr = MAINBUSCF_ADDR_DEFAULT; | |
118 | maa.mb_irq = MAINBUSCF_IRQ_DEFAULT; | 118 | maa.mb_irq = MAINBUSCF_IRQ_DEFAULT; | |
119 | config_found(self, &maa, mainbus_print); | 119 | config_found(self, &maa, mainbus_print); | |
120 | 120 | |||
121 | if (a_config.a_has_rtc) { | 121 | if (a_config.a_has_rtc) { | |
122 | maa.mb_name = "rtc"; | 122 | maa.mb_name = "rtc"; | |
123 | maa.mb_addr = PMPPC_RTC; | 123 | maa.mb_addr = PMPPC_RTC; | |
124 | maa.mb_irq = PMPPC_I_RTC_INT; | 124 | maa.mb_irq = PMPPC_I_RTC_INT; | |
125 | config_found_sm_loc(self, "mainbus", NULL, &maa, mainbus_print, | 125 | config_found_sm_loc(self, "mainbus", NULL, &maa, mainbus_print, | |
126 | mainbus_submatch); | 126 | mainbus_submatch); | |
127 | } | 127 | } | |
128 | 128 | |||
129 | if (a_config.a_has_eth) { | 129 | if (a_config.a_has_eth) { | |
130 | maa.mb_name = "cs"; | 130 | maa.mb_name = "cs"; | |
131 | maa.mb_addr = PMPPC_CS_IO_BASE; | 131 | maa.mb_addr = PMPPC_CS_IO_BASE; | |
132 | maa.mb_irq = PMPPC_I_ETH_INT; | 132 | maa.mb_irq = PMPPC_I_ETH_INT; | |
133 | config_found_sm_loc(self, "mainbus", NULL, &maa, mainbus_print, | 133 | config_found_sm_loc(self, "mainbus", NULL, &maa, mainbus_print, | |
134 | mainbus_submatch); | 134 | mainbus_submatch); | |
135 | maa.mb_bt = &pmppc_mem_tag; | 135 | maa.mb_bt = &pmppc_mem_tag; | |
136 | } | 136 | } | |
137 | if (a_config.a_flash_width != 0) { | 137 | if (a_config.a_flash_width != 0) { | |
138 | maa.mb_name = "flash"; | 138 | maa.mb_name = "flash"; | |
139 | maa.mb_addr = PMPPC_FLASH_BASE; | 139 | maa.mb_addr = PMPPC_FLASH_BASE; | |
140 | maa.mb_irq = MAINBUSCF_IRQ_DEFAULT; | 140 | maa.mb_irq = MAINBUSCF_IRQ_DEFAULT; | |
141 | maa.u.mb_flash.size = a_config.a_flash_size; | 141 | maa.u.mb_flash.size = a_config.a_flash_size; | |
142 | maa.u.mb_flash.width = a_config.a_flash_width; | 142 | maa.u.mb_flash.width = a_config.a_flash_width; | |
143 | config_found_sm_loc(self, "mainbus", NULL, &maa, mainbus_print, | 143 | config_found_sm_loc(self, "mainbus", NULL, &maa, mainbus_print, | |
144 | mainbus_submatch); | 144 | mainbus_submatch); | |
145 | } | 145 | } | |
146 | 146 | |||
147 | maa.mb_name = "cpc"; | 147 | maa.mb_name = "cpc"; | |
148 | maa.mb_addr = MAINBUSCF_ADDR_DEFAULT; | 148 | maa.mb_addr = MAINBUSCF_ADDR_DEFAULT; | |
149 | maa.mb_irq = MAINBUSCF_IRQ_DEFAULT; | 149 | maa.mb_irq = MAINBUSCF_IRQ_DEFAULT; | |
150 | config_found(self, &maa, mainbus_print); | 150 | config_found(self, &maa, mainbus_print); | |
151 | } | 151 | } | |
152 | 152 | |||
153 | static int cpu_match(struct device *, struct cfdata *, void *); | 153 | static int cpu_match(device_t, cfdata_t, void *); | |
154 | static void cpu_attach(struct device *, struct device *, void *); | 154 | static void cpu_attach(device_t, device_t, void *); | |
155 | 155 | |||
156 | CFATTACH_DECL(cpu, sizeof(struct device), | 156 | CFATTACH_DECL_NEW(cpu, 0, | |
157 | cpu_match, cpu_attach, NULL, NULL); | 157 | cpu_match, cpu_attach, NULL, NULL); | |
158 | 158 | |||
159 | extern struct cfdriver cpu_cd; | 159 | extern struct cfdriver cpu_cd; | |
160 | 160 | |||
161 | int | 161 | int | |
162 | cpu_match(struct device *parent, struct cfdata *cf, void *aux) | 162 | cpu_match(device_t parent, cfdata_t cf, void *aux) | |
163 | { | 163 | { | |
164 | struct mainbus_attach_args *maa = aux; | 164 | struct mainbus_attach_args *maa = aux; | |
165 | 165 | |||
166 | if (strcmp(maa->mb_name, cpu_cd.cd_name) != 0) | 166 | if (strcmp(maa->mb_name, cpu_cd.cd_name) != 0) | |
167 | return 0; | 167 | return 0; | |
168 | 168 | |||
169 | if (cpu_info[0].ci_dev != NULL) | 169 | if (cpu_info[0].ci_dev != NULL) | |
170 | return 0; | 170 | return 0; | |
171 | 171 | |||
172 | return 1; | 172 | return 1; | |
173 | } | 173 | } | |
174 | 174 | |||
175 | void | 175 | void | |
176 | cpu_attach(struct device *parent, struct device *self, void *aux) | 176 | cpu_attach(device_t parent, device_t self, void *aux) | |
177 | { | 177 | { | |
178 | (void) cpu_attach_common(self, 0); | 178 | (void) cpu_attach_common(self, 0); | |
179 | } | 179 | } |
--- src/sys/arch/luna68k/luna68k/mainbus.c 2009/03/14 21:04:11 1.8
+++ src/sys/arch/luna68k/luna68k/mainbus.c 2011/06/05 17:03:18 1.9
@@ -1,93 +1,93 @@ | @@ -1,93 +1,93 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.8 2009/03/14 21:04:11 dsl Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.9 2011/06/05 17:03:18 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Tohru Nishimura. | 8 | * by Tohru Nishimura. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | 33 | |||
34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8 2009/03/14 21:04:11 dsl Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.9 2011/06/05 17:03:18 matt Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | 39 | |||
40 | #include <machine/cpu.h> | 40 | #include <machine/cpu.h> | |
41 | #include <machine/autoconf.h> | 41 | #include <machine/autoconf.h> | |
42 | 42 | |||
43 | static struct mainbus_attach_args devs[] = { | 43 | static struct mainbus_attach_args devs[] = { | |
44 | { "clock", 0x45000000, -1 }, /* Mostek/Dallas TimeKeeper */ | 44 | { "clock", 0x45000000, -1 }, /* Mostek/Dallas TimeKeeper */ | |
45 | { "le", 0xf1000000, 3 }, /* Am7990 */ | 45 | { "le", 0xf1000000, 3 }, /* Am7990 */ | |
46 | { "sio", 0x51000000, 6 }, /* uPD7201A */ | 46 | { "sio", 0x51000000, 6 }, /* uPD7201A */ | |
47 | { "fb", 0xc1100000, -1 }, /* BrookTree RAMDAC */ | 47 | { "fb", 0xc1100000, -1 }, /* BrookTree RAMDAC */ | |
48 | { "spc", 0xe1000000, 2 }, /* MB89352 */ | 48 | { "spc", 0xe1000000, 2 }, /* MB89352 */ | |
49 | #if 0 | 49 | #if 0 | |
50 | { "spc", 0xe1000040, 2 }, /* ditto */ | 50 | { "spc", 0xe1000040, 2 }, /* ditto */ | |
51 | #endif | 51 | #endif | |
52 | }; | 52 | }; | |
53 | 53 | |||
54 | static void mainbus_attach(struct device *, struct device *, void *); | 54 | static void mainbus_attach(device_t, device_t, void *); | |
55 | static int mainbus_match(struct device *, struct cfdata *, void *); | 55 | static int mainbus_match(device_t, cfdata_t, void *); | |
56 | static int mainbus_print(void *, const char *); | 56 | static int mainbus_print(void *, const char *); | |
57 | 57 | |||
58 | CFATTACH_DECL(mainbus, sizeof(struct device), | 58 | CFATTACH_DECL_NEW(mainbus, 0, | |
59 | mainbus_match, mainbus_attach, NULL, NULL); | 59 | mainbus_match, mainbus_attach, NULL, NULL); | |
60 | 60 | |||
61 | static int | 61 | static int | |
62 | mainbus_match(struct device *parent, struct cfdata *cf, void *args) | 62 | mainbus_match(device_t parent, cfdata_t cf, void *args) | |
63 | { | 63 | { | |
64 | static int mainbus_matched; | 64 | static int mainbus_matched; | |
65 | 65 | |||
66 | if (mainbus_matched) | 66 | if (mainbus_matched) | |
67 | return (0); | 67 | return (0); | |
68 | 68 | |||
69 | return ((mainbus_matched = 1)); | 69 | return ((mainbus_matched = 1)); | |
70 | } | 70 | } | |
71 | 71 | |||
72 | static void | 72 | static void | |
73 | mainbus_attach(struct device *parent, struct device *self, void *args) | 73 | mainbus_attach(device_t parent, device_t self, void *args) | |
74 | { | 74 | { | |
75 | int i; | 75 | int i; | |
76 | 76 | |||
77 | if (machtype == LUNA_II) | 77 | if (machtype == LUNA_II) | |
78 | devs[1].ma_addr = 0xf0000000; | 78 | devs[1].ma_addr = 0xf0000000; | |
79 | printf("\n"); | 79 | printf("\n"); | |
80 | for (i = 0; i < sizeof(devs)/sizeof(devs[0]); i++) | 80 | for (i = 0; i < sizeof(devs)/sizeof(devs[0]); i++) | |
81 | config_found(self, (void *)&devs[i], mainbus_print); | 81 | config_found(self, (void *)&devs[i], mainbus_print); | |
82 | } | 82 | } | |
83 | 83 | |||
84 | static int | 84 | static int | |
85 | mainbus_print(void *aux, const char *pnp) | 85 | mainbus_print(void *aux, const char *pnp) | |
86 | { | 86 | { | |
87 | struct mainbus_attach_args *ma = aux; | 87 | struct mainbus_attach_args *ma = aux; | |
88 | 88 | |||
89 | if (pnp) | 89 | if (pnp) | |
90 | aprint_normal("%s at %s", ma->ma_name, pnp); | 90 | aprint_normal("%s at %s", ma->ma_name, pnp); | |
91 | 91 | |||
92 | return (UNCONF); | 92 | return (UNCONF); | |
93 | } | 93 | } |
--- src/sys/arch/mac68k/mac68k/mainbus.c 2008/04/28 20:23:27 1.20
+++ src/sys/arch/mac68k/mac68k/mainbus.c 2011/06/05 17:03:18 1.21
@@ -1,105 +1,105 @@ | @@ -1,105 +1,105 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.20 2008/04/28 20:23:27 martin Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:18 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe. | 8 | * by Jason R. Thorpe. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2008/04/28 20:23:27 martin Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:18 matt Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | 38 | |||
39 | #define _M68K_BUS_DMA_PRIVATE | 39 | #define _M68K_BUS_DMA_PRIVATE | |
40 | #include <machine/autoconf.h> | 40 | #include <machine/autoconf.h> | |
41 | 41 | |||
42 | static int mainbus_match(struct device *, struct cfdata *, void *); | 42 | static int mainbus_match(device_t, cfdata_t, void *); | |
43 | static void mainbus_attach(struct device *, struct device *, void *); | 43 | static void mainbus_attach(device_t, device_t, void *); | |
44 | static int mainbus_search(struct device *, struct cfdata *, | 44 | static int mainbus_search(device_t, cfdata_t, | |
45 | const int *ldesc, void *); | 45 | const int *ldesc, void *); | |
46 | 46 | |||
47 | CFATTACH_DECL(mainbus, sizeof(struct device), | 47 | CFATTACH_DECL_NEW(mainbus, 0, | |
48 | mainbus_match, mainbus_attach, NULL, NULL); | 48 | mainbus_match, mainbus_attach, NULL, NULL); | |
49 | 49 | |||
50 | struct m68k_bus_dma_tag mac68k_bus_dma_tag = { | 50 | struct m68k_bus_dma_tag mac68k_bus_dma_tag = { | |
51 | NULL, /* _cookie */ | 51 | NULL, /* _cookie */ | |
52 | 52 | |||
53 | 0, /* _boundary */ | 53 | 0, /* _boundary */ | |
54 | 54 | |||
55 | _bus_dmamap_create, /* _dmamap_create */ | 55 | _bus_dmamap_create, /* _dmamap_create */ | |
56 | _bus_dmamap_destroy, /* _dmamap_destroy */ | 56 | _bus_dmamap_destroy, /* _dmamap_destroy */ | |
57 | _bus_dmamap_load_direct, /* _dmamap_load */ | 57 | _bus_dmamap_load_direct, /* _dmamap_load */ | |
58 | _bus_dmamap_load_mbuf_direct, /* _dmamap_load_mbuf */ | 58 | _bus_dmamap_load_mbuf_direct, /* _dmamap_load_mbuf */ | |
59 | _bus_dmamap_load_uio_direct, /* _dmamap_load_uio */ | 59 | _bus_dmamap_load_uio_direct, /* _dmamap_load_uio */ | |
60 | _bus_dmamap_load_raw_direct, /* _dmamap_load_raw */ | 60 | _bus_dmamap_load_raw_direct, /* _dmamap_load_raw */ | |
61 | _bus_dmamap_unload, /* _dmamap_unload */ | 61 | _bus_dmamap_unload, /* _dmamap_unload */ | |
62 | _bus_dmamap_sync, /* _dmamap_sync */ | 62 | _bus_dmamap_sync, /* _dmamap_sync */ | |
63 | 63 | |||
64 | _bus_dmamem_alloc, /* _dmamem_alloc */ | 64 | _bus_dmamem_alloc, /* _dmamem_alloc */ | |
65 | _bus_dmamem_free, /* _dmamem_free */ | 65 | _bus_dmamem_free, /* _dmamem_free */ | |
66 | _bus_dmamem_map, /* _dmamem_map */ | 66 | _bus_dmamem_map, /* _dmamem_map */ | |
67 | _bus_dmamem_unmap, /* _dmamem_unmap */ | 67 | _bus_dmamem_unmap, /* _dmamem_unmap */ | |
68 | _bus_dmamem_mmap /* _dmamem_mmap */ | 68 | _bus_dmamem_mmap /* _dmamem_mmap */ | |
69 | }; | 69 | }; | |
70 | 70 | |||
71 | static int | 71 | static int | |
72 | mainbus_match(struct device *parent, struct cfdata *cf, void *aux) | 72 | mainbus_match(device_t parent, cfdata_t cf, void *aux) | |
73 | { | 73 | { | |
74 | static int mainbus_matched = 0; | 74 | static int mainbus_matched = 0; | |
75 | 75 | |||
76 | /* Allow only one instance. */ | 76 | /* Allow only one instance. */ | |
77 | if (mainbus_matched) | 77 | if (mainbus_matched) | |
78 | return (0); | 78 | return (0); | |
79 | 79 | |||
80 | mainbus_matched = 1; | 80 | mainbus_matched = 1; | |
81 | return 1; | 81 | return 1; | |
82 | } | 82 | } | |
83 | 83 | |||
84 | static void | 84 | static void | |
85 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 85 | mainbus_attach(device_t parent, device_t self, void *aux) | |
86 | { | 86 | { | |
87 | struct mainbus_attach_args mba; | 87 | struct mainbus_attach_args mba; | |
88 | 88 | |||
89 | printf("\n"); | 89 | printf("\n"); | |
90 | 90 | |||
91 | mba.mba_bst = MAC68K_BUS_SPACE_MEM; | 91 | mba.mba_bst = MAC68K_BUS_SPACE_MEM; | |
92 | mba.mba_dmat = &mac68k_bus_dma_tag; | 92 | mba.mba_dmat = &mac68k_bus_dma_tag; | |
93 | 93 | |||
94 | /* Search for and attach children. */ | 94 | /* Search for and attach children. */ | |
95 | config_search_ia(mainbus_search, self, "mainbus", &mba); | 95 | config_search_ia(mainbus_search, self, "mainbus", &mba); | |
96 | } | 96 | } | |
97 | 97 | |||
98 | static int | 98 | static int | |
99 | mainbus_search(struct device *parent, struct cfdata *cf, | 99 | mainbus_search(device_t parent, cfdata_t cf, | |
100 | const int *ldesc, void *aux) | 100 | const int *ldesc, void *aux) | |
101 | { | 101 | { | |
102 | if (config_match(parent, cf, aux) > 0) | 102 | if (config_match(parent, cf, aux) > 0) | |
103 | config_attach(parent, cf, aux, NULL); | 103 | config_attach(parent, cf, aux, NULL); | |
104 | return 0; | 104 | return 0; | |
105 | } | 105 | } |
--- src/sys/arch/macppc/macppc/cpu.c 2011/06/05 16:52:24 1.55
+++ src/sys/arch/macppc/macppc/cpu.c 2011/06/05 17:03:16 1.56
@@ -1,333 +1,333 @@ | @@ -1,333 +1,333 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.55 2011/06/05 16:52:24 matt Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.56 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001 Tsubai Masanari. | 4 | * Copyright (c) 2001 Tsubai Masanari. | |
5 | * Copyright (c) 1998, 1999, 2001 Internet Research Institute, Inc. | 5 | * Copyright (c) 1998, 1999, 2001 Internet Research Institute, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
15 | * documentation and/or other materials provided with the distribution. | 15 | * documentation and/or other materials provided with the distribution. | |
16 | * 3. All advertising materials mentioning features or use of this software | 16 | * 3. All advertising materials mentioning features or use of this software | |
17 | * must display the following acknowledgement: | 17 | * must display the following acknowledgement: | |
18 | * This product includes software developed by | 18 | * This product includes software developed by | |
19 | * Internet Research Institute, Inc. | 19 | * Internet Research Institute, Inc. | |
20 | * 4. The name of the author may not be used to endorse or promote products | 20 | * 4. The name of the author may not be used to endorse or promote products | |
21 | * derived from this software without specific prior written permission. | 21 | * derived from this software without specific prior written permission. | |
22 | * | 22 | * | |
23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 24 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
25 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 25 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
26 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 26 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 27 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 28 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include <sys/cdefs.h> | 35 | #include <sys/cdefs.h> | |
36 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.55 2011/06/05 16:52:24 matt Exp $"); | 36 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.56 2011/06/05 17:03:16 matt Exp $"); | |
37 | 37 | |||
38 | #include "opt_ppcparam.h" | 38 | #include "opt_ppcparam.h" | |
39 | #include "opt_multiprocessor.h" | 39 | #include "opt_multiprocessor.h" | |
40 | #include "opt_interrupt.h" | 40 | #include "opt_interrupt.h" | |
41 | #include "opt_altivec.h" | 41 | #include "opt_altivec.h" | |
42 | 42 | |||
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/device.h> | 45 | #include <sys/device.h> | |
46 | #include <sys/types.h> | 46 | #include <sys/types.h> | |
47 | #include <sys/lwp.h> | 47 | #include <sys/lwp.h> | |
48 | 48 | |||
49 | #include <dev/ofw/openfirm.h> | 49 | #include <dev/ofw/openfirm.h> | |
50 | #include <powerpc/oea/hid.h> | 50 | #include <powerpc/oea/hid.h> | |
51 | #include <powerpc/oea/bat.h> | 51 | #include <powerpc/oea/bat.h> | |
52 | #include <powerpc/openpic.h> | 52 | #include <powerpc/openpic.h> | |
53 | #include <powerpc/spr.h> | 53 | #include <powerpc/spr.h> | |
54 | #include <powerpc/oea/spr.h> | 54 | #include <powerpc/oea/spr.h> | |
55 | #ifdef ALTIVEC | 55 | #ifdef ALTIVEC | |
56 | #include <powerpc/altivec.h> | 56 | #include <powerpc/altivec.h> | |
57 | #endif | 57 | #endif | |
58 | 58 | |||
59 | #ifdef MULTIPROCESSOR | 59 | #ifdef MULTIPROCESSOR | |
60 | #include <arch/powerpc/pic/picvar.h> | 60 | #include <arch/powerpc/pic/picvar.h> | |
61 | #include <arch/powerpc/pic/ipivar.h> | 61 | #include <arch/powerpc/pic/ipivar.h> | |
62 | #endif | 62 | #endif | |
63 | 63 | |||
64 | #include <machine/autoconf.h> | 64 | #include <machine/autoconf.h> | |
65 | #include <machine/fpu.h> | 65 | #include <machine/fpu.h> | |
66 | #include <machine/pcb.h> | 66 | #include <machine/pcb.h> | |
67 | #include <machine/pio.h> | 67 | #include <machine/pio.h> | |
68 | #include <machine/trap.h> | 68 | #include <machine/trap.h> | |
69 | 69 | |||
70 | #include "pic_openpic.h" | 70 | #include "pic_openpic.h" | |
71 | 71 | |||
72 | #ifndef OPENPIC | 72 | #ifndef OPENPIC | |
73 | #if NPIC_OPENPIC > 0 | 73 | #if NPIC_OPENPIC > 0 | |
74 | #define OPENPIC | 74 | #define OPENPIC | |
75 | #endif /* NOPENPIC > 0 */ | 75 | #endif /* NOPENPIC > 0 */ | |
76 | #endif /* OPENPIC */ | 76 | #endif /* OPENPIC */ | |
77 | 77 | |||
78 | int cpumatch(struct device *, struct cfdata *, void *); | 78 | int cpumatch(device_t, cfdata_t, void *); | |
79 | void cpuattach(struct device *, struct device *, void *); | 79 | void cpuattach(device_t, device_t, void *); | |
80 | 80 | |||
81 | void identifycpu(char *); | 81 | void identifycpu(char *); | |
82 | static void ohare_init(void); | 82 | static void ohare_init(void); | |
83 | 83 | |||
84 | CFATTACH_DECL(cpu, sizeof(struct device), | 84 | CFATTACH_DECL_NEW(cpu, 0, | |
85 | cpumatch, cpuattach, NULL, NULL); | 85 | cpumatch, cpuattach, NULL, NULL); | |
86 | 86 | |||
87 | extern struct cfdriver cpu_cd; | 87 | extern struct cfdriver cpu_cd; | |
88 | 88 | |||
89 | #define HH_INTR_SECONDARY 0xf80000c0 | 89 | #define HH_INTR_SECONDARY 0xf80000c0 | |
90 | #define HH_ARBCONF 0xf8000090 | 90 | #define HH_ARBCONF 0xf8000090 | |
91 | 91 | |||
92 | extern uint32_t ticks_per_intr; | 92 | extern uint32_t ticks_per_intr; | |
93 | 93 | |||
94 | #ifdef OPENPIC | 94 | #ifdef OPENPIC | |
95 | extern void openpic_set_priority(int, int); | 95 | extern void openpic_set_priority(int, int); | |
96 | #endif | 96 | #endif | |
97 | 97 | |||
98 | int | 98 | int | |
99 | cpumatch(struct device *parent, struct cfdata *cf, void *aux) | 99 | cpumatch(device_t parent, cfdata_t cf, void *aux) | |
100 | { | 100 | { | |
101 | struct confargs *ca = aux; | 101 | struct confargs *ca = aux; | |
102 | int *reg = ca->ca_reg; | 102 | int *reg = ca->ca_reg; | |
103 | int node; | 103 | int node; | |
104 | 104 | |||
105 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | 105 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | |
106 | return 0; | 106 | return 0; | |
107 | 107 | |||
108 | node = OF_finddevice("/cpus"); | 108 | node = OF_finddevice("/cpus"); | |
109 | if (node != -1) { | 109 | if (node != -1) { | |
110 | for (node = OF_child(node); node != 0; node = OF_peer(node)) { | 110 | for (node = OF_child(node); node != 0; node = OF_peer(node)) { | |
111 | uint32_t cpunum; | 111 | uint32_t cpunum; | |
112 | int l; | 112 | int l; | |
113 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | 113 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | |
114 | if (l == 4 && reg[0] == cpunum) | 114 | if (l == 4 && reg[0] == cpunum) | |
115 | return 1; | 115 | return 1; | |
116 | } | 116 | } | |
117 | } | 117 | } | |
118 | switch (reg[0]) { | 118 | switch (reg[0]) { | |
119 | case 0: /* primary CPU */ | 119 | case 0: /* primary CPU */ | |
120 | return 1; | 120 | return 1; | |
121 | case 1: /* secondary CPU */ | 121 | case 1: /* secondary CPU */ | |
122 | if (OF_finddevice("/hammerhead") != -1) | 122 | if (OF_finddevice("/hammerhead") != -1) | |
123 | if (in32rb(HH_ARBCONF) & 0x02) | 123 | if (in32rb(HH_ARBCONF) & 0x02) | |
124 | return 1; | 124 | return 1; | |
125 | break; | 125 | break; | |
126 | } | 126 | } | |
127 | 127 | |||
128 | return 0; | 128 | return 0; | |
129 | } | 129 | } | |
130 | 130 | |||
131 | void cpu_OFgetspeed(struct device *, struct cpu_info *); | 131 | void cpu_OFgetspeed(device_t, struct cpu_info *); | |
132 | 132 | |||
133 | void | 133 | void | |
134 | cpu_OFgetspeed(struct device *self, struct cpu_info *ci) | 134 | cpu_OFgetspeed(device_t self, struct cpu_info *ci) | |
135 | { | 135 | { | |
136 | int node; | 136 | int node; | |
137 | 137 | |||
138 | node = OF_finddevice("/cpus"); | 138 | node = OF_finddevice("/cpus"); | |
139 | if (node != -1) { | 139 | if (node != -1) { | |
140 | for (node = OF_child(node); node; node = OF_peer(node)) { | 140 | for (node = OF_child(node); node; node = OF_peer(node)) { | |
141 | uint32_t cpunum; | 141 | uint32_t cpunum; | |
142 | int l; | 142 | int l; | |
143 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | 143 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | |
144 | if (l == 4 && ci->ci_cpuid == cpunum) { | 144 | if (l == 4 && ci->ci_cpuid == cpunum) { | |
145 | uint32_t cf; | 145 | uint32_t cf; | |
146 | l = OF_getprop(node, "clock-frequency", | 146 | l = OF_getprop(node, "clock-frequency", | |
147 | &cf, sizeof(cf)); | 147 | &cf, sizeof(cf)); | |
148 | if (l == 4) | 148 | if (l == 4) | |
149 | ci->ci_khz = cf / 1000; | 149 | ci->ci_khz = cf / 1000; | |
150 | break; | 150 | break; | |
151 | } | 151 | } | |
152 | } | 152 | } | |
153 | } | 153 | } | |
154 | } | 154 | } | |
155 | 155 | |||
156 | void | 156 | void | |
157 | cpuattach(struct device *parent, struct device *self, void *aux) | 157 | cpuattach(device_t parent, device_t self, void *aux) | |
158 | { | 158 | { | |
159 | struct cpu_info *ci; | 159 | struct cpu_info *ci; | |
160 | struct confargs *ca = aux; | 160 | struct confargs *ca = aux; | |
161 | int id = ca->ca_reg[0]; | 161 | int id = ca->ca_reg[0]; | |
162 | 162 | |||
163 | ci = cpu_attach_common(self, id); | 163 | ci = cpu_attach_common(self, id); | |
164 | if (ci == NULL) | 164 | if (ci == NULL) | |
165 | return; | 165 | return; | |
166 | 166 | |||
167 | if (ci->ci_khz == 0) { | 167 | if (ci->ci_khz == 0) { | |
168 | cpu_OFgetspeed(self, ci); | 168 | cpu_OFgetspeed(self, ci); | |
169 | } | 169 | } | |
170 | 170 | |||
171 | if (id > 0) { | 171 | if (id > 0) { | |
172 | #ifdef MULTIPROCESSOR | 172 | #ifdef MULTIPROCESSOR | |
173 | cpu_spinup(self, ci); | 173 | cpu_spinup(self, ci); | |
174 | #endif | 174 | #endif | |
175 | return; | 175 | return; | |
176 | } | 176 | } | |
177 | 177 | |||
178 | if (OF_finddevice("/bandit/ohare") != -1) { | 178 | if (OF_finddevice("/bandit/ohare") != -1) { | |
179 | printf("%s", self->dv_xname); | 179 | printf("%s", self->dv_xname); | |
180 | ohare_init(); | 180 | ohare_init(); | |
181 | } | 181 | } | |
182 | } | 182 | } | |
183 | 183 | |||
184 | #define CACHE_REG 0xf8000000 | 184 | #define CACHE_REG 0xf8000000 | |
185 | 185 | |||
186 | void | 186 | void | |
187 | ohare_init(void) | 187 | ohare_init(void) | |
188 | { | 188 | { | |
189 | volatile uint32_t *cache_reg, x; | 189 | volatile uint32_t *cache_reg, x; | |
190 | 190 | |||
191 | /* enable L2 cache */ | 191 | /* enable L2 cache */ | |
192 | cache_reg = mapiodev(CACHE_REG, PAGE_SIZE); | 192 | cache_reg = mapiodev(CACHE_REG, PAGE_SIZE); | |
193 | if (((cache_reg[2] >> 24) & 0x0f) >= 3) { | 193 | if (((cache_reg[2] >> 24) & 0x0f) >= 3) { | |
194 | x = cache_reg[4]; | 194 | x = cache_reg[4]; | |
195 | if ((x & 0x10) == 0) | 195 | if ((x & 0x10) == 0) | |
196 | x |= 0x04000000; | 196 | x |= 0x04000000; | |
197 | else | 197 | else | |
198 | x |= 0x04000020; | 198 | x |= 0x04000020; | |
199 | 199 | |||
200 | cache_reg[4] = x; | 200 | cache_reg[4] = x; | |
201 | printf(": ohare L2 cache enabled\n"); | 201 | printf(": ohare L2 cache enabled\n"); | |
202 | } | 202 | } | |
203 | } | 203 | } | |
204 | 204 | |||
205 | #ifdef MULTIPROCESSOR | 205 | #ifdef MULTIPROCESSOR | |
206 | 206 | |||
207 | int | 207 | int | |
208 | md_setup_trampoline(volatile struct cpu_hatch_data *h, struct cpu_info *ci) | 208 | md_setup_trampoline(volatile struct cpu_hatch_data *h, struct cpu_info *ci) | |
209 | { | 209 | { | |
210 | #ifdef OPENPIC | 210 | #ifdef OPENPIC | |
211 | if (openpic_base) { | 211 | if (openpic_base) { | |
212 | uint32_t kl_base = 0x80000000; /* XXX */ | 212 | uint32_t kl_base = 0x80000000; /* XXX */ | |
213 | uint32_t gpio = kl_base + 0x5c; /* XXX */ | 213 | uint32_t gpio = kl_base + 0x5c; /* XXX */ | |
214 | u_int node, off; | 214 | u_int node, off; | |
215 | char cpupath[32]; | 215 | char cpupath[32]; | |
216 | 216 | |||
217 | /* construct an absolute branch instruction */ | 217 | /* construct an absolute branch instruction */ | |
218 | *(u_int *)EXC_RST = /* ba cpu_spinup_trampoline */ | 218 | *(u_int *)EXC_RST = /* ba cpu_spinup_trampoline */ | |
219 | 0x48000002 | (u_int)cpu_spinup_trampoline; | 219 | 0x48000002 | (u_int)cpu_spinup_trampoline; | |
220 | __syncicache((void *)EXC_RST, 0x100); | 220 | __syncicache((void *)EXC_RST, 0x100); | |
221 | h->running = -1; | 221 | h->running = -1; | |
222 | 222 | |||
223 | /* see if there's an OF property for the reset register */ | 223 | /* see if there's an OF property for the reset register */ | |
224 | sprintf(cpupath, "/cpus/@%x", ci->ci_cpuid); | 224 | sprintf(cpupath, "/cpus/@%x", ci->ci_cpuid); | |
225 | node = OF_finddevice(cpupath); | 225 | node = OF_finddevice(cpupath); | |
226 | if (node == -1) { | 226 | if (node == -1) { | |
227 | printf(": no OF node for CPU %d?\n", ci->ci_cpuid); | 227 | printf(": no OF node for CPU %d?\n", ci->ci_cpuid); | |
228 | return -1; | 228 | return -1; | |
229 | } | 229 | } | |
230 | if (OF_getprop(node, "soft-reset", &off, 4) == 4) { | 230 | if (OF_getprop(node, "soft-reset", &off, 4) == 4) { | |
231 | gpio = kl_base + off; | 231 | gpio = kl_base + off; | |
232 | } | 232 | } | |
233 | 233 | |||
234 | /* Start secondary CPU. */ | 234 | /* Start secondary CPU. */ | |
235 | #if 1 | 235 | #if 1 | |
236 | out8(gpio, 4); | 236 | out8(gpio, 4); | |
237 | out8(gpio, 0); | 237 | out8(gpio, 0); | |
238 | #else | 238 | #else | |
239 | openpic_write(OPENPIC_PROC_INIT, (1 << 1)); | 239 | openpic_write(OPENPIC_PROC_INIT, (1 << 1)); | |
240 | #endif | 240 | #endif | |
241 | } else { | 241 | } else { | |
242 | #endif /* OPENPIC */ | 242 | #endif /* OPENPIC */ | |
243 | /* Start secondary CPU and stop timebase. */ | 243 | /* Start secondary CPU and stop timebase. */ | |
244 | out32(0xf2800000, (int)cpu_spinup_trampoline); | 244 | out32(0xf2800000, (int)cpu_spinup_trampoline); | |
245 | cpu_send_ipi(1, IPI_NOMESG); | 245 | cpu_send_ipi(1, IPI_NOMESG); | |
246 | #ifdef OPENPIC | 246 | #ifdef OPENPIC | |
247 | } | 247 | } | |
248 | #endif | 248 | #endif | |
249 | return 1; | 249 | return 1; | |
250 | } | 250 | } | |
251 | 251 | |||
252 | void | 252 | void | |
253 | md_presync_timebase(volatile struct cpu_hatch_data *h) | 253 | md_presync_timebase(volatile struct cpu_hatch_data *h) | |
254 | { | 254 | { | |
255 | #ifdef OPENPIC | 255 | #ifdef OPENPIC | |
256 | if (openpic_base) { | 256 | if (openpic_base) { | |
257 | uint64_t tb; | 257 | uint64_t tb; | |
258 | 258 | |||
259 | /* Sync timebase. */ | 259 | /* Sync timebase. */ | |
260 | tb = mftb(); | 260 | tb = mftb(); | |
261 | tb += 100000; /* 3ms @ 33MHz */ | 261 | tb += 100000; /* 3ms @ 33MHz */ | |
262 | 262 | |||
263 | h->tbu = tb >> 32; | 263 | h->tbu = tb >> 32; | |
264 | h->tbl = tb & 0xffffffff; | 264 | h->tbl = tb & 0xffffffff; | |
265 | 265 | |||
266 | while (tb > mftb()) | 266 | while (tb > mftb()) | |
267 | ; | 267 | ; | |
268 | 268 | |||
269 | __asm volatile ("sync; isync"); | 269 | __asm volatile ("sync; isync"); | |
270 | h->running = 0; | 270 | h->running = 0; | |
271 | 271 | |||
272 | delay(500000); | 272 | delay(500000); | |
273 | } else | 273 | } else | |
274 | #endif /* OPENPIC */ | 274 | #endif /* OPENPIC */ | |
275 | { | 275 | { | |
276 | /* sync timebase (XXX shouldn't be zero'ed) */ | 276 | /* sync timebase (XXX shouldn't be zero'ed) */ | |
277 | __asm volatile ("mttbl %0; mttbu %0; mttbl %0" :: "r"(0)); | 277 | __asm volatile ("mttbl %0; mttbu %0; mttbl %0" :: "r"(0)); | |
278 | } | 278 | } | |
279 | } | 279 | } | |
280 | 280 | |||
281 | void | 281 | void | |
282 | md_start_timebase(volatile struct cpu_hatch_data *h) | 282 | md_start_timebase(volatile struct cpu_hatch_data *h) | |
283 | { | 283 | { | |
284 | int i; | 284 | int i; | |
285 | #ifdef OPENPIC | 285 | #ifdef OPENPIC | |
286 | if (!openpic_base) { | 286 | if (!openpic_base) { | |
287 | #endif | 287 | #endif | |
288 | /* | 288 | /* | |
289 | * wait for secondary spin up (1.5ms @ 604/200MHz) | 289 | * wait for secondary spin up (1.5ms @ 604/200MHz) | |
290 | * XXX we cannot use delay() here because timebase is not | 290 | * XXX we cannot use delay() here because timebase is not | |
291 | * running. | 291 | * running. | |
292 | */ | 292 | */ | |
293 | for (i = 0; i < 100000; i++) | 293 | for (i = 0; i < 100000; i++) | |
294 | if (h->running) | 294 | if (h->running) | |
295 | break; | 295 | break; | |
296 | 296 | |||
297 | /* Start timebase. */ | 297 | /* Start timebase. */ | |
298 | out32(0xf2800000, 0x100); | 298 | out32(0xf2800000, 0x100); | |
299 | cpu_send_ipi(1, IPI_NOMESG); | 299 | cpu_send_ipi(1, IPI_NOMESG); | |
300 | #ifdef OPENPIC | 300 | #ifdef OPENPIC | |
301 | } | 301 | } | |
302 | #endif | 302 | #endif | |
303 | } | 303 | } | |
304 | 304 | |||
305 | void | 305 | void | |
306 | md_sync_timebase(volatile struct cpu_hatch_data *h) | 306 | md_sync_timebase(volatile struct cpu_hatch_data *h) | |
307 | { | 307 | { | |
308 | #ifdef OPENPIC | 308 | #ifdef OPENPIC | |
309 | if (openpic_base) { | 309 | if (openpic_base) { | |
310 | /* Sync timebase. */ | 310 | /* Sync timebase. */ | |
311 | u_int tbu = h->tbu; | 311 | u_int tbu = h->tbu; | |
312 | u_int tbl = h->tbl; | 312 | u_int tbl = h->tbl; | |
313 | while (h->running == -1) | 313 | while (h->running == -1) | |
314 | ; | 314 | ; | |
315 | __asm volatile ("sync; isync"); | 315 | __asm volatile ("sync; isync"); | |
316 | __asm volatile ("mttbl %0" :: "r"(0)); | 316 | __asm volatile ("mttbl %0" :: "r"(0)); | |
317 | __asm volatile ("mttbu %0" :: "r"(tbu)); | 317 | __asm volatile ("mttbu %0" :: "r"(tbu)); | |
318 | __asm volatile ("mttbl %0" :: "r"(tbl)); | 318 | __asm volatile ("mttbl %0" :: "r"(tbl)); | |
319 | } | 319 | } | |
320 | #endif | 320 | #endif | |
321 | } | 321 | } | |
322 | 322 | |||
323 | void | 323 | void | |
324 | md_setup_interrupts(void) | 324 | md_setup_interrupts(void) | |
325 | { | 325 | { | |
326 | #ifdef OPENPIC | 326 | #ifdef OPENPIC | |
327 | if (openpic_base) | 327 | if (openpic_base) | |
328 | openpic_set_priority(cpu_number(), 0); | 328 | openpic_set_priority(cpu_number(), 0); | |
329 | else | 329 | else | |
330 | #endif /* OPENPIC */ | 330 | #endif /* OPENPIC */ | |
331 | out32(HH_INTR_SECONDARY, ~0); /* Reset interrupt. */ | 331 | out32(HH_INTR_SECONDARY, ~0); /* Reset interrupt. */ | |
332 | } | 332 | } | |
333 | #endif /* MULTIPROCESSOR */ | 333 | #endif /* MULTIPROCESSOR */ |
--- src/sys/arch/macppc/macppc/mainbus.c 2009/03/14 21:04:12 1.20
+++ src/sys/arch/macppc/macppc/mainbus.c 2011/06/05 17:03:16 1.21
@@ -1,109 +1,109 @@ | @@ -1,109 +1,109 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.20 2009/03/14 21:04:12 dsl Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | 4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
15 | * must display the following acknowledgement: | 15 | * must display the following acknowledgement: | |
16 | * This product includes software developed by Christopher G. Demetriou | 16 | * This product includes software developed by Christopher G. Demetriou | |
17 | * for the NetBSD Project. | 17 | * for the NetBSD Project. | |
18 | * 4. The name of the author may not be used to endorse or promote products | 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 | 19 | * derived from this software without specific prior written permission | |
20 | * | 20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 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 | 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 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 | 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2009/03/14 21:04:12 dsl Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:16 matt Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/device.h> | 37 | #include <sys/device.h> | |
38 | #include <sys/systm.h> | 38 | #include <sys/systm.h> | |
39 | 39 | |||
40 | #include <dev/pci/pcivar.h> | 40 | #include <dev/pci/pcivar.h> | |
41 | #include <dev/ofw/openfirm.h> | 41 | #include <dev/ofw/openfirm.h> | |
42 | 42 | |||
43 | #include <machine/autoconf.h> | 43 | #include <machine/autoconf.h> | |
44 | 44 | |||
45 | #include <powerpc/pic/picvar.h> | 45 | #include <powerpc/pic/picvar.h> | |
46 | 46 | |||
47 | int mainbus_match(struct device *, struct cfdata *, void *); | 47 | int mainbus_match(device_t, cfdata_t, void *); | |
48 | void mainbus_attach(struct device *, struct device *, void *); | 48 | void mainbus_attach(device_t, device_t, void *); | |
49 | 49 | |||
50 | CFATTACH_DECL(mainbus, sizeof(struct device), | 50 | CFATTACH_DECL_NEW(mainbus, 0, | |
51 | mainbus_match, mainbus_attach, NULL, NULL); | 51 | mainbus_match, mainbus_attach, NULL, NULL); | |
52 | 52 | |||
53 | /* | 53 | /* | |
54 | * Probe for the mainbus; always succeeds. | 54 | * Probe for the mainbus; always succeeds. | |
55 | */ | 55 | */ | |
56 | int | 56 | int | |
57 | mainbus_match(struct device *parent, struct cfdata *cf, void *aux) | 57 | mainbus_match(device_t parent, cfdata_t cf, void *aux) | |
58 | { | 58 | { | |
59 | return 1; | 59 | return 1; | |
60 | } | 60 | } | |
61 | 61 | |||
62 | /* | 62 | /* | |
63 | * Attach the mainbus. | 63 | * Attach the mainbus. | |
64 | */ | 64 | */ | |
65 | void | 65 | void | |
66 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 66 | mainbus_attach(device_t parent, device_t self, void *aux) | |
67 | { | 67 | { | |
68 | struct ofbus_attach_args oba; | 68 | struct ofbus_attach_args oba; | |
69 | struct confargs ca; | 69 | struct confargs ca; | |
70 | int node, i; | 70 | int node, i; | |
71 | u_int32_t reg[4]; | 71 | u_int32_t reg[4]; | |
72 | char name[32]; | 72 | char name[32]; | |
73 | 73 | |||
74 | printf("\n"); | 74 | printf("\n"); | |
75 | 75 | |||
76 | for (i = 0; i < 2; i++) { | 76 | for (i = 0; i < 2; i++) { | |
77 | ca.ca_name = "cpu"; | 77 | ca.ca_name = "cpu"; | |
78 | ca.ca_reg = reg; | 78 | ca.ca_reg = reg; | |
79 | reg[0] = i; | 79 | reg[0] = i; | |
80 | config_found(self, &ca, NULL); | 80 | config_found(self, &ca, NULL); | |
81 | } | 81 | } | |
82 | 82 | |||
83 | pic_finish_setup(); | 83 | pic_finish_setup(); | |
84 | 84 | |||
85 | node = OF_peer(0); | 85 | node = OF_peer(0); | |
86 | if (node) { | 86 | if (node) { | |
87 | oba.oba_busname = "ofw"; | 87 | oba.oba_busname = "ofw"; | |
88 | oba.oba_phandle = node; | 88 | oba.oba_phandle = node; | |
89 | config_found(self, &oba, NULL); | 89 | config_found(self, &oba, NULL); | |
90 | } | 90 | } | |
91 | 91 | |||
92 | for (node = OF_child(OF_finddevice("/")); node; node = OF_peer(node)) { | 92 | for (node = OF_child(OF_finddevice("/")); node; node = OF_peer(node)) { | |
93 | memset(name, 0, sizeof(name)); | 93 | memset(name, 0, sizeof(name)); | |
94 | if (OF_getprop(node, "name", name, sizeof(name)) == -1) | 94 | if (OF_getprop(node, "name", name, sizeof(name)) == -1) | |
95 | continue; | 95 | continue; | |
96 | 96 | |||
97 | ca.ca_name = name; | 97 | ca.ca_name = name; | |
98 | ca.ca_node = node; | 98 | ca.ca_node = node; | |
99 | ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg)); | 99 | ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg)); | |
100 | ca.ca_reg = reg; | 100 | ca.ca_reg = reg; | |
101 | config_found(self, &ca, NULL); | 101 | config_found(self, &ca, NULL); | |
102 | } | 102 | } | |
103 | 103 | |||
104 | #ifdef MAMBO | 104 | #ifdef MAMBO | |
105 | ca.ca_name="com"; | 105 | ca.ca_name="com"; | |
106 | config_found(self, &ca, NULL); | 106 | config_found(self, &ca, NULL); | |
107 | #endif | 107 | #endif | |
108 | 108 | |||
109 | } | 109 | } |
--- src/sys/arch/mmeye/mmeye/mainbus.c 2011/02/19 10:46:29 1.8
+++ src/sys/arch/mmeye/mmeye/mainbus.c 2011/06/05 17:03:18 1.9
@@ -1,112 +1,112 @@ | @@ -1,112 +1,112 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.8 2011/02/19 10:46:29 kiyohara Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.9 2011/06/05 17:03:18 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2002 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
15 | * | 15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | 26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.8 2011/02/19 10:46:29 kiyohara Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.9 2011/06/05 17:03:18 matt Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/systm.h> | 33 | #include <sys/systm.h> | |
34 | #include <sys/device.h> | 34 | #include <sys/device.h> | |
35 | #include <machine/autoconf.h> | 35 | #include <machine/autoconf.h> | |
36 | 36 | |||
37 | #include "locators.h" | 37 | #include "locators.h" | |
38 | 38 | |||
39 | static int mainbus_match(device_t, struct cfdata *, void *); | 39 | static int mainbus_match(device_t, cfdata_t, void *); | |
40 | static void mainbus_attach(device_t, device_t, void *); | 40 | static void mainbus_attach(device_t, device_t, void *); | |
41 | static int mainbus_search(device_t, cfdata_t, const int *, void *); | 41 | static int mainbus_search(device_t, cfdata_t, const int *, void *); | |
42 | static int mainbus_print(void *, const char *); | 42 | static int mainbus_print(void *, const char *); | |
43 | 43 | |||
44 | CFATTACH_DECL(mainbus, sizeof(struct device), | 44 | CFATTACH_DECL_NEW(mainbus, 0, | |
45 | mainbus_match, mainbus_attach, NULL, NULL); | 45 | mainbus_match, mainbus_attach, NULL, NULL); | |
46 | 46 | |||
47 | static int | 47 | static int | |
48 | mainbus_match(device_t parent, struct cfdata *cf, void *aux) | 48 | mainbus_match(device_t parent, cfdata_t cf, void *aux) | |
49 | { | 49 | { | |
50 | 50 | |||
51 | return 1; | 51 | return 1; | |
52 | } | 52 | } | |
53 | 53 | |||
54 | static void | 54 | static void | |
55 | mainbus_attach(device_t parent, device_t self, void *aux) | 55 | mainbus_attach(device_t parent, device_t self, void *aux) | |
56 | { | 56 | { | |
57 | struct mainbus_attach_args maa; | 57 | struct mainbus_attach_args maa; | |
58 | 58 | |||
59 | aprint_naive("\n"); | 59 | aprint_naive("\n"); | |
60 | aprint_normal("\n"); | 60 | aprint_normal("\n"); | |
61 | 61 | |||
62 | maa.ma_addr1 = MAINBUSCF_ADDR1_DEFAULT; | 62 | maa.ma_addr1 = MAINBUSCF_ADDR1_DEFAULT; | |
63 | maa.ma_irq1 = MAINBUSCF_IRQ1_DEFAULT; | 63 | maa.ma_irq1 = MAINBUSCF_IRQ1_DEFAULT; | |
64 | 64 | |||
65 | /* CPU and SHBus */ | 65 | /* CPU and SHBus */ | |
66 | maa.ma_name = "cpu"; | 66 | maa.ma_name = "cpu"; | |
67 | config_found_ia(self, "mainbus", &maa, mainbus_print); | 67 | config_found_ia(self, "mainbus", &maa, mainbus_print); | |
68 | maa.ma_name = "shb"; | 68 | maa.ma_name = "shb"; | |
69 | config_found_ia(self, "mainbus", &maa, mainbus_print); | 69 | config_found_ia(self, "mainbus", &maa, mainbus_print); | |
70 | 70 | |||
71 | /* Devices */ | 71 | /* Devices */ | |
72 | config_search_ia(mainbus_search, self, "mainbus", 0); | 72 | config_search_ia(mainbus_search, self, "mainbus", 0); | |
73 | } | 73 | } | |
74 | 74 | |||
75 | static int | 75 | static int | |
76 | mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) | 76 | mainbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) | |
77 | { | 77 | { | |
78 | struct mainbus_attach_args maa; | 78 | struct mainbus_attach_args maa; | |
79 | 79 | |||
80 | if (strcmp(cf->cf_name, "cpu") == 0 || | 80 | if (strcmp(cf->cf_name, "cpu") == 0 || | |
81 | strcmp(cf->cf_name, "shb") == 0) | 81 | strcmp(cf->cf_name, "shb") == 0) | |
82 | return 0; | 82 | return 0; | |
83 | 83 | |||
84 | maa.ma_name = cf->cf_name; | 84 | maa.ma_name = cf->cf_name; | |
85 | maa.ma_addr1 = cf->cf_loc[MAINBUSCF_ADDR1]; | 85 | maa.ma_addr1 = cf->cf_loc[MAINBUSCF_ADDR1]; | |
86 | maa.ma_addr2 = cf->cf_loc[MAINBUSCF_ADDR2]; | 86 | maa.ma_addr2 = cf->cf_loc[MAINBUSCF_ADDR2]; | |
87 | maa.ma_irq1 = cf->cf_loc[MAINBUSCF_IRQ1]; | 87 | maa.ma_irq1 = cf->cf_loc[MAINBUSCF_IRQ1]; | |
88 | maa.ma_irq2 = cf->cf_loc[MAINBUSCF_IRQ2]; | 88 | maa.ma_irq2 = cf->cf_loc[MAINBUSCF_IRQ2]; | |
89 | 89 | |||
90 | if (config_match(parent, cf, &maa)) | 90 | if (config_match(parent, cf, &maa)) | |
91 | config_attach(parent, cf, &maa, mainbus_print); | 91 | config_attach(parent, cf, &maa, mainbus_print); | |
92 | 92 | |||
93 | return 0; | 93 | return 0; | |
94 | } | 94 | } | |
95 | 95 | |||
96 | static int | 96 | static int | |
97 | mainbus_print(void *aux, const char *pnp) | 97 | mainbus_print(void *aux, const char *pnp) | |
98 | { | 98 | { | |
99 | struct mainbus_attach_args *maa = aux; | 99 | struct mainbus_attach_args *maa = aux; | |
100 | 100 | |||
101 | if (maa->ma_addr1 != MAINBUSCF_ADDR1_DEFAULT) { | 101 | if (maa->ma_addr1 != MAINBUSCF_ADDR1_DEFAULT) { | |
102 | aprint_normal(" addr 0x%lx", maa->ma_addr1); | 102 | aprint_normal(" addr 0x%lx", maa->ma_addr1); | |
103 | if (maa->ma_addr2 != MAINBUSCF_ADDR2_DEFAULT) | 103 | if (maa->ma_addr2 != MAINBUSCF_ADDR2_DEFAULT) | |
104 | aprint_normal(",0x%lx", maa->ma_addr2); | 104 | aprint_normal(",0x%lx", maa->ma_addr2); | |
105 | } | 105 | } | |
106 | if (maa->ma_irq1 != MAINBUSCF_IRQ1_DEFAULT) { | 106 | if (maa->ma_irq1 != MAINBUSCF_IRQ1_DEFAULT) { | |
107 | aprint_normal(" irq %d", maa->ma_irq1); | 107 | aprint_normal(" irq %d", maa->ma_irq1); | |
108 | if (maa->ma_irq2 != MAINBUSCF_IRQ2_DEFAULT) | 108 | if (maa->ma_irq2 != MAINBUSCF_IRQ2_DEFAULT) | |
109 | aprint_normal(",%d", maa->ma_irq2); | 109 | aprint_normal(",%d", maa->ma_irq2); | |
110 | } | 110 | } | |
111 | return pnp ? QUIET : UNCONF; | 111 | return pnp ? QUIET : UNCONF; | |
112 | } | 112 | } |
--- src/sys/arch/mvme68k/dev/mainbus.c 2008/04/28 20:23:29 1.20
+++ src/sys/arch/mvme68k/dev/mainbus.c 2011/06/05 17:03:19 1.21
@@ -1,251 +1,251 @@ | @@ -1,251 +1,251 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.20 2008/04/28 20:23:29 martin Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:19 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Steve C. Woodford | 8 | * by Steve C. Woodford | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Derived from the mainbus code in mvme68k/autoconf.c by Chuck Cranor. | 33 | * Derived from the mainbus code in mvme68k/autoconf.c by Chuck Cranor. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2008/04/28 20:23:29 martin Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2011/06/05 17:03:19 matt Exp $"); | |
38 | 38 | |||
39 | #include "vmetwo.h" | 39 | #include "vmetwo.h" | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/kernel.h> | 42 | #include <sys/kernel.h> | |
43 | #include <sys/systm.h> | 43 | #include <sys/systm.h> | |
44 | #include <sys/device.h> | 44 | #include <sys/device.h> | |
45 | 45 | |||
46 | #define _MVME68K_BUS_DMA_PRIVATE | 46 | #define _MVME68K_BUS_DMA_PRIVATE | |
47 | #define _MVME68K_BUS_SPACE_PRIVATE | 47 | #define _MVME68K_BUS_SPACE_PRIVATE | |
48 | #include <machine/bus.h> | 48 | #include <machine/bus.h> | |
49 | #undef _MVME68K_BUS_DMA_PRIVATE | 49 | #undef _MVME68K_BUS_DMA_PRIVATE | |
50 | #undef _MVME68K_BUS_SPACE_PRIVATE | 50 | #undef _MVME68K_BUS_SPACE_PRIVATE | |
51 | #include <machine/cpu.h> | 51 | #include <machine/cpu.h> | |
52 | 52 | |||
53 | #include <mvme68k/dev/mainbus.h> | 53 | #include <mvme68k/dev/mainbus.h> | |
54 | 54 | |||
55 | #if defined(MVME162) || defined(MVME172) || defined(MVME167) || defined(MVME177) | 55 | #if defined(MVME162) || defined(MVME172) || defined(MVME167) || defined(MVME177) | |
56 | #if NVMETWO == 0 | 56 | #if NVMETWO == 0 | |
57 | #include <dev/vme/vmevar.h> | 57 | #include <dev/vme/vmevar.h> | |
58 | #include <dev/mvme/mvmebus.h> | 58 | #include <dev/mvme/mvmebus.h> | |
59 | #include <dev/mvme/vme_twovar.h> | 59 | #include <dev/mvme/vme_twovar.h> | |
60 | #endif | 60 | #endif | |
61 | #endif | 61 | #endif | |
62 | 62 | |||
63 | void mainbus_attach(struct device *, struct device *, void *); | 63 | void mainbus_attach(device_t, device_t, void *); | |
64 | int mainbus_match(struct device *, struct cfdata *, void *); | 64 | int mainbus_match(device_t, cfdata_t, void *); | |
65 | int mainbus_print(void *, const char *); | 65 | int mainbus_print(void *, const char *); | |
66 | 66 | |||
67 | CFATTACH_DECL(mainbus, sizeof(struct device), | 67 | CFATTACH_DECL_NEW(mainbus, 0, | |
68 | mainbus_match, mainbus_attach, NULL, NULL); | 68 | mainbus_match, mainbus_attach, NULL, NULL); | |
69 | 69 | |||
70 | 70 | |||
71 | struct mainbus_devices { | 71 | struct mainbus_devices { | |
72 | const char *md_name; | 72 | const char *md_name; | |
73 | bus_addr_t md_offset; | 73 | bus_addr_t md_offset; | |
74 | }; | 74 | }; | |
75 | 75 | |||
76 | #ifdef MVME147 | 76 | #ifdef MVME147 | |
77 | static struct mainbus_devices mainbusdevs_147[] = { | 77 | static struct mainbus_devices mainbusdevs_147[] = { | |
78 | {"pcc", MAINBUS_PCC_OFFSET}, | 78 | {"pcc", MAINBUS_PCC_OFFSET}, | |
79 | {"timekeeper", MAINBUS_TK147_OFFSET}, | 79 | {"timekeeper", MAINBUS_TK147_OFFSET}, | |
80 | {NULL, 0} | 80 | {NULL, 0} | |
81 | }; | 81 | }; | |
82 | #endif | 82 | #endif | |
83 | 83 | |||
84 | #if defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177) | 84 | #if defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177) | |
85 | static struct mainbus_devices mainbusdevs_1x7[] = { | 85 | static struct mainbus_devices mainbusdevs_1x7[] = { | |
86 | {"pcctwo", MAINBUS_PCCTWO_OFFSET}, | 86 | {"pcctwo", MAINBUS_PCCTWO_OFFSET}, | |
87 | {"vmetwo", MAINBUS_VMETWO_OFFSET}, | 87 | {"vmetwo", MAINBUS_VMETWO_OFFSET}, | |
88 | {"timekeeper", MAINBUS_TIMEKEEPER_OFFSET}, | 88 | {"timekeeper", MAINBUS_TIMEKEEPER_OFFSET}, | |
89 | {NULL, 0} | 89 | {NULL, 0} | |
90 | }; | 90 | }; | |
91 | #endif | 91 | #endif | |
92 | 92 | |||
93 | struct mvme68k_bus_dma_tag _mainbus_dma_tag = { | 93 | struct mvme68k_bus_dma_tag _mainbus_dma_tag = { | |
94 | NULL, | 94 | NULL, | |
95 | _bus_dmamap_create, | 95 | _bus_dmamap_create, | |
96 | _bus_dmamap_destroy, | 96 | _bus_dmamap_destroy, | |
97 | _bus_dmamap_load_direct, | 97 | _bus_dmamap_load_direct, | |
98 | _bus_dmamap_load_mbuf_direct, | 98 | _bus_dmamap_load_mbuf_direct, | |
99 | _bus_dmamap_load_uio_direct, | 99 | _bus_dmamap_load_uio_direct, | |
100 | _bus_dmamap_load_raw_direct, | 100 | _bus_dmamap_load_raw_direct, | |
101 | _bus_dmamap_unload, | 101 | _bus_dmamap_unload, | |
102 | NULL, /* Set up at run-time */ | 102 | NULL, /* Set up at run-time */ | |
103 | _bus_dmamem_alloc, | 103 | _bus_dmamem_alloc, | |
104 | _bus_dmamem_free, | 104 | _bus_dmamem_free, | |
105 | _bus_dmamem_map, | 105 | _bus_dmamem_map, | |
106 | _bus_dmamem_unmap, | 106 | _bus_dmamem_unmap, | |
107 | _bus_dmamem_mmap | 107 | _bus_dmamem_mmap | |
108 | }; | 108 | }; | |
109 | 109 | |||
110 | struct mvme68k_bus_space_tag _mainbus_space_tag = { | 110 | struct mvme68k_bus_space_tag _mainbus_space_tag = { | |
111 | NULL, | 111 | NULL, | |
112 | _bus_space_map, | 112 | _bus_space_map, | |
113 | _bus_space_unmap, | 113 | _bus_space_unmap, | |
114 | _bus_space_peek_1, | 114 | _bus_space_peek_1, | |
115 | _bus_space_peek_2, | 115 | _bus_space_peek_2, | |
116 | _bus_space_peek_4, | 116 | _bus_space_peek_4, | |
117 | _bus_space_poke_1, | 117 | _bus_space_poke_1, | |
118 | _bus_space_poke_2, | 118 | _bus_space_poke_2, | |
119 | _bus_space_poke_4 | 119 | _bus_space_poke_4 | |
120 | }; | 120 | }; | |
121 | 121 | |||
122 | 122 | |||
123 | /* ARGSUSED */ | 123 | /* ARGSUSED */ | |
124 | int | 124 | int | |
125 | mainbus_match(struct device *parent, struct cfdata *cf, void *args) | 125 | mainbus_match(device_t parent, cfdata_t cf, void *args) | |
126 | { | 126 | { | |
127 | static int mainbus_matched; | 127 | static int mainbus_matched; | |
128 | 128 | |||
129 | if (mainbus_matched) | 129 | if (mainbus_matched) | |
130 | return 0; | 130 | return 0; | |
131 | 131 | |||
132 | return (mainbus_matched = 1); | 132 | return (mainbus_matched = 1); | |
133 | } | 133 | } | |
134 | 134 | |||
135 | /* ARGSUSED */ | 135 | /* ARGSUSED */ | |
136 | void | 136 | void | |
137 | mainbus_attach(struct device *parent, struct device *self, void *args) | 137 | mainbus_attach(device_t parent, device_t self, void *args) | |
138 | { | 138 | { | |
139 | struct mainbus_attach_args ma; | 139 | struct mainbus_attach_args ma; | |
140 | struct mainbus_devices *devices; | 140 | struct mainbus_devices *devices; | |
141 | int i; | 141 | int i; | |
142 | 142 | |||
143 | printf("\n"); | 143 | printf("\n"); | |
144 | 144 | |||
145 | /* | 145 | /* | |
146 | * Attach children appropriate for this CPU. | 146 | * Attach children appropriate for this CPU. | |
147 | */ | 147 | */ | |
148 | switch (machineid) { | 148 | switch (machineid) { | |
149 | #ifdef MVME147 | 149 | #ifdef MVME147 | |
150 | case MVME_147: | 150 | case MVME_147: | |
151 | devices = mainbusdevs_147; | 151 | devices = mainbusdevs_147; | |
152 | _mainbus_dma_tag._dmamap_sync = _bus_dmamap_sync_030; | 152 | _mainbus_dma_tag._dmamap_sync = _bus_dmamap_sync_030; | |
153 | break; | 153 | break; | |
154 | #endif | 154 | #endif | |
155 | 155 | |||
156 | #if defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177) | 156 | #if defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177) | |
157 | case MVME_162: | 157 | case MVME_162: | |
158 | case MVME_167: | 158 | case MVME_167: | |
159 | case MVME_172: | 159 | case MVME_172: | |
160 | case MVME_177: | 160 | case MVME_177: | |
161 | devices = mainbusdevs_1x7; | 161 | devices = mainbusdevs_1x7; | |
162 | _mainbus_dma_tag._dmamap_sync = _bus_dmamap_sync_0460; | 162 | _mainbus_dma_tag._dmamap_sync = _bus_dmamap_sync_0460; | |
163 | break; | 163 | break; | |
164 | #endif | 164 | #endif | |
165 | 165 | |||
166 | default: | 166 | default: | |
167 | panic("mainbus_attach: impossible CPU type"); | 167 | panic("mainbus_attach: impossible CPU type"); | |
168 | } | 168 | } | |
169 | 169 | |||
170 | for (i = 0; devices[i].md_name != NULL; ++i) { | 170 | for (i = 0; devices[i].md_name != NULL; ++i) { | |
171 | /* | 171 | /* | |
172 | * On mvme162 and up, if the kernel config file had no vmetwo0 | 172 | * On mvme162 and up, if the kernel config file had no vmetwo0 | |
173 | * device, we have to do some manual initialisation on the | 173 | * device, we have to do some manual initialisation on the | |
174 | * VMEChip2 to get local interrupts working (ABORT switch, | 174 | * VMEChip2 to get local interrupts working (ABORT switch, | |
175 | * hardware assisted soft interrupts). | 175 | * hardware assisted soft interrupts). | |
176 | */ | 176 | */ | |
177 | #if defined(MVME162) || defined(MVME172) || defined(MVME167) || defined(MVME177) | 177 | #if defined(MVME162) || defined(MVME172) || defined(MVME167) || defined(MVME177) | |
178 | #if NVMETWO == 0 | 178 | #if NVMETWO == 0 | |
179 | if (devices[i].md_offset == MAINBUS_VMETWO_OFFSET | 179 | if (devices[i].md_offset == MAINBUS_VMETWO_OFFSET | |
180 | #if defined(MVME147) | 180 | #if defined(MVME147) | |
181 | && machineid != MVME_147 | 181 | && machineid != MVME_147 | |
182 | #endif | 182 | #endif | |
183 | ) { | 183 | ) { | |
184 | (void)vmetwo_probe(&_mainbus_space_tag, | 184 | (void)vmetwo_probe(&_mainbus_space_tag, | |
185 | intiobase_phys + MAINBUS_VMETWO_OFFSET); | 185 | intiobase_phys + MAINBUS_VMETWO_OFFSET); | |
186 | continue; | 186 | continue; | |
187 | } | 187 | } | |
188 | #endif | 188 | #endif | |
189 | #endif | 189 | #endif | |
190 | ma.ma_name = devices[i].md_name; | 190 | ma.ma_name = devices[i].md_name; | |
191 | ma.ma_dmat = &_mainbus_dma_tag; | 191 | ma.ma_dmat = &_mainbus_dma_tag; | |
192 | ma.ma_bust = &_mainbus_space_tag; | 192 | ma.ma_bust = &_mainbus_space_tag; | |
193 | ma.ma_offset = devices[i].md_offset + intiobase_phys; | 193 | ma.ma_offset = devices[i].md_offset + intiobase_phys; | |
194 | 194 | |||
195 | (void)config_found(self, &ma, mainbus_print); | 195 | (void)config_found(self, &ma, mainbus_print); | |
196 | } | 196 | } | |
197 | 197 | |||
198 | 198 | |||
199 | /* | 199 | /* | |
200 | * Attach the memory controllers on mvme162->mvme177. | 200 | * Attach the memory controllers on mvme162->mvme177. | |
201 | * Note: These *must* be attached after the PCCChip2/MCChip. | 201 | * Note: These *must* be attached after the PCCChip2/MCChip. | |
202 | * They must also be attached *after* the VMEchip2 has been | 202 | * They must also be attached *after* the VMEchip2 has been | |
203 | * initialised (either by the driver, or the vmetwo_probe() | 203 | * initialised (either by the driver, or the vmetwo_probe() | |
204 | * call above). | 204 | * call above). | |
205 | */ | 205 | */ | |
206 | #if defined(MVME162) || defined(MVME172) || defined(MVME167) || defined(MVME177) | 206 | #if defined(MVME162) || defined(MVME172) || defined(MVME167) || defined(MVME177) | |
207 | #if defined(MVME147) | 207 | #if defined(MVME147) | |
208 | if (machineid != MVME_147) | 208 | if (machineid != MVME_147) | |
209 | #endif | 209 | #endif | |
210 | { | 210 | { | |
211 | ma.ma_name = "memc"; | 211 | ma.ma_name = "memc"; | |
212 | ma.ma_dmat = &_mainbus_dma_tag; | 212 | ma.ma_dmat = &_mainbus_dma_tag; | |
213 | ma.ma_bust = &_mainbus_space_tag; | 213 | ma.ma_bust = &_mainbus_space_tag; | |
214 | ma.ma_offset = MAINBUS_MEMC1_OFFSET + intiobase_phys; | 214 | ma.ma_offset = MAINBUS_MEMC1_OFFSET + intiobase_phys; | |
215 | (void)config_found(self, &ma, mainbus_print); | 215 | (void)config_found(self, &ma, mainbus_print); | |
216 | ma.ma_offset = MAINBUS_MEMC2_OFFSET + intiobase_phys; | 216 | ma.ma_offset = MAINBUS_MEMC2_OFFSET + intiobase_phys; | |
217 | (void)config_found(self, &ma, mainbus_print); | 217 | (void)config_found(self, &ma, mainbus_print); | |
218 | } | 218 | } | |
219 | #endif | 219 | #endif | |
220 | 220 | |||
221 | /* | 221 | /* | |
222 | * Attach Industry Pack modules on mvme162 and mvme172 | 222 | * Attach Industry Pack modules on mvme162 and mvme172 | |
223 | */ | 223 | */ | |
224 | #if defined(MVME162) || defined(MVME172) | 224 | #if defined(MVME162) || defined(MVME172) | |
225 | #if defined(MVME147) || defined(MVME167) || defined(MVME177) | 225 | #if defined(MVME147) || defined(MVME167) || defined(MVME177) | |
226 | if (machineid == MVME_162 || machineid == MVME_172) | 226 | if (machineid == MVME_162 || machineid == MVME_172) | |
227 | #endif | 227 | #endif | |
228 | { | 228 | { | |
229 | ma.ma_name = "ipack"; | 229 | ma.ma_name = "ipack"; | |
230 | ma.ma_dmat = &_mainbus_dma_tag; | 230 | ma.ma_dmat = &_mainbus_dma_tag; | |
231 | ma.ma_bust = &_mainbus_space_tag; | 231 | ma.ma_bust = &_mainbus_space_tag; | |
232 | ma.ma_offset = MAINBUS_IPACK_OFFSET + intiobase_phys; | 232 | ma.ma_offset = MAINBUS_IPACK_OFFSET + intiobase_phys; | |
233 | (void)config_found(self, &ma, mainbus_print); | 233 | (void)config_found(self, &ma, mainbus_print); | |
234 | } | 234 | } | |
235 | #endif | 235 | #endif | |
236 | } | 236 | } | |
237 | 237 | |||
238 | int | 238 | int | |
239 | mainbus_print(void *aux, const char *cp) | 239 | mainbus_print(void *aux, const char *cp) | |
240 | { | 240 | { | |
241 | struct mainbus_attach_args *ma; | 241 | struct mainbus_attach_args *ma; | |
242 | 242 | |||
243 | ma = aux; | 243 | ma = aux; | |
244 | 244 | |||
245 | if (cp) | 245 | if (cp) | |
246 | aprint_normal("%s at %s", ma->ma_name, cp); | 246 | aprint_normal("%s at %s", ma->ma_name, cp); | |
247 | 247 | |||
248 | aprint_normal(" address 0x%lx", ma->ma_offset); | 248 | aprint_normal(" address 0x%lx", ma->ma_offset); | |
249 | 249 | |||
250 | return UNCONF; | 250 | return UNCONF; | |
251 | } | 251 | } |
--- src/sys/arch/mvmeppc/mvmeppc/cpu.c 2008/04/28 20:23:29 1.8
+++ src/sys/arch/mvmeppc/mvmeppc/cpu.c 2011/06/05 17:03:16 1.9
@@ -1,67 +1,67 @@ | @@ -1,67 +1,67 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.8 2008/04/28 20:23:29 martin Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.9 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by NONAKA Kimihiro. | 8 | * by NONAKA Kimihiro. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.8 2008/04/28 20:23:29 martin Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9 2011/06/05 17:03:16 matt Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/systm.h> | 36 | #include <sys/systm.h> | |
37 | #include <sys/device.h> | 37 | #include <sys/device.h> | |
38 | 38 | |||
39 | #include <machine/autoconf.h> | 39 | #include <machine/autoconf.h> | |
40 | #include <machine/bus.h> | 40 | #include <machine/bus.h> | |
41 | #include <machine/cpu.h> | 41 | #include <machine/cpu.h> | |
42 | #include <machine/platform.h> | 42 | #include <machine/platform.h> | |
43 | 43 | |||
44 | int cpumatch(struct device *, struct cfdata *, void *); | 44 | int cpumatch(device_t, cfdata_t, void *); | |
45 | void cpuattach(struct device *, struct device *, void *); | 45 | void cpuattach(device_t, device_t, void *); | |
46 | 46 | |||
47 | CFATTACH_DECL(cpu, sizeof(struct device), | 47 | CFATTACH_DECL_NEW(cpu, 0, | |
48 | cpumatch, cpuattach, NULL, NULL); | 48 | cpumatch, cpuattach, NULL, NULL); | |
49 | 49 | |||
50 | extern struct cfdriver cpu_cd; | 50 | extern struct cfdriver cpu_cd; | |
51 | 51 | |||
52 | int | 52 | int | |
53 | cpumatch(struct device *parent, struct cfdata *cfdata, void *aux) | 53 | cpumatch(device_t parent, cfdata_t cfdata, void *aux) | |
54 | { | 54 | { | |
55 | 55 | |||
56 | if (cpu_info[0].ci_dev != NULL) | 56 | if (cpu_info[0].ci_dev != NULL) | |
57 | return (0); | 57 | return (0); | |
58 | return (1); | 58 | return (1); | |
59 | } | 59 | } | |
60 | 60 | |||
61 | void | 61 | void | |
62 | cpuattach(struct device *parent, struct device *self, void *aux) | 62 | cpuattach(device_t parent, device_t self, void *aux) | |
63 | { | 63 | { | |
64 | cpu_attach_common(self, 0); | 64 | cpu_attach_common(self, 0); | |
65 | 65 | |||
66 | (*platform->cpu_setup)(self); | 66 | (*platform->cpu_setup)(self); | |
67 | } | 67 | } |
--- src/sys/arch/mvmeppc/mvmeppc/mainbus.c 2011/05/17 17:34:51 1.12
+++ src/sys/arch/mvmeppc/mvmeppc/mainbus.c 2011/06/05 17:03:16 1.13
@@ -1,152 +1,152 @@ | @@ -1,152 +1,152 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.12 2011/05/17 17:34:51 dyoung Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.13 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | 4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
15 | * must display the following acknowledgement: | 15 | * must display the following acknowledgement: | |
16 | * This product includes software developed by Christopher G. Demetriou | 16 | * This product includes software developed by Christopher G. Demetriou | |
17 | * for the NetBSD Project. | 17 | * for the NetBSD Project. | |
18 | * 4. The name of the author may not be used to endorse or promote products | 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 | 19 | * derived from this software without specific prior written permission | |
20 | * | 20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 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 | 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 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 | 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2011/05/17 17:34:51 dyoung Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.13 2011/06/05 17:03:16 matt Exp $"); | |
35 | 35 | |||
36 | #include <sys/param.h> | 36 | #include <sys/param.h> | |
37 | #include <sys/extent.h> | 37 | #include <sys/extent.h> | |
38 | #include <sys/systm.h> | 38 | #include <sys/systm.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | #include <sys/malloc.h> | 40 | #include <sys/malloc.h> | |
41 | 41 | |||
42 | #include <machine/autoconf.h> | 42 | #include <machine/autoconf.h> | |
43 | #include <machine/bus.h> | 43 | #include <machine/bus.h> | |
44 | 44 | |||
45 | #include "pci.h" | 45 | #include "pci.h" | |
46 | #include "opt_pci.h" | 46 | #include "opt_pci.h" | |
47 | #include <dev/pci/pcivar.h> | 47 | #include <dev/pci/pcivar.h> | |
48 | #include <dev/pci/pciconf.h> | 48 | #include <dev/pci/pciconf.h> | |
49 | #include <machine/pci_machdep.h> | 49 | #include <machine/pci_machdep.h> | |
50 | #include <machine/isa_machdep.h> | 50 | #include <machine/isa_machdep.h> | |
51 | 51 | |||
52 | int mainbus_match(struct device *, struct cfdata *, void *); | 52 | int mainbus_match(device_t, cfdata_t, void *); | |
53 | void mainbus_attach(struct device *, struct device *, void *); | 53 | void mainbus_attach(device_t, device_t, void *); | |
54 | 54 | |||
55 | CFATTACH_DECL(mainbus, sizeof(struct device), | 55 | CFATTACH_DECL_NEW(mainbus, 0, | |
56 | mainbus_match, mainbus_attach, NULL, NULL); | 56 | mainbus_match, mainbus_attach, NULL, NULL); | |
57 | 57 | |||
58 | int mainbus_print(void *, const char *); | 58 | int mainbus_print(void *, const char *); | |
59 | 59 | |||
60 | 60 | |||
61 | /* There can be only one */ | 61 | /* There can be only one */ | |
62 | static int mainbus_found; | 62 | static int mainbus_found; | |
63 | struct powerpc_isa_chipset genppc_ict; | 63 | struct powerpc_isa_chipset genppc_ict; | |
64 | struct genppc_pci_chipset *genppc_pct; | 64 | struct genppc_pci_chipset *genppc_pct; | |
65 | 65 | |||
66 | /* | 66 | /* | |
67 | * Probe for the mainbus; always succeeds. | 67 | * Probe for the mainbus; always succeeds. | |
68 | */ | 68 | */ | |
69 | int | 69 | int | |
70 | mainbus_match(struct device *parent, struct cfdata *match, void *aux) | 70 | mainbus_match(device_t parent, cfdata_t match, void *aux) | |
71 | { | 71 | { | |
72 | 72 | |||
73 | if (mainbus_found) | 73 | if (mainbus_found) | |
74 | return 0; | 74 | return 0; | |
75 | return 1; | 75 | return 1; | |
76 | } | 76 | } | |
77 | 77 | |||
78 | /* | 78 | /* | |
79 | * Attach the mainbus. | 79 | * Attach the mainbus. | |
80 | */ | 80 | */ | |
81 | void | 81 | void | |
82 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 82 | mainbus_attach(device_t parent, device_t self, void *aux) | |
83 | { | 83 | { | |
84 | struct pcibus_attach_args pba; | 84 | struct pcibus_attach_args pba; | |
85 | #if NPCI > 0 | 85 | #if NPCI > 0 | |
86 | struct genppc_pci_chipset_businfo *pbi; | 86 | struct genppc_pci_chipset_businfo *pbi; | |
87 | #endif | 87 | #endif | |
88 | #ifdef PCI_NETBSD_CONFIGURE | 88 | #ifdef PCI_NETBSD_CONFIGURE | |
89 | struct extent *ioext, *memext; | 89 | struct extent *ioext, *memext; | |
90 | #endif | 90 | #endif | |
91 | 91 | |||
92 | mainbus_found = 1; | 92 | mainbus_found = 1; | |
93 | 93 | |||
94 | aprint_normal("\n"); | 94 | aprint_normal("\n"); | |
95 | 95 | |||
96 | /* attach cpu */ | 96 | /* attach cpu */ | |
97 | config_found_ia(self, "mainbus", NULL, mainbus_print); | 97 | config_found_ia(self, "mainbus", NULL, mainbus_print); | |
98 | 98 | |||
99 | /* | 99 | /* | |
100 | * XXX Note also that the presence of a PCI bus should | 100 | * XXX Note also that the presence of a PCI bus should | |
101 | * XXX _always_ be checked, and if present the bus should be | 101 | * XXX _always_ be checked, and if present the bus should be | |
102 | * XXX 'found'. However, because of the structure of the code, | 102 | * XXX 'found'. However, because of the structure of the code, | |
103 | * XXX that's not currently possible. | 103 | * XXX that's not currently possible. | |
104 | */ | 104 | */ | |
105 | #if NPCI > 0 | 105 | #if NPCI > 0 | |
106 | genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, | 106 | genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, | |
107 | M_NOWAIT); | 107 | M_NOWAIT); | |
108 | KASSERT(genppc_pct != NULL); | 108 | KASSERT(genppc_pct != NULL); | |
109 | mvmeppc_pci_get_chipset_tag(genppc_pct); | 109 | mvmeppc_pci_get_chipset_tag(genppc_pct); | |
110 | 110 | |||
111 | pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), | 111 | pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), | |
112 | M_DEVBUF, M_NOWAIT); | 112 | M_DEVBUF, M_NOWAIT); | |
113 | KASSERT(pbi != NULL); | 113 | KASSERT(pbi != NULL); | |
114 | pbi->pbi_properties = prop_dictionary_create(); | 114 | pbi->pbi_properties = prop_dictionary_create(); | |
115 | KASSERT(pbi->pbi_properties != NULL); | 115 | KASSERT(pbi->pbi_properties != NULL); | |
116 | 116 | |||
117 | SIMPLEQ_INIT(&genppc_pct->pc_pbi); | 117 | SIMPLEQ_INIT(&genppc_pct->pc_pbi); | |
118 | SIMPLEQ_INSERT_TAIL(&genppc_pct->pc_pbi, pbi, next); | 118 | SIMPLEQ_INSERT_TAIL(&genppc_pct->pc_pbi, pbi, next); | |
119 | 119 | |||
120 | #ifdef PCI_NETBSD_CONFIGURE | 120 | #ifdef PCI_NETBSD_CONFIGURE | |
121 | ioext = extent_create("pciio", 0x00008000, 0x0000ffff, M_DEVBUF, | 121 | ioext = extent_create("pciio", 0x00008000, 0x0000ffff, M_DEVBUF, | |
122 | NULL, 0, EX_NOWAIT); | 122 | NULL, 0, EX_NOWAIT); | |
123 | memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF, | 123 | memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF, | |
124 | NULL, 0, EX_NOWAIT); | 124 | NULL, 0, EX_NOWAIT); | |
125 | 125 | |||
126 | pci_configure_bus(0, ioext, memext, NULL, 0, 32); | 126 | pci_configure_bus(0, ioext, memext, NULL, 0, 32); | |
127 | 127 | |||
128 | extent_destroy(ioext); | 128 | extent_destroy(ioext); | |
129 | extent_destroy(memext); | 129 | extent_destroy(memext); | |
130 | #endif | 130 | #endif | |
131 | 131 | |||
132 | pba.pba_iot = &prep_io_space_tag; | 132 | pba.pba_iot = &prep_io_space_tag; | |
133 | pba.pba_memt = &prep_mem_space_tag; | 133 | pba.pba_memt = &prep_mem_space_tag; | |
134 | pba.pba_dmat = &pci_bus_dma_tag; | 134 | pba.pba_dmat = &pci_bus_dma_tag; | |
135 | pba.pba_dmat64 = NULL; | 135 | pba.pba_dmat64 = NULL; | |
136 | pba.pba_pc = genppc_pct; | 136 | pba.pba_pc = genppc_pct; | |
137 | pba.pba_bus = 0; | 137 | pba.pba_bus = 0; | |
138 | pba.pba_bridgetag = NULL; | 138 | pba.pba_bridgetag = NULL; | |
139 | pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | 139 | pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | |
140 | config_found_ia(self, "pcibus", &pba, pcibusprint); | 140 | config_found_ia(self, "pcibus", &pba, pcibusprint); | |
141 | #endif | 141 | #endif | |
142 | } | 142 | } | |
143 | 143 | |||
144 | int | 144 | int | |
145 | mainbus_print(void *aux, const char *pnp) | 145 | mainbus_print(void *aux, const char *pnp) | |
146 | { | 146 | { | |
147 | 147 | |||
148 | if (pnp) | 148 | if (pnp) | |
149 | aprint_normal("cpu at %s", pnp); | 149 | aprint_normal("cpu at %s", pnp); | |
150 | 150 | |||
151 | return (UNCONF); | 151 | return (UNCONF); | |
152 | } | 152 | } |
--- src/sys/arch/next68k/next68k/mainbus.c 2008/04/28 20:23:30 1.10
+++ src/sys/arch/next68k/next68k/mainbus.c 2011/06/05 17:03:19 1.11
@@ -1,105 +1,105 @@ | @@ -1,105 +1,105 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.10 2008/04/28 20:23:30 martin Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.11 2011/06/05 17:03:19 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jason R. Thorpe. | 8 | * by Jason R. Thorpe. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.10 2008/04/28 20:23:30 martin Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.11 2011/06/05 17:03:19 matt Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | 38 | |||
39 | #define _M68K_BUS_DMA_PRIVATE | 39 | #define _M68K_BUS_DMA_PRIVATE | |
40 | #include <machine/autoconf.h> | 40 | #include <machine/autoconf.h> | |
41 | 41 | |||
42 | static int mainbus_match(struct device *, struct cfdata *, void *); | 42 | static int mainbus_match(device_t, cfdata_t, void *); | |
43 | static void mainbus_attach(struct device *, struct device *, void *); | 43 | static void mainbus_attach(device_t, device_t, void *); | |
44 | static int mainbus_search(struct device *, struct cfdata *, | 44 | static int mainbus_search(device_t, cfdata_t, | |
45 | const int *, void *); | 45 | const int *, void *); | |
46 | 46 | |||
47 | CFATTACH_DECL(mainbus, sizeof(struct device), | 47 | CFATTACH_DECL_NEW(mainbus, 0, | |
48 | mainbus_match, mainbus_attach, NULL, NULL); | 48 | mainbus_match, mainbus_attach, NULL, NULL); | |
49 | 49 | |||
50 | struct m68k_bus_dma_tag next68k_bus_dma_tag = { | 50 | struct m68k_bus_dma_tag next68k_bus_dma_tag = { | |
51 | NULL, /* _cookie */ | 51 | NULL, /* _cookie */ | |
52 | 52 | |||
53 | 0, /* _boundary */ | 53 | 0, /* _boundary */ | |
54 | 54 | |||
55 | _bus_dmamap_create, /* _dmamap_create */ | 55 | _bus_dmamap_create, /* _dmamap_create */ | |
56 | _bus_dmamap_destroy, /* _dmamap_destroy */ | 56 | _bus_dmamap_destroy, /* _dmamap_destroy */ | |
57 | _bus_dmamap_load_direct, /* _dmamap_load */ | 57 | _bus_dmamap_load_direct, /* _dmamap_load */ | |
58 | _bus_dmamap_load_mbuf_direct, /* _dmamap_load_mbuf */ | 58 | _bus_dmamap_load_mbuf_direct, /* _dmamap_load_mbuf */ | |
59 | _bus_dmamap_load_uio_direct, /* _dmamap_load_uio */ | 59 | _bus_dmamap_load_uio_direct, /* _dmamap_load_uio */ | |
60 | _bus_dmamap_load_raw_direct, /* _dmamap_load_raw */ | 60 | _bus_dmamap_load_raw_direct, /* _dmamap_load_raw */ | |
61 | _bus_dmamap_unload, /* _dmamap_unload */ | 61 | _bus_dmamap_unload, /* _dmamap_unload */ | |
62 | _bus_dmamap_sync, /* _dmamap_sync */ | 62 | _bus_dmamap_sync, /* _dmamap_sync */ | |
63 | 63 | |||
64 | _bus_dmamem_alloc, /* _dmamem_alloc */ | 64 | _bus_dmamem_alloc, /* _dmamem_alloc */ | |
65 | _bus_dmamem_free, /* _dmamem_free */ | 65 | _bus_dmamem_free, /* _dmamem_free */ | |
66 | _bus_dmamem_map, /* _dmamem_map */ | 66 | _bus_dmamem_map, /* _dmamem_map */ | |
67 | _bus_dmamem_unmap, /* _dmamem_unmap */ | 67 | _bus_dmamem_unmap, /* _dmamem_unmap */ | |
68 | _bus_dmamem_mmap /* _dmamem_mmap */ | 68 | _bus_dmamem_mmap /* _dmamem_mmap */ | |
69 | }; | 69 | }; | |
70 | 70 | |||
71 | static int mainbus_attached = 0; | 71 | static int mainbus_attached = 0; | |
72 | 72 | |||
73 | static int | 73 | static int | |
74 | mainbus_match(struct device *parent, struct cfdata *cf, void *aux) | 74 | mainbus_match(device_t parent, cfdata_t cf, void *aux) | |
75 | { | 75 | { | |
76 | /* Allow only one instance. */ | 76 | /* Allow only one instance. */ | |
77 | if (mainbus_attached) | 77 | if (mainbus_attached) | |
78 | return (0); | 78 | return (0); | |
79 | 79 | |||
80 | return 1; | 80 | return 1; | |
81 | } | 81 | } | |
82 | 82 | |||
83 | static void | 83 | static void | |
84 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 84 | mainbus_attach(device_t parent, device_t self, void *aux) | |
85 | { | 85 | { | |
86 | struct mainbus_attach_args mba; | 86 | struct mainbus_attach_args mba; | |
87 | 87 | |||
88 | printf("\n"); | 88 | printf("\n"); | |
89 | 89 | |||
90 | mba.mba_dmat = &next68k_bus_dma_tag; | 90 | mba.mba_dmat = &next68k_bus_dma_tag; | |
91 | 91 | |||
92 | /* Search for and attach children. */ | 92 | /* Search for and attach children. */ | |
93 | config_search_ia(mainbus_search, self, "mainbus", &mba); | 93 | config_search_ia(mainbus_search, self, "mainbus", &mba); | |
94 | 94 | |||
95 | mainbus_attached = 1; | 95 | mainbus_attached = 1; | |
96 | } | 96 | } | |
97 | 97 | |||
98 | static int | 98 | static int | |
99 | mainbus_search(struct device *parent, struct cfdata *cf, | 99 | mainbus_search(device_t parent, cfdata_t cf, | |
100 | const int *ldesc, void *aux) | 100 | const int *ldesc, void *aux) | |
101 | { | 101 | { | |
102 | if (config_match(parent, cf, aux) > 0) | 102 | if (config_match(parent, cf, aux) > 0) | |
103 | config_attach(parent, cf, aux, NULL); | 103 | config_attach(parent, cf, aux, NULL); | |
104 | return 0; | 104 | return 0; | |
105 | } | 105 | } |
--- src/sys/arch/ofppc/ofppc/cpu.c 2011/06/05 16:52:24 1.14
+++ src/sys/arch/ofppc/ofppc/cpu.c 2011/06/05 17:03:16 1.15
@@ -1,319 +1,319 @@ | @@ -1,319 +1,319 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.14 2011/06/05 16:52:24 matt Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.15 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by NONAKA Kimihiro; by Jason R. Thorpe. | 8 | * by NONAKA Kimihiro; by Jason R. Thorpe. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.14 2011/06/05 16:52:24 matt Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.15 2011/06/05 17:03:16 matt Exp $"); | |
34 | 34 | |||
35 | #include "opt_ppcparam.h" | 35 | #include "opt_ppcparam.h" | |
36 | #include "opt_multiprocessor.h" | 36 | #include "opt_multiprocessor.h" | |
37 | #include "opt_interrupt.h" | 37 | #include "opt_interrupt.h" | |
38 | #include "opt_altivec.h" | 38 | #include "opt_altivec.h" | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/device.h> | 42 | #include <sys/device.h> | |
43 | 43 | |||
44 | #include <dev/ofw/openfirm.h> | 44 | #include <dev/ofw/openfirm.h> | |
45 | 45 | |||
46 | #include <powerpc/openpic.h> | 46 | #include <powerpc/openpic.h> | |
47 | #include <powerpc/spr.h> | 47 | #include <powerpc/spr.h> | |
48 | #include <powerpc/oea/spr.h> | 48 | #include <powerpc/oea/spr.h> | |
49 | #include <powerpc/oea/hid.h> | 49 | #include <powerpc/oea/hid.h> | |
50 | #include <powerpc/oea/bat.h> | 50 | #include <powerpc/oea/bat.h> | |
51 | #ifdef ALTIVEC | 51 | #ifdef ALTIVEC | |
52 | #include <powerpc/altivec.h> | 52 | #include <powerpc/altivec.h> | |
53 | #endif | 53 | #endif | |
54 | 54 | |||
55 | #ifdef MULTIPROCESSOR | 55 | #ifdef MULTIPROCESSOR | |
56 | #include <arch/powerpc/pic/picvar.h> | 56 | #include <arch/powerpc/pic/picvar.h> | |
57 | #include <arch/powerpc/pic/ipivar.h> | 57 | #include <arch/powerpc/pic/ipivar.h> | |
58 | #include <powerpc/rtas.h> | 58 | #include <powerpc/rtas.h> | |
59 | #endif | 59 | #endif | |
60 | 60 | |||
61 | #include <machine/autoconf.h> | 61 | #include <machine/autoconf.h> | |
62 | #include <machine/cpu.h> | 62 | #include <machine/cpu.h> | |
63 | #include <machine/fpu.h> | 63 | #include <machine/fpu.h> | |
64 | #include <machine/pcb.h> | 64 | #include <machine/pcb.h> | |
65 | #include <machine/pio.h> | 65 | #include <machine/pio.h> | |
66 | #include <machine/trap.h> | 66 | #include <machine/trap.h> | |
67 | 67 | |||
68 | #include "pic_openpic.h" | 68 | #include "pic_openpic.h" | |
69 | 69 | |||
70 | #ifndef OPENPIC | 70 | #ifndef OPENPIC | |
71 | #if NPIC_OPENPIC > 0 | 71 | #if NPIC_OPENPIC > 0 | |
72 | #define OPENPIC | 72 | #define OPENPIC | |
73 | #endif /* NOPENPIC > 0 */ | 73 | #endif /* NOPENPIC > 0 */ | |
74 | #endif /* OPENPIC */ | 74 | #endif /* OPENPIC */ | |
75 | 75 | |||
76 | static int cpu_match(struct device *, struct cfdata *, void *); | 76 | static int cpu_match(device_t, cfdata_t, void *); | |
77 | static void cpu_attach(struct device *, struct device *, void *); | 77 | static void cpu_attach(device_t, device_t, void *); | |
78 | void cpu_OFgetspeed(struct device *, struct cpu_info *); | 78 | void cpu_OFgetspeed(device_t, struct cpu_info *); | |
79 | 79 | |||
80 | CFATTACH_DECL(cpu, sizeof(struct device), | 80 | CFATTACH_DECL_NEW(cpu, 0, | |
81 | cpu_match, cpu_attach, NULL, NULL); | 81 | cpu_match, cpu_attach, NULL, NULL); | |
82 | 82 | |||
83 | extern struct cfdriver cpu_cd; | 83 | extern struct cfdriver cpu_cd; | |
84 | extern int machine_has_rtas; | 84 | extern int machine_has_rtas; | |
85 | 85 | |||
86 | int | 86 | int | |
87 | cpu_match(struct device *parent, struct cfdata *cfdata, void *aux) | 87 | cpu_match(device_t parent, cfdata_t cfdata, void *aux) | |
88 | { | 88 | { | |
89 | struct confargs *ca = aux; | 89 | struct confargs *ca = aux; | |
90 | int *reg = ca->ca_reg; | 90 | int *reg = ca->ca_reg; | |
91 | int node; | 91 | int node; | |
92 | 92 | |||
93 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | 93 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | |
94 | return 0; | 94 | return 0; | |
95 | 95 | |||
96 | node = OF_finddevice("/cpus"); | 96 | node = OF_finddevice("/cpus"); | |
97 | if (node != -1) { | 97 | if (node != -1) { | |
98 | for (node = OF_child(node); node != 0; node = OF_peer(node)) { | 98 | for (node = OF_child(node); node != 0; node = OF_peer(node)) { | |
99 | uint32_t cpunum; | 99 | uint32_t cpunum; | |
100 | int l; | 100 | int l; | |
101 | 101 | |||
102 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | 102 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | |
103 | if (l == 4 && reg[0] == cpunum) | 103 | if (l == 4 && reg[0] == cpunum) | |
104 | return 1; | 104 | return 1; | |
105 | } | 105 | } | |
106 | } | 106 | } | |
107 | if (reg[0] == 0) | 107 | if (reg[0] == 0) | |
108 | return 1; | 108 | return 1; | |
109 | return 0; | 109 | return 0; | |
110 | } | 110 | } | |
111 | 111 | |||
112 | void | 112 | void | |
113 | cpu_OFgetspeed(struct device *self, struct cpu_info *ci) | 113 | cpu_OFgetspeed(device_t self, struct cpu_info *ci) | |
114 | { | 114 | { | |
115 | int node; | 115 | int node; | |
116 | node = OF_finddevice("/cpus"); | 116 | node = OF_finddevice("/cpus"); | |
117 | if (node != -1) { | 117 | if (node != -1) { | |
118 | for (node = OF_child(node); node; node = OF_peer(node)) { | 118 | for (node = OF_child(node); node; node = OF_peer(node)) { | |
119 | uint32_t cpunum; | 119 | uint32_t cpunum; | |
120 | int l; | 120 | int l; | |
121 | 121 | |||
122 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | 122 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | |
123 | if (l == sizeof(uint32_t) && ci->ci_cpuid == cpunum) { | 123 | if (l == sizeof(uint32_t) && ci->ci_cpuid == cpunum) { | |
124 | uint32_t cf; | 124 | uint32_t cf; | |
125 | 125 | |||
126 | l = OF_getprop(node, "clock-frequency", | 126 | l = OF_getprop(node, "clock-frequency", | |
127 | &cf, sizeof(cf)); | 127 | &cf, sizeof(cf)); | |
128 | if (l == sizeof(uint32_t)) | 128 | if (l == sizeof(uint32_t)) | |
129 | ci->ci_khz = cf / 1000; | 129 | ci->ci_khz = cf / 1000; | |
130 | break; | 130 | break; | |
131 | } | 131 | } | |
132 | } | 132 | } | |
133 | } | 133 | } | |
134 | if (ci->ci_khz) | 134 | if (ci->ci_khz) | |
135 | aprint_normal_dev(self, "%u.%02u MHz\n", | 135 | aprint_normal_dev(self, "%u.%02u MHz\n", | |
136 | ci->ci_khz / 1000, (ci->ci_khz / 10) % 100); | 136 | ci->ci_khz / 1000, (ci->ci_khz / 10) % 100); | |
137 | } | 137 | } | |
138 | 138 | |||
139 | static void | 139 | static void | |
140 | cpu_print_cache_config(uint32_t size, uint32_t line) | 140 | cpu_print_cache_config(uint32_t size, uint32_t line) | |
141 | { | 141 | { | |
142 | char cbuf[7]; | 142 | char cbuf[7]; | |
143 | 143 | |||
144 | format_bytes(cbuf, sizeof(cbuf), size); | 144 | format_bytes(cbuf, sizeof(cbuf), size); | |
145 | aprint_normal("%s %dB/line", cbuf, line); | 145 | aprint_normal("%s %dB/line", cbuf, line); | |
146 | } | 146 | } | |
147 | 147 | |||
148 | static void | 148 | static void | |
149 | cpu_OFprintcacheinfo(int node) | 149 | cpu_OFprintcacheinfo(int node) | |
150 | { | 150 | { | |
151 | int l; | 151 | int l; | |
152 | uint32_t dcache=0, icache=0, dline=0, iline=0; | 152 | uint32_t dcache=0, icache=0, dline=0, iline=0; | |
153 | 153 | |||
154 | OF_getprop(node, "i-cache-size", &icache, sizeof(icache)); | 154 | OF_getprop(node, "i-cache-size", &icache, sizeof(icache)); | |
155 | OF_getprop(node, "d-cache-size", &dcache, sizeof(dcache)); | 155 | OF_getprop(node, "d-cache-size", &dcache, sizeof(dcache)); | |
156 | OF_getprop(node, "i-cache-line-size", &iline, sizeof(iline)); | 156 | OF_getprop(node, "i-cache-line-size", &iline, sizeof(iline)); | |
157 | OF_getprop(node, "d-cache-line-size", &dline, sizeof(dline)); | 157 | OF_getprop(node, "d-cache-line-size", &dline, sizeof(dline)); | |
158 | if (OF_getprop(node, "cache-unified", &l, sizeof(l)) != -1) { | 158 | if (OF_getprop(node, "cache-unified", &l, sizeof(l)) != -1) { | |
159 | aprint_normal("cache "); | 159 | aprint_normal("cache "); | |
160 | cpu_print_cache_config(icache, iline); | 160 | cpu_print_cache_config(icache, iline); | |
161 | } else { | 161 | } else { | |
162 | aprint_normal("I-cache "); | 162 | aprint_normal("I-cache "); | |
163 | cpu_print_cache_config(icache, iline); | 163 | cpu_print_cache_config(icache, iline); | |
164 | aprint_normal(", D-cache "); | 164 | aprint_normal(", D-cache "); | |
165 | cpu_print_cache_config(dcache, dline); | 165 | cpu_print_cache_config(dcache, dline); | |
166 | } | 166 | } | |
167 | aprint_normal("\n"); | 167 | aprint_normal("\n"); | |
168 | } | 168 | } | |
169 | 169 | |||
170 | static void | 170 | static void | |
171 | cpu_OFgetcache(struct device *self, struct cpu_info *ci) | 171 | cpu_OFgetcache(device_t self, struct cpu_info *ci) | |
172 | { | 172 | { | |
173 | int node, cpu=-1; | 173 | int node, cpu=-1; | |
174 | char name[32]; | 174 | char name[32]; | |
175 | 175 | |||
176 | node = OF_finddevice("/cpus"); | 176 | node = OF_finddevice("/cpus"); | |
177 | if (node == -1) | 177 | if (node == -1) | |
178 | return; | 178 | return; | |
179 | 179 | |||
180 | for (node = OF_child(node); node; node = OF_peer(node)) { | 180 | for (node = OF_child(node); node; node = OF_peer(node)) { | |
181 | uint32_t cpunum; | 181 | uint32_t cpunum; | |
182 | int l; | 182 | int l; | |
183 | 183 | |||
184 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | 184 | l = OF_getprop(node, "reg", &cpunum, sizeof(cpunum)); | |
185 | if (l == sizeof(uint32_t) && ci->ci_cpuid == cpunum) { | 185 | if (l == sizeof(uint32_t) && ci->ci_cpuid == cpunum) { | |
186 | cpu = node; | 186 | cpu = node; | |
187 | break; | 187 | break; | |
188 | } | 188 | } | |
189 | } | 189 | } | |
190 | if (cpu == -1) | 190 | if (cpu == -1) | |
191 | return; | 191 | return; | |
192 | /* now we have cpu */ | 192 | /* now we have cpu */ | |
193 | aprint_normal_dev(self, "L1 "); | 193 | aprint_normal_dev(self, "L1 "); | |
194 | cpu_OFprintcacheinfo(cpu); | 194 | cpu_OFprintcacheinfo(cpu); | |
195 | for (node = OF_child(cpu); node; node = OF_peer(node)) { | 195 | for (node = OF_child(cpu); node; node = OF_peer(node)) { | |
196 | if (OF_getprop(node, "name", name, sizeof(name)) != -1) { | 196 | if (OF_getprop(node, "name", name, sizeof(name)) != -1) { | |
197 | if (strcmp("l2-cache", name) == 0) { | 197 | if (strcmp("l2-cache", name) == 0) { | |
198 | aprint_normal_dev(self, "L2 "); | 198 | aprint_normal_dev(self, "L2 "); | |
199 | cpu_OFprintcacheinfo(node); | 199 | cpu_OFprintcacheinfo(node); | |
200 | } else if (strcmp("l3-cache", name) == 0) { | 200 | } else if (strcmp("l3-cache", name) == 0) { | |
201 | aprint_normal_dev(self, "L3 "); | 201 | aprint_normal_dev(self, "L3 "); | |
202 | cpu_OFprintcacheinfo(node); | 202 | cpu_OFprintcacheinfo(node); | |
203 | } | 203 | } | |
204 | } | 204 | } | |
205 | } | 205 | } | |
206 | } | 206 | } | |
207 | 207 | |||
208 | 208 | |||
209 | void | 209 | void | |
210 | cpu_attach(struct device *parent, struct device *self, void *aux) | 210 | cpu_attach(device_t parent, device_t self, void *aux) | |
211 | { | 211 | { | |
212 | struct cpu_info *ci; | 212 | struct cpu_info *ci; | |
213 | struct confargs *ca = aux; | 213 | struct confargs *ca = aux; | |
214 | int id = ca->ca_reg[0]; | 214 | int id = ca->ca_reg[0]; | |
215 | 215 | |||
216 | ci = cpu_attach_common(self, id); | 216 | ci = cpu_attach_common(self, id); | |
217 | if (ci == NULL) | 217 | if (ci == NULL) | |
218 | return; | 218 | return; | |
219 | 219 | |||
220 | if (id > 0) | 220 | if (id > 0) | |
221 | #ifdef MULTIPROCESSOR | 221 | #ifdef MULTIPROCESSOR | |
222 | cpu_spinup(self, ci); | 222 | cpu_spinup(self, ci); | |
223 | #endif | 223 | #endif | |
224 | 224 | |||
225 | if (ci->ci_khz == 0) | 225 | if (ci->ci_khz == 0) | |
226 | cpu_OFgetspeed(self, ci); | 226 | cpu_OFgetspeed(self, ci); | |
227 | 227 | |||
228 | cpu_OFgetcache(self, ci); | 228 | cpu_OFgetcache(self, ci); | |
229 | return; | 229 | return; | |
230 | } | 230 | } | |
231 | 231 | |||
232 | #ifdef MULTIPROCESSOR | 232 | #ifdef MULTIPROCESSOR | |
233 | 233 | |||
234 | extern volatile u_int cpu_spinstart_cpunum; | 234 | extern volatile u_int cpu_spinstart_cpunum; | |
235 | extern volatile u_int cpu_spinstart_ack; | 235 | extern volatile u_int cpu_spinstart_ack; | |
236 | 236 | |||
237 | int | 237 | int | |
238 | md_setup_trampoline(volatile struct cpu_hatch_data *h, struct cpu_info *ci) | 238 | md_setup_trampoline(volatile struct cpu_hatch_data *h, struct cpu_info *ci) | |
239 | { | 239 | { | |
240 | int i; | 240 | int i; | |
241 | u_int msr; | 241 | u_int msr; | |
242 | 242 | |||
243 | msr = mfmsr(); | 243 | msr = mfmsr(); | |
244 | h->running = -1; | 244 | h->running = -1; | |
245 | cpu_spinstart_cpunum = ci->ci_cpuid; | 245 | cpu_spinstart_cpunum = ci->ci_cpuid; | |
246 | __asm volatile("dcbf 0,%0"::"r"(&cpu_spinstart_cpunum):"memory"); | 246 | __asm volatile("dcbf 0,%0"::"r"(&cpu_spinstart_cpunum):"memory"); | |
247 | 247 | |||
248 | for (i=0; i < 100000000; i++) | 248 | for (i=0; i < 100000000; i++) | |
249 | if (cpu_spinstart_ack == 0) | 249 | if (cpu_spinstart_ack == 0) | |
250 | break; | 250 | break; | |
251 | return 1; | 251 | return 1; | |
252 | } | 252 | } | |
253 | 253 | |||
254 | void | 254 | void | |
255 | md_presync_timebase(volatile struct cpu_hatch_data *h) | 255 | md_presync_timebase(volatile struct cpu_hatch_data *h) | |
256 | { | 256 | { | |
257 | uint64_t tb; | 257 | uint64_t tb; | |
258 | int junk; | 258 | int junk; | |
259 | 259 | |||
260 | if (machine_has_rtas && rtas_has_func(RTAS_FUNC_FREEZE_TIME_BASE)) { | 260 | if (machine_has_rtas && rtas_has_func(RTAS_FUNC_FREEZE_TIME_BASE)) { | |
261 | rtas_call(RTAS_FUNC_FREEZE_TIME_BASE, 0, 1, &junk); | 261 | rtas_call(RTAS_FUNC_FREEZE_TIME_BASE, 0, 1, &junk); | |
262 | /* Sync timebase. */ | 262 | /* Sync timebase. */ | |
263 | tb = mftb(); | 263 | tb = mftb(); | |
264 | 264 | |||
265 | h->tbu = tb >> 32; | 265 | h->tbu = tb >> 32; | |
266 | h->tbl = tb & 0xffffffff; | 266 | h->tbl = tb & 0xffffffff; | |
267 | 267 | |||
268 | h->running = 0; | 268 | h->running = 0; | |
269 | } | 269 | } | |
270 | /* otherwise, the machine has no rtas, or if it does, things | 270 | /* otherwise, the machine has no rtas, or if it does, things | |
271 | * are pre-syncd, per PAPR v2.2. I don't have anything without | 271 | * are pre-syncd, per PAPR v2.2. I don't have anything without | |
272 | * rtas, so if such a machine exists, someone will have to write | 272 | * rtas, so if such a machine exists, someone will have to write | |
273 | * code for it | 273 | * code for it | |
274 | */ | 274 | */ | |
275 | } | 275 | } | |
276 | 276 | |||
277 | void | 277 | void | |
278 | md_start_timebase(volatile struct cpu_hatch_data *h) | 278 | md_start_timebase(volatile struct cpu_hatch_data *h) | |
279 | { | 279 | { | |
280 | int i, junk; | 280 | int i, junk; | |
281 | /* | 281 | /* | |
282 | * wait for secondary spin up (1.5ms @ 604/200MHz) | 282 | * wait for secondary spin up (1.5ms @ 604/200MHz) | |
283 | * XXX we cannot use delay() here because timebase is not | 283 | * XXX we cannot use delay() here because timebase is not | |
284 | * running. | 284 | * running. | |
285 | */ | 285 | */ | |
286 | for (i = 0; i < 100000; i++) | 286 | for (i = 0; i < 100000; i++) | |
287 | if (h->running) | 287 | if (h->running) | |
288 | break; | 288 | break; | |
289 | 289 | |||
290 | /* Start timebase. */ | 290 | /* Start timebase. */ | |
291 | if (machine_has_rtas && rtas_has_func(RTAS_FUNC_THAW_TIME_BASE)) | 291 | if (machine_has_rtas && rtas_has_func(RTAS_FUNC_THAW_TIME_BASE)) | |
292 | rtas_call(RTAS_FUNC_THAW_TIME_BASE, 0, 1, &junk); | 292 | rtas_call(RTAS_FUNC_THAW_TIME_BASE, 0, 1, &junk); | |
293 | } | 293 | } | |
294 | 294 | |||
295 | /* | 295 | /* | |
296 | * We wait for h->running to become 0, and then we know that the time is | 296 | * We wait for h->running to become 0, and then we know that the time is | |
297 | * frozen and h->tb is correct. | 297 | * frozen and h->tb is correct. | |
298 | */ | 298 | */ | |
299 | 299 | |||
300 | void | 300 | void | |
301 | md_sync_timebase(volatile struct cpu_hatch_data *h) | 301 | md_sync_timebase(volatile struct cpu_hatch_data *h) | |
302 | { | 302 | { | |
303 | /* Sync timebase. */ | 303 | /* Sync timebase. */ | |
304 | u_int tbu = h->tbu; | 304 | u_int tbu = h->tbu; | |
305 | u_int tbl = h->tbl; | 305 | u_int tbl = h->tbl; | |
306 | while (h->running == -1) | 306 | while (h->running == -1) | |
307 | ; | 307 | ; | |
308 | __asm volatile ("sync; isync"); | 308 | __asm volatile ("sync; isync"); | |
309 | __asm volatile ("mttbl %0" :: "r"(0)); | 309 | __asm volatile ("mttbl %0" :: "r"(0)); | |
310 | __asm volatile ("mttbu %0" :: "r"(tbu)); | 310 | __asm volatile ("mttbu %0" :: "r"(tbu)); | |
311 | __asm volatile ("mttbl %0" :: "r"(tbl)); | 311 | __asm volatile ("mttbl %0" :: "r"(tbl)); | |
312 | } | 312 | } | |
313 | 313 | |||
314 | void | 314 | void | |
315 | md_setup_interrupts(void) | 315 | md_setup_interrupts(void) | |
316 | { | 316 | { | |
317 | /* do nothing, this is handled in ofwpci */ | 317 | /* do nothing, this is handled in ofwpci */ | |
318 | } | 318 | } | |
319 | #endif /* MULTIPROCESSOR */ | 319 | #endif /* MULTIPROCESSOR */ |
--- src/sys/arch/ofppc/ofppc/mainbus.c 2010/06/09 04:41:42 1.26
+++ src/sys/arch/ofppc/ofppc/mainbus.c 2011/06/05 17:03:16 1.27
@@ -1,349 +1,349 @@ | @@ -1,349 +1,349 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.26 2010/06/09 04:41:42 kiyohara Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.27 2011/06/05 17:03:16 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Tim Rightnour | 8 | * by Tim Rightnour | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.26 2010/06/09 04:41:42 kiyohara Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.27 2011/06/05 17:03:16 matt Exp $"); | |
34 | 34 | |||
35 | #include "opt_interrupt.h" | 35 | #include "opt_interrupt.h" | |
36 | #include "opt_multiprocessor.h" | 36 | #include "opt_multiprocessor.h" | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | 41 | |||
42 | #include <dev/pci/pcivar.h> | 42 | #include <dev/pci/pcivar.h> | |
43 | #include <dev/ofw/openfirm.h> | 43 | #include <dev/ofw/openfirm.h> | |
44 | #include <dev/ofw/ofw_pci.h> | 44 | #include <dev/ofw/ofw_pci.h> | |
45 | #include <arch/powerpc/pic/picvar.h> | 45 | #include <arch/powerpc/pic/picvar.h> | |
46 | #ifdef MULTIPROCESSOR | 46 | #ifdef MULTIPROCESSOR | |
47 | #include <arch/powerpc/pic/ipivar.h> | 47 | #include <arch/powerpc/pic/ipivar.h> | |
48 | #endif | 48 | #endif | |
49 | #include <machine/pci_machdep.h> | 49 | #include <machine/pci_machdep.h> | |
50 | #include <machine/autoconf.h> | 50 | #include <machine/autoconf.h> | |
51 | 51 | |||
52 | #include <dev/isa/isareg.h> | 52 | #include <dev/isa/isareg.h> | |
53 | #include <dev/isa/isavar.h> | 53 | #include <dev/isa/isavar.h> | |
54 | 54 | |||
55 | int mainbus_match(struct device *, struct cfdata *, void *); | 55 | int mainbus_match(device_t, cfdata_t, void *); | |
56 | void mainbus_attach(struct device *, struct device *, void *); | 56 | void mainbus_attach(device_t, device_t, void *); | |
57 | 57 | |||
58 | CFATTACH_DECL(mainbus, sizeof(struct device), | 58 | CFATTACH_DECL_NEW(mainbus, 0, | |
59 | mainbus_match, mainbus_attach, NULL, NULL); | 59 | mainbus_match, mainbus_attach, NULL, NULL); | |
60 | 60 | |||
61 | int mainbus_found = 0; | 61 | int mainbus_found = 0; | |
62 | struct pic_ops *isa_pic; | 62 | struct pic_ops *isa_pic; | |
63 | 63 | |||
64 | #ifdef PIC_PREPIVR | 64 | #ifdef PIC_PREPIVR | |
65 | vaddr_t prep_intr_reg; | 65 | vaddr_t prep_intr_reg; | |
66 | uint32_t prep_intr_reg_off; | 66 | uint32_t prep_intr_reg_off; | |
67 | #endif | 67 | #endif | |
68 | 68 | |||
69 | extern ofw_pic_node_t picnodes[8]; | 69 | extern ofw_pic_node_t picnodes[8]; | |
70 | extern int nrofpics; | 70 | extern int nrofpics; | |
71 | extern int primary_pic; | 71 | extern int primary_pic; | |
72 | 72 | |||
73 | #ifdef PIC_PREPIVR | 73 | #ifdef PIC_PREPIVR | |
74 | static struct pic_ops * | 74 | static struct pic_ops * | |
75 | init_prepivr(int node) | 75 | init_prepivr(int node) | |
76 | { | 76 | { | |
77 | int pcinode; | 77 | int pcinode; | |
78 | uint32_t ivr; | 78 | uint32_t ivr; | |
79 | 79 | |||
80 | pcinode = OF_finddevice("/pci"); | 80 | pcinode = OF_finddevice("/pci"); | |
81 | if (OF_getprop(pcinode, "8259-interrupt-acknowledge", &ivr, | 81 | if (OF_getprop(pcinode, "8259-interrupt-acknowledge", &ivr, | |
82 | sizeof(ivr)) != sizeof(ivr)) { | 82 | sizeof(ivr)) != sizeof(ivr)) { | |
83 | aprint_error("Incorrectly identified i8259 as prepivr\n"); | 83 | aprint_error("Incorrectly identified i8259 as prepivr\n"); | |
84 | return setup_i8259(); | 84 | return setup_i8259(); | |
85 | } | 85 | } | |
86 | prep_intr_reg = (vaddr_t)mapiodev(ivr, sizeof(uint32_t)); | 86 | prep_intr_reg = (vaddr_t)mapiodev(ivr, sizeof(uint32_t)); | |
87 | prep_intr_reg_off = 0; /* hack */ | 87 | prep_intr_reg_off = 0; /* hack */ | |
88 | if (!prep_intr_reg) | 88 | if (!prep_intr_reg) | |
89 | panic("startup: no room for interrupt register"); | 89 | panic("startup: no room for interrupt register"); | |
90 | 90 | |||
91 | return setup_prepivr(PIC_IVR_MOT); | 91 | return setup_prepivr(PIC_IVR_MOT); | |
92 | } | 92 | } | |
93 | #endif | 93 | #endif | |
94 | 94 | |||
95 | static int | 95 | static int | |
96 | init_openpic(int node) | 96 | init_openpic(int node) | |
97 | { | 97 | { | |
98 | struct ofw_pci_register aadr; | 98 | struct ofw_pci_register aadr; | |
99 | struct ranges { | 99 | struct ranges { | |
100 | uint32_t pci_hi, pci_mid, pci_lo; | 100 | uint32_t pci_hi, pci_mid, pci_lo; | |
101 | uint32_t host; | 101 | uint32_t host; | |
102 | uint32_t size_hi, size_lo; | 102 | uint32_t size_hi, size_lo; | |
103 | } ranges[6], *rp = ranges; | 103 | } ranges[6], *rp = ranges; | |
104 | unsigned char *baseaddr = NULL; | 104 | unsigned char *baseaddr = NULL; | |
105 | uint32_t reg[12]; | 105 | uint32_t reg[12]; | |
106 | int parent, len; | 106 | int parent, len; | |
107 | #ifdef PIC_DISTOPENPIC | 107 | #ifdef PIC_DISTOPENPIC | |
108 | unsigned char *isu[OPENPIC_MAX_ISUS]; | 108 | unsigned char *isu[OPENPIC_MAX_ISUS]; | |
109 | int i, j; | 109 | int i, j; | |
110 | int isumap[OPENPIC_MAX_ISUS]; | 110 | int isumap[OPENPIC_MAX_ISUS]; | |
111 | #endif | 111 | #endif | |
112 | 112 | |||
113 | if (OF_getprop(node, "assigned-addresses", &aadr, sizeof(aadr)) | 113 | if (OF_getprop(node, "assigned-addresses", &aadr, sizeof(aadr)) | |
114 | != sizeof(aadr)) | 114 | != sizeof(aadr)) | |
115 | goto noaadr; | 115 | goto noaadr; | |
116 | 116 | |||
117 | parent = OF_parent(node); | 117 | parent = OF_parent(node); | |
118 | len = OF_getprop(parent, "ranges", ranges, sizeof(ranges)); | 118 | len = OF_getprop(parent, "ranges", ranges, sizeof(ranges)); | |
119 | if (len == -1) | 119 | if (len == -1) | |
120 | goto noaadr; | 120 | goto noaadr; | |
121 | 121 | |||
122 | #ifdef PIC_OPENPIC | 122 | #ifdef PIC_OPENPIC | |
123 | while (len >= sizeof(ranges[0])) { | 123 | while (len >= sizeof(ranges[0])) { | |
124 | if ((rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == | 124 | if ((rp->pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == | |
125 | (aadr.phys_hi & OFW_PCI_PHYS_HI_SPACEMASK) && | 125 | (aadr.phys_hi & OFW_PCI_PHYS_HI_SPACEMASK) && | |
126 | (aadr.size_lo + aadr.phys_lo <= (rp->size_lo+rp->host))) { | 126 | (aadr.size_lo + aadr.phys_lo <= (rp->size_lo+rp->host))) { | |
127 | baseaddr = (unsigned char *)mapiodev( | 127 | baseaddr = (unsigned char *)mapiodev( | |
128 | rp->host | aadr.phys_lo, aadr.size_lo); | 128 | rp->host | aadr.phys_lo, aadr.size_lo); | |
129 | aprint_normal("Found openpic at %08x\n", | 129 | aprint_normal("Found openpic at %08x\n", | |
130 | rp->host | aadr.phys_lo); | 130 | rp->host | aadr.phys_lo); | |
131 | setup_openpic(baseaddr, 0); | 131 | setup_openpic(baseaddr, 0); | |
132 | #ifdef MULTIPROCESSOR | 132 | #ifdef MULTIPROCESSOR | |
133 | setup_openpic_ipi(); | 133 | setup_openpic_ipi(); | |
134 | ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL); | 134 | ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL); | |
135 | for (i=1; i < ncpu; i++) { | 135 | for (i=1; i < ncpu; i++) { | |
136 | aprint_verbose("Enabling interrupts " | 136 | aprint_verbose("Enabling interrupts " | |
137 | "for cpu%d\n", i); | 137 | "for cpu%d\n", i); | |
138 | openpic_set_priority(i, 0); | 138 | openpic_set_priority(i, 0); | |
139 | } | 139 | } | |
140 | #endif | 140 | #endif | |
141 | return TRUE; | 141 | return TRUE; | |
142 | } | 142 | } | |
143 | rp++; | 143 | rp++; | |
144 | len -= sizeof(ranges[0]); | 144 | len -= sizeof(ranges[0]); | |
145 | } | 145 | } | |
146 | #endif | 146 | #endif | |
147 | rp = 0; /* satisfy -Wall */ | 147 | rp = 0; /* satisfy -Wall */ | |
148 | return FALSE; | 148 | return FALSE; | |
149 | noaadr: | 149 | noaadr: | |
150 | /* this isn't a PCI-attached openpic */ | 150 | /* this isn't a PCI-attached openpic */ | |
151 | len = OF_getprop(node, "reg", ®, sizeof(reg)); | 151 | len = OF_getprop(node, "reg", ®, sizeof(reg)); | |
152 | if (len < sizeof(int)*2) | 152 | if (len < sizeof(int)*2) | |
153 | return FALSE; | 153 | return FALSE; | |
154 | 154 | |||
155 | if (len == sizeof(int)*2) { | 155 | if (len == sizeof(int)*2) { | |
156 | baseaddr = (unsigned char *)mapiodev(reg[0], reg[1]); | 156 | baseaddr = (unsigned char *)mapiodev(reg[0], reg[1]); | |
157 | aprint_verbose("Found openpic at %08x\n", reg[0]); | 157 | aprint_verbose("Found openpic at %08x\n", reg[0]); | |
158 | #ifdef PIC_OPENPIC | 158 | #ifdef PIC_OPENPIC | |
159 | (void)setup_openpic(baseaddr, 0); | 159 | (void)setup_openpic(baseaddr, 0); | |
160 | #ifdef MULTIPROCESSOR | 160 | #ifdef MULTIPROCESSOR | |
161 | setup_openpic_ipi(); | 161 | setup_openpic_ipi(); | |
162 | ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL); | 162 | ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL); | |
163 | for (i=1; i < ncpu; i++) { | 163 | for (i=1; i < ncpu; i++) { | |
164 | aprint_verbose("Enabling interrupts for cpu%d\n", i); | 164 | aprint_verbose("Enabling interrupts for cpu%d\n", i); | |
165 | openpic_set_priority(i, 0); | 165 | openpic_set_priority(i, 0); | |
166 | } | 166 | } | |
167 | #endif | 167 | #endif | |
168 | return TRUE; | 168 | return TRUE; | |
169 | #else | 169 | #else | |
170 | aprint_error("No openpic support compiled into kernel!"); | 170 | aprint_error("No openpic support compiled into kernel!"); | |
171 | return FALSE; | 171 | return FALSE; | |
172 | #endif | 172 | #endif | |
173 | } | 173 | } | |
174 | 174 | |||
175 | #ifdef PIC_DISTOPENPIC | 175 | #ifdef PIC_DISTOPENPIC | |
176 | /* otherwise, we have a distributed openpic */ | 176 | /* otherwise, we have a distributed openpic */ | |
177 | i = len/(sizeof(int)*2) - 1; | 177 | i = len/(sizeof(int)*2) - 1; | |
178 | if (i == 0) | 178 | if (i == 0) | |
179 | return FALSE; | 179 | return FALSE; | |
180 | if (i > OPENPIC_MAX_ISUS) | 180 | if (i > OPENPIC_MAX_ISUS) | |
181 | aprint_error("Increase OPENPIC_MAX_ISUS to %d\n", i); | 181 | aprint_error("Increase OPENPIC_MAX_ISUS to %d\n", i); | |
182 | 182 | |||
183 | baseaddr = (unsigned char *)mapiodev(reg[0], 0x40000); | 183 | baseaddr = (unsigned char *)mapiodev(reg[0], 0x40000); | |
184 | aprint_verbose("Found openpic at %08x\n", reg[0]); | 184 | aprint_verbose("Found openpic at %08x\n", reg[0]); | |
185 | 185 | |||
186 | for (j=0; j < i; j++) { | 186 | for (j=0; j < i; j++) { | |
187 | isu[j] = (unsigned char *)mapiodev(reg[(j+1)*2], | 187 | isu[j] = (unsigned char *)mapiodev(reg[(j+1)*2], | |
188 | reg[(j+1)*2+1]); | 188 | reg[(j+1)*2+1]); | |
189 | isumap[j] = reg[(j+1)*2+1]; | 189 | isumap[j] = reg[(j+1)*2+1]; | |
190 | } | 190 | } | |
191 | (void)setup_distributed_openpic(baseaddr, i, (void **)isu, isumap); | 191 | (void)setup_distributed_openpic(baseaddr, i, (void **)isu, isumap); | |
192 | #ifdef MULTIPROCESSOR | 192 | #ifdef MULTIPROCESSOR | |
193 | setup_openpic_ipi(); | 193 | setup_openpic_ipi(); | |
194 | ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL); | 194 | ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL); | |
195 | for (i=1; i < ncpu; i++) { | 195 | for (i=1; i < ncpu; i++) { | |
196 | aprint_verbose("Enabling interrupts for cpu%d\n", i); | 196 | aprint_verbose("Enabling interrupts for cpu%d\n", i); | |
197 | openpic_set_priority(i, 0); | 197 | openpic_set_priority(i, 0); | |
198 | } | 198 | } | |
199 | #endif | 199 | #endif | |
200 | return TRUE; | 200 | return TRUE; | |
201 | #endif | 201 | #endif | |
202 | aprint_error("PIC support not present or PIC error\n"); | 202 | aprint_error("PIC support not present or PIC error\n"); | |
203 | return FALSE; | 203 | return FALSE; | |
204 | } | 204 | } | |
205 | 205 | |||
206 | 206 | |||
207 | /* | 207 | /* | |
208 | * Probe for the mainbus; always succeeds. | 208 | * Probe for the mainbus; always succeeds. | |
209 | */ | 209 | */ | |
210 | int | 210 | int | |
211 | mainbus_match(struct device *parent, struct cfdata *cf, void *aux) | 211 | mainbus_match(device_t parent, cfdata_t cf, void *aux) | |
212 | { | 212 | { | |
213 | if (mainbus_found) | 213 | if (mainbus_found) | |
214 | return 0; | 214 | return 0; | |
215 | return 1; | 215 | return 1; | |
216 | } | 216 | } | |
217 | 217 | |||
218 | /* | 218 | /* | |
219 | * Attach the mainbus. | 219 | * Attach the mainbus. | |
220 | */ | 220 | */ | |
221 | void | 221 | void | |
222 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 222 | mainbus_attach(device_t parent, device_t self, void *aux) | |
223 | { | 223 | { | |
224 | struct ofbus_attach_args oba; | 224 | struct ofbus_attach_args oba; | |
225 | struct confargs ca; | 225 | struct confargs ca; | |
226 | int node, rtnode, i; | 226 | int node, rtnode, i; | |
227 | u_int32_t reg[4]; | 227 | u_int32_t reg[4]; | |
228 | char name[32]; | 228 | char name[32]; | |
229 | 229 | |||
230 | mainbus_found = 1; | 230 | mainbus_found = 1; | |
231 | 231 | |||
232 | aprint_normal("\n"); | 232 | aprint_normal("\n"); | |
233 | 233 | |||
234 | /* Find rtas first */ | 234 | /* Find rtas first */ | |
235 | rtnode = OF_finddevice("/rtas"); | 235 | rtnode = OF_finddevice("/rtas"); | |
236 | if (rtnode != -1) { | 236 | if (rtnode != -1) { | |
237 | memset(name, 0, sizeof(name)); | 237 | memset(name, 0, sizeof(name)); | |
238 | if (OF_getprop(rtnode, "name", name, sizeof(name)) != -1) { | 238 | if (OF_getprop(rtnode, "name", name, sizeof(name)) != -1) { | |
239 | ca.ca_name = name; | 239 | ca.ca_name = name; | |
240 | ca.ca_node = rtnode; | 240 | ca.ca_node = rtnode; | |
241 | ca.ca_nreg = OF_getprop(rtnode, "reg", reg, | 241 | ca.ca_nreg = OF_getprop(rtnode, "reg", reg, | |
242 | sizeof(reg)); | 242 | sizeof(reg)); | |
243 | ca.ca_reg = reg; | 243 | ca.ca_reg = reg; | |
244 | config_found(self, &ca, NULL); | 244 | config_found(self, &ca, NULL); | |
245 | } | 245 | } | |
246 | } | 246 | } | |
247 | 247 | |||
248 | /* Now find CPU's */ | 248 | /* Now find CPU's */ | |
249 | for (i = 0; i < CPU_MAXNUM; i++) { | 249 | for (i = 0; i < CPU_MAXNUM; i++) { | |
250 | ca.ca_name = "cpu"; | 250 | ca.ca_name = "cpu"; | |
251 | ca.ca_reg = reg; | 251 | ca.ca_reg = reg; | |
252 | reg[0] = i; | 252 | reg[0] = i; | |
253 | config_found(self, &ca, NULL); | 253 | config_found(self, &ca, NULL); | |
254 | } | 254 | } | |
255 | 255 | |||
256 | node = OF_peer(0); | 256 | node = OF_peer(0); | |
257 | if (node) { | 257 | if (node) { | |
258 | oba.oba_busname = "ofw"; | 258 | oba.oba_busname = "ofw"; | |
259 | oba.oba_phandle = node; | 259 | oba.oba_phandle = node; | |
260 | config_found(self, &oba, NULL); | 260 | config_found(self, &oba, NULL); | |
261 | } | 261 | } | |
262 | 262 | |||
263 | if (strcmp(model_name, "Pegasos2") == 0) { | 263 | if (strcmp(model_name, "Pegasos2") == 0) { | |
264 | /* | 264 | /* | |
265 | * Configure to System Controller MV64361. | 265 | * Configure to System Controller MV64361. | |
266 | * And skip other devices. These attached from it. | 266 | * And skip other devices. These attached from it. | |
267 | */ | 267 | */ | |
268 | ca.ca_name = "gt"; | 268 | ca.ca_name = "gt"; | |
269 | 269 | |||
270 | config_found(self, &ca, NULL); | 270 | config_found(self, &ca, NULL); | |
271 | 271 | |||
272 | goto config_fin; | 272 | goto config_fin; | |
273 | } | 273 | } | |
274 | 274 | |||
275 | /* this primarily searches for pci bridges on the root bus */ | 275 | /* this primarily searches for pci bridges on the root bus */ | |
276 | for (node = OF_child(OF_finddevice("/")); node; node = OF_peer(node)) { | 276 | for (node = OF_child(OF_finddevice("/")); node; node = OF_peer(node)) { | |
277 | memset(name, 0, sizeof(name)); | 277 | memset(name, 0, sizeof(name)); | |
278 | if (OF_getprop(node, "name", name, sizeof(name)) == -1) | 278 | if (OF_getprop(node, "name", name, sizeof(name)) == -1) | |
279 | continue; | 279 | continue; | |
280 | /* skip rtas */ | 280 | /* skip rtas */ | |
281 | if (node == rtnode) | 281 | if (node == rtnode) | |
282 | continue; | 282 | continue; | |
283 | 283 | |||
284 | ca.ca_name = name; | 284 | ca.ca_name = name; | |
285 | ca.ca_node = node; | 285 | ca.ca_node = node; | |
286 | ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg)); | 286 | ca.ca_nreg = OF_getprop(node, "reg", reg, sizeof(reg)); | |
287 | ca.ca_reg = reg; | 287 | ca.ca_reg = reg; | |
288 | 288 | |||
289 | config_found(self, &ca, NULL); | 289 | config_found(self, &ca, NULL); | |
290 | } | 290 | } | |
291 | 291 | |||
292 | config_fin: | 292 | config_fin: | |
293 | pic_finish_setup(); | 293 | pic_finish_setup(); | |
294 | } | 294 | } | |
295 | 295 | |||
296 | void | 296 | void | |
297 | init_interrupt(void) | 297 | init_interrupt(void) | |
298 | { | 298 | { | |
299 | /* Do nothing, not ready yet */ | 299 | /* Do nothing, not ready yet */ | |
300 | } | 300 | } | |
301 | 301 | |||
302 | void | 302 | void | |
303 | init_ofppc_interrupt(void) | 303 | init_ofppc_interrupt(void) | |
304 | { | 304 | { | |
305 | int node, i, isa_cascade = 0; | 305 | int node, i, isa_cascade = 0; | |
306 | 306 | |||
307 | /* Now setup the PIC's */ | 307 | /* Now setup the PIC's */ | |
308 | node = OF_finddevice("/"); | 308 | node = OF_finddevice("/"); | |
309 | if (node <= 0) | 309 | if (node <= 0) | |
310 | panic("Can't find root OFW device node\n"); | 310 | panic("Can't find root OFW device node\n"); | |
311 | genofw_find_ofpics(node); | 311 | genofw_find_ofpics(node); | |
312 | genofw_fixup_picnode_offsets(); | 312 | genofw_fixup_picnode_offsets(); | |
313 | pic_init(); | 313 | pic_init(); | |
314 | 314 | |||
315 | /* find ISA first */ | 315 | /* find ISA first */ | |
316 | for (i = 0; i < nrofpics; i++) { | 316 | for (i = 0; i < nrofpics; i++) { | |
317 | if (picnodes[i].type == PICNODE_TYPE_8259) { | 317 | if (picnodes[i].type == PICNODE_TYPE_8259) { | |
318 | aprint_debug("calling i8259 setup\n"); | 318 | aprint_debug("calling i8259 setup\n"); | |
319 | isa_pic = setup_i8259(); | 319 | isa_pic = setup_i8259(); | |
320 | } | 320 | } | |
321 | if (picnodes[i].type == PICNODE_TYPE_IVR) { | 321 | if (picnodes[i].type == PICNODE_TYPE_IVR) { | |
322 | aprint_debug("calling prepivr setup\n"); | 322 | aprint_debug("calling prepivr setup\n"); | |
323 | #ifdef PIC_PREPIVR | 323 | #ifdef PIC_PREPIVR | |
324 | isa_pic = init_prepivr(picnodes[i].node); | 324 | isa_pic = init_prepivr(picnodes[i].node); | |
325 | #else | 325 | #else | |
326 | isa_pic = setup_i8259(); | 326 | isa_pic = setup_i8259(); | |
327 | #endif | 327 | #endif | |
328 | } | 328 | } | |
329 | } | 329 | } | |
330 | for (i = 0; i < nrofpics; i++) { | 330 | for (i = 0; i < nrofpics; i++) { | |
331 | if (picnodes[i].type == PICNODE_TYPE_8259) | 331 | if (picnodes[i].type == PICNODE_TYPE_8259) | |
332 | continue; | 332 | continue; | |
333 | if (picnodes[i].type == PICNODE_TYPE_IVR) | 333 | if (picnodes[i].type == PICNODE_TYPE_IVR) | |
334 | continue; | 334 | continue; | |
335 | if (picnodes[i].type == PICNODE_TYPE_OPENPIC) { | 335 | if (picnodes[i].type == PICNODE_TYPE_OPENPIC) { | |
336 | aprint_debug("calling openpic setup\n"); | 336 | aprint_debug("calling openpic setup\n"); | |
337 | if (isa_pic != NULL) | 337 | if (isa_pic != NULL) | |
338 | isa_cascade = 1; | 338 | isa_cascade = 1; | |
339 | (void)init_openpic(picnodes[i].node); | 339 | (void)init_openpic(picnodes[i].node); | |
340 | } else | 340 | } else | |
341 | aprint_error("Unhandled pic node type node=%x\n", | 341 | aprint_error("Unhandled pic node type node=%x\n", | |
342 | picnodes[i].node); | 342 | picnodes[i].node); | |
343 | } | 343 | } | |
344 | if (isa_cascade) { | 344 | if (isa_cascade) { | |
345 | primary_pic = 1; | 345 | primary_pic = 1; | |
346 | intr_establish(16, IST_LEVEL, IPL_NONE, pic_handle_intr, | 346 | intr_establish(16, IST_LEVEL, IPL_NONE, pic_handle_intr, | |
347 | isa_pic); | 347 | isa_pic); | |
348 | } | 348 | } | |
349 | } | 349 | } |
--- src/sys/arch/powerpc/ibm4xx/cpu.c 2010/03/18 13:47:05 1.28
+++ src/sys/arch/powerpc/ibm4xx/cpu.c 2011/06/05 17:03:17 1.29
@@ -1,318 +1,318 @@ | @@ -1,318 +1,318 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.28 2010/03/18 13:47:05 kiyohara Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.29 2011/06/05 17:03:17 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2001 Wasabi Systems, Inc. | 4 | * Copyright 2001 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc. | 7 | * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
15 | * notice, this list of conditions and the following disclaimer in the | 15 | * notice, this list of conditions and the following disclaimer in the | |
16 | * documentation and/or other materials provided with the distribution. | 16 | * documentation and/or other materials provided with the distribution. | |
17 | * 3. All advertising materials mentioning features or use of this software | 17 | * 3. All advertising materials mentioning features or use of this software | |
18 | * must display the following acknowledgement: | 18 | * must display the following acknowledgement: | |
19 | * This product includes software developed for the NetBSD Project by | 19 | * This product includes software developed for the NetBSD Project by | |
20 | * Wasabi Systems, Inc. | 20 | * Wasabi Systems, Inc. | |
21 | * 4. The name of Wasabi Systems, Inc. may not be used to endorse | 21 | * 4. The name of Wasabi Systems, Inc. may not be used to endorse | |
22 | * or promote products derived from this software without specific prior | 22 | * or promote products derived from this software without specific prior | |
23 | * written permission. | 23 | * written permission. | |
24 | * | 24 | * | |
25 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND | 25 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND | |
26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 27 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | 28 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | |
29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 29 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
35 | * POSSIBILITY OF SUCH DAMAGE. | 35 | * POSSIBILITY OF SUCH DAMAGE. | |
36 | */ | 36 | */ | |
37 | 37 | |||
38 | #include <sys/cdefs.h> | 38 | #include <sys/cdefs.h> | |
39 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.28 2010/03/18 13:47:05 kiyohara Exp $"); | 39 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.29 2011/06/05 17:03:17 matt Exp $"); | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/systm.h> | 42 | #include <sys/systm.h> | |
43 | #include <sys/device.h> | 43 | #include <sys/device.h> | |
44 | #include <sys/evcnt.h> | 44 | #include <sys/evcnt.h> | |
45 | 45 | |||
46 | #include <uvm/uvm_extern.h> | 46 | #include <uvm/uvm_extern.h> | |
47 | 47 | |||
48 | #include <prop/proplib.h> | 48 | #include <prop/proplib.h> | |
49 | 49 | |||
50 | #include <machine/cpu.h> | 50 | #include <machine/cpu.h> | |
51 | #include <powerpc/ibm4xx/dev/plbvar.h> | 51 | #include <powerpc/ibm4xx/dev/plbvar.h> | |
52 | 52 | |||
53 | struct cputab { | 53 | struct cputab { | |
54 | u_int version; | 54 | u_int version; | |
55 | u_int mask; | 55 | u_int mask; | |
56 | const char *name; | 56 | const char *name; | |
57 | }; | 57 | }; | |
58 | static struct cputab models[] = { | 58 | static struct cputab models[] = { | |
59 | { PVR_401A1, 0xffff0000, "401A1" }, | 59 | { PVR_401A1, 0xffff0000, "401A1" }, | |
60 | { PVR_401B2, 0xffff0000, "401B21" }, | 60 | { PVR_401B2, 0xffff0000, "401B21" }, | |
61 | { PVR_401C2, 0xffff0000, "401C2" }, | 61 | { PVR_401C2, 0xffff0000, "401C2" }, | |
62 | { PVR_401D2, 0xffff0000, "401D2" }, | 62 | { PVR_401D2, 0xffff0000, "401D2" }, | |
63 | { PVR_401E2, 0xffff0000, "401E2" }, | 63 | { PVR_401E2, 0xffff0000, "401E2" }, | |
64 | { PVR_401F2, 0xffff0000, "401F2" }, | 64 | { PVR_401F2, 0xffff0000, "401F2" }, | |
65 | { PVR_401G2, 0xffff0000, "401G2" }, | 65 | { PVR_401G2, 0xffff0000, "401G2" }, | |
66 | { PVR_403, 0xffff0000, "403" }, | 66 | { PVR_403, 0xffff0000, "403" }, | |
67 | { PVR_405GP, 0xffff0000, "405GP" }, | 67 | { PVR_405GP, 0xffff0000, "405GP" }, | |
68 | { PVR_405GPR, 0xffff0000, "405GPr" }, | 68 | { PVR_405GPR, 0xffff0000, "405GPr" }, | |
69 | { PVR_405D5X1, 0xfffff000, "Xilinx Virtex II Pro" }, | 69 | { PVR_405D5X1, 0xfffff000, "Xilinx Virtex II Pro" }, | |
70 | { PVR_405D5X2, 0xfffff000, "Xilinx Virtex 4 FX" }, | 70 | { PVR_405D5X2, 0xfffff000, "Xilinx Virtex 4 FX" }, | |
71 | { PVR_405EX, 0xffff0000, "405EX" }, | 71 | { PVR_405EX, 0xffff0000, "405EX" }, | |
72 | { 0, 0, NULL } | 72 | { 0, 0, NULL } | |
73 | }; | 73 | }; | |
74 | 74 | |||
75 | static int cpumatch(struct device *, struct cfdata *, void *); | 75 | static int cpumatch(device_t, cfdata_t, void *); | |
76 | static void cpuattach(struct device *, struct device *, void *); | 76 | static void cpuattach(device_t, device_t, void *); | |
77 | 77 | |||
78 | CFATTACH_DECL(cpu, sizeof(struct device), | 78 | CFATTACH_DECL_NEW(cpu, 0, | |
79 | cpumatch, cpuattach, NULL, NULL); | 79 | cpumatch, cpuattach, NULL, NULL); | |
80 | 80 | |||
81 | int ncpus; | 81 | int ncpus; | |
82 | 82 | |||
83 | struct cpu_info cpu_info[1] = { | 83 | struct cpu_info cpu_info[1] = { | |
84 | { | 84 | { | |
85 | /* XXX add more ci_ev_* as we teach 4xx about them */ | 85 | /* XXX add more ci_ev_* as we teach 4xx about them */ | |
86 | .ci_ev_clock = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | 86 | .ci_ev_clock = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | |
87 | NULL, "cpu0", "clock"), | 87 | NULL, "cpu0", "clock"), | |
88 | .ci_ev_statclock = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | 88 | .ci_ev_statclock = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | |
89 | NULL, "cpu0", "stat clock"), | 89 | NULL, "cpu0", "stat clock"), | |
90 | .ci_ev_softclock = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | 90 | .ci_ev_softclock = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | |
91 | NULL, "cpu0", "soft clock"), | 91 | NULL, "cpu0", "soft clock"), | |
92 | .ci_ev_softnet = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | 92 | .ci_ev_softnet = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | |
93 | NULL, "cpu0", "soft net"), | 93 | NULL, "cpu0", "soft net"), | |
94 | .ci_ev_softserial = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | 94 | .ci_ev_softserial = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, | |
95 | NULL, "cpu0", "soft serial"), | 95 | NULL, "cpu0", "soft serial"), | |
96 | .ci_curlwp = &lwp0, | 96 | .ci_curlwp = &lwp0, | |
97 | } | 97 | } | |
98 | }; | 98 | }; | |
99 | 99 | |||
100 | char cpu_model[80]; | 100 | char cpu_model[80]; | |
101 | 101 | |||
102 | int cpufound = 0; | 102 | int cpufound = 0; | |
103 | 103 | |||
104 | static int | 104 | static int | |
105 | cpumatch(struct device *parent, struct cfdata *cf, void *aux) | 105 | cpumatch(device_t parent, cfdata_t cf, void *aux) | |
106 | { | 106 | { | |
107 | struct plb_attach_args *paa = aux; | 107 | struct plb_attach_args *paa = aux; | |
108 | 108 | |||
109 | /* make sure that we're looking for a CPU */ | 109 | /* make sure that we're looking for a CPU */ | |
110 | if (strcmp(paa->plb_name, cf->cf_name) != 0) | 110 | if (strcmp(paa->plb_name, cf->cf_name) != 0) | |
111 | return (0); | 111 | return (0); | |
112 | 112 | |||
113 | return !cpufound; | 113 | return !cpufound; | |
114 | } | 114 | } | |
115 | 115 | |||
116 | static void | 116 | static void | |
117 | cpuattach(struct device *parent, struct device *self, void *aux) | 117 | cpuattach(device_t parent, device_t self, void *aux) | |
118 | { | 118 | { | |
119 | struct cputab *cp = models; | 119 | struct cputab *cp = models; | |
120 | u_int pvr; | 120 | u_int pvr; | |
121 | u_int processor_freq; | 121 | u_int processor_freq; | |
122 | prop_number_t freq; | 122 | prop_number_t freq; | |
123 | 123 | |||
124 | freq = prop_dictionary_get(board_properties, "processor-frequency"); | 124 | freq = prop_dictionary_get(board_properties, "processor-frequency"); | |
125 | KASSERT(freq != NULL); | 125 | KASSERT(freq != NULL); | |
126 | processor_freq = (unsigned int) prop_number_integer_value(freq); | 126 | processor_freq = (unsigned int) prop_number_integer_value(freq); | |
127 | 127 | |||
128 | cpufound++; | 128 | cpufound++; | |
129 | ncpus++; | 129 | ncpus++; | |
130 | 130 | |||
131 | pvr = mfpvr(); | 131 | pvr = mfpvr(); | |
132 | while (cp->name) { | 132 | while (cp->name) { | |
133 | if ((pvr & cp->mask) == cp->version) | 133 | if ((pvr & cp->mask) == cp->version) | |
134 | break; | 134 | break; | |
135 | cp++; | 135 | cp++; | |
136 | } | 136 | } | |
137 | if (cp->name) | 137 | if (cp->name) | |
138 | strcpy(cpu_model, cp->name); | 138 | strcpy(cpu_model, cp->name); | |
139 | else | 139 | else | |
140 | sprintf(cpu_model, "Version 0x%x", pvr); | 140 | sprintf(cpu_model, "Version 0x%x", pvr); | |
141 | 141 | |||
142 | printf(": %dMHz %s (PVR 0x%x)\n", processor_freq / 1000 / 1000, | 142 | printf(": %dMHz %s (PVR 0x%x)\n", processor_freq / 1000 / 1000, | |
143 | cp->name ? cp->name : "unknown model", pvr); | 143 | cp->name ? cp->name : "unknown model", pvr); | |
144 | 144 | |||
145 | cpu_probe_cache(); | 145 | cpu_probe_cache(); | |
146 | 146 | |||
147 | /* We would crash later on anyway so just make the reason obvious */ | 147 | /* We would crash later on anyway so just make the reason obvious */ | |
148 | if (curcpu()->ci_ci.icache_size == 0 && | 148 | if (curcpu()->ci_ci.icache_size == 0 && | |
149 | curcpu()->ci_ci.dcache_size == 0) | 149 | curcpu()->ci_ci.dcache_size == 0) | |
150 | panic("%s could not detect cache size", device_xname(self)); | 150 | panic("%s could not detect cache size", device_xname(self)); | |
151 | 151 | |||
152 | printf("%s: Instruction cache size %d line size %d\n", | 152 | printf("%s: Instruction cache size %d line size %d\n", | |
153 | device_xname(self), | 153 | device_xname(self), | |
154 | curcpu()->ci_ci.icache_size, curcpu()->ci_ci.icache_line_size); | 154 | curcpu()->ci_ci.icache_size, curcpu()->ci_ci.icache_line_size); | |
155 | printf("%s: Data cache size %d line size %d\n", | 155 | printf("%s: Data cache size %d line size %d\n", | |
156 | device_xname(self), | 156 | device_xname(self), | |
157 | curcpu()->ci_ci.dcache_size, curcpu()->ci_ci.dcache_line_size); | 157 | curcpu()->ci_ci.dcache_size, curcpu()->ci_ci.dcache_line_size); | |
158 | } | 158 | } | |
159 | 159 | |||
160 | /* | 160 | /* | |
161 | * This routine must be explicitly called to initialize the | 161 | * This routine must be explicitly called to initialize the | |
162 | * CPU cache information so cache flushe and memcpy operation | 162 | * CPU cache information so cache flushe and memcpy operation | |
163 | * work. | 163 | * work. | |
164 | */ | 164 | */ | |
165 | void | 165 | void | |
166 | cpu_probe_cache(void) | 166 | cpu_probe_cache(void) | |
167 | { | 167 | { | |
168 | struct cputab *cp = models; | 168 | struct cputab *cp = models; | |
169 | u_int pvr; | 169 | u_int pvr; | |
170 | 170 | |||
171 | pvr = mfpvr(); | 171 | pvr = mfpvr(); | |
172 | while (cp->name) { | 172 | while (cp->name) { | |
173 | if ((pvr & cp->mask) == cp->version) | 173 | if ((pvr & cp->mask) == cp->version) | |
174 | break; | 174 | break; | |
175 | cp++; | 175 | cp++; | |
176 | } | 176 | } | |
177 | 177 | |||
178 | /* | 178 | /* | |
179 | * First we need to identify the CPU and determine the | 179 | * First we need to identify the CPU and determine the | |
180 | * cache line size, or things like memset/memcpy may lose | 180 | * cache line size, or things like memset/memcpy may lose | |
181 | * badly. | 181 | * badly. | |
182 | */ | 182 | */ | |
183 | switch (cp->version) { | 183 | switch (cp->version) { | |
184 | case PVR_401A1: | 184 | case PVR_401A1: | |
185 | curcpu()->ci_ci.dcache_size = 1024; | 185 | curcpu()->ci_ci.dcache_size = 1024; | |
186 | curcpu()->ci_ci.dcache_line_size = 16; | 186 | curcpu()->ci_ci.dcache_line_size = 16; | |
187 | curcpu()->ci_ci.icache_size = 2848; | 187 | curcpu()->ci_ci.icache_size = 2848; | |
188 | curcpu()->ci_ci.icache_line_size = 16; | 188 | curcpu()->ci_ci.icache_line_size = 16; | |
189 | break; | 189 | break; | |
190 | case PVR_401B2: | 190 | case PVR_401B2: | |
191 | curcpu()->ci_ci.dcache_size = 8192; | 191 | curcpu()->ci_ci.dcache_size = 8192; | |
192 | curcpu()->ci_ci.dcache_line_size = 16; | 192 | curcpu()->ci_ci.dcache_line_size = 16; | |
193 | curcpu()->ci_ci.icache_size = 16384; | 193 | curcpu()->ci_ci.icache_size = 16384; | |
194 | curcpu()->ci_ci.icache_line_size = 16; | 194 | curcpu()->ci_ci.icache_line_size = 16; | |
195 | break; | 195 | break; | |
196 | case PVR_401C2: | 196 | case PVR_401C2: | |
197 | curcpu()->ci_ci.dcache_size = 8192; | 197 | curcpu()->ci_ci.dcache_size = 8192; | |
198 | curcpu()->ci_ci.dcache_line_size = 16; | 198 | curcpu()->ci_ci.dcache_line_size = 16; | |
199 | curcpu()->ci_ci.icache_size = 0; | 199 | curcpu()->ci_ci.icache_size = 0; | |
200 | curcpu()->ci_ci.icache_line_size = 16; | 200 | curcpu()->ci_ci.icache_line_size = 16; | |
201 | break; | 201 | break; | |
202 | case PVR_401D2: | 202 | case PVR_401D2: | |
203 | curcpu()->ci_ci.dcache_size = 2848; | 203 | curcpu()->ci_ci.dcache_size = 2848; | |
204 | curcpu()->ci_ci.dcache_line_size = 16; | 204 | curcpu()->ci_ci.dcache_line_size = 16; | |
205 | curcpu()->ci_ci.icache_size = 4096; | 205 | curcpu()->ci_ci.icache_size = 4096; | |
206 | curcpu()->ci_ci.icache_line_size = 16; | 206 | curcpu()->ci_ci.icache_line_size = 16; | |
207 | break; | 207 | break; | |
208 | case PVR_401E2: | 208 | case PVR_401E2: | |
209 | curcpu()->ci_ci.dcache_size = 0; | 209 | curcpu()->ci_ci.dcache_size = 0; | |
210 | curcpu()->ci_ci.dcache_line_size = 16; | 210 | curcpu()->ci_ci.dcache_line_size = 16; | |
211 | curcpu()->ci_ci.icache_size = 0; | 211 | curcpu()->ci_ci.icache_size = 0; | |
212 | curcpu()->ci_ci.icache_line_size = 16; | 212 | curcpu()->ci_ci.icache_line_size = 16; | |
213 | break; | 213 | break; | |
214 | case PVR_401F2: | 214 | case PVR_401F2: | |
215 | curcpu()->ci_ci.dcache_size = 2048; | 215 | curcpu()->ci_ci.dcache_size = 2048; | |
216 | curcpu()->ci_ci.dcache_line_size = 16; | 216 | curcpu()->ci_ci.dcache_line_size = 16; | |
217 | curcpu()->ci_ci.icache_size = 2848; | 217 | curcpu()->ci_ci.icache_size = 2848; | |
218 | curcpu()->ci_ci.icache_line_size = 16; | 218 | curcpu()->ci_ci.icache_line_size = 16; | |
219 | break; | 219 | break; | |
220 | case PVR_401G2: | 220 | case PVR_401G2: | |
221 | curcpu()->ci_ci.dcache_size = 2848; | 221 | curcpu()->ci_ci.dcache_size = 2848; | |
222 | curcpu()->ci_ci.dcache_line_size = 16; | 222 | curcpu()->ci_ci.dcache_line_size = 16; | |
223 | curcpu()->ci_ci.icache_size = 8192; | 223 | curcpu()->ci_ci.icache_size = 8192; | |
224 | curcpu()->ci_ci.icache_line_size = 16; | 224 | curcpu()->ci_ci.icache_line_size = 16; | |
225 | break; | 225 | break; | |
226 | case PVR_403: | 226 | case PVR_403: | |
227 | curcpu()->ci_ci.dcache_size = 8192; | 227 | curcpu()->ci_ci.dcache_size = 8192; | |
228 | curcpu()->ci_ci.dcache_line_size = 16; | 228 | curcpu()->ci_ci.dcache_line_size = 16; | |
229 | curcpu()->ci_ci.icache_size = 16384; | 229 | curcpu()->ci_ci.icache_size = 16384; | |
230 | curcpu()->ci_ci.icache_line_size = 16; | 230 | curcpu()->ci_ci.icache_line_size = 16; | |
231 | break; | 231 | break; | |
232 | case PVR_405GP: | 232 | case PVR_405GP: | |
233 | curcpu()->ci_ci.dcache_size = 8192; | 233 | curcpu()->ci_ci.dcache_size = 8192; | |
234 | curcpu()->ci_ci.dcache_line_size = 32; | 234 | curcpu()->ci_ci.dcache_line_size = 32; | |
235 | curcpu()->ci_ci.icache_size = 8192; | 235 | curcpu()->ci_ci.icache_size = 8192; | |
236 | curcpu()->ci_ci.icache_line_size = 32; | 236 | curcpu()->ci_ci.icache_line_size = 32; | |
237 | break; | 237 | break; | |
238 | case PVR_405GPR: | 238 | case PVR_405GPR: | |
239 | case PVR_405D5X1: | 239 | case PVR_405D5X1: | |
240 | case PVR_405D5X2: | 240 | case PVR_405D5X2: | |
241 | case PVR_405EX: | 241 | case PVR_405EX: | |
242 | curcpu()->ci_ci.dcache_size = 16384; | 242 | curcpu()->ci_ci.dcache_size = 16384; | |
243 | curcpu()->ci_ci.dcache_line_size = 32; | 243 | curcpu()->ci_ci.dcache_line_size = 32; | |
244 | curcpu()->ci_ci.icache_size = 16384; | 244 | curcpu()->ci_ci.icache_size = 16384; | |
245 | curcpu()->ci_ci.icache_line_size = 32; | 245 | curcpu()->ci_ci.icache_line_size = 32; | |
246 | break; | 246 | break; | |
247 | default: | 247 | default: | |
248 | /* | 248 | /* | |
249 | * Unknown CPU type. For safety we'll specify a | 249 | * Unknown CPU type. For safety we'll specify a | |
250 | * cache with a 4-byte line size. That way cache | 250 | * cache with a 4-byte line size. That way cache | |
251 | * flush routines won't miss any lines. | 251 | * flush routines won't miss any lines. | |
252 | */ | 252 | */ | |
253 | curcpu()->ci_ci.dcache_line_size = 4; | 253 | curcpu()->ci_ci.dcache_line_size = 4; | |
254 | curcpu()->ci_ci.icache_line_size = 4; | 254 | curcpu()->ci_ci.icache_line_size = 4; | |
255 | break; | 255 | break; | |
256 | } | 256 | } | |
257 | } | 257 | } | |
258 | 258 | |||
259 | /* | 259 | /* | |
260 | * These small routines may have to be replaced, | 260 | * These small routines may have to be replaced, | |
261 | * if/when we support processors other that the 604. | 261 | * if/when we support processors other that the 604. | |
262 | */ | 262 | */ | |
263 | 263 | |||
264 | void | 264 | void | |
265 | dcache_flush_page(vaddr_t va) | 265 | dcache_flush_page(vaddr_t va) | |
266 | { | 266 | { | |
267 | int i; | 267 | int i; | |
268 | 268 | |||
269 | if (curcpu()->ci_ci.dcache_line_size) | 269 | if (curcpu()->ci_ci.dcache_line_size) | |
270 | for (i = 0; i < PAGE_SIZE; | 270 | for (i = 0; i < PAGE_SIZE; | |
271 | i += curcpu()->ci_ci.dcache_line_size) | 271 | i += curcpu()->ci_ci.dcache_line_size) | |
272 | __asm volatile("dcbf %0,%1" : : "r" (va), "r" (i)); | 272 | __asm volatile("dcbf %0,%1" : : "r" (va), "r" (i)); | |
273 | __asm volatile("sync;isync" : : ); | 273 | __asm volatile("sync;isync" : : ); | |
274 | } | 274 | } | |
275 | 275 | |||
276 | void | 276 | void | |
277 | icache_flush_page(vaddr_t va) | 277 | icache_flush_page(vaddr_t va) | |
278 | { | 278 | { | |
279 | int i; | 279 | int i; | |
280 | 280 | |||
281 | if (curcpu()->ci_ci.icache_line_size) | 281 | if (curcpu()->ci_ci.icache_line_size) | |
282 | for (i = 0; i < PAGE_SIZE; | 282 | for (i = 0; i < PAGE_SIZE; | |
283 | i += curcpu()->ci_ci.icache_line_size) | 283 | i += curcpu()->ci_ci.icache_line_size) | |
284 | __asm volatile("icbi %0,%1" : : "r" (va), "r" (i)); | 284 | __asm volatile("icbi %0,%1" : : "r" (va), "r" (i)); | |
285 | __asm volatile("sync;isync" : : ); | 285 | __asm volatile("sync;isync" : : ); | |
286 | } | 286 | } | |
287 | 287 | |||
288 | void | 288 | void | |
289 | dcache_flush(vaddr_t va, vsize_t len) | 289 | dcache_flush(vaddr_t va, vsize_t len) | |
290 | { | 290 | { | |
291 | int i; | 291 | int i; | |
292 | 292 | |||
293 | if (len == 0) | 293 | if (len == 0) | |
294 | return; | 294 | return; | |
295 | 295 | |||
296 | /* Make sure we flush all cache lines */ | 296 | /* Make sure we flush all cache lines */ | |
297 | len += va & (curcpu()->ci_ci.dcache_line_size-1); | 297 | len += va & (curcpu()->ci_ci.dcache_line_size-1); | |
298 | if (curcpu()->ci_ci.dcache_line_size) | 298 | if (curcpu()->ci_ci.dcache_line_size) | |
299 | for (i = 0; i < len; i += curcpu()->ci_ci.dcache_line_size) | 299 | for (i = 0; i < len; i += curcpu()->ci_ci.dcache_line_size) | |
300 | __asm volatile("dcbf %0,%1" : : "r" (va), "r" (i)); | 300 | __asm volatile("dcbf %0,%1" : : "r" (va), "r" (i)); | |
301 | __asm volatile("sync;isync" : : ); | 301 | __asm volatile("sync;isync" : : ); | |
302 | } | 302 | } | |
303 | 303 | |||
304 | void | 304 | void | |
305 | icache_flush(vaddr_t va, vsize_t len) | 305 | icache_flush(vaddr_t va, vsize_t len) | |
306 | { | 306 | { | |
307 | int i; | 307 | int i; | |
308 | 308 | |||
309 | if (len == 0) | 309 | if (len == 0) | |
310 | return; | 310 | return; | |
311 | 311 | |||
312 | /* Make sure we flush all cache lines */ | 312 | /* Make sure we flush all cache lines */ | |
313 | len += va & (curcpu()->ci_ci.icache_line_size-1); | 313 | len += va & (curcpu()->ci_ci.icache_line_size-1); | |
314 | if (curcpu()->ci_ci.icache_line_size) | 314 | if (curcpu()->ci_ci.icache_line_size) | |
315 | for (i = 0; i < len; i += curcpu()->ci_ci.icache_line_size) | 315 | for (i = 0; i < len; i += curcpu()->ci_ci.icache_line_size) | |
316 | __asm volatile("icbi %0,%1" : : "r" (va), "r" (i)); | 316 | __asm volatile("icbi %0,%1" : : "r" (va), "r" (i)); | |
317 | __asm volatile("sync;isync" : : ); | 317 | __asm volatile("sync;isync" : : ); | |
318 | } | 318 | } |
--- src/sys/arch/prep/prep/cpu.c 2008/04/28 20:23:33 1.15
+++ src/sys/arch/prep/prep/cpu.c 2011/06/05 17:03:17 1.16
@@ -1,166 +1,166 @@ | @@ -1,166 +1,166 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.15 2008/04/28 20:23:33 martin Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.16 2011/06/05 17:03:17 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by NONAKA Kimihiro. | 8 | * by NONAKA Kimihiro. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.15 2008/04/28 20:23:33 martin Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.16 2011/06/05 17:03:17 matt Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/systm.h> | 36 | #include <sys/systm.h> | |
37 | #include <sys/device.h> | 37 | #include <sys/device.h> | |
38 | 38 | |||
39 | #include <machine/autoconf.h> | 39 | #include <machine/autoconf.h> | |
40 | #include <machine/bus.h> | 40 | #include <machine/bus.h> | |
41 | #include <machine/cpu.h> | 41 | #include <machine/cpu.h> | |
42 | #include <machine/platform.h> | 42 | #include <machine/platform.h> | |
43 | 43 | |||
44 | #ifdef MULTIPROCESSOR | 44 | #ifdef MULTIPROCESSOR | |
45 | #include <arch/powerpc/pic/picvar.h> | 45 | #include <arch/powerpc/pic/picvar.h> | |
46 | #include <arch/powerpc/pic/ipivar.h> | 46 | #include <arch/powerpc/pic/ipivar.h> | |
47 | #include <powerpc/openpic.h> | 47 | #include <powerpc/openpic.h> | |
48 | #include <powerpc/trap.h> | 48 | #include <powerpc/trap.h> | |
49 | 49 | |||
50 | extern void openpic_set_priority(int, int); | 50 | extern void openpic_set_priority(int, int); | |
51 | #endif | 51 | #endif | |
52 | 52 | |||
53 | int cpumatch(struct device *, struct cfdata *, void *); | 53 | int cpumatch(device_t, cfdata_t, void *); | |
54 | void cpuattach(struct device *, struct device *, void *); | 54 | void cpuattach(device_t, device_t, void *); | |
55 | 55 | |||
56 | CFATTACH_DECL(cpu, sizeof(struct device), | 56 | CFATTACH_DECL_NEW(cpu, 0, | |
57 | cpumatch, cpuattach, NULL, NULL); | 57 | cpumatch, cpuattach, NULL, NULL); | |
58 | 58 | |||
59 | extern struct cfdriver cpu_cd; | 59 | extern struct cfdriver cpu_cd; | |
60 | 60 | |||
61 | int | 61 | int | |
62 | cpumatch(struct device *parent, struct cfdata *cfdata, void *aux) | 62 | cpumatch(device_t parent, cfdata_t cfdata, void *aux) | |
63 | { | 63 | { | |
64 | struct confargs *ca = aux; | 64 | struct confargs *ca = aux; | |
65 | 65 | |||
66 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | 66 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | |
67 | return (0); | 67 | return (0); | |
68 | #if 0 | 68 | #if 0 | |
69 | if (cpu_info[0].ci_dev != NULL) | 69 | if (cpu_info[0].ci_dev != NULL) | |
70 | return (0); | 70 | return (0); | |
71 | #endif | 71 | #endif | |
72 | return (1); | 72 | return (1); | |
73 | } | 73 | } | |
74 | 74 | |||
75 | void | 75 | void | |
76 | cpuattach(struct device *parent, struct device *self, void *aux) | 76 | cpuattach(device_t parent, device_t self, void *aux) | |
77 | { | 77 | { | |
78 | struct cpu_info *ci; | 78 | struct cpu_info *ci; | |
79 | struct confargs *ca = aux; | 79 | struct confargs *ca = aux; | |
80 | int id = ca->ca_node; | 80 | int id = ca->ca_node; | |
81 | 81 | |||
82 | ci = cpu_attach_common(self, id); | 82 | ci = cpu_attach_common(self, id); | |
83 | if (ci == NULL) | 83 | if (ci == NULL) | |
84 | return; | 84 | return; | |
85 | 85 | |||
86 | #ifdef MULTIPROCESSOR | 86 | #ifdef MULTIPROCESSOR | |
87 | if (id > 0) { | 87 | if (id > 0) { | |
88 | cpu_spinup(self, ci); | 88 | cpu_spinup(self, ci); | |
89 | return; | 89 | return; | |
90 | } | 90 | } | |
91 | #endif | 91 | #endif | |
92 | 92 | |||
93 | cpu_setup_prep_generic(self); | 93 | cpu_setup_prep_generic(self); | |
94 | } | 94 | } | |
95 | 95 | |||
96 | #ifdef MULTIPROCESSOR | 96 | #ifdef MULTIPROCESSOR | |
97 | 97 | |||
98 | int | 98 | int | |
99 | md_setup_trampoline(volatile struct cpu_hatch_data *h, struct cpu_info *ci) | 99 | md_setup_trampoline(volatile struct cpu_hatch_data *h, struct cpu_info *ci) | |
100 | { | 100 | { | |
101 | if (!openpic_base) | 101 | if (!openpic_base) | |
102 | return -1; | 102 | return -1; | |
103 | 103 | |||
104 | /* construct an absolute branch instruction */ | 104 | /* construct an absolute branch instruction */ | |
105 | /* ba cpu_spinup_trampoline */ | 105 | /* ba cpu_spinup_trampoline */ | |
106 | *(u_int *)EXC_RST = 0x48000002 | (u_int)cpu_spinup_trampoline; | 106 | *(u_int *)EXC_RST = 0x48000002 | (u_int)cpu_spinup_trampoline; | |
107 | __syncicache((void *)EXC_RST, 0x100); | 107 | __syncicache((void *)EXC_RST, 0x100); | |
108 | h->running = -1; | 108 | h->running = -1; | |
109 | 109 | |||
110 | /* Start secondary CPU. */ | 110 | /* Start secondary CPU. */ | |
111 | openpic_write(OPENPIC_PROC_INIT, (1 << 1)); | 111 | openpic_write(OPENPIC_PROC_INIT, (1 << 1)); | |
112 | return 1; | 112 | return 1; | |
113 | } | 113 | } | |
114 | 114 | |||
115 | void | 115 | void | |
116 | md_presync_timebase(volatile struct cpu_hatch_data *h) | 116 | md_presync_timebase(volatile struct cpu_hatch_data *h) | |
117 | { | 117 | { | |
118 | uint64_t tb; | 118 | uint64_t tb; | |
119 | 119 | |||
120 | /* Sync timebase. */ | 120 | /* Sync timebase. */ | |
121 | tb = mftb(); | 121 | tb = mftb(); | |
122 | tb += 100000; /* 3ms @ 33MHz */ | 122 | tb += 100000; /* 3ms @ 33MHz */ | |
123 | 123 | |||
124 | h->tbu = tb >> 32; | 124 | h->tbu = tb >> 32; | |
125 | h->tbl = tb & 0xffffffff; | 125 | h->tbl = tb & 0xffffffff; | |
126 | 126 | |||
127 | while (tb > mftb()) | 127 | while (tb > mftb()) | |
128 | ; | 128 | ; | |
129 | 129 | |||
130 | __asm volatile ("sync; isync"); | 130 | __asm volatile ("sync; isync"); | |
131 | h->running = 0; | 131 | h->running = 0; | |
132 | 132 | |||
133 | delay(500000); | 133 | delay(500000); | |
134 | } | 134 | } | |
135 | 135 | |||
136 | void | 136 | void | |
137 | md_start_timebase(volatile struct cpu_hatch_data *h) | 137 | md_start_timebase(volatile struct cpu_hatch_data *h) | |
138 | { | 138 | { | |
139 | /* do nada */ | 139 | /* do nada */ | |
140 | } | 140 | } | |
141 | 141 | |||
142 | void | 142 | void | |
143 | md_sync_timebase(volatile struct cpu_hatch_data *h) | 143 | md_sync_timebase(volatile struct cpu_hatch_data *h) | |
144 | { | 144 | { | |
145 | u_int tbu = h->tbu; | 145 | u_int tbu = h->tbu; | |
146 | u_int tbl = h->tbl; | 146 | u_int tbl = h->tbl; | |
147 | 147 | |||
148 | while (h->running == -1) | 148 | while (h->running == -1) | |
149 | ; | 149 | ; | |
150 | 150 | |||
151 | __asm volatile ("sync; isync"); | 151 | __asm volatile ("sync; isync"); | |
152 | __asm volatile ("mttbl %0" :: "r"(0)); | 152 | __asm volatile ("mttbl %0" :: "r"(0)); | |
153 | __asm volatile ("mttbu %0" :: "r"(tbu)); | 153 | __asm volatile ("mttbu %0" :: "r"(tbu)); | |
154 | __asm volatile ("mttbl %0" :: "r"(tbl)); | 154 | __asm volatile ("mttbl %0" :: "r"(tbl)); | |
155 | } | 155 | } | |
156 | 156 | |||
157 | void | 157 | void | |
158 | md_setup_interrupts(void) | 158 | md_setup_interrupts(void) | |
159 | { | 159 | { | |
160 | if (!openpic_base) | 160 | if (!openpic_base) | |
161 | return; | 161 | return; | |
162 | /* clear the reset on all CPU's */ | 162 | /* clear the reset on all CPU's */ | |
163 | openpic_write(OPENPIC_PROC_INIT, 0); | 163 | openpic_write(OPENPIC_PROC_INIT, 0); | |
164 | openpic_set_priority(cpu_number(), 0); | 164 | openpic_set_priority(cpu_number(), 0); | |
165 | } | 165 | } | |
166 | #endif /* MULTIPROCESSOR */ | 166 | #endif /* MULTIPROCESSOR */ |
--- src/sys/arch/prep/prep/mainbus.c 2011/05/17 17:34:52 1.30
+++ src/sys/arch/prep/prep/mainbus.c 2011/06/05 17:03:17 1.31
@@ -1,198 +1,198 @@ | @@ -1,198 +1,198 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.30 2011/05/17 17:34:52 dyoung Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.31 2011/06/05 17:03:17 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | 4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
15 | * must display the following acknowledgement: | 15 | * must display the following acknowledgement: | |
16 | * This product includes software developed by Christopher G. Demetriou | 16 | * This product includes software developed by Christopher G. Demetriou | |
17 | * for the NetBSD Project. | 17 | * for the NetBSD Project. | |
18 | * 4. The name of the author may not be used to endorse or promote products | 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 | 19 | * derived from this software without specific prior written permission | |
20 | * | 20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 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 | 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 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 | 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.30 2011/05/17 17:34:52 dyoung Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.31 2011/06/05 17:03:17 matt Exp $"); | |
35 | 35 | |||
36 | #include "opt_pci.h" | 36 | #include "opt_pci.h" | |
37 | #include "opt_residual.h" | 37 | #include "opt_residual.h" | |
38 | 38 | |||
39 | #include "pnpbus.h" | 39 | #include "pnpbus.h" | |
40 | #include "pci.h" | 40 | #include "pci.h" | |
41 | #include "isa.h" | 41 | #include "isa.h" | |
42 | 42 | |||
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/extent.h> | 44 | #include <sys/extent.h> | |
45 | #include <sys/systm.h> | 45 | #include <sys/systm.h> | |
46 | #include <sys/device.h> | 46 | #include <sys/device.h> | |
47 | #include <sys/malloc.h> | 47 | #include <sys/malloc.h> | |
48 | 48 | |||
49 | #include <machine/autoconf.h> | 49 | #include <machine/autoconf.h> | |
50 | #include <machine/bus.h> | 50 | #include <machine/bus.h> | |
51 | #include <machine/isa_machdep.h> | 51 | #include <machine/isa_machdep.h> | |
52 | 52 | |||
53 | #include <dev/pci/pcivar.h> | 53 | #include <dev/pci/pcivar.h> | |
54 | #include <dev/pci/pciconf.h> | 54 | #include <dev/pci/pciconf.h> | |
55 | 55 | |||
56 | #include <prep/pnpbus/pnpbusvar.h> | 56 | #include <prep/pnpbus/pnpbusvar.h> | |
57 | 57 | |||
58 | #include <machine/platform.h> | 58 | #include <machine/platform.h> | |
59 | #include <machine/residual.h> | 59 | #include <machine/residual.h> | |
60 | 60 | |||
61 | int mainbus_match(struct device *, struct cfdata *, void *); | 61 | int mainbus_match(device_t, cfdata_t, void *); | |
62 | void mainbus_attach(struct device *, struct device *, void *); | 62 | void mainbus_attach(device_t, device_t, void *); | |
63 | 63 | |||
64 | CFATTACH_DECL(mainbus, sizeof(struct device), | 64 | CFATTACH_DECL_NEW(mainbus, 0, | |
65 | mainbus_match, mainbus_attach, NULL, NULL); | 65 | mainbus_match, mainbus_attach, NULL, NULL); | |
66 | 66 | |||
67 | int mainbus_print(void *, const char *); | 67 | int mainbus_print(void *, const char *); | |
68 | 68 | |||
69 | union mainbus_attach_args { | 69 | union mainbus_attach_args { | |
70 | const char *mba_busname; /* first elem of all */ | 70 | const char *mba_busname; /* first elem of all */ | |
71 | struct pcibus_attach_args mba_pba; | 71 | struct pcibus_attach_args mba_pba; | |
72 | struct pnpbus_attach_args mba_paa; | 72 | struct pnpbus_attach_args mba_paa; | |
73 | }; | 73 | }; | |
74 | 74 | |||
75 | /* There can be only one. */ | 75 | /* There can be only one. */ | |
76 | int mainbus_found = 0; | 76 | int mainbus_found = 0; | |
77 | struct powerpc_isa_chipset genppc_ict; | 77 | struct powerpc_isa_chipset genppc_ict; | |
78 | struct genppc_pci_chipset *genppc_pct; | 78 | struct genppc_pci_chipset *genppc_pct; | |
79 | 79 | |||
80 | /* | 80 | /* | |
81 | * Probe for the mainbus; always succeeds. | 81 | * Probe for the mainbus; always succeeds. | |
82 | */ | 82 | */ | |
83 | int | 83 | int | |
84 | mainbus_match(struct device *parent, struct cfdata *match, void *aux) | 84 | mainbus_match(device_t parent, cfdata_t match, void *aux) | |
85 | { | 85 | { | |
86 | 86 | |||
87 | if (mainbus_found) | 87 | if (mainbus_found) | |
88 | return 0; | 88 | return 0; | |
89 | return 1; | 89 | return 1; | |
90 | } | 90 | } | |
91 | 91 | |||
92 | /* | 92 | /* | |
93 | * Attach the mainbus. | 93 | * Attach the mainbus. | |
94 | */ | 94 | */ | |
95 | void | 95 | void | |
96 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 96 | mainbus_attach(device_t parent, device_t self, void *aux) | |
97 | { | 97 | { | |
98 | union mainbus_attach_args mba; | 98 | union mainbus_attach_args mba; | |
99 | struct confargs ca; | 99 | struct confargs ca; | |
100 | int i; | 100 | int i; | |
101 | #if NPCI > 0 | 101 | #if NPCI > 0 | |
102 | struct genppc_pci_chipset_businfo *pbi; | 102 | struct genppc_pci_chipset_businfo *pbi; | |
103 | #ifdef PCI_NETBSD_CONFIGURE | 103 | #ifdef PCI_NETBSD_CONFIGURE | |
104 | struct extent *ioext, *memext; | 104 | struct extent *ioext, *memext; | |
105 | #endif | 105 | #endif | |
106 | #endif | 106 | #endif | |
107 | 107 | |||
108 | mainbus_found = 1; | 108 | mainbus_found = 1; | |
109 | 109 | |||
110 | aprint_normal("\n"); | 110 | aprint_normal("\n"); | |
111 | 111 | |||
112 | #if defined(RESIDUAL_DATA_DUMP) | 112 | #if defined(RESIDUAL_DATA_DUMP) | |
113 | print_residual_device_info(); | 113 | print_residual_device_info(); | |
114 | #endif | 114 | #endif | |
115 | 115 | |||
116 | for (i = 0; i < CPU_MAXNUM; i++) { | 116 | for (i = 0; i < CPU_MAXNUM; i++) { | |
117 | ca.ca_name = "cpu"; | 117 | ca.ca_name = "cpu"; | |
118 | ca.ca_node = i; | 118 | ca.ca_node = i; | |
119 | config_found_ia(self, "mainbus", &ca, NULL); | 119 | config_found_ia(self, "mainbus", &ca, NULL); | |
120 | } | 120 | } | |
121 | 121 | |||
122 | /* | 122 | /* | |
123 | * XXX Note also that the presence of a PCI bus should | 123 | * XXX Note also that the presence of a PCI bus should | |
124 | * XXX _always_ be checked, and if present the bus should be | 124 | * XXX _always_ be checked, and if present the bus should be | |
125 | * XXX 'found'. However, because of the structure of the code, | 125 | * XXX 'found'. However, because of the structure of the code, | |
126 | * XXX that's not currently possible. | 126 | * XXX that's not currently possible. | |
127 | */ | 127 | */ | |
128 | #if NPCI > 0 | 128 | #if NPCI > 0 | |
129 | genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, | 129 | genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, | |
130 | M_NOWAIT); | 130 | M_NOWAIT); | |
131 | KASSERT(genppc_pct != NULL); | 131 | KASSERT(genppc_pct != NULL); | |
132 | prep_pci_get_chipset_tag(genppc_pct); | 132 | prep_pci_get_chipset_tag(genppc_pct); | |
133 | 133 | |||
134 | pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), | 134 | pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), | |
135 | M_DEVBUF, M_NOWAIT); | 135 | M_DEVBUF, M_NOWAIT); | |
136 | KASSERT(pbi != NULL); | 136 | KASSERT(pbi != NULL); | |
137 | pbi->pbi_properties = prop_dictionary_create(); | 137 | pbi->pbi_properties = prop_dictionary_create(); | |
138 | KASSERT(pbi->pbi_properties != NULL); | 138 | KASSERT(pbi->pbi_properties != NULL); | |
139 | 139 | |||
140 | SIMPLEQ_INIT(&genppc_pct->pc_pbi); | 140 | SIMPLEQ_INIT(&genppc_pct->pc_pbi); | |
141 | SIMPLEQ_INSERT_TAIL(&genppc_pct->pc_pbi, pbi, next); | 141 | SIMPLEQ_INSERT_TAIL(&genppc_pct->pc_pbi, pbi, next); | |
142 | 142 | |||
143 | /* find the primary host bridge */ | 143 | /* find the primary host bridge */ | |
144 | setup_pciintr_map(pbi, 0, 0, 0); | 144 | setup_pciintr_map(pbi, 0, 0, 0); | |
145 | 145 | |||
146 | #ifdef PCI_NETBSD_CONFIGURE | 146 | #ifdef PCI_NETBSD_CONFIGURE | |
147 | ioext = extent_create("pciio", 0x00008000, 0x0000ffff, M_DEVBUF, | 147 | ioext = extent_create("pciio", 0x00008000, 0x0000ffff, M_DEVBUF, | |
148 | NULL, 0, EX_NOWAIT); | 148 | NULL, 0, EX_NOWAIT); | |
149 | memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF, | 149 | memext = extent_create("pcimem", 0x00000000, 0x0fffffff, M_DEVBUF, | |
150 | NULL, 0, EX_NOWAIT); | 150 | NULL, 0, EX_NOWAIT); | |
151 | 151 | |||
152 | pci_configure_bus(genppc_pct, ioext, memext, NULL, 0, CACHELINESIZE); | 152 | pci_configure_bus(genppc_pct, ioext, memext, NULL, 0, CACHELINESIZE); | |
153 | 153 | |||
154 | extent_destroy(ioext); | 154 | extent_destroy(ioext); | |
155 | extent_destroy(memext); | 155 | extent_destroy(memext); | |
156 | #endif /* PCI_NETBSD_CONFIGURE */ | 156 | #endif /* PCI_NETBSD_CONFIGURE */ | |
157 | #endif /* NPCI */ | 157 | #endif /* NPCI */ | |
158 | 158 | |||
159 | /* scan pnpbus first */ | 159 | /* scan pnpbus first */ | |
160 | #if NPNPBUS > 0 | 160 | #if NPNPBUS > 0 | |
161 | mba.mba_paa.paa_name = "pnpbus"; | 161 | mba.mba_paa.paa_name = "pnpbus"; | |
162 | mba.mba_paa.paa_iot = &genppc_isa_io_space_tag; | 162 | mba.mba_paa.paa_iot = &genppc_isa_io_space_tag; | |
163 | mba.mba_paa.paa_memt = &genppc_isa_mem_space_tag; | 163 | mba.mba_paa.paa_memt = &genppc_isa_mem_space_tag; | |
164 | mba.mba_paa.paa_ic = &genppc_ict; | 164 | mba.mba_paa.paa_ic = &genppc_ict; | |
165 | mba.mba_paa.paa_dmat = &isa_bus_dma_tag; | 165 | mba.mba_paa.paa_dmat = &isa_bus_dma_tag; | |
166 | config_found_ia(self, "mainbus", &mba.mba_pba, mainbus_print); | 166 | config_found_ia(self, "mainbus", &mba.mba_pba, mainbus_print); | |
167 | #endif /* NPNPBUS */ | 167 | #endif /* NPNPBUS */ | |
168 | 168 | |||
169 | #if NPCI > 0 | 169 | #if NPCI > 0 | |
170 | memset(&mba, 0, sizeof(mba)); | 170 | memset(&mba, 0, sizeof(mba)); | |
171 | mba.mba_pba._pba_busname = NULL; | 171 | mba.mba_pba._pba_busname = NULL; | |
172 | mba.mba_pba.pba_iot = &prep_io_space_tag; | 172 | mba.mba_pba.pba_iot = &prep_io_space_tag; | |
173 | mba.mba_pba.pba_memt = &prep_mem_space_tag; | 173 | mba.mba_pba.pba_memt = &prep_mem_space_tag; | |
174 | mba.mba_pba.pba_dmat = &pci_bus_dma_tag; | 174 | mba.mba_pba.pba_dmat = &pci_bus_dma_tag; | |
175 | mba.mba_pba.pba_dmat64 = NULL; | 175 | mba.mba_pba.pba_dmat64 = NULL; | |
176 | mba.mba_pba.pba_pc = genppc_pct; | 176 | mba.mba_pba.pba_pc = genppc_pct; | |
177 | mba.mba_pba.pba_bus = 0; | 177 | mba.mba_pba.pba_bus = 0; | |
178 | mba.mba_pba.pba_bridgetag = NULL; | 178 | mba.mba_pba.pba_bridgetag = NULL; | |
179 | mba.mba_pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | 179 | mba.mba_pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | |
180 | config_found_ia(self, "pcibus", &mba.mba_pba, pcibusprint); | 180 | config_found_ia(self, "pcibus", &mba.mba_pba, pcibusprint); | |
181 | #endif /* NPCI */ | 181 | #endif /* NPCI */ | |
182 | 182 | |||
183 | #ifdef RESIDUAL_DATA_DUMP | 183 | #ifdef RESIDUAL_DATA_DUMP | |
184 | SIMPLEQ_FOREACH(pbi, &genppc_pct->pc_pbi, next) | 184 | SIMPLEQ_FOREACH(pbi, &genppc_pct->pc_pbi, next) | |
185 | printf("%s\n", prop_dictionary_externalize(pbi->pbi_properties)); | 185 | printf("%s\n", prop_dictionary_externalize(pbi->pbi_properties)); | |
186 | #endif | 186 | #endif | |
187 | } | 187 | } | |
188 | 188 | |||
189 | int | 189 | int | |
190 | mainbus_print(void *aux, const char *pnp) | 190 | mainbus_print(void *aux, const char *pnp) | |
191 | { | 191 | { | |
192 | union mainbus_attach_args *mba = aux; | 192 | union mainbus_attach_args *mba = aux; | |
193 | 193 | |||
194 | if (pnp) | 194 | if (pnp) | |
195 | aprint_normal("%s at %s", mba->mba_busname, pnp); | 195 | aprint_normal("%s at %s", mba->mba_busname, pnp); | |
196 | 196 | |||
197 | return (UNCONF); | 197 | return (UNCONF); | |
198 | } | 198 | } |
--- src/sys/arch/rs6000/rs6000/cpu.c 2008/04/28 20:23:34 1.2
+++ src/sys/arch/rs6000/rs6000/cpu.c 2011/06/05 17:03:17 1.3
@@ -1,73 +1,73 @@ | @@ -1,73 +1,73 @@ | |||
1 | /* $NetBSD: cpu.c,v 1.2 2008/04/28 20:23:34 martin Exp $ */ | 1 | /* $NetBSD: cpu.c,v 1.3 2011/06/05 17:03:17 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by NONAKA Kimihiro. | 8 | * by NONAKA Kimihiro. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.2 2008/04/28 20:23:34 martin Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.3 2011/06/05 17:03:17 matt Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/systm.h> | 36 | #include <sys/systm.h> | |
37 | #include <sys/device.h> | 37 | #include <sys/device.h> | |
38 | 38 | |||
39 | #include <machine/autoconf.h> | 39 | #include <machine/autoconf.h> | |
40 | #include <machine/bus.h> | 40 | #include <machine/bus.h> | |
41 | #include <machine/cpu.h> | 41 | #include <machine/cpu.h> | |
42 | 42 | |||
43 | int cpumatch(struct device *, struct cfdata *, void *); | 43 | int cpumatch(device_t, cfdata_t, void *); | |
44 | void cpuattach(struct device *, struct device *, void *); | 44 | void cpuattach(device_t, device_t, void *); | |
45 | 45 | |||
46 | CFATTACH_DECL(cpu, sizeof(struct device), | 46 | CFATTACH_DECL_NEW(cpu, 0, | |
47 | cpumatch, cpuattach, NULL, NULL); | 47 | cpumatch, cpuattach, NULL, NULL); | |
48 | 48 | |||
49 | extern struct cfdriver cpu_cd; | 49 | extern struct cfdriver cpu_cd; | |
50 | 50 | |||
51 | int | 51 | int | |
52 | cpumatch(struct device *parent, struct cfdata *cfdata, void *aux) | 52 | cpumatch(device_t parent, cfdata_t cfdata, void *aux) | |
53 | { | 53 | { | |
54 | struct confargs *ca = aux; | 54 | struct confargs *ca = aux; | |
55 | 55 | |||
56 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | 56 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | |
57 | return (0); | 57 | return (0); | |
58 | if (cpu_info[0].ci_dev != NULL) | 58 | if (cpu_info[0].ci_dev != NULL) | |
59 | return (0); | 59 | return (0); | |
60 | return (1); | 60 | return (1); | |
61 | } | 61 | } | |
62 | 62 | |||
63 | void | 63 | void | |
64 | cpuattach(struct device *parent, struct device *self, void *aux) | 64 | cpuattach(device_t parent, device_t self, void *aux) | |
65 | { | 65 | { | |
66 | struct cpu_info *ci; | 66 | struct cpu_info *ci; | |
67 | 67 | |||
68 | ci = cpu_attach_common(self, 0); | 68 | ci = cpu_attach_common(self, 0); | |
69 | if (ci == NULL) | 69 | if (ci == NULL) | |
70 | return; | 70 | return; | |
71 | 71 | |||
72 | /* cpu_setup_prep_generic(self);*/ | 72 | /* cpu_setup_prep_generic(self);*/ | |
73 | } | 73 | } |
--- src/sys/arch/rs6000/rs6000/mainbus.c 2009/01/18 16:46:12 1.3
+++ src/sys/arch/rs6000/rs6000/mainbus.c 2011/06/05 17:03:17 1.4
@@ -1,131 +1,131 @@ | @@ -1,131 +1,131 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.3 2009/01/18 16:46:12 christos Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.4 2011/06/05 17:03:17 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Tim Rightnour | 8 | * by Tim Rightnour | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
16 | * notice, this list of conditions and the following disclaimer in the | 16 | * notice, this list of conditions and the following disclaimer in the | |
17 | * documentation and/or other materials provided with the distribution. | 17 | * documentation and/or other materials provided with the distribution. | |
18 | * | 18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.3 2009/01/18 16:46:12 christos Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4 2011/06/05 17:03:17 matt Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/extent.h> | 36 | #include <sys/extent.h> | |
37 | #include <sys/systm.h> | 37 | #include <sys/systm.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | #include <sys/malloc.h> | 39 | #include <sys/malloc.h> | |
40 | 40 | |||
41 | #include <machine/autoconf.h> | 41 | #include <machine/autoconf.h> | |
42 | #include <powerpc/pio.h> | 42 | #include <powerpc/pio.h> | |
43 | #include <machine/bus.h> | 43 | #include <machine/bus.h> | |
44 | 44 | |||
45 | #include "mca.h" | 45 | #include "mca.h" | |
46 | 46 | |||
47 | #if NMCA > 0 | 47 | #if NMCA > 0 | |
48 | #include <dev/mca/mcavar.h> | 48 | #include <dev/mca/mcavar.h> | |
49 | #endif | 49 | #endif | |
50 | 50 | |||
51 | int mainbus_match(struct device *, struct cfdata *, void *); | 51 | int mainbus_match(device_t, cfdata_t, void *); | |
52 | void mainbus_attach(struct device *, struct device *, void *); | 52 | void mainbus_attach(device_t, device_t, void *); | |
53 | 53 | |||
54 | CFATTACH_DECL(mainbus, sizeof(struct device), | 54 | CFATTACH_DECL_NEW(mainbus, 0, | |
55 | mainbus_match, mainbus_attach, NULL, NULL); | 55 | mainbus_match, mainbus_attach, NULL, NULL); | |
56 | 56 | |||
57 | int mainbus_print(void *, const char *); | 57 | int mainbus_print(void *, const char *); | |
58 | 58 | |||
59 | union mainbus_attach_args { | 59 | union mainbus_attach_args { | |
60 | const char *mba_busname; /* first elem of all */ | 60 | const char *mba_busname; /* first elem of all */ | |
61 | #if NMCA > 0 | 61 | #if NMCA > 0 | |
62 | struct mcabus_attach_args mba_mba; | 62 | struct mcabus_attach_args mba_mba; | |
63 | #endif | 63 | #endif | |
64 | }; | 64 | }; | |
65 | 65 | |||
66 | /* There can be only one. */ | 66 | /* There can be only one. */ | |
67 | int mainbus_found = 0; | 67 | int mainbus_found = 0; | |
68 | 68 | |||
69 | /* | 69 | /* | |
70 | * Probe for the mainbus; always succeeds. | 70 | * Probe for the mainbus; always succeeds. | |
71 | */ | 71 | */ | |
72 | int | 72 | int | |
73 | mainbus_match(struct device *parent, struct cfdata *match, void *aux) | 73 | mainbus_match(device_t parent, cfdata_t match, void *aux) | |
74 | { | 74 | { | |
75 | 75 | |||
76 | if (mainbus_found) | 76 | if (mainbus_found) | |
77 | return 0; | 77 | return 0; | |
78 | return 1; | 78 | return 1; | |
79 | } | 79 | } | |
80 | 80 | |||
81 | /* | 81 | /* | |
82 | * Attach the mainbus. | 82 | * Attach the mainbus. | |
83 | */ | 83 | */ | |
84 | void | 84 | void | |
85 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 85 | mainbus_attach(device_t parent, device_t self, void *aux) | |
86 | { | 86 | { | |
87 | union mainbus_attach_args mba; | 87 | union mainbus_attach_args mba; | |
88 | struct confargs ca; | 88 | struct confargs ca; | |
89 | #if DEBUG | 89 | #if DEBUG | |
90 | int slot; | 90 | int slot; | |
91 | #endif | 91 | #endif | |
92 | mainbus_found = 1; | 92 | mainbus_found = 1; | |
93 | 93 | |||
94 | aprint_normal("\n"); | 94 | aprint_normal("\n"); | |
95 | 95 | |||
96 | ca.ca_name = "cpu"; | 96 | ca.ca_name = "cpu"; | |
97 | ca.ca_node = 0; | 97 | ca.ca_node = 0; | |
98 | config_found_ia(self, "mainbus", &ca, mainbus_print); | 98 | config_found_ia(self, "mainbus", &ca, mainbus_print); | |
99 | 99 | |||
100 | #if DEBUG | 100 | #if DEBUG | |
101 | printf("scanning MCA bus\n"); | 101 | printf("scanning MCA bus\n"); | |
102 | for (slot=0; slot < 16; slot++) { | 102 | for (slot=0; slot < 16; slot++) { | |
103 | printf("slot %d == %x%x\n", slot, | 103 | printf("slot %d == %x%x\n", slot, | |
104 | inb(0xc0400100 + 1 + (slot<<16)), | 104 | inb(0xc0400100 + 1 + (slot<<16)), | |
105 | inb(0xc0400100 + 0 + (slot<<16))); | 105 | inb(0xc0400100 + 0 + (slot<<16))); | |
106 | } | 106 | } | |
107 | printf("done\n"); | 107 | printf("done\n"); | |
108 | 108 | |||
109 | printf(" CFG reg (1)= %x\n", inl(0xc0010080)); | 109 | printf(" CFG reg (1)= %x\n", inl(0xc0010080)); | |
110 | printf(" TCE reg (1)= %x\n", inl(0xc001009c)); | 110 | printf(" TCE reg (1)= %x\n", inl(0xc001009c)); | |
111 | #endif | 111 | #endif | |
112 | 112 | |||
113 | mba.mba_mba.mba_iot = &rs6000_iocc0_io_space_tag; | 113 | mba.mba_mba.mba_iot = &rs6000_iocc0_io_space_tag; | |
114 | mba.mba_mba.mba_memt = &rs6000_iocc0_io_space_tag; /* XXX ??? */ | 114 | mba.mba_mba.mba_memt = &rs6000_iocc0_io_space_tag; /* XXX ??? */ | |
115 | mba.mba_mba.mba_dmat = NULL; /*&mca_bus_dma_tag;*/ | 115 | mba.mba_mba.mba_dmat = NULL; /*&mca_bus_dma_tag;*/ | |
116 | mba.mba_mba.mba_mc = NULL; | 116 | mba.mba_mba.mba_mc = NULL; | |
117 | mba.mba_mba.mba_bus = 0; | 117 | mba.mba_mba.mba_bus = 0; | |
118 | config_found_ia(self, "mcabus", &mba.mba_mba, mcabusprint); | 118 | config_found_ia(self, "mcabus", &mba.mba_mba, mcabusprint); | |
119 | 119 | |||
120 | } | 120 | } | |
121 | 121 | |||
122 | int | 122 | int | |
123 | mainbus_print(void *aux, const char *pnp) | 123 | mainbus_print(void *aux, const char *pnp) | |
124 | { | 124 | { | |
125 | union mainbus_attach_args *mba = aux; | 125 | union mainbus_attach_args *mba = aux; | |
126 | 126 | |||
127 | if (pnp) | 127 | if (pnp) | |
128 | aprint_normal("%s at %s", mba->mba_busname, pnp); | 128 | aprint_normal("%s at %s", mba->mba_busname, pnp); | |
129 | 129 | |||
130 | return (UNCONF); | 130 | return (UNCONF); | |
131 | } | 131 | } |
--- src/sys/arch/sandpoint/sandpoint/mainbus.c 2011/05/17 17:34:52 1.22
+++ src/sys/arch/sandpoint/sandpoint/mainbus.c 2011/06/05 17:03:19 1.23
@@ -1,161 +1,161 @@ | @@ -1,161 +1,161 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.22 2011/05/17 17:34:52 dyoung Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.23 2011/06/05 17:03:19 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | 4 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
15 | * must display the following acknowledgement: | 15 | * must display the following acknowledgement: | |
16 | * This product includes software developed by Christopher G. Demetriou | 16 | * This product includes software developed by Christopher G. Demetriou | |
17 | * for the NetBSD Project. | 17 | * for the NetBSD Project. | |
18 | * 4. The name of the author may not be used to endorse or promote products | 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 | 19 | * derived from this software without specific prior written permission | |
20 | * | 20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 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 | 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 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 | 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | #include <sys/cdefs.h> | 33 | #include <sys/cdefs.h> | |
34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.22 2011/05/17 17:34:52 dyoung Exp $"); | 34 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.23 2011/06/05 17:03:19 matt Exp $"); | |
35 | 35 | |||
36 | #include "opt_pci.h" | 36 | #include "opt_pci.h" | |
37 | #include "pci.h" | 37 | #include "pci.h" | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/extent.h> | 40 | #include <sys/extent.h> | |
41 | #include <sys/device.h> | 41 | #include <sys/device.h> | |
42 | #include <sys/malloc.h> | 42 | #include <sys/malloc.h> | |
43 | #include <sys/systm.h> | 43 | #include <sys/systm.h> | |
44 | 44 | |||
45 | #include <machine/bus.h> | 45 | #include <machine/bus.h> | |
46 | #include <machine/isa_machdep.h> | 46 | #include <machine/isa_machdep.h> | |
47 | 47 | |||
48 | #include <dev/pci/pcivar.h> | 48 | #include <dev/pci/pcivar.h> | |
49 | #include <dev/pci/pciconf.h> | 49 | #include <dev/pci/pciconf.h> | |
50 | 50 | |||
51 | struct conf_args { | 51 | struct conf_args { | |
52 | const char *ca_name; | 52 | const char *ca_name; | |
53 | }; | 53 | }; | |
54 | 54 | |||
55 | int mainbus_match(struct device *, struct cfdata *, void *); | 55 | int mainbus_match(device_t, cfdata_t, void *); | |
56 | void mainbus_attach(struct device *, struct device *, void *); | 56 | void mainbus_attach(device_t, device_t, void *); | |
57 | int mainbus_print(void *, const char *); | 57 | int mainbus_print(void *, const char *); | |
58 | 58 | |||
59 | CFATTACH_DECL(mainbus, sizeof(struct device), | 59 | CFATTACH_DECL_NEW(mainbus, 0, | |
60 | mainbus_match, mainbus_attach, NULL, NULL); | 60 | mainbus_match, mainbus_attach, NULL, NULL); | |
61 | 61 | |||
62 | struct powerpc_isa_chipset genppc_ict; | 62 | struct powerpc_isa_chipset genppc_ict; | |
63 | 63 | |||
64 | /* | 64 | /* | |
65 | * Probe for the mainbus; always succeeds. | 65 | * Probe for the mainbus; always succeeds. | |
66 | */ | 66 | */ | |
67 | int | 67 | int | |
68 | mainbus_match(struct device *parent, struct cfdata *match, void *aux) | 68 | mainbus_match(device_t parent, cfdata_t match, void *aux) | |
69 | { | 69 | { | |
70 | 70 | |||
71 | return 1; | 71 | return 1; | |
72 | } | 72 | } | |
73 | 73 | |||
74 | /* | 74 | /* | |
75 | * Attach the mainbus. | 75 | * Attach the mainbus. | |
76 | */ | 76 | */ | |
77 | void | 77 | void | |
78 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 78 | mainbus_attach(device_t parent, device_t self, void *aux) | |
79 | { | 79 | { | |
80 | struct conf_args ca; | 80 | struct conf_args ca; | |
81 | struct pcibus_attach_args pba; | 81 | struct pcibus_attach_args pba; | |
82 | #if defined(PCI_NETBSD_CONFIGURE) | 82 | #if defined(PCI_NETBSD_CONFIGURE) | |
83 | struct extent *ioext, *memext; | 83 | struct extent *ioext, *memext; | |
84 | #endif | 84 | #endif | |
85 | 85 | |||
86 | printf("\n"); | 86 | printf("\n"); | |
87 | 87 | |||
88 | ca.ca_name = "cpu"; | 88 | ca.ca_name = "cpu"; | |
89 | config_found_ia(self, "mainbus", &ca, mainbus_print); | 89 | config_found_ia(self, "mainbus", &ca, mainbus_print); | |
90 | ca.ca_name = "eumb"; | 90 | ca.ca_name = "eumb"; | |
91 | config_found_ia(self, "mainbus", &ca, mainbus_print); | 91 | config_found_ia(self, "mainbus", &ca, mainbus_print); | |
92 | 92 | |||
93 | /* | 93 | /* | |
94 | * XXX Note also that the presence of a PCI bus should | 94 | * XXX Note also that the presence of a PCI bus should | |
95 | * XXX _always_ be checked, and if present the bus should be | 95 | * XXX _always_ be checked, and if present the bus should be | |
96 | * XXX 'found'. However, because of the structure of the code, | 96 | * XXX 'found'. However, because of the structure of the code, | |
97 | * XXX that's not currently possible. | 97 | * XXX that's not currently possible. | |
98 | */ | 98 | */ | |
99 | #if NPCI > 0 | 99 | #if NPCI > 0 | |
100 | #if defined(PCI_NETBSD_CONFIGURE) | 100 | #if defined(PCI_NETBSD_CONFIGURE) | |
101 | ioext = extent_create("pciio", 0x00001000, 0x0000ffff, M_DEVBUF, | 101 | ioext = extent_create("pciio", 0x00001000, 0x0000ffff, M_DEVBUF, | |
102 | NULL, 0, EX_NOWAIT); | 102 | NULL, 0, EX_NOWAIT); | |
103 | memext = extent_create("pcimem", 0x80000000, 0x8fffffff, M_DEVBUF, | 103 | memext = extent_create("pcimem", 0x80000000, 0x8fffffff, M_DEVBUF, | |
104 | NULL, 0, EX_NOWAIT); | 104 | NULL, 0, EX_NOWAIT); | |
105 | 105 | |||
106 | pci_configure_bus(0, ioext, memext, NULL, 0, 32); | 106 | pci_configure_bus(0, ioext, memext, NULL, 0, 32); | |
107 | 107 | |||
108 | extent_destroy(ioext); | 108 | extent_destroy(ioext); | |
109 | extent_destroy(memext); | 109 | extent_destroy(memext); | |
110 | #endif | 110 | #endif | |
111 | 111 | |||
112 | pba.pba_iot = &sandpoint_io_space_tag; | 112 | pba.pba_iot = &sandpoint_io_space_tag; | |
113 | pba.pba_memt = &sandpoint_mem_space_tag; | 113 | pba.pba_memt = &sandpoint_mem_space_tag; | |
114 | pba.pba_dmat = &pci_bus_dma_tag; | 114 | pba.pba_dmat = &pci_bus_dma_tag; | |
115 | pba.pba_dmat64 = NULL; | 115 | pba.pba_dmat64 = NULL; | |
116 | pba.pba_bus = 0; | 116 | pba.pba_bus = 0; | |
117 | pba.pba_pc = 0; | 117 | pba.pba_pc = 0; | |
118 | pba.pba_bridgetag = NULL; | 118 | pba.pba_bridgetag = NULL; | |
119 | pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | 119 | pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | |
120 | 120 | |||
121 | config_found_ia(self, "pcibus", &pba, pcibusprint); | 121 | config_found_ia(self, "pcibus", &pba, pcibusprint); | |
122 | #endif | 122 | #endif | |
123 | } | 123 | } | |
124 | 124 | |||
125 | static int cpu_match(struct device *, struct cfdata *, void *); | 125 | static int cpu_match(device_t, cfdata_t, void *); | |
126 | static void cpu_attach(struct device *, struct device *, void *); | 126 | static void cpu_attach(device_t, device_t, void *); | |
127 | 127 | |||
128 | CFATTACH_DECL(cpu, sizeof(struct device), | 128 | CFATTACH_DECL_NEW(cpu, 0, | |
129 | cpu_match, cpu_attach, NULL, NULL); | 129 | cpu_match, cpu_attach, NULL, NULL); | |
130 | 130 | |||
131 | extern struct cfdriver cpu_cd; | 131 | extern struct cfdriver cpu_cd; | |
132 | 132 | |||
133 | int | 133 | int | |
134 | cpu_match(struct device *parent, struct cfdata *cf, void *aux) | 134 | cpu_match(device_t parent, cfdata_t cf, void *aux) | |
135 | { | 135 | { | |
136 | struct conf_args *ca = aux; | 136 | struct conf_args *ca = aux; | |
137 | 137 | |||
138 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | 138 | if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) | |
139 | return 0; | 139 | return 0; | |
140 | if (cpu_info[0].ci_dev != NULL) | 140 | if (cpu_info[0].ci_dev != NULL) | |
141 | return 0; | 141 | return 0; | |
142 | 142 | |||
143 | return 1; | 143 | return 1; | |
144 | } | 144 | } | |
145 | 145 | |||
146 | void | 146 | void | |
147 | cpu_attach(struct device *parent, struct device *self, void *aux) | 147 | cpu_attach(device_t parent, device_t self, void *aux) | |
148 | { | 148 | { | |
149 | 149 | |||
150 | (void) cpu_attach_common(self, 0); | 150 | (void) cpu_attach_common(self, 0); | |
151 | } | 151 | } | |
152 | 152 | |||
153 | int | 153 | int | |
154 | mainbus_print(void *aux, const char *pnp) | 154 | mainbus_print(void *aux, const char *pnp) | |
155 | { | 155 | { | |
156 | struct conf_args *ca = aux; | 156 | struct conf_args *ca = aux; | |
157 | 157 | |||
158 | if (pnp) | 158 | if (pnp) | |
159 | aprint_normal("%s at %s", ca->ca_name, pnp); | 159 | aprint_normal("%s at %s", ca->ca_name, pnp); | |
160 | return (UNCONF); | 160 | return (UNCONF); | |
161 | } | 161 | } |
--- src/sys/arch/shark/ofw/cpu_ofbus.c 2009/03/14 15:36:13 1.7
+++ src/sys/arch/shark/ofw/cpu_ofbus.c 2011/06/05 17:03:18 1.8
@@ -1,47 +1,47 @@ | @@ -1,47 +1,47 @@ | |||
1 | /* $NetBSD: cpu_ofbus.c,v 1.7 2009/03/14 15:36:13 dsl Exp $ */ | 1 | /* $NetBSD: cpu_ofbus.c,v 1.8 2011/06/05 17:03:18 matt Exp $ */ | |
2 | 2 | |||
3 | #include <sys/cdefs.h> | 3 | #include <sys/cdefs.h> | |
4 | __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.7 2009/03/14 15:36:13 dsl Exp $"); | 4 | __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.8 2011/06/05 17:03:18 matt Exp $"); | |
5 | 5 | |||
6 | #include <sys/param.h> | 6 | #include <sys/param.h> | |
7 | #include <sys/systm.h> | 7 | #include <sys/systm.h> | |
8 | #include <sys/device.h> | 8 | #include <sys/device.h> | |
9 | 9 | |||
10 | #include <machine/cpu.h> | 10 | #include <machine/cpu.h> | |
11 | 11 | |||
12 | #include <dev/ofw/openfirm.h> | 12 | #include <dev/ofw/openfirm.h> | |
13 | 13 | |||
14 | /* | 14 | /* | |
15 | * int cpu_ofbus_match(struct device *parent, struct cfdata *cf, void *aux) | 15 | * int cpu_ofbus_match(device_t parent, cfdata_t cf, void *aux) | |
16 | * | 16 | * | |
17 | * Probe for the main cpu. Currently all this does is return 1 to | 17 | * Probe for the main cpu. Currently all this does is return 1 to | |
18 | * indicate that the cpu was found. | 18 | * indicate that the cpu was found. | |
19 | */ | 19 | */ | |
20 | 20 | |||
21 | static int | 21 | static int | |
22 | cpu_ofbus_match(struct device *parent, struct cfdata *cf, void *aux) | 22 | cpu_ofbus_match(device_t parent, cfdata_t cf, void *aux) | |
23 | { | 23 | { | |
24 | struct ofbus_attach_args *aa = aux; | 24 | struct ofbus_attach_args *aa = aux; | |
25 | char buf[32]; | 25 | char buf[32]; | |
26 | 26 | |||
27 | if (OF_getprop(aa->oba_phandle, "device_type", buf, sizeof(buf)) < 0) | 27 | if (OF_getprop(aa->oba_phandle, "device_type", buf, sizeof(buf)) < 0) | |
28 | return (0); | 28 | return (0); | |
29 | if (strcmp("cpu", buf)) | 29 | if (strcmp("cpu", buf)) | |
30 | return (0); | 30 | return (0); | |
31 | return(1); | 31 | return(1); | |
32 | } | 32 | } | |
33 | 33 | |||
34 | /* | 34 | /* | |
35 | * void cpu_ofbus_attach(struct device *parent, struct device *dev, void *aux) | 35 | * void cpu_ofbus_attach(device_t parent, device_t dev, void *aux) | |
36 | * | 36 | * | |
37 | * Attach the main cpu | 37 | * Attach the main cpu | |
38 | */ | 38 | */ | |
39 | 39 | |||
40 | static void | 40 | static void | |
41 | cpu_ofbus_attach(struct device *parent, struct device *self, void *aux) | 41 | cpu_ofbus_attach(device_t parent, device_t self, void *aux) | |
42 | { | 42 | { | |
43 | cpu_attach(self); | 43 | cpu_attach(self); | |
44 | } | 44 | } | |
45 | 45 | |||
46 | CFATTACH_DECL(cpu_ofbus, sizeof(struct device), | 46 | CFATTACH_DECL_NEW(cpu_ofbus, 0, | |
47 | cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL); | 47 | cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL); |