From 808baf43a580596f1677663bafd6844118680c5a Mon Sep 17 00:00:00 2001
From: sigsegv7 <ian@vegaa.systems>
Date: Wed, 20 Sep 2023 02:28:15 -0400
Subject: kernel: dev: Setup timer descriptor for HPET

Signed-off-by: sigsegv7 <ian@vegaa.systems>
---
 sys/dev/timer/hpet.c | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'sys/dev')

diff --git a/sys/dev/timer/hpet.c b/sys/dev/timer/hpet.c
index 9e9180f..f5b1621 100644
--- a/sys/dev/timer/hpet.c
+++ b/sys/dev/timer/hpet.c
@@ -31,6 +31,7 @@
 #include <firmware/acpi/acpi.h>
 #include <sys/panic.h>
 #include <sys/cdefs.h>
+#include <sys/timer.h>
 #include <sys/syslog.h>
 #include <sys/mmio.h>
 
@@ -62,6 +63,7 @@ __KERNEL_META("$Vega$: hpet.c, Ian Marco Moffett, "
 #define spinwait_hint()   __nothing
 #endif  /* defined(__x86_64__) */
 
+static struct timer timer = { 0 };
 static struct hpet *acpi_hpet = NULL;
 static void *hpet_base = NULL;
 static bool is_faulty = false;
@@ -177,6 +179,12 @@ hpet_init(void)
     hpet_write(HPET_REG_MAIN_COUNTER, 0);
     hpet_write(HPET_GENERAL_CONFIG, 1);
 
+    /* Setup the timer descriptor */
+    timer.name = "HIGH_PRECISION_EVENT_TIMER";
+    timer.msleep = hpet_msleep;
+    timer.usleep = hpet_usleep;
+    timer.nsleep = hpet_nsleep;
+
     /* Not faulty */
     is_faulty = false;
     return 0;
-- 
cgit v1.2.3