diff options
author | Anup Patel <apatel@ventanamicro.com> | 2021-06-29 10:44:04 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2022-02-15 18:04:24 +0300 |
commit | 10509405b2722d25389280b7d914579a16e2eb7e (patch) | |
tree | ef1736a60178619f07a52b32203f8b32351b23a4 /include | |
parent | 5f56314618d4733c83bb80c65f9181e952f051ed (diff) | |
download | opensbi-10509405b2722d25389280b7d914579a16e2eb7e.tar.xz |
include: sbi: Introduce nascent_init() platform callback
We introduce nascent_init() platform callback which will allow
platforms to do very early initialization of platform specific
per-HART CSRs and per-HART devices.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sbi/sbi_platform.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index 4d192f2..0b5ae4b 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -64,6 +64,9 @@ enum sbi_platform_features { /** Platform functions */ struct sbi_platform_operations { + /* Platform nascent initialization */ + int (*nascent_init)(void); + /** Platform early initialization */ int (*early_init)(bool cold_boot); /** Platform final initialization */ @@ -300,6 +303,23 @@ static inline bool sbi_platform_hart_invalid(const struct sbi_platform *plat, } /** + * Nascent (very early) initialization for current HART + * + * NOTE: This function can be used to do very early initialization of + * platform specific per-HART CSRs and devices. + * + * @param plat pointer to struct sbi_platform + * + * @return 0 on success and negative error code on failure + */ +static inline int sbi_platform_nascent_init(const struct sbi_platform *plat) +{ + if (plat && sbi_platform_ops(plat)->nascent_init) + return sbi_platform_ops(plat)->nascent_init(); + return 0; +} + +/** * Early initialization for current HART * * @param plat pointer to struct sbi_platform |