Page MenuHomeFreeBSD

D56421.id175612.diff
No OneTemporary

D56421.id175612.diff

diff --git a/sys/powerpc/include/pcpu.h b/sys/powerpc/include/pcpu.h
--- a/sys/powerpc/include/pcpu.h
+++ b/sys/powerpc/include/pcpu.h
@@ -45,6 +45,7 @@
struct thread *pc_vecthread; /* current vec user */ \
struct thread *pc_htmthread; /* current htm user */ \
uintptr_t pc_hwref; \
+ uintptr_t pc_pic; \
int pc_bsp; \
volatile int pc_awake; \
uint32_t pc_ipimask; \
diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c
--- a/sys/powerpc/powerpc/mp_machdep.c
+++ b/sys/powerpc/powerpc/mp_machdep.c
@@ -87,6 +87,7 @@
/* Give platform code a chance to do anything else necessary */
platform_smp_ap_init();
+ PIC_AP_INIT(root_pic);
/* Initialize decrementer */
decr_ap_init();
diff --git a/sys/powerpc/powerpc/openpic.c b/sys/powerpc/powerpc/openpic.c
--- a/sys/powerpc/powerpc/openpic.c
+++ b/sys/powerpc/powerpc/openpic.c
@@ -254,7 +254,7 @@
break;
ncpu++;
}
- mask &= (1 << cpu);
+ mask = (1 << __pcpu[cpu].pc_pic);
}
openpic_write(sc, OPENPIC_IDEST(irq), mask);
@@ -288,9 +288,10 @@
CTR1(KTR_INTR, "%s: got interrupt", __func__);
- cpuid = (dev == root_pic) ? PCPU_GET(cpuid) : 0;
-
sc = device_get_softc(dev);
+
+ cpuid = (dev == root_pic) ? PCPU_GET(pic) : 0;
+
while (1) {
vector = openpic_read(sc, OPENPIC_PCPU_IACK(cpuid));
vector &= OPENPIC_VECTOR_MASK;
@@ -337,9 +338,9 @@
struct openpic_softc *sc;
u_int cpuid;
- cpuid = (dev == root_pic) ? PCPU_GET(cpuid) : 0;
-
sc = device_get_softc(dev);
+ cpuid = (dev == root_pic) ? PCPU_GET(pic) : 0;
+
openpic_write(sc, OPENPIC_PCPU_EOI(cpuid), 0);
}
@@ -352,8 +353,8 @@
sc = device_get_softc(dev);
sched_pin();
- openpic_write(sc, OPENPIC_PCPU_IPI_DISPATCH(PCPU_GET(cpuid), 0),
- 1u << cpu);
+ openpic_write(sc, OPENPIC_PCPU_IPI_DISPATCH(PCPU_GET(pic), 0),
+ 1u << pcpu_find(cpu)->pc_pic);
sched_unpin();
}
@@ -454,6 +455,18 @@
return (0);
}
+static void
+openpic_ap_init(device_t dev)
+{
+ struct openpic_softc *sc;
+
+ if (dev != root_pic)
+ return;
+
+ sc = device_get_softc(dev);
+ PCPU_SET(pic, bus_read_4(sc->sc_memr, OPENPIC_WHOAMI));
+}
+
static device_method_t openpic_methods[] = {
/* Device interface */
DEVMETHOD(device_suspend, openpic_suspend),
@@ -468,6 +481,7 @@
DEVMETHOD(pic_ipi, openpic_ipi),
DEVMETHOD(pic_mask, openpic_mask),
DEVMETHOD(pic_unmask, openpic_unmask),
+ DEVMETHOD(pic_ap_init, openpic_ap_init),
DEVMETHOD_END
};
diff --git a/sys/powerpc/powerpc/pic_if.m b/sys/powerpc/powerpc/pic_if.m
--- a/sys/powerpc/powerpc/pic_if.m
+++ b/sys/powerpc/powerpc/pic_if.m
@@ -100,3 +100,6 @@
void *priv;
};
+METHOD void ap_init {
+ device_t dev;
+};

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 3, 7:13 PM (19 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40146266
Default Alt Text
D56421.id175612.diff (2 KB)

Event Timeline