summaryrefslogtreecommitdiff
path: root/include/sbi_utils
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2021-07-24 08:05:01 +0300
committerAnup Patel <anup@brainfault.org>2021-08-14 06:37:42 +0300
commit7aa6c9aa96049b741b754b7340ea96a37719de27 (patch)
tree0f82d9ef6e2d02de411e52e4aa8df2371fefadf3 /include/sbi_utils
parentb35f7826b019623d096b6b5c1803232818834e5b (diff)
downloadopensbi-7aa6c9aa96049b741b754b7340ea96a37719de27.tar.xz
lib: utils/timer: Simplify MTIMER synchronization
We simplify MTIMER synchronization as follows: 1) Detect MTIMER devices with unique (or non-shared) MTIME register at boot-time 2) Select first MTIMER device with no associated HART as our reference MTIMER device 3) Only synchronize MTIMER devices with unique (or non-shared) MTIME register using reference MTIMER device 4) Directly update the MTIME register at time of synchronization because MTIME is a read/write register. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi_utils')
-rw-r--r--include/sbi_utils/timer/aclint_mtimer.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/sbi_utils/timer/aclint_mtimer.h b/include/sbi_utils/timer/aclint_mtimer.h
index fdc46cd..a9fe445 100644
--- a/include/sbi_utils/timer/aclint_mtimer.h
+++ b/include/sbi_utils/timer/aclint_mtimer.h
@@ -31,14 +31,19 @@ struct aclint_mtimer_data {
u32 first_hartid;
u32 hart_count;
bool has_64bit_mmio;
+ bool has_shared_mtime;
/* Private details (initialized and used by ACLINT MTIMER library) */
struct aclint_mtimer_data *time_delta_reference;
unsigned long time_delta_computed;
- u64 time_delta;
u64 (*time_rd)(volatile u64 *addr);
void (*time_wr)(bool timecmp, u64 value, volatile u64 *addr);
};
+void aclint_mtimer_sync(struct aclint_mtimer_data *mt);
+
+void aclint_mtimer_set_reference(struct aclint_mtimer_data *mt,
+ struct aclint_mtimer_data *ref);
+
int aclint_mtimer_warm_init(void);
int aclint_mtimer_cold_init(struct aclint_mtimer_data *mt,