patch-2.4.25 linux-2.4.25/arch/ppc64/kernel/xics.c

Next file: linux-2.4.25/arch/ppc64/kernel/xics.h
Previous file: linux-2.4.25/arch/ppc64/kernel/viopath.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.24/arch/ppc64/kernel/xics.c linux-2.4.25/arch/ppc64/kernel/xics.c
@@ -51,7 +51,6 @@
 };
 
 #define XICS_IPI		2
-#define XICS_IRQ_OFFSET		0x10
 #define XICS_IRQ_SPURIOUS	0
 
 /* Want a priority other than 0.  Various HW issues require this. */
@@ -136,17 +135,14 @@
 
 
 void
-xics_enable_irq(
-	u_int	virq
-	)
+xics_enable_irq(u_int virq)
 {
 	u_int		irq;
 	unsigned long	status;
 	long	        call_status;
 	unsigned int    interrupt_server = default_server;
 
-	virq -= XICS_IRQ_OFFSET;
-	irq = virt_irq_to_real(virq);
+	irq = irq_offset_down(virq);
 	if (irq == XICS_IPI)
 		return;
 
@@ -175,18 +171,14 @@
 }
 
 void
-xics_disable_irq(
-	u_int	virq
-	)
+xics_disable_irq(u_int virq)
 {
 	u_int		irq;
 	unsigned long 	status;
 	long 	        call_status;
 
-	virq -= XICS_IRQ_OFFSET;
-	irq = virt_irq_to_real(virq);
-	call_status = rtas_call(ibm_int_off, 1, 1, (unsigned long*)&status, 
-				irq);
+	irq = irq_offset_down(virq);
+	call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq);
 	if( call_status != 0 ) {
 		printk("xics_disable_irq: irq=%x: rtas_call failed, retn=%lx\n",
 		       irq, call_status);
@@ -195,16 +187,12 @@
 }
 
 void
-xics_end_irq(
-	u_int	irq
-	)
+xics_end_irq(u_int irq)
 {
 	int cpu = smp_processor_id();
 
-	ops->cppr_info(cpu, 0); /* actually the value overwritten by ack */
-	iosync();
-	ops->xirr_info_set(cpu, ((0xff<<24) | (virt_irq_to_real(irq-XICS_IRQ_OFFSET))));
 	iosync();
+	ops->xirr_info_set(cpu, (0xff<<24) | irq_offset_down(irq));
 }
 
 void
@@ -212,7 +200,7 @@
 {
 	int cpu = smp_processor_id();
 
-	if( irq < XICS_IRQ_OFFSET ) {
+	if (irq < irq_offset_value()) {
 		i8259_pic.ack(irq);
 		iosync();
 		ops->xirr_info_set(cpu, ((0xff<<24) | xics_irq_8259_cascade_real));
@@ -239,13 +227,13 @@
 		irq = i8259_irq(cpu);
 		if(irq == -1) {
 			/* Spurious cascaded interrupt.  Still must ack xics */
-                        xics_end_irq(XICS_IRQ_OFFSET + xics_irq_8259_cascade);
+			xics_end_irq(irq_offset_up(xics_irq_8259_cascade));
 			irq = -1;
 		}
 	} else if( vec == XICS_IRQ_SPURIOUS ) {
 		irq = -1;
 	} else {
-		irq = real_irq_to_virt(vec) + XICS_IRQ_OFFSET;
+		irq = irq_offset_up(vec);
 	}
 	return irq;
 }
@@ -290,6 +278,15 @@
 }
 #endif /* CONFIG_SMP */
 
+void xics_init_irq_desc(irq_desc_t *desc)
+{
+	/* Don't mess with the handler if already set.
+	 * This leaves the setup of isa handlers undisturbed.
+	 */
+	if (!desc->handler)
+		desc->handler = &xics_pic;
+}
+
 void
 xics_init_IRQ( void )
 {
@@ -373,7 +370,7 @@
 			while (1);
 		}
 		xics_irq_8259_cascade_real = *ireg;
-		xics_irq_8259_cascade = virt_irq_create_mapping(xics_irq_8259_cascade_real);
+		xics_irq_8259_cascade = xics_irq_8259_cascade_real;
 	}
 
 	if (systemcfg->platform == PLATFORM_PSERIES) {
@@ -398,36 +395,24 @@
 	xics_8259_pic.enable = i8259_pic.enable;
 	xics_8259_pic.disable = i8259_pic.disable;
 	for (i = 0; i < 16; ++i)
-		irq_desc[i].handler = &xics_8259_pic;
-	for (; i < NR_IRQS; ++i)
-		irq_desc[i].handler = &xics_pic;
+		real_irqdesc(i)->handler = &xics_8259_pic;
 
 	ops->cppr_info(0, 0xff);
 	iosync();
 	if (xics_irq_8259_cascade != -1) {
-		if (request_irq(xics_irq_8259_cascade + XICS_IRQ_OFFSET, no_action,
-				0, "8259 cascade", 0))
+		if (request_irq(irq_offset_up(xics_irq_8259_cascade),
+				no_action, 0, "8259 cascade", 0))
 			printk(KERN_ERR "xics_init_IRQ: couldn't get 8259 cascade\n");
 		i8259_init();
 	}
 
 #ifdef CONFIG_SMP
-	real_irq_to_virt_map[XICS_IPI] = virt_irq_to_real_map[XICS_IPI] = XICS_IPI;
-	request_irq(XICS_IPI + XICS_IRQ_OFFSET, xics_ipi_action, 0, "IPI", 0);
-	irq_desc[XICS_IPI+XICS_IRQ_OFFSET].status |= IRQ_PER_CPU;
+	request_irq(irq_offset_up(XICS_IPI), xics_ipi_action, 0, "IPI", 0);
+	real_irqdesc(irq_offset_up(XICS_IPI))->status |= IRQ_PER_CPU;
 #endif
 	ppc64_boot_msg(0x21, "XICS Done");
 }
 
-void xics_isa_init(void)
-{
-	return;
-	if (request_irq(xics_irq_8259_cascade + XICS_IRQ_OFFSET, no_action,
-			0, "8259 cascade", 0))
-		printk(KERN_ERR "xics_init_IRQ: couldn't get 8259 cascade\n");
-	i8259_init();
-}
-
 /*
  * Find first logical cpu and return its physical cpu number
  */
@@ -445,21 +430,19 @@
 	return default_distrib_server;
 }
 
-void xics_set_affinity(unsigned int virq, unsigned long cpumask)
+void xics_set_affinity(unsigned int irq, unsigned long cpumask)
 {
-        irq_desc_t *desc = irq_desc + virq;
-	unsigned int irq;
+	irq_desc_t *desc = irqdesc(irq);
 	unsigned long flags;
 	long status;
 	unsigned long xics_status[2];
 	u32 newmask;
 
-	virq -= XICS_IRQ_OFFSET;
-	irq = virt_irq_to_real(virq);
+	irq = irq_offset_down(irq);
 	if (irq == XICS_IPI)
 		return;
 
-        spin_lock_irqsave(&desc->lock, flags);
+	spin_lock_irqsave(&desc->lock, flags);
 
 	status = rtas_call(ibm_get_xive, 1, 3, (void *)&xics_status, irq);
 
@@ -485,5 +468,5 @@
 	}
 
 out:
-        spin_unlock_irqrestore(&desc->lock, flags);
+	spin_unlock_irqrestore(&desc->lock, flags);
 }

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