diff options
| author | Anup Patel <[email protected]> | 2020-01-03 09:18:42 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2020-01-07 12:10:55 +0530 |
| commit | 6469ed101cb3c036cce1ead0d64160a7315f72af (patch) | |
| tree | 3deec50bffa180639771f83c07d3ca2a7d470e9f /lib | |
| parent | 55e191e3b09c4979212c592a4e86e0f561ce1f97 (diff) | |
lib: Add timer exit API
We add sbi_timer_exit() API for OpenSBI exit path handling in
sbi_exit() implementation.
Signed-off-by: Anup Patel <[email protected]>
Reviewed-by: Atish Patra <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sbi/sbi_init.c | 2 | ||||
| -rw-r--r-- | lib/sbi/sbi_timer.c | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c index d5d35130..2247324c 100644 --- a/lib/sbi/sbi_init.c +++ b/lib/sbi/sbi_init.c @@ -205,6 +205,8 @@ void __noreturn sbi_exit(struct sbi_scratch *scratch) sbi_platform_early_exit(plat); + sbi_timer_exit(scratch); + sbi_platform_final_exit(plat); sbi_hart_hang(); diff --git a/lib/sbi/sbi_timer.c b/lib/sbi/sbi_timer.c index 1ba386f0..60ddfaad 100644 --- a/lib/sbi/sbi_timer.c +++ b/lib/sbi/sbi_timer.c @@ -76,11 +76,6 @@ void sbi_timer_set_delta_upper(struct sbi_scratch *scratch, ulong delta_upper) *time_delta |= ((u64)delta_upper << 32); } -void sbi_timer_event_stop(struct sbi_scratch *scratch) -{ - sbi_platform_timer_event_stop(sbi_platform_ptr(scratch)); -} - void sbi_timer_event_start(struct sbi_scratch *scratch, u64 next_event) { sbi_platform_timer_event_start(sbi_platform_ptr(scratch), next_event); @@ -113,3 +108,13 @@ int sbi_timer_init(struct sbi_scratch *scratch, bool cold_boot) return sbi_platform_timer_init(sbi_platform_ptr(scratch), cold_boot); } + +void sbi_timer_exit(struct sbi_scratch *scratch) +{ + sbi_platform_timer_event_stop(sbi_platform_ptr(scratch)); + + csr_clear(CSR_MIP, MIP_STIP); + csr_clear(CSR_MIE, MIP_MTIP); + + sbi_platform_timer_exit(sbi_platform_ptr(scratch)); +} |
