CFATTACH_DECL(..., sizeof(struct device), -> CFATTACH_DECL_NEW(..., 0 struct device * -> device_t struct cfdata * -> cfdata_t use bool when appropriate some constificationdiff -r1.12 -r1.13 src/sys/arch/evbmips/malta/dev/gt.c
(matt)
--- src/sys/arch/evbmips/malta/dev/gt.c 2011/05/17 17:34:49 1.12
+++ src/sys/arch/evbmips/malta/dev/gt.c 2011/06/06 17:13:05 1.13
@@ -1,218 +1,216 @@ | @@ -1,218 +1,216 @@ | |||
1 | /* $NetBSD: gt.c,v 1.12 2011/05/17 17:34:49 dyoung Exp $ */ | 1 | /* $NetBSD: gt.c,v 1.13 2011/06/06 17:13:05 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2002 Wasabi Systems, Inc. | 4 | * Copyright 2002 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Jason R. Thorpe and Simon Burge for Wasabi Systems, Inc. | 7 | * Written by Jason R. Thorpe 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: gt.c,v 1.12 2011/05/17 17:34:49 dyoung Exp $"); | 39 | __KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.13 2011/06/06 17:13:05 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 | 44 | |||
45 | #include <dev/pci/pcivar.h> | 45 | #include <dev/pci/pcivar.h> | |
46 | 46 | |||
47 | #include <evbmips/malta/maltareg.h> | 47 | #include <evbmips/malta/maltareg.h> | |
48 | #include <evbmips/malta/maltavar.h> | 48 | #include <evbmips/malta/maltavar.h> | |
49 | 49 | |||
50 | #include <evbmips/malta/dev/gtreg.h> | 50 | #include <evbmips/malta/dev/gtreg.h> | |
51 | #include <evbmips/malta/dev/gtvar.h> | 51 | #include <evbmips/malta/dev/gtvar.h> | |
52 | 52 | |||
53 | #include "pci.h" | 53 | #include "pci.h" | |
54 | 54 | |||
55 | /* | 55 | /* | |
56 | * Galileo systems (so far) are always single-processor, so this is sufficient. | 56 | * Galileo systems (so far) are always single-processor, so this is sufficient. | |
57 | */ | 57 | */ | |
58 | #define PCI_CONF_LOCK(s) (s) = splhigh() | 58 | #define PCI_CONF_LOCK(s) (s) = splhigh() | |
59 | #define PCI_CONF_UNLOCK(s) splx((s)) | 59 | #define PCI_CONF_UNLOCK(s) splx((s)) | |
60 | 60 | |||
61 | static void gt_attach_hook(struct device *, struct device *, | 61 | static void gt_attach_hook(device_t, device_t, struct pcibus_attach_args *); | |
62 | struct pcibus_attach_args *); | |||
63 | static int gt_bus_maxdevs(void *, int); | 62 | static int gt_bus_maxdevs(void *, int); | |
64 | static pcitag_t gt_make_tag(void *, int, int, int); | 63 | static pcitag_t gt_make_tag(void *, int, int, int); | |
65 | static void gt_decompose_tag(void *, pcitag_t, int *, int *, int *); | 64 | static void gt_decompose_tag(void *, pcitag_t, int *, int *, int *); | |
66 | static pcireg_t gt_conf_read(void *, pcitag_t, int); | 65 | static pcireg_t gt_conf_read(void *, pcitag_t, int); | |
67 | static void gt_conf_write(void *, pcitag_t, int, pcireg_t); | 66 | static void gt_conf_write(void *, pcitag_t, int, pcireg_t); | |
68 | 67 | |||
69 | void | 68 | void | |
70 | gt_pci_init(pci_chipset_tag_t pc, struct gt_config *mcp) | 69 | gt_pci_init(pci_chipset_tag_t pc, struct gt_config *mcp) | |
71 | { | 70 | { | |
72 | 71 | |||
73 | pc->pc_conf_v = mcp; | 72 | pc->pc_conf_v = mcp; | |
74 | pc->pc_attach_hook = gt_attach_hook; | 73 | pc->pc_attach_hook = gt_attach_hook; | |
75 | pc->pc_bus_maxdevs = gt_bus_maxdevs; | 74 | pc->pc_bus_maxdevs = gt_bus_maxdevs; | |
76 | pc->pc_make_tag = gt_make_tag; | 75 | pc->pc_make_tag = gt_make_tag; | |
77 | pc->pc_decompose_tag = gt_decompose_tag; | 76 | pc->pc_decompose_tag = gt_decompose_tag; | |
78 | pc->pc_conf_read = gt_conf_read; | 77 | pc->pc_conf_read = gt_conf_read; | |
79 | pc->pc_conf_write = gt_conf_write; | 78 | pc->pc_conf_write = gt_conf_write; | |
80 | } | 79 | } | |
81 | 80 | |||
82 | static void | 81 | static void | |
83 | gt_attach_hook(struct device *parent, struct device *self, | 82 | gt_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba) | |
84 | struct pcibus_attach_args *pba) | |||
85 | { | 83 | { | |
86 | 84 | |||
87 | /* Nothing to do... */ | 85 | /* Nothing to do... */ | |
88 | } | 86 | } | |
89 | 87 | |||
90 | static int gt_match(struct device *, struct cfdata *, void *); | 88 | static int gt_match(device_t, cfdata_t, void *); | |
91 | static void gt_attach(struct device *, struct device *, void *); | 89 | static void gt_attach(device_t, device_t, void *); | |
92 | static int gt_print(void *aux, const char *pnp); | 90 | static int gt_print(void *aux, const char *pnp); | |
93 | 91 | |||
94 | CFATTACH_DECL(gt, sizeof(struct device), | 92 | CFATTACH_DECL_NEW(gt, 0, | |
95 | gt_match, gt_attach, NULL, NULL); | 93 | gt_match, gt_attach, NULL, NULL); | |
96 | 94 | |||
97 | static int | 95 | static int | |
98 | gt_match(struct device *parent, struct cfdata *match, void *aux) | 96 | gt_match(device_t parent, cfdata_t match, void *aux) | |
99 | { | 97 | { | |
100 | return 1; | 98 | return 1; | |
101 | } | 99 | } | |
102 | 100 | |||
103 | static void | 101 | static void | |
104 | gt_attach(struct device *parent, struct device *self, void *aux) | 102 | gt_attach(device_t parent, device_t self, void *aux) | |
105 | { | 103 | { | |
106 | struct malta_config *mcp = &malta_configuration; | 104 | struct malta_config *mcp = &malta_configuration; | |
107 | struct pcibus_attach_args pba; | 105 | struct pcibus_attach_args pba; | |
108 | 106 | |||
109 | printf("\n"); | 107 | printf("\n"); | |
110 | 108 | |||
111 | #if NPCI > 0 | 109 | #if NPCI > 0 | |
112 | pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | 110 | pba.pba_flags = PCI_FLAGS_IO_OKAY | PCI_FLAGS_MEM_OKAY; | |
113 | pba.pba_bus = 0; | 111 | pba.pba_bus = 0; | |
114 | pba.pba_bridgetag = NULL; | 112 | pba.pba_bridgetag = NULL; | |
115 | pba.pba_iot = &mcp->mc_iot; | 113 | pba.pba_iot = &mcp->mc_iot; | |
116 | pba.pba_memt = &mcp->mc_memt; | 114 | pba.pba_memt = &mcp->mc_memt; | |
117 | pba.pba_dmat = &mcp->mc_pci_dmat; /* pci_bus_dma_tag */ | 115 | pba.pba_dmat = &mcp->mc_pci_dmat; /* pci_bus_dma_tag */ | |
118 | pba.pba_dmat64 = NULL; | 116 | pba.pba_dmat64 = NULL; | |
119 | pba.pba_pc = &mcp->mc_pc; | 117 | pba.pba_pc = &mcp->mc_pc; | |
120 | 118 | |||
121 | config_found_ia(self, "pcibus", &pba, gt_print); | 119 | config_found_ia(self, "pcibus", &pba, gt_print); | |
122 | #endif | 120 | #endif | |
123 | } | 121 | } | |
124 | 122 | |||
125 | static int | 123 | static int | |
126 | gt_print(void *aux, const char *pnp) | 124 | gt_print(void *aux, const char *pnp) | |
127 | { | 125 | { | |
128 | /* XXX */ | 126 | /* XXX */ | |
129 | return 0; | 127 | return 0; | |
130 | } | 128 | } | |
131 | 129 | |||
132 | static int | 130 | static int | |
133 | gt_bus_maxdevs(void *v, int busno) | 131 | gt_bus_maxdevs(void *v, int busno) | |
134 | { | 132 | { | |
135 | 133 | |||
136 | /* The galileo has problems accessing device 31. */ | 134 | /* The galileo has problems accessing device 31. */ | |
137 | if (busno == 0) | 135 | if (busno == 0) | |
138 | return (31); | 136 | return (31); | |
139 | return (32); | 137 | return (32); | |
140 | } | 138 | } | |
141 | 139 | |||
142 | static pcitag_t | 140 | static pcitag_t | |
143 | gt_make_tag(void *v, int b, int d, int f) | 141 | gt_make_tag(void *v, int b, int d, int f) | |
144 | { | 142 | { | |
145 | 143 | |||
146 | return ((b << 16) | (d << 11) | (f << 8)); | 144 | return ((b << 16) | (d << 11) | (f << 8)); | |
147 | } | 145 | } | |
148 | 146 | |||
149 | static void | 147 | static void | |
150 | gt_decompose_tag(void *v, pcitag_t tag, int *bp, int *dp, int *fp) | 148 | gt_decompose_tag(void *v, pcitag_t tag, int *bp, int *dp, int *fp) | |
151 | { | 149 | { | |
152 | 150 | |||
153 | if (bp != NULL) | 151 | if (bp != NULL) | |
154 | *bp = (tag >> 16) & 0xff; | 152 | *bp = (tag >> 16) & 0xff; | |
155 | if (dp != NULL) | 153 | if (dp != NULL) | |
156 | *dp = (tag >> 11) & 0x1f; | 154 | *dp = (tag >> 11) & 0x1f; | |
157 | if (fp != NULL) | 155 | if (fp != NULL) | |
158 | *fp = (tag >> 8) & 0x7; | 156 | *fp = (tag >> 8) & 0x7; | |
159 | } | 157 | } | |
160 | 158 | |||
161 | static pcireg_t | 159 | static pcireg_t | |
162 | gt_conf_read(void *v, pcitag_t tag, int offset) | 160 | gt_conf_read(void *v, pcitag_t tag, int offset) | |
163 | { | 161 | { | |
164 | pcireg_t data; | 162 | pcireg_t data; | |
165 | int bus, dev, func, s; | 163 | int bus, dev, func, s; | |
166 | 164 | |||
167 | gt_decompose_tag(NULL /* XXX */, tag, &bus, &dev, &func); | 165 | gt_decompose_tag(NULL /* XXX */, tag, &bus, &dev, &func); | |
168 | 166 | |||
169 | /* The galileo has problems accessing device 31. */ | 167 | /* The galileo has problems accessing device 31. */ | |
170 | if (bus == 0 && dev == 31) | 168 | if (bus == 0 && dev == 31) | |
171 | return ((pcireg_t) -1); | 169 | return ((pcireg_t) -1); | |
172 | 170 | |||
173 | /* XXX: no support for bus > 0 yet */ | 171 | /* XXX: no support for bus > 0 yet */ | |
174 | if (bus > 0) | 172 | if (bus > 0) | |
175 | return ((pcireg_t) -1); | 173 | return ((pcireg_t) -1); | |
176 | 174 | |||
177 | PCI_CONF_LOCK(s); | 175 | PCI_CONF_LOCK(s); | |
178 | 176 | |||
179 | /* Clear cause register bits. */ | 177 | /* Clear cause register bits. */ | |
180 | GT_REGVAL(GT_INTR_CAUSE) = 0; | 178 | GT_REGVAL(GT_INTR_CAUSE) = 0; | |
181 | 179 | |||
182 | GT_REGVAL(GT_PCI0_CFG_ADDR) = (1 << 31) | tag | offset; | 180 | GT_REGVAL(GT_PCI0_CFG_ADDR) = (1 << 31) | tag | offset; | |
183 | data = GT_REGVAL(GT_PCI0_CFG_DATA); | 181 | data = GT_REGVAL(GT_PCI0_CFG_DATA); | |
184 | 182 | |||
185 | /* Check for master abort. */ | 183 | /* Check for master abort. */ | |
186 | if (GT_REGVAL(GT_INTR_CAUSE) & (GTIC_MASABORT0 | GTIC_TARABORT0)) | 184 | if (GT_REGVAL(GT_INTR_CAUSE) & (GTIC_MASABORT0 | GTIC_TARABORT0)) | |
187 | data = (pcireg_t) -1; | 185 | data = (pcireg_t) -1; | |
188 | 186 | |||
189 | PCI_CONF_UNLOCK(s); | 187 | PCI_CONF_UNLOCK(s); | |
190 | 188 | |||
191 | return (data); | 189 | return (data); | |
192 | } | 190 | } | |
193 | 191 | |||
194 | static void | 192 | static void | |
195 | gt_conf_write(void *v, pcitag_t tag, int offset, pcireg_t data) | 193 | gt_conf_write(void *v, pcitag_t tag, int offset, pcireg_t data) | |
196 | { | 194 | { | |
197 | int bus, dev, func, s; | 195 | int bus, dev, func, s; | |
198 | 196 | |||
199 | gt_decompose_tag(NULL /* XXX */, tag, &bus, &dev, &func); | 197 | gt_decompose_tag(NULL /* XXX */, tag, &bus, &dev, &func); | |
200 | 198 | |||
201 | /* The galileo has problems accessing device 31. */ | 199 | /* The galileo has problems accessing device 31. */ | |
202 | if (bus == 0 && dev == 31) | 200 | if (bus == 0 && dev == 31) | |
203 | return; | 201 | return; | |
204 | 202 | |||
205 | /* XXX: no support for bus > 0 yet */ | 203 | /* XXX: no support for bus > 0 yet */ | |
206 | if (bus > 0) | 204 | if (bus > 0) | |
207 | return; | 205 | return; | |
208 | 206 | |||
209 | PCI_CONF_LOCK(s); | 207 | PCI_CONF_LOCK(s); | |
210 | 208 | |||
211 | /* Clear cause register bits. */ | 209 | /* Clear cause register bits. */ | |
212 | GT_REGVAL(GT_INTR_CAUSE) = 0; | 210 | GT_REGVAL(GT_INTR_CAUSE) = 0; | |
213 | 211 | |||
214 | GT_REGVAL(GT_PCI0_CFG_ADDR) = (1 << 31) | tag | offset; | 212 | GT_REGVAL(GT_PCI0_CFG_ADDR) = (1 << 31) | tag | offset; | |
215 | GT_REGVAL(GT_PCI0_CFG_DATA) = data; | 213 | GT_REGVAL(GT_PCI0_CFG_DATA) = data; | |
216 | 214 | |||
217 | PCI_CONF_UNLOCK(s); | 215 | PCI_CONF_UNLOCK(s); | |
218 | } | 216 | } |
--- src/sys/arch/evbmips/malta/dev/mainbus.c 2009/03/14 15:36:06 1.11
+++ src/sys/arch/evbmips/malta/dev/mainbus.c 2011/06/06 17:13:05 1.12
@@ -1,191 +1,190 @@ | @@ -1,191 +1,190 @@ | |||
1 | /* $NetBSD: mainbus.c,v 1.11 2009/03/14 15:36:06 dsl Exp $ */ | 1 | /* $NetBSD: mainbus.c,v 1.12 2011/06/06 17:13:05 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2002 Wasabi Systems, Inc. | 4 | * Copyright 2002 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Simon Burge for Wasabi Systems, Inc. | 7 | * Written by 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: mainbus.c,v 1.11 2009/03/14 15:36:06 dsl Exp $"); | 39 | __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2011/06/06 17:13:05 matt Exp $"); | |
40 | 40 | |||
41 | #include "opt_pci.h" | 41 | #include "opt_pci.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 | #if defined(PCI_NETBSD_CONFIGURE) | 46 | #if defined(PCI_NETBSD_CONFIGURE) | |
47 | #include <sys/extent.h> | 47 | #include <sys/extent.h> | |
48 | #include <sys/malloc.h> | 48 | #include <sys/malloc.h> | |
49 | #endif | 49 | #endif | |
50 | 50 | |||
51 | #include <dev/pci/pcivar.h> | 51 | #include <dev/pci/pcivar.h> | |
52 | #if defined(PCI_NETBSD_CONFIGURE) | 52 | #if defined(PCI_NETBSD_CONFIGURE) | |
53 | #include <dev/pci/pciconf.h> | 53 | #include <dev/pci/pciconf.h> | |
54 | #endif | 54 | #endif | |
55 | 55 | |||
56 | #include <mips/cache.h> | 56 | #include <mips/cache.h> | |
57 | #include <mips/cpuregs.h> | 57 | #include <mips/cpuregs.h> | |
58 | 58 | |||
59 | #include <evbmips/malta/autoconf.h> | 59 | #include <evbmips/malta/autoconf.h> | |
60 | #include <evbmips/malta/maltareg.h> | 60 | #include <evbmips/malta/maltareg.h> | |
61 | #include <evbmips/malta/maltavar.h> | 61 | #include <evbmips/malta/maltavar.h> | |
62 | 62 | |||
63 | #if defined(PCI_NETBSD_ENABLE_IDE) | 63 | #if defined(PCI_NETBSD_ENABLE_IDE) | |
64 | #include <dev/pci/pciide_piix_reg.h> | 64 | #include <dev/pci/pciide_piix_reg.h> | |
65 | #endif /* PCI_NETBSD_ENABLE_IDE */ | 65 | #endif /* PCI_NETBSD_ENABLE_IDE */ | |
66 | 66 | |||
67 | #include "locators.h" | 67 | #include "locators.h" | |
68 | #include "pci.h" | 68 | #include "pci.h" | |
69 | 69 | |||
70 | static int mainbus_match(struct device *, struct cfdata *, void *); | 70 | static int mainbus_match(device_t, cfdata_t, void *); | |
71 | static void mainbus_attach(struct device *, struct device *, void *); | 71 | static void mainbus_attach(device_t, device_t, void *); | |
72 | static int mainbus_submatch(struct device *, struct cfdata *, | 72 | static int mainbus_submatch(device_t, cfdata_t, const int *, void *); | |
73 | const int *, void *); | |||
74 | static int mainbus_print(void *, const char *); | 73 | static int mainbus_print(void *, const char *); | |
75 | 74 | |||
76 | CFATTACH_DECL(mainbus, sizeof(struct device), | 75 | CFATTACH_DECL_NEW(mainbus, 0, | |
77 | mainbus_match, mainbus_attach, NULL, NULL); | 76 | mainbus_match, mainbus_attach, NULL, NULL); | |
78 | 77 | |||
79 | /* There can be only one. */ | 78 | /* There can be only one. */ | |
80 | int mainbus_found; | 79 | bool mainbus_found; | |
81 | 80 | |||
82 | struct mainbusdev { | 81 | struct mainbusdev { | |
83 | const char *md_name; | 82 | const char *md_name; | |
84 | bus_addr_t md_addr; | 83 | bus_addr_t md_addr; | |
85 | int md_intr; | 84 | int md_intr; | |
86 | }; | 85 | }; | |
87 | 86 | |||
88 | struct mainbusdev mainbusdevs[] = { | 87 | const struct mainbusdev mainbusdevs[] = { | |
89 | { "cpu", -1, -1 }, | 88 | { "cpu", -1, -1 }, | |
90 | { "gt", MALTA_CORECTRL_BASE, -1 }, | 89 | { "gt", MALTA_CORECTRL_BASE, -1 }, | |
91 | { "com", MALTA_CBUSUART, MALTA_CBUSUART_INTR }, | 90 | { "com", MALTA_CBUSUART, MALTA_CBUSUART_INTR }, | |
92 | { "i2c", MALTA_I2C_BASE, -1 }, | 91 | { "i2c", MALTA_I2C_BASE, -1 }, | |
93 | { "gpio", MALTA_GPIO_BASE, -1 }, | 92 | { "gpio", MALTA_GPIO_BASE, -1 }, | |
94 | { NULL, 0, 0 }, | 93 | { NULL, 0, 0 }, | |
95 | }; | 94 | }; | |
96 | 95 | |||
97 | static int | 96 | static int | |
98 | mainbus_match(struct device *parent, struct cfdata *match, void *aux) | 97 | mainbus_match(device_t parent, cfdata_t match, void *aux) | |
99 | { | 98 | { | |
100 | 99 | |||
101 | if (mainbus_found) | 100 | if (mainbus_found) | |
102 | return (0); | 101 | return (0); | |
103 | 102 | |||
104 | return (1); | 103 | return (1); | |
105 | } | 104 | } | |
106 | 105 | |||
107 | static void | 106 | static void | |
108 | mainbus_attach(struct device *parent, struct device *self, void *aux) | 107 | mainbus_attach(device_t parent, device_t self, void *aux) | |
109 | { | 108 | { | |
110 | struct mainbus_attach_args ma; | 109 | struct mainbus_attach_args ma; | |
111 | struct mainbusdev *md; | 110 | const struct mainbusdev *md; | |
112 | #if defined(PCI_NETBSD_CONFIGURE) | 111 | #if defined(PCI_NETBSD_CONFIGURE) | |
113 | struct extent *ioext, *memext; | 112 | struct extent *ioext, *memext; | |
114 | #endif | 113 | #endif | |
115 | #if defined(PCI_NETBSD_ENABLE_IDE) | 114 | #if defined(PCI_NETBSD_ENABLE_IDE) | |
116 | struct malta_config *mcp = &malta_configuration; | 115 | struct malta_config *mcp = &malta_configuration; | |
117 | pci_chipset_tag_t pc = &mcp->mc_pc; | 116 | pci_chipset_tag_t pc = &mcp->mc_pc; | |
118 | pcitag_t idetag; | 117 | pcitag_t idetag; | |
119 | pcireg_t idetim; | 118 | pcireg_t idetim; | |
120 | #endif | 119 | #endif | |
121 | 120 | |||
122 | mainbus_found = 1; | 121 | mainbus_found = true; | |
123 | printf("\n"); | 122 | printf("\n"); | |
124 | 123 | |||
125 | #if defined(PCI_NETBSD_CONFIGURE) | 124 | #if defined(PCI_NETBSD_CONFIGURE) | |
126 | ioext = extent_create("pciio", 0x00001000, 0x0000efff, | 125 | ioext = extent_create("pciio", 0x00001000, 0x0000efff, | |
127 | M_DEVBUF, NULL, 0, EX_NOWAIT); | 126 | M_DEVBUF, NULL, 0, EX_NOWAIT); | |
128 | memext = extent_create("pcimem", MALTA_PCIMEM1_BASE, | 127 | memext = extent_create("pcimem", MALTA_PCIMEM1_BASE, | |
129 | MALTA_PCIMEM1_BASE + MALTA_PCIMEM1_SIZE, | 128 | MALTA_PCIMEM1_BASE + MALTA_PCIMEM1_SIZE, | |
130 | M_DEVBUF, NULL, 0, EX_NOWAIT); | 129 | M_DEVBUF, NULL, 0, EX_NOWAIT); | |
131 | 130 | |||
132 | pci_configure_bus(pc, ioext, memext, NULL, 0, mips_dcache_align); | 131 | pci_configure_bus(pc, ioext, memext, NULL, 0, mips_dcache_align); | |
133 | extent_destroy(ioext); | 132 | extent_destroy(ioext); | |
134 | extent_destroy(memext); | 133 | extent_destroy(memext); | |
135 | #endif /* PCI_NETBSD_CONFIGURE */ | 134 | #endif /* PCI_NETBSD_CONFIGURE */ | |
136 | 135 | |||
137 | #if defined(PCI_NETBSD_ENABLE_IDE) | 136 | #if defined(PCI_NETBSD_ENABLE_IDE) | |
138 | /* | 137 | /* | |
139 | * Perhaps PMON has not enabled the IDE controller. Easy to | 138 | * Perhaps PMON has not enabled the IDE controller. Easy to | |
140 | * fix -- just set the ENABLE bits for each channel in the | 139 | * fix -- just set the ENABLE bits for each channel in the | |
141 | * IDETIM register. Just clear all the bits for the channel | 140 | * IDETIM register. Just clear all the bits for the channel | |
142 | * except for the ENABLE bits -- the `pciide' driver will | 141 | * except for the ENABLE bits -- the `pciide' driver will | |
143 | * properly configure it later. | 142 | * properly configure it later. | |
144 | */ | 143 | */ | |
145 | idetim = 0; | 144 | idetim = 0; | |
146 | if (PCI_NETBSD_ENABLE_IDE & 0x01) | 145 | if (PCI_NETBSD_ENABLE_IDE & 0x01) | |
147 | idetim = PIIX_IDETIM_SET(idetim, PIIX_IDETIM_IDE, 0); | 146 | idetim = PIIX_IDETIM_SET(idetim, PIIX_IDETIM_IDE, 0); | |
148 | if (PCI_NETBSD_ENABLE_IDE & 0x02) | 147 | if (PCI_NETBSD_ENABLE_IDE & 0x02) | |
149 | idetim = PIIX_IDETIM_SET(idetim, PIIX_IDETIM_IDE, 1); | 148 | idetim = PIIX_IDETIM_SET(idetim, PIIX_IDETIM_IDE, 1); | |
150 | 149 | |||
151 | /* pciide0 is pci device 10, function 1 */ | 150 | /* pciide0 is pci device 10, function 1 */ | |
152 | idetag = pci_make_tag(pc, 0, 10, 1); | 151 | idetag = pci_make_tag(pc, 0, 10, 1); | |
153 | pci_conf_write(pc, idetag, PIIX_IDETIM, idetim); | 152 | pci_conf_write(pc, idetag, PIIX_IDETIM, idetim); | |
154 | #endif | 153 | #endif | |
155 | for (md = mainbusdevs; md->md_name != NULL; md++) { | 154 | for (md = mainbusdevs; md->md_name != NULL; md++) { | |
156 | ma.ma_name = md->md_name; | 155 | ma.ma_name = md->md_name; | |
157 | ma.ma_addr = md->md_addr; | 156 | ma.ma_addr = md->md_addr; | |
158 | ma.ma_intr = md->md_intr; | 157 | ma.ma_intr = md->md_intr; | |
159 | (void) config_found_sm_loc(self, "mainbus", NULL, &ma, | 158 | (void) config_found_sm_loc(self, "mainbus", NULL, &ma, | |
160 | mainbus_print, mainbus_submatch); | 159 | mainbus_print, mainbus_submatch); | |
161 | } | 160 | } | |
162 | } | 161 | } | |
163 | 162 | |||
164 | static int | 163 | static int | |
165 | mainbus_submatch(struct device *parent, struct cfdata *cf, | 164 | mainbus_submatch(device_t parent, cfdata_t cf, | |
166 | const int *ldesc, void *aux) | 165 | const int *ldesc, void *aux) | |
167 | { | 166 | { | |
168 | struct mainbus_attach_args *ma = aux; | 167 | struct mainbus_attach_args *ma = aux; | |
169 | 168 | |||
170 | if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT && | 169 | if (cf->cf_loc[MAINBUSCF_ADDR] != MAINBUSCF_ADDR_DEFAULT && | |
171 | cf->cf_loc[MAINBUSCF_ADDR] != ma->ma_addr) | 170 | cf->cf_loc[MAINBUSCF_ADDR] != ma->ma_addr) | |
172 | return (0); | 171 | return (0); | |
173 | 172 | |||
174 | return (config_match(parent, cf, aux)); | 173 | return (config_match(parent, cf, aux)); | |
175 | } | 174 | } | |
176 | 175 | |||
177 | static int | 176 | static int | |
178 | mainbus_print(void *aux, const char *pnp) | 177 | mainbus_print(void *aux, const char *pnp) | |
179 | { | 178 | { | |
180 | struct mainbus_attach_args *ma = aux; | 179 | struct mainbus_attach_args *ma = aux; | |
181 | 180 | |||
182 | if (pnp != 0) | 181 | if (pnp != 0) | |
183 | return QUIET; | 182 | return QUIET; | |
184 | 183 | |||
185 | if (pnp) | 184 | if (pnp) | |
186 | aprint_normal("%s at %s", ma->ma_name, pnp); | 185 | aprint_normal("%s at %s", ma->ma_name, pnp); | |
187 | if (ma->ma_addr != MAINBUSCF_ADDR_DEFAULT) | 186 | if (ma->ma_addr != MAINBUSCF_ADDR_DEFAULT) | |
188 | aprint_normal(" addr 0x%lx", ma->ma_addr); | 187 | aprint_normal(" addr 0x%lx", ma->ma_addr); | |
189 | 188 | |||
190 | return (UNCONF); | 189 | return (UNCONF); | |
191 | } | 190 | } |
--- src/sys/arch/evbmips/malta/pci/pchb.c 2006/08/22 21:42:19 1.9
+++ src/sys/arch/evbmips/malta/pci/pchb.c 2011/06/06 17:13:05 1.10
@@ -1,110 +1,110 @@ | @@ -1,110 +1,110 @@ | |||
1 | /* $NetBSD: pchb.c,v 1.9 2006/08/22 21:42:19 riz Exp $ */ | 1 | /* $NetBSD: pchb.c,v 1.10 2011/06/06 17:13:05 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2002 Wasabi Systems, Inc. | 4 | * Copyright 2002 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Simon Burge for Wasabi Systems, Inc. | 7 | * Written by 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: pchb.c,v 1.9 2006/08/22 21:42:19 riz Exp $"); | 39 | __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.10 2011/06/06 17:13:05 matt Exp $"); | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/device.h> | 42 | #include <sys/device.h> | |
43 | #include <sys/systm.h> | 43 | #include <sys/systm.h> | |
44 | 44 | |||
45 | #include <dev/pci/pcivar.h> | 45 | #include <dev/pci/pcivar.h> | |
46 | #include <dev/pci/pcidevs.h> | 46 | #include <dev/pci/pcidevs.h> | |
47 | 47 | |||
48 | static int pchb_match(struct device *, struct cfdata *, void *); | 48 | static int pchb_match(device_t, cfdata_t, void *); | |
49 | static void pchb_attach(struct device *, struct device *, void *); | 49 | static void pchb_attach(device_t, device_t, void *); | |
50 | 50 | |||
51 | CFATTACH_DECL(pchb, sizeof(struct device), | 51 | CFATTACH_DECL_NEW(pchb, 0, | |
52 | pchb_match, pchb_attach, NULL, NULL); | 52 | pchb_match, pchb_attach, NULL, NULL); | |
53 | 53 | |||
54 | static int pcifound = 0; | 54 | static bool pcifound; | |
55 | 55 | |||
56 | static int | 56 | static int | |
57 | pchb_match(struct device *parent, struct cfdata *match, void *aux) | 57 | pchb_match(device_t parent, cfdata_t match, void *aux) | |
58 | { | 58 | { | |
59 | struct pci_attach_args *pa = aux; | 59 | struct pci_attach_args *pa = aux; | |
60 | 60 | |||
61 | /* | 61 | /* | |
62 | * Match all known PCI host chipsets. | 62 | * Match all known PCI host chipsets. | |
63 | */ | 63 | */ | |
64 | if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE && | 64 | if (PCI_CLASS(pa->pa_class) == PCI_CLASS_BRIDGE && | |
65 | PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_HOST) { | 65 | PCI_SUBCLASS(pa->pa_class) == PCI_SUBCLASS_BRIDGE_HOST) { | |
66 | switch (PCI_VENDOR(pa->pa_id)) { | 66 | switch (PCI_VENDOR(pa->pa_id)) { | |
67 | case PCI_VENDOR_MARVELL: | 67 | case PCI_VENDOR_MARVELL: | |
68 | switch (PCI_PRODUCT(pa->pa_id)) { | 68 | switch (PCI_PRODUCT(pa->pa_id)) { | |
69 | case PCI_PRODUCT_MARVELL_GT64120: | 69 | case PCI_PRODUCT_MARVELL_GT64120: | |
70 | return (!pcifound); | 70 | return (!pcifound); | |
71 | } | 71 | } | |
72 | break; | 72 | break; | |
73 | } | 73 | } | |
74 | } | 74 | } | |
75 | return (0); | 75 | return (0); | |
76 | } | 76 | } | |
77 | 77 | |||
78 | static void | 78 | static void | |
79 | pchb_attach(struct device *parent, struct device *self, void *aux) | 79 | pchb_attach(device_t parent, device_t self, void *aux) | |
80 | { | 80 | { | |
81 | struct pci_attach_args *pa = aux; | 81 | struct pci_attach_args *pa = aux; | |
82 | char devinfo[256]; | 82 | char devinfo[256]; | |
83 | 83 | |||
84 | printf("\n"); | 84 | printf("\n"); | |
85 | pcifound++; | 85 | pcifound = true; | |
86 | 86 | |||
87 | /* | 87 | /* | |
88 | * All we do is print out a description. Eventually, we | 88 | * All we do is print out a description. Eventually, we | |
89 | * might want to add code that does something that's | 89 | * might want to add code that does something that's | |
90 | * possibly chipset-specific. | 90 | * possibly chipset-specific. | |
91 | */ | 91 | */ | |
92 | if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_MARVELL && | 92 | if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_MARVELL && | |
93 | PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MARVELL_GT64120) { | 93 | PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MARVELL_GT64120) { | |
94 | /* Bah, same product ID... */ | 94 | /* Bah, same product ID... */ | |
95 | 95 | |||
96 | /* | 96 | /* | |
97 | * XXX: Is the >= 0x10 test correct? The '120 doco | 97 | * XXX: Is the >= 0x10 test correct? The '120 doco | |
98 | * lists rev == 0x02 and the '120A doco lists | 98 | * lists rev == 0x02 and the '120A doco lists | |
99 | * rev == 0x10. | 99 | * rev == 0x10. | |
100 | */ | 100 | */ | |
101 | snprintf(devinfo, sizeof(devinfo), | 101 | snprintf(devinfo, sizeof(devinfo), | |
102 | "Galileo Technology GT-64120%s System Controller", | 102 | "Galileo Technology GT-64120%s System Controller", | |
103 | PCI_REVISION(pa->pa_class) >= 0x10 ? "A" : ""); | 103 | PCI_REVISION(pa->pa_class) >= 0x10 ? "A" : ""); | |
104 | } else { | 104 | } else { | |
105 | pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, | 105 | pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, | |
106 | sizeof(devinfo)); | 106 | sizeof(devinfo)); | |
107 | } | 107 | } | |
108 | printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, | 108 | printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, | |
109 | PCI_REVISION(pa->pa_class)); | 109 | PCI_REVISION(pa->pa_class)); | |
110 | } | 110 | } |
--- src/sys/arch/evbppc/explora/dev/elb.c 2011/06/06 16:42:17 1.7
+++ src/sys/arch/evbppc/explora/dev/elb.c 2011/06/06 17:13:06 1.8
@@ -1,182 +1,184 @@ | @@ -1,182 +1,184 @@ | |||
1 | /* $NetBSD: elb.c,v 1.7 2011/06/06 16:42:17 matt Exp $ */ | 1 | /* $NetBSD: elb.c,v 1.8 2011/06/06 17:13:06 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2003 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2003 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 Juergen Hannken-Illjes. | 8 | * by Juergen Hannken-Illjes. | |
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: elb.c,v 1.7 2011/06/06 16:42:17 matt Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: elb.c,v 1.8 2011/06/06 17:13:06 matt Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/conf.h> | 36 | #include <sys/conf.h> | |
37 | #include <sys/device.h> | 37 | #include <sys/device.h> | |
38 | #include <sys/systm.h> | 38 | #include <sys/systm.h> | |
39 | #include <sys/extent.h> | 39 | #include <sys/extent.h> | |
40 | 40 | |||
41 | #include <machine/explora.h> | 41 | #include <machine/explora.h> | |
42 | #define _POWERPC_BUS_DMA_PRIVATE | 42 | #define _POWERPC_BUS_DMA_PRIVATE | |
43 | #include <machine/bus.h> | 43 | #include <machine/bus.h> | |
44 | 44 | |||
45 | #include <powerpc/ibm4xx/dcr403cgx.h> | 45 | #include <powerpc/ibm4xx/dcr403cgx.h> | |
46 | 46 | |||
47 | #include <evbppc/explora/dev/elbvar.h> | 47 | #include <evbppc/explora/dev/elbvar.h> | |
48 | 48 | |||
49 | struct elb_dev { | 49 | struct elb_dev { | |
50 | const char *elb_name; | 50 | const char *elb_name; | |
51 | int elb_addr; | 51 | int elb_addr; | |
52 | int elb_addr2; | 52 | int elb_addr2; | |
53 | int elb_irq; | 53 | int elb_irq; | |
54 | bus_space_tag_t elb_bt; | 54 | bus_space_tag_t elb_bt; | |
55 | }; | 55 | }; | |
56 | 56 | |||
57 | static int elb_match(device_t, cfdata_t, void *); | 57 | static int elb_match(device_t, cfdata_t, void *); | |
58 | static void elb_attach(device_t, device_t, void *); | 58 | static void elb_attach(device_t, device_t, void *); | |
59 | static int elb_print(void *, const char *); | 59 | static int elb_print(void *, const char *); | |
60 | 60 | |||
61 | static struct powerpc_bus_space elb_tag = { | 61 | static struct powerpc_bus_space elb_tag = { | |
62 | _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE | 1, /* stride 1 */ | 62 | _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE | 1, /* stride 1 */ | |
63 | 0x00000000, | 63 | 0x00000000, | |
64 | BASE_PCKBC, | 64 | BASE_PCKBC, | |
65 | BASE_PCKBC + 0x6ff | 65 | BASE_PCKBC + 0x6ff | |
66 | }; | 66 | }; | |
67 | static char elb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)] | |||
68 | __attribute__((aligned(8))); | |||
69 | static int elb_tag_init_done; | |||
70 | ||||
71 | static struct powerpc_bus_space elb_fb_tag = { | 67 | static struct powerpc_bus_space elb_fb_tag = { | |
72 | _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE, | 68 | _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE, | |
73 | 0x00000000, | 69 | 0x00000000, | |
74 | BASE_FB, | 70 | BASE_FB, | |
75 | BASE_FB2 + SIZE_FB - 1 | 71 | BASE_FB2 + SIZE_FB - 1 | |
76 | }; | 72 | }; | |
73 | ||||
74 | static char elb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)] | |||
75 | __attribute__((aligned(8))); | |||
77 | static char elbfb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)] | 76 | static char elbfb_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8)] | |
78 | __attribute__((aligned(8))); | 77 | __attribute__((aligned(8))); | |
79 | static int elbfb_tag_init_done; | 78 | ||
79 | static bool elb_tag_init_done; | |||
80 | static bool elbfb_tag_init_done; | |||
80 | 81 | |||
81 | /* | 82 | /* | |
82 | * DMA struct, nothing special. | 83 | * DMA struct, nothing special. | |
83 | */ | 84 | */ | |
84 | static struct powerpc_bus_dma_tag elb_bus_dma_tag = { | 85 | static struct powerpc_bus_dma_tag elb_bus_dma_tag = { | |
85 | 0, /* _bounce_thresh */ | 86 | 0, /* _bounce_thresh */ | |
86 | _bus_dmamap_create, | 87 | _bus_dmamap_create, | |
87 | _bus_dmamap_destroy, | 88 | _bus_dmamap_destroy, | |
88 | _bus_dmamap_load, | 89 | _bus_dmamap_load, | |
89 | _bus_dmamap_load_mbuf, | 90 | _bus_dmamap_load_mbuf, | |
90 | _bus_dmamap_load_uio, | 91 | _bus_dmamap_load_uio, | |
91 | _bus_dmamap_load_raw, | 92 | _bus_dmamap_load_raw, | |
92 | _bus_dmamap_unload, | 93 | _bus_dmamap_unload, | |
93 | _bus_dmamap_sync, | 94 | _bus_dmamap_sync, | |
94 | _bus_dmamem_alloc, | 95 | _bus_dmamem_alloc, | |
95 | _bus_dmamem_free, | 96 | _bus_dmamem_free, | |
96 | _bus_dmamem_map, | 97 | _bus_dmamem_map, | |
97 | _bus_dmamem_unmap, | 98 | _bus_dmamem_unmap, | |
98 | _bus_dmamem_mmap, | 99 | _bus_dmamem_mmap, | |
99 | _bus_dma_phys_to_bus_mem_generic, | 100 | _bus_dma_phys_to_bus_mem_generic, | |
100 | _bus_dma_bus_mem_to_phys_generic, | 101 | _bus_dma_bus_mem_to_phys_generic, | |
101 | }; | 102 | }; | |
102 | 103 | |||
103 | static struct elb_dev elb_devs[] = { | 104 | static const struct elb_dev elb_devs[] = { | |
104 | { "cpu", 0, 0, -1, NULL }, | 105 | { "cpu", 0, 0, -1, NULL }, | |
105 | { "pckbc", BASE_PCKBC, BASE_PCKBC2, 31, &elb_tag }, | 106 | { "pckbc", BASE_PCKBC, BASE_PCKBC2, 31, &elb_tag }, | |
106 | { "com", BASE_COM, 0, 30, &elb_tag }, | 107 | { "com", BASE_COM, 0, 30, &elb_tag }, | |
107 | { "lpt", BASE_LPT, 0, -1, &elb_tag }, | 108 | { "lpt", BASE_LPT, 0, -1, &elb_tag }, | |
108 | { "fb", BASE_FB, BASE_FB2, -1, &elb_fb_tag }, | 109 | { "fb", BASE_FB, BASE_FB2, -1, &elb_fb_tag }, | |
109 | { "le", BASE_LE, 0, 28, &elb_fb_tag }, | 110 | { "le", BASE_LE, 0, 28, &elb_fb_tag }, | |
110 | }; | 111 | }; | |
111 | 112 | |||
112 | CFATTACH_DECL_NEW(elb, 0, | 113 | CFATTACH_DECL_NEW(elb, 0, | |
113 | elb_match, elb_attach, NULL, NULL); | 114 | elb_match, elb_attach, NULL, NULL); | |
114 | 115 | |||
115 | /* | 116 | /* | |
116 | * Probe for the elb; always succeeds. | 117 | * Probe for the elb; always succeeds. | |
117 | */ | 118 | */ | |
118 | static int | 119 | static int | |
119 | elb_match(device_t parent, cfdata_t cf, void *aux) | 120 | elb_match(device_t parent, cfdata_t cf, void *aux) | |
120 | { | 121 | { | |
121 | return (1); | 122 | return (1); | |
122 | } | 123 | } | |
123 | 124 | |||
124 | /* | 125 | /* | |
125 | * Attach the Explora local bus. | 126 | * Attach the Explora local bus. | |
126 | */ | 127 | */ | |
127 | static void | 128 | static void | |
128 | elb_attach(device_t parent, device_t self, void *aux) | 129 | elb_attach(device_t parent, device_t self, void *aux) | |
129 | { | 130 | { | |
130 | struct elb_attach_args eaa; | 131 | struct elb_attach_args eaa; | |
131 | int i; | 132 | const struct elb_dev *elb; | |
133 | size_t i; | |||
132 | 134 | |||
133 | printf("\n"); | 135 | printf("\n"); | |
134 | for (i = 0; i < sizeof(elb_devs)/sizeof(elb_devs[0]); i++) { | 136 | for (i = 0, elb = elb_devs; i < __arraycount(elb_devs); i++, elb++) { | |
135 | eaa.elb_name = elb_devs[i].elb_name; | 137 | eaa.elb_name = elb->elb_name; | |
136 | eaa.elb_bt = elb_get_bus_space_tag(elb_devs[i].elb_addr); | 138 | eaa.elb_bt = elb_get_bus_space_tag(elb->elb_addr); | |
137 | eaa.elb_dmat = &elb_bus_dma_tag; | 139 | eaa.elb_dmat = &elb_bus_dma_tag; | |
138 | eaa.elb_base = elb_devs[i].elb_addr; | 140 | eaa.elb_base = elb->elb_addr; | |
139 | eaa.elb_base2 = elb_devs[i].elb_addr2; | 141 | eaa.elb_base2 = elb->elb_addr2; | |
140 | eaa.elb_irq = elb_devs[i].elb_irq; | 142 | eaa.elb_irq = elb->elb_irq; | |
141 | 143 | |||
142 | (void) config_found(self, &eaa, elb_print); | 144 | (void) config_found(self, &eaa, elb_print); | |
143 | } | 145 | } | |
144 | } | 146 | } | |
145 | 147 | |||
146 | static int | 148 | static int | |
147 | elb_print(void *aux, const char *pnp) | 149 | elb_print(void *aux, const char *pnp) | |
148 | { | 150 | { | |
149 | struct elb_attach_args *eaa = aux; | 151 | struct elb_attach_args *eaa = aux; | |
150 | 152 | |||
151 | if (pnp) | 153 | if (pnp) | |
152 | aprint_normal("%s at %s", eaa->elb_name, pnp); | 154 | aprint_normal("%s at %s", eaa->elb_name, pnp); | |
153 | if (eaa->elb_irq != -1) | 155 | if (eaa->elb_irq != -1) | |
154 | aprint_normal(" irq %d", eaa->elb_irq); | 156 | aprint_normal(" irq %d", eaa->elb_irq); | |
155 | 157 | |||
156 | return (UNCONF); | 158 | return (UNCONF); | |
157 | } | 159 | } | |
158 | 160 | |||
159 | bus_space_tag_t | 161 | bus_space_tag_t | |
160 | elb_get_bus_space_tag(bus_addr_t addr) | 162 | elb_get_bus_space_tag(bus_addr_t addr) | |
161 | { | 163 | { | |
162 | 164 | |||
163 | if ((addr & 0xff000000) == 0x74000000) { | 165 | if ((addr & 0xff000000) == 0x74000000) { | |
164 | if (!elb_tag_init_done) { | 166 | if (!elb_tag_init_done) { | |
165 | if (bus_space_init(&elb_tag, "elbtag", | 167 | if (bus_space_init(&elb_tag, "elbtag", | |
166 | elb_ex_storage, sizeof(elb_ex_storage))) | 168 | elb_ex_storage, sizeof(elb_ex_storage))) | |
167 | panic("elb_get_bus_space_tag: elb_tag"); | 169 | panic("elb_get_bus_space_tag: elb_tag"); | |
168 | 170 | |||
169 | elb_tag_init_done = 1; | 171 | elb_tag_init_done = true; | |
170 | } | 172 | } | |
171 | return (&elb_tag); | 173 | return (&elb_tag); | |
172 | } else { | 174 | } else { | |
173 | if (!elbfb_tag_init_done) { | 175 | if (!elbfb_tag_init_done) { | |
174 | if (bus_space_init(&elb_fb_tag, "elbfbtag", | 176 | if (bus_space_init(&elb_fb_tag, "elbfbtag", | |
175 | elbfb_ex_storage, sizeof(elbfb_ex_storage))) | 177 | elbfb_ex_storage, sizeof(elbfb_ex_storage))) | |
176 | panic("elb_get_bus_space_tag: elb_fb_tag"); | 178 | panic("elb_get_bus_space_tag: elb_fb_tag"); | |
177 | 179 | |||
178 | elbfb_tag_init_done = 1; | 180 | elbfb_tag_init_done = true; | |
179 | } | 181 | } | |
180 | return (&elb_fb_tag); | 182 | return (&elb_fb_tag); | |
181 | } | 183 | } | |
182 | } | 184 | } |
--- src/sys/arch/evbppc/walnut/pci/Attic/pchb.c 2011/06/06 16:42:18 1.10
+++ src/sys/arch/evbppc/walnut/pci/Attic/pchb.c 2011/06/06 17:13:06 1.11
@@ -1,223 +1,223 @@ | @@ -1,223 +1,223 @@ | |||
1 | /* $NetBSD: pchb.c,v 1.10 2011/06/06 16:42:18 matt Exp $ */ | 1 | /* $NetBSD: pchb.c,v 1.11 2011/06/06 17:13:06 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 | #include <sys/cdefs.h> | 31 | #include <sys/cdefs.h> | |
32 | __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.10 2011/06/06 16:42:18 matt Exp $"); | 32 | __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.11 2011/06/06 17:13:06 matt Exp $"); | |
33 | 33 | |||
34 | #include "pci.h" | 34 | #include "pci.h" | |
35 | #include "opt_pci.h" | 35 | #include "opt_pci.h" | |
36 | 36 | |||
37 | #include <sys/types.h> | 37 | #include <sys/types.h> | |
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/systm.h> | 39 | #include <sys/systm.h> | |
40 | #include <sys/device.h> | 40 | #include <sys/device.h> | |
41 | #include <sys/extent.h> | 41 | #include <sys/extent.h> | |
42 | #include <sys/malloc.h> | 42 | #include <sys/malloc.h> | |
43 | 43 | |||
44 | #define _IBM4XX_BUS_DMA_PRIVATE | 44 | #define _IBM4XX_BUS_DMA_PRIVATE | |
45 | #include <machine/walnut.h> | 45 | #include <machine/walnut.h> | |
46 | 46 | |||
47 | #include <powerpc/ibm4xx/ibm405gp.h> | 47 | #include <powerpc/ibm4xx/ibm405gp.h> | |
48 | #include <powerpc/ibm4xx/dev/plbvar.h> | 48 | #include <powerpc/ibm4xx/dev/plbvar.h> | |
49 | 49 | |||
50 | #include <dev/pci/pcivar.h> | 50 | #include <dev/pci/pcivar.h> | |
51 | #include <dev/pci/pcireg.h> | 51 | #include <dev/pci/pcireg.h> | |
52 | #include <dev/pci/pcidevs.h> | 52 | #include <dev/pci/pcidevs.h> | |
53 | #include <dev/pci/pciconf.h> | 53 | #include <dev/pci/pciconf.h> | |
54 | 54 | |||
55 | static int pchbmatch(device_t, cfdata_t, void *); | 55 | static int pchbmatch(device_t, cfdata_t, void *); | |
56 | static void pchbattach(device_t, device_t, void *); | 56 | static void pchbattach(device_t, device_t, void *); | |
57 | static int pchbprint(void *, const char *); | 57 | static int pchbprint(void *, const char *); | |
58 | 58 | |||
59 | CFATTACH_DECL_NEW(pchb, 0, | 59 | CFATTACH_DECL_NEW(pchb, 0, | |
60 | pchbmatch, pchbattach, NULL, NULL); | 60 | pchbmatch, pchbattach, NULL, NULL); | |
61 | 61 | |||
62 | static int pcifound = 0; | 62 | static bool pcifound; | |
63 | 63 | |||
64 | /* IO window located @ e8000000 and maps to 0-0xffff */ | 64 | /* IO window located @ e8000000 and maps to 0-0xffff */ | |
65 | static struct powerpc_bus_space pchb_io_tag = { | 65 | static struct powerpc_bus_space pchb_io_tag = { | |
66 | _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_IO_TYPE, | 66 | _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_IO_TYPE, | |
67 | MIN_PLB_PCI_IOADDR, /* offset */ | 67 | MIN_PLB_PCI_IOADDR, /* offset */ | |
68 | MIN_PCI_PCI_IOADDR, /* extent base */ | 68 | MIN_PCI_PCI_IOADDR, /* extent base */ | |
69 | MIN_PCI_PCI_IOADDR + 0xffff, /* extent limit */ | 69 | MIN_PCI_PCI_IOADDR + 0xffff, /* extent limit */ | |
70 | }; | 70 | }; | |
71 | 71 | |||
72 | /* PCI memory window is directly mapped */ | 72 | /* PCI memory window is directly mapped */ | |
73 | static struct powerpc_bus_space pchb_mem_tag = { | 73 | static struct powerpc_bus_space pchb_mem_tag = { | |
74 | _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE, | 74 | _BUS_SPACE_LITTLE_ENDIAN | _BUS_SPACE_MEM_TYPE, | |
75 | 0x00000000, /* offset */ | 75 | 0x00000000, /* offset */ | |
76 | MIN_PCI_MEMADDR_NOPREFETCH, /* extent base */ | 76 | MIN_PCI_MEMADDR_NOPREFETCH, /* extent base */ | |
77 | MIN_PCI_MEMADDR_NOPREFETCH + 0x1fffffff, /* extent limit */ | 77 | MIN_PCI_MEMADDR_NOPREFETCH + 0x1fffffff, /* extent limit */ | |
78 | }; | 78 | }; | |
79 | 79 | |||
80 | 80 | |||
81 | static int | 81 | static int | |
82 | pchbmatch(device_t parent, cfdata_t cf, void *aux) | 82 | pchbmatch(device_t parent, cfdata_t cf, void *aux) | |
83 | { | 83 | { | |
84 | struct plb_attach_args *paa = aux; | 84 | struct plb_attach_args *paa = aux; | |
85 | /* XXX chipset tag unused by walnut, so just pass 0 */ | 85 | /* XXX chipset tag unused by walnut, so just pass 0 */ | |
86 | pci_chipset_tag_t pc = 0; | 86 | pci_chipset_tag_t pc = 0; | |
87 | pcitag_t tag; | 87 | pcitag_t tag; | |
88 | int class, id; | 88 | int class, id; | |
89 | 89 | |||
90 | /* match only pchb devices */ | 90 | /* match only pchb devices */ | |
91 | if (strcmp(paa->plb_name, cf->cf_name) != 0) | 91 | if (strcmp(paa->plb_name, cf->cf_name) != 0) | |
92 | return 0; | 92 | return 0; | |
93 | 93 | |||
94 | pci_machdep_init(); | 94 | pci_machdep_init(); | |
95 | tag = pci_make_tag(pc, 0, 0, 0); | 95 | tag = pci_make_tag(pc, 0, 0, 0); | |
96 | 96 | |||
97 | class = pci_conf_read(pc, tag, PCI_CLASS_REG); | 97 | class = pci_conf_read(pc, tag, PCI_CLASS_REG); | |
98 | id = pci_conf_read(pc, tag, PCI_ID_REG); | 98 | id = pci_conf_read(pc, tag, PCI_ID_REG); | |
99 | 99 | |||
100 | /* | 100 | /* | |
101 | * Match all known PCI host chipsets. | 101 | * Match all known PCI host chipsets. | |
102 | */ | 102 | */ | |
103 | if (PCI_CLASS(class) == PCI_CLASS_BRIDGE && | 103 | if (PCI_CLASS(class) == PCI_CLASS_BRIDGE && | |
104 | PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_HOST) { | 104 | PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_HOST) { | |
105 | switch (PCI_VENDOR(id)) { | 105 | switch (PCI_VENDOR(id)) { | |
106 | case PCI_VENDOR_IBM: | 106 | case PCI_VENDOR_IBM: | |
107 | switch (PCI_PRODUCT(id)) { | 107 | switch (PCI_PRODUCT(id)) { | |
108 | case PCI_PRODUCT_IBM_405GP: | 108 | case PCI_PRODUCT_IBM_405GP: | |
109 | return (!pcifound); | 109 | return (!pcifound); | |
110 | } | 110 | } | |
111 | break; | 111 | break; | |
112 | } | 112 | } | |
113 | } | 113 | } | |
114 | return (0); | 114 | return (0); | |
115 | } | 115 | } | |
116 | 116 | |||
117 | static void | 117 | static void | |
118 | pchbattach(device_t parent, device_t self, void *aux) | 118 | pchbattach(device_t parent, device_t self, void *aux) | |
119 | { | 119 | { | |
120 | struct plb_attach_args *paa = aux; | 120 | struct plb_attach_args *paa = aux; | |
121 | struct pcibus_attach_args pba; | 121 | struct pcibus_attach_args pba; | |
122 | char devinfo[256]; | 122 | char devinfo[256]; | |
123 | #ifdef PCI_NETBSD_CONFIGURE | 123 | #ifdef PCI_NETBSD_CONFIGURE | |
124 | struct extent *ioext, *memext; | 124 | struct extent *ioext, *memext; | |
125 | #ifdef PCI_CONFIGURE_VERBOSE | 125 | #ifdef PCI_CONFIGURE_VERBOSE | |
126 | extern int pci_conf_debug; | 126 | extern int pci_conf_debug; | |
127 | 127 | |||
128 | pci_conf_debug = 1; | 128 | pci_conf_debug = 1; | |
129 | #endif | 129 | #endif | |
130 | #endif | 130 | #endif | |
131 | pci_chipset_tag_t pc = 0; | 131 | pci_chipset_tag_t pc = 0; | |
132 | pcitag_t tag; | 132 | pcitag_t tag; | |
133 | int class, id; | 133 | int class, id; | |
134 | 134 | |||
135 | pci_machdep_init(); | 135 | pci_machdep_init(); | |
136 | tag = pci_make_tag(pc, 0, 0, 0); | 136 | tag = pci_make_tag(pc, 0, 0, 0); | |
137 | 137 | |||
138 | class = pci_conf_read(pc, tag, PCI_CLASS_REG); | 138 | class = pci_conf_read(pc, tag, PCI_CLASS_REG); | |
139 | id = pci_conf_read(pc, tag, PCI_ID_REG); | 139 | id = pci_conf_read(pc, tag, PCI_ID_REG); | |
140 | 140 | |||
141 | printf("\n"); | 141 | printf("\n"); | |
142 | pcifound++; | 142 | pcifound = true; | |
143 | /* | 143 | /* | |
144 | * All we do is print out a description. Eventually, we | 144 | * All we do is print out a description. Eventually, we | |
145 | * might want to add code that does something that's | 145 | * might want to add code that does something that's | |
146 | * possibly chipset-specific. | 146 | * possibly chipset-specific. | |
147 | */ | 147 | */ | |
148 | 148 | |||
149 | pci_devinfo(id, class, 0, devinfo, sizeof(devinfo)); | 149 | pci_devinfo(id, class, 0, devinfo, sizeof(devinfo)); | |
150 | printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, | 150 | printf("%s: %s (rev. 0x%02x)\n", self->dv_xname, devinfo, | |
151 | PCI_REVISION(class)); | 151 | PCI_REVISION(class)); | |
152 | 152 | |||
153 | pci_machdep_init(); /* Redundant... */ | 153 | pci_machdep_init(); /* Redundant... */ | |
154 | ibm4xx_setup_pci(); | 154 | ibm4xx_setup_pci(); | |
155 | #ifdef PCI_CONFIGURE_VERBOSE | 155 | #ifdef PCI_CONFIGURE_VERBOSE | |
156 | ibm4xx_show_pci_map(); | 156 | ibm4xx_show_pci_map(); | |
157 | #endif | 157 | #endif | |
158 | 158 | |||
159 | if (bus_space_init(&pchb_io_tag, "pchbio", NULL, 0)) | 159 | if (bus_space_init(&pchb_io_tag, "pchbio", NULL, 0)) | |
160 | panic("pchbattach: can't init IO tag"); | 160 | panic("pchbattach: can't init IO tag"); | |
161 | if (bus_space_init(&pchb_mem_tag, "pchbmem", NULL, 0)) | 161 | if (bus_space_init(&pchb_mem_tag, "pchbmem", NULL, 0)) | |
162 | panic("pchbattach: can't init MEM tag"); | 162 | panic("pchbattach: can't init MEM tag"); | |
163 | 163 | |||
164 | #ifdef PCI_NETBSD_CONFIGURE | 164 | #ifdef PCI_NETBSD_CONFIGURE | |
165 | memext = extent_create("pcimem", MIN_PCI_MEMADDR_NOPREFETCH, | 165 | memext = extent_create("pcimem", MIN_PCI_MEMADDR_NOPREFETCH, | |
166 | MIN_PCI_MEMADDR_NOPREFETCH + 0x1fffffff, M_DEVBUF, NULL, 0, | 166 | MIN_PCI_MEMADDR_NOPREFETCH + 0x1fffffff, M_DEVBUF, NULL, 0, | |
167 | EX_NOWAIT); | 167 | EX_NOWAIT); | |
168 | ioext = extent_create("pciio", MIN_PCI_PCI_IOADDR, | 168 | ioext = extent_create("pciio", MIN_PCI_PCI_IOADDR, | |
169 | MIN_PCI_PCI_IOADDR + 0xffff, M_DEVBUF, NULL, 0, EX_NOWAIT); | 169 | MIN_PCI_PCI_IOADDR + 0xffff, M_DEVBUF, NULL, 0, EX_NOWAIT); | |
170 | pci_configure_bus(0, ioext, memext, NULL, 0, 32); | 170 | pci_configure_bus(0, ioext, memext, NULL, 0, 32); | |
171 | extent_destroy(memext); | 171 | extent_destroy(memext); | |
172 | extent_destroy(ioext); | 172 | extent_destroy(ioext); | |
173 | #endif /* PCI_NETBSD_CONFIGURE */ | 173 | #endif /* PCI_NETBSD_CONFIGURE */ | |
174 | 174 | |||
175 | #ifdef PCI_CONFIGURE_VERBOSE | 175 | #ifdef PCI_CONFIGURE_VERBOSE | |
176 | printf("running config_found PCI\n"); | 176 | printf("running config_found PCI\n"); | |
177 | #endif | 177 | #endif | |
178 | /* IO window located @ e8000000 and maps to 0-0xffff */ | 178 | /* IO window located @ e8000000 and maps to 0-0xffff */ | |
179 | pba.pba_iot = &pchb_io_tag; | 179 | pba.pba_iot = &pchb_io_tag; | |
180 | /* PCI memory window is directly mapped */ | 180 | /* PCI memory window is directly mapped */ | |
181 | pba.pba_memt = &pchb_mem_tag; | 181 | pba.pba_memt = &pchb_mem_tag; | |
182 | pba.pba_dmat = paa->plb_dmat; | 182 | pba.pba_dmat = paa->plb_dmat; | |
183 | pba.pba_dmat64 = NULL; | 183 | pba.pba_dmat64 = NULL; | |
184 | pba.pba_bus = 0; | 184 | pba.pba_bus = 0; | |
185 | pba.pba_bridgetag = NULL; | 185 | pba.pba_bridgetag = NULL; | |
186 | pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY; | 186 | pba.pba_flags = PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY; | |
187 | config_found_ia(self, "pcibus", &pba, pchbprint); | 187 | config_found_ia(self, "pcibus", &pba, pchbprint); | |
188 | } | 188 | } | |
189 | 189 | |||
190 | 190 | |||
191 | static int | 191 | static int | |
192 | pchbprint(void *aux, const char *p) | 192 | pchbprint(void *aux, const char *p) | |
193 | { | 193 | { | |
194 | 194 | |||
195 | if (p == NULL) | 195 | if (p == NULL) | |
196 | return (UNCONF); | 196 | return (UNCONF); | |
197 | return (QUIET); | 197 | return (QUIET); | |
198 | } | 198 | } | |
199 | 199 | |||
200 | #if 0 | 200 | #if 0 | |
201 | static void | 201 | static void | |
202 | scan_pci_bus(void) | 202 | scan_pci_bus(void) | |
203 | { | 203 | { | |
204 | pcitag_t tag; | 204 | pcitag_t tag; | |
205 | int i, x; | 205 | int i, x; | |
206 | 206 | |||
207 | for (i=0;i<32;i++){ | 207 | for (i=0;i<32;i++){ | |
208 | tag = pci_make_tag(0, 0, i, 0); | 208 | tag = pci_make_tag(0, 0, i, 0); | |
209 | x = pci_conf_read(0, tag, 0); | 209 | x = pci_conf_read(0, tag, 0); | |
210 | printf("%d tag=%08x : %08x\n", i, tag, x); | 210 | printf("%d tag=%08x : %08x\n", i, tag, x); | |
211 | #if 0 | 211 | #if 0 | |
212 | if (PCI_VENDOR(x) == PCI_VENDOR_INTEL | 212 | if (PCI_VENDOR(x) == PCI_VENDOR_INTEL | |
213 | && PCI_PRODUCT(x) == PCI_PRODUCT_INTEL_80960_RP) { | 213 | && PCI_PRODUCT(x) == PCI_PRODUCT_INTEL_80960_RP) { | |
214 | /* Do not configure PCI bus analyzer */ | 214 | /* Do not configure PCI bus analyzer */ | |
215 | continue; | 215 | continue; | |
216 | } | 216 | } | |
217 | x = pci_conf_read(0, tag, PCI_COMMAND_STATUS_REG); | 217 | x = pci_conf_read(0, tag, PCI_COMMAND_STATUS_REG); | |
218 | x |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE; | 218 | x |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE; | |
219 | pci_conf_write(0, tag, PCI_COMMAND_STATUS_REG, x); | 219 | pci_conf_write(0, tag, PCI_COMMAND_STATUS_REG, x); | |
220 | #endif | 220 | #endif | |
221 | } | 221 | } | |
222 | } | 222 | } | |
223 | #endif | 223 | #endif |
--- src/sys/arch/hpcmips/tx/txioman.c 2008/04/28 20:23:22 1.9
+++ src/sys/arch/hpcmips/tx/txioman.c 2011/06/06 17:13:06 1.10
@@ -1,103 +1,103 @@ | @@ -1,103 +1,103 @@ | |||
1 | /* $NetBSD: txioman.c,v 1.9 2008/04/28 20:23:22 martin Exp $ */ | 1 | /* $NetBSD: txioman.c,v 1.10 2011/06/06 17:13:06 matt Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999, 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 UCHIYAMA Yasushi. | 8 | * by UCHIYAMA Yasushi. | |
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: txioman.c,v 1.9 2008/04/28 20:23:22 martin Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: txioman.c,v 1.10 2011/06/06 17:13:06 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/bus.h> | 39 | #include <machine/bus.h> | |
40 | #include <hpcmips/tx/tx39var.h> | 40 | #include <hpcmips/tx/tx39var.h> | |
41 | 41 | |||
42 | #include <dev/hpc/hpciovar.h> | 42 | #include <dev/hpc/hpciovar.h> | |
43 | 43 | |||
44 | int txioman_match(struct device *, struct cfdata *, void *); | 44 | int txioman_match(device_t, cfdata_t, void *); | |
45 | void txioman_attach(struct device *, struct device *, void *); | 45 | void txioman_attach(device_t, device_t, void *); | |
46 | void txioman_callback(struct device *); | 46 | void txioman_callback(device_t); | |
47 | int txioman_print(void *, const char *); | 47 | int txioman_print(void *, const char *); | |
48 | hpcio_chip_t tx_conf_reference_ioman(void *, int); | 48 | hpcio_chip_t tx_conf_reference_ioman(void *, int); | |
49 | 49 | |||
50 | CFATTACH_DECL(txioman, sizeof(struct device), | 50 | CFATTACH_DECL_NEW(txioman, 0, | |
51 | txioman_match, txioman_attach, NULL, NULL); | 51 | txioman_match, txioman_attach, NULL, NULL); | |
52 | 52 | |||
53 | int | 53 | int | |
54 | txioman_match(struct device *parent, struct cfdata *cf, void *aux) | 54 | txioman_match(device_t parent, cfdata_t cf, void *aux) | |
55 | { | 55 | { | |
56 | return (1); | 56 | return (1); | |
57 | } | 57 | } | |
58 | 58 | |||
59 | void | 59 | void | |
60 | txioman_attach(struct device *parent, struct device *self, void *aux) | 60 | txioman_attach(device_t parent, device_t self, void *aux) | |
61 | { | 61 | { | |
62 | printf("\n"); | 62 | printf("\n"); | |
63 | 63 | |||
64 | config_defer(self, txioman_callback); | 64 | config_defer(self, txioman_callback); | |
65 | } | 65 | } | |
66 | 66 | |||
67 | void | 67 | void | |
68 | txioman_callback(struct device *self) | 68 | txioman_callback(device_t self) | |
69 | { | 69 | { | |
70 | struct hpcio_attach_args haa; | 70 | struct hpcio_attach_args haa; | |
71 | 71 | |||
72 | haa.haa_busname = HPCIO_BUSNAME; | 72 | haa.haa_busname = HPCIO_BUSNAME; | |
73 | haa.haa_sc = tx_conf_get_tag(); | 73 | haa.haa_sc = tx_conf_get_tag(); | |
74 | haa.haa_getchip = tx_conf_reference_ioman; | 74 | haa.haa_getchip = tx_conf_reference_ioman; | |
75 | haa.haa_iot = 0; /* not needed for TX */ | 75 | haa.haa_iot = 0; /* not needed for TX */ | |
76 | 76 | |||
77 | config_found(self, &haa, txioman_print); | 77 | config_found(self, &haa, txioman_print); | |
78 | } | 78 | } | |
79 | 79 | |||
80 | int | 80 | int | |
81 | txioman_print(void *aux, const char *pnp) | 81 | txioman_print(void *aux, const char *pnp) | |
82 | { | 82 | { | |
83 | 83 | |||
84 | return (QUIET); | 84 | return (QUIET); | |
85 | } | 85 | } | |
86 | 86 | |||
87 | void | 87 | void | |
88 | tx_conf_register_ioman(tx_chipset_tag_t t, struct hpcio_chip *hc) | 88 | tx_conf_register_ioman(tx_chipset_tag_t t, struct hpcio_chip *hc) | |
89 | { | 89 | { | |
90 | KASSERT(t == tx_conf_get_tag()); | 90 | KASSERT(t == tx_conf_get_tag()); | |
91 | KASSERT(hc); | 91 | KASSERT(hc); | |
92 | 92 | |||
93 | t->tc_iochip[hc->hc_chipid] = hc; | 93 | t->tc_iochip[hc->hc_chipid] = hc; | |
94 | } | 94 | } | |
95 | 95 | |||
96 | hpcio_chip_t | 96 | hpcio_chip_t | |
97 | tx_conf_reference_ioman(void *ctx, int iochip) | 97 | tx_conf_reference_ioman(void *ctx, int iochip) | |
98 | { | 98 | { | |
99 | struct tx_chipset_tag *t = tx_conf_get_tag(); | 99 | struct tx_chipset_tag *t = tx_conf_get_tag(); | |
100 | KASSERT(iochip >= 0 && iochip < NTXIO_GROUP); | 100 | KASSERT(iochip >= 0 && iochip < NTXIO_GROUP); | |
101 | 101 | |||
102 | return (t->tc_iochip[iochip]); | 102 | return (t->tc_iochip[iochip]); | |
103 | } | 103 | } |
--- src/sys/arch/mips/alchemy/dev/auaudio.c 2005/12/11 12:18:06 1.7
+++ src/sys/arch/mips/alchemy/dev/auaudio.c 2011/06/06 17:13:06 1.8
@@ -1,71 +1,71 @@ | @@ -1,71 +1,71 @@ | |||
1 | /* $NetBSD: auaudio.c,v 1.7 2005/12/11 12:18:06 christos Exp $ */ | 1 | /* $NetBSD: auaudio.c,v 1.8 2011/06/06 17:13:06 matt Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright 2002 Wasabi Systems, Inc. | 4 | * Copyright 2002 Wasabi Systems, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Written by Simon Burge for Wasabi Systems, Inc. | 7 | * Written by 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: auaudio.c,v 1.7 2005/12/11 12:18:06 christos Exp $"); | 39 | __KERNEL_RCSID(0, "$NetBSD: auaudio.c,v 1.8 2011/06/06 17:13:06 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 | 44 | |||
45 | #include <mips/alchemy/include/aureg.h> | 45 | #include <mips/alchemy/include/aureg.h> | |
46 | #include <mips/alchemy/include/aubusvar.h> | 46 | #include <mips/alchemy/include/aubusvar.h> | |
47 | 47 | |||
48 | static int auaudio_match(struct device *, struct cfdata *, void *); | 48 | static int auaudio_match(device_t, cfdata_t, void *); | |
49 | static void auaudio_attach(struct device *, struct device *, void *); | 49 | static void auaudio_attach(device_t, device_t, void *); | |
50 | 50 | |||
51 | CFATTACH_DECL(auaudio, sizeof (struct device), | 51 | CFATTACH_DECL_NEW(auaudio, sizeof (struct device), | |
52 | auaudio_match, auaudio_attach, NULL, NULL); | 52 | auaudio_match, auaudio_attach, NULL, NULL); | |
53 | 53 | |||
54 | int | 54 | int | |
55 | auaudio_match(struct device *parent, struct cfdata *match, void *aux) | 55 | auaudio_match(device_t parent, cfdata_t match, void *aux) | |
56 | { | 56 | { | |
57 | struct aubus_attach_args *aa = aux; | 57 | struct aubus_attach_args *aa = aux; | |
58 | 58 | |||
59 | return (0); /* XXX unimplemented! */ | 59 | return (0); /* XXX unimplemented! */ | |
60 | if (strcmp(aa->aa_name, match->cf_name) == 0) | 60 | if (strcmp(aa->aa_name, match->cf_name) == 0) | |
61 | return (1); | 61 | return (1); | |
62 | 62 | |||
63 | return (0); | 63 | return (0); | |
64 | } | 64 | } | |
65 | 65 | |||
66 | void | 66 | void | |
67 | auaudio_attach(struct device *parent, struct device *self, void *aux) | 67 | auaudio_attach(device_t parent, device_t self, void *aux) | |
68 | { | 68 | { | |
69 | 69 | |||
70 | printf(": Au1X00 audio\n"); /* \n in clockattach */ | 70 | printf(": Au1X00 audio\n"); /* \n in clockattach */ | |
71 | } | 71 | } |
--- src/sys/arch/mipsco/obio/obio.c 2009/03/16 23:11:13 1.16
+++ src/sys/arch/mipsco/obio/obio.c 2011/06/06 17:13:06 1.17
@@ -1,129 +1,129 @@ | @@ -1,129 +1,129 @@ | |||
1 | /* $NetBSD: obio.c,v 1.16 2009/03/16 23:11:13 dsl Exp $ */ | 1 | /* $NetBSD: obio.c,v 1.17 2011/06/06 17:13:06 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 Wayne Knowles | 8 | * by Wayne Knowles | |
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: obio.c,v 1.16 2009/03/16 23:11:13 dsl Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: obio.c,v 1.17 2011/06/06 17:13:06 matt Exp $"); | |
34 | 34 | |||
35 | #include "locators.h" | 35 | #include "locators.h" | |
36 | 36 | |||
37 | #include <sys/param.h> | 37 | #include <sys/param.h> | |
38 | #include <sys/systm.h> | 38 | #include <sys/systm.h> | |
39 | #include <sys/device.h> | 39 | #include <sys/device.h> | |
40 | 40 | |||
41 | #include <machine/autoconf.h> | 41 | #include <machine/autoconf.h> | |
42 | #include <machine/mainboard.h> | 42 | #include <machine/mainboard.h> | |
43 | #include <machine/bus.h> | 43 | #include <machine/bus.h> | |
44 | #include <machine/sysconf.h> | 44 | #include <machine/sysconf.h> | |
45 | 45 | |||
46 | static int obio_match(struct device *, struct cfdata *, void *); | 46 | static int obio_match(device_t, cfdata_t, void *); | |
47 | static void obio_attach(struct device *, struct device *, void *); | 47 | static void obio_attach(device_t, device_t, void *); | |
48 | static int obio_search(struct device *, struct cfdata *, | 48 | static int obio_search(device_t, cfdata_t, const int *, void *); | |
49 | const int *, void *); | |||
50 | static int obio_print(void *, const char *); | 49 | static int obio_print(void *, const char *); | |
51 | static void obio_intr_establish(bus_space_tag_t, int, int, int, | 50 | static void obio_intr_establish(bus_space_tag_t, int, int, int, | |
52 | int (*)(void *), void *); | 51 | int (*)(void *), void *); | |
53 | 52 | |||
54 | CFATTACH_DECL(obio, sizeof(struct device), | 53 | CFATTACH_DECL_NEW(obio, 0, | |
55 | obio_match, obio_attach, NULL, NULL); | 54 | obio_match, obio_attach, NULL, NULL); | |
56 | 55 | |||
57 | extern struct cfdriver obio_cd; | 56 | extern struct cfdriver obio_cd; | |
58 | 57 | |||
59 | struct mipsco_bus_space obio_bustag; | 58 | struct mipsco_bus_space obio_bustag; | |
60 | struct mipsco_bus_dma_tag obio_dmatag; | 59 | struct mipsco_bus_dma_tag obio_dmatag; | |
61 | 60 | |||
62 | static int | 61 | static int | |
63 | obio_match(struct device *parent, struct cfdata *cf, void *aux) | 62 | obio_match(device_t parent, cfdata_t cf, void *aux) | |
64 | { | 63 | { | |
65 | struct confargs *ca = aux; | 64 | struct confargs *ca = aux; | |
66 | 65 | |||
67 | if (strcmp(ca->ca_name, obio_cd.cd_name) != 0) | 66 | if (strcmp(ca->ca_name, obio_cd.cd_name) != 0) | |
68 | return 0; | 67 | return 0; | |
69 | 68 | |||
70 | return 1; | 69 | return 1; | |
71 | } | 70 | } | |
72 | 71 | |||
73 | static void | 72 | static void | |
74 | obio_attach(struct device *parent, struct device *self, void *aux) | 73 | obio_attach(device_t parent, device_t self, void *aux) | |
75 | { | 74 | { | |
76 | struct confargs *ca = aux; | 75 | struct confargs *ca = aux; | |
77 | 76 | |||
78 | /* PIZAZZ (Mips 3000 Magnum) Address Map */ | 77 | /* PIZAZZ (Mips 3000 Magnum) Address Map */ | |
79 | mipsco_bus_space_init(&obio_bustag, "obio", | 78 | mipsco_bus_space_init(&obio_bustag, "obio", | |
80 | 0x18000000, 0xb8000000, | 79 | 0x18000000, 0xb8000000, | |
81 | 0xb8000000, 0x08000000); | 80 | 0xb8000000, 0x08000000); | |
82 | 81 | |||
83 | _bus_dma_tag_init(&obio_dmatag); | 82 | _bus_dma_tag_init(&obio_dmatag); | |
84 | obio_bustag.bs_intr_establish = obio_intr_establish; /* XXX */ | 83 | obio_bustag.bs_intr_establish = obio_intr_establish; /* XXX */ | |
85 | 84 | |||
86 | ca->ca_bustag = &obio_bustag; | 85 | ca->ca_bustag = &obio_bustag; | |
87 | ca->ca_dmatag = &obio_dmatag; | 86 | ca->ca_dmatag = &obio_dmatag; | |
88 | 87 | |||
89 | printf("\n"); | 88 | printf("\n"); | |
90 | config_search_ia(obio_search, self, "obio", ca); | 89 | config_search_ia(obio_search, self, "obio", ca); | |
91 | } | 90 | } | |
92 | 91 | |||
93 | static int | 92 | static int | |
94 | obio_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux) | 93 | obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) | |
95 | { | 94 | { | |
96 | struct confargs *ca = aux; | 95 | struct confargs *ca = aux; | |
97 | 96 | |||
98 | ca->ca_addr = cf->cf_addr; | 97 | ca->ca_addr = cf->cf_addr; | |
99 | ca->ca_name = cf->cf_name; | 98 | ca->ca_name = cf->cf_name; | |
100 | 99 | |||
101 | if (config_match(parent, cf, ca) != 0) | 100 | if (config_match(parent, cf, ca) != 0) | |
102 | config_attach(parent, cf, ca, obio_print); | 101 | config_attach(parent, cf, ca, obio_print); | |
103 | 102 | |||
104 | return 0; | 103 | return 0; | |
105 | } | 104 | } | |
106 | 105 | |||
107 | /* | 106 | /* | |
108 | * Print out the confargs. The (parent) name is non-NULL | 107 | * Print out the confargs. The (parent) name is non-NULL | |
109 | * when there was no match found by config_found(). | 108 | * when there was no match found by config_found(). | |
110 | */ | 109 | */ | |
111 | static int | 110 | static int | |
112 | obio_print(void *args, const char *name) | 111 | obio_print(void *args, const char *name) | |
113 | { | 112 | { | |
114 | struct confargs *ca = args; | 113 | struct confargs *ca = args; | |
115 | 114 | |||
116 | if (name) | 115 | if (name) | |
117 | return(QUIET); | 116 | return(QUIET); | |
118 | 117 | |||
119 | if (ca->ca_addr != -1) | 118 | if (ca->ca_addr != -1) | |
120 | aprint_normal(" addr 0x%x", ca->ca_addr); | 119 | aprint_normal(" addr 0x%x", ca->ca_addr); | |
121 | 120 | |||
122 | return(UNCONF); | 121 | return(UNCONF); | |
123 | } | 122 | } | |
124 | 123 | |||
125 | void | 124 | void | |
126 | obio_intr_establish(bus_space_tag_t bst, int level, int pri, int flags, int (*func)(void *), void *arg) | 125 | obio_intr_establish(bus_space_tag_t bst, int level, int pri, int flags, | |
126 | int (*func)(void *), void *arg) | |||
127 | { | 127 | { | |
128 | (*platform.intr_establish)(level, func, arg); | 128 | (*platform.intr_establish)(level, func, arg); | |
129 | } | 129 | } |