spl: Add fields for VBE
authorSimon Glass <sjg@chromium.org>
Thu, 16 Jan 2025 01:27:17 +0000 (18:27 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 22 Jan 2025 15:47:50 +0000 (09:47 -0600)
Add some fields to track the VBE state in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
include/spl.h

index 43b344d..781e5a2 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/global_data.h>
 #include <asm/spl.h>
 #include <handoff.h>
+#include <image.h>
 #include <mmc.h>
 
 struct blk_desc;
@@ -265,6 +266,11 @@ enum spl_sandbox_flags {
        SPL_SANDBOXF_ARG_IS_BUF,
 };
 
+/**
+ * struct spl_image_info - Information about the SPL image being loaded
+ *
+ * @fdt_size: Size of the FDT for the image (0 if none)
+ */
 struct spl_image_info {
        const char *name;
        u8 os;
@@ -276,6 +282,7 @@ struct spl_image_info {
        u32 boot_device;
        u32 offset;
        u32 size;
+       ulong fdt_size;
        u32 flags;
        void *arg;
 #ifdef CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK
@@ -316,12 +323,18 @@ typedef ulong (*spl_load_reader)(struct spl_load_info *load, ulong sector,
  * @read: Function to call to read from the device
  * @priv: Private data for the device
  * @bl_len: Block length for reading in bytes
+ * @phase: Image phase to load
+ * @fit_loaded: true if the FIT has been loaded, except for external data
  */
 struct spl_load_info {
        spl_load_reader read;
        void *priv;
 #if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
-       int bl_len;
+       u16 bl_len;
+#endif
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+       u8 phase;
+       u8 fit_loaded;
 #endif
 };
 
@@ -344,6 +357,32 @@ static inline void spl_set_bl_len(struct spl_load_info *info, int bl_len)
 #endif
 }
 
+static inline void xpl_set_phase(struct spl_load_info *info,
+                                enum image_phase_t phase)
+{
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+       info->phase = phase;
+#endif
+}
+
+static inline enum image_phase_t xpl_get_phase(struct spl_load_info *info)
+{
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+       return info->phase;
+#else
+       return IH_PHASE_NONE;
+#endif
+}
+
+static inline bool xpl_get_fit_loaded(struct spl_load_info *info)
+{
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+       return info->fit_loaded;
+#else
+       return false;
+#endif
+}
+
 /**
  * spl_load_init() - Set up a new spl_load_info structure
  */