aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorHuang Ying <ying.huang@intel.com>2011-12-07 22:25:50 -0500
committerLen Brown <len.brown@intel.com>2012-01-17 03:54:46 -0500
commit4134b8c8811f23aa8a281db50dcee64dda414736 (patch)
tree92b5c931590dba047f6634b401a45b6f8ccd1aed /drivers/acpi
parentb54ac6d2a25084667da781c7ca2cebef52a2bcdd (diff)
ACPI, APEI, Resolve false conflict between ACPI NVS and APEI
Some firmware will access memory in ACPI NVS region via APEI. That is, instructions in APEI ERST/EINJ table will read/write ACPI NVS region. The original resource conflict checking in APEI code will check memory/ioport accessed by APEI via general resource management mech. But ACPI NVS region is marked as busy already, so that the false resource conflict will prevent APEI ERST/EINJ to work. To fix this, this patch excludes ACPI NVS regions when APEI components request resources. So that they will not conflict with ACPI NVS regions. Reported-and-tested-by: Pavel Ivanov <paivanof@gmail.com> Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/apei/apei-base.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index f2c5062e2b32..4abb6c74a938 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -449,8 +449,19 @@ int apei_resources_sub(struct apei_resources *resources1,
449} 449}
450EXPORT_SYMBOL_GPL(apei_resources_sub); 450EXPORT_SYMBOL_GPL(apei_resources_sub);
451 451
452static int apei_get_nvs_callback(__u64 start, __u64 size, void *data)
453{
454 struct apei_resources *resources = data;
455 return apei_res_add(&resources->iomem, start, size);
456}
457
458static int apei_get_nvs_resources(struct apei_resources *resources)
459{
460 return acpi_nvs_for_each_region(apei_get_nvs_callback, resources);
461}
462
452/* 463/*
453 * IO memory/port rersource management mechanism is used to check 464 * IO memory/port resource management mechanism is used to check
454 * whether memory/port area used by GARs conflicts with normal memory 465 * whether memory/port area used by GARs conflicts with normal memory
455 * or IO memory/port of devices. 466 * or IO memory/port of devices.
456 */ 467 */
@@ -459,12 +470,26 @@ int apei_resources_request(struct apei_resources *resources,
459{ 470{
460 struct apei_res *res, *res_bak = NULL; 471 struct apei_res *res, *res_bak = NULL;
461 struct resource *r; 472 struct resource *r;
473 struct apei_resources nvs_resources;
462 int rc; 474 int rc;
463 475
464 rc = apei_resources_sub(resources, &apei_resources_all); 476 rc = apei_resources_sub(resources, &apei_resources_all);
465 if (rc) 477 if (rc)
466 return rc; 478 return rc;
467 479
480 /*
481 * Some firmware uses ACPI NVS region, that has been marked as
482 * busy, so exclude it from APEI resources to avoid false
483 * conflict.
484 */
485 apei_resources_init(&nvs_resources);
486 rc = apei_get_nvs_resources(&nvs_resources);
487 if (rc)
488 goto res_fini;
489 rc = apei_resources_sub(resources, &nvs_resources);
490 if (rc)
491 goto res_fini;
492
468 rc = -EINVAL; 493 rc = -EINVAL;
469 list_for_each_entry(res, &resources->iomem, list) { 494 list_for_each_entry(res, &resources->iomem, list) {
470 r = request_mem_region(res->start, res->end - res->start, 495 r = request_mem_region(res->start, res->end - res->start,
@@ -511,6 +536,8 @@ err_unmap_iomem:
511 break; 536 break;
512 release_mem_region(res->start, res->end - res->start); 537 release_mem_region(res->start, res->end - res->start);
513 } 538 }
539res_fini:
540 apei_resources_fini(&nvs_resources);
514 return rc; 541 return rc;
515} 542}
516EXPORT_SYMBOL_GPL(apei_resources_request); 543EXPORT_SYMBOL_GPL(apei_resources_request);