summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/emulation/qemu-power9/Makefile.inc2
-rw-r--r--src/mainboard/emulation/qemu-power9/ramstage.c21
2 files changed, 23 insertions, 0 deletions
diff --git a/src/mainboard/emulation/qemu-power9/Makefile.inc b/src/mainboard/emulation/qemu-power9/Makefile.inc
index bd905a3029..ace00a75b7 100644
--- a/src/mainboard/emulation/qemu-power9/Makefile.inc
+++ b/src/mainboard/emulation/qemu-power9/Makefile.inc
@@ -2,3 +2,5 @@
romstage-y += cbmem.c
romstage-y += romstage.c
+
+ramstage-y += ramstage.c
diff --git a/src/mainboard/emulation/qemu-power9/ramstage.c b/src/mainboard/emulation/qemu-power9/ramstage.c
new file mode 100644
index 0000000000..c92587b696
--- /dev/null
+++ b/src/mainboard/emulation/qemu-power9/ramstage.c
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <cpu/power/spr.h>
+#include <program_loading.h>
+
+/*
+ * Payload's entry point is an offset to the real entry point, not to OPD
+ * (Official Procedure Descriptor) for entry point.
+ *
+ * Also pass FDT address to payload stored in SPR_HSPRG0 by bootblock.
+ */
+void platform_prog_run(struct prog *prog)
+{
+ asm volatile(
+ "mfspr %%r27, %0\n" /* pass pointer to FDT */
+ "mtctr %2\n"
+ "mr 3, %1\n"
+ "bctr\n"
+ :: "i"(SPR_HSPRG0), "r"(prog_entry_arg(prog)), "r"(prog_entry(prog))
+ : "memory");
+}