aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/tbxface.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/tbxface.c')
-rw-r--r--drivers/acpi/acpica/tbxface.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c
index f5378fc302b3..adb7f56b853e 100644
--- a/drivers/acpi/acpica/tbxface.c
+++ b/drivers/acpi/acpica/tbxface.c
@@ -513,39 +513,56 @@ static acpi_status acpi_tb_load_namespace(void)
513{ 513{
514 acpi_status status; 514 acpi_status status;
515 u32 i; 515 u32 i;
516 struct acpi_table_header *new_dsdt;
516 517
517 ACPI_FUNCTION_TRACE(tb_load_namespace); 518 ACPI_FUNCTION_TRACE(tb_load_namespace);
518 519
519 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 520 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
520 521
521 acpi_gbl_DSDT = &acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT];
522
523 /* 522 /*
524 * Load the namespace. The DSDT is required, but any SSDT and 523 * Load the namespace. The DSDT is required, but any SSDT and
525 * PSDT tables are optional. Verify the DSDT. 524 * PSDT tables are optional. Verify the DSDT.
526 */ 525 */
527 if (!acpi_gbl_root_table_list.count || 526 if (!acpi_gbl_root_table_list.count ||
528 !ACPI_COMPARE_NAME(&acpi_gbl_DSDT->signature, ACPI_SIG_DSDT) || 527 !ACPI_COMPARE_NAME(&
529 ACPI_FAILURE(acpi_tb_verify_table(acpi_gbl_DSDT))) { 528 (acpi_gbl_root_table_list.
529 tables[ACPI_TABLE_INDEX_DSDT].signature),
530 ACPI_SIG_DSDT)
531 ||
532 ACPI_FAILURE(acpi_tb_verify_table
533 (&acpi_gbl_root_table_list.
534 tables[ACPI_TABLE_INDEX_DSDT]))) {
530 status = AE_NO_ACPI_TABLES; 535 status = AE_NO_ACPI_TABLES;
531 goto unlock_and_exit; 536 goto unlock_and_exit;
532 } 537 }
533 538
534 /* 539 /*
540 * Save the DSDT pointer for simple access. This is the mapped memory
541 * address. We must take care here because the address of the .Tables
542 * array can change dynamically as tables are loaded at run-time. Note:
543 * .Pointer field is not validated until after call to acpi_tb_verify_table.
544 */
545 acpi_gbl_DSDT =
546 acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer;
547
548 /*
535 * Optionally copy the entire DSDT to local memory (instead of simply 549 * Optionally copy the entire DSDT to local memory (instead of simply
536 * mapping it.) There are some BIOSs that corrupt or replace the original 550 * mapping it.) There are some BIOSs that corrupt or replace the original
537 * DSDT, creating the need for this option. Default is FALSE, do not copy 551 * DSDT, creating the need for this option. Default is FALSE, do not copy
538 * the DSDT. 552 * the DSDT.
539 */ 553 */
540 if (acpi_gbl_copy_dsdt_locally) { 554 if (acpi_gbl_copy_dsdt_locally) {
541 acpi_tb_copy_dsdt(acpi_gbl_DSDT); 555 new_dsdt = acpi_tb_copy_dsdt(ACPI_TABLE_INDEX_DSDT);
556 if (new_dsdt) {
557 acpi_gbl_DSDT = new_dsdt;
558 }
542 } 559 }
543 560
544 /* 561 /*
545 * Save the original DSDT header for detection of table corruption 562 * Save the original DSDT header for detection of table corruption
546 * and/or replacement of the DSDT from outside the OS. 563 * and/or replacement of the DSDT from outside the OS.
547 */ 564 */
548 ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT->pointer, 565 ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
549 sizeof(struct acpi_table_header)); 566 sizeof(struct acpi_table_header));
550 567
551 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); 568 (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);