diff options
| -rw-r--r-- | drivers/acpi/acpica/Makefile | 1 | ||||
| -rw-r--r-- | drivers/acpi/acpica/tbxface.c | 165 | ||||
| -rw-r--r-- | drivers/acpi/acpica/tbxfload.c | 211 |
3 files changed, 213 insertions, 164 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index fa9a7d5afeb8..0a1b3435f920 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
| @@ -134,6 +134,7 @@ acpi-y += \ | |||
| 134 | tbinstal.o \ | 134 | tbinstal.o \ |
| 135 | tbutils.o \ | 135 | tbutils.o \ |
| 136 | tbxface.o \ | 136 | tbxface.o \ |
| 137 | tbxfload.o \ | ||
| 137 | tbxfroot.o | 138 | tbxfroot.o |
| 138 | 139 | ||
| 139 | acpi-y += \ | 140 | acpi-y += \ |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index abcc6412c244..472a91ccde95 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | * | 2 | * |
| 3 | * Module Name: tbxface - Public interfaces to the ACPI subsystem | 3 | * Module Name: tbxface - ACPI table oriented external interfaces |
| 4 | * ACPI table oriented interfaces | ||
| 5 | * | 4 | * |
| 6 | *****************************************************************************/ | 5 | *****************************************************************************/ |
| 7 | 6 | ||
| @@ -51,11 +50,6 @@ | |||
| 51 | #define _COMPONENT ACPI_TABLES | 50 | #define _COMPONENT ACPI_TABLES |
| 52 | ACPI_MODULE_NAME("tbxface") | 51 | ACPI_MODULE_NAME("tbxface") |
| 53 | 52 | ||
| 54 | /* Local prototypes */ | ||
| 55 | static acpi_status acpi_tb_load_namespace(void); | ||
| 56 | |||
| 57 | static int no_auto_ssdt; | ||
| 58 | |||
| 59 | /******************************************************************************* | 53 | /******************************************************************************* |
| 60 | * | 54 | * |
| 61 | * FUNCTION: acpi_allocate_root_table | 55 | * FUNCTION: acpi_allocate_root_table |
| @@ -69,7 +63,6 @@ static int no_auto_ssdt; | |||
| 69 | * acpi_initialize_tables. | 63 | * acpi_initialize_tables. |
| 70 | * | 64 | * |
| 71 | ******************************************************************************/ | 65 | ******************************************************************************/ |
| 72 | |||
| 73 | acpi_status acpi_allocate_root_table(u32 initial_table_count) | 66 | acpi_status acpi_allocate_root_table(u32 initial_table_count) |
| 74 | { | 67 | { |
| 75 | 68 | ||
| @@ -502,150 +495,6 @@ acpi_get_table_by_index(u32 table_index, struct acpi_table_header **table) | |||
| 502 | 495 | ||
| 503 | ACPI_EXPORT_SYMBOL(acpi_get_table_by_index) | 496 | ACPI_EXPORT_SYMBOL(acpi_get_table_by_index) |
| 504 | 497 | ||
| 505 | /******************************************************************************* | ||
| 506 | * | ||
| 507 | * FUNCTION: acpi_tb_load_namespace | ||
| 508 | * | ||
| 509 | * PARAMETERS: None | ||
| 510 | * | ||
| 511 | * RETURN: Status | ||
| 512 | * | ||
| 513 | * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in | ||
| 514 | * the RSDT/XSDT. | ||
| 515 | * | ||
| 516 | ******************************************************************************/ | ||
| 517 | static acpi_status acpi_tb_load_namespace(void) | ||
| 518 | { | ||
| 519 | acpi_status status; | ||
| 520 | u32 i; | ||
| 521 | struct acpi_table_header *new_dsdt; | ||
| 522 | |||
| 523 | ACPI_FUNCTION_TRACE(tb_load_namespace); | ||
| 524 | |||
| 525 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
| 526 | |||
| 527 | /* | ||
| 528 | * Load the namespace. The DSDT is required, but any SSDT and | ||
| 529 | * PSDT tables are optional. Verify the DSDT. | ||
| 530 | */ | ||
| 531 | if (!acpi_gbl_root_table_list.current_table_count || | ||
| 532 | !ACPI_COMPARE_NAME(& | ||
| 533 | (acpi_gbl_root_table_list. | ||
| 534 | tables[ACPI_TABLE_INDEX_DSDT].signature), | ||
| 535 | ACPI_SIG_DSDT) | ||
| 536 | || | ||
| 537 | ACPI_FAILURE(acpi_tb_verify_table | ||
| 538 | (&acpi_gbl_root_table_list. | ||
| 539 | tables[ACPI_TABLE_INDEX_DSDT]))) { | ||
| 540 | status = AE_NO_ACPI_TABLES; | ||
| 541 | goto unlock_and_exit; | ||
| 542 | } | ||
| 543 | |||
| 544 | /* | ||
| 545 | * Save the DSDT pointer for simple access. This is the mapped memory | ||
| 546 | * address. We must take care here because the address of the .Tables | ||
| 547 | * array can change dynamically as tables are loaded at run-time. Note: | ||
| 548 | * .Pointer field is not validated until after call to acpi_tb_verify_table. | ||
| 549 | */ | ||
| 550 | acpi_gbl_DSDT = | ||
| 551 | acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer; | ||
| 552 | |||
| 553 | /* | ||
| 554 | * Optionally copy the entire DSDT to local memory (instead of simply | ||
| 555 | * mapping it.) There are some BIOSs that corrupt or replace the original | ||
| 556 | * DSDT, creating the need for this option. Default is FALSE, do not copy | ||
| 557 | * the DSDT. | ||
| 558 | */ | ||
| 559 | if (acpi_gbl_copy_dsdt_locally) { | ||
| 560 | new_dsdt = acpi_tb_copy_dsdt(ACPI_TABLE_INDEX_DSDT); | ||
| 561 | if (new_dsdt) { | ||
| 562 | acpi_gbl_DSDT = new_dsdt; | ||
| 563 | } | ||
| 564 | } | ||
| 565 | |||
| 566 | /* | ||
| 567 | * Save the original DSDT header for detection of table corruption | ||
| 568 | * and/or replacement of the DSDT from outside the OS. | ||
| 569 | */ | ||
| 570 | ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT, | ||
| 571 | sizeof(struct acpi_table_header)); | ||
| 572 | |||
| 573 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
| 574 | |||
| 575 | /* Load and parse tables */ | ||
| 576 | |||
| 577 | status = acpi_ns_load_table(ACPI_TABLE_INDEX_DSDT, acpi_gbl_root_node); | ||
| 578 | if (ACPI_FAILURE(status)) { | ||
| 579 | return_ACPI_STATUS(status); | ||
| 580 | } | ||
| 581 | |||
| 582 | /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ | ||
| 583 | |||
| 584 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
| 585 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { | ||
| 586 | if ((!ACPI_COMPARE_NAME | ||
| 587 | (&(acpi_gbl_root_table_list.tables[i].signature), | ||
| 588 | ACPI_SIG_SSDT) | ||
| 589 | && | ||
| 590 | !ACPI_COMPARE_NAME(& | ||
| 591 | (acpi_gbl_root_table_list.tables[i]. | ||
| 592 | signature), ACPI_SIG_PSDT)) | ||
| 593 | || | ||
| 594 | ACPI_FAILURE(acpi_tb_verify_table | ||
| 595 | (&acpi_gbl_root_table_list.tables[i]))) { | ||
| 596 | continue; | ||
| 597 | } | ||
| 598 | |||
| 599 | if (no_auto_ssdt) { | ||
| 600 | printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n"); | ||
| 601 | continue; | ||
| 602 | } | ||
| 603 | |||
| 604 | /* Ignore errors while loading tables, get as many as possible */ | ||
| 605 | |||
| 606 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
| 607 | (void)acpi_ns_load_table(i, acpi_gbl_root_node); | ||
| 608 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
| 609 | } | ||
| 610 | |||
| 611 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); | ||
| 612 | |||
| 613 | unlock_and_exit: | ||
| 614 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
| 615 | return_ACPI_STATUS(status); | ||
| 616 | } | ||
| 617 | |||
| 618 | /******************************************************************************* | ||
| 619 | * | ||
| 620 | * FUNCTION: acpi_load_tables | ||
| 621 | * | ||
| 622 | * PARAMETERS: None | ||
| 623 | * | ||
| 624 | * RETURN: Status | ||
| 625 | * | ||
| 626 | * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT | ||
| 627 | * | ||
| 628 | ******************************************************************************/ | ||
| 629 | |||
| 630 | acpi_status acpi_load_tables(void) | ||
| 631 | { | ||
| 632 | acpi_status status; | ||
| 633 | |||
| 634 | ACPI_FUNCTION_TRACE(acpi_load_tables); | ||
| 635 | |||
| 636 | /* Load the namespace from the tables */ | ||
| 637 | |||
| 638 | status = acpi_tb_load_namespace(); | ||
| 639 | if (ACPI_FAILURE(status)) { | ||
| 640 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 641 | "While loading namespace from ACPI tables")); | ||
| 642 | } | ||
| 643 | |||
| 644 | return_ACPI_STATUS(status); | ||
| 645 | } | ||
| 646 | |||
| 647 | ACPI_EXPORT_SYMBOL(acpi_load_tables) | ||
| 648 | |||
| 649 | 498 | ||
| 650 | /******************************************************************************* | 499 | /******************************************************************************* |
| 651 | * | 500 | * |
| @@ -734,15 +583,3 @@ acpi_status acpi_remove_table_handler(acpi_tbl_handler handler) | |||
| 734 | } | 583 | } |
| 735 | 584 | ||
| 736 | ACPI_EXPORT_SYMBOL(acpi_remove_table_handler) | 585 | ACPI_EXPORT_SYMBOL(acpi_remove_table_handler) |
| 737 | |||
| 738 | |||
| 739 | static int __init acpi_no_auto_ssdt_setup(char *s) { | ||
| 740 | |||
| 741 | printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); | ||
| 742 | |||
| 743 | no_auto_ssdt = 1; | ||
| 744 | |||
| 745 | return 1; | ||
| 746 | } | ||
| 747 | |||
| 748 | __setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup); | ||
diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c new file mode 100644 index 000000000000..54a01ae94f8b --- /dev/null +++ b/drivers/acpi/acpica/tbxfload.c | |||
| @@ -0,0 +1,211 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Module Name: tbxfload - Table load/unload external interfaces | ||
| 4 | * | ||
| 5 | *****************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2012, Intel Corp. | ||
| 9 | * All rights reserved. | ||
| 10 | * | ||
| 11 | * Redistribution and use in source and binary forms, with or without | ||
| 12 | * modification, are permitted provided that the following conditions | ||
| 13 | * are met: | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions, and the following disclaimer, | ||
| 16 | * without modification. | ||
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
| 20 | * including a substantially similar Disclaimer requirement for further | ||
| 21 | * binary redistribution. | ||
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
| 23 | * of any contributors may be used to endorse or promote products derived | ||
| 24 | * from this software without specific prior written permission. | ||
| 25 | * | ||
| 26 | * Alternatively, this software may be distributed under the terms of the | ||
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
| 28 | * Software Foundation. | ||
| 29 | * | ||
| 30 | * NO WARRANTY | ||
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 41 | * POSSIBILITY OF SUCH DAMAGES. | ||
| 42 | */ | ||
| 43 | |||
| 44 | #include <linux/export.h> | ||
| 45 | #include <acpi/acpi.h> | ||
| 46 | #include "accommon.h" | ||
| 47 | #include "acnamesp.h" | ||
| 48 | #include "actables.h" | ||
| 49 | |||
| 50 | #define _COMPONENT ACPI_TABLES | ||
| 51 | ACPI_MODULE_NAME("tbxfload") | ||
| 52 | |||
| 53 | /* Local prototypes */ | ||
| 54 | static acpi_status acpi_tb_load_namespace(void); | ||
| 55 | |||
| 56 | static int no_auto_ssdt; | ||
| 57 | |||
| 58 | /******************************************************************************* | ||
| 59 | * | ||
| 60 | * FUNCTION: acpi_load_tables | ||
| 61 | * | ||
| 62 | * PARAMETERS: None | ||
| 63 | * | ||
| 64 | * RETURN: Status | ||
| 65 | * | ||
| 66 | * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT | ||
| 67 | * | ||
| 68 | ******************************************************************************/ | ||
| 69 | |||
| 70 | acpi_status acpi_load_tables(void) | ||
| 71 | { | ||
| 72 | acpi_status status; | ||
| 73 | |||
| 74 | ACPI_FUNCTION_TRACE(acpi_load_tables); | ||
| 75 | |||
| 76 | /* Load the namespace from the tables */ | ||
| 77 | |||
| 78 | status = acpi_tb_load_namespace(); | ||
| 79 | if (ACPI_FAILURE(status)) { | ||
| 80 | ACPI_EXCEPTION((AE_INFO, status, | ||
| 81 | "While loading namespace from ACPI tables")); | ||
| 82 | } | ||
| 83 | |||
| 84 | return_ACPI_STATUS(status); | ||
| 85 | } | ||
| 86 | |||
| 87 | ACPI_EXPORT_SYMBOL(acpi_load_tables) | ||
| 88 | |||
| 89 | /******************************************************************************* | ||
| 90 | * | ||
| 91 | * FUNCTION: acpi_tb_load_namespace | ||
| 92 | * | ||
| 93 | * PARAMETERS: None | ||
| 94 | * | ||
| 95 | * RETURN: Status | ||
| 96 | * | ||
| 97 | * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in | ||
| 98 | * the RSDT/XSDT. | ||
| 99 | * | ||
| 100 | ******************************************************************************/ | ||
| 101 | static acpi_status acpi_tb_load_namespace(void) | ||
| 102 | { | ||
| 103 | acpi_status status; | ||
| 104 | u32 i; | ||
| 105 | struct acpi_table_header *new_dsdt; | ||
| 106 | |||
| 107 | ACPI_FUNCTION_TRACE(tb_load_namespace); | ||
| 108 | |||
| 109 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
| 110 | |||
| 111 | /* | ||
| 112 | * Load the namespace. The DSDT is required, but any SSDT and | ||
| 113 | * PSDT tables are optional. Verify the DSDT. | ||
| 114 | */ | ||
| 115 | if (!acpi_gbl_root_table_list.current_table_count || | ||
| 116 | !ACPI_COMPARE_NAME(& | ||
| 117 | (acpi_gbl_root_table_list. | ||
| 118 | tables[ACPI_TABLE_INDEX_DSDT].signature), | ||
| 119 | ACPI_SIG_DSDT) | ||
| 120 | || | ||
| 121 | ACPI_FAILURE(acpi_tb_verify_table | ||
| 122 | (&acpi_gbl_root_table_list. | ||
| 123 | tables[ACPI_TABLE_INDEX_DSDT]))) { | ||
| 124 | status = AE_NO_ACPI_TABLES; | ||
| 125 | goto unlock_and_exit; | ||
| 126 | } | ||
| 127 | |||
| 128 | /* | ||
| 129 | * Save the DSDT pointer for simple access. This is the mapped memory | ||
| 130 | * address. We must take care here because the address of the .Tables | ||
| 131 | * array can change dynamically as tables are loaded at run-time. Note: | ||
| 132 | * .Pointer field is not validated until after call to acpi_tb_verify_table. | ||
| 133 | */ | ||
| 134 | acpi_gbl_DSDT = | ||
| 135 | acpi_gbl_root_table_list.tables[ACPI_TABLE_INDEX_DSDT].pointer; | ||
| 136 | |||
| 137 | /* | ||
| 138 | * Optionally copy the entire DSDT to local memory (instead of simply | ||
| 139 | * mapping it.) There are some BIOSs that corrupt or replace the original | ||
| 140 | * DSDT, creating the need for this option. Default is FALSE, do not copy | ||
| 141 | * the DSDT. | ||
| 142 | */ | ||
| 143 | if (acpi_gbl_copy_dsdt_locally) { | ||
| 144 | new_dsdt = acpi_tb_copy_dsdt(ACPI_TABLE_INDEX_DSDT); | ||
| 145 | if (new_dsdt) { | ||
| 146 | acpi_gbl_DSDT = new_dsdt; | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | /* | ||
| 151 | * Save the original DSDT header for detection of table corruption | ||
| 152 | * and/or replacement of the DSDT from outside the OS. | ||
| 153 | */ | ||
| 154 | ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT, | ||
| 155 | sizeof(struct acpi_table_header)); | ||
| 156 | |||
| 157 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
| 158 | |||
| 159 | /* Load and parse tables */ | ||
| 160 | |||
| 161 | status = acpi_ns_load_table(ACPI_TABLE_INDEX_DSDT, acpi_gbl_root_node); | ||
| 162 | if (ACPI_FAILURE(status)) { | ||
| 163 | return_ACPI_STATUS(status); | ||
| 164 | } | ||
| 165 | |||
| 166 | /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ | ||
| 167 | |||
| 168 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
| 169 | for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { | ||
| 170 | if ((!ACPI_COMPARE_NAME | ||
| 171 | (&(acpi_gbl_root_table_list.tables[i].signature), | ||
| 172 | ACPI_SIG_SSDT) | ||
| 173 | && | ||
| 174 | !ACPI_COMPARE_NAME(& | ||
| 175 | (acpi_gbl_root_table_list.tables[i]. | ||
| 176 | signature), ACPI_SIG_PSDT)) | ||
| 177 | || | ||
| 178 | ACPI_FAILURE(acpi_tb_verify_table | ||
| 179 | (&acpi_gbl_root_table_list.tables[i]))) { | ||
| 180 | continue; | ||
| 181 | } | ||
| 182 | |||
| 183 | if (no_auto_ssdt) { | ||
| 184 | printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n"); | ||
| 185 | continue; | ||
| 186 | } | ||
| 187 | |||
| 188 | /* Ignore errors while loading tables, get as many as possible */ | ||
| 189 | |||
| 190 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
| 191 | (void)acpi_ns_load_table(i, acpi_gbl_root_node); | ||
| 192 | (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | ||
| 193 | } | ||
| 194 | |||
| 195 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); | ||
| 196 | |||
| 197 | unlock_and_exit: | ||
| 198 | (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); | ||
| 199 | return_ACPI_STATUS(status); | ||
| 200 | } | ||
| 201 | |||
| 202 | static int __init acpi_no_auto_ssdt_setup(char *s) { | ||
| 203 | |||
| 204 | printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); | ||
| 205 | |||
| 206 | no_auto_ssdt = 1; | ||
| 207 | |||
| 208 | return 1; | ||
| 209 | } | ||
| 210 | |||
| 211 | __setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup); | ||
