diff options
author | Lv Zheng <lv.zheng@intel.com> | 2014-07-07 22:05:58 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-07-08 08:22:24 -0400 |
commit | 890fbfa051148933ea24cdaee868e2e1c4b93ecd (patch) | |
tree | d8e506339cccac935595136a45924d2c068b975f /tools/power | |
parent | 8aa5e56eeb61a099ea6519eb30ee399e1bc043ce (diff) |
ACPICA: acpidump: Add support for ACPI 1.0 GUID in Linux
For older EFI platforms, searches for the RSDP using ACPI 1.0 GUID if the
2.0 GUID search fails.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: David E. Box <david.e.box@linux.intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r-- | tools/power/acpi/os_specific/service_layers/oslinuxtbl.c | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c index 28c52008e854..0dc2485dedf5 100644 --- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c | |||
@@ -77,6 +77,9 @@ osl_map_table(acpi_size address, | |||
77 | 77 | ||
78 | static void osl_unmap_table(struct acpi_table_header *table); | 78 | static void osl_unmap_table(struct acpi_table_header *table); |
79 | 79 | ||
80 | static acpi_physical_address | ||
81 | osl_find_rsdp_via_efi_by_keyword(FILE * file, const char *keyword); | ||
82 | |||
80 | static acpi_physical_address osl_find_rsdp_via_efi(void); | 83 | static acpi_physical_address osl_find_rsdp_via_efi(void); |
81 | 84 | ||
82 | static acpi_status osl_load_rsdp(void); | 85 | static acpi_status osl_load_rsdp(void); |
@@ -417,6 +420,38 @@ acpi_os_get_table_by_index(u32 index, | |||
417 | 420 | ||
418 | /****************************************************************************** | 421 | /****************************************************************************** |
419 | * | 422 | * |
423 | * FUNCTION: osl_find_rsdp_via_efi_by_keyword | ||
424 | * | ||
425 | * PARAMETERS: keyword - Character string indicating ACPI GUID version | ||
426 | * in the EFI table | ||
427 | * | ||
428 | * RETURN: RSDP address if found | ||
429 | * | ||
430 | * DESCRIPTION: Find RSDP address via EFI using keyword indicating the ACPI | ||
431 | * GUID version. | ||
432 | * | ||
433 | *****************************************************************************/ | ||
434 | |||
435 | static acpi_physical_address | ||
436 | osl_find_rsdp_via_efi_by_keyword(FILE * file, const char *keyword) | ||
437 | { | ||
438 | char buffer[80]; | ||
439 | unsigned long long address = 0; | ||
440 | char format[32]; | ||
441 | |||
442 | snprintf(format, 32, "%s=%s", keyword, "%llx"); | ||
443 | fseek(file, 0, SEEK_SET); | ||
444 | while (fgets(buffer, 80, file)) { | ||
445 | if (sscanf(buffer, format, &address) == 1) { | ||
446 | break; | ||
447 | } | ||
448 | } | ||
449 | |||
450 | return ((acpi_physical_address) (address)); | ||
451 | } | ||
452 | |||
453 | /****************************************************************************** | ||
454 | * | ||
420 | * FUNCTION: osl_find_rsdp_via_efi | 455 | * FUNCTION: osl_find_rsdp_via_efi |
421 | * | 456 | * |
422 | * PARAMETERS: None | 457 | * PARAMETERS: None |
@@ -430,20 +465,19 @@ acpi_os_get_table_by_index(u32 index, | |||
430 | static acpi_physical_address osl_find_rsdp_via_efi(void) | 465 | static acpi_physical_address osl_find_rsdp_via_efi(void) |
431 | { | 466 | { |
432 | FILE *file; | 467 | FILE *file; |
433 | char buffer[80]; | 468 | acpi_physical_address address = 0; |
434 | unsigned long address = 0; | ||
435 | 469 | ||
436 | file = fopen(EFI_SYSTAB, "r"); | 470 | file = fopen(EFI_SYSTAB, "r"); |
437 | if (file) { | 471 | if (file) { |
438 | while (fgets(buffer, 80, file)) { | 472 | address = osl_find_rsdp_via_efi_by_keyword(file, "ACPI20"); |
439 | if (sscanf(buffer, "ACPI20=0x%lx", &address) == 1) { | 473 | if (!address) { |
440 | break; | 474 | address = |
441 | } | 475 | osl_find_rsdp_via_efi_by_keyword(file, "ACPI"); |
442 | } | 476 | } |
443 | fclose(file); | 477 | fclose(file); |
444 | } | 478 | } |
445 | 479 | ||
446 | return ((acpi_physical_address) (address)); | 480 | return (address); |
447 | } | 481 | } |
448 | 482 | ||
449 | /****************************************************************************** | 483 | /****************************************************************************** |