summaryrefslogtreecommitdiff
path: root/include/sbi_utils/sys/clint.h
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-05-12 16:08:31 +0300
committerAnup Patel <anup@brainfault.org>2020-05-23 08:06:43 +0300
commita9a97511851198559e75640a9e5e67f65695dc2e (patch)
tree3c7a01bfa30aab552fbb049f5fea25b8007a2d83 /include/sbi_utils/sys/clint.h
parentd30bb684481b6be642a0eaa9e7f0778d6519cc15 (diff)
downloadopensbi-a9a97511851198559e75640a9e5e67f65695dc2e.tar.xz
lib: utils: Allow CLINT functions to be used for multiple CLINTs
We extend CLINT cold init function to have a "struct clint_data *" parameter pointing to CLINT details. This allows platforms to use CLINT functions for multiple CLINT instances. When multiple CLINTs are present, the platform can also provide one of the CLINT as reference CLINT for other CLINTs. This will help CLINTs to sync their time value with reference CLINT using a time_delta computed in warm init function. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi_utils/sys/clint.h')
-rw-r--r--include/sbi_utils/sys/clint.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/sbi_utils/sys/clint.h b/include/sbi_utils/sys/clint.h
index a26f148..b07cf62 100644
--- a/include/sbi_utils/sys/clint.h
+++ b/include/sbi_utils/sys/clint.h
@@ -12,13 +12,30 @@
#include <sbi/sbi_types.h>
+struct clint_data {
+ /* Public details */
+ unsigned long addr;
+ u32 first_hartid;
+ u32 hart_count;
+ bool has_64bit_mmio;
+ /* Private details (initialized and used by CLINT library)*/
+ u32 *ipi;
+ struct clint_data *time_delta_reference;
+ unsigned long time_delta_computed;
+ u64 time_delta;
+ u64 *time_val;
+ u64 *time_cmp;
+ u64 (*time_rd)(volatile u64 *addr);
+ void (*time_wr)(u64 value, volatile u64 *addr);
+};
+
void clint_ipi_send(u32 target_hart);
void clint_ipi_clear(u32 target_hart);
int clint_warm_ipi_init(void);
-int clint_cold_ipi_init(unsigned long base, u32 hart_count);
+int clint_cold_ipi_init(struct clint_data *clint);
u64 clint_timer_value(void);
@@ -28,7 +45,7 @@ void clint_timer_event_start(u64 next_event);
int clint_warm_timer_init(void);
-int clint_cold_timer_init(unsigned long base, u32 hart_count,
- bool has_64bit_mmio);
+int clint_cold_timer_init(struct clint_data *clint,
+ struct clint_data *reference);
#endif