ACPICA: acpidump: Allow customized tables to be dumped without accessing /dev/mem
authorLv Zheng <lv.zheng@intel.com>
Wed, 1 Jul 2015 06:44:52 +0000 (14:44 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 1 Jul 2015 21:17:55 +0000 (23:17 +0200)
ACPICA commit ab29013cfa2424140446aff196a70b211ab343a9

The /dev/mem can be configured out, in which case, acpidump should still
work with "-c" option as tables can be found in /sys/firmware/acpi/tables.
This patch allows acpidump to work without /dev/mem.
This patch has been tested with "acpidump -c" and "acpidump -c -n FADT".
And it worked as expected. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/ab29013c
Reported-by: Al Stone <ahs3@redhat.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c

index db15c9d2049e08f6090d3d391a7617246aa9c1c5..3aff9a2c70888ea8d7894fce14fbf50642fc0577 100644 (file)
@@ -582,64 +582,67 @@ static acpi_status osl_table_initialize(void)
                return (AE_OK);
        }
 
-       /* Get RSDP from memory */
+       if (!gbl_dump_customized_tables) {
 
-       status = osl_load_rsdp();
-       if (ACPI_FAILURE(status)) {
-               return (status);
-       }
+               /* Get RSDP from memory */
+
+               status = osl_load_rsdp();
+               if (ACPI_FAILURE(status)) {
+                       return (status);
+               }
 
-       /* Get XSDT from memory */
+               /* Get XSDT from memory */
 
-       if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
-               if (gbl_xsdt) {
-                       free(gbl_xsdt);
-                       gbl_xsdt = NULL;
+               if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
+                       if (gbl_xsdt) {
+                               free(gbl_xsdt);
+                               gbl_xsdt = NULL;
+                       }
+
+                       gbl_revision = 2;
+                       status = osl_get_bios_table(ACPI_SIG_XSDT, 0,
+                                                   ACPI_CAST_PTR(struct
+                                                                 acpi_table_header
+                                                                 *, &gbl_xsdt),
+                                                   &address);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
                }
 
-               gbl_revision = 2;
-               status = osl_get_bios_table(ACPI_SIG_XSDT, 0,
-                                           ACPI_CAST_PTR(struct
-                                                         acpi_table_header *,
-                                                         &gbl_xsdt), &address);
-               if (ACPI_FAILURE(status)) {
-                       return (status);
+               /* Get RSDT from memory */
+
+               if (gbl_rsdp.rsdt_physical_address) {
+                       if (gbl_rsdt) {
+                               free(gbl_rsdt);
+                               gbl_rsdt = NULL;
+                       }
+
+                       status = osl_get_bios_table(ACPI_SIG_RSDT, 0,
+                                                   ACPI_CAST_PTR(struct
+                                                                 acpi_table_header
+                                                                 *, &gbl_rsdt),
+                                                   &address);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+                       }
                }
-       }
 
-       /* Get RSDT from memory */
+               /* Get FADT from memory */
 
-       if (gbl_rsdp.rsdt_physical_address) {
-               if (gbl_rsdt) {
-                       free(gbl_rsdt);
-                       gbl_rsdt = NULL;
+               if (gbl_fadt) {
+                       free(gbl_fadt);
+                       gbl_fadt = NULL;
                }
 
-               status = osl_get_bios_table(ACPI_SIG_RSDT, 0,
+               status = osl_get_bios_table(ACPI_SIG_FADT, 0,
                                            ACPI_CAST_PTR(struct
                                                          acpi_table_header *,
-                                                         &gbl_rsdt), &address);
+                                                         &gbl_fadt),
+                                           &gbl_fadt_address);
                if (ACPI_FAILURE(status)) {
                        return (status);
                }
-       }
-
-       /* Get FADT from memory */
-
-       if (gbl_fadt) {
-               free(gbl_fadt);
-               gbl_fadt = NULL;
-       }
-
-       status = osl_get_bios_table(ACPI_SIG_FADT, 0,
-                                   ACPI_CAST_PTR(struct acpi_table_header *,
-                                                 &gbl_fadt),
-                                   &gbl_fadt_address);
-       if (ACPI_FAILURE(status)) {
-               return (status);
-       }
-
-       if (!gbl_dump_customized_tables) {
 
                /* Add mandatory tables to global table list first */