]> git.baikalelectronics.ru Git - uboot.git/commitdiff
x86: acpi: Don't touch ACPI hardware in write_acpi_tables()
authorBin Meng <bmeng.cn@gmail.com>
Thu, 19 Jul 2018 04:42:16 +0000 (21:42 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 20 Jul 2018 01:33:22 +0000 (09:33 +0800)
write_acpi_tables() currently touches ACPI hardware to switch to
ACPI mode at the end. Move such operation out of this function,
so that it only does what the function name tells us.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
arch/x86/cpu/cpu.c
arch/x86/lib/acpi_table.c

index d08b7d9b1e0f05c5642aa6c888ba3772eb7fd1da..290ee084e5e9ac7726c1115e3ffd84390bd95aeb 100644 (file)
@@ -179,17 +179,32 @@ __weak void board_final_cleanup(void)
 
 int last_stage_init(void)
 {
+       struct acpi_fadt __maybe_unused *fadt;
+
        board_final_cleanup();
 
-#if CONFIG_HAVE_ACPI_RESUME
-       struct acpi_fadt *fadt = acpi_find_fadt();
+#ifdef CONFIG_HAVE_ACPI_RESUME
+       fadt = acpi_find_fadt();
 
-       if (fadt != NULL && gd->arch.prev_sleep_state == ACPI_S3)
+       if (fadt && gd->arch.prev_sleep_state == ACPI_S3)
                acpi_resume(fadt);
 #endif
 
        write_tables();
 
+#ifdef CONFIG_GENERATE_ACPI_TABLE
+       fadt = acpi_find_fadt();
+
+       /* Don't touch ACPI hardware on HW reduced platforms */
+       if (fadt && !(fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)) {
+               /*
+                * Other than waiting for OSPM to request us to switch to ACPI
+                * mode, do it by ourselves, since SMI will not be triggered.
+                */
+               enter_acpi_mode(fadt->pm1a_cnt_blk);
+       }
+#endif
+
        return 0;
 }
 #endif
index e26c54d187a3b1f780fb73fe3bd05e3b5a43d4c6..e48c9b957447e7a84a7ab0161436f9091f382515 100644 (file)
@@ -12,7 +12,6 @@
 #include <dm/uclass-internal.h>
 #include <version.h>
 #include <asm/acpi/global_nvs.h>
-#include <asm/acpi.h>
 #include <asm/acpi_table.h>
 #include <asm/ioapic.h>
 #include <asm/lapic.h>
@@ -444,16 +443,6 @@ ulong write_acpi_tables(ulong start)
        acpi_rsdp_addr = (unsigned long)rsdp;
        debug("ACPI: done\n");
 
-       /* Don't touch ACPI hardware on HW reduced platforms */
-       if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
-               return current;
-
-       /*
-        * Other than waiting for OSPM to request us to switch to ACPI mode,
-        * do it by ourselves, since SMI will not be triggered.
-        */
-       enter_acpi_mode(fadt->pm1a_cnt_blk);
-
        return current;
 }