[PATCH] spl: opensbi: convert scratch options to config

From: Nikita Shubin n.shubin@yadro.com
Convert hardcoded "opensbi_info.options" to config provided value, this allows changing options passed to OpenSBI.
SPL_OPENSBI_SCRATCH_OPTIONS is defaulted to SBI_SCRATCH_NO_BOOT_PRINTS.
Link: https://github.com/riscv-software-src/opensbi/blob/master/docs/firmware/fw_d... Signed-off-by: Nikita Shubin n.shubin@yadro.com --- common/spl/Kconfig | 8 ++++++++ common/spl/spl_opensbi.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 2352fc9d6d..07c03d611d 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1486,6 +1486,14 @@ config SPL_OPENSBI_LOAD_ADDR help Load address of the OpenSBI binary.
+config SPL_OPENSBI_SCRATCH_OPTIONS + hex "Scratch options passed to OpenSBI" + default 0x1 + depends on SPL_OPENSBI + help + Options passed to fw_dynamic, for example SBI_SCRATCH_NO_BOOT_PRINTS or + SBI_SCRATCH_DEBUG_PRINTS. + config SPL_TARGET string "Addtional build targets for 'make'" default "spl/u-boot-spl.srec" if RCAR_GEN2 diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c index 7fe0b5e158..b0f40076c3 100644 --- a/common/spl/spl_opensbi.c +++ b/common/spl/spl_opensbi.c @@ -71,7 +71,7 @@ void spl_invoke_opensbi(struct spl_image_info *spl_image) opensbi_info.version = FW_DYNAMIC_INFO_VERSION; opensbi_info.next_addr = uboot_entry; opensbi_info.next_mode = FW_DYNAMIC_INFO_NEXT_MODE_S; - opensbi_info.options = SBI_SCRATCH_NO_BOOT_PRINTS; + opensbi_info.options = CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS; opensbi_info.boot_hart = gd->arch.boot_hart;
opensbi_entry = (void (*)(ulong, ulong, ulong))spl_image->entry_point;

On Mon, Aug 8, 2022 at 3:58 PM Nikita Shubin nikita.shubin@maquefel.me wrote:
From: Nikita Shubin n.shubin@yadro.com
Convert hardcoded "opensbi_info.options" to config provided value, this allows changing options passed to OpenSBI.
SPL_OPENSBI_SCRATCH_OPTIONS is defaulted to SBI_SCRATCH_NO_BOOT_PRINTS.
Link: https://github.com/riscv-software-src/opensbi/blob/master/docs/firmware/fw_d... Signed-off-by: Nikita Shubin n.shubin@yadro.com
Looks good to me.
Reviewed-by: Anup Patel anup@brainfault.org
Regards, Anup
common/spl/Kconfig | 8 ++++++++ common/spl/spl_opensbi.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 2352fc9d6d..07c03d611d 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1486,6 +1486,14 @@ config SPL_OPENSBI_LOAD_ADDR help Load address of the OpenSBI binary.
+config SPL_OPENSBI_SCRATCH_OPTIONS
hex "Scratch options passed to OpenSBI"
default 0x1
depends on SPL_OPENSBI
help
Options passed to fw_dynamic, for example SBI_SCRATCH_NO_BOOT_PRINTS or
SBI_SCRATCH_DEBUG_PRINTS.
config SPL_TARGET string "Addtional build targets for 'make'" default "spl/u-boot-spl.srec" if RCAR_GEN2 diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c index 7fe0b5e158..b0f40076c3 100644 --- a/common/spl/spl_opensbi.c +++ b/common/spl/spl_opensbi.c @@ -71,7 +71,7 @@ void spl_invoke_opensbi(struct spl_image_info *spl_image) opensbi_info.version = FW_DYNAMIC_INFO_VERSION; opensbi_info.next_addr = uboot_entry; opensbi_info.next_mode = FW_DYNAMIC_INFO_NEXT_MODE_S;
opensbi_info.options = SBI_SCRATCH_NO_BOOT_PRINTS;
opensbi_info.options = CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS; opensbi_info.boot_hart = gd->arch.boot_hart; opensbi_entry = (void (*)(ulong, ulong, ulong))spl_image->entry_point;
-- 2.35.1

On Mon, Aug 08, 2022 at 01:28:52PM +0300, Nikita Shubin wrote:
From: Nikita Shubin n.shubin@yadro.com
Convert hardcoded "opensbi_info.options" to config provided value, this allows changing options passed to OpenSBI.
SPL_OPENSBI_SCRATCH_OPTIONS is defaulted to SBI_SCRATCH_NO_BOOT_PRINTS.
Link: https://github.com/riscv-software-src/opensbi/blob/master/docs/firmware/fw_d... Signed-off-by: Nikita Shubin n.shubin@yadro.com
common/spl/Kconfig | 8 ++++++++ common/spl/spl_opensbi.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
Reviewed-by: Leo Yu-Chi Liang ycliang@andestech.com
participants (3)
-
Anup Patel
-
Leo Liang
-
Nikita Shubin