NIC drivers use register_dev_irq()
[akaros.git] / kern / drivers / net / rl8168.c
index 924d3ce..a749114 100644 (file)
@@ -145,11 +145,11 @@ int rl8168_scan_pci() {
                        if (result == 0) // (0 denotes no valid data)
                                continue;
                        // Read the bottom bit of the BAR. 
-                       if (result & PCI_BAR_IO_MASK) {
-                               result = result & PCI_IO_MASK;
+                       if (result & PCI_BAR_IO) {
+                               result = result & PCI_BAR_IO_MASK;
                                rl8168_debug("-->BAR%u: %s --> %x\n", k, "IO", result);
                        } else {
-                               result = result & PCI_MEM_MASK;
+                               result = result & PCI_BAR_MEM_MASK;
                                rl8168_debug("-->BAR%u: %s --> %x\n", k, "MEM", result);
                        }
                        // TODO Switch to memory mapped instead of IO?
@@ -311,16 +311,7 @@ void rl8168_setup_interrupts() {
        outw(rl8168_io_base_addr + RL_IS_REG, RL_INTRRUPT_CLEAR);
        
        // Kernel based interrupt stuff
-       register_interrupt_handler(interrupt_handlers, KERNEL_IRQ_OFFSET + rl8168_irq, rl8168_interrupt_handler, 0);
-#ifdef CONFIG_ENABLE_MPTABLES
-       ioapic_route_irq(rl8168_irq, 1);        
-#else
-       pic_unmask_irq(rl8168_irq);
-       unmask_lapic_lvt(LAPIC_LVT_LINT0);
-       enable_irq();
-#endif
-       
-       return;
+       register_dev_irq(rl8168_irq, rl8168_interrupt_handler, 0);
 }
 
 // We need to evaluate this routine in terms of concurrency.