| @@ -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 |
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 | |
84 | struct resource_parse_callback_arg { | | 84 | struct 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 | |
90 | static ACPI_STATUS | | 90 | static ACPI_STATUS |
91 | acpi_resource_parse_callback(ACPI_RESOURCE *res, void *context) | | 91 | acpi_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 | */ |
347 | ACPI_STATUS | | 347 | ACPI_STATUS |
348 | acpi_resource_parse(device_t dev, ACPI_HANDLE handle, const char *path, | | 348 | acpi_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 | */ |
382 | void | | 382 | void |
383 | acpi_resource_print(device_t dev, struct acpi_resources *res) | | 383 | acpi_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 | */ |
460 | void | | 460 | void |
461 | acpi_resource_cleanup(struct acpi_resources *res) | | 461 | acpi_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 | |
509 | struct acpi_io * | | 509 | struct acpi_io * |
510 | acpi_res_io(struct acpi_resources *res, int idx) | | 510 | acpi_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 | |
521 | struct acpi_iorange * | | 521 | struct acpi_iorange * |
522 | acpi_res_iorange(struct acpi_resources *res, int idx) | | 522 | acpi_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 | |
533 | struct acpi_mem * | | 533 | struct acpi_mem * |
534 | acpi_res_mem(struct acpi_resources *res, int idx) | | 534 | acpi_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 | |
545 | struct acpi_memrange * | | 545 | struct acpi_memrange * |
546 | acpi_res_memrange(struct acpi_resources *res, int idx) | | 546 | acpi_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 | |
557 | struct acpi_irq * | | 557 | struct acpi_irq * |
558 | acpi_res_irq(struct acpi_resources *res, int idx) | | 558 | acpi_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 | |
569 | struct acpi_drq * | | 569 | struct acpi_drq * |
570 | acpi_res_drq(struct acpi_resources *res, int idx) | | 570 | acpi_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 | |
585 | static void acpi_res_parse_init(device_t, void *, void **); | | 585 | static void acpi_res_parse_init(device_t, void *, void **); |
586 | static void acpi_res_parse_fini(device_t, void *); | | 586 | static void acpi_res_parse_fini(device_t, void *); |
587 | | | 587 | |
588 | static void acpi_res_parse_ioport(device_t, void *, uint32_t, | | 588 | static void acpi_res_parse_ioport(device_t, void *, uint32_t, |
589 | uint32_t); | | 589 | uint32_t); |
590 | static void acpi_res_parse_iorange(device_t, void *, uint32_t, | | 590 | static 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 | |
593 | static void acpi_res_parse_memory(device_t, void *, uint32_t, | | 593 | static void acpi_res_parse_memory(device_t, void *, uint32_t, |
594 | uint32_t); | | 594 | uint32_t); |
595 | static void acpi_res_parse_memrange(device_t, void *, uint32_t, | | 595 | static 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 | |
598 | static void acpi_res_parse_irq(device_t, void *, uint32_t, uint32_t); | | 598 | static void acpi_res_parse_irq(device_t, void *, uint32_t, uint32_t); |
599 | static void acpi_res_parse_drq(device_t, void *, uint32_t); | | 599 | static void acpi_res_parse_drq(device_t, void *, uint32_t); |
600 | | | 600 | |
601 | static void acpi_res_parse_start_dep(device_t, void *, int); | | 601 | static void acpi_res_parse_start_dep(device_t, void *, int); |
602 | static void acpi_res_parse_end_dep(device_t, void *); | | 602 | static void acpi_res_parse_end_dep(device_t, void *); |
603 | | | 603 | |
604 | const struct acpi_resource_parse_ops acpi_resource_parse_ops_default = { | | 604 | const 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 | |
621 | const struct acpi_resource_parse_ops acpi_resource_parse_ops_quiet = { | | 621 | const 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 | |
638 | static void | | 638 | static void |
639 | acpi_res_parse_init(device_t dev, void *arg, void **contextp) | | 639 | acpi_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 | |
664 | static void | | 664 | static void |
665 | acpi_res_parse_fini(device_t dev, void *context) | | 665 | acpi_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 | |
673 | static void | | 673 | static void |
674 | acpi_res_parse_ioport(device_t dev, void *context, uint32_t base, | | 674 | acpi_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 | |
718 | static void | | 718 | static void |
719 | acpi_res_parse_iorange(device_t dev, void *context, uint32_t low, | | 719 | acpi_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 | |
742 | static void | | 742 | static void |
743 | acpi_res_parse_memory(device_t dev, void *context, uint32_t base, | | 743 | acpi_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 | |
764 | static void | | 764 | static void |
765 | acpi_res_parse_memrange(device_t dev, void *context, uint32_t low, | | 765 | acpi_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 | |
788 | static void | | 788 | static void |
789 | acpi_res_parse_irq(device_t dev, void *context, uint32_t irq, uint32_t type) | | 789 | acpi_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 | |
809 | static void | | 809 | static void |
810 | acpi_res_parse_drq(device_t dev, void *context, uint32_t drq) | | 810 | acpi_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 | |
829 | static void | | 829 | static void |
830 | acpi_res_parse_start_dep(device_t dev, void *context, | | 830 | acpi_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 | |
837 | static void | | 837 | static void |
838 | acpi_res_parse_end_dep(device_t dev, void *context) | | 838 | acpi_res_parse_end_dep(device_t dev, void *context) |
839 | { | | 839 | { |
840 | | | 840 | |
841 | /* Nothing to do. */ | | 841 | /* Nothing to do. */ |
842 | } | | 842 | } |