Mon Apr 13 18:32:50 2015 UTC ()
sync with new acpica struct shuffling.


(christos)
diff -r1.18 -r1.19 src/sys/dev/acpi/acpi_pci.c
diff -r1.35 -r1.36 src/sys/dev/acpi/acpi_resource.c

cvs diff -r1.18 -r1.19 src/sys/dev/acpi/acpi_pci.c (switch to unified diff)

--- src/sys/dev/acpi/acpi_pci.c 2010/12/31 10:56:39 1.18
+++ src/sys/dev/acpi/acpi_pci.c 2015/04/13 18:32:50 1.19
@@ -1,440 +1,440 @@ @@ -1,440 +1,440 @@
1/* $NetBSD: acpi_pci.c,v 1.18 2010/12/31 10:56:39 jruoho Exp $ */ 1/* $NetBSD: acpi_pci.c,v 1.19 2015/04/13 18:32:50 christos Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. 4 * Copyright (c) 2009, 2010 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 Christoph Egger and Gregoire Sutre. 8 * by Christoph Egger and Gregoire Sutre.
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. The name of the author may not be used to endorse or promote products 15 * 2. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission. 16 * derived from this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE. 28 * SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.18 2010/12/31 10:56:39 jruoho Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.19 2015/04/13 18:32:50 christos Exp $");
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/kmem.h> 36#include <sys/kmem.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38 38
39#include <dev/pci/pcireg.h> 39#include <dev/pci/pcireg.h>
40#include <dev/pci/pcivar.h> 40#include <dev/pci/pcivar.h>
41#include <dev/pci/pcidevs.h> 41#include <dev/pci/pcidevs.h>
42#include <dev/pci/ppbreg.h> 42#include <dev/pci/ppbreg.h>
43 43
44#include <dev/acpi/acpireg.h> 44#include <dev/acpi/acpireg.h>
45#include <dev/acpi/acpivar.h> 45#include <dev/acpi/acpivar.h>
46#include <dev/acpi/acpi_pci.h> 46#include <dev/acpi/acpi_pci.h>
47 47
48#include "locators.h" 48#include "locators.h"
49 49
50#define _COMPONENT ACPI_BUS_COMPONENT 50#define _COMPONENT ACPI_BUS_COMPONENT
51ACPI_MODULE_NAME ("acpi_pci") 51ACPI_MODULE_NAME ("acpi_pci")
52 52
53#define ACPI_HILODWORD(x) ACPI_HIWORD(ACPI_LODWORD((x))) 53#define ACPI_HILODWORD(x) ACPI_HIWORD(ACPI_LODWORD((x)))
54#define ACPI_LOLODWORD(x) ACPI_LOWORD(ACPI_LODWORD((x))) 54#define ACPI_LOLODWORD(x) ACPI_LOWORD(ACPI_LODWORD((x)))
55 55
56static ACPI_STATUS acpi_pcidev_pciroot_bus(ACPI_HANDLE, uint16_t *); 56static ACPI_STATUS acpi_pcidev_pciroot_bus(ACPI_HANDLE, uint16_t *);
57static ACPI_STATUS acpi_pcidev_pciroot_bus_callback(ACPI_RESOURCE *, 57static ACPI_STATUS acpi_pcidev_pciroot_bus_callback(ACPI_RESOURCE *,
58 void *); 58 void *);
59 59
60/* 60/*
61 * Regarding PCI Segment Groups (ACPI 4.0, p. 277): 61 * Regarding PCI Segment Groups (ACPI 4.0, p. 277):
62 * 62 *
63 * "The optional _SEG object is located under a PCI host bridge and 63 * "The optional _SEG object is located under a PCI host bridge and
64 * evaluates to an integer that describes the PCI Segment Group (see PCI 64 * evaluates to an integer that describes the PCI Segment Group (see PCI
65 * Firmware Specification v3.0)." 65 * Firmware Specification v3.0)."
66 * 66 *
67 * "PCI Segment Group is purely a software concept managed by system 67 * "PCI Segment Group is purely a software concept managed by system
68 * firmware and used by OSPM. It is a logical collection of PCI buses 68 * firmware and used by OSPM. It is a logical collection of PCI buses
69 * (or bus segments). It is a way to logically group the PCI bus segments 69 * (or bus segments). It is a way to logically group the PCI bus segments
70 * and PCI Express Hierarchies. _SEG is a level higher than _BBN." 70 * and PCI Express Hierarchies. _SEG is a level higher than _BBN."
71 * 71 *
72 * "PCI Segment Group supports more than 256 buses in a system by allowing 72 * "PCI Segment Group supports more than 256 buses in a system by allowing
73 * the reuse of the PCI bus numbers. Within each PCI Segment Group, the bus 73 * the reuse of the PCI bus numbers. Within each PCI Segment Group, the bus
74 * numbers for the PCI buses must be unique. PCI buses in different PCI 74 * numbers for the PCI buses must be unique. PCI buses in different PCI
75 * Segment Group are permitted to have the same bus number." 75 * Segment Group are permitted to have the same bus number."
76 */ 76 */
77 77
78/* 78/*
79 * Regarding PCI Base Bus Numbers (ACPI 4.0, p. 277): 79 * Regarding PCI Base Bus Numbers (ACPI 4.0, p. 277):
80 * 80 *
81 * "For multi-root PCI platforms, the _BBN object evaluates to the PCI bus 81 * "For multi-root PCI platforms, the _BBN object evaluates to the PCI bus
82 * number that the BIOS assigns. This is needed to access a PCI_Config 82 * number that the BIOS assigns. This is needed to access a PCI_Config
83 * operation region for the specified bus. The _BBN object is located under 83 * operation region for the specified bus. The _BBN object is located under
84 * a PCI host bridge and must be unique for every host bridge within a 84 * a PCI host bridge and must be unique for every host bridge within a
85 * segment since it is the PCI bus number." 85 * segment since it is the PCI bus number."
86 * 86 *
87 * Moreover, the ACPI FAQ (http://www.acpi.info/acpi_faq.htm) says: 87 * Moreover, the ACPI FAQ (http://www.acpi.info/acpi_faq.htm) says:
88 * 88 *
89 * "For a multiple root bus machine, _BBN is required for each bus. _BBN 89 * "For a multiple root bus machine, _BBN is required for each bus. _BBN
90 * should provide the bus number assigned to this bus by the BIOS at boot 90 * should provide the bus number assigned to this bus by the BIOS at boot
91 * time." 91 * time."
92 */ 92 */
93 93
94/* 94/*
95 * acpi_pcidev_pciroot_bus: 95 * acpi_pcidev_pciroot_bus:
96 * 96 *
97 * Derive the PCI bus number of a PCI root bridge from its resources. 97 * Derive the PCI bus number of a PCI root bridge from its resources.
98 * If successful, return AE_OK and fill *busp. Otherwise, return an 98 * If successful, return AE_OK and fill *busp. Otherwise, return an
99 * exception code and leave *busp unchanged. 99 * exception code and leave *busp unchanged.
100 */ 100 */
101static ACPI_STATUS 101static ACPI_STATUS
102acpi_pcidev_pciroot_bus(ACPI_HANDLE handle, uint16_t *busp) 102acpi_pcidev_pciroot_bus(ACPI_HANDLE handle, uint16_t *busp)
103{ 103{
104 ACPI_STATUS rv; 104 ACPI_STATUS rv;
105 int32_t bus; 105 int32_t bus;
106 106
107 bus = -1; 107 bus = -1;
108 108
109 /* 109 /*
110 * XXX: Use the ACPI resource parsing functions (acpi_resource.c) 110 * XXX: Use the ACPI resource parsing functions (acpi_resource.c)
111 * once bus number ranges have been implemented there. 111 * once bus number ranges have been implemented there.
112 */ 112 */
113 rv = AcpiWalkResources(handle, "_CRS", 113 rv = AcpiWalkResources(handle, "_CRS",
114 acpi_pcidev_pciroot_bus_callback, &bus); 114 acpi_pcidev_pciroot_bus_callback, &bus);
115 115
116 if (ACPI_FAILURE(rv)) 116 if (ACPI_FAILURE(rv))
117 return rv; 117 return rv;
118 118
119 if (bus == -1) 119 if (bus == -1)
120 return AE_NOT_EXIST; 120 return AE_NOT_EXIST;
121 121
122 /* Here it holds that 0 <= bus <= 0xFFFF. */ 122 /* Here it holds that 0 <= bus <= 0xFFFF. */
123 *busp = (uint16_t)bus; 123 *busp = (uint16_t)bus;
124 124
125 return rv; 125 return rv;
126} 126}
127 127
128static ACPI_STATUS 128static ACPI_STATUS
129acpi_pcidev_pciroot_bus_callback(ACPI_RESOURCE *res, void *context) 129acpi_pcidev_pciroot_bus_callback(ACPI_RESOURCE *res, void *context)
130{ 130{
131 ACPI_RESOURCE_ADDRESS64 addr64; 131 ACPI_RESOURCE_ADDRESS64 addr64;
132 int32_t *bus = context; 132 int32_t *bus = context;
133 133
134 /* Always continue the walk by returning AE_OK. */ 134 /* Always continue the walk by returning AE_OK. */
135 if ((res->Type != ACPI_RESOURCE_TYPE_ADDRESS16) && 135 if ((res->Type != ACPI_RESOURCE_TYPE_ADDRESS16) &&
136 (res->Type != ACPI_RESOURCE_TYPE_ADDRESS32) && 136 (res->Type != ACPI_RESOURCE_TYPE_ADDRESS32) &&
137 (res->Type != ACPI_RESOURCE_TYPE_ADDRESS64)) 137 (res->Type != ACPI_RESOURCE_TYPE_ADDRESS64))
138 return AE_OK; 138 return AE_OK;
139 139
140 if (ACPI_FAILURE(AcpiResourceToAddress64(res, &addr64))) 140 if (ACPI_FAILURE(AcpiResourceToAddress64(res, &addr64)))
141 return AE_OK; 141 return AE_OK;
142 142
143 if (addr64.ResourceType != ACPI_BUS_NUMBER_RANGE) 143 if (addr64.ResourceType != ACPI_BUS_NUMBER_RANGE)
144 return AE_OK; 144 return AE_OK;
145 145
146 if (*bus != -1) 146 if (*bus != -1)
147 return AE_ALREADY_EXISTS; 147 return AE_ALREADY_EXISTS;
148 148
149 if (addr64.Minimum > 0xFFFF) 149 if (addr64.Address.Minimum > 0xFFFF)
150 return AE_BAD_DATA; 150 return AE_BAD_DATA;
151 151
152 *bus = (int32_t)addr64.Minimum; 152 *bus = (int32_t)addr64.Address.Minimum;
153 153
154 return AE_OK; 154 return AE_OK;
155} 155}
156 156
157/* 157/*
158 * acpi_pcidev_scan: 158 * acpi_pcidev_scan:
159 * 159 *
160 * Scan the ACPI device tree for PCI devices. A node is detected as a 160 * Scan the ACPI device tree for PCI devices. A node is detected as a
161 * PCI device if it has an ancestor that is a PCI root bridge and such 161 * PCI device if it has an ancestor that is a PCI root bridge and such
162 * that all intermediate nodes are PCI-to-PCI bridges. Depth-first 162 * that all intermediate nodes are PCI-to-PCI bridges. Depth-first
163 * recursive implementation. 163 * recursive implementation.
164 * 164 *
165 * PCI root bridges do not necessarily contain an _ADR, since they already 165 * PCI root bridges do not necessarily contain an _ADR, since they already
166 * contain an _HID (ACPI 4.0a, p. 197). However we require an _ADR for 166 * contain an _HID (ACPI 4.0a, p. 197). However we require an _ADR for
167 * all non-root PCI devices. 167 * all non-root PCI devices.
168 */ 168 */
169ACPI_STATUS 169ACPI_STATUS
170acpi_pcidev_scan(struct acpi_devnode *ad) 170acpi_pcidev_scan(struct acpi_devnode *ad)
171{ 171{
172 struct acpi_devnode *child; 172 struct acpi_devnode *child;
173 struct acpi_pci_info *ap; 173 struct acpi_pci_info *ap;
174 ACPI_INTEGER val; 174 ACPI_INTEGER val;
175 ACPI_STATUS rv; 175 ACPI_STATUS rv;
176 176
177 ad->ad_pciinfo = NULL; 177 ad->ad_pciinfo = NULL;
178 178
179 /* 179 /*
180 * We attach PCI information only to devices that are present, 180 * We attach PCI information only to devices that are present,
181 * enabled, and functioning properly. 181 * enabled, and functioning properly.
182 * Note: there is a possible race condition, because _STA may 182 * Note: there is a possible race condition, because _STA may
183 * have changed since ad->ad_devinfo->CurrentStatus was set. 183 * have changed since ad->ad_devinfo->CurrentStatus was set.
184 */ 184 */
185 if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE) 185 if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE)
186 goto rec; 186 goto rec;
187 if ((ad->ad_devinfo->Valid & ACPI_VALID_STA) != 0 && 187 if ((ad->ad_devinfo->Valid & ACPI_VALID_STA) != 0 &&
188 (ad->ad_devinfo->CurrentStatus & ACPI_STA_OK) != ACPI_STA_OK) 188 (ad->ad_devinfo->CurrentStatus & ACPI_STA_OK) != ACPI_STA_OK)
189 goto rec; 189 goto rec;
190 190
191 if (ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) { 191 if (ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) {
192 192
193 ap = kmem_zalloc(sizeof(*ap), KM_SLEEP); 193 ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
194 194
195 if (ap == NULL) 195 if (ap == NULL)
196 return AE_NO_MEMORY; 196 return AE_NO_MEMORY;
197 197
198 /* 198 /*
199 * If no _SEG exist, all PCI bus segments are assumed 199 * If no _SEG exist, all PCI bus segments are assumed
200 * to be in the PCI segment group 0 (ACPI 4.0, p. 277). 200 * to be in the PCI segment group 0 (ACPI 4.0, p. 277).
201 * The segment group number is conveyed in the lower 201 * The segment group number is conveyed in the lower
202 * 16 bits of _SEG (the other bits are all reserved). 202 * 16 bits of _SEG (the other bits are all reserved).
203 */ 203 */
204 rv = acpi_eval_integer(ad->ad_handle, "_SEG", &val); 204 rv = acpi_eval_integer(ad->ad_handle, "_SEG", &val);
205 205
206 if (ACPI_SUCCESS(rv)) 206 if (ACPI_SUCCESS(rv))
207 ap->ap_segment = ACPI_LOWORD(val); 207 ap->ap_segment = ACPI_LOWORD(val);
208 208
209 /* Try to get downstream bus number using _CRS first. */ 209 /* Try to get downstream bus number using _CRS first. */
210 rv = acpi_pcidev_pciroot_bus(ad->ad_handle, &ap->ap_downbus); 210 rv = acpi_pcidev_pciroot_bus(ad->ad_handle, &ap->ap_downbus);
211 211
212 if (ACPI_FAILURE(rv)) { 212 if (ACPI_FAILURE(rv)) {
213 rv = acpi_eval_integer(ad->ad_handle, "_BBN", &val); 213 rv = acpi_eval_integer(ad->ad_handle, "_BBN", &val);
214 214
215 if (ACPI_SUCCESS(rv)) 215 if (ACPI_SUCCESS(rv))
216 ap->ap_downbus = ACPI_LOWORD(val); 216 ap->ap_downbus = ACPI_LOWORD(val);
217 } 217 }
218 218
219 if (ap->ap_downbus > 255) { 219 if (ap->ap_downbus > 255) {
220 aprint_error_dev(ad->ad_root, 220 aprint_error_dev(ad->ad_root,
221 "invalid PCI downstream bus for %s\n", ad->ad_name); 221 "invalid PCI downstream bus for %s\n", ad->ad_name);
222 kmem_free(ap, sizeof(*ap)); 222 kmem_free(ap, sizeof(*ap));
223 goto rec; 223 goto rec;
224 } 224 }
225 225
226 ap->ap_flags |= ACPI_PCI_INFO_BRIDGE; 226 ap->ap_flags |= ACPI_PCI_INFO_BRIDGE;
227 227
228 /* 228 /*
229 * This ACPI node denotes a PCI root bridge, but it may also 229 * This ACPI node denotes a PCI root bridge, but it may also
230 * denote a PCI device on the bridge's downstream bus segment. 230 * denote a PCI device on the bridge's downstream bus segment.
231 */ 231 */
232 if (ad->ad_devinfo->Valid & ACPI_VALID_ADR) { 232 if (ad->ad_devinfo->Valid & ACPI_VALID_ADR) {
233 ap->ap_bus = ap->ap_downbus; 233 ap->ap_bus = ap->ap_downbus;
234 ap->ap_device = 234 ap->ap_device =
235 ACPI_HILODWORD(ad->ad_devinfo->Address); 235 ACPI_HILODWORD(ad->ad_devinfo->Address);
236 ap->ap_function = 236 ap->ap_function =
237 ACPI_LOLODWORD(ad->ad_devinfo->Address); 237 ACPI_LOLODWORD(ad->ad_devinfo->Address);
238 238
239 if (ap->ap_device > 31 || 239 if (ap->ap_device > 31 ||
240 (ap->ap_function > 7 && ap->ap_function != 0xFFFF)) 240 (ap->ap_function > 7 && ap->ap_function != 0xFFFF))
241 aprint_error_dev(ad->ad_root, 241 aprint_error_dev(ad->ad_root,
242 "invalid PCI address for %s\n", ad->ad_name); 242 "invalid PCI address for %s\n", ad->ad_name);
243 else 243 else
244 ap->ap_flags |= ACPI_PCI_INFO_DEVICE; 244 ap->ap_flags |= ACPI_PCI_INFO_DEVICE;
245 } 245 }
246 246
247 ad->ad_pciinfo = ap; 247 ad->ad_pciinfo = ap;
248 248
249 goto rec; 249 goto rec;
250 } 250 }
251 251
252 if ((ad->ad_parent != NULL) && 252 if ((ad->ad_parent != NULL) &&
253 (ad->ad_parent->ad_pciinfo != NULL) && 253 (ad->ad_parent->ad_pciinfo != NULL) &&
254 (ad->ad_parent->ad_pciinfo->ap_flags & ACPI_PCI_INFO_BRIDGE) && 254 (ad->ad_parent->ad_pciinfo->ap_flags & ACPI_PCI_INFO_BRIDGE) &&
255 (ad->ad_devinfo->Valid & ACPI_VALID_ADR)) { 255 (ad->ad_devinfo->Valid & ACPI_VALID_ADR)) {
256 256
257 /* 257 /*
258 * Our parent is a PCI root bridge or a PCI-to-PCI 258 * Our parent is a PCI root bridge or a PCI-to-PCI
259 * bridge. We have the same PCI segment number, and 259 * bridge. We have the same PCI segment number, and
260 * our bus number is its downstream bus number. 260 * our bus number is its downstream bus number.
261 */ 261 */
262 ap = kmem_zalloc(sizeof(*ap), KM_SLEEP); 262 ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);
263 263
264 if (ap == NULL) 264 if (ap == NULL)
265 return AE_NO_MEMORY; 265 return AE_NO_MEMORY;
266 266
267 ap->ap_segment = ad->ad_parent->ad_pciinfo->ap_segment; 267 ap->ap_segment = ad->ad_parent->ad_pciinfo->ap_segment;
268 ap->ap_bus = ad->ad_parent->ad_pciinfo->ap_downbus; 268 ap->ap_bus = ad->ad_parent->ad_pciinfo->ap_downbus;
269 269
270 ap->ap_device = ACPI_HILODWORD(ad->ad_devinfo->Address); 270 ap->ap_device = ACPI_HILODWORD(ad->ad_devinfo->Address);
271 ap->ap_function = ACPI_LOLODWORD(ad->ad_devinfo->Address); 271 ap->ap_function = ACPI_LOLODWORD(ad->ad_devinfo->Address);
272 272
273 if (ap->ap_device > 31 || 273 if (ap->ap_device > 31 ||
274 (ap->ap_function > 7 && ap->ap_function != 0xFFFF)) { 274 (ap->ap_function > 7 && ap->ap_function != 0xFFFF)) {
275 aprint_error_dev(ad->ad_root, 275 aprint_error_dev(ad->ad_root,
276 "invalid PCI address for %s\n", ad->ad_name); 276 "invalid PCI address for %s\n", ad->ad_name);
277 kmem_free(ap, sizeof(*ap)); 277 kmem_free(ap, sizeof(*ap));
278 goto rec; 278 goto rec;
279 } 279 }
280 280
281 ap->ap_flags |= ACPI_PCI_INFO_DEVICE; 281 ap->ap_flags |= ACPI_PCI_INFO_DEVICE;
282 282
283 if (ap->ap_function == 0xFFFF) { 283 if (ap->ap_function == 0xFFFF) {
284 /* 284 /*
285 * Assume that this device is not a PCI-to-PCI bridge. 285 * Assume that this device is not a PCI-to-PCI bridge.
286 * XXX: Do we need to be smarter? 286 * XXX: Do we need to be smarter?
287 */ 287 */
288 } else { 288 } else {
289 /* 289 /*
290 * Check whether this device is a PCI-to-PCI 290 * Check whether this device is a PCI-to-PCI
291 * bridge and get its secondary bus number. 291 * bridge and get its secondary bus number.
292 */ 292 */
293 rv = acpi_pcidev_ppb_downbus(ap->ap_segment, ap->ap_bus, 293 rv = acpi_pcidev_ppb_downbus(ap->ap_segment, ap->ap_bus,
294 ap->ap_device, ap->ap_function, &ap->ap_downbus); 294 ap->ap_device, ap->ap_function, &ap->ap_downbus);
295 295
296 if (ACPI_SUCCESS(rv)) 296 if (ACPI_SUCCESS(rv))
297 ap->ap_flags |= ACPI_PCI_INFO_BRIDGE; 297 ap->ap_flags |= ACPI_PCI_INFO_BRIDGE;
298 } 298 }
299 299
300 ad->ad_pciinfo = ap; 300 ad->ad_pciinfo = ap;
301 301
302 goto rec; 302 goto rec;
303 } 303 }
304 304
305rec: 305rec:
306 SIMPLEQ_FOREACH(child, &ad->ad_child_head, ad_child_list) { 306 SIMPLEQ_FOREACH(child, &ad->ad_child_head, ad_child_list) {
307 rv = acpi_pcidev_scan(child); 307 rv = acpi_pcidev_scan(child);
308 308
309 if (ACPI_FAILURE(rv)) 309 if (ACPI_FAILURE(rv))
310 return rv; 310 return rv;
311 } 311 }
312 312
313 return AE_OK; 313 return AE_OK;
314} 314}
315 315
316/* 316/*
317 * acpi_pcidev_ppb_downbus: 317 * acpi_pcidev_ppb_downbus:
318 * 318 *
319 * Retrieve the secondary bus number of the PCI-to-PCI bridge having the 319 * Retrieve the secondary bus number of the PCI-to-PCI bridge having the
320 * given PCI id. If successful, return AE_OK and fill *downbus. 320 * given PCI id. If successful, return AE_OK and fill *downbus.
321 * Otherwise, return an exception code and leave *downbus unchanged. 321 * Otherwise, return an exception code and leave *downbus unchanged.
322 * 322 *
323 * XXX Need to deal with PCI segment groups (see also acpica/OsdHardware.c). 323 * XXX Need to deal with PCI segment groups (see also acpica/OsdHardware.c).
324 */ 324 */
325ACPI_STATUS 325ACPI_STATUS
326acpi_pcidev_ppb_downbus(uint16_t segment, uint16_t bus, uint16_t device, 326acpi_pcidev_ppb_downbus(uint16_t segment, uint16_t bus, uint16_t device,
327 uint16_t function, uint16_t *downbus) 327 uint16_t function, uint16_t *downbus)
328{ 328{
329 struct acpi_softc *sc = acpi_softc; 329 struct acpi_softc *sc = acpi_softc;
330 pci_chipset_tag_t pc; 330 pci_chipset_tag_t pc;
331 pcitag_t tag; 331 pcitag_t tag;
332 pcireg_t val; 332 pcireg_t val;
333 333
334 if (bus > 255 || device > 31 || function > 7) 334 if (bus > 255 || device > 31 || function > 7)
335 return AE_BAD_PARAMETER; 335 return AE_BAD_PARAMETER;
336 336
337 pc = sc->sc_pc; 337 pc = sc->sc_pc;
338 338
339 tag = pci_make_tag(pc, bus, device, function); 339 tag = pci_make_tag(pc, bus, device, function);
340 340
341 /* Check that this device exists. */ 341 /* Check that this device exists. */
342 val = pci_conf_read(pc, tag, PCI_ID_REG); 342 val = pci_conf_read(pc, tag, PCI_ID_REG);
343 343
344 if (PCI_VENDOR(val) == PCI_VENDOR_INVALID || 344 if (PCI_VENDOR(val) == PCI_VENDOR_INVALID ||
345 PCI_VENDOR(val) == 0) 345 PCI_VENDOR(val) == 0)
346 return AE_NOT_EXIST; 346 return AE_NOT_EXIST;
347 347
348 /* Check that this device is a PCI-to-PCI bridge. */ 348 /* Check that this device is a PCI-to-PCI bridge. */
349 val = pci_conf_read(pc, tag, PCI_BHLC_REG); 349 val = pci_conf_read(pc, tag, PCI_BHLC_REG);
350 350
351 if (PCI_HDRTYPE_TYPE(val) != PCI_HDRTYPE_PPB) 351 if (PCI_HDRTYPE_TYPE(val) != PCI_HDRTYPE_PPB)
352 return AE_TYPE; 352 return AE_TYPE;
353 353
354 /* This is a PCI-to-PCI bridge. Get its secondary bus#. */ 354 /* This is a PCI-to-PCI bridge. Get its secondary bus#. */
355 val = pci_conf_read(pc, tag, PPB_REG_BUSINFO); 355 val = pci_conf_read(pc, tag, PPB_REG_BUSINFO);
356 *downbus = PPB_BUSINFO_SECONDARY(val); 356 *downbus = PPB_BUSINFO_SECONDARY(val);
357 357
358 return AE_OK; 358 return AE_OK;
359} 359}
360 360
361/* 361/*
362 * acpi_pcidev_find: 362 * acpi_pcidev_find:
363 * 363 *
364 * Finds a PCI device in the ACPI name space. 364 * Finds a PCI device in the ACPI name space.
365 * 365 *
366 * Returns an ACPI device node on success and NULL on failure. 366 * Returns an ACPI device node on success and NULL on failure.
367 */ 367 */
368struct acpi_devnode * 368struct acpi_devnode *
369acpi_pcidev_find(uint16_t segment, uint16_t bus, 369acpi_pcidev_find(uint16_t segment, uint16_t bus,
370 uint16_t device, uint16_t function) 370 uint16_t device, uint16_t function)
371{ 371{
372 struct acpi_softc *sc = acpi_softc; 372 struct acpi_softc *sc = acpi_softc;
373 struct acpi_devnode *ad; 373 struct acpi_devnode *ad;
374 374
375 if (sc == NULL) 375 if (sc == NULL)
376 return NULL; 376 return NULL;
377 377
378 SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) { 378 SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
379 379
380 if (ad->ad_pciinfo != NULL && 380 if (ad->ad_pciinfo != NULL &&
381 (ad->ad_pciinfo->ap_flags & ACPI_PCI_INFO_DEVICE) && 381 (ad->ad_pciinfo->ap_flags & ACPI_PCI_INFO_DEVICE) &&
382 ad->ad_pciinfo->ap_segment == segment && 382 ad->ad_pciinfo->ap_segment == segment &&
383 ad->ad_pciinfo->ap_bus == bus && 383 ad->ad_pciinfo->ap_bus == bus &&
384 ad->ad_pciinfo->ap_device == device && 384 ad->ad_pciinfo->ap_device == device &&
385 ad->ad_pciinfo->ap_function == function) 385 ad->ad_pciinfo->ap_function == function)
386 return ad; 386 return ad;
387 } 387 }
388 388
389 return NULL; 389 return NULL;
390} 390}
391 391
392 392
393/* 393/*
394 * acpi_pcidev_find_dev: 394 * acpi_pcidev_find_dev:
395 * 395 *
396 * Returns the device corresponding to the given PCI info, or NULL 396 * Returns the device corresponding to the given PCI info, or NULL
397 * if it doesn't exist. 397 * if it doesn't exist.
398 */ 398 */
399device_t 399device_t
400acpi_pcidev_find_dev(struct acpi_devnode *ad) 400acpi_pcidev_find_dev(struct acpi_devnode *ad)
401{ 401{
402 struct acpi_pci_info *ap; 402 struct acpi_pci_info *ap;
403 struct pci_softc *pci; 403 struct pci_softc *pci;
404 device_t dv, pr; 404 device_t dv, pr;
405 deviter_t di; 405 deviter_t di;
406 406
407 if (ad == NULL) 407 if (ad == NULL)
408 return NULL; 408 return NULL;
409 409
410 if (ad->ad_pciinfo == NULL) 410 if (ad->ad_pciinfo == NULL)
411 return NULL; 411 return NULL;
412 412
413 ap = ad->ad_pciinfo; 413 ap = ad->ad_pciinfo;
414 414
415 if (ap->ap_function == 0xFFFF) 415 if (ap->ap_function == 0xFFFF)
416 return NULL; 416 return NULL;
417 417
418 for (dv = deviter_first(&di, DEVITER_F_ROOT_FIRST); 418 for (dv = deviter_first(&di, DEVITER_F_ROOT_FIRST);
419 dv != NULL; dv = deviter_next(&di)) { 419 dv != NULL; dv = deviter_next(&di)) {
420 420
421 pr = device_parent(dv); 421 pr = device_parent(dv);
422 422
423 if (pr == NULL || device_is_a(pr, "pci") != true) 423 if (pr == NULL || device_is_a(pr, "pci") != true)
424 continue; 424 continue;
425 425
426 if (dv->dv_locators == NULL) /* This should not happen. */ 426 if (dv->dv_locators == NULL) /* This should not happen. */
427 continue; 427 continue;
428 428
429 pci = device_private(pr); 429 pci = device_private(pr);
430 430
431 if (pci->sc_bus == ap->ap_bus && 431 if (pci->sc_bus == ap->ap_bus &&
432 device_locator(dv, PCICF_DEV) == ap->ap_device && 432 device_locator(dv, PCICF_DEV) == ap->ap_device &&
433 device_locator(dv, PCICF_FUNCTION) == ap->ap_function) 433 device_locator(dv, PCICF_FUNCTION) == ap->ap_function)
434 break; 434 break;
435 } 435 }
436 436
437 deviter_release(&di); 437 deviter_release(&di);
438 438
439 return dv; 439 return dv;
440} 440}

