summaryrefslogtreecommitdiff
path: root/include/spl.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/spl.h')
-rw-r--r--include/spl.h84
1 files changed, 48 insertions, 36 deletions
diff --git a/include/spl.h b/include/spl.h
index de808ccd413..269e36bb441 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -34,24 +34,26 @@ struct spl_boot_device;
enum boot_device;
/*
- * u_boot_first_phase() - check if this is the first U-Boot phase
+ * xpl_is_first_phase() - check if this is the first U-Boot phase
*
- * U-Boot has up to three phases: TPL, SPL and U-Boot proper. Depending on the
- * build flags we can determine whether the current build is for the first
+ * U-Boot has up to four phases: TPL, VPL, SPL and U-Boot proper. Depending on
+ * the build flags we can determine whether the current build is for the first
* phase of U-Boot or not. If there is no SPL, then this is U-Boot proper. If
* there is SPL but no TPL, the the first phase is SPL. If there is TPL, then
- * it is the first phase.
+ * it is the first phase, etc.
*
- * @returns true if this is the first phase of U-Boot
+ * Note that VPL can never be the first phase. If it exists, it is loaded from
+ * TPL
*
+ * Return: true if this is the first phase of U-Boot
*/
-static inline bool u_boot_first_phase(void)
+static inline bool xpl_is_first_phase(void)
{
if (IS_ENABLED(CONFIG_TPL)) {
if (IS_ENABLED(CONFIG_TPL_BUILD))
return true;
} else if (IS_ENABLED(CONFIG_SPL)) {
- if (IS_ENABLED(CONFIG_SPL_BUILD))
+ if (IS_ENABLED(CONFIG_XPL_BUILD))
return true;
} else {
return true;
@@ -60,7 +62,7 @@ static inline bool u_boot_first_phase(void)
return false;
}
-enum u_boot_phase {
+enum xpl_phase_t {
PHASE_NONE, /* Invalid phase, signifying before U-Boot */
PHASE_TPL, /* Running in TPL */
PHASE_VPL, /* Running in VPL */
@@ -72,7 +74,7 @@ enum u_boot_phase {
};
/**
- * spl_phase() - Find out the phase of U-Boot
+ * xpl_phase() - Find out the phase of U-Boot
*
* This can be used to avoid #ifdef logic and use if() instead.
*
@@ -84,43 +86,43 @@ enum u_boot_phase {
*
* but with this you can use:
*
- * if (spl_phase() == PHASE_TPL) {
+ * if (xpl_phase() == PHASE_TPL) {
* ...
* }
*
* To include code only in SPL, you might do:
*
- * #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
+ * #if defined(CONFIG_XPL_BUILD) && !defined(CONFIG_TPL_BUILD)
* ...
* #endif
*
* but with this you can use:
*
- * if (spl_phase() == PHASE_SPL) {
+ * if (xpl_phase() == PHASE_SPL) {
* ...
* }
*
* To include code only in U-Boot proper, you might do:
*
- * #ifndef CONFIG_SPL_BUILD
+ * #ifndef CONFIG_XPL_BUILD
* ...
* #endif
*
* but with this you can use:
*
- * if (spl_phase() == PHASE_BOARD_F) {
+ * if (xpl_phase() == PHASE_BOARD_F) {
* ...
* }
*
* Return: U-Boot phase
*/
-static inline enum u_boot_phase spl_phase(void)
+static inline enum xpl_phase_t xpl_phase(void)
{
#ifdef CONFIG_TPL_BUILD
return PHASE_TPL;
#elif defined(CONFIG_VPL_BUILD)
return PHASE_VPL;
-#elif defined(CONFIG_SPL_BUILD)
+#elif defined(CONFIG_XPL_BUILD)
return PHASE_SPL;
#else
DECLARE_GLOBAL_DATA_PTR;
@@ -132,29 +134,39 @@ static inline enum u_boot_phase spl_phase(void)
#endif
}
-/* returns true if in U-Boot proper, false if in SPL */
-static inline bool spl_in_proper(void)
+/* returns true if in U-Boot proper, false if in xPL */
+static inline bool not_xpl(void)
{
-#ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_XPL_BUILD
return false;
#endif
return true;
}
+/* returns true if in xPL, false if in U-Boot proper */
+static inline bool is_xpl(void)
+{
+#ifdef CONFIG_XPL_BUILD
+ return true;
+#endif
+
+ return false;
+}
+
/**
- * spl_prev_phase() - Figure out the previous U-Boot phase
+ * xpl_prev_phase() - Figure out the previous U-Boot phase
*
* Return: the previous phase from this one, e.g. if called in SPL this returns
* PHASE_TPL, if TPL is enabled
*/
-static inline enum u_boot_phase spl_prev_phase(void)
+static inline enum xpl_phase_t xpl_prev_phase(void)
{
#ifdef CONFIG_TPL_BUILD
return PHASE_NONE;
#elif defined(CONFIG_VPL_BUILD)
return PHASE_TPL; /* VPL requires TPL */
-#elif defined(CONFIG_SPL_BUILD)
+#elif defined(CONFIG_XPL_BUILD)
return IS_ENABLED(CONFIG_VPL) ? PHASE_VPL :
IS_ENABLED(CONFIG_TPL) ? PHASE_TPL :
PHASE_NONE;
@@ -165,12 +177,12 @@ static inline enum u_boot_phase spl_prev_phase(void)
}
/**
- * spl_next_phase() - Figure out the next U-Boot phase
+ * xpl_next_phase() - Figure out the next U-Boot phase
*
* Return: the next phase from this one, e.g. if called in TPL this returns
* PHASE_SPL
*/
-static inline enum u_boot_phase spl_next_phase(void)
+static inline enum xpl_phase_t xpl_next_phase(void)
{
#ifdef CONFIG_TPL_BUILD
return IS_ENABLED(CONFIG_VPL) ? PHASE_VPL : PHASE_SPL;
@@ -182,11 +194,11 @@ static inline enum u_boot_phase spl_next_phase(void)
}
/**
- * spl_phase_name() - Get the name of the current phase
+ * xpl_name() - Get the name of a phase
*
* Return: phase name
*/
-static inline const char *spl_phase_name(enum u_boot_phase phase)
+static inline const char *xpl_name(enum xpl_phase_t phase)
{
switch (phase) {
case PHASE_TPL:
@@ -204,12 +216,12 @@ static inline const char *spl_phase_name(enum u_boot_phase phase)
}
/**
- * spl_phase_prefix() - Get the prefix of the current phase
+ * xpl_prefix() - Get the prefix of the current phase
*
* @phase: Phase to look up
* Return: phase prefix ("spl", "tpl", etc.)
*/
-static inline const char *spl_phase_prefix(enum u_boot_phase phase)
+static inline const char *xpl_prefix(enum xpl_phase_t phase)
{
switch (phase) {
case PHASE_TPL:
@@ -227,18 +239,18 @@ static inline const char *spl_phase_prefix(enum u_boot_phase phase)
}
/* A string name for SPL or TPL */
-#ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_XPL_BUILD
# ifdef CONFIG_TPL_BUILD
-# define SPL_TPL_NAME "TPL"
+# define PHASE_NAME "TPL"
# elif defined(CONFIG_VPL_BUILD)
-# define SPL_TPL_NAME "VPL"
-# else
-# define SPL_TPL_NAME "SPL"
+# define PHASE_NAME "VPL"
+# elif defined(CONFIG_SPL_BUILD)
+# define PHASE_NAME "SPL"
# endif
-# define SPL_TPL_PROMPT SPL_TPL_NAME ": "
+# define PHASE_PROMPT PHASE_NAME ": "
#else
-# define SPL_TPL_NAME ""
-# define SPL_TPL_PROMPT ""
+# define PHASE_NAME ""
+# define PHASE_PROMPT ""
#endif
/**