From 12dc34aed789ae8e7ba342c0ab6b33529516b4bd Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 7 Jan 2022 17:46:43 +0200 Subject: Moved debugging into debug.c + No clue why I had that stuff in common/main.c --- common/debug.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'common/debug.c') 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 #include #include +#include #include #include #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 -- cgit v1.3