| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
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 |
| @@ -57,27 +57,27 @@ | | | @@ -57,27 +57,27 @@ |
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 |
80 | ACPI_MODULE_NAME("RESOURCE") | | 80 | ACPI_MODULE_NAME("RESOURCE") |
81 | | | 81 | |
82 | static ACPI_STATUS acpi_resource_parse_callback(ACPI_RESOURCE *, void *); | | 82 | static ACPI_STATUS acpi_resource_parse_callback(ACPI_RESOURCE *, void *); |
83 | | | 83 | |
| @@ -230,61 +230,61 @@ acpi_resource_parse_callback(ACPI_RESOUR | | | @@ -230,61 +230,61 @@ acpi_resource_parse_callback(ACPI_RESOUR |
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")); |