diff options
| author | Anup Patel <[email protected]> | 2020-01-03 09:10:41 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2020-01-07 12:10:48 +0530 |
| commit | 55e191e3b09c4979212c592a4e86e0f561ce1f97 (patch) | |
| tree | f23986fe49fd1291b03d2da152e31f189b2ad388 /include | |
| parent | c3e406f1609af8f14e93419aa6722e646a8f4f56 (diff) | |
lib: Add system early_exit and final_exit APIs
This patch adds system-level early_exit and final_exit APIs
with corresponding platform hooks. These new APIs will be
primarily used by sbi_exit() in OpenSBI exit path.
Signed-off-by: Anup Patel <[email protected]>
Reviewed-by: Atish Patra <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/sbi/sbi_platform.h | 27 | ||||
| -rw-r--r-- | include/sbi/sbi_system.h | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index 010328eb..72bb7e29 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -76,6 +76,11 @@ struct sbi_platform_operations { /** Platform final initialization */ int (*final_init)(bool cold_boot); + /** Platform early exit */ + void (*early_exit)(void); + /** Platform final exit */ + void (*final_exit)(void); + /** For platforms that do not implement misa, non-standard * methods are needed to determine cpu extension. */ @@ -302,6 +307,28 @@ static inline int sbi_platform_final_init(const struct sbi_platform *plat, } /** + * Early exit for current HART + * + * @param plat pointer to struct sbi_platform + */ +static inline void sbi_platform_early_exit(const struct sbi_platform *plat) +{ + if (plat && sbi_platform_ops(plat)->early_exit) + sbi_platform_ops(plat)->early_exit(); +} + +/** + * Final exit for current HART + * + * @param plat pointer to struct sbi_platform + */ +static inline void sbi_platform_final_exit(const struct sbi_platform *plat) +{ + if (plat && sbi_platform_ops(plat)->final_exit) + sbi_platform_ops(plat)->final_exit(); +} + +/** * Check CPU extension in MISA * * @param plat pointer to struct sbi_platform diff --git a/include/sbi/sbi_system.h b/include/sbi/sbi_system.h index bf768d9a..c1ef3742 100644 --- a/include/sbi/sbi_system.h +++ b/include/sbi/sbi_system.h @@ -18,6 +18,10 @@ int sbi_system_early_init(struct sbi_scratch *scratch, bool cold_boot); int sbi_system_final_init(struct sbi_scratch *scratch, bool cold_boot); +void sbi_system_early_exit(struct sbi_scratch *scratch); + +void sbi_system_final_exit(struct sbi_scratch *scratch); + void __attribute__((noreturn)) sbi_system_reboot(struct sbi_scratch *scratch, u32 type); |
