summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-05-29 01:01:52 -0400
committerIan Moffett <ian@osmora.org>2025-05-29 01:01:52 -0400
commit8b62cb8210a955bf9696b8d151d51fc6274732cd (patch)
tree7d8c3715338adbc26c3414fa86e3df988f1a2ad0
parentc1ee781a26f1910fe1736b982ce6248c7c2421ff (diff)
kernel: uacpi: Implement kernel nsec func
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--sys/dev/acpi/uacpi.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/acpi/uacpi.c b/sys/dev/acpi/uacpi.c
index 03d0ecf..612f23b 100644
--- a/sys/dev/acpi/uacpi.c
+++ b/sys/dev/acpi/uacpi.c
@@ -513,9 +513,18 @@ uacpi_u64
uacpi_kernel_get_nanoseconds_since_boot(void)
{
static uacpi_u64 time = 0;
+ static struct timer tmr = {0};
+ tmrr_status_t tmr_error;
+
+ if (time == 0) {
+ tmr_error = req_timer(TIMER_GP, &tmr);
+ if (tmr_error != TMRR_SUCCESS) {
+ time += 1000000;
+ return time;
+ }
+ }
- /* TODO */
- time += 1000000;
+ time = tmr.get_time_nsec();
return time;
}