[PATCH v3 32/43] vbe: Support selecting operations by SPL phase

Simon Glass sjg at chromium.org
Fri Oct 21 02:23:09 CEST 2022


VBE supports booting firmware during the SPL phases, i.e. so that VPL can
start SPL and SPL can start U-Boot.

It also supports booting an OS, when in U-Boot.

As a first step towards these features, add functions to indicate the
current VBE phase. The firmware selection is done in VPL and the OS
selection is done in U-Boot proper.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 include/vbe.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/include/vbe.h b/include/vbe.h
index b83f6f0c519..ece2697b5dc 100644
--- a/include/vbe.h
+++ b/include/vbe.h
@@ -10,6 +10,34 @@
 #ifndef __VBE_H
 #define __VBE_H
 
+/**
+ * enum vbe_phase_t - current phase of VBE
+ *
+ * VBE operates in two distinct phases. In VPL it has to choose which firmware
+ * to run (SPL, U-Boot, OP-TEE, etc.). It then carries on running until it gets
+ * to U-Boot, where it decides which OS to run
+ *
+ * @VBE_PHASE_FIRMWARE: Selecting the firmware to run
+ * @VBE_PHASE_OS: Selecting the Operating System to run
+ */
+enum vbe_phase_t {
+	VBE_PHASE_FIRMWARE,
+	VBE_PHASE_OS,
+};
+
+/**
+ * vbe_phase() - get current VBE phase
+ *
+ * Returns: Current VBE phase
+ */
+static inline enum vbe_phase_t vbe_phase(void)
+{
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		return VBE_PHASE_FIRMWARE;
+
+	return VBE_PHASE_OS;
+}
+
 /**
  * vbe_list() - List the VBE bootmeths
  *
-- 
2.38.0.135.g90850a2211-goog



More information about the U-Boot mailing list