aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandolph <randolph@andestech.com>2023-10-12 14:35:07 +0800
committerLeo Yu-Chi Liang <ycliang@andestech.com>2023-10-19 17:29:33 +0800
commit58fa2a5aa164fd8b516bd66649bbb595ebf1540c (patch)
tree4c08bb463fd6c669119d57f3b5b2e04c74503b01
parent9421e419817a2a86ad73995ff3ffd0957bec7b82 (diff)
downloadu-boot-58fa2a5aa164fd8b516bd66649bbb595ebf1540c.zip
u-boot-58fa2a5aa164fd8b516bd66649bbb595ebf1540c.tar.gz
u-boot-58fa2a5aa164fd8b516bd66649bbb595ebf1540c.tar.bz2
spl: riscv: add os type for next booting stage
If SPL_LOAD_FIT_OPENSBI_OS_BOOT is enabled, the function spl_invoke_opensbi should change the target OS type to IH_OS_LINUX. OpenSBI will load the Linux image as the next boot stage. The os_takes_devicetree function returns a value of true or false depending on whether or not SPL_LOAD_FIT_OPENSBI_OS_BOOT is enabled. Signed-off-by: Randolph <randolph@andestech.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/spl/spl_fit.c3
-rw-r--r--common/spl/spl_opensbi.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index c026e1a..70d8d59 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -367,7 +367,8 @@ static bool os_takes_devicetree(uint8_t os)
case IH_OS_U_BOOT:
return true;
case IH_OS_LINUX:
- return IS_ENABLED(CONFIG_SPL_OS_BOOT);
+ return IS_ENABLED(CONFIG_SPL_OS_BOOT) ||
+ IS_ENABLED(CONFIG_SPL_OPENSBI);
default:
return false;
}
diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c
index 6583b31..9801d38 100644
--- a/common/spl/spl_opensbi.c
+++ b/common/spl/spl_opensbi.c
@@ -59,9 +59,14 @@ void __noreturn spl_invoke_opensbi(struct spl_image_info *spl_image)
/*
* Find next os image in /fit-images
- * The next os image default is u-boot proper
+ * The next os image default is u-boot proper, once enable
+ * OpenSBI OS boot mode, the OS image should be linux.
*/
- os_type = IH_OS_U_BOOT;
+ if (CONFIG_IS_ENABLED(LOAD_FIT_OPENSBI_OS_BOOT))
+ os_type = IH_OS_LINUX;
+ else
+ os_type = IH_OS_U_BOOT;
+
ret = spl_opensbi_find_os_node(spl_image->fdt_addr, &os_node, os_type);
if (ret) {
pr_err("Can't find %s node for opensbi, %d\n",