diff options
| author | Heiko Stuebner <[email protected]> | 2022-10-04 18:42:25 +0200 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2022-10-13 09:52:05 +0530 |
| commit | 4f2acb53e21af805e499f7f594a931af9b0623fd (patch) | |
| tree | 6baf642377f1e1c81b9687e79852c6d982d664f3 | |
| parent | c316fa38c264a1c01f178621e79a8c451f5f5a46 (diff) | |
lib: sbi_platform: expose hart_features to extension_init callback
The platform-specific extension_init callback is supposed to
set specific things for the platform opensbi is running on.
So it's also the right place to override specific hart_features
if needed - when it's know that autodetection has provided
wrong results for example.
Suggested-by: Atish Patra <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Reviewed-by: Guo Ren <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Signed-off-by: Heiko Stuebner <[email protected]>
| -rw-r--r-- | include/sbi/sbi_platform.h | 8 | ||||
| -rw-r--r-- | lib/sbi/sbi_hart.c | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index 87024dbd..722f27a1 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -48,6 +48,7 @@ struct sbi_domain_memregion; struct sbi_trap_info; struct sbi_trap_regs; +struct sbi_hart_features; /** Possible feature flags of a platform */ enum sbi_platform_features { @@ -90,7 +91,7 @@ struct sbi_platform_operations { int (*misa_get_xlen)(void); /** Initialize (or populate) HART extensions for the platform */ - int (*extensions_init)(void); + int (*extensions_init)(struct sbi_hart_features *hfeatures); /** Initialize (or populate) domains for the platform */ int (*domains_init)(void); @@ -464,10 +465,11 @@ static inline int sbi_platform_misa_xlen(const struct sbi_platform *plat) * @return 0 on success and negative error code on failure */ static inline int sbi_platform_extensions_init( - const struct sbi_platform *plat) + const struct sbi_platform *plat, + struct sbi_hart_features *hfeatures) { if (plat && sbi_platform_ops(plat)->extensions_init) - return sbi_platform_ops(plat)->extensions_init(); + return sbi_platform_ops(plat)->extensions_init(hfeatures); return 0; } diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index d0a62951..dacab1a0 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -672,7 +672,8 @@ __mhpm_skip: } /* Let platform populate extensions */ - rc = sbi_platform_extensions_init(sbi_platform_thishart_ptr()); + rc = sbi_platform_extensions_init(sbi_platform_thishart_ptr(), + hfeatures); if (rc) return rc; |
