summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2010-07-06 15:31:58 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2010-07-06 15:31:58 +0000
commit990347ec5d0306c6f82b564336200db370a0ee1c (patch)
treefa38bd2a7b89ae67616fff74ef7e872d047eba96 /sys/powerpc
parent6075124f5d4f68fbf2a03a70240288f2e9947813 (diff)
downloadFreeBSD-src-990347ec5d0306c6f82b564336200db370a0ee1c.zip
FreeBSD-src-990347ec5d0306c6f82b564336200db370a0ee1c.tar.gz
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
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/powerpc/openpic.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sys/powerpc/powerpc/openpic.c b/sys/powerpc/powerpc/openpic.c
index cf06c6a..f06349a 100644
--- a/sys/powerpc/powerpc/openpic.c
+++ b/sys/powerpc/powerpc/openpic.c
@@ -74,7 +74,7 @@ openpic_set_priority(struct openpic_softc *sc, int pri)
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 trapframe *tf)
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();
}
OpenPOWER on IntegriCloud