All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Adeos-main] PATCH: Adeos ppc g5 support
@ 2005-05-25 20:42 Heikki Lindholm
  2005-05-25 21:58 ` [Adeos-main] " Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Heikki Lindholm @ 2005-05-25 20:42 UTC (permalink / raw
  To: rtai; +Cc: adeos-main

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]

Hello,
Current adeos ppc has (at least) two problems with Apple G5 hardware:
* the PowerPC 970 decrementer does not work the same way as most ppc32 
decrementers: it can't be turned off and it's level-sensitive
* cascading interrupts aren't handled correctly
Attached is patch against fusion 0.7.4 included adeos to fix these 
problems (not the cleanest possible implementation, but the ppc32 kernel 
for g5 isn't either)

Regards,
  Heikki Lindholm

[-- Attachment #2: adeos-ppc-r7c1-g5.patch --]
[-- Type: text/plain, Size: 2346 bytes --]

diff -Nru linux-2.6.10-adeos-orig/arch/ppc/kernel/adeos.c linux-2.6.10-adeos-work/arch/ppc/kernel/adeos.c
--- linux-2.6.10-adeos-orig/arch/ppc/kernel/adeos.c	2005-05-25 21:22:41.289901000 +0300
+++ linux-2.6.10-adeos-work/arch/ppc/kernel/adeos.c	2005-05-25 23:23:17.954761000 +0300
@@ -65,6 +65,11 @@
 
 struct pt_regs __adeos_irq_regs;
 
+#ifdef CONFIG_POWER4
+extern struct irqaction k2u3_cascade_action;
+extern int openpic2_get_irq(struct pt_regs *regs);
+#endif
+
 /* Current reload value for the decrementer. */
 unsigned long __adeos_decr_ticks;
 
@@ -346,7 +351,7 @@
 
 {
     irq_desc_t *desc = irq_desc + irq;
-
+    
     if (desc->handler->ack != NULL)
 	{
 	unsigned long adflags;
@@ -364,7 +369,19 @@
 	preempt_disable();
 #endif /* CONFIG_PREEMPT */
 	spin_lock(&desc->lock);
-	desc->handler->ack(irq);
+	desc->handler->ack(irq); 
+#ifdef CONFIG_POWER4
+	/* if it is a k2u3 cascaded irq, acknowledge it, also */
+	if (desc->action == &k2u3_cascade_action) {
+	    struct pt_regs regs;
+	    int irq2 = openpic2_get_irq(&regs);
+	    if (irq2 != -1) {
+                irq_desc_t *desc2 = irq_desc + irq2;
+		if (desc2->handler->ack)
+		    desc2->handler->ack(irq2);
+	    }
+	}
+#endif
 	spin_unlock(&desc->lock);
 #ifdef CONFIG_PREEMPT
 	preempt_enable_no_resched();
@@ -565,6 +582,14 @@
 	return 1;
 	}
 
+#ifdef CONFIG_POWER4
+    /* On 970 CPUs DEC cannot be disabled, and without setting DEC
+     * here, DEC interrupt would be triggered as soon as interrupts are
+     * enabled in __adeos_sync_stage 
+     */
+    set_dec(0x7fffffff);
+#endif
+    
     __adeos_irq_regs.msr = regs->msr; /* for do_timer() */
 
     __adeos_handle_irq(ADEOS_TIMER_VIRQ,regs);
diff -Nru linux-2.6.10-adeos-orig/arch/ppc/platforms/pmac_pic.c linux-2.6.10-adeos-work/arch/ppc/platforms/pmac_pic.c
--- linux-2.6.10-adeos-orig/arch/ppc/platforms/pmac_pic.c	2004-12-24 23:35:28.000000000 +0200
+++ linux-2.6.10-adeos-work/arch/ppc/platforms/pmac_pic.c	2005-05-25 23:09:37.535483000 +0300
@@ -387,7 +387,12 @@
 	return IRQ_HANDLED;
 }
 
+#ifdef CONFIG_ADEOS_CORE
+/* this is used in kernel/adeos.c adeos_acknowledge_irq */
+struct irqaction k2u3_cascade_action = {
+#else /* !CONFIG_ADEOS_CORE */
 static struct irqaction k2u3_cascade_action = {
+#endif /* CONFIG_ADEOS_CORE */
 	.handler	= k2u3_action,
 	.flags		= 0,
 	.mask		= CPU_MASK_NONE,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Adeos-main] Re: PATCH: Adeos ppc g5 support
  2005-05-25 20:42 [Adeos-main] PATCH: Adeos ppc g5 support Heikki Lindholm
@ 2005-05-25 21:58 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2005-05-25 21:58 UTC (permalink / raw
  To: Heikki Lindholm; +Cc: rtai, adeos-main

Heikki Lindholm wrote:
> Hello,
> Current adeos ppc has (at least) two problems with Apple G5 hardware:
> * the PowerPC 970 decrementer does not work the same way as most ppc32 
> decrementers: it can't be turned off and it's level-sensitive
> * cascading interrupts aren't handled correctly
> Attached is patch against fusion 0.7.4 included adeos to fix these 
> problems (not the cleanest possible implementation, but the ppc32 kernel 
> for g5 isn't either)
> 

Applied, thanks. These fixes will be part of the next patch set.

-- 

Philippe.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-25 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-25 20:42 [Adeos-main] PATCH: Adeos ppc g5 support Heikki Lindholm
2005-05-25 21:58 ` [Adeos-main] " Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.