grml...
[seabios.git] / src / pic.c
index aa0453a81b9481dfd220e6dc501afeece6904d44..8992a8b576f79292a469cb63b6bea8b96058ffd5 100644 (file)
--- a/src/pic.c
+++ b/src/pic.c
 #include "config.h" // CONFIG_*
 
 void
-pic_setup()
+set_pics(u8 irq0, u8 irq8)
 {
-    dprintf(3, "init pic\n");
     // Send ICW1 (select OCW1 + will send ICW4)
     outb(0x11, PORT_PIC1_CMD);
     outb(0x11, PORT_PIC2_CMD);
     // Send ICW2 (base irqs: 0x08-0x0f for irq0-7, 0x70-0x77 for irq8-15)
-    outb(0x08, PORT_PIC1_DATA);
-    outb(0x70, PORT_PIC2_DATA);
+    outb(irq0, PORT_PIC1_DATA);
+    outb(irq8, PORT_PIC2_DATA);
     // Send ICW3 (cascaded pic ids)
     outb(0x04, PORT_PIC1_DATA);
     outb(0x02, PORT_PIC2_DATA);
@@ -30,24 +29,24 @@ pic_setup()
     outb(~0, PORT_PIC2_DATA);
 }
 
+void
+pic_setup(void)
+{
+    dprintf(3, "init pic\n");
+    set_pics(0x08, 0x70);
+}
+
 // Handler for otherwise unused hardware irqs.
 void VISIBLE16
 handle_hwpic1(struct bregs *regs)
 {
-    u8 isr = get_pic1_isr();
-    dprintf(DEBUG_ISR_hwpic1, "Got noisy pic1 irq %x\n", isr);
-    isr &= ~PIC1_IRQ2; // don't ever mask the cascaded irq
-    if (isr)
-        mask_pic1(isr);
+    dprintf(DEBUG_ISR_hwpic1, "handle_hwpic1 irq=%x\n", get_pic1_isr());
     eoi_pic1();
 }
 
 void VISIBLE16
 handle_hwpic2(struct bregs *regs)
 {
-    u8 isr = get_pic2_isr();
-    dprintf(DEBUG_ISR_hwpic2, "Got noisy pic2 irq %x\n", isr);
-    if (isr)
-        mask_pic2(isr);
+    dprintf(DEBUG_ISR_hwpic2, "handle_hwpic2 irq=%x\n", get_pic2_isr());
     eoi_pic2();
 }