summaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-07-08 04:05:58 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-08 14:22:24 +0200
commit890fbfa051148933ea24cdaee868e2e1c4b93ecd (patch)
treed8e506339cccac935595136a45924d2c068b975f /tools/power
parentACPICA: Utilities: Fix memory leak in acpi_ut_copy_iobject_to_iobject (diff)
downloadlinux-890fbfa051148933ea24cdaee868e2e1c4b93ecd.tar.xz
linux-890fbfa051148933ea24cdaee868e2e1c4b93ecd.zip
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.c48
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,
static void osl_unmap_table(struct acpi_table_header *table);
+static acpi_physical_address
+osl_find_rsdp_via_efi_by_keyword(FILE * file, const char *keyword);
+
static acpi_physical_address osl_find_rsdp_via_efi(void);
static acpi_status osl_load_rsdp(void);
@@ -417,6 +420,38 @@ acpi_os_get_table_by_index(u32 index,
/******************************************************************************
*
+ * FUNCTION: osl_find_rsdp_via_efi_by_keyword
+ *
+ * PARAMETERS: keyword - Character string indicating ACPI GUID version
+ * in the EFI table
+ *
+ * RETURN: RSDP address if found
+ *
+ * DESCRIPTION: Find RSDP address via EFI using keyword indicating the ACPI
+ * GUID version.
+ *
+ *****************************************************************************/
+
+static acpi_physical_address
+osl_find_rsdp_via_efi_by_keyword(FILE * file, const char *keyword)
+{
+ char buffer[80];
+ unsigned long long address = 0;
+ char format[32];
+
+ snprintf(format, 32, "%s=%s", keyword, "%llx");
+ fseek(file, 0, SEEK_SET);
+ while (fgets(buffer, 80, file)) {
+ if (sscanf(buffer, format, &address) == 1) {
+ break;
+ }
+ }
+
+ return ((acpi_physical_address) (address));
+}
+
+/******************************************************************************
+ *
* FUNCTION: osl_find_rsdp_via_efi
*
* PARAMETERS: None
@@ -430,20 +465,19 @@ acpi_os_get_table_by_index(u32 index,
static acpi_physical_address osl_find_rsdp_via_efi(void)
{
FILE *file;
- char buffer[80];
- unsigned long address = 0;
+ acpi_physical_address address = 0;
file = fopen(EFI_SYSTAB, "r");
if (file) {
- while (fgets(buffer, 80, file)) {
- if (sscanf(buffer, "ACPI20=0x%lx", &address) == 1) {
- break;
- }
+ address = osl_find_rsdp_via_efi_by_keyword(file, "ACPI20");
+ if (!address) {
+ address =
+ osl_find_rsdp_via_efi_by_keyword(file, "ACPI");
}
fclose(file);
}
- return ((acpi_physical_address) (address));
+ return (address);
}
/******************************************************************************