summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2025-02-03 16:01:44 -0600
committerTom Rini <[email protected]>2025-02-03 16:01:44 -0600
commit3e69c75e86e1c32c8c0fd6153bcc10aa00fb3616 (patch)
tree676898552baf386cc0c4119ee4bf7edc1ba8aee0 /include
parent752321b62530dcbd6e8b5872aff4cf761809d76b (diff)
parentf1eb367d76c9b28053b3adcb6bdeb865c6eda5fd (diff)
Merge patch series "vbe: Series part G"
Simon Glass <[email protected]> says: This includes the VBE ABrec (A/B/recovery) implementation as well as a number of patches needed to make it work: - marking some code as used by SPL_RELOC - selection of images from a FIT based on the boot phase - removal of unwanted hash code which increases code-size too much - a few Kconfig-related additions for VPL Note: The goal for the next series (part H) is to enable VBE on rk3399-generic, i.e. able to boot on multiple rk3399-based boards with only the TPL phase being different for each board. Link: https://lore.kernel.org/r/[email protected]/
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/sections.h16
-rw-r--r--include/spl.h19
-rw-r--r--include/spl_load.h9
-rw-r--r--include/vbe.h21
4 files changed, 58 insertions, 7 deletions
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index b6bca53db10..3fd5c772a1a 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -67,6 +67,9 @@ extern char __text_start[];
/* This marks the text region which must be relocated */
extern char __image_copy_start[], __image_copy_end[];
+/* This marks the rcode region used for SPL relocation */
+extern char _rcode_start[], _rcode_end[];
+
extern char __bss_end[];
extern char __rel_dyn_start[], __rel_dyn_end[];
extern char _image_binary_end[];
@@ -77,4 +80,17 @@ extern char _image_binary_end[];
*/
extern void _start(void);
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(RELOC_LOADER)
+#define __rcode __section(".text.rcode")
+#define __rdata __section(".text.rdata")
+#else
+#define __rcode
+#define __rdata
+#endif
+#else
+#define __rcode
+#define __rdata
+#endif
+
#endif /* _ASM_GENERIC_SECTIONS_H_ */
diff --git a/include/spl.h b/include/spl.h
index 7155e9c67aa..850c64d4b19 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -345,7 +345,7 @@ typedef ulong (*spl_load_reader)(struct spl_load_info *load, ulong sector,
* @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
+ * @no_fdt_update: true to update the FDT with any loadables that are loaded
*/
struct spl_load_info {
spl_load_reader read;
@@ -355,7 +355,7 @@ struct spl_load_info {
#endif
#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
u8 phase;
- u8 fit_loaded;
+ u8 fdt_update;
#endif
};
@@ -395,12 +395,20 @@ static inline enum image_phase_t xpl_get_phase(struct spl_load_info *info)
#endif
}
-static inline bool xpl_get_fit_loaded(struct spl_load_info *info)
+static inline void xpl_set_fdt_update(struct spl_load_info *info,
+ bool fdt_update)
{
#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
- return info->fit_loaded;
+ info->fdt_update = fdt_update;
+#endif
+}
+
+static inline enum image_phase_t xpl_get_fdt_update(struct spl_load_info *info)
+{
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+ return info->fdt_update;
#else
- return false;
+ return true;
#endif
}
@@ -415,6 +423,7 @@ static inline void spl_load_init(struct spl_load_info *load,
load->priv = priv;
spl_set_bl_len(load, bl_len);
xpl_set_phase(load, IH_PHASE_NONE);
+ xpl_set_fdt_update(load, true);
}
/*
diff --git a/include/spl_load.h b/include/spl_load.h
index 935f7d336f2..525e0c9e86c 100644
--- a/include/spl_load.h
+++ b/include/spl_load.h
@@ -20,13 +20,15 @@ static inline int _spl_load(struct spl_image_info *spl_image,
ulong base_offset, image_offset, overhead;
int read, ret;
+ log_debug("\nloading hdr from %lx to %p\n", (ulong)offset, header);
read = info->read(info, offset, ALIGN(sizeof(*header),
spl_get_bl_len(info)), header);
if (read < (int)sizeof(*header))
return -EIO;
if (image_get_magic(header) == FDT_MAGIC) {
- if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL)) {
+ log_debug("Found FIT\n");
+ if (CONFIG_IS_ENABLED(LOAD_FIT_FULL)) {
void *buf;
/*
@@ -48,9 +50,12 @@ static inline int _spl_load(struct spl_image_info *spl_image,
return spl_parse_image_header(spl_image, bootdev, buf);
}
- if (IS_ENABLED(CONFIG_SPL_LOAD_FIT))
+ if (CONFIG_IS_ENABLED(LOAD_FIT)) {
+ log_debug("Simple loading\n");
return spl_load_simple_fit(spl_image, info, offset,
header);
+ }
+ log_debug("No FIT support\n");
}
if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER) &&
diff --git a/include/vbe.h b/include/vbe.h
index 56bff63362f..61bfa0e557d 100644
--- a/include/vbe.h
+++ b/include/vbe.h
@@ -10,6 +10,8 @@
#ifndef __VBE_H
#define __VBE_H
+#include <linux/types.h>
+
/**
* enum vbe_phase_t - current phase of VBE
*
@@ -26,12 +28,31 @@ enum vbe_phase_t {
};
/**
+ * enum vbe_pick_t - indicates which firmware is picked
+ *
+ * @VBEFT_A: Firmware A
+ * @VBEFT_B: Firmware B
+ * @VBEFT_RECOVERY: Recovery firmware
+ */
+enum vbe_pick_t {
+ VBEP_A,
+ VBEP_B,
+ VBEP_RECOVERY,
+};
+
+/**
* struct vbe_handoff - information about VBE progress
*
+ * @offset: Offset of the FIT to use for SPL onwards
+ * @size: Size of the area containing the FIT
* @phases: Indicates which phases used the VBE bootmeth (1 << PHASE_...)
+ * @pick: Indicates which firmware pick was used (enum vbe_pick_t)
*/
struct vbe_handoff {
+ ulong offset;
+ ulong size;
u8 phases;
+ u8 pick;
};
/**