[PATCH v7 3/4] platform: generic: Allow platform_override to perform firmware init
Anup Patel
anup at brainfault.org
Sat Jan 7 02:32:34 PST 2023
On Thu, Dec 29, 2022 at 8:27 AM Wei Liang Lim
<weiliang.lim at starfivetech.com> wrote:
>
> We add a generic platform override callback to allow platform specific firmware init.
>
> Signed-off-by: Wei Liang Lim <weiliang.lim at starfivetech.com>
> Reviewed-by: Chee Hong Ang <cheehong.ang at starfivetech.com>
> Reviewed-by: Jun Liang Tan <junliang.tan at starfivetech.com>
Looks good to me.
Reviewed-by: Anup Patel <anup at brainfault.org>
Applied this patch to the riscv/opensbi repo
Thanks,
Anup
> ---
> platform/generic/include/platform_override.h | 1 +
> platform/generic/platform.c | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/platform/generic/include/platform_override.h b/platform/generic/include/platform_override.h
> index 21354e9..a59b06a 100644
> --- a/platform/generic/include/platform_override.h
> +++ b/platform/generic/include/platform_override.h
> @@ -26,6 +26,7 @@ struct platform_override {
> int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
> int (*extensions_init)(const struct fdt_match *match,
> struct sbi_hart_features *hfeatures);
> + void (*fw_init)(void *fdt, const struct fdt_match *match);
> int (*vendor_ext_check)(long extid, const struct fdt_match *match);
> int (*vendor_ext_provider)(long extid, long funcid,
> const struct sbi_trap_regs *regs,
> diff --git a/platform/generic/platform.c b/platform/generic/platform.c
> index 5fb0dc6..a34d3b0 100644
> --- a/platform/generic/platform.c
> +++ b/platform/generic/platform.c
> @@ -85,6 +85,9 @@ unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1,
>
> fw_platform_lookup_special(fdt, root_offset);
>
> + if (generic_plat && generic_plat->fw_init)
> + generic_plat->fw_init(fdt, generic_plat_match);
> +
> model = fdt_getprop(fdt, root_offset, "model", &len);
> if (model)
> sbi_strncpy(platform.name, model, sizeof(platform.name) - 1);
> --
> 2.25.1
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
More information about the opensbi
mailing list