PATCH: Adeos ppc g5 support
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
arch/ppc/kernel/adeos.c +27 -2
@@ -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 (®s); +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);
arch/ppc/platforms/pmac_pic.c +5 -0
@@ -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,
Philippe Gerum
AppliedQuoted 6 lines · Heikki Lindholm
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.
Signature · 1 line
Philippe.