diff options
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 14 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 547 |
2 files changed, 332 insertions, 229 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 816479ad217b..f104577f73e0 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -27,12 +27,15 @@ | |||
27 | 27 | ||
28 | static int num = 0; | 28 | static int num = 0; |
29 | 29 | ||
30 | /* We need only to blacklist devices that have already an acpi driver that | ||
31 | * can't use pnp layer. We don't need to blacklist device that are directly | ||
32 | * used by the kernel (PCI root, ...), as it is harmless and there were | ||
33 | * already present in pnpbios. But there is an exception for devices that | ||
34 | * have irqs (PIC, Timer) because we call acpi_register_gsi. | ||
35 | * Finaly only devices that have a CRS method need to be in this list. | ||
36 | */ | ||
30 | static char __initdata excluded_id_list[] = | 37 | static char __initdata excluded_id_list[] = |
31 | "PNP0C0A," /* Battery */ | ||
32 | "PNP0C0C,PNP0C0E,PNP0C0D," /* Button */ | ||
33 | "PNP0C09," /* EC */ | 38 | "PNP0C09," /* EC */ |
34 | "PNP0C0B," /* Fan */ | ||
35 | "PNP0A03," /* PCI root */ | ||
36 | "PNP0C0F," /* Link device */ | 39 | "PNP0C0F," /* Link device */ |
37 | "PNP0000," /* PIC */ | 40 | "PNP0000," /* PIC */ |
38 | "PNP0100," /* Timer */ | 41 | "PNP0100," /* Timer */ |
@@ -131,7 +134,8 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
131 | struct pnp_id *dev_id; | 134 | struct pnp_id *dev_id; |
132 | struct pnp_dev *dev; | 135 | struct pnp_dev *dev; |
133 | 136 | ||
134 | if (!ispnpidacpi(acpi_device_hid(device)) || | 137 | status = acpi_get_handle(device->handle, "_CRS", &temp); |
138 | if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) || | ||
135 | is_exclusive_device(device)) | 139 | is_exclusive_device(device)) |
136 | return 0; | 140 | return 0; |
137 | 141 | ||
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 416d30debe6c..407b4eaddcbf 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (c) 2004 Matthieu Castet <castet.matthieu@free.fr> | 4 | * Copyright (c) 2004 Matthieu Castet <castet.matthieu@free.fr> |
5 | * Copyright (c) 2004 Li Shaohua <shaohua.li@intel.com> | 5 | * Copyright (c) 2004 Li Shaohua <shaohua.li@intel.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms of the GNU General Public License as published by the | 8 | * under the terms of the GNU General Public License as published by the |
9 | * Free Software Foundation; either version 2, or (at your option) any | 9 | * Free Software Foundation; either version 2, or (at your option) any |
@@ -32,17 +32,17 @@ | |||
32 | /* | 32 | /* |
33 | * Allocated Resources | 33 | * Allocated Resources |
34 | */ | 34 | */ |
35 | static int irq_flags(int edge_level, int active_high_low) | 35 | static int irq_flags(int triggering, int polarity) |
36 | { | 36 | { |
37 | int flag; | 37 | int flag; |
38 | if (edge_level == ACPI_LEVEL_SENSITIVE) { | 38 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
39 | if(active_high_low == ACPI_ACTIVE_LOW) | 39 | if(polarity == ACPI_ACTIVE_LOW) |
40 | flag = IORESOURCE_IRQ_LOWLEVEL; | 40 | flag = IORESOURCE_IRQ_LOWLEVEL; |
41 | else | 41 | else |
42 | flag = IORESOURCE_IRQ_HIGHLEVEL; | 42 | flag = IORESOURCE_IRQ_HIGHLEVEL; |
43 | } | 43 | } |
44 | else { | 44 | else { |
45 | if(active_high_low == ACPI_ACTIVE_LOW) | 45 | if(polarity == ACPI_ACTIVE_LOW) |
46 | flag = IORESOURCE_IRQ_LOWEDGE; | 46 | flag = IORESOURCE_IRQ_LOWEDGE; |
47 | else | 47 | else |
48 | flag = IORESOURCE_IRQ_HIGHEDGE; | 48 | flag = IORESOURCE_IRQ_HIGHEDGE; |
@@ -50,31 +50,31 @@ static int irq_flags(int edge_level, int active_high_low) | |||
50 | return flag; | 50 | return flag; |
51 | } | 51 | } |
52 | 52 | ||
53 | static void decode_irq_flags(int flag, int *edge_level, int *active_high_low) | 53 | static void decode_irq_flags(int flag, int *triggering, int *polarity) |
54 | { | 54 | { |
55 | switch (flag) { | 55 | switch (flag) { |
56 | case IORESOURCE_IRQ_LOWLEVEL: | 56 | case IORESOURCE_IRQ_LOWLEVEL: |
57 | *edge_level = ACPI_LEVEL_SENSITIVE; | 57 | *triggering = ACPI_LEVEL_SENSITIVE; |
58 | *active_high_low = ACPI_ACTIVE_LOW; | 58 | *polarity = ACPI_ACTIVE_LOW; |
59 | break; | 59 | break; |
60 | case IORESOURCE_IRQ_HIGHLEVEL: | 60 | case IORESOURCE_IRQ_HIGHLEVEL: |
61 | *edge_level = ACPI_LEVEL_SENSITIVE; | 61 | *triggering = ACPI_LEVEL_SENSITIVE; |
62 | *active_high_low = ACPI_ACTIVE_HIGH; | 62 | *polarity = ACPI_ACTIVE_HIGH; |
63 | break; | 63 | break; |
64 | case IORESOURCE_IRQ_LOWEDGE: | 64 | case IORESOURCE_IRQ_LOWEDGE: |
65 | *edge_level = ACPI_EDGE_SENSITIVE; | 65 | *triggering = ACPI_EDGE_SENSITIVE; |
66 | *active_high_low = ACPI_ACTIVE_LOW; | 66 | *polarity = ACPI_ACTIVE_LOW; |
67 | break; | 67 | break; |
68 | case IORESOURCE_IRQ_HIGHEDGE: | 68 | case IORESOURCE_IRQ_HIGHEDGE: |
69 | *edge_level = ACPI_EDGE_SENSITIVE; | 69 | *triggering = ACPI_EDGE_SENSITIVE; |
70 | *active_high_low = ACPI_ACTIVE_HIGH; | 70 | *polarity = ACPI_ACTIVE_HIGH; |
71 | break; | 71 | break; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | static void | 75 | static void |
76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | 76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, |
77 | int edge_level, int active_high_low) | 77 | int triggering, int polarity) |
78 | { | 78 | { |
79 | int i = 0; | 79 | int i = 0; |
80 | int irq; | 80 | int irq; |
@@ -89,7 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | |||
89 | return; | 89 | return; |
90 | 90 | ||
91 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 91 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
92 | irq = acpi_register_gsi(gsi, edge_level, active_high_low); | 92 | irq = acpi_register_gsi(gsi, triggering, polarity); |
93 | if (irq < 0) { | 93 | if (irq < 0) { |
94 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; | 94 | res->irq_resource[i].flags |= IORESOURCE_DISABLED; |
95 | return; | 95 | return; |
@@ -163,77 +163,96 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
163 | struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; | 163 | struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; |
164 | int i; | 164 | int i; |
165 | 165 | ||
166 | switch (res->id) { | 166 | switch (res->type) { |
167 | case ACPI_RSTYPE_IRQ: | 167 | case ACPI_RESOURCE_TYPE_IRQ: |
168 | /* | 168 | /* |
169 | * Per spec, only one interrupt per descriptor is allowed in | 169 | * Per spec, only one interrupt per descriptor is allowed in |
170 | * _CRS, but some firmware violates this, so parse them all. | 170 | * _CRS, but some firmware violates this, so parse them all. |
171 | */ | 171 | */ |
172 | for (i = 0; i < res->data.irq.number_of_interrupts; i++) { | 172 | for (i = 0; i < res->data.irq.interrupt_count; i++) { |
173 | pnpacpi_parse_allocated_irqresource(res_table, | 173 | pnpacpi_parse_allocated_irqresource(res_table, |
174 | res->data.irq.interrupts[i], | 174 | res->data.irq.interrupts[i], |
175 | res->data.irq.edge_level, | 175 | res->data.irq.triggering, |
176 | res->data.irq.active_high_low); | 176 | res->data.irq.polarity); |
177 | } | 177 | } |
178 | break; | 178 | break; |
179 | 179 | ||
180 | case ACPI_RSTYPE_EXT_IRQ: | 180 | case ACPI_RESOURCE_TYPE_DMA: |
181 | for (i = 0; i < res->data.extended_irq.number_of_interrupts; i++) { | 181 | if (res->data.dma.channel_count > 0) |
182 | pnpacpi_parse_allocated_irqresource(res_table, | 182 | pnpacpi_parse_allocated_dmaresource(res_table, |
183 | res->data.extended_irq.interrupts[i], | ||
184 | res->data.extended_irq.edge_level, | ||
185 | res->data.extended_irq.active_high_low); | ||
186 | } | ||
187 | break; | ||
188 | case ACPI_RSTYPE_DMA: | ||
189 | if (res->data.dma.number_of_channels > 0) | ||
190 | pnpacpi_parse_allocated_dmaresource(res_table, | ||
191 | res->data.dma.channels[0]); | 183 | res->data.dma.channels[0]); |
192 | break; | 184 | break; |
193 | case ACPI_RSTYPE_IO: | 185 | |
194 | pnpacpi_parse_allocated_ioresource(res_table, | 186 | case ACPI_RESOURCE_TYPE_IO: |
195 | res->data.io.min_base_address, | 187 | pnpacpi_parse_allocated_ioresource(res_table, |
196 | res->data.io.range_length); | 188 | res->data.io.minimum, |
189 | res->data.io.address_length); | ||
197 | break; | 190 | break; |
198 | case ACPI_RSTYPE_FIXED_IO: | 191 | |
199 | pnpacpi_parse_allocated_ioresource(res_table, | 192 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
200 | res->data.fixed_io.base_address, | 193 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: |
201 | res->data.fixed_io.range_length); | ||
202 | break; | 194 | break; |
203 | case ACPI_RSTYPE_MEM24: | 195 | |
204 | pnpacpi_parse_allocated_memresource(res_table, | 196 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
205 | res->data.memory24.min_base_address, | 197 | pnpacpi_parse_allocated_ioresource(res_table, |
206 | res->data.memory24.range_length); | 198 | res->data.fixed_io.address, |
199 | res->data.fixed_io.address_length); | ||
200 | break; | ||
201 | |||
202 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
207 | break; | 203 | break; |
208 | case ACPI_RSTYPE_MEM32: | 204 | |
209 | pnpacpi_parse_allocated_memresource(res_table, | 205 | case ACPI_RESOURCE_TYPE_END_TAG: |
210 | res->data.memory32.min_base_address, | 206 | break; |
211 | res->data.memory32.range_length); | 207 | |
208 | case ACPI_RESOURCE_TYPE_MEMORY24: | ||
209 | pnpacpi_parse_allocated_memresource(res_table, | ||
210 | res->data.memory24.minimum, | ||
211 | res->data.memory24.address_length); | ||
212 | break; | 212 | break; |
213 | case ACPI_RSTYPE_FIXED_MEM32: | 213 | case ACPI_RESOURCE_TYPE_MEMORY32: |
214 | pnpacpi_parse_allocated_memresource(res_table, | 214 | pnpacpi_parse_allocated_memresource(res_table, |
215 | res->data.fixed_memory32.range_base_address, | 215 | res->data.memory32.minimum, |
216 | res->data.fixed_memory32.range_length); | 216 | res->data.memory32.address_length); |
217 | break; | 217 | break; |
218 | case ACPI_RSTYPE_ADDRESS16: | 218 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
219 | pnpacpi_parse_allocated_memresource(res_table, | 219 | pnpacpi_parse_allocated_memresource(res_table, |
220 | res->data.address16.min_address_range, | 220 | res->data.fixed_memory32.address, |
221 | res->data.fixed_memory32.address_length); | ||
222 | break; | ||
223 | case ACPI_RESOURCE_TYPE_ADDRESS16: | ||
224 | pnpacpi_parse_allocated_memresource(res_table, | ||
225 | res->data.address16.minimum, | ||
221 | res->data.address16.address_length); | 226 | res->data.address16.address_length); |
222 | break; | 227 | break; |
223 | case ACPI_RSTYPE_ADDRESS32: | 228 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
224 | pnpacpi_parse_allocated_memresource(res_table, | 229 | pnpacpi_parse_allocated_memresource(res_table, |
225 | res->data.address32.min_address_range, | 230 | res->data.address32.minimum, |
226 | res->data.address32.address_length); | 231 | res->data.address32.address_length); |
227 | break; | 232 | break; |
228 | case ACPI_RSTYPE_ADDRESS64: | 233 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
229 | pnpacpi_parse_allocated_memresource(res_table, | 234 | pnpacpi_parse_allocated_memresource(res_table, |
230 | res->data.address64.min_address_range, | 235 | res->data.address64.minimum, |
231 | res->data.address64.address_length); | 236 | res->data.address64.address_length); |
232 | break; | 237 | break; |
233 | case ACPI_RSTYPE_VENDOR: | 238 | |
239 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | ||
240 | break; | ||
241 | |||
242 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | ||
243 | for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { | ||
244 | pnpacpi_parse_allocated_irqresource(res_table, | ||
245 | res->data.extended_irq.interrupts[i], | ||
246 | res->data.extended_irq.triggering, | ||
247 | res->data.extended_irq.polarity); | ||
248 | } | ||
249 | break; | ||
250 | |||
251 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
234 | break; | 252 | break; |
253 | |||
235 | default: | 254 | default: |
236 | pnp_warn("PnPACPI: unknown resource type %d", res->id); | 255 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
237 | return AE_ERROR; | 256 | return AE_ERROR; |
238 | } | 257 | } |
239 | 258 | ||
@@ -253,13 +272,13 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
253 | int i; | 272 | int i; |
254 | struct pnp_dma * dma; | 273 | struct pnp_dma * dma; |
255 | 274 | ||
256 | if (p->number_of_channels == 0) | 275 | if (p->channel_count == 0) |
257 | return; | 276 | return; |
258 | dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); | 277 | dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); |
259 | if (!dma) | 278 | if (!dma) |
260 | return; | 279 | return; |
261 | 280 | ||
262 | for(i = 0; i < p->number_of_channels; i++) | 281 | for(i = 0; i < p->channel_count; i++) |
263 | dma->map |= 1 << p->channels[i]; | 282 | dma->map |= 1 << p->channels[i]; |
264 | dma->flags = 0; | 283 | dma->flags = 0; |
265 | if (p->bus_master) | 284 | if (p->bus_master) |
@@ -309,37 +328,37 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option, | |||
309 | int i; | 328 | int i; |
310 | struct pnp_irq * irq; | 329 | struct pnp_irq * irq; |
311 | 330 | ||
312 | if (p->number_of_interrupts == 0) | 331 | if (p->interrupt_count == 0) |
313 | return; | 332 | return; |
314 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 333 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); |
315 | if (!irq) | 334 | if (!irq) |
316 | return; | 335 | return; |
317 | 336 | ||
318 | for(i = 0; i < p->number_of_interrupts; i++) | 337 | for(i = 0; i < p->interrupt_count; i++) |
319 | if (p->interrupts[i]) | 338 | if (p->interrupts[i]) |
320 | __set_bit(p->interrupts[i], irq->map); | 339 | __set_bit(p->interrupts[i], irq->map); |
321 | irq->flags = irq_flags(p->edge_level, p->active_high_low); | 340 | irq->flags = irq_flags(p->triggering, p->polarity); |
322 | 341 | ||
323 | pnp_register_irq_resource(option, irq); | 342 | pnp_register_irq_resource(option, irq); |
324 | return; | 343 | return; |
325 | } | 344 | } |
326 | 345 | ||
327 | static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, | 346 | static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, |
328 | struct acpi_resource_ext_irq *p) | 347 | struct acpi_resource_extended_irq *p) |
329 | { | 348 | { |
330 | int i; | 349 | int i; |
331 | struct pnp_irq * irq; | 350 | struct pnp_irq * irq; |
332 | 351 | ||
333 | if (p->number_of_interrupts == 0) | 352 | if (p->interrupt_count == 0) |
334 | return; | 353 | return; |
335 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 354 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); |
336 | if (!irq) | 355 | if (!irq) |
337 | return; | 356 | return; |
338 | 357 | ||
339 | for(i = 0; i < p->number_of_interrupts; i++) | 358 | for(i = 0; i < p->interrupt_count; i++) |
340 | if (p->interrupts[i]) | 359 | if (p->interrupts[i]) |
341 | __set_bit(p->interrupts[i], irq->map); | 360 | __set_bit(p->interrupts[i], irq->map); |
342 | irq->flags = irq_flags(p->edge_level, p->active_high_low); | 361 | irq->flags = irq_flags(p->triggering, p->polarity); |
343 | 362 | ||
344 | pnp_register_irq_resource(option, irq); | 363 | pnp_register_irq_resource(option, irq); |
345 | return; | 364 | return; |
@@ -351,16 +370,16 @@ pnpacpi_parse_port_option(struct pnp_option *option, | |||
351 | { | 370 | { |
352 | struct pnp_port * port; | 371 | struct pnp_port * port; |
353 | 372 | ||
354 | if (io->range_length == 0) | 373 | if (io->address_length == 0) |
355 | return; | 374 | return; |
356 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 375 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
357 | if (!port) | 376 | if (!port) |
358 | return; | 377 | return; |
359 | port->min = io->min_base_address; | 378 | port->min = io->minimum; |
360 | port->max = io->max_base_address; | 379 | port->max = io->maximum; |
361 | port->align = io->alignment; | 380 | port->align = io->alignment; |
362 | port->size = io->range_length; | 381 | port->size = io->address_length; |
363 | port->flags = ACPI_DECODE_16 == io->io_decode ? | 382 | port->flags = ACPI_DECODE_16 == io->io_decode ? |
364 | PNP_PORT_FLAG_16BITADDR : 0; | 383 | PNP_PORT_FLAG_16BITADDR : 0; |
365 | pnp_register_port_resource(option,port); | 384 | pnp_register_port_resource(option,port); |
366 | return; | 385 | return; |
@@ -372,13 +391,13 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
372 | { | 391 | { |
373 | struct pnp_port * port; | 392 | struct pnp_port * port; |
374 | 393 | ||
375 | if (io->range_length == 0) | 394 | if (io->address_length == 0) |
376 | return; | 395 | return; |
377 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 396 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
378 | if (!port) | 397 | if (!port) |
379 | return; | 398 | return; |
380 | port->min = port->max = io->base_address; | 399 | port->min = port->max = io->address; |
381 | port->size = io->range_length; | 400 | port->size = io->address_length; |
382 | port->align = 0; | 401 | port->align = 0; |
383 | port->flags = PNP_PORT_FLAG_FIXED; | 402 | port->flags = PNP_PORT_FLAG_FIXED; |
384 | pnp_register_port_resource(option,port); | 403 | pnp_register_port_resource(option,port); |
@@ -387,21 +406,21 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
387 | 406 | ||
388 | static void | 407 | static void |
389 | pnpacpi_parse_mem24_option(struct pnp_option *option, | 408 | pnpacpi_parse_mem24_option(struct pnp_option *option, |
390 | struct acpi_resource_mem24 *p) | 409 | struct acpi_resource_memory24 *p) |
391 | { | 410 | { |
392 | struct pnp_mem * mem; | 411 | struct pnp_mem * mem; |
393 | 412 | ||
394 | if (p->range_length == 0) | 413 | if (p->address_length == 0) |
395 | return; | 414 | return; |
396 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 415 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); |
397 | if (!mem) | 416 | if (!mem) |
398 | return; | 417 | return; |
399 | mem->min = p->min_base_address; | 418 | mem->min = p->minimum; |
400 | mem->max = p->max_base_address; | 419 | mem->max = p->maximum; |
401 | mem->align = p->alignment; | 420 | mem->align = p->alignment; |
402 | mem->size = p->range_length; | 421 | mem->size = p->address_length; |
403 | 422 | ||
404 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? | 423 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
405 | IORESOURCE_MEM_WRITEABLE : 0; | 424 | IORESOURCE_MEM_WRITEABLE : 0; |
406 | 425 | ||
407 | pnp_register_mem_resource(option,mem); | 426 | pnp_register_mem_resource(option,mem); |
@@ -410,21 +429,21 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, | |||
410 | 429 | ||
411 | static void | 430 | static void |
412 | pnpacpi_parse_mem32_option(struct pnp_option *option, | 431 | pnpacpi_parse_mem32_option(struct pnp_option *option, |
413 | struct acpi_resource_mem32 *p) | 432 | struct acpi_resource_memory32 *p) |
414 | { | 433 | { |
415 | struct pnp_mem * mem; | 434 | struct pnp_mem * mem; |
416 | 435 | ||
417 | if (p->range_length == 0) | 436 | if (p->address_length == 0) |
418 | return; | 437 | return; |
419 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 438 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); |
420 | if (!mem) | 439 | if (!mem) |
421 | return; | 440 | return; |
422 | mem->min = p->min_base_address; | 441 | mem->min = p->minimum; |
423 | mem->max = p->max_base_address; | 442 | mem->max = p->maximum; |
424 | mem->align = p->alignment; | 443 | mem->align = p->alignment; |
425 | mem->size = p->range_length; | 444 | mem->size = p->address_length; |
426 | 445 | ||
427 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? | 446 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
428 | IORESOURCE_MEM_WRITEABLE : 0; | 447 | IORESOURCE_MEM_WRITEABLE : 0; |
429 | 448 | ||
430 | pnp_register_mem_resource(option,mem); | 449 | pnp_register_mem_resource(option,mem); |
@@ -433,33 +452,72 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, | |||
433 | 452 | ||
434 | static void | 453 | static void |
435 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | 454 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, |
436 | struct acpi_resource_fixed_mem32 *p) | 455 | struct acpi_resource_fixed_memory32 *p) |
437 | { | 456 | { |
438 | struct pnp_mem * mem; | 457 | struct pnp_mem * mem; |
439 | 458 | ||
440 | if (p->range_length == 0) | 459 | if (p->address_length == 0) |
441 | return; | 460 | return; |
442 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 461 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); |
443 | if (!mem) | 462 | if (!mem) |
444 | return; | 463 | return; |
445 | mem->min = mem->max = p->range_base_address; | 464 | mem->min = mem->max = p->address; |
446 | mem->size = p->range_length; | 465 | mem->size = p->address_length; |
447 | mem->align = 0; | 466 | mem->align = 0; |
448 | 467 | ||
449 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? | 468 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
450 | IORESOURCE_MEM_WRITEABLE : 0; | 469 | IORESOURCE_MEM_WRITEABLE : 0; |
451 | 470 | ||
452 | pnp_register_mem_resource(option,mem); | 471 | pnp_register_mem_resource(option,mem); |
453 | return; | 472 | return; |
454 | } | 473 | } |
455 | 474 | ||
475 | static void | ||
476 | pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | ||
477 | { | ||
478 | struct acpi_resource_address64 addr, *p = &addr; | ||
479 | acpi_status status; | ||
480 | struct pnp_mem * mem; | ||
481 | struct pnp_port * port; | ||
482 | |||
483 | status = acpi_resource_to_address64(r, p); | ||
484 | if (!ACPI_SUCCESS(status)) { | ||
485 | pnp_warn("PnPACPI: failed to convert resource type %d", r->type); | ||
486 | return; | ||
487 | } | ||
488 | |||
489 | if (p->address_length == 0) | ||
490 | return; | ||
491 | |||
492 | if (p->resource_type == ACPI_MEMORY_RANGE) { | ||
493 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | ||
494 | if (!mem) | ||
495 | return; | ||
496 | mem->min = mem->max = p->minimum; | ||
497 | mem->size = p->address_length; | ||
498 | mem->align = 0; | ||
499 | mem->flags = (p->info.mem.write_protect == | ||
500 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; | ||
501 | pnp_register_mem_resource(option,mem); | ||
502 | } else if (p->resource_type == ACPI_IO_RANGE) { | ||
503 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | ||
504 | if (!port) | ||
505 | return; | ||
506 | port->min = port->max = p->minimum; | ||
507 | port->size = p->address_length; | ||
508 | port->align = 0; | ||
509 | port->flags = PNP_PORT_FLAG_FIXED; | ||
510 | pnp_register_port_resource(option,port); | ||
511 | } | ||
512 | } | ||
513 | |||
456 | struct acpipnp_parse_option_s { | 514 | struct acpipnp_parse_option_s { |
457 | struct pnp_option *option; | 515 | struct pnp_option *option; |
458 | struct pnp_option *option_independent; | 516 | struct pnp_option *option_independent; |
459 | struct pnp_dev *dev; | 517 | struct pnp_dev *dev; |
460 | }; | 518 | }; |
461 | 519 | ||
462 | static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | 520 | static acpi_status pnpacpi_option_resource(struct acpi_resource *res, |
463 | void *data) | 521 | void *data) |
464 | { | 522 | { |
465 | int priority = 0; | 523 | int priority = 0; |
@@ -467,35 +525,16 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
467 | struct pnp_dev *dev = parse_data->dev; | 525 | struct pnp_dev *dev = parse_data->dev; |
468 | struct pnp_option *option = parse_data->option; | 526 | struct pnp_option *option = parse_data->option; |
469 | 527 | ||
470 | switch (res->id) { | 528 | switch (res->type) { |
471 | case ACPI_RSTYPE_IRQ: | 529 | case ACPI_RESOURCE_TYPE_IRQ: |
472 | pnpacpi_parse_irq_option(option, &res->data.irq); | 530 | pnpacpi_parse_irq_option(option, &res->data.irq); |
473 | break; | 531 | break; |
474 | case ACPI_RSTYPE_EXT_IRQ: | 532 | |
475 | pnpacpi_parse_ext_irq_option(option, | 533 | case ACPI_RESOURCE_TYPE_DMA: |
476 | &res->data.extended_irq); | ||
477 | break; | ||
478 | case ACPI_RSTYPE_DMA: | ||
479 | pnpacpi_parse_dma_option(option, &res->data.dma); | 534 | pnpacpi_parse_dma_option(option, &res->data.dma); |
480 | break; | 535 | break; |
481 | case ACPI_RSTYPE_IO: | 536 | |
482 | pnpacpi_parse_port_option(option, &res->data.io); | 537 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
483 | break; | ||
484 | case ACPI_RSTYPE_FIXED_IO: | ||
485 | pnpacpi_parse_fixed_port_option(option, | ||
486 | &res->data.fixed_io); | ||
487 | break; | ||
488 | case ACPI_RSTYPE_MEM24: | ||
489 | pnpacpi_parse_mem24_option(option, &res->data.memory24); | ||
490 | break; | ||
491 | case ACPI_RSTYPE_MEM32: | ||
492 | pnpacpi_parse_mem32_option(option, &res->data.memory32); | ||
493 | break; | ||
494 | case ACPI_RSTYPE_FIXED_MEM32: | ||
495 | pnpacpi_parse_fixed_mem32_option(option, | ||
496 | &res->data.fixed_memory32); | ||
497 | break; | ||
498 | case ACPI_RSTYPE_START_DPF: | ||
499 | switch (res->data.start_dpf.compatibility_priority) { | 538 | switch (res->data.start_dpf.compatibility_priority) { |
500 | case ACPI_GOOD_CONFIGURATION: | 539 | case ACPI_GOOD_CONFIGURATION: |
501 | priority = PNP_RES_PRIORITY_PREFERRED; | 540 | priority = PNP_RES_PRIORITY_PREFERRED; |
@@ -518,7 +557,8 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
518 | return AE_ERROR; | 557 | return AE_ERROR; |
519 | parse_data->option = option; | 558 | parse_data->option = option; |
520 | break; | 559 | break; |
521 | case ACPI_RSTYPE_END_DPF: | 560 | |
561 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
522 | /*only one EndDependentFn is allowed*/ | 562 | /*only one EndDependentFn is allowed*/ |
523 | if (!parse_data->option_independent) { | 563 | if (!parse_data->option_independent) { |
524 | pnp_warn("PnPACPI: more than one EndDependentFn"); | 564 | pnp_warn("PnPACPI: more than one EndDependentFn"); |
@@ -527,15 +567,59 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
527 | parse_data->option = parse_data->option_independent; | 567 | parse_data->option = parse_data->option_independent; |
528 | parse_data->option_independent = NULL; | 568 | parse_data->option_independent = NULL; |
529 | break; | 569 | break; |
570 | |||
571 | case ACPI_RESOURCE_TYPE_IO: | ||
572 | pnpacpi_parse_port_option(option, &res->data.io); | ||
573 | break; | ||
574 | |||
575 | case ACPI_RESOURCE_TYPE_FIXED_IO: | ||
576 | pnpacpi_parse_fixed_port_option(option, | ||
577 | &res->data.fixed_io); | ||
578 | break; | ||
579 | |||
580 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
581 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
582 | break; | ||
583 | |||
584 | case ACPI_RESOURCE_TYPE_MEMORY24: | ||
585 | pnpacpi_parse_mem24_option(option, &res->data.memory24); | ||
586 | break; | ||
587 | |||
588 | case ACPI_RESOURCE_TYPE_MEMORY32: | ||
589 | pnpacpi_parse_mem32_option(option, &res->data.memory32); | ||
590 | break; | ||
591 | |||
592 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | ||
593 | pnpacpi_parse_fixed_mem32_option(option, | ||
594 | &res->data.fixed_memory32); | ||
595 | break; | ||
596 | |||
597 | case ACPI_RESOURCE_TYPE_ADDRESS16: | ||
598 | case ACPI_RESOURCE_TYPE_ADDRESS32: | ||
599 | case ACPI_RESOURCE_TYPE_ADDRESS64: | ||
600 | pnpacpi_parse_address_option(option, res); | ||
601 | break; | ||
602 | |||
603 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | ||
604 | break; | ||
605 | |||
606 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | ||
607 | pnpacpi_parse_ext_irq_option(option, | ||
608 | &res->data.extended_irq); | ||
609 | break; | ||
610 | |||
611 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
612 | break; | ||
613 | |||
530 | default: | 614 | default: |
531 | pnp_warn("PnPACPI: unknown resource type %d", res->id); | 615 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
532 | return AE_ERROR; | 616 | return AE_ERROR; |
533 | } | 617 | } |
534 | 618 | ||
535 | return AE_OK; | 619 | return AE_OK; |
536 | } | 620 | } |
537 | 621 | ||
538 | acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | 622 | acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, |
539 | struct pnp_dev *dev) | 623 | struct pnp_dev *dev) |
540 | { | 624 | { |
541 | acpi_status status; | 625 | acpi_status status; |
@@ -546,7 +630,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | |||
546 | return AE_ERROR; | 630 | return AE_ERROR; |
547 | parse_data.option_independent = parse_data.option; | 631 | parse_data.option_independent = parse_data.option; |
548 | parse_data.dev = dev; | 632 | parse_data.dev = dev; |
549 | status = acpi_walk_resources(handle, METHOD_NAME__PRS, | 633 | status = acpi_walk_resources(handle, METHOD_NAME__PRS, |
550 | pnpacpi_option_resource, &parse_data); | 634 | pnpacpi_option_resource, &parse_data); |
551 | 635 | ||
552 | return status; | 636 | return status; |
@@ -559,21 +643,24 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | |||
559 | void *data) | 643 | void *data) |
560 | { | 644 | { |
561 | int *res_cnt = (int *)data; | 645 | int *res_cnt = (int *)data; |
562 | switch (res->id) { | 646 | switch (res->type) { |
563 | case ACPI_RSTYPE_IRQ: | 647 | case ACPI_RESOURCE_TYPE_IRQ: |
564 | case ACPI_RSTYPE_EXT_IRQ: | 648 | case ACPI_RESOURCE_TYPE_DMA: |
565 | case ACPI_RSTYPE_DMA: | 649 | case ACPI_RESOURCE_TYPE_IO: |
566 | case ACPI_RSTYPE_IO: | 650 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
567 | case ACPI_RSTYPE_FIXED_IO: | 651 | case ACPI_RESOURCE_TYPE_MEMORY24: |
568 | case ACPI_RSTYPE_MEM24: | 652 | case ACPI_RESOURCE_TYPE_MEMORY32: |
569 | case ACPI_RSTYPE_MEM32: | 653 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
570 | case ACPI_RSTYPE_FIXED_MEM32: | 654 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
571 | #if 0 | 655 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
572 | case ACPI_RSTYPE_ADDRESS16: | 656 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
573 | case ACPI_RSTYPE_ADDRESS32: | 657 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
574 | case ACPI_RSTYPE_ADDRESS64: | ||
575 | #endif | ||
576 | (*res_cnt) ++; | 658 | (*res_cnt) ++; |
659 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
660 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
661 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
662 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
663 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
577 | default: | 664 | default: |
578 | return AE_OK; | 665 | return AE_OK; |
579 | } | 666 | } |
@@ -584,22 +671,25 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | |||
584 | void *data) | 671 | void *data) |
585 | { | 672 | { |
586 | struct acpi_resource **resource = (struct acpi_resource **)data; | 673 | struct acpi_resource **resource = (struct acpi_resource **)data; |
587 | switch (res->id) { | 674 | switch (res->type) { |
588 | case ACPI_RSTYPE_IRQ: | 675 | case ACPI_RESOURCE_TYPE_IRQ: |
589 | case ACPI_RSTYPE_EXT_IRQ: | 676 | case ACPI_RESOURCE_TYPE_DMA: |
590 | case ACPI_RSTYPE_DMA: | 677 | case ACPI_RESOURCE_TYPE_IO: |
591 | case ACPI_RSTYPE_IO: | 678 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
592 | case ACPI_RSTYPE_FIXED_IO: | 679 | case ACPI_RESOURCE_TYPE_MEMORY24: |
593 | case ACPI_RSTYPE_MEM24: | 680 | case ACPI_RESOURCE_TYPE_MEMORY32: |
594 | case ACPI_RSTYPE_MEM32: | 681 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
595 | case ACPI_RSTYPE_FIXED_MEM32: | 682 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
596 | #if 0 | 683 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
597 | case ACPI_RSTYPE_ADDRESS16: | 684 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
598 | case ACPI_RSTYPE_ADDRESS32: | 685 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
599 | case ACPI_RSTYPE_ADDRESS64: | 686 | (*resource)->type = res->type; |
600 | #endif | ||
601 | (*resource)->id = res->id; | ||
602 | (*resource)++; | 687 | (*resource)++; |
688 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
689 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
690 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
691 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
692 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
603 | default: | 693 | default: |
604 | return AE_OK; | 694 | return AE_OK; |
605 | } | 695 | } |
@@ -607,14 +697,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | |||
607 | return AE_OK; | 697 | return AE_OK; |
608 | } | 698 | } |
609 | 699 | ||
610 | int pnpacpi_build_resource_template(acpi_handle handle, | 700 | int pnpacpi_build_resource_template(acpi_handle handle, |
611 | struct acpi_buffer *buffer) | 701 | struct acpi_buffer *buffer) |
612 | { | 702 | { |
613 | struct acpi_resource *resource; | 703 | struct acpi_resource *resource; |
614 | int res_cnt = 0; | 704 | int res_cnt = 0; |
615 | acpi_status status; | 705 | acpi_status status; |
616 | 706 | ||
617 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 707 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
618 | pnpacpi_count_resources, &res_cnt); | 708 | pnpacpi_count_resources, &res_cnt); |
619 | if (ACPI_FAILURE(status)) { | 709 | if (ACPI_FAILURE(status)) { |
620 | pnp_err("Evaluate _CRS failed"); | 710 | pnp_err("Evaluate _CRS failed"); |
@@ -628,7 +718,7 @@ int pnpacpi_build_resource_template(acpi_handle handle, | |||
628 | return -ENOMEM; | 718 | return -ENOMEM; |
629 | pnp_dbg("Res cnt %d", res_cnt); | 719 | pnp_dbg("Res cnt %d", res_cnt); |
630 | resource = (struct acpi_resource *)buffer->pointer; | 720 | resource = (struct acpi_resource *)buffer->pointer; |
631 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 721 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
632 | pnpacpi_type_resources, &resource); | 722 | pnpacpi_type_resources, &resource); |
633 | if (ACPI_FAILURE(status)) { | 723 | if (ACPI_FAILURE(status)) { |
634 | kfree(buffer->pointer); | 724 | kfree(buffer->pointer); |
@@ -636,54 +726,54 @@ int pnpacpi_build_resource_template(acpi_handle handle, | |||
636 | return -EINVAL; | 726 | return -EINVAL; |
637 | } | 727 | } |
638 | /* resource will pointer the end resource now */ | 728 | /* resource will pointer the end resource now */ |
639 | resource->id = ACPI_RSTYPE_END_TAG; | 729 | resource->type = ACPI_RESOURCE_TYPE_END_TAG; |
640 | 730 | ||
641 | return 0; | 731 | return 0; |
642 | } | 732 | } |
643 | 733 | ||
644 | static void pnpacpi_encode_irq(struct acpi_resource *resource, | 734 | static void pnpacpi_encode_irq(struct acpi_resource *resource, |
645 | struct resource *p) | 735 | struct resource *p) |
646 | { | 736 | { |
647 | int edge_level, active_high_low; | 737 | int triggering, polarity; |
648 | 738 | ||
649 | decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, | 739 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, |
650 | &active_high_low); | 740 | &polarity); |
651 | resource->id = ACPI_RSTYPE_IRQ; | 741 | resource->type = ACPI_RESOURCE_TYPE_IRQ; |
652 | resource->length = sizeof(struct acpi_resource); | 742 | resource->length = sizeof(struct acpi_resource); |
653 | resource->data.irq.edge_level = edge_level; | 743 | resource->data.irq.triggering = triggering; |
654 | resource->data.irq.active_high_low = active_high_low; | 744 | resource->data.irq.polarity = polarity; |
655 | if (edge_level == ACPI_EDGE_SENSITIVE) | 745 | if (triggering == ACPI_EDGE_SENSITIVE) |
656 | resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 746 | resource->data.irq.sharable = ACPI_EXCLUSIVE; |
657 | else | 747 | else |
658 | resource->data.irq.shared_exclusive = ACPI_SHARED; | 748 | resource->data.irq.sharable = ACPI_SHARED; |
659 | resource->data.irq.number_of_interrupts = 1; | 749 | resource->data.irq.interrupt_count = 1; |
660 | resource->data.irq.interrupts[0] = p->start; | 750 | resource->data.irq.interrupts[0] = p->start; |
661 | } | 751 | } |
662 | 752 | ||
663 | static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | 753 | static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, |
664 | struct resource *p) | 754 | struct resource *p) |
665 | { | 755 | { |
666 | int edge_level, active_high_low; | 756 | int triggering, polarity; |
667 | 757 | ||
668 | decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, | 758 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, |
669 | &active_high_low); | 759 | &polarity); |
670 | resource->id = ACPI_RSTYPE_EXT_IRQ; | 760 | resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; |
671 | resource->length = sizeof(struct acpi_resource); | 761 | resource->length = sizeof(struct acpi_resource); |
672 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; | 762 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; |
673 | resource->data.extended_irq.edge_level = edge_level; | 763 | resource->data.extended_irq.triggering = triggering; |
674 | resource->data.extended_irq.active_high_low = active_high_low; | 764 | resource->data.extended_irq.polarity = polarity; |
675 | if (edge_level == ACPI_EDGE_SENSITIVE) | 765 | if (triggering == ACPI_EDGE_SENSITIVE) |
676 | resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 766 | resource->data.irq.sharable = ACPI_EXCLUSIVE; |
677 | else | 767 | else |
678 | resource->data.irq.shared_exclusive = ACPI_SHARED; | 768 | resource->data.irq.sharable = ACPI_SHARED; |
679 | resource->data.extended_irq.number_of_interrupts = 1; | 769 | resource->data.extended_irq.interrupt_count = 1; |
680 | resource->data.extended_irq.interrupts[0] = p->start; | 770 | resource->data.extended_irq.interrupts[0] = p->start; |
681 | } | 771 | } |
682 | 772 | ||
683 | static void pnpacpi_encode_dma(struct acpi_resource *resource, | 773 | static void pnpacpi_encode_dma(struct acpi_resource *resource, |
684 | struct resource *p) | 774 | struct resource *p) |
685 | { | 775 | { |
686 | resource->id = ACPI_RSTYPE_DMA; | 776 | resource->type = ACPI_RESOURCE_TYPE_DMA; |
687 | resource->length = sizeof(struct acpi_resource); | 777 | resource->length = sizeof(struct acpi_resource); |
688 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ | 778 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ |
689 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) | 779 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) |
@@ -701,75 +791,75 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, | |||
701 | else if (p->flags & IORESOURCE_DMA_16BIT) | 791 | else if (p->flags & IORESOURCE_DMA_16BIT) |
702 | resource->data.dma.transfer = ACPI_TRANSFER_16; | 792 | resource->data.dma.transfer = ACPI_TRANSFER_16; |
703 | resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; | 793 | resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; |
704 | resource->data.dma.number_of_channels = 1; | 794 | resource->data.dma.channel_count = 1; |
705 | resource->data.dma.channels[0] = p->start; | 795 | resource->data.dma.channels[0] = p->start; |
706 | } | 796 | } |
707 | 797 | ||
708 | static void pnpacpi_encode_io(struct acpi_resource *resource, | 798 | static void pnpacpi_encode_io(struct acpi_resource *resource, |
709 | struct resource *p) | 799 | struct resource *p) |
710 | { | 800 | { |
711 | resource->id = ACPI_RSTYPE_IO; | 801 | resource->type = ACPI_RESOURCE_TYPE_IO; |
712 | resource->length = sizeof(struct acpi_resource); | 802 | resource->length = sizeof(struct acpi_resource); |
713 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ | 803 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ |
714 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? | 804 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? |
715 | ACPI_DECODE_16 : ACPI_DECODE_10; | 805 | ACPI_DECODE_16 : ACPI_DECODE_10; |
716 | resource->data.io.min_base_address = p->start; | 806 | resource->data.io.minimum = p->start; |
717 | resource->data.io.max_base_address = p->end; | 807 | resource->data.io.maximum = p->end; |
718 | resource->data.io.alignment = 0; /* Correct? */ | 808 | resource->data.io.alignment = 0; /* Correct? */ |
719 | resource->data.io.range_length = p->end - p->start + 1; | 809 | resource->data.io.address_length = p->end - p->start + 1; |
720 | } | 810 | } |
721 | 811 | ||
722 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | 812 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, |
723 | struct resource *p) | 813 | struct resource *p) |
724 | { | 814 | { |
725 | resource->id = ACPI_RSTYPE_FIXED_IO; | 815 | resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; |
726 | resource->length = sizeof(struct acpi_resource); | 816 | resource->length = sizeof(struct acpi_resource); |
727 | resource->data.fixed_io.base_address = p->start; | 817 | resource->data.fixed_io.address = p->start; |
728 | resource->data.fixed_io.range_length = p->end - p->start + 1; | 818 | resource->data.fixed_io.address_length = p->end - p->start + 1; |
729 | } | 819 | } |
730 | 820 | ||
731 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, | 821 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, |
732 | struct resource *p) | 822 | struct resource *p) |
733 | { | 823 | { |
734 | resource->id = ACPI_RSTYPE_MEM24; | 824 | resource->type = ACPI_RESOURCE_TYPE_MEMORY24; |
735 | resource->length = sizeof(struct acpi_resource); | 825 | resource->length = sizeof(struct acpi_resource); |
736 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ | 826 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ |
737 | resource->data.memory24.read_write_attribute = | 827 | resource->data.memory24.write_protect = |
738 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 828 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
739 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 829 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
740 | resource->data.memory24.min_base_address = p->start; | 830 | resource->data.memory24.minimum = p->start; |
741 | resource->data.memory24.max_base_address = p->end; | 831 | resource->data.memory24.maximum = p->end; |
742 | resource->data.memory24.alignment = 0; | 832 | resource->data.memory24.alignment = 0; |
743 | resource->data.memory24.range_length = p->end - p->start + 1; | 833 | resource->data.memory24.address_length = p->end - p->start + 1; |
744 | } | 834 | } |
745 | 835 | ||
746 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, | 836 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, |
747 | struct resource *p) | 837 | struct resource *p) |
748 | { | 838 | { |
749 | resource->id = ACPI_RSTYPE_MEM32; | 839 | resource->type = ACPI_RESOURCE_TYPE_MEMORY32; |
750 | resource->length = sizeof(struct acpi_resource); | 840 | resource->length = sizeof(struct acpi_resource); |
751 | resource->data.memory32.read_write_attribute = | 841 | resource->data.memory32.write_protect = |
752 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 842 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
753 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 843 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
754 | resource->data.memory32.min_base_address = p->start; | 844 | resource->data.memory32.minimum = p->start; |
755 | resource->data.memory32.max_base_address = p->end; | 845 | resource->data.memory32.maximum = p->end; |
756 | resource->data.memory32.alignment = 0; | 846 | resource->data.memory32.alignment = 0; |
757 | resource->data.memory32.range_length = p->end - p->start + 1; | 847 | resource->data.memory32.address_length = p->end - p->start + 1; |
758 | } | 848 | } |
759 | 849 | ||
760 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | 850 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, |
761 | struct resource *p) | 851 | struct resource *p) |
762 | { | 852 | { |
763 | resource->id = ACPI_RSTYPE_FIXED_MEM32; | 853 | resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; |
764 | resource->length = sizeof(struct acpi_resource); | 854 | resource->length = sizeof(struct acpi_resource); |
765 | resource->data.fixed_memory32.read_write_attribute = | 855 | resource->data.fixed_memory32.write_protect = |
766 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 856 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
767 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 857 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
768 | resource->data.fixed_memory32.range_base_address = p->start; | 858 | resource->data.fixed_memory32.address = p->start; |
769 | resource->data.fixed_memory32.range_length = p->end - p->start + 1; | 859 | resource->data.fixed_memory32.address_length = p->end - p->start + 1; |
770 | } | 860 | } |
771 | 861 | ||
772 | int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | 862 | int pnpacpi_encode_resources(struct pnp_resource_table *res_table, |
773 | struct acpi_buffer *buffer) | 863 | struct acpi_buffer *buffer) |
774 | { | 864 | { |
775 | int i = 0; | 865 | int i = 0; |
@@ -780,58 +870,67 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
780 | 870 | ||
781 | pnp_dbg("res cnt %d", res_cnt); | 871 | pnp_dbg("res cnt %d", res_cnt); |
782 | while (i < res_cnt) { | 872 | while (i < res_cnt) { |
783 | switch(resource->id) { | 873 | switch(resource->type) { |
784 | case ACPI_RSTYPE_IRQ: | 874 | case ACPI_RESOURCE_TYPE_IRQ: |
785 | pnp_dbg("Encode irq"); | 875 | pnp_dbg("Encode irq"); |
786 | pnpacpi_encode_irq(resource, | 876 | pnpacpi_encode_irq(resource, |
787 | &res_table->irq_resource[irq]); | 877 | &res_table->irq_resource[irq]); |
788 | irq++; | 878 | irq++; |
789 | break; | 879 | break; |
790 | 880 | ||
791 | case ACPI_RSTYPE_EXT_IRQ: | 881 | case ACPI_RESOURCE_TYPE_DMA: |
792 | pnp_dbg("Encode ext irq"); | ||
793 | pnpacpi_encode_ext_irq(resource, | ||
794 | &res_table->irq_resource[irq]); | ||
795 | irq++; | ||
796 | break; | ||
797 | case ACPI_RSTYPE_DMA: | ||
798 | pnp_dbg("Encode dma"); | 882 | pnp_dbg("Encode dma"); |
799 | pnpacpi_encode_dma(resource, | 883 | pnpacpi_encode_dma(resource, |
800 | &res_table->dma_resource[dma]); | 884 | &res_table->dma_resource[dma]); |
801 | dma ++; | 885 | dma ++; |
802 | break; | 886 | break; |
803 | case ACPI_RSTYPE_IO: | 887 | case ACPI_RESOURCE_TYPE_IO: |
804 | pnp_dbg("Encode io"); | 888 | pnp_dbg("Encode io"); |
805 | pnpacpi_encode_io(resource, | 889 | pnpacpi_encode_io(resource, |
806 | &res_table->port_resource[port]); | 890 | &res_table->port_resource[port]); |
807 | port ++; | 891 | port ++; |
808 | break; | 892 | break; |
809 | case ACPI_RSTYPE_FIXED_IO: | 893 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
810 | pnp_dbg("Encode fixed io"); | 894 | pnp_dbg("Encode fixed io"); |
811 | pnpacpi_encode_fixed_io(resource, | 895 | pnpacpi_encode_fixed_io(resource, |
812 | &res_table->port_resource[port]); | 896 | &res_table->port_resource[port]); |
813 | port ++; | 897 | port ++; |
814 | break; | 898 | break; |
815 | case ACPI_RSTYPE_MEM24: | 899 | case ACPI_RESOURCE_TYPE_MEMORY24: |
816 | pnp_dbg("Encode mem24"); | 900 | pnp_dbg("Encode mem24"); |
817 | pnpacpi_encode_mem24(resource, | 901 | pnpacpi_encode_mem24(resource, |
818 | &res_table->mem_resource[mem]); | 902 | &res_table->mem_resource[mem]); |
819 | mem ++; | 903 | mem ++; |
820 | break; | 904 | break; |
821 | case ACPI_RSTYPE_MEM32: | 905 | case ACPI_RESOURCE_TYPE_MEMORY32: |
822 | pnp_dbg("Encode mem32"); | 906 | pnp_dbg("Encode mem32"); |
823 | pnpacpi_encode_mem32(resource, | 907 | pnpacpi_encode_mem32(resource, |
824 | &res_table->mem_resource[mem]); | 908 | &res_table->mem_resource[mem]); |
825 | mem ++; | 909 | mem ++; |
826 | break; | 910 | break; |
827 | case ACPI_RSTYPE_FIXED_MEM32: | 911 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
828 | pnp_dbg("Encode fixed mem32"); | 912 | pnp_dbg("Encode fixed mem32"); |
829 | pnpacpi_encode_fixed_mem32(resource, | 913 | pnpacpi_encode_fixed_mem32(resource, |
830 | &res_table->mem_resource[mem]); | 914 | &res_table->mem_resource[mem]); |
831 | mem ++; | 915 | mem ++; |
832 | break; | 916 | break; |
917 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | ||
918 | pnp_dbg("Encode ext irq"); | ||
919 | pnpacpi_encode_ext_irq(resource, | ||
920 | &res_table->irq_resource[irq]); | ||
921 | irq++; | ||
922 | break; | ||
923 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
924 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
925 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
926 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
927 | case ACPI_RESOURCE_TYPE_ADDRESS16: | ||
928 | case ACPI_RESOURCE_TYPE_ADDRESS32: | ||
929 | case ACPI_RESOURCE_TYPE_ADDRESS64: | ||
930 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | ||
931 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
833 | default: /* other type */ | 932 | default: /* other type */ |
834 | pnp_warn("unknown resource type %d", resource->id); | 933 | pnp_warn("unknown resource type %d", resource->type); |
835 | return -EINVAL; | 934 | return -EINVAL; |
836 | } | 935 | } |
837 | resource ++; | 936 | resource ++; |