diff options
Diffstat (limited to 'drivers/pnp/pnpacpi/rsparser.c')
| -rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 199 |
1 files changed, 88 insertions, 111 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 407b4eaddcbf..3a4a644c2686 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
| @@ -36,13 +36,13 @@ static int irq_flags(int triggering, int polarity) | |||
| 36 | { | 36 | { |
| 37 | int flag; | 37 | int flag; |
| 38 | if (triggering == ACPI_LEVEL_SENSITIVE) { | 38 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
| 39 | if(polarity == 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(polarity == 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; |
| @@ -57,7 +57,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
| 57 | *triggering = ACPI_LEVEL_SENSITIVE; | 57 | *triggering = ACPI_LEVEL_SENSITIVE; |
| 58 | *polarity = ACPI_ACTIVE_LOW; | 58 | *polarity = ACPI_ACTIVE_LOW; |
| 59 | break; | 59 | break; |
| 60 | case IORESOURCE_IRQ_HIGHLEVEL: | 60 | case IORESOURCE_IRQ_HIGHLEVEL: |
| 61 | *triggering = ACPI_LEVEL_SENSITIVE; | 61 | *triggering = ACPI_LEVEL_SENSITIVE; |
| 62 | *polarity = ACPI_ACTIVE_HIGH; | 62 | *polarity = ACPI_ACTIVE_HIGH; |
| 63 | break; | 63 | break; |
| @@ -73,7 +73,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
| 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 triggering, int polarity) | 77 | int triggering, int polarity) |
| 78 | { | 78 | { |
| 79 | int i = 0; | 79 | int i = 0; |
| @@ -101,7 +101,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | static void | 103 | static void |
| 104 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | 104 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) |
| 105 | { | 105 | { |
| 106 | int i = 0; | 106 | int i = 0; |
| 107 | while (i < PNP_MAX_DMA && | 107 | while (i < PNP_MAX_DMA && |
| @@ -119,8 +119,8 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | static void | 121 | static void |
| 122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | 122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, |
| 123 | u32 io, u32 len) | 123 | u64 io, u64 len) |
| 124 | { | 124 | { |
| 125 | int i = 0; | 125 | int i = 0; |
| 126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && | 126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && |
| @@ -138,7 +138,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | |||
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | static void | 140 | static void |
| 141 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | 141 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, |
| 142 | u64 mem, u64 len) | 142 | u64 mem, u64 len) |
| 143 | { | 143 | { |
| 144 | int i = 0; | 144 | int i = 0; |
| @@ -156,11 +156,32 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | |||
| 156 | } | 156 | } |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | static void | ||
| 160 | pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | ||
| 161 | struct acpi_resource *res) | ||
| 162 | { | ||
| 163 | struct acpi_resource_address64 addr, *p = &addr; | ||
| 164 | acpi_status status; | ||
| 165 | |||
| 166 | status = acpi_resource_to_address64(res, p); | ||
| 167 | if (!ACPI_SUCCESS(status)) { | ||
| 168 | pnp_warn("PnPACPI: failed to convert resource type %d", | ||
| 169 | res->type); | ||
| 170 | return; | ||
| 171 | } | ||
| 172 | |||
| 173 | if (p->resource_type == ACPI_MEMORY_RANGE) | ||
| 174 | pnpacpi_parse_allocated_memresource(res_table, | ||
| 175 | p->minimum, p->address_length); | ||
| 176 | else if (p->resource_type == ACPI_IO_RANGE) | ||
| 177 | pnpacpi_parse_allocated_ioresource(res_table, | ||
| 178 | p->minimum, p->address_length); | ||
| 179 | } | ||
| 159 | 180 | ||
| 160 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 181 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
| 161 | void *data) | 182 | void *data) |
| 162 | { | 183 | { |
| 163 | struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; | 184 | struct pnp_resource_table *res_table = (struct pnp_resource_table *)data; |
| 164 | int i; | 185 | int i; |
| 165 | 186 | ||
| 166 | switch (res->type) { | 187 | switch (res->type) { |
| @@ -221,19 +242,9 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
| 221 | res->data.fixed_memory32.address_length); | 242 | res->data.fixed_memory32.address_length); |
| 222 | break; | 243 | break; |
| 223 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 244 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
| 224 | pnpacpi_parse_allocated_memresource(res_table, | ||
| 225 | res->data.address16.minimum, | ||
| 226 | res->data.address16.address_length); | ||
| 227 | break; | ||
| 228 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 245 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
| 229 | pnpacpi_parse_allocated_memresource(res_table, | ||
| 230 | res->data.address32.minimum, | ||
| 231 | res->data.address32.address_length); | ||
| 232 | break; | ||
| 233 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 246 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
| 234 | pnpacpi_parse_allocated_memresource(res_table, | 247 | pnpacpi_parse_allocated_address_space(res_table, res); |
| 235 | res->data.address64.minimum, | ||
| 236 | res->data.address64.address_length); | ||
| 237 | break; | 248 | break; |
| 238 | 249 | ||
| 239 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | 250 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: |
| @@ -255,11 +266,11 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
| 255 | pnp_warn("PnPACPI: unknown resource type %d", res->type); | 266 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
| 256 | return AE_ERROR; | 267 | return AE_ERROR; |
| 257 | } | 268 | } |
| 258 | 269 | ||
| 259 | return AE_OK; | 270 | return AE_OK; |
| 260 | } | 271 | } |
| 261 | 272 | ||
| 262 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table * res) | 273 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table *res) |
| 263 | { | 274 | { |
| 264 | /* Blank the resource table values */ | 275 | /* Blank the resource table values */ |
| 265 | pnp_init_resource_table(res); | 276 | pnp_init_resource_table(res); |
| @@ -317,17 +328,17 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
| 317 | pnp_err("Invalid DMA transfer type"); | 328 | pnp_err("Invalid DMA transfer type"); |
| 318 | } | 329 | } |
| 319 | 330 | ||
| 320 | pnp_register_dma_resource(option,dma); | 331 | pnp_register_dma_resource(option, dma); |
| 321 | return; | 332 | return; |
| 322 | } | 333 | } |
| 323 | 334 | ||
| 324 | 335 | ||
| 325 | static void pnpacpi_parse_irq_option(struct pnp_option *option, | 336 | static void pnpacpi_parse_irq_option(struct pnp_option *option, |
| 326 | struct acpi_resource_irq *p) | 337 | struct acpi_resource_irq *p) |
| 327 | { | 338 | { |
| 328 | int i; | 339 | int i; |
| 329 | struct pnp_irq * irq; | 340 | struct pnp_irq *irq; |
| 330 | 341 | ||
| 331 | if (p->interrupt_count == 0) | 342 | if (p->interrupt_count == 0) |
| 332 | return; | 343 | return; |
| 333 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 344 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); |
| @@ -347,7 +358,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, | |||
| 347 | struct acpi_resource_extended_irq *p) | 358 | struct acpi_resource_extended_irq *p) |
| 348 | { | 359 | { |
| 349 | int i; | 360 | int i; |
| 350 | struct pnp_irq * irq; | 361 | struct pnp_irq *irq; |
| 351 | 362 | ||
| 352 | if (p->interrupt_count == 0) | 363 | if (p->interrupt_count == 0) |
| 353 | return; | 364 | return; |
| @@ -368,7 +379,7 @@ static void | |||
| 368 | pnpacpi_parse_port_option(struct pnp_option *option, | 379 | pnpacpi_parse_port_option(struct pnp_option *option, |
| 369 | struct acpi_resource_io *io) | 380 | struct acpi_resource_io *io) |
| 370 | { | 381 | { |
| 371 | struct pnp_port * port; | 382 | struct pnp_port *port; |
| 372 | 383 | ||
| 373 | if (io->address_length == 0) | 384 | if (io->address_length == 0) |
| 374 | return; | 385 | return; |
| @@ -381,7 +392,7 @@ pnpacpi_parse_port_option(struct pnp_option *option, | |||
| 381 | port->size = io->address_length; | 392 | port->size = io->address_length; |
| 382 | port->flags = ACPI_DECODE_16 == io->io_decode ? | 393 | port->flags = ACPI_DECODE_16 == io->io_decode ? |
| 383 | PNP_PORT_FLAG_16BITADDR : 0; | 394 | PNP_PORT_FLAG_16BITADDR : 0; |
| 384 | pnp_register_port_resource(option,port); | 395 | pnp_register_port_resource(option, port); |
| 385 | return; | 396 | return; |
| 386 | } | 397 | } |
| 387 | 398 | ||
| @@ -389,7 +400,7 @@ static void | |||
| 389 | pnpacpi_parse_fixed_port_option(struct pnp_option *option, | 400 | pnpacpi_parse_fixed_port_option(struct pnp_option *option, |
| 390 | struct acpi_resource_fixed_io *io) | 401 | struct acpi_resource_fixed_io *io) |
| 391 | { | 402 | { |
| 392 | struct pnp_port * port; | 403 | struct pnp_port *port; |
| 393 | 404 | ||
| 394 | if (io->address_length == 0) | 405 | if (io->address_length == 0) |
| 395 | return; | 406 | return; |
| @@ -400,7 +411,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
| 400 | port->size = io->address_length; | 411 | port->size = io->address_length; |
| 401 | port->align = 0; | 412 | port->align = 0; |
| 402 | port->flags = PNP_PORT_FLAG_FIXED; | 413 | port->flags = PNP_PORT_FLAG_FIXED; |
| 403 | pnp_register_port_resource(option,port); | 414 | pnp_register_port_resource(option, port); |
| 404 | return; | 415 | return; |
| 405 | } | 416 | } |
| 406 | 417 | ||
| @@ -408,7 +419,7 @@ static void | |||
| 408 | pnpacpi_parse_mem24_option(struct pnp_option *option, | 419 | pnpacpi_parse_mem24_option(struct pnp_option *option, |
| 409 | struct acpi_resource_memory24 *p) | 420 | struct acpi_resource_memory24 *p) |
| 410 | { | 421 | { |
| 411 | struct pnp_mem * mem; | 422 | struct pnp_mem *mem; |
| 412 | 423 | ||
| 413 | if (p->address_length == 0) | 424 | if (p->address_length == 0) |
| 414 | return; | 425 | return; |
| @@ -423,7 +434,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, | |||
| 423 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 434 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
| 424 | IORESOURCE_MEM_WRITEABLE : 0; | 435 | IORESOURCE_MEM_WRITEABLE : 0; |
| 425 | 436 | ||
| 426 | pnp_register_mem_resource(option,mem); | 437 | pnp_register_mem_resource(option, mem); |
| 427 | return; | 438 | return; |
| 428 | } | 439 | } |
| 429 | 440 | ||
| @@ -431,7 +442,7 @@ static void | |||
| 431 | pnpacpi_parse_mem32_option(struct pnp_option *option, | 442 | pnpacpi_parse_mem32_option(struct pnp_option *option, |
| 432 | struct acpi_resource_memory32 *p) | 443 | struct acpi_resource_memory32 *p) |
| 433 | { | 444 | { |
| 434 | struct pnp_mem * mem; | 445 | struct pnp_mem *mem; |
| 435 | 446 | ||
| 436 | if (p->address_length == 0) | 447 | if (p->address_length == 0) |
| 437 | return; | 448 | return; |
| @@ -446,7 +457,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, | |||
| 446 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 457 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
| 447 | IORESOURCE_MEM_WRITEABLE : 0; | 458 | IORESOURCE_MEM_WRITEABLE : 0; |
| 448 | 459 | ||
| 449 | pnp_register_mem_resource(option,mem); | 460 | pnp_register_mem_resource(option, mem); |
| 450 | return; | 461 | return; |
| 451 | } | 462 | } |
| 452 | 463 | ||
| @@ -454,7 +465,7 @@ static void | |||
| 454 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | 465 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, |
| 455 | struct acpi_resource_fixed_memory32 *p) | 466 | struct acpi_resource_fixed_memory32 *p) |
| 456 | { | 467 | { |
| 457 | struct pnp_mem * mem; | 468 | struct pnp_mem *mem; |
| 458 | 469 | ||
| 459 | if (p->address_length == 0) | 470 | if (p->address_length == 0) |
| 460 | return; | 471 | return; |
| @@ -468,7 +479,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | |||
| 468 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 479 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
| 469 | IORESOURCE_MEM_WRITEABLE : 0; | 480 | IORESOURCE_MEM_WRITEABLE : 0; |
| 470 | 481 | ||
| 471 | pnp_register_mem_resource(option,mem); | 482 | pnp_register_mem_resource(option, mem); |
| 472 | return; | 483 | return; |
| 473 | } | 484 | } |
| 474 | 485 | ||
| @@ -477,8 +488,8 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
| 477 | { | 488 | { |
| 478 | struct acpi_resource_address64 addr, *p = &addr; | 489 | struct acpi_resource_address64 addr, *p = &addr; |
| 479 | acpi_status status; | 490 | acpi_status status; |
| 480 | struct pnp_mem * mem; | 491 | struct pnp_mem *mem; |
| 481 | struct pnp_port * port; | 492 | struct pnp_port *port; |
| 482 | 493 | ||
| 483 | status = acpi_resource_to_address64(r, p); | 494 | status = acpi_resource_to_address64(r, p); |
| 484 | if (!ACPI_SUCCESS(status)) { | 495 | if (!ACPI_SUCCESS(status)) { |
| @@ -498,7 +509,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
| 498 | mem->align = 0; | 509 | mem->align = 0; |
| 499 | mem->flags = (p->info.mem.write_protect == | 510 | mem->flags = (p->info.mem.write_protect == |
| 500 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; | 511 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; |
| 501 | pnp_register_mem_resource(option,mem); | 512 | pnp_register_mem_resource(option, mem); |
| 502 | } else if (p->resource_type == ACPI_IO_RANGE) { | 513 | } else if (p->resource_type == ACPI_IO_RANGE) { |
| 503 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 514 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
| 504 | if (!port) | 515 | if (!port) |
| @@ -507,7 +518,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
| 507 | port->size = p->address_length; | 518 | port->size = p->address_length; |
| 508 | port->align = 0; | 519 | port->align = 0; |
| 509 | port->flags = PNP_PORT_FLAG_FIXED; | 520 | port->flags = PNP_PORT_FLAG_FIXED; |
| 510 | pnp_register_port_resource(option,port); | 521 | pnp_register_port_resource(option, port); |
| 511 | } | 522 | } |
| 512 | } | 523 | } |
| 513 | 524 | ||
| @@ -531,7 +542,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
| 531 | break; | 542 | break; |
| 532 | 543 | ||
| 533 | case ACPI_RESOURCE_TYPE_DMA: | 544 | case ACPI_RESOURCE_TYPE_DMA: |
| 534 | pnpacpi_parse_dma_option(option, &res->data.dma); | 545 | pnpacpi_parse_dma_option(option, &res->data.dma); |
| 535 | break; | 546 | break; |
| 536 | 547 | ||
| 537 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 548 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
| @@ -539,7 +550,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
| 539 | case ACPI_GOOD_CONFIGURATION: | 550 | case ACPI_GOOD_CONFIGURATION: |
| 540 | priority = PNP_RES_PRIORITY_PREFERRED; | 551 | priority = PNP_RES_PRIORITY_PREFERRED; |
| 541 | break; | 552 | break; |
| 542 | 553 | ||
| 543 | case ACPI_ACCEPTABLE_CONFIGURATION: | 554 | case ACPI_ACCEPTABLE_CONFIGURATION: |
| 544 | priority = PNP_RES_PRIORITY_ACCEPTABLE; | 555 | priority = PNP_RES_PRIORITY_ACCEPTABLE; |
| 545 | break; | 556 | break; |
| @@ -555,7 +566,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
| 555 | option = pnp_register_dependent_option(dev, priority); | 566 | option = pnp_register_dependent_option(dev, priority); |
| 556 | if (!option) | 567 | if (!option) |
| 557 | return AE_ERROR; | 568 | return AE_ERROR; |
| 558 | parse_data->option = option; | 569 | parse_data->option = option; |
| 559 | break; | 570 | break; |
| 560 | 571 | ||
| 561 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | 572 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: |
| @@ -615,7 +626,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
| 615 | pnp_warn("PnPACPI: unknown resource type %d", res->type); | 626 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
| 616 | return AE_ERROR; | 627 | return AE_ERROR; |
| 617 | } | 628 | } |
| 618 | 629 | ||
| 619 | return AE_OK; | 630 | return AE_OK; |
| 620 | } | 631 | } |
| 621 | 632 | ||
| @@ -636,13 +647,8 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | |||
| 636 | return status; | 647 | return status; |
| 637 | } | 648 | } |
| 638 | 649 | ||
| 639 | /* | 650 | static int pnpacpi_supported_resource(struct acpi_resource *res) |
| 640 | * Set resource | ||
| 641 | */ | ||
| 642 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | ||
| 643 | void *data) | ||
| 644 | { | 651 | { |
| 645 | int *res_cnt = (int *)data; | ||
| 646 | switch (res->type) { | 652 | switch (res->type) { |
| 647 | case ACPI_RESOURCE_TYPE_IRQ: | 653 | case ACPI_RESOURCE_TYPE_IRQ: |
| 648 | case ACPI_RESOURCE_TYPE_DMA: | 654 | case ACPI_RESOURCE_TYPE_DMA: |
| @@ -655,43 +661,32 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | |||
| 655 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 661 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
| 656 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 662 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
| 657 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 663 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
| 658 | (*res_cnt) ++; | 664 | return 1; |
| 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: | ||
| 664 | default: | ||
| 665 | return AE_OK; | ||
| 666 | } | 665 | } |
| 667 | return AE_OK; | 666 | return 0; |
| 668 | } | 667 | } |
| 669 | 668 | ||
| 670 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | 669 | /* |
| 670 | * Set resource | ||
| 671 | */ | ||
| 672 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | ||
| 671 | void *data) | 673 | void *data) |
| 672 | { | 674 | { |
| 673 | struct acpi_resource **resource = (struct acpi_resource **)data; | 675 | int *res_cnt = (int *)data; |
| 674 | switch (res->type) { | 676 | |
| 675 | case ACPI_RESOURCE_TYPE_IRQ: | 677 | if (pnpacpi_supported_resource(res)) |
| 676 | case ACPI_RESOURCE_TYPE_DMA: | 678 | (*res_cnt)++; |
| 677 | case ACPI_RESOURCE_TYPE_IO: | 679 | return AE_OK; |
| 678 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 680 | } |
| 679 | case ACPI_RESOURCE_TYPE_MEMORY24: | 681 | |
| 680 | case ACPI_RESOURCE_TYPE_MEMORY32: | 682 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) |
| 681 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 683 | { |
| 682 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 684 | struct acpi_resource **resource = (struct acpi_resource **)data; |
| 683 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 685 | |
| 684 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 686 | if (pnpacpi_supported_resource(res)) { |
| 685 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | ||
| 686 | (*resource)->type = res->type; | 687 | (*resource)->type = res->type; |
| 688 | (*resource)->length = sizeof(struct acpi_resource); | ||
| 687 | (*resource)++; | 689 | (*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: | ||
| 693 | default: | ||
| 694 | return AE_OK; | ||
| 695 | } | 690 | } |
| 696 | 691 | ||
| 697 | return AE_OK; | 692 | return AE_OK; |
| @@ -735,11 +730,8 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource, | |||
| 735 | struct resource *p) | 730 | struct resource *p) |
| 736 | { | 731 | { |
| 737 | int triggering, polarity; | 732 | int triggering, polarity; |
| 738 | 733 | ||
| 739 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, | 734 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); |
| 740 | &polarity); | ||
| 741 | resource->type = ACPI_RESOURCE_TYPE_IRQ; | ||
| 742 | resource->length = sizeof(struct acpi_resource); | ||
| 743 | resource->data.irq.triggering = triggering; | 735 | resource->data.irq.triggering = triggering; |
| 744 | resource->data.irq.polarity = polarity; | 736 | resource->data.irq.polarity = polarity; |
| 745 | if (triggering == ACPI_EDGE_SENSITIVE) | 737 | if (triggering == ACPI_EDGE_SENSITIVE) |
| @@ -754,11 +746,8 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
| 754 | struct resource *p) | 746 | struct resource *p) |
| 755 | { | 747 | { |
| 756 | int triggering, polarity; | 748 | int triggering, polarity; |
| 757 | 749 | ||
| 758 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, | 750 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); |
| 759 | &polarity); | ||
| 760 | resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; | ||
| 761 | resource->length = sizeof(struct acpi_resource); | ||
| 762 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; | 751 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; |
| 763 | resource->data.extended_irq.triggering = triggering; | 752 | resource->data.extended_irq.triggering = triggering; |
| 764 | resource->data.extended_irq.polarity = polarity; | 753 | resource->data.extended_irq.polarity = polarity; |
| @@ -773,8 +762,6 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
| 773 | static void pnpacpi_encode_dma(struct acpi_resource *resource, | 762 | static void pnpacpi_encode_dma(struct acpi_resource *resource, |
| 774 | struct resource *p) | 763 | struct resource *p) |
| 775 | { | 764 | { |
| 776 | resource->type = ACPI_RESOURCE_TYPE_DMA; | ||
| 777 | resource->length = sizeof(struct acpi_resource); | ||
| 778 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ | 765 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ |
| 779 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) | 766 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) |
| 780 | resource->data.dma.type = ACPI_COMPATIBILITY; | 767 | resource->data.dma.type = ACPI_COMPATIBILITY; |
| @@ -798,8 +785,6 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, | |||
| 798 | static void pnpacpi_encode_io(struct acpi_resource *resource, | 785 | static void pnpacpi_encode_io(struct acpi_resource *resource, |
| 799 | struct resource *p) | 786 | struct resource *p) |
| 800 | { | 787 | { |
| 801 | resource->type = ACPI_RESOURCE_TYPE_IO; | ||
| 802 | resource->length = sizeof(struct acpi_resource); | ||
| 803 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ | 788 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ |
| 804 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? | 789 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? |
| 805 | ACPI_DECODE_16 : ACPI_DECODE_10; | 790 | ACPI_DECODE_16 : ACPI_DECODE_10; |
| @@ -812,8 +797,6 @@ static void pnpacpi_encode_io(struct acpi_resource *resource, | |||
| 812 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | 797 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, |
| 813 | struct resource *p) | 798 | struct resource *p) |
| 814 | { | 799 | { |
| 815 | resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; | ||
| 816 | resource->length = sizeof(struct acpi_resource); | ||
| 817 | resource->data.fixed_io.address = p->start; | 800 | resource->data.fixed_io.address = p->start; |
| 818 | resource->data.fixed_io.address_length = p->end - p->start + 1; | 801 | resource->data.fixed_io.address_length = p->end - p->start + 1; |
| 819 | } | 802 | } |
| @@ -821,8 +804,6 @@ static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | |||
| 821 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, | 804 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, |
| 822 | struct resource *p) | 805 | struct resource *p) |
| 823 | { | 806 | { |
| 824 | resource->type = ACPI_RESOURCE_TYPE_MEMORY24; | ||
| 825 | resource->length = sizeof(struct acpi_resource); | ||
| 826 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ | 807 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ |
| 827 | resource->data.memory24.write_protect = | 808 | resource->data.memory24.write_protect = |
| 828 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 809 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
| @@ -836,8 +817,6 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, | |||
| 836 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, | 817 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, |
| 837 | struct resource *p) | 818 | struct resource *p) |
| 838 | { | 819 | { |
| 839 | resource->type = ACPI_RESOURCE_TYPE_MEMORY32; | ||
| 840 | resource->length = sizeof(struct acpi_resource); | ||
| 841 | resource->data.memory32.write_protect = | 820 | resource->data.memory32.write_protect = |
| 842 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 821 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
| 843 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 822 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
| @@ -850,8 +829,6 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, | |||
| 850 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | 829 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, |
| 851 | struct resource *p) | 830 | struct resource *p) |
| 852 | { | 831 | { |
| 853 | resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; | ||
| 854 | resource->length = sizeof(struct acpi_resource); | ||
| 855 | resource->data.fixed_memory32.write_protect = | 832 | resource->data.fixed_memory32.write_protect = |
| 856 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 833 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
| 857 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 834 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
| @@ -882,37 +859,37 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
| 882 | pnp_dbg("Encode dma"); | 859 | pnp_dbg("Encode dma"); |
| 883 | pnpacpi_encode_dma(resource, | 860 | pnpacpi_encode_dma(resource, |
| 884 | &res_table->dma_resource[dma]); | 861 | &res_table->dma_resource[dma]); |
| 885 | dma ++; | 862 | dma++; |
| 886 | break; | 863 | break; |
| 887 | case ACPI_RESOURCE_TYPE_IO: | 864 | case ACPI_RESOURCE_TYPE_IO: |
| 888 | pnp_dbg("Encode io"); | 865 | pnp_dbg("Encode io"); |
| 889 | pnpacpi_encode_io(resource, | 866 | pnpacpi_encode_io(resource, |
| 890 | &res_table->port_resource[port]); | 867 | &res_table->port_resource[port]); |
| 891 | port ++; | 868 | port++; |
| 892 | break; | 869 | break; |
| 893 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 870 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
| 894 | pnp_dbg("Encode fixed io"); | 871 | pnp_dbg("Encode fixed io"); |
| 895 | pnpacpi_encode_fixed_io(resource, | 872 | pnpacpi_encode_fixed_io(resource, |
| 896 | &res_table->port_resource[port]); | 873 | &res_table->port_resource[port]); |
| 897 | port ++; | 874 | port++; |
| 898 | break; | 875 | break; |
| 899 | case ACPI_RESOURCE_TYPE_MEMORY24: | 876 | case ACPI_RESOURCE_TYPE_MEMORY24: |
| 900 | pnp_dbg("Encode mem24"); | 877 | pnp_dbg("Encode mem24"); |
| 901 | pnpacpi_encode_mem24(resource, | 878 | pnpacpi_encode_mem24(resource, |
| 902 | &res_table->mem_resource[mem]); | 879 | &res_table->mem_resource[mem]); |
| 903 | mem ++; | 880 | mem++; |
| 904 | break; | 881 | break; |
| 905 | case ACPI_RESOURCE_TYPE_MEMORY32: | 882 | case ACPI_RESOURCE_TYPE_MEMORY32: |
| 906 | pnp_dbg("Encode mem32"); | 883 | pnp_dbg("Encode mem32"); |
| 907 | pnpacpi_encode_mem32(resource, | 884 | pnpacpi_encode_mem32(resource, |
| 908 | &res_table->mem_resource[mem]); | 885 | &res_table->mem_resource[mem]); |
| 909 | mem ++; | 886 | mem++; |
| 910 | break; | 887 | break; |
| 911 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 888 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
| 912 | pnp_dbg("Encode fixed mem32"); | 889 | pnp_dbg("Encode fixed mem32"); |
| 913 | pnpacpi_encode_fixed_mem32(resource, | 890 | pnpacpi_encode_fixed_mem32(resource, |
| 914 | &res_table->mem_resource[mem]); | 891 | &res_table->mem_resource[mem]); |
| 915 | mem ++; | 892 | mem++; |
| 916 | break; | 893 | break; |
| 917 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 894 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
| 918 | pnp_dbg("Encode ext irq"); | 895 | pnp_dbg("Encode ext irq"); |
| @@ -933,8 +910,8 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
| 933 | pnp_warn("unknown resource type %d", resource->type); | 910 | pnp_warn("unknown resource type %d", resource->type); |
| 934 | return -EINVAL; | 911 | return -EINVAL; |
| 935 | } | 912 | } |
| 936 | resource ++; | 913 | resource++; |
| 937 | i ++; | 914 | i++; |
| 938 | } | 915 | } |
| 939 | return 0; | 916 | return 0; |
| 940 | } | 917 | } |
