aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-07-05 16:32:57 -0600
committerSimon Glass <sjg@chromium.org>2021-07-21 10:27:35 -0600
commit7d84fbb57312ac0224dc67860f4d0306a3bb3f81 (patch)
tree9550c6a16e8343c80a30a904ef60c48d3e6a6cab /include
parent1ac9c4cef521c5c5fd6591e83acf9728b167aaee (diff)
downloadu-boot-7d84fbb57312ac0224dc67860f4d0306a3bb3f81.zip
u-boot-7d84fbb57312ac0224dc67860f4d0306a3bb3f81.tar.gz
u-boot-7d84fbb57312ac0224dc67860f4d0306a3bb3f81.tar.bz2
spl: Provide more information on boot failure
If SPL fails to boot, try to provide an error code to indicate what is wrong. For example, if a uclass is missing, this can return -EPFNOSUPPORT (-96) which provides useful information. Add a helper for accessing the image-loader name so we can drop the use of #ifdefs in this code. Put this feature behind a CONFIG_SHOW_ERRORS option to avoid increasing the code size. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/spl.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/spl.h b/include/spl.h
index d88fb79..74a1939 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -505,6 +505,16 @@ struct spl_image_loader {
struct spl_boot_device *bootdev);
};
+/* Helper function for accessing the name */
+static inline const char *spl_loader_name(const struct spl_image_loader *loader)
+{
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ return loader->name;
+#else
+ return NULL;
+#endif
+}
+
/* Declare an SPL image loader */
#define SPL_LOAD_IMAGE(__name) \
ll_entry_declare(struct spl_image_loader, __name, spl_image_loader)