cvs diff -r1.35 -r1.36 src/sys/dev/acpi/acpi_resource.c (switch to unified diff)

--- src/sys/dev/acpi/acpi_resource.c 2011/06/30 20:09:39 1.35
+++ src/sys/dev/acpi/acpi_resource.c 2015/04/13 18:32:50 1.36
@@ -1,842 +1,842 @@ @@ -1,842 +1,842 @@
1/* $NetBSD: acpi_resource.c,v 1.35 2011/06/30 20:09:39 wiz Exp $ */ 1/* $NetBSD: acpi_resource.c,v 1.36 2015/04/13 18:32:50 christos 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 Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe 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/*- 38/*-
39 * Copyright (c) 2000 Michael Smith 39 * Copyright (c) 2000 Michael Smith
40 * Copyright (c) 2000 BSDi 40 * Copyright (c) 2000 BSDi
41 * All rights reserved. 41 * All rights reserved.
42 * 42 *
43 * Redistribution and use in source and binary forms, with or without 43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions 44 * modification, are permitted provided that the following conditions
45 * are met: 45 * are met:
46 * 1. Redistributions of source code must retain the above copyright 46 * 1. Redistributions of source code must retain the above copyright
47 * notice, this list of conditions and the following disclaimer. 47 * notice, this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright 48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the 49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution. 50 * documentation and/or other materials provided with the distribution.
51 * 51 *
52 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 52 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 55 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE. 62 * SUCH DAMAGE.
63 */ 63 */
64 64
65/* 65/*
66 * ACPI resource parsing. 66 * ACPI resource parsing.
67 */ 67 */
68 68
69#include <sys/cdefs.h> 69#include <sys/cdefs.h>
70__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.35 2011/06/30 20:09:39 wiz Exp $"); 70__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.36 2015/04/13 18:32:50 christos Exp $");
71 71
72#include <sys/param.h> 72#include <sys/param.h>
73#include <sys/device.h> 73#include <sys/device.h>
74#include <sys/systm.h> 74#include <sys/systm.h>
75 75
76#include <dev/acpi/acpireg.h> 76#include <dev/acpi/acpireg.h>
77#include <dev/acpi/acpivar.h> 77#include <dev/acpi/acpivar.h>
78 78
79#define _COMPONENT ACPI_RESOURCE_COMPONENT 79#define _COMPONENT ACPI_RESOURCE_COMPONENT
80ACPI_MODULE_NAME("RESOURCE") 80ACPI_MODULE_NAME("RESOURCE")
81 81
82static ACPI_STATUS acpi_resource_parse_callback(ACPI_RESOURCE *, void *); 82static ACPI_STATUS acpi_resource_parse_callback(ACPI_RESOURCE *, void *);
83 83
84struct resource_parse_callback_arg { 84struct resource_parse_callback_arg {
85 const struct acpi_resource_parse_ops *ops; 85 const struct acpi_resource_parse_ops *ops;
86 device_t dev; 86 device_t dev;
87 void *context; 87 void *context;
88}; 88};
89 89
90static ACPI_STATUS 90static ACPI_STATUS
91acpi_resource_parse_callback(ACPI_RESOURCE *res, void *context) 91acpi_resource_parse_callback(ACPI_RESOURCE *res, void *context)
92{ 92{
93 struct resource_parse_callback_arg *arg = context; 93 struct resource_parse_callback_arg *arg = context;
94 const struct acpi_resource_parse_ops *ops; 94 const struct acpi_resource_parse_ops *ops;
95 int i; 95 int i;
96 96
97 ACPI_FUNCTION_TRACE(__func__); 97 ACPI_FUNCTION_TRACE(__func__);
98 98
99 ops = arg->ops; 99 ops = arg->ops;
100 100
101 switch (res->Type) { 101 switch (res->Type) {
102 case ACPI_RESOURCE_TYPE_FIXED_IO: 102 case ACPI_RESOURCE_TYPE_FIXED_IO:
103 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 103 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
104 "FixedIo 0x%x/%u\n", 104 "FixedIo 0x%x/%u\n",
105 res->Data.FixedIo.Address, 105 res->Data.FixedIo.Address,
106 res->Data.FixedIo.AddressLength)); 106 res->Data.FixedIo.AddressLength));
107 if (ops->ioport) 107 if (ops->ioport)
108 (*ops->ioport)(arg->dev, arg->context, 108 (*ops->ioport)(arg->dev, arg->context,
109 res->Data.FixedIo.Address, 109 res->Data.FixedIo.Address,
110 res->Data.FixedIo.AddressLength); 110 res->Data.FixedIo.AddressLength);
111 break; 111 break;
112 112
113 case ACPI_RESOURCE_TYPE_IO: 113 case ACPI_RESOURCE_TYPE_IO:
114 if (res->Data.Io.Minimum == 114 if (res->Data.Io.Minimum ==
115 res->Data.Io.Maximum) { 115 res->Data.Io.Maximum) {
116 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 116 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
117 "Io 0x%x/%u\n", 117 "Io 0x%x/%u\n",
118 res->Data.Io.Minimum, 118 res->Data.Io.Minimum,
119 res->Data.Io.AddressLength)); 119 res->Data.Io.AddressLength));
120 if (ops->ioport) 120 if (ops->ioport)
121 (*ops->ioport)(arg->dev, arg->context, 121 (*ops->ioport)(arg->dev, arg->context,
122 res->Data.Io.Minimum, 122 res->Data.Io.Minimum,
123 res->Data.Io.AddressLength); 123 res->Data.Io.AddressLength);
124 } else { 124 } else {
125 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 125 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
126 "Io 0x%x-0x%x/%u\n", 126 "Io 0x%x-0x%x/%u\n",
127 res->Data.Io.Minimum, 127 res->Data.Io.Minimum,
128 res->Data.Io.Maximum, 128 res->Data.Io.Maximum,
129 res->Data.Io.AddressLength)); 129 res->Data.Io.AddressLength));
130 if (ops->iorange) 130 if (ops->iorange)
131 (*ops->iorange)(arg->dev, arg->context, 131 (*ops->iorange)(arg->dev, arg->context,
132 res->Data.Io.Minimum, 132 res->Data.Io.Minimum,
133 res->Data.Io.Maximum, 133 res->Data.Io.Maximum,
134 res->Data.Io.AddressLength, 134 res->Data.Io.AddressLength,
135 res->Data.Io.Alignment); 135 res->Data.Io.Alignment);
136 } 136 }
137 break; 137 break;
138 138
139 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 139 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
140 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 140 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
141 "FixedMemory32 0x%x/%u\n", 141 "FixedMemory32 0x%x/%u\n",
142 res->Data.FixedMemory32.Address, 142 res->Data.FixedMemory32.Address,
143 res->Data.FixedMemory32.AddressLength)); 143 res->Data.FixedMemory32.AddressLength));
144 if (ops->memory) 144 if (ops->memory)
145 (*ops->memory)(arg->dev, arg->context, 145 (*ops->memory)(arg->dev, arg->context,
146 res->Data.FixedMemory32.Address, 146 res->Data.FixedMemory32.Address,
147 res->Data.FixedMemory32.AddressLength); 147 res->Data.FixedMemory32.AddressLength);
148 break; 148 break;
149 149
150 case ACPI_RESOURCE_TYPE_MEMORY32: 150 case ACPI_RESOURCE_TYPE_MEMORY32:
151 if (res->Data.Memory32.Minimum == 151 if (res->Data.Memory32.Minimum ==
152 res->Data.Memory32.Maximum) { 152 res->Data.Memory32.Maximum) {
153 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 153 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
154 "Memory32 0x%x/%u\n", 154 "Memory32 0x%x/%u\n",
155 res->Data.Memory32.Minimum, 155 res->Data.Memory32.Minimum,
156 res->Data.Memory32.AddressLength)); 156 res->Data.Memory32.AddressLength));
157 if (ops->memory) 157 if (ops->memory)
158 (*ops->memory)(arg->dev, arg->context, 158 (*ops->memory)(arg->dev, arg->context,
159 res->Data.Memory32.Minimum, 159 res->Data.Memory32.Minimum,
160 res->Data.Memory32.AddressLength); 160 res->Data.Memory32.AddressLength);
161 } else { 161 } else {
162 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 162 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
163 "Memory32 0x%x-0x%x/%u\n", 163 "Memory32 0x%x-0x%x/%u\n",
164 res->Data.Memory32.Minimum, 164 res->Data.Memory32.Minimum,
165 res->Data.Memory32.Maximum, 165 res->Data.Memory32.Maximum,
166 res->Data.Memory32.AddressLength)); 166 res->Data.Memory32.AddressLength));
167 if (ops->memrange) 167 if (ops->memrange)
168 (*ops->memrange)(arg->dev, arg->context, 168 (*ops->memrange)(arg->dev, arg->context,
169 res->Data.Memory32.Minimum, 169 res->Data.Memory32.Minimum,
170 res->Data.Memory32.Maximum, 170 res->Data.Memory32.Maximum,
171 res->Data.Memory32.AddressLength, 171 res->Data.Memory32.AddressLength,
172 res->Data.Memory32.Alignment); 172 res->Data.Memory32.Alignment);
173 } 173 }
174 break; 174 break;
175 175
176 case ACPI_RESOURCE_TYPE_MEMORY24: 176 case ACPI_RESOURCE_TYPE_MEMORY24:
177 if (res->Data.Memory24.Minimum == 177 if (res->Data.Memory24.Minimum ==
178 res->Data.Memory24.Maximum) { 178 res->Data.Memory24.Maximum) {
179 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 179 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
180 "Memory24 0x%x/%u\n", 180 "Memory24 0x%x/%u\n",
181 res->Data.Memory24.Minimum, 181 res->Data.Memory24.Minimum,
182 res->Data.Memory24.AddressLength)); 182 res->Data.Memory24.AddressLength));
183 if (ops->memory) 183 if (ops->memory)
184 (*ops->memory)(arg->dev, arg->context, 184 (*ops->memory)(arg->dev, arg->context,
185 res->Data.Memory24.Minimum, 185 res->Data.Memory24.Minimum,
186 res->Data.Memory24.AddressLength); 186 res->Data.Memory24.AddressLength);
187 } else { 187 } else {
188 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 188 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
189 "Memory24 0x%x-0x%x/%u\n", 189 "Memory24 0x%x-0x%x/%u\n",
190 res->Data.Memory24.Minimum, 190 res->Data.Memory24.Minimum,
191 res->Data.Memory24.Maximum, 191 res->Data.Memory24.Maximum,
192 res->Data.Memory24.AddressLength)); 192 res->Data.Memory24.AddressLength));
193 if (ops->memrange) 193 if (ops->memrange)
194 (*ops->memrange)(arg->dev, arg->context, 194 (*ops->memrange)(arg->dev, arg->context,
195 res->Data.Memory24.Minimum, 195 res->Data.Memory24.Minimum,
196 res->Data.Memory24.Maximum, 196 res->Data.Memory24.Maximum,
197 res->Data.Memory24.AddressLength, 197 res->Data.Memory24.AddressLength,
198 res->Data.Memory24.Alignment); 198 res->Data.Memory24.Alignment);
199 } 199 }
200 break; 200 break;
201 201
202 case ACPI_RESOURCE_TYPE_IRQ: 202 case ACPI_RESOURCE_TYPE_IRQ:
203 for (i = 0; i < res->Data.Irq.InterruptCount; i++) { 203 for (i = 0; i < res->Data.Irq.InterruptCount; i++) {
204 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 204 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
205 "IRQ %u\n", 205 "IRQ %u\n",
206 res->Data.Irq.Interrupts[i])); 206 res->Data.Irq.Interrupts[i]));
207 if (ops->irq) 207 if (ops->irq)
208 (*ops->irq)(arg->dev, arg->context, 208 (*ops->irq)(arg->dev, arg->context,
209 res->Data.Irq.Interrupts[i], 209 res->Data.Irq.Interrupts[i],
210 res->Data.Irq.Triggering); 210 res->Data.Irq.Triggering);
211 } 211 }
212 break; 212 break;
213 213
214 case ACPI_RESOURCE_TYPE_DMA: 214 case ACPI_RESOURCE_TYPE_DMA:
215 for (i = 0; i < res->Data.Dma.ChannelCount; i++) { 215 for (i = 0; i < res->Data.Dma.ChannelCount; i++) {
216 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 216 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
217 "DRQ %u\n", 217 "DRQ %u\n",
218 res->Data.Dma.Channels[i])); 218 res->Data.Dma.Channels[i]));
219 if (ops->drq) 219 if (ops->drq)
220 (*ops->drq)(arg->dev, arg->context, 220 (*ops->drq)(arg->dev, arg->context,
221 res->Data.Dma.Channels[i]); 221 res->Data.Dma.Channels[i]);
222 } 222 }
223 break; 223 break;
224 224
225 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 225 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
226 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 226 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
227 "Start dependent functions: %u\n", 227 "Start dependent functions: %u\n",
228 res->Data.StartDpf.CompatibilityPriority)); 228 res->Data.StartDpf.CompatibilityPriority));
229 if (ops->start_dep) 229 if (ops->start_dep)
230 (*ops->start_dep)(arg->dev, arg->context, 230 (*ops->start_dep)(arg->dev, arg->context,
231 res->Data.StartDpf.CompatibilityPriority); 231 res->Data.StartDpf.CompatibilityPriority);
232 break; 232 break;
233 233
234 case ACPI_RESOURCE_TYPE_END_DEPENDENT: 234 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
235 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 235 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
236 "End dependent functions\n")); 236 "End dependent functions\n"));
237 if (ops->end_dep) 237 if (ops->end_dep)
238 (*ops->end_dep)(arg->dev, arg->context); 238 (*ops->end_dep)(arg->dev, arg->context);
239 break; 239 break;
240 240
241 case ACPI_RESOURCE_TYPE_ADDRESS32: 241 case ACPI_RESOURCE_TYPE_ADDRESS32:
242 /* XXX Only fixed size supported for now */ 242 /* XXX Only fixed size supported for now */
243 if (res->Data.Address32.AddressLength == 0 || 243 if (res->Data.Address32.Address.AddressLength == 0 ||
244 res->Data.Address32.ProducerConsumer != ACPI_CONSUMER) 244 res->Data.Address32.ProducerConsumer != ACPI_CONSUMER)
245 break; 245 break;
246#define ADRRESS32_FIXED2(r) \ 246#define ADRRESS32_FIXED2(r) \
247 ((r)->Data.Address32.MinAddressFixed == ACPI_ADDRESS_FIXED && \ 247 ((r)->Data.Address32.MinAddressFixed == ACPI_ADDRESS_FIXED && \
248 (r)->Data.Address32.MaxAddressFixed == ACPI_ADDRESS_FIXED) 248 (r)->Data.Address32.MaxAddressFixed == ACPI_ADDRESS_FIXED)
249 switch (res->Data.Address32.ResourceType) { 249 switch (res->Data.Address32.ResourceType) {
250 case ACPI_MEMORY_RANGE: 250 case ACPI_MEMORY_RANGE:
251 if (ADRRESS32_FIXED2(res)) { 251 if (ADRRESS32_FIXED2(res)) {
252 if (ops->memory) 252 if (ops->memory)
253 (*ops->memory)(arg->dev, arg->context, 253 (*ops->memory)(arg->dev, arg->context,
254 res->Data.Address32.Minimum, 254 res->Data.Address32.Address.Minimum,
255 res->Data.Address32.AddressLength); 255 res->Data.Address32.Address.AddressLength);
256 } else { 256 } else {
257 if (ops->memrange) 257 if (ops->memrange)
258 (*ops->memrange)(arg->dev, arg->context, 258 (*ops->memrange)(arg->dev, arg->context,
259 res->Data.Address32.Minimum, 259 res->Data.Address32.Address.Minimum,
260 res->Data.Address32.Maximum, 260 res->Data.Address32.Address.Maximum,
261 res->Data.Address32.AddressLength, 261 res->Data.Address32.Address.AddressLength,
262 res->Data.Address32.Granularity); 262 res->Data.Address32.Address.Granularity);
263 } 263 }
264 break; 264 break;
265 case ACPI_IO_RANGE: 265 case ACPI_IO_RANGE:
266 if (ADRRESS32_FIXED2(res)) { 266 if (ADRRESS32_FIXED2(res)) {
267 if (ops->ioport) 267 if (ops->ioport)
268 (*ops->ioport)(arg->dev, arg->context, 268 (*ops->ioport)(arg->dev, arg->context,
269 res->Data.Address32.Minimum, 269 res->Data.Address32.Address.Minimum,
270 res->Data.Address32.AddressLength); 270 res->Data.Address32.Address.AddressLength);
271 } else { 271 } else {
272 if (ops->iorange) 272 if (ops->iorange)
273 (*ops->iorange)(arg->dev, arg->context, 273 (*ops->iorange)(arg->dev, arg->context,
274 res->Data.Address32.Minimum, 274 res->Data.Address32.Address.Minimum,
275 res->Data.Address32.Maximum, 275 res->Data.Address32.Address.Maximum,
276 res->Data.Address32.AddressLength, 276 res->Data.Address32.Address.AddressLength,
277 res->Data.Address32.Granularity); 277 res->Data.Address32.Address.Granularity);
278 } 278 }
279 break; 279 break;
280 case ACPI_BUS_NUMBER_RANGE: 280 case ACPI_BUS_NUMBER_RANGE:
281 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 281 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
282 "Address32/BusNumber unimplemented\n")); 282 "Address32/BusNumber unimplemented\n"));
283 break; 283 break;
284 } 284 }
285#undef ADRRESS32_FIXED2 285#undef ADRRESS32_FIXED2
286 break; 286 break;
287 287
288 case ACPI_RESOURCE_TYPE_ADDRESS16: 288 case ACPI_RESOURCE_TYPE_ADDRESS16:
289 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 289 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
290 "Address16 unimplemented\n")); 290 "Address16 unimplemented\n"));
291 break; 291 break;
292 292
293 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: 293 case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
294 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 294 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
295 "Extended address64 unimplemented\n")); 295 "Extended address64 unimplemented\n"));
296 break; 296 break;
297 297
298 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: 298 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
299 if (res->Data.ExtendedIrq.ProducerConsumer != ACPI_CONSUMER) { 299 if (res->Data.ExtendedIrq.ProducerConsumer != ACPI_CONSUMER) {
300 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 300 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
301 "ignored ExtIRQ producer\n")); 301 "ignored ExtIRQ producer\n"));
302 break; 302 break;
303 } 303 }
304 for (i = 0; i < res->Data.ExtendedIrq.InterruptCount; i++) { 304 for (i = 0; i < res->Data.ExtendedIrq.InterruptCount; i++) {
305 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 305 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
306 "ExtIRQ %u\n", 306 "ExtIRQ %u\n",
307 res->Data.ExtendedIrq.Interrupts[i])); 307 res->Data.ExtendedIrq.Interrupts[i]));
308 if (ops->irq) 308 if (ops->irq)
309 (*ops->irq)(arg->dev, arg->context, 309 (*ops->irq)(arg->dev, arg->context,
310 res->Data.ExtendedIrq.Interrupts[i], 310 res->Data.ExtendedIrq.Interrupts[i],
311 res->Data.ExtendedIrq.Triggering); 311 res->Data.ExtendedIrq.Triggering);
312 } 312 }
313 break; 313 break;
314 314
315 case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: 315 case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
316 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 316 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
317 "GenericRegister unimplemented\n")); 317 "GenericRegister unimplemented\n"));
318 break; 318 break;
319 319
320 case ACPI_RESOURCE_TYPE_VENDOR: 320 case ACPI_RESOURCE_TYPE_VENDOR:
321 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 321 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
322 "VendorSpecific unimplemented\n")); 322 "VendorSpecific unimplemented\n"));
323 break; 323 break;
324 324
325 default: 325 default:
326 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, 326 ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
327 "Unknown resource type: %u\n", res->Type)); 327 "Unknown resource type: %u\n", res->Type));
328 break; 328 break;
329 } 329 }
330 330
331 return_ACPI_STATUS(AE_OK); 331 return_ACPI_STATUS(AE_OK);
332} 332}
333 333
334 334
335/* 335/*
336 * acpi_resource_parse: 336 * acpi_resource_parse:
337 * 337 *
338 * Parse a device node's resources and fill them in for the 338 * Parse a device node's resources and fill them in for the
339 * client. 339 * client.
340 * 340 *
341 * This API supports _CRS (current resources) and 341 * This API supports _CRS (current resources) and
342 * _PRS (possible resources). 342 * _PRS (possible resources).
343 * 343 *
344 * Note that it might be nice to also locate ACPI-specific resource 344 * Note that it might be nice to also locate ACPI-specific resource
345 * items, such as GPE bits. 345 * items, such as GPE bits.
346 */ 346 */
347ACPI_STATUS 347ACPI_STATUS
348acpi_resource_parse(device_t dev, ACPI_HANDLE handle, const char *path, 348acpi_resource_parse(device_t dev, ACPI_HANDLE handle, const char *path,
349 void *arg, const struct acpi_resource_parse_ops *ops) 349 void *arg, const struct acpi_resource_parse_ops *ops)
350{ 350{
351 struct resource_parse_callback_arg cbarg; 351 struct resource_parse_callback_arg cbarg;
352 ACPI_STATUS rv; 352 ACPI_STATUS rv;
353 353
354 ACPI_FUNCTION_TRACE(__func__); 354 ACPI_FUNCTION_TRACE(__func__);
355 355
356 if (ops->init) 356 if (ops->init)
357 (*ops->init)(dev, arg, &cbarg.context); 357 (*ops->init)(dev, arg, &cbarg.context);
358 else 358 else
359 cbarg.context = arg; 359 cbarg.context = arg;
360 cbarg.ops = ops; 360 cbarg.ops = ops;
361 cbarg.dev = dev; 361 cbarg.dev = dev;
362 362
363 rv = AcpiWalkResources(handle, path, acpi_resource_parse_callback, 363 rv = AcpiWalkResources(handle, path, acpi_resource_parse_callback,
364 &cbarg); 364 &cbarg);
365 if (ACPI_FAILURE(rv)) { 365 if (ACPI_FAILURE(rv)) {
366 aprint_error_dev(dev, "ACPI: unable to get %s resources: %s\n", 366 aprint_error_dev(dev, "ACPI: unable to get %s resources: %s\n",
367 path, AcpiFormatException(rv)); 367 path, AcpiFormatException(rv));
368 return_ACPI_STATUS(rv); 368 return_ACPI_STATUS(rv);
369 } 369 }
370 370
371 if (ops->fini) 371 if (ops->fini)
372 (*ops->fini)(dev, cbarg.context); 372 (*ops->fini)(dev, cbarg.context);
373 373
374 return_ACPI_STATUS(AE_OK); 374 return_ACPI_STATUS(AE_OK);
375} 375}
376 376
377/* 377/*
378 * acpi_resource_print: 378 * acpi_resource_print:
379 * 379 *
380 * Print the resources assigned to a device. 380 * Print the resources assigned to a device.
381 */ 381 */
382void 382void
383acpi_resource_print(device_t dev, struct acpi_resources *res) 383acpi_resource_print(device_t dev, struct acpi_resources *res)
384{ 384{
385 const char *sep; 385 const char *sep;
386 386
387 if (SIMPLEQ_EMPTY(&res->ar_io) && 387 if (SIMPLEQ_EMPTY(&res->ar_io) &&
388 SIMPLEQ_EMPTY(&res->ar_iorange) && 388 SIMPLEQ_EMPTY(&res->ar_iorange) &&
389 SIMPLEQ_EMPTY(&res->ar_mem) && 389 SIMPLEQ_EMPTY(&res->ar_mem) &&
390 SIMPLEQ_EMPTY(&res->ar_memrange) && 390 SIMPLEQ_EMPTY(&res->ar_memrange) &&
391 SIMPLEQ_EMPTY(&res->ar_irq) && 391 SIMPLEQ_EMPTY(&res->ar_irq) &&
392 SIMPLEQ_EMPTY(&res->ar_drq)) 392 SIMPLEQ_EMPTY(&res->ar_drq))
393 return; 393 return;
394 394
395 aprint_normal(":"); 395 aprint_normal(":");
396 396
397 if (SIMPLEQ_EMPTY(&res->ar_io) == 0) { 397 if (SIMPLEQ_EMPTY(&res->ar_io) == 0) {
398 struct acpi_io *ar; 398 struct acpi_io *ar;
399 399
400 sep = ""; 400 sep = "";
401 aprint_normal(" io "); 401 aprint_normal(" io ");
402 SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) { 402 SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) {
403 aprint_normal("%s0x%x", sep, ar->ar_base); 403 aprint_normal("%s0x%x", sep, ar->ar_base);
404 if (ar->ar_length > 1) 404 if (ar->ar_length > 1)
405 aprint_normal("-0x%x", ar->ar_base + 405 aprint_normal("-0x%x", ar->ar_base +
406 ar->ar_length - 1); 406 ar->ar_length - 1);
407 sep = ","; 407 sep = ",";
408 } 408 }
409 } 409 }
410 410
411 /* XXX iorange */ 411 /* XXX iorange */
412 412
413 if (SIMPLEQ_EMPTY(&res->ar_mem) == 0) { 413 if (SIMPLEQ_EMPTY(&res->ar_mem) == 0) {
414 struct acpi_mem *ar; 414 struct acpi_mem *ar;
415 415
416 sep = ""; 416 sep = "";
417 aprint_normal(" mem "); 417 aprint_normal(" mem ");
418 SIMPLEQ_FOREACH(ar, &res->ar_mem, ar_list) { 418 SIMPLEQ_FOREACH(ar, &res->ar_mem, ar_list) {
419 aprint_normal("%s0x%x", sep, ar->ar_base); 419 aprint_normal("%s0x%x", sep, ar->ar_base);
420 if (ar->ar_length > 1) 420 if (ar->ar_length > 1)
421 aprint_normal("-0x%x", ar->ar_base + 421 aprint_normal("-0x%x", ar->ar_base +
422 ar->ar_length - 1); 422 ar->ar_length - 1);
423 sep = ","; 423 sep = ",";
424 } 424 }
425 } 425 }
426 426
427 /* XXX memrange */ 427 /* XXX memrange */
428 428
429 if (SIMPLEQ_EMPTY(&res->ar_irq) == 0) { 429 if (SIMPLEQ_EMPTY(&res->ar_irq) == 0) {
430 struct acpi_irq *ar; 430 struct acpi_irq *ar;
431 431
432 sep = ""; 432 sep = "";
433 aprint_normal(" irq "); 433 aprint_normal(" irq ");
434 SIMPLEQ_FOREACH(ar, &res->ar_irq, ar_list) { 434 SIMPLEQ_FOREACH(ar, &res->ar_irq, ar_list) {
435 aprint_normal("%s%d", sep, ar->ar_irq); 435 aprint_normal("%s%d", sep, ar->ar_irq);
436 sep = ","; 436 sep = ",";
437 } 437 }
438 } 438 }
439 439
440 if (SIMPLEQ_EMPTY(&res->ar_drq) == 0) { 440 if (SIMPLEQ_EMPTY(&res->ar_drq) == 0) {
441 struct acpi_drq *ar; 441 struct acpi_drq *ar;
442 442
443 sep = ""; 443 sep = "";
444 aprint_normal(" drq "); 444 aprint_normal(" drq ");
445 SIMPLEQ_FOREACH(ar, &res->ar_drq, ar_list) { 445 SIMPLEQ_FOREACH(ar, &res->ar_drq, ar_list) {
446 aprint_normal("%s%d", sep, ar->ar_drq); 446 aprint_normal("%s%d", sep, ar->ar_drq);
447 sep = ","; 447 sep = ",";
448 } 448 }
449 } 449 }
450 450
451 aprint_normal("\n"); 451 aprint_normal("\n");
452 aprint_naive("\n"); 452 aprint_naive("\n");
453} 453}
454 454
455/* 455/*
456 * acpi_resource_cleanup: 456 * acpi_resource_cleanup:
457 * 457 *
458 * Free all allocated buffers 458 * Free all allocated buffers
459 */ 459 */
460void 460void
461acpi_resource_cleanup(struct acpi_resources *res) 461acpi_resource_cleanup(struct acpi_resources *res)
462{ 462{
463 while (!SIMPLEQ_EMPTY(&res->ar_io)) { 463 while (!SIMPLEQ_EMPTY(&res->ar_io)) {
464 struct acpi_io *ar; 464 struct acpi_io *ar;
465 ar = SIMPLEQ_FIRST(&res->ar_io); 465 ar = SIMPLEQ_FIRST(&res->ar_io);
466 SIMPLEQ_REMOVE_HEAD(&res->ar_io, ar_list); 466 SIMPLEQ_REMOVE_HEAD(&res->ar_io, ar_list);
467 ACPI_FREE(ar); 467 ACPI_FREE(ar);
468 } 468 }
469 469
470 while (!SIMPLEQ_EMPTY(&res->ar_iorange)) { 470 while (!SIMPLEQ_EMPTY(&res->ar_iorange)) {
471 struct acpi_iorange *ar; 471 struct acpi_iorange *ar;
472 ar = SIMPLEQ_FIRST(&res->ar_iorange); 472 ar = SIMPLEQ_FIRST(&res->ar_iorange);
473 SIMPLEQ_REMOVE_HEAD(&res->ar_iorange, ar_list); 473 SIMPLEQ_REMOVE_HEAD(&res->ar_iorange, ar_list);
474 ACPI_FREE(ar); 474 ACPI_FREE(ar);
475 } 475 }
476 476
477 while (!SIMPLEQ_EMPTY(&res->ar_mem)) { 477 while (!SIMPLEQ_EMPTY(&res->ar_mem)) {
478 struct acpi_mem *ar; 478 struct acpi_mem *ar;
479 ar = SIMPLEQ_FIRST(&res->ar_mem); 479 ar = SIMPLEQ_FIRST(&res->ar_mem);
480 SIMPLEQ_REMOVE_HEAD(&res->ar_mem, ar_list); 480 SIMPLEQ_REMOVE_HEAD(&res->ar_mem, ar_list);
481 ACPI_FREE(ar); 481 ACPI_FREE(ar);
482 } 482 }
483 483
484 while (!SIMPLEQ_EMPTY(&res->ar_memrange)) { 484 while (!SIMPLEQ_EMPTY(&res->ar_memrange)) {
485 struct acpi_memrange *ar; 485 struct acpi_memrange *ar;
486 ar = SIMPLEQ_FIRST(&res->ar_memrange); 486 ar = SIMPLEQ_FIRST(&res->ar_memrange);
487 SIMPLEQ_REMOVE_HEAD(&res->ar_memrange, ar_list); 487 SIMPLEQ_REMOVE_HEAD(&res->ar_memrange, ar_list);
488 ACPI_FREE(ar); 488 ACPI_FREE(ar);
489 } 489 }
490 490
491 while (!SIMPLEQ_EMPTY(&res->ar_irq)) { 491 while (!SIMPLEQ_EMPTY(&res->ar_irq)) {
492 struct acpi_irq *ar; 492 struct acpi_irq *ar;
493 ar = SIMPLEQ_FIRST(&res->ar_irq); 493 ar = SIMPLEQ_FIRST(&res->ar_irq);
494 SIMPLEQ_REMOVE_HEAD(&res->ar_irq, ar_list); 494 SIMPLEQ_REMOVE_HEAD(&res->ar_irq, ar_list);
495 ACPI_FREE(ar); 495 ACPI_FREE(ar);
496 } 496 }
497 497
498 while (!SIMPLEQ_EMPTY(&res->ar_drq)) { 498 while (!SIMPLEQ_EMPTY(&res->ar_drq)) {
499 struct acpi_drq *ar; 499 struct acpi_drq *ar;
500 ar = SIMPLEQ_FIRST(&res->ar_drq); 500 ar = SIMPLEQ_FIRST(&res->ar_drq);
501 SIMPLEQ_REMOVE_HEAD(&res->ar_drq, ar_list); 501 SIMPLEQ_REMOVE_HEAD(&res->ar_drq, ar_list);
502 ACPI_FREE(ar); 502 ACPI_FREE(ar);
503 } 503 }
504 504
505 res->ar_nio = res->ar_niorange = res->ar_nmem = 505 res->ar_nio = res->ar_niorange = res->ar_nmem =
506 res->ar_nmemrange = res->ar_nirq = res->ar_ndrq = 0; 506 res->ar_nmemrange = res->ar_nirq = res->ar_ndrq = 0;
507} 507}
508 508
509struct acpi_io * 509struct acpi_io *
510acpi_res_io(struct acpi_resources *res, int idx) 510acpi_res_io(struct acpi_resources *res, int idx)
511{ 511{
512 struct acpi_io *ar; 512 struct acpi_io *ar;
513 513
514 SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) { 514 SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) {
515 if (ar->ar_index == idx) 515 if (ar->ar_index == idx)
516 return ar; 516 return ar;
517 } 517 }
518 return NULL; 518 return NULL;
519} 519}
520 520
521struct acpi_iorange * 521struct acpi_iorange *
522acpi_res_iorange(struct acpi_resources *res, int idx) 522acpi_res_iorange(struct acpi_resources *res, int idx)
523{ 523{
524 struct acpi_iorange *ar; 524 struct acpi_iorange *ar;
525 525
526 SIMPLEQ_FOREACH(ar, &res->ar_iorange, ar_list) { 526 SIMPLEQ_FOREACH(ar, &res->ar_iorange, ar_list) {
527 if (ar->ar_index == idx) 527 if (ar->ar_index == idx)
528 return ar; 528 return ar;
529 } 529 }
530 return NULL; 530 return NULL;
531} 531}
532 532
533struct acpi_mem * 533struct acpi_mem *
534acpi_res_mem(struct acpi_resources *res, int idx) 534acpi_res_mem(struct acpi_resources *res, int idx)
535{ 535{
536 struct acpi_mem *ar; 536 struct acpi_mem *ar;
537 537
538 SIMPLEQ_FOREACH(ar, &res->ar_mem, ar_list) { 538 SIMPLEQ_FOREACH(ar, &res->ar_mem, ar_list) {
539 if (ar->ar_index == idx) 539 if (ar->ar_index == idx)
540 return ar; 540 return ar;
541 } 541 }
542 return NULL; 542 return NULL;
543} 543}
544 544
545struct acpi_memrange * 545struct acpi_memrange *
546acpi_res_memrange(struct acpi_resources *res, int idx) 546acpi_res_memrange(struct acpi_resources *res, int idx)
547{ 547{
548 struct acpi_memrange *ar; 548 struct acpi_memrange *ar;
549 549
550 SIMPLEQ_FOREACH(ar, &res->ar_memrange, ar_list) { 550 SIMPLEQ_FOREACH(ar, &res->ar_memrange, ar_list) {
551 if (ar->ar_index == idx) 551 if (ar->ar_index == idx)
552 return ar; 552 return ar;
553 } 553 }
554 return NULL; 554 return NULL;
555} 555}
556 556
557struct acpi_irq * 557struct acpi_irq *
558acpi_res_irq(struct acpi_resources *res, int idx) 558acpi_res_irq(struct acpi_resources *res, int idx)
559{ 559{
560 struct acpi_irq *ar; 560 struct acpi_irq *ar;
561 561
562 SIMPLEQ_FOREACH(ar, &res->ar_irq, ar_list) { 562 SIMPLEQ_FOREACH(ar, &res->ar_irq, ar_list) {
563 if (ar->ar_index == idx) 563 if (ar->ar_index == idx)
564 return ar; 564 return ar;
565 } 565 }
566 return NULL; 566 return NULL;
567} 567}
568 568
569struct acpi_drq * 569struct acpi_drq *
570acpi_res_drq(struct acpi_resources *res, int idx) 570acpi_res_drq(struct acpi_resources *res, int idx)
571{ 571{
572 struct acpi_drq *ar; 572 struct acpi_drq *ar;
573 573
574 SIMPLEQ_FOREACH(ar, &res->ar_drq, ar_list) { 574 SIMPLEQ_FOREACH(ar, &res->ar_drq, ar_list) {
575 if (ar->ar_index == idx) 575 if (ar->ar_index == idx)
576 return ar; 576 return ar;
577 } 577 }
578 return NULL; 578 return NULL;
579} 579}
580 580
581/***************************************************************************** 581/*****************************************************************************
582 * Default ACPI resource parse operations. 582 * Default ACPI resource parse operations.
583 *****************************************************************************/ 583 *****************************************************************************/
584 584
585static void acpi_res_parse_init(device_t, void *, void **); 585static void acpi_res_parse_init(device_t, void *, void **);
586static void acpi_res_parse_fini(device_t, void *); 586static void acpi_res_parse_fini(device_t, void *);
587 587
588static void acpi_res_parse_ioport(device_t, void *, uint32_t, 588static void acpi_res_parse_ioport(device_t, void *, uint32_t,
589 uint32_t); 589 uint32_t);
590static void acpi_res_parse_iorange(device_t, void *, uint32_t, 590static void acpi_res_parse_iorange(device_t, void *, uint32_t,
591 uint32_t, uint32_t, uint32_t); 591 uint32_t, uint32_t, uint32_t);
592 592
593static void acpi_res_parse_memory(device_t, void *, uint32_t, 593static void acpi_res_parse_memory(device_t, void *, uint32_t,
594 uint32_t); 594 uint32_t);
595static void acpi_res_parse_memrange(device_t, void *, uint32_t, 595static void acpi_res_parse_memrange(device_t, void *, uint32_t,
596 uint32_t, uint32_t, uint32_t); 596 uint32_t, uint32_t, uint32_t);
597 597
598static void acpi_res_parse_irq(device_t, void *, uint32_t, uint32_t); 598static void acpi_res_parse_irq(device_t, void *, uint32_t, uint32_t);
599static void acpi_res_parse_drq(device_t, void *, uint32_t); 599static void acpi_res_parse_drq(device_t, void *, uint32_t);
600 600
601static void acpi_res_parse_start_dep(device_t, void *, int); 601static void acpi_res_parse_start_dep(device_t, void *, int);
602static void acpi_res_parse_end_dep(device_t, void *); 602static void acpi_res_parse_end_dep(device_t, void *);
603 603
604const struct acpi_resource_parse_ops acpi_resource_parse_ops_default = { 604const struct acpi_resource_parse_ops acpi_resource_parse_ops_default = {
605 .init = acpi_res_parse_init, 605 .init = acpi_res_parse_init,
606 .fini = acpi_res_parse_fini, 606 .fini = acpi_res_parse_fini,
607 607
608 .ioport = acpi_res_parse_ioport, 608 .ioport = acpi_res_parse_ioport,
609 .iorange = acpi_res_parse_iorange, 609 .iorange = acpi_res_parse_iorange,
610 610
611 .memory = acpi_res_parse_memory, 611 .memory = acpi_res_parse_memory,
612 .memrange = acpi_res_parse_memrange, 612 .memrange = acpi_res_parse_memrange,
613 613
614 .irq = acpi_res_parse_irq, 614 .irq = acpi_res_parse_irq,
615 .drq = acpi_res_parse_drq, 615 .drq = acpi_res_parse_drq,
616 616
617 .start_dep = acpi_res_parse_start_dep, 617 .start_dep = acpi_res_parse_start_dep,
618 .end_dep = acpi_res_parse_end_dep, 618 .end_dep = acpi_res_parse_end_dep,
619}; 619};
620 620
621const struct acpi_resource_parse_ops acpi_resource_parse_ops_quiet = { 621const struct acpi_resource_parse_ops acpi_resource_parse_ops_quiet = {
622 .init = acpi_res_parse_init, 622 .init = acpi_res_parse_init,
623 .fini = NULL, 623 .fini = NULL,
624 624
625 .ioport = acpi_res_parse_ioport, 625 .ioport = acpi_res_parse_ioport,
626 .iorange = acpi_res_parse_iorange, 626 .iorange = acpi_res_parse_iorange,
627 627
628 .memory = acpi_res_parse_memory, 628 .memory = acpi_res_parse_memory,
629 .memrange = acpi_res_parse_memrange, 629 .memrange = acpi_res_parse_memrange,
630 630
631 .irq = acpi_res_parse_irq, 631 .irq = acpi_res_parse_irq,
632 .drq = acpi_res_parse_drq, 632 .drq = acpi_res_parse_drq,
633 633
634 .start_dep = acpi_res_parse_start_dep, 634 .start_dep = acpi_res_parse_start_dep,
635 .end_dep = acpi_res_parse_end_dep, 635 .end_dep = acpi_res_parse_end_dep,
636}; 636};
637 637
638static void 638static void
639acpi_res_parse_init(device_t dev, void *arg, void **contextp) 639acpi_res_parse_init(device_t dev, void *arg, void **contextp)
640{ 640{
641 struct acpi_resources *res = arg; 641 struct acpi_resources *res = arg;
642 642
643 SIMPLEQ_INIT(&res->ar_io); 643 SIMPLEQ_INIT(&res->ar_io);
644 res->ar_nio = 0; 644 res->ar_nio = 0;
645 645
646 SIMPLEQ_INIT(&res->ar_iorange); 646 SIMPLEQ_INIT(&res->ar_iorange);
647 res->ar_niorange = 0; 647 res->ar_niorange = 0;
648 648
649 SIMPLEQ_INIT(&res->ar_mem); 649 SIMPLEQ_INIT(&res->ar_mem);
650 res->ar_nmem = 0; 650 res->ar_nmem = 0;
651 651
652 SIMPLEQ_INIT(&res->ar_memrange); 652 SIMPLEQ_INIT(&res->ar_memrange);
653 res->ar_nmemrange = 0; 653 res->ar_nmemrange = 0;
654 654
655 SIMPLEQ_INIT(&res->ar_irq); 655 SIMPLEQ_INIT(&res->ar_irq);
656 res->ar_nirq = 0; 656 res->ar_nirq = 0;
657 657
658 SIMPLEQ_INIT(&res->ar_drq); 658 SIMPLEQ_INIT(&res->ar_drq);
659 res->ar_ndrq = 0; 659 res->ar_ndrq = 0;
660 660
661 *contextp = res; 661 *contextp = res;
662} 662}
663 663
664static void 664static void
665acpi_res_parse_fini(device_t dev, void *context) 665acpi_res_parse_fini(device_t dev, void *context)
666{ 666{
667 struct acpi_resources *res = context; 667 struct acpi_resources *res = context;
668 668
669 /* Print the resources we're using. */ 669 /* Print the resources we're using. */
670 acpi_resource_print(dev, res); 670 acpi_resource_print(dev, res);
671} 671}
672 672
673static void 673static void
674acpi_res_parse_ioport(device_t dev, void *context, uint32_t base, 674acpi_res_parse_ioport(device_t dev, void *context, uint32_t base,
675 uint32_t length) 675 uint32_t length)
676{ 676{
677 struct acpi_resources *res = context; 677 struct acpi_resources *res = context;
678 struct acpi_io *ar; 678 struct acpi_io *ar;
679 679
680 /* 680 /*
681 * Check if there is another I/O port directly below/under 681 * Check if there is another I/O port directly below/under
682 * this one. 682 * this one.
683 */ 683 */
684 SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) { 684 SIMPLEQ_FOREACH(ar, &res->ar_io, ar_list) {
685 if (ar->ar_base == base + length ) { 685 if (ar->ar_base == base + length ) {
686 /* 686 /*
687 * Entry just below existing entry - adjust 687 * Entry just below existing entry - adjust
688 * the entry and return. 688 * the entry and return.
689 */ 689 */
690 ar->ar_base = base; 690 ar->ar_base = base;
691 ar->ar_length += length; 691 ar->ar_length += length;
692 return; 692 return;
693 } else if (ar->ar_base + ar->ar_length == base) { 693 } else if (ar->ar_base + ar->ar_length == base) {
694 /* 694 /*
695 * Entry just above existing entry - adjust 695 * Entry just above existing entry - adjust
696 * the entry and return. 696 * the entry and return.
697 */ 697 */
698 ar->ar_length += length; 698 ar->ar_length += length;
699 return; 699 return;
700 } 700 }
701 } 701 }
702 702
703 ar = ACPI_ALLOCATE(sizeof(*ar)); 703 ar = ACPI_ALLOCATE(sizeof(*ar));
704 if (ar == NULL) { 704 if (ar == NULL) {
705 aprint_error_dev(dev, "ACPI: unable to allocate I/O resource %d\n", 705 aprint_error_dev(dev, "ACPI: unable to allocate I/O resource %d\n",
706 res->ar_nio); 706 res->ar_nio);
707 res->ar_nio++; 707 res->ar_nio++;
708 return; 708 return;
709 } 709 }
710 710
711 ar->ar_index = res->ar_nio++; 711 ar->ar_index = res->ar_nio++;
712 ar->ar_base = base; 712 ar->ar_base = base;
713 ar->ar_length = length; 713 ar->ar_length = length;
714 714
715 SIMPLEQ_INSERT_TAIL(&res->ar_io, ar, ar_list); 715 SIMPLEQ_INSERT_TAIL(&res->ar_io, ar, ar_list);
716} 716}
717 717
718static void 718static void
719acpi_res_parse_iorange(device_t dev, void *context, uint32_t low, 719acpi_res_parse_iorange(device_t dev, void *context, uint32_t low,
720 uint32_t high, uint32_t length, uint32_t align) 720 uint32_t high, uint32_t length, uint32_t align)
721{ 721{
722 struct acpi_resources *res = context; 722 struct acpi_resources *res = context;
723 struct acpi_iorange *ar; 723 struct acpi_iorange *ar;
724 724
725 ar = ACPI_ALLOCATE(sizeof(*ar)); 725 ar = ACPI_ALLOCATE(sizeof(*ar));
726 if (ar == NULL) { 726 if (ar == NULL) {
727 aprint_error_dev(dev, "ACPI: unable to allocate I/O range resource %d\n", 727 aprint_error_dev(dev, "ACPI: unable to allocate I/O range resource %d\n",
728 res->ar_niorange); 728 res->ar_niorange);
729 res->ar_niorange++; 729 res->ar_niorange++;
730 return; 730 return;
731 } 731 }
732 732
733 ar->ar_index = res->ar_niorange++; 733 ar->ar_index = res->ar_niorange++;
734 ar->ar_low = low; 734 ar->ar_low = low;
735 ar->ar_high = high; 735 ar->ar_high = high;
736 ar->ar_length = length; 736 ar->ar_length = length;
737 ar->ar_align = align; 737 ar->ar_align = align;
738 738
739 SIMPLEQ_INSERT_TAIL(&res->ar_iorange, ar, ar_list); 739 SIMPLEQ_INSERT_TAIL(&res->ar_iorange, ar, ar_list);
740} 740}
741 741
742static void 742static void
743acpi_res_parse_memory(device_t dev, void *context, uint32_t base, 743acpi_res_parse_memory(device_t dev, void *context, uint32_t base,
744 uint32_t length) 744 uint32_t length)
745{ 745{
746 struct acpi_resources *res = context; 746 struct acpi_resources *res = context;
747 struct acpi_mem *ar; 747 struct acpi_mem *ar;
748 748
749 ar = ACPI_ALLOCATE(sizeof(*ar)); 749 ar = ACPI_ALLOCATE(sizeof(*ar));
750 if (ar == NULL) { 750 if (ar == NULL) {
751 aprint_error_dev(dev, "ACPI: unable to allocate Memory resource %d\n", 751 aprint_error_dev(dev, "ACPI: unable to allocate Memory resource %d\n",
752 res->ar_nmem); 752 res->ar_nmem);
753 res->ar_nmem++; 753 res->ar_nmem++;
754 return; 754 return;
755 } 755 }
756 756
757 ar->ar_index = res->ar_nmem++; 757 ar->ar_index = res->ar_nmem++;
758 ar->ar_base = base; 758 ar->ar_base = base;
759 ar->ar_length = length; 759 ar->ar_length = length;
760 760
761 SIMPLEQ_INSERT_TAIL(&res->ar_mem, ar, ar_list); 761 SIMPLEQ_INSERT_TAIL(&res->ar_mem, ar, ar_list);
762} 762}
763 763
764static void 764static void
765acpi_res_parse_memrange(device_t dev, void *context, uint32_t low, 765acpi_res_parse_memrange(device_t dev, void *context, uint32_t low,
766 uint32_t high, uint32_t length, uint32_t align) 766 uint32_t high, uint32_t length, uint32_t align)
767{ 767{
768 struct acpi_resources *res = context; 768 struct acpi_resources *res = context;
769 struct acpi_memrange *ar; 769 struct acpi_memrange *ar;
770 770
771 ar = ACPI_ALLOCATE(sizeof(*ar)); 771 ar = ACPI_ALLOCATE(sizeof(*ar));
772 if (ar == NULL) { 772 if (ar == NULL) {
773 aprint_error_dev(dev, "ACPI: unable to allocate Memory range resource %d\n", 773 aprint_error_dev(dev, "ACPI: unable to allocate Memory range resource %d\n",
774 res->ar_nmemrange); 774 res->ar_nmemrange);
775 res->ar_nmemrange++; 775 res->ar_nmemrange++;
776 return; 776 return;
777 } 777 }
778 778
779 ar->ar_index = res->ar_nmemrange++; 779 ar->ar_index = res->ar_nmemrange++;
780 ar->ar_low = low; 780 ar->ar_low = low;
781 ar->ar_high = high; 781 ar->ar_high = high;
782 ar->ar_length = length; 782 ar->ar_length = length;
783 ar->ar_align = align; 783 ar->ar_align = align;
784 784
785 SIMPLEQ_INSERT_TAIL(&res->ar_memrange, ar, ar_list); 785 SIMPLEQ_INSERT_TAIL(&res->ar_memrange, ar, ar_list);
786} 786}
787 787
788static void 788static void
789acpi_res_parse_irq(device_t dev, void *context, uint32_t irq, uint32_t type) 789acpi_res_parse_irq(device_t dev, void *context, uint32_t irq, uint32_t type)
790{ 790{
791 struct acpi_resources *res = context; 791 struct acpi_resources *res = context;
792 struct acpi_irq *ar; 792 struct acpi_irq *ar;
793 793
794 ar = ACPI_ALLOCATE(sizeof(*ar)); 794 ar = ACPI_ALLOCATE(sizeof(*ar));
795 if (ar == NULL) { 795 if (ar == NULL) {
796 aprint_error_dev(dev, "ACPI: unable to allocate IRQ resource %d\n", 796 aprint_error_dev(dev, "ACPI: unable to allocate IRQ resource %d\n",
797 res->ar_nirq); 797 res->ar_nirq);
798 res->ar_nirq++; 798 res->ar_nirq++;
799 return; 799 return;
800 } 800 }
801 801
802 ar->ar_index = res->ar_nirq++; 802 ar->ar_index = res->ar_nirq++;
803 ar->ar_irq = irq; 803 ar->ar_irq = irq;
804 ar->ar_type = type; 804 ar->ar_type = type;
805 805
806 SIMPLEQ_INSERT_TAIL(&res->ar_irq, ar, ar_list); 806 SIMPLEQ_INSERT_TAIL(&res->ar_irq, ar, ar_list);
807} 807}
808 808
809static void 809static void
810acpi_res_parse_drq(device_t dev, void *context, uint32_t drq) 810acpi_res_parse_drq(device_t dev, void *context, uint32_t drq)
811{ 811{
812 struct acpi_resources *res = context; 812 struct acpi_resources *res = context;
813 struct acpi_drq *ar; 813 struct acpi_drq *ar;
814 814
815 ar = ACPI_ALLOCATE(sizeof(*ar)); 815 ar = ACPI_ALLOCATE(sizeof(*ar));
816 if (ar == NULL) { 816 if (ar == NULL) {
817 aprint_error_dev(dev, "ACPI: unable to allocate DRQ resource %d\n", 817 aprint_error_dev(dev, "ACPI: unable to allocate DRQ resource %d\n",
818 res->ar_ndrq); 818 res->ar_ndrq);
819 res->ar_ndrq++; 819 res->ar_ndrq++;
820 return; 820 return;
821 } 821 }
822 822
823 ar->ar_index = res->ar_ndrq++; 823 ar->ar_index = res->ar_ndrq++;
824 ar->ar_drq = drq; 824 ar->ar_drq = drq;
825 825
826 SIMPLEQ_INSERT_TAIL(&res->ar_drq, ar, ar_list); 826 SIMPLEQ_INSERT_TAIL(&res->ar_drq, ar, ar_list);
827} 827}
828 828
829static void 829static void
830acpi_res_parse_start_dep(device_t dev, void *context, 830acpi_res_parse_start_dep(device_t dev, void *context,
831 int preference) 831 int preference)
832{ 832{
833 833
834 aprint_error_dev(dev, "ACPI: dependent functions not supported\n"); 834 aprint_error_dev(dev, "ACPI: dependent functions not supported\n");
835} 835}
836 836
837static void 837static void
838acpi_res_parse_end_dep(device_t dev, void *context) 838acpi_res_parse_end_dep(device_t dev, void *context)
839{ 839{
840 840
841 /* Nothing to do. */ 841 /* Nothing to do. */
842} 842}