diff options
author | Lv Zheng <lv.zheng@intel.com> | 2016-09-13 05:48:27 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-09-16 19:10:43 -0400 |
commit | 307ecb0aa3a24528efd1cfcea8215b2d82df6e10 (patch) | |
tree | 0f60262d00305de3163cd9fda66b9b01369bb412 | |
parent | 237502055915b7bb6c04f4eafd85f3a4704771fb (diff) |
ACPI / sysfs: Fix an issue for LoadTable opcode
OEM tables can be installed via RSDT/XSDT, in this case, they have already
been created under /sys/firmware/acpi/tables.
For this kind of tables, normally LoadTable opcode will be executed to load
them. If LoadTable opcode is executed after acpi_sysfs_init(),
acpi_sysfs_table_handler() will be invoked, thus a redundant table file
will be created under /sys/firmware/acpi/tables/dynamic. Then running
"acpidump" on such platform results in an error, complaining blank empty
table (see Link 1 below).
The bug can be reproduced by customizing an OEM1 table, allowing it to be
overridden via 'table_sigs' (drivers/acpi/tables.c), adding the following
code to the customized DSDT to load it:
Name (OEMH, Zero)
Name (OEMF, One)
If (LEqual (OEMF, One)) {
Store (LoadTable ("OEM1", "Intel", "Test"), OEMH)
Store (Zero, OEMF)
}
In order to make sure that the OEM1 table is installed after
acpi_sysfs_init(), acpi_sysfs_init() can be moved before invoking
acpi_load_tables(). Then the following command execution result can be
seen:
# acpidump > acpidump.txt
Could not read table header: /sysfs/firmware/acpi/tables/dynamic/OEM12
Could not get ACPI table at index 17, AE_BAD_HEADER
Link: https://bugzilla.kernel.org/show_bug.cgi?id=150841 # [1]
Link: https://github.com/acpica/acpica/commit/ed6a5fbc
Reported-by: Jason Voelz <jason.voelz@intel.com>
Reported-by: Francisco Leoner <francisco.j.lenoer.soto@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/sysfs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 703c993888b2..c88d4bdf2165 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
@@ -383,7 +383,7 @@ acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context) | |||
383 | struct acpi_table_attr *table_attr; | 383 | struct acpi_table_attr *table_attr; |
384 | 384 | ||
385 | switch (event) { | 385 | switch (event) { |
386 | case ACPI_TABLE_EVENT_LOAD: | 386 | case ACPI_TABLE_EVENT_INSTALL: |
387 | table_attr = | 387 | table_attr = |
388 | kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); | 388 | kzalloc(sizeof(struct acpi_table_attr), GFP_KERNEL); |
389 | if (!table_attr) | 389 | if (!table_attr) |
@@ -397,7 +397,9 @@ acpi_status acpi_sysfs_table_handler(u32 event, void *table, void *context) | |||
397 | } else | 397 | } else |
398 | list_add_tail(&table_attr->node, &acpi_table_attr_list); | 398 | list_add_tail(&table_attr->node, &acpi_table_attr_list); |
399 | break; | 399 | break; |
400 | case ACPI_TABLE_EVENT_LOAD: | ||
400 | case ACPI_TABLE_EVENT_UNLOAD: | 401 | case ACPI_TABLE_EVENT_UNLOAD: |
402 | case ACPI_TABLE_EVENT_UNINSTALL: | ||
401 | /* | 403 | /* |
402 | * we do not need to do anything right now | 404 | * we do not need to do anything right now |
403 | * because the table is not deleted from the | 405 | * because the table is not deleted from the |