aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c364
1 files changed, 182 insertions, 182 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 15ec05f69ddd..f4adebde6155 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 */
35static int irq_flags(int edge_level, int active_high_low) 35static 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
53static void decode_irq_flags(int flag, int *edge_level, int *active_high_low) 53static 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
75static void 75static void
76pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, 76pnpacpi_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;
@@ -164,73 +164,73 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
164 int i; 164 int i;
165 165
166 switch (res->type) { 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_EXTENDED_IRQ:
181 for (i = 0; i < res->data.extended_irq.number_of_interrupts; i++) { 181 for (i = 0; i < res->data.extended_irq.interrupt_count; i++) {
182 pnpacpi_parse_allocated_irqresource(res_table, 182 pnpacpi_parse_allocated_irqresource(res_table,
183 res->data.extended_irq.interrupts[i], 183 res->data.extended_irq.interrupts[i],
184 res->data.extended_irq.edge_level, 184 res->data.extended_irq.triggering,
185 res->data.extended_irq.active_high_low); 185 res->data.extended_irq.polarity);
186 } 186 }
187 break; 187 break;
188 case ACPI_RSTYPE_DMA: 188 case ACPI_RESOURCE_TYPE_DMA:
189 if (res->data.dma.number_of_channels > 0) 189 if (res->data.dma.channel_count > 0)
190 pnpacpi_parse_allocated_dmaresource(res_table, 190 pnpacpi_parse_allocated_dmaresource(res_table,
191 res->data.dma.channels[0]); 191 res->data.dma.channels[0]);
192 break; 192 break;
193 case ACPI_RSTYPE_IO: 193 case ACPI_RESOURCE_TYPE_IO:
194 pnpacpi_parse_allocated_ioresource(res_table, 194 pnpacpi_parse_allocated_ioresource(res_table,
195 res->data.io.min_base_address, 195 res->data.io.minimum,
196 res->data.io.range_length); 196 res->data.io.address_length);
197 break; 197 break;
198 case ACPI_RSTYPE_FIXED_IO: 198 case ACPI_RESOURCE_TYPE_FIXED_IO:
199 pnpacpi_parse_allocated_ioresource(res_table, 199 pnpacpi_parse_allocated_ioresource(res_table,
200 res->data.fixed_io.base_address, 200 res->data.fixed_io.address,
201 res->data.fixed_io.range_length); 201 res->data.fixed_io.address_length);
202 break; 202 break;
203 case ACPI_RSTYPE_MEM24: 203 case ACPI_RESOURCE_TYPE_MEMORY24:
204 pnpacpi_parse_allocated_memresource(res_table, 204 pnpacpi_parse_allocated_memresource(res_table,
205 res->data.memory24.min_base_address, 205 res->data.memory24.minimum,
206 res->data.memory24.range_length); 206 res->data.memory24.address_length);
207 break; 207 break;
208 case ACPI_RSTYPE_MEM32: 208 case ACPI_RESOURCE_TYPE_MEMORY32:
209 pnpacpi_parse_allocated_memresource(res_table, 209 pnpacpi_parse_allocated_memresource(res_table,
210 res->data.memory32.min_base_address, 210 res->data.memory32.minimum,
211 res->data.memory32.range_length); 211 res->data.memory32.address_length);
212 break; 212 break;
213 case ACPI_RSTYPE_FIXED_MEM32: 213 case ACPI_RESOURCE_TYPE_FIXED_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.fixed_memory32.address,
216 res->data.fixed_memory32.range_length); 216 res->data.fixed_memory32.address_length);
217 break; 217 break;
218 case ACPI_RSTYPE_ADDRESS16: 218 case ACPI_RESOURCE_TYPE_ADDRESS16:
219 pnpacpi_parse_allocated_memresource(res_table, 219 pnpacpi_parse_allocated_memresource(res_table,
220 res->data.address16.min_address_range, 220 res->data.address16.minimum,
221 res->data.address16.address_length); 221 res->data.address16.address_length);
222 break; 222 break;
223 case ACPI_RSTYPE_ADDRESS32: 223 case ACPI_RESOURCE_TYPE_ADDRESS32:
224 pnpacpi_parse_allocated_memresource(res_table, 224 pnpacpi_parse_allocated_memresource(res_table,
225 res->data.address32.min_address_range, 225 res->data.address32.minimum,
226 res->data.address32.address_length); 226 res->data.address32.address_length);
227 break; 227 break;
228 case ACPI_RSTYPE_ADDRESS64: 228 case ACPI_RESOURCE_TYPE_ADDRESS64:
229 pnpacpi_parse_allocated_memresource(res_table, 229 pnpacpi_parse_allocated_memresource(res_table,
230 res->data.address64.min_address_range, 230 res->data.address64.minimum,
231 res->data.address64.address_length); 231 res->data.address64.address_length);
232 break; 232 break;
233 case ACPI_RSTYPE_VENDOR: 233 case ACPI_RESOURCE_TYPE_VENDOR:
234 break; 234 break;
235 default: 235 default:
236 pnp_warn("PnPACPI: unknown resource type %d", res->type); 236 pnp_warn("PnPACPI: unknown resource type %d", res->type);
@@ -253,13 +253,13 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
253 int i; 253 int i;
254 struct pnp_dma * dma; 254 struct pnp_dma * dma;
255 255
256 if (p->number_of_channels == 0) 256 if (p->channel_count == 0)
257 return; 257 return;
258 dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); 258 dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL);
259 if (!dma) 259 if (!dma)
260 return; 260 return;
261 261
262 for(i = 0; i < p->number_of_channels; i++) 262 for(i = 0; i < p->channel_count; i++)
263 dma->map |= 1 << p->channels[i]; 263 dma->map |= 1 << p->channels[i];
264 dma->flags = 0; 264 dma->flags = 0;
265 if (p->bus_master) 265 if (p->bus_master)
@@ -309,37 +309,37 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option,
309 int i; 309 int i;
310 struct pnp_irq * irq; 310 struct pnp_irq * irq;
311 311
312 if (p->number_of_interrupts == 0) 312 if (p->interrupt_count == 0)
313 return; 313 return;
314 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); 314 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
315 if (!irq) 315 if (!irq)
316 return; 316 return;
317 317
318 for(i = 0; i < p->number_of_interrupts; i++) 318 for(i = 0; i < p->interrupt_count; i++)
319 if (p->interrupts[i]) 319 if (p->interrupts[i])
320 __set_bit(p->interrupts[i], irq->map); 320 __set_bit(p->interrupts[i], irq->map);
321 irq->flags = irq_flags(p->edge_level, p->active_high_low); 321 irq->flags = irq_flags(p->triggering, p->polarity);
322 322
323 pnp_register_irq_resource(option, irq); 323 pnp_register_irq_resource(option, irq);
324 return; 324 return;
325} 325}
326 326
327static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, 327static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
328 struct acpi_resource_ext_irq *p) 328 struct acpi_resource_extended_irq *p)
329{ 329{
330 int i; 330 int i;
331 struct pnp_irq * irq; 331 struct pnp_irq * irq;
332 332
333 if (p->number_of_interrupts == 0) 333 if (p->interrupt_count == 0)
334 return; 334 return;
335 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); 335 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
336 if (!irq) 336 if (!irq)
337 return; 337 return;
338 338
339 for(i = 0; i < p->number_of_interrupts; i++) 339 for(i = 0; i < p->interrupt_count; i++)
340 if (p->interrupts[i]) 340 if (p->interrupts[i])
341 __set_bit(p->interrupts[i], irq->map); 341 __set_bit(p->interrupts[i], irq->map);
342 irq->flags = irq_flags(p->edge_level, p->active_high_low); 342 irq->flags = irq_flags(p->triggering, p->polarity);
343 343
344 pnp_register_irq_resource(option, irq); 344 pnp_register_irq_resource(option, irq);
345 return; 345 return;
@@ -351,16 +351,16 @@ pnpacpi_parse_port_option(struct pnp_option *option,
351{ 351{
352 struct pnp_port * port; 352 struct pnp_port * port;
353 353
354 if (io->range_length == 0) 354 if (io->address_length == 0)
355 return; 355 return;
356 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); 356 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
357 if (!port) 357 if (!port)
358 return; 358 return;
359 port->min = io->min_base_address; 359 port->min = io->minimum;
360 port->max = io->max_base_address; 360 port->max = io->maximum;
361 port->align = io->alignment; 361 port->align = io->alignment;
362 port->size = io->range_length; 362 port->size = io->address_length;
363 port->flags = ACPI_DECODE_16 == io->io_decode ? 363 port->flags = ACPI_DECODE_16 == io->io_decode ?
364 PNP_PORT_FLAG_16BITADDR : 0; 364 PNP_PORT_FLAG_16BITADDR : 0;
365 pnp_register_port_resource(option,port); 365 pnp_register_port_resource(option,port);
366 return; 366 return;
@@ -372,13 +372,13 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
372{ 372{
373 struct pnp_port * port; 373 struct pnp_port * port;
374 374
375 if (io->range_length == 0) 375 if (io->address_length == 0)
376 return; 376 return;
377 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); 377 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
378 if (!port) 378 if (!port)
379 return; 379 return;
380 port->min = port->max = io->base_address; 380 port->min = port->max = io->address;
381 port->size = io->range_length; 381 port->size = io->address_length;
382 port->align = 0; 382 port->align = 0;
383 port->flags = PNP_PORT_FLAG_FIXED; 383 port->flags = PNP_PORT_FLAG_FIXED;
384 pnp_register_port_resource(option,port); 384 pnp_register_port_resource(option,port);
@@ -387,19 +387,19 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
387 387
388static void 388static void
389pnpacpi_parse_mem24_option(struct pnp_option *option, 389pnpacpi_parse_mem24_option(struct pnp_option *option,
390 struct acpi_resource_mem24 *p) 390 struct acpi_resource_memory24 *p)
391{ 391{
392 struct pnp_mem * mem; 392 struct pnp_mem * mem;
393 393
394 if (p->range_length == 0) 394 if (p->address_length == 0)
395 return; 395 return;
396 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); 396 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
397 if (!mem) 397 if (!mem)
398 return; 398 return;
399 mem->min = p->min_base_address; 399 mem->min = p->minimum;
400 mem->max = p->max_base_address; 400 mem->max = p->maximum;
401 mem->align = p->alignment; 401 mem->align = p->alignment;
402 mem->size = p->range_length; 402 mem->size = p->address_length;
403 403
404 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 404 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
405 IORESOURCE_MEM_WRITEABLE : 0; 405 IORESOURCE_MEM_WRITEABLE : 0;
@@ -410,19 +410,19 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
410 410
411static void 411static void
412pnpacpi_parse_mem32_option(struct pnp_option *option, 412pnpacpi_parse_mem32_option(struct pnp_option *option,
413 struct acpi_resource_mem32 *p) 413 struct acpi_resource_memory32 *p)
414{ 414{
415 struct pnp_mem * mem; 415 struct pnp_mem * mem;
416 416
417 if (p->range_length == 0) 417 if (p->address_length == 0)
418 return; 418 return;
419 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); 419 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
420 if (!mem) 420 if (!mem)
421 return; 421 return;
422 mem->min = p->min_base_address; 422 mem->min = p->minimum;
423 mem->max = p->max_base_address; 423 mem->max = p->maximum;
424 mem->align = p->alignment; 424 mem->align = p->alignment;
425 mem->size = p->range_length; 425 mem->size = p->address_length;
426 426
427 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 427 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
428 IORESOURCE_MEM_WRITEABLE : 0; 428 IORESOURCE_MEM_WRITEABLE : 0;
@@ -433,17 +433,17 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
433 433
434static void 434static void
435pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, 435pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
436 struct acpi_resource_fixed_mem32 *p) 436 struct acpi_resource_fixed_memory32 *p)
437{ 437{
438 struct pnp_mem * mem; 438 struct pnp_mem * mem;
439 439
440 if (p->range_length == 0) 440 if (p->address_length == 0)
441 return; 441 return;
442 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); 442 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
443 if (!mem) 443 if (!mem)
444 return; 444 return;
445 mem->min = mem->max = p->range_base_address; 445 mem->min = mem->max = p->address;
446 mem->size = p->range_length; 446 mem->size = p->address_length;
447 mem->align = 0; 447 mem->align = 0;
448 448
449 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ? 449 mem->flags = (ACPI_READ_WRITE_MEMORY == p->read_write_attribute) ?
@@ -459,7 +459,7 @@ struct acpipnp_parse_option_s {
459 struct pnp_dev *dev; 459 struct pnp_dev *dev;
460}; 460};
461 461
462static acpi_status pnpacpi_option_resource(struct acpi_resource *res, 462static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
463 void *data) 463 void *data)
464{ 464{
465 int priority = 0; 465 int priority = 0;
@@ -468,34 +468,34 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
468 struct pnp_option *option = parse_data->option; 468 struct pnp_option *option = parse_data->option;
469 469
470 switch (res->type) { 470 switch (res->type) {
471 case ACPI_RSTYPE_IRQ: 471 case ACPI_RESOURCE_TYPE_IRQ:
472 pnpacpi_parse_irq_option(option, &res->data.irq); 472 pnpacpi_parse_irq_option(option, &res->data.irq);
473 break; 473 break;
474 case ACPI_RSTYPE_EXT_IRQ: 474 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
475 pnpacpi_parse_ext_irq_option(option, 475 pnpacpi_parse_ext_irq_option(option,
476 &res->data.extended_irq); 476 &res->data.extended_irq);
477 break; 477 break;
478 case ACPI_RSTYPE_DMA: 478 case ACPI_RESOURCE_TYPE_DMA:
479 pnpacpi_parse_dma_option(option, &res->data.dma); 479 pnpacpi_parse_dma_option(option, &res->data.dma);
480 break; 480 break;
481 case ACPI_RSTYPE_IO: 481 case ACPI_RESOURCE_TYPE_IO:
482 pnpacpi_parse_port_option(option, &res->data.io); 482 pnpacpi_parse_port_option(option, &res->data.io);
483 break; 483 break;
484 case ACPI_RSTYPE_FIXED_IO: 484 case ACPI_RESOURCE_TYPE_FIXED_IO:
485 pnpacpi_parse_fixed_port_option(option, 485 pnpacpi_parse_fixed_port_option(option,
486 &res->data.fixed_io); 486 &res->data.fixed_io);
487 break; 487 break;
488 case ACPI_RSTYPE_MEM24: 488 case ACPI_RESOURCE_TYPE_MEMORY24:
489 pnpacpi_parse_mem24_option(option, &res->data.memory24); 489 pnpacpi_parse_mem24_option(option, &res->data.memory24);
490 break; 490 break;
491 case ACPI_RSTYPE_MEM32: 491 case ACPI_RESOURCE_TYPE_MEMORY32:
492 pnpacpi_parse_mem32_option(option, &res->data.memory32); 492 pnpacpi_parse_mem32_option(option, &res->data.memory32);
493 break; 493 break;
494 case ACPI_RSTYPE_FIXED_MEM32: 494 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
495 pnpacpi_parse_fixed_mem32_option(option, 495 pnpacpi_parse_fixed_mem32_option(option,
496 &res->data.fixed_memory32); 496 &res->data.fixed_memory32);
497 break; 497 break;
498 case ACPI_RSTYPE_START_DPF: 498 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
499 switch (res->data.start_dpf.compatibility_priority) { 499 switch (res->data.start_dpf.compatibility_priority) {
500 case ACPI_GOOD_CONFIGURATION: 500 case ACPI_GOOD_CONFIGURATION:
501 priority = PNP_RES_PRIORITY_PREFERRED; 501 priority = PNP_RES_PRIORITY_PREFERRED;
@@ -518,7 +518,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
518 return AE_ERROR; 518 return AE_ERROR;
519 parse_data->option = option; 519 parse_data->option = option;
520 break; 520 break;
521 case ACPI_RSTYPE_END_DPF: 521 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
522 /*only one EndDependentFn is allowed*/ 522 /*only one EndDependentFn is allowed*/
523 if (!parse_data->option_independent) { 523 if (!parse_data->option_independent) {
524 pnp_warn("PnPACPI: more than one EndDependentFn"); 524 pnp_warn("PnPACPI: more than one EndDependentFn");
@@ -535,7 +535,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
535 return AE_OK; 535 return AE_OK;
536} 536}
537 537
538acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, 538acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
539 struct pnp_dev *dev) 539 struct pnp_dev *dev)
540{ 540{
541 acpi_status status; 541 acpi_status status;
@@ -546,7 +546,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
546 return AE_ERROR; 546 return AE_ERROR;
547 parse_data.option_independent = parse_data.option; 547 parse_data.option_independent = parse_data.option;
548 parse_data.dev = dev; 548 parse_data.dev = dev;
549 status = acpi_walk_resources(handle, METHOD_NAME__PRS, 549 status = acpi_walk_resources(handle, METHOD_NAME__PRS,
550 pnpacpi_option_resource, &parse_data); 550 pnpacpi_option_resource, &parse_data);
551 551
552 return status; 552 return status;
@@ -560,18 +560,18 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
560{ 560{
561 int *res_cnt = (int *)data; 561 int *res_cnt = (int *)data;
562 switch (res->type) { 562 switch (res->type) {
563 case ACPI_RSTYPE_IRQ: 563 case ACPI_RESOURCE_TYPE_IRQ:
564 case ACPI_RSTYPE_EXT_IRQ: 564 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
565 case ACPI_RSTYPE_DMA: 565 case ACPI_RESOURCE_TYPE_DMA:
566 case ACPI_RSTYPE_IO: 566 case ACPI_RESOURCE_TYPE_IO:
567 case ACPI_RSTYPE_FIXED_IO: 567 case ACPI_RESOURCE_TYPE_FIXED_IO:
568 case ACPI_RSTYPE_MEM24: 568 case ACPI_RESOURCE_TYPE_MEMORY24:
569 case ACPI_RSTYPE_MEM32: 569 case ACPI_RESOURCE_TYPE_MEMORY32:
570 case ACPI_RSTYPE_FIXED_MEM32: 570 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
571#if 0 571#if 0
572 case ACPI_RSTYPE_ADDRESS16: 572 case ACPI_RESOURCE_TYPE_ADDRESS16:
573 case ACPI_RSTYPE_ADDRESS32: 573 case ACPI_RESOURCE_TYPE_ADDRESS32:
574 case ACPI_RSTYPE_ADDRESS64: 574 case ACPI_RESOURCE_TYPE_ADDRESS64:
575#endif 575#endif
576 (*res_cnt) ++; 576 (*res_cnt) ++;
577 default: 577 default:
@@ -585,18 +585,18 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res,
585{ 585{
586 struct acpi_resource **resource = (struct acpi_resource **)data; 586 struct acpi_resource **resource = (struct acpi_resource **)data;
587 switch (res->type) { 587 switch (res->type) {
588 case ACPI_RSTYPE_IRQ: 588 case ACPI_RESOURCE_TYPE_IRQ:
589 case ACPI_RSTYPE_EXT_IRQ: 589 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
590 case ACPI_RSTYPE_DMA: 590 case ACPI_RESOURCE_TYPE_DMA:
591 case ACPI_RSTYPE_IO: 591 case ACPI_RESOURCE_TYPE_IO:
592 case ACPI_RSTYPE_FIXED_IO: 592 case ACPI_RESOURCE_TYPE_FIXED_IO:
593 case ACPI_RSTYPE_MEM24: 593 case ACPI_RESOURCE_TYPE_MEMORY24:
594 case ACPI_RSTYPE_MEM32: 594 case ACPI_RESOURCE_TYPE_MEMORY32:
595 case ACPI_RSTYPE_FIXED_MEM32: 595 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
596#if 0 596#if 0
597 case ACPI_RSTYPE_ADDRESS16: 597 case ACPI_RESOURCE_TYPE_ADDRESS16:
598 case ACPI_RSTYPE_ADDRESS32: 598 case ACPI_RESOURCE_TYPE_ADDRESS32:
599 case ACPI_RSTYPE_ADDRESS64: 599 case ACPI_RESOURCE_TYPE_ADDRESS64:
600#endif 600#endif
601 (*resource)->type = res->type; 601 (*resource)->type = res->type;
602 (*resource)++; 602 (*resource)++;
@@ -607,14 +607,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res,
607 return AE_OK; 607 return AE_OK;
608} 608}
609 609
610int pnpacpi_build_resource_template(acpi_handle handle, 610int pnpacpi_build_resource_template(acpi_handle handle,
611 struct acpi_buffer *buffer) 611 struct acpi_buffer *buffer)
612{ 612{
613 struct acpi_resource *resource; 613 struct acpi_resource *resource;
614 int res_cnt = 0; 614 int res_cnt = 0;
615 acpi_status status; 615 acpi_status status;
616 616
617 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 617 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
618 pnpacpi_count_resources, &res_cnt); 618 pnpacpi_count_resources, &res_cnt);
619 if (ACPI_FAILURE(status)) { 619 if (ACPI_FAILURE(status)) {
620 pnp_err("Evaluate _CRS failed"); 620 pnp_err("Evaluate _CRS failed");
@@ -628,7 +628,7 @@ int pnpacpi_build_resource_template(acpi_handle handle,
628 return -ENOMEM; 628 return -ENOMEM;
629 pnp_dbg("Res cnt %d", res_cnt); 629 pnp_dbg("Res cnt %d", res_cnt);
630 resource = (struct acpi_resource *)buffer->pointer; 630 resource = (struct acpi_resource *)buffer->pointer;
631 status = acpi_walk_resources(handle, METHOD_NAME__CRS, 631 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
632 pnpacpi_type_resources, &resource); 632 pnpacpi_type_resources, &resource);
633 if (ACPI_FAILURE(status)) { 633 if (ACPI_FAILURE(status)) {
634 kfree(buffer->pointer); 634 kfree(buffer->pointer);
@@ -636,54 +636,54 @@ int pnpacpi_build_resource_template(acpi_handle handle,
636 return -EINVAL; 636 return -EINVAL;
637 } 637 }
638 /* resource will pointer the end resource now */ 638 /* resource will pointer the end resource now */
639 resource->type = ACPI_RSTYPE_END_TAG; 639 resource->type = ACPI_RESOURCE_TYPE_END_TAG;
640 640
641 return 0; 641 return 0;
642} 642}
643 643
644static void pnpacpi_encode_irq(struct acpi_resource *resource, 644static void pnpacpi_encode_irq(struct acpi_resource *resource,
645 struct resource *p) 645 struct resource *p)
646{ 646{
647 int edge_level, active_high_low; 647 int triggering, polarity;
648 648
649 decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, 649 decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering,
650 &active_high_low); 650 &polarity);
651 resource->type = ACPI_RSTYPE_IRQ; 651 resource->type = ACPI_RESOURCE_TYPE_IRQ;
652 resource->length = sizeof(struct acpi_resource); 652 resource->length = sizeof(struct acpi_resource);
653 resource->data.irq.edge_level = edge_level; 653 resource->data.irq.triggering = triggering;
654 resource->data.irq.active_high_low = active_high_low; 654 resource->data.irq.polarity = polarity;
655 if (edge_level == ACPI_EDGE_SENSITIVE) 655 if (triggering == ACPI_EDGE_SENSITIVE)
656 resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; 656 resource->data.irq.sharable = ACPI_EXCLUSIVE;
657 else 657 else
658 resource->data.irq.shared_exclusive = ACPI_SHARED; 658 resource->data.irq.sharable = ACPI_SHARED;
659 resource->data.irq.number_of_interrupts = 1; 659 resource->data.irq.interrupt_count = 1;
660 resource->data.irq.interrupts[0] = p->start; 660 resource->data.irq.interrupts[0] = p->start;
661} 661}
662 662
663static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, 663static void pnpacpi_encode_ext_irq(struct acpi_resource *resource,
664 struct resource *p) 664 struct resource *p)
665{ 665{
666 int edge_level, active_high_low; 666 int triggering, polarity;
667 667
668 decode_irq_flags(p->flags & IORESOURCE_BITS, &edge_level, 668 decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering,
669 &active_high_low); 669 &polarity);
670 resource->type = ACPI_RSTYPE_EXT_IRQ; 670 resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ;
671 resource->length = sizeof(struct acpi_resource); 671 resource->length = sizeof(struct acpi_resource);
672 resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; 672 resource->data.extended_irq.producer_consumer = ACPI_CONSUMER;
673 resource->data.extended_irq.edge_level = edge_level; 673 resource->data.extended_irq.triggering = triggering;
674 resource->data.extended_irq.active_high_low = active_high_low; 674 resource->data.extended_irq.polarity = polarity;
675 if (edge_level == ACPI_EDGE_SENSITIVE) 675 if (triggering == ACPI_EDGE_SENSITIVE)
676 resource->data.irq.shared_exclusive = ACPI_EXCLUSIVE; 676 resource->data.irq.sharable = ACPI_EXCLUSIVE;
677 else 677 else
678 resource->data.irq.shared_exclusive = ACPI_SHARED; 678 resource->data.irq.sharable = ACPI_SHARED;
679 resource->data.extended_irq.number_of_interrupts = 1; 679 resource->data.extended_irq.interrupt_count = 1;
680 resource->data.extended_irq.interrupts[0] = p->start; 680 resource->data.extended_irq.interrupts[0] = p->start;
681} 681}
682 682
683static void pnpacpi_encode_dma(struct acpi_resource *resource, 683static void pnpacpi_encode_dma(struct acpi_resource *resource,
684 struct resource *p) 684 struct resource *p)
685{ 685{
686 resource->type = ACPI_RSTYPE_DMA; 686 resource->type = ACPI_RESOURCE_TYPE_DMA;
687 resource->length = sizeof(struct acpi_resource); 687 resource->length = sizeof(struct acpi_resource);
688 /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ 688 /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */
689 if (p->flags & IORESOURCE_DMA_COMPATIBLE) 689 if (p->flags & IORESOURCE_DMA_COMPATIBLE)
@@ -701,75 +701,75 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource,
701 else if (p->flags & IORESOURCE_DMA_16BIT) 701 else if (p->flags & IORESOURCE_DMA_16BIT)
702 resource->data.dma.transfer = ACPI_TRANSFER_16; 702 resource->data.dma.transfer = ACPI_TRANSFER_16;
703 resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER; 703 resource->data.dma.bus_master = p->flags & IORESOURCE_DMA_MASTER;
704 resource->data.dma.number_of_channels = 1; 704 resource->data.dma.channel_count = 1;
705 resource->data.dma.channels[0] = p->start; 705 resource->data.dma.channels[0] = p->start;
706} 706}
707 707
708static void pnpacpi_encode_io(struct acpi_resource *resource, 708static void pnpacpi_encode_io(struct acpi_resource *resource,
709 struct resource *p) 709 struct resource *p)
710{ 710{
711 resource->type = ACPI_RSTYPE_IO; 711 resource->type = ACPI_RESOURCE_TYPE_IO;
712 resource->length = sizeof(struct acpi_resource); 712 resource->length = sizeof(struct acpi_resource);
713 /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ 713 /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */
714 resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? 714 resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)?
715 ACPI_DECODE_16 : ACPI_DECODE_10; 715 ACPI_DECODE_16 : ACPI_DECODE_10;
716 resource->data.io.min_base_address = p->start; 716 resource->data.io.minimum = p->start;
717 resource->data.io.max_base_address = p->end; 717 resource->data.io.maximum = p->end;
718 resource->data.io.alignment = 0; /* Correct? */ 718 resource->data.io.alignment = 0; /* Correct? */
719 resource->data.io.range_length = p->end - p->start + 1; 719 resource->data.io.address_length = p->end - p->start + 1;
720} 720}
721 721
722static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, 722static void pnpacpi_encode_fixed_io(struct acpi_resource *resource,
723 struct resource *p) 723 struct resource *p)
724{ 724{
725 resource->type = ACPI_RSTYPE_FIXED_IO; 725 resource->type = ACPI_RESOURCE_TYPE_FIXED_IO;
726 resource->length = sizeof(struct acpi_resource); 726 resource->length = sizeof(struct acpi_resource);
727 resource->data.fixed_io.base_address = p->start; 727 resource->data.fixed_io.address = p->start;
728 resource->data.fixed_io.range_length = p->end - p->start + 1; 728 resource->data.fixed_io.address_length = p->end - p->start + 1;
729} 729}
730 730
731static void pnpacpi_encode_mem24(struct acpi_resource *resource, 731static void pnpacpi_encode_mem24(struct acpi_resource *resource,
732 struct resource *p) 732 struct resource *p)
733{ 733{
734 resource->type = ACPI_RSTYPE_MEM24; 734 resource->type = ACPI_RESOURCE_TYPE_MEMORY24;
735 resource->length = sizeof(struct acpi_resource); 735 resource->length = sizeof(struct acpi_resource);
736 /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ 736 /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */
737 resource->data.memory24.read_write_attribute = 737 resource->data.memory24.read_write_attribute =
738 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 738 (p->flags & IORESOURCE_MEM_WRITEABLE) ?
739 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 739 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
740 resource->data.memory24.min_base_address = p->start; 740 resource->data.memory24.minimum = p->start;
741 resource->data.memory24.max_base_address = p->end; 741 resource->data.memory24.maximum = p->end;
742 resource->data.memory24.alignment = 0; 742 resource->data.memory24.alignment = 0;
743 resource->data.memory24.range_length = p->end - p->start + 1; 743 resource->data.memory24.address_length = p->end - p->start + 1;
744} 744}
745 745
746static void pnpacpi_encode_mem32(struct acpi_resource *resource, 746static void pnpacpi_encode_mem32(struct acpi_resource *resource,
747 struct resource *p) 747 struct resource *p)
748{ 748{
749 resource->type = ACPI_RSTYPE_MEM32; 749 resource->type = ACPI_RESOURCE_TYPE_MEMORY32;
750 resource->length = sizeof(struct acpi_resource); 750 resource->length = sizeof(struct acpi_resource);
751 resource->data.memory32.read_write_attribute = 751 resource->data.memory32.read_write_attribute =
752 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 752 (p->flags & IORESOURCE_MEM_WRITEABLE) ?
753 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 753 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
754 resource->data.memory32.min_base_address = p->start; 754 resource->data.memory32.minimum = p->start;
755 resource->data.memory32.max_base_address = p->end; 755 resource->data.memory32.maximum = p->end;
756 resource->data.memory32.alignment = 0; 756 resource->data.memory32.alignment = 0;
757 resource->data.memory32.range_length = p->end - p->start + 1; 757 resource->data.memory32.address_length = p->end - p->start + 1;
758} 758}
759 759
760static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, 760static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource,
761 struct resource *p) 761 struct resource *p)
762{ 762{
763 resource->type = ACPI_RSTYPE_FIXED_MEM32; 763 resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32;
764 resource->length = sizeof(struct acpi_resource); 764 resource->length = sizeof(struct acpi_resource);
765 resource->data.fixed_memory32.read_write_attribute = 765 resource->data.fixed_memory32.read_write_attribute =
766 (p->flags & IORESOURCE_MEM_WRITEABLE) ? 766 (p->flags & IORESOURCE_MEM_WRITEABLE) ?
767 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; 767 ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
768 resource->data.fixed_memory32.range_base_address = p->start; 768 resource->data.fixed_memory32.address = p->start;
769 resource->data.fixed_memory32.range_length = p->end - p->start + 1; 769 resource->data.fixed_memory32.address_length = p->end - p->start + 1;
770} 770}
771 771
772int pnpacpi_encode_resources(struct pnp_resource_table *res_table, 772int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
773 struct acpi_buffer *buffer) 773 struct acpi_buffer *buffer)
774{ 774{
775 int i = 0; 775 int i = 0;
@@ -781,50 +781,50 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
781 pnp_dbg("res cnt %d", res_cnt); 781 pnp_dbg("res cnt %d", res_cnt);
782 while (i < res_cnt) { 782 while (i < res_cnt) {
783 switch(resource->type) { 783 switch(resource->type) {
784 case ACPI_RSTYPE_IRQ: 784 case ACPI_RESOURCE_TYPE_IRQ:
785 pnp_dbg("Encode irq"); 785 pnp_dbg("Encode irq");
786 pnpacpi_encode_irq(resource, 786 pnpacpi_encode_irq(resource,
787 &res_table->irq_resource[irq]); 787 &res_table->irq_resource[irq]);
788 irq++; 788 irq++;
789 break; 789 break;
790 790
791 case ACPI_RSTYPE_EXT_IRQ: 791 case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
792 pnp_dbg("Encode ext irq"); 792 pnp_dbg("Encode ext irq");
793 pnpacpi_encode_ext_irq(resource, 793 pnpacpi_encode_ext_irq(resource,
794 &res_table->irq_resource[irq]); 794 &res_table->irq_resource[irq]);
795 irq++; 795 irq++;
796 break; 796 break;
797 case ACPI_RSTYPE_DMA: 797 case ACPI_RESOURCE_TYPE_DMA:
798 pnp_dbg("Encode dma"); 798 pnp_dbg("Encode dma");
799 pnpacpi_encode_dma(resource, 799 pnpacpi_encode_dma(resource,
800 &res_table->dma_resource[dma]); 800 &res_table->dma_resource[dma]);
801 dma ++; 801 dma ++;
802 break; 802 break;
803 case ACPI_RSTYPE_IO: 803 case ACPI_RESOURCE_TYPE_IO:
804 pnp_dbg("Encode io"); 804 pnp_dbg("Encode io");
805 pnpacpi_encode_io(resource, 805 pnpacpi_encode_io(resource,
806 &res_table->port_resource[port]); 806 &res_table->port_resource[port]);
807 port ++; 807 port ++;
808 break; 808 break;
809 case ACPI_RSTYPE_FIXED_IO: 809 case ACPI_RESOURCE_TYPE_FIXED_IO:
810 pnp_dbg("Encode fixed io"); 810 pnp_dbg("Encode fixed io");
811 pnpacpi_encode_fixed_io(resource, 811 pnpacpi_encode_fixed_io(resource,
812 &res_table->port_resource[port]); 812 &res_table->port_resource[port]);
813 port ++; 813 port ++;
814 break; 814 break;
815 case ACPI_RSTYPE_MEM24: 815 case ACPI_RESOURCE_TYPE_MEMORY24:
816 pnp_dbg("Encode mem24"); 816 pnp_dbg("Encode mem24");
817 pnpacpi_encode_mem24(resource, 817 pnpacpi_encode_mem24(resource,
818 &res_table->mem_resource[mem]); 818 &res_table->mem_resource[mem]);
819 mem ++; 819 mem ++;
820 break; 820 break;
821 case ACPI_RSTYPE_MEM32: 821 case ACPI_RESOURCE_TYPE_MEMORY32:
822 pnp_dbg("Encode mem32"); 822 pnp_dbg("Encode mem32");
823 pnpacpi_encode_mem32(resource, 823 pnpacpi_encode_mem32(resource,
824 &res_table->mem_resource[mem]); 824 &res_table->mem_resource[mem]);
825 mem ++; 825 mem ++;
826 break; 826 break;
827 case ACPI_RSTYPE_FIXED_MEM32: 827 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
828 pnp_dbg("Encode fixed mem32"); 828 pnp_dbg("Encode fixed mem32");
829 pnpacpi_encode_fixed_mem32(resource, 829 pnpacpi_encode_fixed_mem32(resource,
830 &res_table->mem_resource[mem]); 830 &res_table->mem_resource[mem]);