summaryrefslogtreecommitdiff
path: root/include/vbe.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2022-10-20 18:23:09 -0600
committerTom Rini <trini@konsulko.com>2022-10-31 11:03:18 -0400
commit70b26e4356f9153d2d8195748a0e146c35b0c42e (patch)
tree989bba69aef5da389fde5195e44a438c7a8f78de /include/vbe.h
parentf1459c365795a72fff94e249b0eb5cb61ead340e (diff)
vbe: Support selecting operations by SPL phase
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@chromium.org>
Diffstat (limited to 'include/vbe.h')
-rw-r--r--include/vbe.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/vbe.h b/include/vbe.h
index b83f6f0c51..ece2697b5d 100644
--- a/include/vbe.h
+++ b/include/vbe.h
@@ -11,6 +11,34 @@
#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
*
* This shows a list of the VBE bootmeth devices