patch-2.4.0-test4 linux/arch/ppc/kernel/pmac_pic.c

Next file: linux/arch/ppc/kernel/pmac_setup.c
Previous file: linux/arch/ppc/kernel/pmac_pci.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test3/linux/arch/ppc/kernel/pmac_pic.c linux/arch/ppc/kernel/pmac_pic.c
@@ -61,14 +61,32 @@
 	openpic_enable_irq(irq_nr);
 }
 
+static void pmac_openpic_ack_irq(unsigned int irq_nr)
+{
+	if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0)
+		openpic_eoi(smp_processor_id());
+	openpic_disable_irq(irq_nr);
+}
+
+static void pmac_openpic_end_irq(unsigned int irq_nr)
+{
+	if ((irq_desc[irq_nr].status & IRQ_LEVEL) != 0)
+		openpic_eoi(smp_processor_id());
+	openpic_enable_irq(irq_nr);
+}
+
 struct hw_interrupt_type pmac_open_pic = {
 	" OpenPIC  ",
 	NULL,
 	NULL,
 	pmac_openpic_unmask_irq,
 	pmac_openpic_mask_irq,
-	pmac_openpic_mask_irq,
-	0
+	/* Theorically, the mask&ack should be NULL for OpenPIC. However, doing
+	 * so shows tons of bogus interrupts coming in.
+	 */
+	pmac_openpic_ack_irq,
+	pmac_openpic_end_irq,
+	NULL
 };
 
 static void __pmac pmac_mask_and_ack_irq(unsigned int irq_nr)
@@ -141,7 +159,8 @@
         pmac_unmask_irq,
         pmac_mask_irq,
         pmac_mask_and_ack_irq,
-        0
+        pmac_unmask_irq,
+        NULL
 };
 
 struct hw_interrupt_type gatwick_pic = {
@@ -151,7 +170,8 @@
 	pmac_unmask_irq,
 	pmac_mask_irq,
 	pmac_mask_and_ack_irq,
-	0
+	pmac_unmask_irq,
+	NULL
 };
 
 static void gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
@@ -199,17 +219,13 @@
         }
 #endif /* CONFIG_SMP */
 
-	/* Yeah, I know, this could be a separate get_irq function */
-	if (has_openpic)
-	{
+	if (has_openpic) {
 		irq = openpic_irq(smp_processor_id());
 		if (irq == OPENPIC_VEC_SPURIOUS)
 			/* We get those when doing polled ADB requests,
 			 * using -2 is a temp hack to disable the printk
 			 */
 			irq = -2; /*-1; */
-		else
-			openpic_eoi(smp_processor_id());
 	}
 	else
 	{

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)