[PATCH v7 3/4] platform: generic: Allow platform_override to perform firmware init
Wei Liang Lim
weiliang.lim at starfivetech.com
Wed Dec 28 18:56:17 PST 2022
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>
---
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
More information about the opensbi
mailing list