Author: nwhitehorn Date: Tue Jul 6 15:31:58 2010 New Revision: 209725 URL: http://svn.freebsd.org/changeset/base/209725
Log: Fix interrupt distribution to multiple CPUs on systems with cascaded PICs. Because slave PICs send all interrupts to their CPU 0 output line (which is routed to a pin on the master PIC), changes to per-CPU register banks like EOI on the slave PIC must be accessed for CPU 0, instead of the CPU actually processing the interrupt. Submitted by: Andreas Tobler Modified: head/sys/powerpc/powerpc/openpic.c Modified: head/sys/powerpc/powerpc/openpic.c ============================================================================== --- head/sys/powerpc/powerpc/openpic.c Tue Jul 6 15:27:05 2010 (r209724) +++ head/sys/powerpc/powerpc/openpic.c Tue Jul 6 15:31:58 2010 (r209725) @@ -74,7 +74,7 @@ openpic_set_priority(struct openpic_soft uint32_t x; sched_pin(); - tpr = OPENPIC_PCPU_TPR(PCPU_GET(cpuid)); + tpr = OPENPIC_PCPU_TPR((sc->sc_dev == root_pic) ? PCPU_GET(cpuid) : 0); x = openpic_read(sc, tpr); x &= ~OPENPIC_TPR_MASK; x |= pri; @@ -208,10 +208,10 @@ openpic_attach(device_t dev) for (irq = 0; irq < sc->sc_nirq; irq++) openpic_write(sc, OPENPIC_IDEST(irq), 1 << 0); - /* clear all pending interrupts */ + /* clear all pending interrupts from cpu 0 */ for (irq = 0; irq < sc->sc_nirq; irq++) { - (void)openpic_read(sc, OPENPIC_PCPU_IACK(PCPU_GET(cpuid))); - openpic_write(sc, OPENPIC_PCPU_EOI(PCPU_GET(cpuid)), 0); + (void)openpic_read(sc, OPENPIC_PCPU_IACK(0)); + openpic_write(sc, OPENPIC_PCPU_EOI(0), 0); } for (cpu = 0; cpu < sc->sc_ncpu; cpu++) @@ -282,7 +282,8 @@ openpic_dispatch(device_t dev, struct tr CTR1(KTR_INTR, "%s: got interrupt", __func__); - cpuid = PCPU_GET(cpuid); + cpuid = (dev == root_pic) ? PCPU_GET(cpuid) : 0; + sc = device_get_softc(dev); while (1) { @@ -318,19 +319,25 @@ void openpic_eoi(device_t dev, u_int irq __unused) { struct openpic_softc *sc; + u_int cpuid; + + cpuid = (dev == root_pic) ? PCPU_GET(cpuid) : 0; sc = device_get_softc(dev); - openpic_write(sc, OPENPIC_PCPU_EOI(PCPU_GET(cpuid)), 0); + openpic_write(sc, OPENPIC_PCPU_EOI(cpuid), 0); } void openpic_ipi(device_t dev, u_int cpu) { struct openpic_softc *sc; + u_int cpuid; sc = device_get_softc(dev); sched_pin(); - openpic_write(sc, OPENPIC_PCPU_IPI_DISPATCH(PCPU_GET(cpuid), 0), + cpuid = (dev == root_pic) ? PCPU_GET(cpuid) : 0; + + openpic_write(sc, OPENPIC_PCPU_IPI_DISPATCH(cpuid, 0), 1u << cpu); sched_unpin(); } _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"