From: Randolph <randolph@andestech.com>
To: <u-boot@lists.denx.de>
Cc: <randolph.sklin@gmail.com>, <dylan@andestech.com>,
<tim609@andestech.com>, <peterlin@andestech.com>,
Randolph <randolph@andestech.com>
Subject: [PATCH RESEND 5/7] spl: riscv: add os type for next booting stage
Date: Fri, 6 Oct 2023 19:23:49 +0800 [thread overview]
Message-ID: <20231006112351.2275090-6-randolph@andestech.com> (raw)
In-Reply-To: <20231006112351.2275090-1-randolph@andestech.com>
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>
---
common/spl/spl_fit.c | 4 ++++
common/spl/spl_opensbi.c | 7 ++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 730639f756..750562721a 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -351,7 +351,11 @@ static bool os_takes_devicetree(uint8_t os)
case IH_OS_U_BOOT:
return true;
case IH_OS_LINUX:
+#ifdef CONFIG_RISCV
+ return IS_ENABLED(CONFIG_SPL_LOAD_FIT_OPENSBI_OS_BOOT);
+#else
return IS_ENABLED(CONFIG_SPL_OS_BOOT);
+#endif
default:
return false;
}
diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c
index a0c5f35dab..708869ad48 100644
--- a/common/spl/spl_opensbi.c
+++ b/common/spl/spl_opensbi.c
@@ -58,9 +58,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.
*/
+#if CONFIG_IS_ENABLED(LOAD_FIT_OPENSBI_OS_BOOT)
+ os_type = IH_OS_LINUX;
+#else
os_type = IH_OS_U_BOOT;
+#endif
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",
--
2.34.1
next prev parent reply other threads:[~2023-10-06 11:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-06 11:23 [PATCH RESEND 0/7] riscv: spl: OpenSBI OS boot mode Randolph
2023-10-06 11:23 ` [PATCH RESEND 1/7] riscv: dts: Introduce SPL_LOAD_FIT_CONFIG symbol Randolph
2023-10-07 23:09 ` Simon Glass
2023-10-06 11:23 ` [PATCH RESEND 2/7] riscv: dts: add binman_linux.dtsi for opensbi os boot mode Randolph
2023-10-07 23:09 ` Simon Glass
2023-10-06 11:23 ` [PATCH RESEND 3/7] spl: riscv: opensbi: change the default os_type as varible Randolph
2023-10-07 23:09 ` Simon Glass
2023-10-06 11:23 ` [PATCH RESEND 4/7] riscv: dts: introduce SPL_LOAD_FIT_OPENSBI_OS_BOOT symbol Randolph
2023-10-07 23:09 ` Simon Glass
2023-10-06 11:23 ` Randolph [this message]
2023-10-07 23:09 ` [PATCH RESEND 5/7] spl: riscv: add os type for next booting stage Simon Glass
2023-10-06 11:23 ` [PATCH RESEND 6/7] andes: config: add riscv falcon mode for ae350 platform Randolph
2023-10-06 11:23 ` [PATCH RESEND 7/7] riscv: spl: andes: Move the DTB in front of kernel Randolph
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231006112351.2275090-6-randolph@andestech.com \
--to=randolph@andestech.com \
--cc=dylan@andestech.com \
--cc=peterlin@andestech.com \
--cc=randolph.sklin@gmail.com \
--cc=tim609@andestech.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).