diff options
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 517 |
1 files changed, 288 insertions, 229 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 2424bd3620dc..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); | ||
190 | break; | ||
191 | |||
192 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
193 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
194 | break; | ||
195 | |||
196 | case ACPI_RESOURCE_TYPE_FIXED_IO: | ||
197 | pnpacpi_parse_allocated_ioresource(res_table, | ||
198 | res->data.fixed_io.address, | ||
199 | res->data.fixed_io.address_length); | ||
200 | break; | ||
201 | |||
202 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
197 | break; | 203 | break; |
198 | case ACPI_RSTYPE_FIXED_IO: | 204 | |
199 | pnpacpi_parse_allocated_ioresource(res_table, | 205 | case ACPI_RESOURCE_TYPE_END_TAG: |
200 | res->data.fixed_io.base_address, | ||
201 | res->data.fixed_io.range_length); | ||
202 | break; | 206 | break; |
203 | case ACPI_RSTYPE_MEM24: | 207 | |
204 | pnpacpi_parse_allocated_memresource(res_table, | 208 | case ACPI_RESOURCE_TYPE_MEMORY24: |
205 | res->data.memory24.min_base_address, | 209 | pnpacpi_parse_allocated_memresource(res_table, |
206 | res->data.memory24.range_length); | 210 | res->data.memory24.minimum, |
211 | res->data.memory24.address_length); | ||
207 | break; | 212 | break; |
208 | case ACPI_RSTYPE_MEM32: | 213 | case ACPI_RESOURCE_TYPE_MEMORY32: |
209 | pnpacpi_parse_allocated_memresource(res_table, | 214 | pnpacpi_parse_allocated_memresource(res_table, |
210 | res->data.memory32.min_base_address, | 215 | res->data.memory32.minimum, |
211 | res->data.memory32.range_length); | 216 | res->data.memory32.address_length); |
212 | break; | 217 | break; |
213 | case ACPI_RSTYPE_FIXED_MEM32: | 218 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
214 | pnpacpi_parse_allocated_memresource(res_table, | 219 | pnpacpi_parse_allocated_memresource(res_table, |
215 | res->data.fixed_memory32.range_base_address, | 220 | res->data.fixed_memory32.address, |
216 | res->data.fixed_memory32.range_length); | 221 | res->data.fixed_memory32.address_length); |
217 | break; | 222 | break; |
218 | case ACPI_RSTYPE_ADDRESS16: | 223 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
219 | pnpacpi_parse_allocated_memresource(res_table, | 224 | pnpacpi_parse_allocated_memresource(res_table, |
220 | res->data.address16.min_address_range, | 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,20 +452,20 @@ 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); |
@@ -463,7 +482,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
463 | 482 | ||
464 | status = acpi_resource_to_address64(r, p); | 483 | status = acpi_resource_to_address64(r, p); |
465 | if (!ACPI_SUCCESS(status)) { | 484 | if (!ACPI_SUCCESS(status)) { |
466 | pnp_warn("PnPACPI: failed to convert resource type %d", r->id); | 485 | pnp_warn("PnPACPI: failed to convert resource type %d", r->type); |
467 | return; | 486 | return; |
468 | } | 487 | } |
469 | 488 | ||
@@ -474,17 +493,17 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
474 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 493 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); |
475 | if (!mem) | 494 | if (!mem) |
476 | return; | 495 | return; |
477 | mem->min = mem->max = p->min_address_range; | 496 | mem->min = mem->max = p->minimum; |
478 | mem->size = p->address_length; | 497 | mem->size = p->address_length; |
479 | mem->align = 0; | 498 | mem->align = 0; |
480 | mem->flags = (p->attribute.memory.read_write_attribute == | 499 | mem->flags = (p->info.mem.write_protect == |
481 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; | 500 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; |
482 | pnp_register_mem_resource(option,mem); | 501 | pnp_register_mem_resource(option,mem); |
483 | } else if (p->resource_type == ACPI_IO_RANGE) { | 502 | } else if (p->resource_type == ACPI_IO_RANGE) { |
484 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 503 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
485 | if (!port) | 504 | if (!port) |
486 | return; | 505 | return; |
487 | port->min = port->max = p->min_address_range; | 506 | port->min = port->max = p->minimum; |
488 | port->size = p->address_length; | 507 | port->size = p->address_length; |
489 | port->align = 0; | 508 | port->align = 0; |
490 | port->flags = PNP_PORT_FLAG_FIXED; | 509 | port->flags = PNP_PORT_FLAG_FIXED; |
@@ -498,7 +517,7 @@ struct acpipnp_parse_option_s { | |||
498 | struct pnp_dev *dev; | 517 | struct pnp_dev *dev; |
499 | }; | 518 | }; |
500 | 519 | ||
501 | static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | 520 | static acpi_status pnpacpi_option_resource(struct acpi_resource *res, |
502 | void *data) | 521 | void *data) |
503 | { | 522 | { |
504 | int priority = 0; | 523 | int priority = 0; |
@@ -506,40 +525,16 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
506 | struct pnp_dev *dev = parse_data->dev; | 525 | struct pnp_dev *dev = parse_data->dev; |
507 | struct pnp_option *option = parse_data->option; | 526 | struct pnp_option *option = parse_data->option; |
508 | 527 | ||
509 | switch (res->id) { | 528 | switch (res->type) { |
510 | case ACPI_RSTYPE_IRQ: | 529 | case ACPI_RESOURCE_TYPE_IRQ: |
511 | pnpacpi_parse_irq_option(option, &res->data.irq); | 530 | pnpacpi_parse_irq_option(option, &res->data.irq); |
512 | break; | 531 | break; |
513 | case ACPI_RSTYPE_EXT_IRQ: | 532 | |
514 | pnpacpi_parse_ext_irq_option(option, | 533 | case ACPI_RESOURCE_TYPE_DMA: |
515 | &res->data.extended_irq); | ||
516 | break; | ||
517 | case ACPI_RSTYPE_DMA: | ||
518 | pnpacpi_parse_dma_option(option, &res->data.dma); | 534 | pnpacpi_parse_dma_option(option, &res->data.dma); |
519 | break; | 535 | break; |
520 | case ACPI_RSTYPE_IO: | 536 | |
521 | pnpacpi_parse_port_option(option, &res->data.io); | 537 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
522 | break; | ||
523 | case ACPI_RSTYPE_FIXED_IO: | ||
524 | pnpacpi_parse_fixed_port_option(option, | ||
525 | &res->data.fixed_io); | ||
526 | break; | ||
527 | case ACPI_RSTYPE_MEM24: | ||
528 | pnpacpi_parse_mem24_option(option, &res->data.memory24); | ||
529 | break; | ||
530 | case ACPI_RSTYPE_MEM32: | ||
531 | pnpacpi_parse_mem32_option(option, &res->data.memory32); | ||
532 | break; | ||
533 | case ACPI_RSTYPE_FIXED_MEM32: | ||
534 | pnpacpi_parse_fixed_mem32_option(option, | ||
535 | &res->data.fixed_memory32); | ||
536 | break; | ||
537 | case ACPI_RSTYPE_ADDRESS16: | ||
538 | case ACPI_RSTYPE_ADDRESS32: | ||
539 | case ACPI_RSTYPE_ADDRESS64: | ||
540 | pnpacpi_parse_address_option(option, res); | ||
541 | break; | ||
542 | case ACPI_RSTYPE_START_DPF: | ||
543 | switch (res->data.start_dpf.compatibility_priority) { | 538 | switch (res->data.start_dpf.compatibility_priority) { |
544 | case ACPI_GOOD_CONFIGURATION: | 539 | case ACPI_GOOD_CONFIGURATION: |
545 | priority = PNP_RES_PRIORITY_PREFERRED; | 540 | priority = PNP_RES_PRIORITY_PREFERRED; |
@@ -562,7 +557,8 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
562 | return AE_ERROR; | 557 | return AE_ERROR; |
563 | parse_data->option = option; | 558 | parse_data->option = option; |
564 | break; | 559 | break; |
565 | case ACPI_RSTYPE_END_DPF: | 560 | |
561 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
566 | /*only one EndDependentFn is allowed*/ | 562 | /*only one EndDependentFn is allowed*/ |
567 | if (!parse_data->option_independent) { | 563 | if (!parse_data->option_independent) { |
568 | pnp_warn("PnPACPI: more than one EndDependentFn"); | 564 | pnp_warn("PnPACPI: more than one EndDependentFn"); |
@@ -571,15 +567,59 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
571 | parse_data->option = parse_data->option_independent; | 567 | parse_data->option = parse_data->option_independent; |
572 | parse_data->option_independent = NULL; | 568 | parse_data->option_independent = NULL; |
573 | 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 | |||
574 | default: | 614 | default: |
575 | pnp_warn("PnPACPI: unknown resource type %d", res->id); | 615 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
576 | return AE_ERROR; | 616 | return AE_ERROR; |
577 | } | 617 | } |
578 | 618 | ||
579 | return AE_OK; | 619 | return AE_OK; |
580 | } | 620 | } |
581 | 621 | ||
582 | acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | 622 | acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, |
583 | struct pnp_dev *dev) | 623 | struct pnp_dev *dev) |
584 | { | 624 | { |
585 | acpi_status status; | 625 | acpi_status status; |
@@ -590,7 +630,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | |||
590 | return AE_ERROR; | 630 | return AE_ERROR; |
591 | parse_data.option_independent = parse_data.option; | 631 | parse_data.option_independent = parse_data.option; |
592 | parse_data.dev = dev; | 632 | parse_data.dev = dev; |
593 | status = acpi_walk_resources(handle, METHOD_NAME__PRS, | 633 | status = acpi_walk_resources(handle, METHOD_NAME__PRS, |
594 | pnpacpi_option_resource, &parse_data); | 634 | pnpacpi_option_resource, &parse_data); |
595 | 635 | ||
596 | return status; | 636 | return status; |
@@ -603,19 +643,24 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | |||
603 | void *data) | 643 | void *data) |
604 | { | 644 | { |
605 | int *res_cnt = (int *)data; | 645 | int *res_cnt = (int *)data; |
606 | switch (res->id) { | 646 | switch (res->type) { |
607 | case ACPI_RSTYPE_IRQ: | 647 | case ACPI_RESOURCE_TYPE_IRQ: |
608 | case ACPI_RSTYPE_EXT_IRQ: | 648 | case ACPI_RESOURCE_TYPE_DMA: |
609 | case ACPI_RSTYPE_DMA: | 649 | case ACPI_RESOURCE_TYPE_IO: |
610 | case ACPI_RSTYPE_IO: | 650 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
611 | case ACPI_RSTYPE_FIXED_IO: | 651 | case ACPI_RESOURCE_TYPE_MEMORY24: |
612 | case ACPI_RSTYPE_MEM24: | 652 | case ACPI_RESOURCE_TYPE_MEMORY32: |
613 | case ACPI_RSTYPE_MEM32: | 653 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
614 | case ACPI_RSTYPE_FIXED_MEM32: | 654 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
615 | case ACPI_RSTYPE_ADDRESS16: | 655 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
616 | case ACPI_RSTYPE_ADDRESS32: | 656 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
617 | case ACPI_RSTYPE_ADDRESS64: | 657 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
618 | (*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: | ||
619 | default: | 664 | default: |
620 | return AE_OK; | 665 | return AE_OK; |
621 | } | 666 | } |
@@ -626,20 +671,25 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | |||
626 | void *data) | 671 | void *data) |
627 | { | 672 | { |
628 | struct acpi_resource **resource = (struct acpi_resource **)data; | 673 | struct acpi_resource **resource = (struct acpi_resource **)data; |
629 | switch (res->id) { | 674 | switch (res->type) { |
630 | case ACPI_RSTYPE_IRQ: | 675 | case ACPI_RESOURCE_TYPE_IRQ: |
631 | case ACPI_RSTYPE_EXT_IRQ: | 676 | case ACPI_RESOURCE_TYPE_DMA: |
632 | case ACPI_RSTYPE_DMA: | 677 | case ACPI_RESOURCE_TYPE_IO: |
633 | case ACPI_RSTYPE_IO: | 678 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
634 | case ACPI_RSTYPE_FIXED_IO: | 679 | case ACPI_RESOURCE_TYPE_MEMORY24: |
635 | case ACPI_RSTYPE_MEM24: | 680 | case ACPI_RESOURCE_TYPE_MEMORY32: |
636 | case ACPI_RSTYPE_MEM32: | 681 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
637 | case ACPI_RSTYPE_FIXED_MEM32: | 682 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
638 | case ACPI_RSTYPE_ADDRESS16: | 683 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
639 | case ACPI_RSTYPE_ADDRESS32: | 684 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
640 | case ACPI_RSTYPE_ADDRESS64: | 685 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
641 | (*resource)->id = res->id; | 686 | (*resource)->type = res->type; |
642 | (*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: | ||
643 | default: | 693 | default: |
644 | return AE_OK; | 694 | return AE_OK; |
645 | } | 695 | } |
@@ -647,14 +697,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | |||
647 | return AE_OK; | 697 | return AE_OK; |
648 | } | 698 | } |
649 | 699 | ||
650 | int pnpacpi_build_resource_template(acpi_handle handle, | 700 | int pnpacpi_build_resource_template(acpi_handle handle, |
651 | struct acpi_buffer *buffer) | 701 | struct acpi_buffer *buffer) |
652 | { | 702 | { |
653 | struct acpi_resource *resource; | 703 | struct acpi_resource *resource; |
654 | int res_cnt = 0; | 704 | int res_cnt = 0; |
655 | acpi_status status; | 705 | acpi_status status; |
656 | 706 | ||
657 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 707 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
658 | pnpacpi_count_resources, &res_cnt); | 708 | pnpacpi_count_resources, &res_cnt); |
659 | if (ACPI_FAILURE(status)) { | 709 | if (ACPI_FAILURE(status)) { |
660 | pnp_err("Evaluate _CRS failed"); | 710 | pnp_err("Evaluate _CRS failed"); |
@@ -668,7 +718,7 @@ int pnpacpi_build_resource_template(acpi_handle handle, | |||
668 | return -ENOMEM; | 718 | return -ENOMEM; |
669 | pnp_dbg("Res cnt %d", res_cnt); | 719 | pnp_dbg("Res cnt %d", res_cnt); |
670 | resource = (struct acpi_resource *)buffer->pointer; | 720 | resource = (struct acpi_resource *)buffer->pointer; |
671 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 721 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
672 | pnpacpi_type_resources, &resource); | 722 | pnpacpi_type_resources, &resource); |
673 | if (ACPI_FAILURE(status)) { | 723 | if (ACPI_FAILURE(status)) { |
674 | kfree(buffer->pointer); | 724 | kfree(buffer->pointer); |
@@ -676,54 +726,54 @@ int pnpacpi_build_resource_template(acpi_handle handle, | |||
676 | return -EINVAL; | 726 | return -EINVAL; |
677 | } | 727 | } |
678 | /* resource will pointer the end resource now */ | 728 | /* resource will pointer the end resource now */ |
679 | resource->id = ACPI_RSTYPE_END_TAG; | 729 | resource->type = ACPI_RESOURCE_TYPE_END_TAG; |
680 | 730 | ||
681 | return 0; | 731 | return 0; |
682 | } | 732 | } |
683 | 733 | ||
684 | static void pnpacpi_encode_irq(struct acpi_resource *resource, | 734 | static void pnpacpi_encode_irq(struct acpi_resource *resource, |
685 | struct resource *p) | 735 | struct resource *p) |
686 | { | 736 | { |
687 | int edge_level, active_high_low; | 737 | int triggering, polarity; |
688 | 738 | ||
689 | decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, | 739 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, |
690 | &active_high_low); | 740 | &polarity); |
691 | resource->id = ACPI_RSTYPE_IRQ; | 741 | resource->type = ACPI_RESOURCE_TYPE_IRQ; |
692 | resource->length = sizeof(struct acpi_resource); | 742 | resource->length = sizeof(struct acpi_resource); |
693 | resource->data.irq.edge_level = edge_level; | 743 | resource->data.irq.triggering = triggering; |
694 | resource->data.irq.active_high_low = active_high_low; | 744 | resource->data.irq.polarity = polarity; |
695 | if (edge_level == ACPI_EDGE_SENSITIVE) | 745 | if (triggering == ACPI_EDGE_SENSITIVE) |
696 | resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 746 | resource->data.irq.sharable = ACPI_EXCLUSIVE; |
697 | else | 747 | else |
698 | resource->data.irq.shared_exclusive = ACPI_SHARED; | 748 | resource->data.irq.sharable = ACPI_SHARED; |
699 | resource->data.irq.number_of_interrupts = 1; | 749 | resource->data.irq.interrupt_count = 1; |
700 | resource->data.irq.interrupts[0] = p->start; | 750 | resource->data.irq.interrupts[0] = p->start; |
701 | } | 751 | } |
702 | 752 | ||
703 | static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | 753 | static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, |
704 | struct resource *p) | 754 | struct resource *p) |
705 | { | 755 | { |
706 | int edge_level, active_high_low; | 756 | int triggering, polarity; |
707 | 757 | ||
708 | decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, | 758 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, |
709 | &active_high_low); | 759 | &polarity); |
710 | resource->id = ACPI_RSTYPE_EXT_IRQ; | 760 | resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; |
711 | resource->length = sizeof(struct acpi_resource); | 761 | resource->length = sizeof(struct acpi_resource); |
712 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; | 762 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; |
713 | resource->data.extended_irq.edge_level = edge_level; | 763 | resource->data.extended_irq.triggering = triggering; |
714 | resource->data.extended_irq.active_high_low = active_high_low; | 764 | resource->data.extended_irq.polarity = polarity; |
715 | if (edge_level == ACPI_EDGE_SENSITIVE) | 765 | if (triggering == ACPI_EDGE_SENSITIVE) |
716 | resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; | 766 | resource->data.irq.sharable = ACPI_EXCLUSIVE; |
717 | else | 767 | else |
718 | resource->data.irq.shared_exclusive = ACPI_SHARED; | 768 | resource->data.irq.sharable = ACPI_SHARED; |
719 | resource->data.extended_irq.number_of_interrupts = 1; | 769 | resource->data.extended_irq.interrupt_count = 1; |
720 | resource->data.extended_irq.interrupts[0] = p->start; | 770 | resource->data.extended_irq.interrupts[0] = p->start; |
721 | } | 771 | } |
722 | 772 | ||
723 | static void pnpacpi_encode_dma(struct acpi_resource *resource, | 773 | static void pnpacpi_encode_dma(struct acpi_resource *resource, |
724 | struct resource *p) | 774 | struct resource *p) |
725 | { | 775 | { |
726 | resource->id = ACPI_RSTYPE_DMA; | 776 | resource->type = ACPI_RESOURCE_TYPE_DMA; |
727 | resource->length = sizeof(struct acpi_resource); | 777 | resource->length = sizeof(struct acpi_resource); |
728 | /* 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 */ |
729 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) | 779 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) |
@@ -741,75 +791,75 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, | |||
741 | else if (p->flags & IORESOURCE_DMA_16BIT) | 791 | else if (p->flags & IORESOURCE_DMA_16BIT) |
742 | resource->data.dma.transfer = ACPI_TRANSFER_16; | 792 | resource->data.dma.transfer = ACPI_TRANSFER_16; |
743 | resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; | 793 | resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; |
744 | resource->data.dma.number_of_channels = 1; | 794 | resource->data.dma.channel_count = 1; |
745 | resource->data.dma.channels[0] = p->start; | 795 | resource->data.dma.channels[0] = p->start; |
746 | } | 796 | } |
747 | 797 | ||
748 | static void pnpacpi_encode_io(struct acpi_resource *resource, | 798 | static void pnpacpi_encode_io(struct acpi_resource *resource, |
749 | struct resource *p) | 799 | struct resource *p) |
750 | { | 800 | { |
751 | resource->id = ACPI_RSTYPE_IO; | 801 | resource->type = ACPI_RESOURCE_TYPE_IO; |
752 | resource->length = sizeof(struct acpi_resource); | 802 | resource->length = sizeof(struct acpi_resource); |
753 | /* 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 */ |
754 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? | 804 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? |
755 | ACPI_DECODE_16 : ACPI_DECODE_10; | 805 | ACPI_DECODE_16 : ACPI_DECODE_10; |
756 | resource->data.io.min_base_address = p->start; | 806 | resource->data.io.minimum = p->start; |
757 | resource->data.io.max_base_address = p->end; | 807 | resource->data.io.maximum = p->end; |
758 | resource->data.io.alignment = 0; /* Correct? */ | 808 | resource->data.io.alignment = 0; /* Correct? */ |
759 | resource->data.io.range_length = p->end - p->start + 1; | 809 | resource->data.io.address_length = p->end - p->start + 1; |
760 | } | 810 | } |
761 | 811 | ||
762 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | 812 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, |
763 | struct resource *p) | 813 | struct resource *p) |
764 | { | 814 | { |
765 | resource->id = ACPI_RSTYPE_FIXED_IO; | 815 | resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; |
766 | resource->length = sizeof(struct acpi_resource); | 816 | resource->length = sizeof(struct acpi_resource); |
767 | resource->data.fixed_io.base_address = p->start; | 817 | resource->data.fixed_io.address = p->start; |
768 | resource->data.fixed_io.range_length = p->end - p->start + 1; | 818 | resource->data.fixed_io.address_length = p->end - p->start + 1; |
769 | } | 819 | } |
770 | 820 | ||
771 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, | 821 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, |
772 | struct resource *p) | 822 | struct resource *p) |
773 | { | 823 | { |
774 | resource->id = ACPI_RSTYPE_MEM24; | 824 | resource->type = ACPI_RESOURCE_TYPE_MEMORY24; |
775 | resource->length = sizeof(struct acpi_resource); | 825 | resource->length = sizeof(struct acpi_resource); |
776 | /* 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 */ |
777 | resource->data.memory24.read_write_attribute = | 827 | resource->data.memory24.write_protect = |
778 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 828 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
779 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 829 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
780 | resource->data.memory24.min_base_address = p->start; | 830 | resource->data.memory24.minimum = p->start; |
781 | resource->data.memory24.max_base_address = p->end; | 831 | resource->data.memory24.maximum = p->end; |
782 | resource->data.memory24.alignment = 0; | 832 | resource->data.memory24.alignment = 0; |
783 | resource->data.memory24.range_length = p->end - p->start + 1; | 833 | resource->data.memory24.address_length = p->end - p->start + 1; |
784 | } | 834 | } |
785 | 835 | ||
786 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, | 836 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, |
787 | struct resource *p) | 837 | struct resource *p) |
788 | { | 838 | { |
789 | resource->id = ACPI_RSTYPE_MEM32; | 839 | resource->type = ACPI_RESOURCE_TYPE_MEMORY32; |
790 | resource->length = sizeof(struct acpi_resource); | 840 | resource->length = sizeof(struct acpi_resource); |
791 | resource->data.memory32.read_write_attribute = | 841 | resource->data.memory32.write_protect = |
792 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 842 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
793 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 843 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
794 | resource->data.memory32.min_base_address = p->start; | 844 | resource->data.memory32.minimum = p->start; |
795 | resource->data.memory32.max_base_address = p->end; | 845 | resource->data.memory32.maximum = p->end; |
796 | resource->data.memory32.alignment = 0; | 846 | resource->data.memory32.alignment = 0; |
797 | resource->data.memory32.range_length = p->end - p->start + 1; | 847 | resource->data.memory32.address_length = p->end - p->start + 1; |
798 | } | 848 | } |
799 | 849 | ||
800 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | 850 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, |
801 | struct resource *p) | 851 | struct resource *p) |
802 | { | 852 | { |
803 | resource->id = ACPI_RSTYPE_FIXED_MEM32; | 853 | resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; |
804 | resource->length = sizeof(struct acpi_resource); | 854 | resource->length = sizeof(struct acpi_resource); |
805 | resource->data.fixed_memory32.read_write_attribute = | 855 | resource->data.fixed_memory32.write_protect = |
806 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 856 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
807 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 857 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
808 | resource->data.fixed_memory32.range_base_address = p->start; | 858 | resource->data.fixed_memory32.address = p->start; |
809 | resource->data.fixed_memory32.range_length = p->end - p->start + 1; | 859 | resource->data.fixed_memory32.address_length = p->end - p->start + 1; |
810 | } | 860 | } |
811 | 861 | ||
812 | int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | 862 | int pnpacpi_encode_resources(struct pnp_resource_table *res_table, |
813 | struct acpi_buffer *buffer) | 863 | struct acpi_buffer *buffer) |
814 | { | 864 | { |
815 | int i = 0; | 865 | int i = 0; |
@@ -820,58 +870,67 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
820 | 870 | ||
821 | pnp_dbg("res cnt %d", res_cnt); | 871 | pnp_dbg("res cnt %d", res_cnt); |
822 | while (i < res_cnt) { | 872 | while (i < res_cnt) { |
823 | switch(resource->id) { | 873 | switch(resource->type) { |
824 | case ACPI_RSTYPE_IRQ: | 874 | case ACPI_RESOURCE_TYPE_IRQ: |
825 | pnp_dbg("Encode irq"); | 875 | pnp_dbg("Encode irq"); |
826 | pnpacpi_encode_irq(resource, | 876 | pnpacpi_encode_irq(resource, |
827 | &res_table->irq_resource[irq]); | 877 | &res_table->irq_resource[irq]); |
828 | irq++; | 878 | irq++; |
829 | break; | 879 | break; |
830 | 880 | ||
831 | case ACPI_RSTYPE_EXT_IRQ: | 881 | case ACPI_RESOURCE_TYPE_DMA: |
832 | pnp_dbg("Encode ext irq"); | ||
833 | pnpacpi_encode_ext_irq(resource, | ||
834 | &res_table->irq_resource[irq]); | ||
835 | irq++; | ||
836 | break; | ||
837 | case ACPI_RSTYPE_DMA: | ||
838 | pnp_dbg("Encode dma"); | 882 | pnp_dbg("Encode dma"); |
839 | pnpacpi_encode_dma(resource, | 883 | pnpacpi_encode_dma(resource, |
840 | &res_table->dma_resource[dma]); | 884 | &res_table->dma_resource[dma]); |
841 | dma ++; | 885 | dma ++; |
842 | break; | 886 | break; |
843 | case ACPI_RSTYPE_IO: | 887 | case ACPI_RESOURCE_TYPE_IO: |
844 | pnp_dbg("Encode io"); | 888 | pnp_dbg("Encode io"); |
845 | pnpacpi_encode_io(resource, | 889 | pnpacpi_encode_io(resource, |
846 | &res_table->port_resource[port]); | 890 | &res_table->port_resource[port]); |
847 | port ++; | 891 | port ++; |
848 | break; | 892 | break; |
849 | case ACPI_RSTYPE_FIXED_IO: | 893 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
850 | pnp_dbg("Encode fixed io"); | 894 | pnp_dbg("Encode fixed io"); |
851 | pnpacpi_encode_fixed_io(resource, | 895 | pnpacpi_encode_fixed_io(resource, |
852 | &res_table->port_resource[port]); | 896 | &res_table->port_resource[port]); |
853 | port ++; | 897 | port ++; |
854 | break; | 898 | break; |
855 | case ACPI_RSTYPE_MEM24: | 899 | case ACPI_RESOURCE_TYPE_MEMORY24: |
856 | pnp_dbg("Encode mem24"); | 900 | pnp_dbg("Encode mem24"); |
857 | pnpacpi_encode_mem24(resource, | 901 | pnpacpi_encode_mem24(resource, |
858 | &res_table->mem_resource[mem]); | 902 | &res_table->mem_resource[mem]); |
859 | mem ++; | 903 | mem ++; |
860 | break; | 904 | break; |
861 | case ACPI_RSTYPE_MEM32: | 905 | case ACPI_RESOURCE_TYPE_MEMORY32: |
862 | pnp_dbg("Encode mem32"); | 906 | pnp_dbg("Encode mem32"); |
863 | pnpacpi_encode_mem32(resource, | 907 | pnpacpi_encode_mem32(resource, |
864 | &res_table->mem_resource[mem]); | 908 | &res_table->mem_resource[mem]); |
865 | mem ++; | 909 | mem ++; |
866 | break; | 910 | break; |
867 | case ACPI_RSTYPE_FIXED_MEM32: | 911 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
868 | pnp_dbg("Encode fixed mem32"); | 912 | pnp_dbg("Encode fixed mem32"); |
869 | pnpacpi_encode_fixed_mem32(resource, | 913 | pnpacpi_encode_fixed_mem32(resource, |
870 | &res_table->mem_resource[mem]); | 914 | &res_table->mem_resource[mem]); |
871 | mem ++; | 915 | mem ++; |
872 | 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: | ||
873 | default: /* other type */ | 932 | default: /* other type */ |
874 | pnp_warn("unknown resource type %d", resource->id); | 933 | pnp_warn("unknown resource type %d", resource->type); |
875 | return -EINVAL; | 934 | return -EINVAL; |
876 | } | 935 | } |
877 | resource ++; | 936 | resource ++; |