aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsigsegv7 <ian@vegaa.systems>2023-09-20 03:02:39 -0400
committersigsegv7 <ian@vegaa.systems>2023-09-20 03:02:39 -0400
commitc9ea9bda1dfaa54842bbdeb38145f41275376d95 (patch)
treeebfcdb96f4461cc4955418118d037da9157de494
parent06bb3c51f7e0b23f3399d00f75623a490a6571b9 (diff)
kernel: init_main: Dump timer registry
Signed-off-by: sigsegv7 <ian@vegaa.systems>
-rw-r--r--sys/kern/init_main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index f874ca8..f96128c 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -31,13 +31,44 @@
#include <sys/tty.h>
#include <sys/syslog.h>
#include <sys/machdep.h>
+#include <sys/timer.h>
#include <firmware/acpi/acpi.h>
#include <vm/vm_physseg.h>
#include <logo.h>
+__MODULE_NAME("init_main");
__KERNEL_META("$Vega$: init_main.c, Ian Marco Moffett, "
"Where the Vega kernel first starts up");
+static inline void
+log_timer(const char *purpose, tmrr_status_t s, const struct timer *tmr)
+{
+ if (s == TMRR_EMPTY_ENTRY) {
+ KINFO("%s not yet registered\n", purpose);
+ } else if (tmr->name == NULL) {
+ KINFO("Nameless %s registered; unknown\n", purpose);
+ } else {
+ KINFO("%s registered: %s\n", purpose, tmr->name);
+ }
+}
+
+/*
+ * Logs what timers are registered
+ * on the system.
+ */
+static void
+list_timers(void)
+{
+ struct timer timer_tmp;
+ tmrr_status_t status;
+
+ status = req_timer(TIMER_SCHED, &timer_tmp);
+ log_timer("SCHED_TMR", status, &timer_tmp);
+
+ status = req_timer(TIMER_GP, &timer_tmp);
+ log_timer("GENERAL_PURPOSE_TMR", status, &timer_tmp);
+}
+
void
main(void)
{
@@ -53,6 +84,8 @@ main(void)
processor_init();
vm_physseg_init();
+ list_timers();
+
/* We're done here, halt the processor */
__ASMV("cli; hlt");
}