|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [RFC PATCH v2 2/2] correct wall time for arm64
Currently, as no rtc device enabled, wrong wall time will be
return.
After rtc pl031 enabled, the correct wall time will be offered.
Signed-off-by: Jianyong Wu <jianyong.wu@xxxxxxx>
---
plat/common/arm/generic_timer.c | 3 ++-
plat/common/arm/time.c | 12 ++++++++++++
plat/common/include/arm/time.h | 1 +
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/plat/common/arm/generic_timer.c b/plat/common/arm/generic_timer.c
index 59e53f1..5c3c308 100644
--- a/plat/common/arm/generic_timer.c
+++ b/plat/common/arm/generic_timer.c
@@ -32,6 +32,7 @@
* THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
*/
#include <stdlib.h>
+#include <rtc.h>
#include <uk/assert.h>
#include <uk/plat/time.h>
#include <uk/plat/lcpu.h>
@@ -198,7 +199,7 @@ static inline __nsec generic_timer_monotonic(void)
*/
static inline uint64_t generic_timer_epochoffset(void)
{
- return 0;
+ return rtc_gettimeofday();
}
/*
diff --git a/plat/common/arm/time.c b/plat/common/arm/time.c
index 46407af..d2b4701 100644
--- a/plat/common/arm/time.c
+++ b/plat/common/arm/time.c
@@ -33,6 +33,7 @@
*/
#include <stdlib.h>
#include <libfdt.h>
+#include <rtc.h>
#include <ofw/fdt.h>
#include <uk/assert.h>
#include <uk/plat/time.h>
@@ -105,6 +106,17 @@ void time_block_until(__snsec until)
}
}
+__snsec rtc_gettimeofday(void)
+{
+#ifdef CONFIG_RTC_PL031
+ uint64_t ret;
+
+ ret = rtc_boot_seconds * 1000000000UL;
+
+ return ret;
+#endif
+ return 0;
+}
/* must be called before interrupts are enabled */
void ukplat_time_init(void)
{
diff --git a/plat/common/include/arm/time.h b/plat/common/include/arm/time.h
index 3288d2b..5cdf2fb 100644
--- a/plat/common/include/arm/time.h
+++ b/plat/common/include/arm/time.h
@@ -21,5 +21,6 @@ int generic_timer_init(int fdt_timer);
int generic_timer_irq_handler(void *arg __unused);
void generic_timer_cpu_block_until(uint64_t until_ns);
void generic_timer_update_boot_ticks(void);
+__snsec rtc_gettimeofday(void);
#endif /* __ARM_ARM_TIME_H */
--
2.17.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |