time: Revise state abstraction
Make abstract state `State` of HW.Time.Timer, that's used to derive the
Hz value for instance, External. This helps to fix flow issues in the
mutime implementation and also matches real hardware better: The clock
rate may be derived from the hardware state.
HW.Time.Timer.Hz had to be made a volatile function, therefore.
Change-Id: I35af2d0db1acbf9652ea00763aa288545746bb79
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/c/libhwbase/+/26838
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Reto Buerki <reet@codelabs.ch>
diff --git a/common/hw-time-timer.ads b/common/hw-time-timer.ads
index cfe2e0b..90978df 100644
--- a/common/hw-time-timer.ads
+++ b/common/hw-time-timer.ads
@@ -14,11 +14,12 @@
private package HW.Time.Timer
with
- Abstract_State => ((Timer_State with Part_Of => HW.Time.State),
+ Abstract_State => ((Timer_State with
+ Part_Of => HW.Time.State,
+ External => Async_Writers),
(Abstract_Time with
Part_Of => HW.Time.State,
- External => Async_Writers)),
- Initializes => (Timer_State)
+ External => Async_Writers))
is
-- Returns the highest point in time that has definitely passed.
@@ -37,6 +38,7 @@
function Hz return T
with
+ Volatile_Function,
Global => (Input => Timer_State);
end HW.Time.Timer;