diff options
| author | Samuel Holland <[email protected]> | 2024-09-02 21:06:49 -0700 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2024-11-05 17:29:13 +0530 |
| commit | 450082874346bb25109877b7ac6a1754f089f538 (patch) | |
| tree | a3e4c1726e26303e7d61206ffad8934dfbb04f3f /lib/utils/timer/aclint_mtimer.c | |
| parent | 1a2e507d2347500e6c994e005fb9725b2a9a8e8f (diff) | |
lib: sbi_timer: Call driver warm_init from SBI core
Currently, the platform's timer device is tracked in two places: the
core SBI implementation has `timer_dev`, and the FDT timer layer has
`current_driver`. The latter is used for warm initialization of the
timer device. However, this warm init is not specific to FDT-based
platforms; other platforms call exactly the same functions from the
same point in the boot sequence.
The code is simplified and made common across platforms by treating warm
init and exit as properties of the driver, not the platform. Then the
platform's only role is to select and prepare a driver during cold boot.
For now, only add a .warm_init hook, since none of the existing drivers
need an .exit hook. It could be added in the future if needed.
Signed-off-by: Samuel Holland <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib/utils/timer/aclint_mtimer.c')
| -rw-r--r-- | lib/utils/timer/aclint_mtimer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/utils/timer/aclint_mtimer.c b/lib/utils/timer/aclint_mtimer.c index 9acb26eb..3db3c3be 100644 --- a/lib/utils/timer/aclint_mtimer.c +++ b/lib/utils/timer/aclint_mtimer.c @@ -143,7 +143,7 @@ void aclint_mtimer_set_reference(struct aclint_mtimer_data *mt, mt->time_delta_computed = 0; } -int aclint_mtimer_warm_init(void) +static int aclint_mtimer_warm_init(void) { u64 *mt_time_cmp; u32 target_hart = current_hartid(); @@ -260,6 +260,7 @@ int aclint_mtimer_cold_init(struct aclint_mtimer_data *mt, } mtimer.timer_freq = mt->mtime_freq; + mtimer.warm_init = aclint_mtimer_warm_init; sbi_timer_set_device(&mtimer); return 0; |
