aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/debug.c21
-rw-r--r--common/main.c26
2 files changed, 22 insertions, 25 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
diff --git a/common/main.c b/common/main.c
index 3aabc3c..0e33ecc 100644
--- a/common/main.c
+++ b/common/main.c
@@ -7,30 +7,6 @@
#include <arch/irq.h>
#include <libfdt.h>
-#ifdef DEBUG
-static struct dbg_info dbg_info = (struct dbg_info){0};
-
-static void init_dbg(void *fdt)
-{
- dbg_info = dbg_from_fdt(fdt);
-}
-
-static void setup_dmap_dbg()
-{
- setup_dbg(dbg_info.dbg_ptr, dbg_info.dev);
-}
-
-static 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);
-}
-#else
-#define init_dbg(...)
-#define setup_dmap_dbg(...)
-#define setup_io_dbg(...)
-#endif
-
void __main main(void *fdt)
{
/* dbg uses direct mapping at this point */
@@ -38,7 +14,7 @@ void __main main(void *fdt)
setup_dmap_dbg();
dbg_fdt(fdt);
- arch_setup(fdt);
+ setup_arch(fdt);
init_pmem(fdt);
struct vm_branch *b = init_vmem(fdt);