aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi/rsparser.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/pnpacpi/rsparser.c')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 416d30debe6c..2424bd3620dc 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -453,6 +453,45 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
453 return; 453 return;
454} 454}
455 455
456static void
457pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r)
458{
459 struct acpi_resource_address64 addr, *p = &addr;
460 acpi_status status;
461 struct pnp_mem * mem;
462 struct pnp_port * port;
463
464 status = acpi_resource_to_address64(r, p);
465 if (!ACPI_SUCCESS(status)) {
466 pnp_warn("PnPACPI: failed to convert resource type %d", r->id);
467 return;
468 }
469
470 if (p->address_length == 0)
471 return;
472
473 if (p->resource_type == ACPI_MEMORY_RANGE) {
474 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
475 if (!mem)
476 return;
477 mem->min = mem->max = p->min_address_range;
478 mem->size = p->address_length;
479 mem->align = 0;
480 mem->flags = (p->attribute.memory.read_write_attribute ==
481 ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0;
482 pnp_register_mem_resource(option,mem);
483 } else if (p->resource_type == ACPI_IO_RANGE) {
484 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
485 if (!port)
486 return;
487 port->min = port->max = p->min_address_range;
488 port->size = p->address_length;
489 port->align = 0;
490 port->flags = PNP_PORT_FLAG_FIXED;
491 pnp_register_port_resource(option,port);
492 }
493}
494
456struct acpipnp_parse_option_s { 495struct acpipnp_parse_option_s {
457 struct pnp_option *option; 496 struct pnp_option *option;
458 struct pnp_option *option_independent; 497 struct pnp_option *option_independent;
@@ -495,6 +534,11 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
495 pnpacpi_parse_fixed_mem32_option(option, 534 pnpacpi_parse_fixed_mem32_option(option,
496 &res->data.fixed_memory32); 535 &res->data.fixed_memory32);
497 break; 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;
498 case ACPI_RSTYPE_START_DPF: 542 case ACPI_RSTYPE_START_DPF:
499 switch (res->data.start_dpf.compatibility_priority) { 543 switch (res->data.start_dpf.compatibility_priority) {
500 case ACPI_GOOD_CONFIGURATION: 544 case ACPI_GOOD_CONFIGURATION:
@@ -568,11 +612,9 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
568 case ACPI_RSTYPE_MEM24: 612 case ACPI_RSTYPE_MEM24:
569 case ACPI_RSTYPE_MEM32: 613 case ACPI_RSTYPE_MEM32:
570 case ACPI_RSTYPE_FIXED_MEM32: 614 case ACPI_RSTYPE_FIXED_MEM32:
571#if 0
572 case ACPI_RSTYPE_ADDRESS16: 615 case ACPI_RSTYPE_ADDRESS16:
573 case ACPI_RSTYPE_ADDRESS32: 616 case ACPI_RSTYPE_ADDRESS32:
574 case ACPI_RSTYPE_ADDRESS64: 617 case ACPI_RSTYPE_ADDRESS64:
575#endif
576 (*res_cnt) ++; 618 (*res_cnt) ++;
577 default: 619 default:
578 return AE_OK; 620 return AE_OK;
@@ -593,11 +635,9 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res,
593 case ACPI_RSTYPE_MEM24: 635 case ACPI_RSTYPE_MEM24:
594 case ACPI_RSTYPE_MEM32: 636 case ACPI_RSTYPE_MEM32:
595 case ACPI_RSTYPE_FIXED_MEM32: 637 case ACPI_RSTYPE_FIXED_MEM32:
596#if 0
597 case ACPI_RSTYPE_ADDRESS16: 638 case ACPI_RSTYPE_ADDRESS16:
598 case ACPI_RSTYPE_ADDRESS32: 639 case ACPI_RSTYPE_ADDRESS32:
599 case ACPI_RSTYPE_ADDRESS64: 640 case ACPI_RSTYPE_ADDRESS64:
600#endif
601 (*resource)->id = res->id; 641 (*resource)->id = res->id;
602 (*resource)++; 642 (*resource)++;
603 default: 643 default: