Create a new arch-specific way of creating a standard passage to the
next phase.

Signed-off-by: Simon Glass <[email protected]>
---

Changes in v2:
- Make the stdpass calling standard arch-specific

 common/spl/spl.c                  | 27 ++++++++++++++++++++++-----
 include/asm-generic/global_data.h |  6 ++++++
 include/passage.h                 | 28 ++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 5 deletions(-)
 create mode 100644 include/passage.h

diff --git a/common/spl/spl.c b/common/spl/spl.c
index be770d0226c..0b78fdd5eae 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -22,6 +22,7 @@
 #include <malloc.h>
 #include <mapmem.h>
 #include <nand.h>
+#include <passage.h>
 #include <serial.h>
 #include <spl.h>
 #if CONFIG_IS_ENABLED(BANNER_PRINT)
@@ -392,13 +393,29 @@ int spl_parse_image_header(struct spl_image_info 
*spl_image,
 
 __weak void __noreturn jump_to_image(struct spl_image_info *spl_image)
 {
-       typedef void __noreturn (*image_entry_noargs_t)(void);
-
-       image_entry_noargs_t image_entry =
-               (image_entry_noargs_t)spl_image->entry_point;
+       typedef void __noreturn (*image_entry_t)(void);
+       ulong bloblist = 0;
+       ulong dtb_offset = 0;
 
        debug("image entry point: 0x%lx\n", spl_image->entry_point);
-       image_entry();
+
+       if (CONFIG_IS_ENABLED(PASSAGE_OUT)) {
+               const void *fdt;
+
+               bloblist = bloblist_get_base();
+               fdt = bloblist_find(BLOBLISTT_CONTROL_DTB, 0);
+
+               log_debug("passage: sending bloblist at %lx, dtb offset %lx\n",
+                         bloblist, dtb_offset);
+               arch_passage_entry(spl_image->entry_point,
+                                  map_to_sysmem(gd_bloblist()),
+                                  map_to_sysmem(fdt));
+       } else {
+               image_entry_t image_entry;
+
+               image_entry = (image_entry_t)spl_image->entry_point;
+               image_entry();
+       }
 }
 
 #if CONFIG_IS_ENABLED(HANDOFF)
diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index 34b4139e498..71a60115cee 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -552,6 +552,12 @@ static_assert(sizeof(struct global_data) == GD_SIZE);
 #define gd_set_multi_dtb_fit(_dtb)
 #endif
 
+#if CONFIG_IS_ENABLED(BLOBLIST)
+#define gd_bloblist()          gd->bloblist
+#else
+#define gd_bloblist()          NULL
+#endif
+
 /**
  * enum gd_flags - global data flags
  *
diff --git a/include/passage.h b/include/passage.h
new file mode 100644
index 00000000000..51c40154711
--- /dev/null
+++ b/include/passage.h
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Standard passage implementation
+ *
+ * Copyright 2022 Google LLC
+ * Written by Simon Glass <[email protected]>
+ */
+
+#ifndef __PASSAGE_H
+#define __PASSAGE_H
+
+enum {
+       PASSAGE_ABI_MACH        = 0xb00757a3,
+       PASSAGE_ABI_VERSION     = 1,
+};
+
+static inline ulong passage_mach_version(void)
+{
+#if BITS_PER_LONG == 64
+       return (ulong)PASSAGE_ABI_MACH << 32 | PASSAGE_ABI_VERSION;
+#else
+       return (PASSAGE_ABI_MACH & ~0xff) | PASSAGE_ABI_VERSION;
+#endif
+}
+
+void __noreturn arch_passage_entry(ulong entry_addr, ulong bloblist, ulong 
fdt);
+
+#endif
-- 
2.34.1.703.g22d0c6ccf7-goog

Reply via email to