NIC drivers use register_dev_irq()
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 23 Oct 2013 05:22:40 +0000 (22:22 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 16 Jan 2014 19:15:47 +0000 (11:15 -0800)
In plan9, this would go in devether.

kern/drivers/net/e1000.c
kern/drivers/net/e1000.h
kern/drivers/net/ne2k.c
kern/drivers/net/rl8168.c
kern/drivers/net/rl8168.h

index 89a93da..fbb635b 100644 (file)
@@ -638,25 +638,7 @@ void e1000_setup_interrupts() {
        e1000_irq_enable();
 
        // Kernel based interrupt stuff
-       register_interrupt_handler(interrupt_handlers, KERNEL_IRQ_OFFSET + e1000_irq, e1000_interrupt_handler, 0);
-
-       // Enable irqs for the e1000
-       // TODO: figure out where the interrupts are actually going..
-#ifdef CONFIG_ENABLE_MPTABLES
-       /* TODO: this should be for any IOAPIC EOI, not just MPTABLES */
-       ioapic_route_irq(e1000_irq, E1000_IRQ_CPU);     
-       printk("ioapic rout\n");
-
-#else 
-       // This will route the interrupts automatically to CORE 0
-       // Call send_kernel_message if you want to route them somewhere else
-       pic_unmask_irq(e1000_irq);
-       unmask_lapic_lvt(LAPIC_LVT_LINT0);
-       enable_irq();
-       printk("picroute\n");
-#endif
-
-       return;
+       register_dev_irq(e1000_irq, e1000_interrupt_handler, 0);
 }
 
 // Code that is executed when an interrupt comes in on IRQ e1000_irq
index d3330cd..a7c96d5 100644 (file)
@@ -36,9 +36,6 @@
 
 #include "e1000_hw.h"
 
-// Offset used for indexing IRQs
-#define KERNEL_IRQ_OFFSET      32
-
 // Intel Descriptor Related Sizing
 #define E1000_NUM_TX_DESCRIPTORS       2048
 #define E1000_NUM_RX_DESCRIPTORS       2048
index 85b1add..9c4f105 100644 (file)
@@ -173,15 +173,7 @@ void ne2k_setup_interrupts() {
        ne2k_debug("-->Setting interrupts.\n");
        
        // Kernel based interrupt stuff
-       register_interrupt_handler(interrupt_handlers, KERNEL_IRQ_OFFSET + ne2k_irq, ne2k_interrupt_handler, (void *)0);
-       
-#ifdef CONFIG_ENABLE_MPTABLES
-       ioapic_route_irq(ne2k_irq, 0);  
-#else
-       pic_unmask_irq(ne2k_irq);
-       unmask_lapic_lvt(LAPIC_LVT_LINT0);
-       enable_irq();
-#endif
+       register_dev_irq(ne2k_irq, ne2k_interrupt_handler, 0);
        
        SET_PAGE_0();
 
index 4e6d6ac..a749114 100644 (file)
@@ -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.
index 6ae51aa..0c23be4 100644 (file)
@@ -84,9 +84,6 @@
 #define DES_TX_UDP_CHK_MASK 0x80000000
 #define DES_TX_TCP_CHK_MASK 0x40000000
 
-// Offset used for indexing IRQs
-#define KERNEL_IRQ_OFFSET      32
-
 // Realtek Descriptor Related Sizing
 #define NUM_TX_DESCRIPTORS     1024
 #define NUM_RX_DESCRIPTORS     1024