aboutsummaryrefslogtreecommitdiff
path: root/common/debug.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-01-07 17:46:43 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-01-07 17:46:43 +0200
commit12dc34aed789ae8e7ba342c0ab6b33529516b4bd (patch)
tree7f5bb289e183e538eb510afd63678b2329623f28 /common/debug.c
parentebe6fe5d44d58fcb1b9d0ac52fa98a0a3ff309a7 (diff)
downloadkmi-12dc34aed789ae8e7ba342c0ab6b33529516b4bd.tar.gz
kmi-12dc34aed789ae8e7ba342c0ab6b33529516b4bd.zip
Moved debugging into debug.c
+ No clue why I had that stuff in common/main.c
Diffstat (limited to 'common/debug.c')
-rw-r--r--common/debug.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/debug.c b/common/debug.c
index d34823a..afc04e7 100644
--- a/common/debug.c
+++ b/common/debug.c
@@ -3,10 +3,31 @@
#include <apos/bits.h>
#include <apos/vmem.h>
#include <apos/pmem.h>
+#include <arch/vmem.h>
#include <libfdt.h>
#include <stdarg.h>
#ifdef DEBUG
+static struct dbg_info {
+ pm_t dbg_ptr;
+ enum serial_dev dev;
+} dbg_info = (struct dbg_info){0};
+
+void init_dbg(void *fdt)
+{
+ dbg_info = dbg_from_fdt(fdt);
+}
+
+void setup_dmap_dbg()
+{
+ setup_dbg(dbg_info.dbg_ptr, dbg_info.dev);
+}
+
+void setup_io_dbg(struct vm_branch *b)
+{
+ vm_t io_ptr = setup_kernel_io(b, dbg_info.dbg_ptr);
+ setup_dbg(io_ptr, dbg_info.dev);
+}
/* if there arises a need for more supported serial drivers, I should probably
* try to implement some kind of basic driver subsystem, but this is good enough