x86: Notify the FSP of the 'end firmware' event
authorSimon Glass <sjg@chromium.org>
Tue, 22 Sep 2020 18:45:28 +0000 (12:45 -0600)
committerBin Meng <bmeng.cn@gmail.com>
Fri, 25 Sep 2020 03:27:22 +0000 (11:27 +0800)
Send this notification when U-Boot is about to boot into Linux, as
requested by the FSP.

Currently this causes a crash with the APL FSP, so leave it disabled for
now.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/cpu.c
arch/x86/lib/fsp/fsp_common.c

index 69c1418..f869275 100644 (file)
@@ -189,6 +189,14 @@ __weak void board_final_init(void)
 {
 }
 
+/*
+ * Implement a weak default function for boards that need to do some final
+ * processing before booting the OS.
+ */
+__weak void board_final_cleanup(void)
+{
+}
+
 int last_stage_init(void)
 {
        struct acpi_fadt __maybe_unused *fadt;
@@ -218,6 +226,13 @@ int last_stage_init(void)
                }
        }
 
+       /*
+        * TODO(sjg@chromium.org): Move this to bootm_announce_and_cleanup()
+        * once APL FSP-S at 0x200000 does not overlap with the bzimage at
+        * 0x100000.
+        */
+       board_final_cleanup();
+
        return 0;
 }
 #endif
index ea52954..4061fa2 100644 (file)
@@ -60,6 +60,22 @@ void board_final_init(void)
                debug("OK\n");
 }
 
+void board_final_cleanup(void)
+{
+       u32 status;
+
+       /* TODO(sjg@chromium.org): This causes Linux to crash */
+       return;
+
+       /* call into FspNotify */
+       debug("Calling into FSP (notify phase INIT_PHASE_END_FIRMWARE): ");
+       status = fsp_notify(NULL, INIT_PHASE_END_FIRMWARE);
+       if (status)
+               debug("fail, error code %x\n", status);
+       else
+               debug("OK\n");
+}
+
 int fsp_save_s3_stack(void)
 {
        struct udevice *dev;