diff options
| author | Anup Patel <[email protected]> | 2020-03-14 19:39:15 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2020-03-19 09:15:29 +0530 |
| commit | bd6ef02d47015706bc7a79cc16b3f19946889a3b (patch) | |
| tree | 43cb1da0e3658f3536ae3b902022a060fcaaa94b | |
| parent | 209134d8f9c6e4ec9a555a7813f7e2c004b5b2d7 (diff) | |
include: sbi_platform: Improve sbi_platform_hart_disabled() API
The sbi_platform_hart_disabled() should return TRUE for HART id
greater than platform hart count.
Signed-off-by: Anup Patel <[email protected]>
Reviewed-by: Bin Meng <[email protected]>
| -rw-r--r-- | include/sbi/sbi_platform.h | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index bc7991c0..0264732f 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -238,22 +238,6 @@ static inline const char *sbi_platform_name(const struct sbi_platform *plat) } /** - * Check whether the given HART is disabled - * - * @param plat pointer to struct sbi_platform - * @param hartid HART ID - * - * @return TRUE if HART is disabled and FALSE otherwise - */ -static inline bool sbi_platform_hart_disabled(const struct sbi_platform *plat, - u32 hartid) -{ - if (plat && sbi_platform_ops(plat)->hart_disabled) - return sbi_platform_ops(plat)->hart_disabled(hartid); - return FALSE; -} - -/** * Get platform specific tlb range flush maximum value. Any request with size * higher than this is upgraded to a full flush. * @@ -298,6 +282,26 @@ static inline u32 sbi_platform_hart_stack_size(const struct sbi_platform *plat) } /** + * Check whether the given HART is disabled + * + * @param plat pointer to struct sbi_platform + * @param hartid HART ID + * + * @return TRUE if HART is disabled and FALSE otherwise + */ +static inline bool sbi_platform_hart_disabled(const struct sbi_platform *plat, + u32 hartid) +{ + if (plat) { + if (sbi_platform_hart_count(plat) <= hartid) + return TRUE; + if (sbi_platform_ops(plat)->hart_disabled) + return sbi_platform_ops(plat)->hart_disabled(hartid); + } + return FALSE; +} + +/** * Bringup a given hart from previous stage. Platform should implement this * operation if they support a custom mechanism to start a hart. Otherwise, * a generic WFI based approach will be used to start/stop a hart in OpenSBI. |
