Rename backtrace_kframe -> backtrace_hwtf [2/2]
[akaros.git] / kern / arch / x86 / init.c
index fc5dac5..fe35276 100644 (file)
@@ -1,9 +1,5 @@
 /* See COPYRIGHT for copyright information. */
 
-#ifdef __SHARC__
-#pragma nosharc
-#endif
-
 #include <smp.h>
 
 #include <arch/pci.h>
@@ -12,6 +8,7 @@
 #include <arch/init.h>
 #include <console.h>
 #include <monitor.h>
+#include <arch/usb.h>
 
 struct ancillary_state x86_default_fpu;
 uint32_t kerndate;
@@ -40,8 +37,12 @@ static void irq_console(struct hw_trapframe *hw_tf, void *data)
                case capchar2ctl('B'):
                        /* backtrace / debugging for the core receiving the irq */
                        printk("\nForced trapframe and backtrace for core %d\n", core_id());
+                       if (!hw_tf) {
+                               printk("(no hw_tf, we probably polled the console)\n");
+                               return;
+                       }
                        print_trapframe(hw_tf);
-                       backtrace_kframe(hw_tf);
+                       backtrace_hwtf(hw_tf);
                        return;
        }
        /* Do our work in an RKM, instead of interrupt context.  Note the RKM will
@@ -50,12 +51,24 @@ static void irq_console(struct hw_trapframe *hw_tf, void *data)
                            0, KMSG_ROUTINE);
 }
 
+static void cons_poller(void *arg)
+{
+       while (1) {
+               kthread_usleep(10000);
+               irq_console(0, arg);
+       }
+}
+
 static void cons_irq_init(void)
 {
        struct cons_dev *i;
        /* Register interrupt handlers for all console devices */
-       SLIST_FOREACH(i, &cdev_list, next)
-               register_dev_irq(i->irq, irq_console, i, -1);
+       SLIST_FOREACH(i, &cdev_list, next) {
+               register_irq(i->irq, irq_console, i, MKBUS(BusISA, 0, 0, 0));
+#ifdef CONFIG_POLL_CONSOLE
+               ktask("cons_poller", cons_poller, i);
+#endif /* CONFIG_POLL_CONSOLE */
+       }
 }
 
 void arch_init()
@@ -66,6 +79,7 @@ void arch_init()
        asm volatile ("fninit");
        save_fp_state(&x86_default_fpu); /* used in arch/trap.h for fpu init */
        pci_init();
+       vmm_init();
        // this returns when all other cores are done and ready to receive IPIs
        #ifdef CONFIG_SINGLE_CORE
                smp_percpu_init();
@@ -76,5 +90,11 @@ void arch_init()
 
        perfmon_init();
        cons_irq_init();
+       intel_lpc_init();
+#ifdef CONFIG_ENABLE_LEGACY_USB
+       printk("Legacy USB support enabled, expect SMM interference!\n");
+#else
+       usb_disable_legacy();
+#endif
        check_timing_stability();
 }