aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2026-01-21 04:16:17 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2026-01-21 04:28:40 +0000
commit24d048be7aae10e101596bd0d0f09a901a6f97f0 (patch)
tree375dc391caa2f88304ac4e56f996fb4f2a18ae08
parentc611ef5747a5d2ceb094331d3dd74d5c8b523b9c (diff)
powerpc/mpc85xx: Set pc_hwref to the primary thread ID
On multithreaded cores (e6500) the CPU ID in the device tree (reg[0]) is the primary core, which may not match the cpuid, until Book-E threading is added.
-rw-r--r--sys/powerpc/mpc85xx/platform_mpc85xx.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/powerpc/mpc85xx/platform_mpc85xx.c b/sys/powerpc/mpc85xx/platform_mpc85xx.c
index 6653c40b01a3..cc2ad829eb05 100644
--- a/sys/powerpc/mpc85xx/platform_mpc85xx.c
+++ b/sys/powerpc/mpc85xx/platform_mpc85xx.c
@@ -302,14 +302,26 @@ mpc85xx_smp_first_cpu(platform_t plat, struct cpuref *cpuref)
static int
mpc85xx_smp_next_cpu(platform_t plat, struct cpuref *cpuref)
{
+ phandle_t node;
+ pcell_t reg;
+ int i;
if (cpu >= maxcpu)
return (ENOENT);
cpuref->cr_cpuid = cpu++;
- cpuref->cr_hwref = cpuref->cr_cpuid;
+
+ node = OF_finddevice("/cpus");
+ for (i = 0, node = OF_child(node); i < cpuref->cr_cpuid;
+ i++, node = OF_peer(node))
+ ;
+ if (OF_getencprop(node, "reg", &reg, sizeof(reg)) > 0)
+ cpuref->cr_hwref = reg;
+ else
+ cpuref->cr_hwref = cpuref->cr_cpuid;
if (bootverbose)
- printf("powerpc_smp_next_cpu: cpuid %d\n", cpuref->cr_cpuid);
+ printf("powerpc_smp_next_cpu: cpuid %d, hwref %d\n",
+ cpuref->cr_cpuid, (int)cpuref->cr_hwref);
return (0);
}