From nobody Fri May 1 00:08:25 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g6BG64l08z6cXxh for ; Fri, 01 May 2026 00:08:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g6BG648C1z3ynF for ; Fri, 01 May 2026 00:08:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777594110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m2kYEhS2tOf8VOUvqOVUbzOPYr0IDMI3qL0SoAcspB4=; b=W0Zo3Jl9ZCsO1eqOIluaGFzIAoXFWck6mUmig+DuJg9qPIr0NQJo/UUaB7VB3sIQzU4oyd o3mohjDDWjvT/u+Sihcv0XbJYCmzZI/3yjmLVO5pKZHdJOG0QEGzVm+/9IszAUmatIpZNG d1LifytvS/D3Hkf6bgumQMkxQo2Pj418LB2MmwF75hruxTLAn84hgbWz6Rj+1uwpQPd9lr 3UDyqxQBk2dAnHfT/MOh0K9aUTAhG6bMebEPEN2cd9+gSCzP75U+Sn+a3wR+7tajAGOMsN oUBokG5YvNzpAB2IZ3d4jyTpAlCcIJLLwY3YjAxqtFdLucDeXsP6hXMukj3kVw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777594110; a=rsa-sha256; cv=none; b=SYNfpsHQDUSVCoqP4+MdODpQchAu7bnni5aS62FOL1Sc3vNATht1M4cAdf3NxPjO4Ad54B i/Gn4kXO/rzwxNWOVIedJ3RU03WJFMyDOc9wTjaLcHNF5FEfwzZ94DIamNvCT+Ju35vH1p 2nvANJhJz4WkpJD/xo8bG35sJTDPxPFwGFrOfBmsThfF0/giZLBeVB3gHS5VN7XVAngW6Z MjI7hGRQmo2kAN38A6fNe0kxOmiikzx1ya8pVCcSA5cxVHRsrEnALGURpPtamdYu+x2BCk Fx30refFoC6Pufd2iexN6AYzQ/PI4ZL+q3Re0bTEgZbiNkw00wYfQU7fXXdj5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777594110; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m2kYEhS2tOf8VOUvqOVUbzOPYr0IDMI3qL0SoAcspB4=; b=Ty76vJ3xMdAVGzGSH5jVEjcVNnLPNHKJnpyfweq9dIEqgFxHNCe+0lEyNAY+Oxw26UUCOL sCpDiQAhVmNkzx0nIcQV8XPuToP/FmWBbWuOcKZAvdeWrTUux740hETbCqqoVTsLeo8K0x 84asaqt3zzrspILFdOgwPlwkHaYR8Gtyl5KDas8VwHwh7jjF4FUq30ymViWlJA8AApXlQf 09ium1izQNcF/op/izRAxrKu0W57fYH52UB9muVZr//21wC25jw5qsFxwSYsNZBPiIke6z d2ZxhgGMAe6G1FKyeag5A6CuKHpOQktzx6QGYfyEJGBfgr3Z1Zjq5lxZGTHSOg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g6BG63V1Szb51 for ; Fri, 01 May 2026 00:08:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32696 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 01 May 2026 00:08:25 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: 6a0610cb5018 - main - powerpc/pic: fix the openpic CPU logic to work on powermac List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6a0610cb50181d1797d1a8c5d60ad76c666a625e Auto-Submitted: auto-generated Date: Fri, 01 May 2026 00:08:25 +0000 Message-Id: <69f3eef9.32696.499d8cb1@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=6a0610cb50181d1797d1a8c5d60ad76c666a625e commit 6a0610cb50181d1797d1a8c5d60ad76c666a625e Author: Adrian Chadd AuthorDate: 2026-05-01 00:07:48 +0000 Commit: Adrian Chadd CommitDate: 2026-05-01 00:07:48 +0000 powerpc/pic: fix the openpic CPU logic to work on powermac Earlier work (40bcad56f - powerpc/pic: Add a PIC_AP_INIT() to set up AP PIC info) broke booting my dual G5 powermac. After much digging, jhibbits@ and I discovered that the openpic implementation for the memory/bus controller used in the G5 CPUs doesn't implement /all/ of the openpic specification. Notably it sticks the WHOAMI register in a different location. This is reading 0x0 back for all the PICs which is .. very not great. So to restore the previous behaviour, use a quick for now that jhibbits@ can set appropriately to trust WHOAMI. I've tested this on my dual G5 PPC and it boots/runs fine. Fixes: 40bcad56f Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D56751 --- sys/powerpc/include/openpicvar.h | 1 + sys/powerpc/ofw/openpic_ofw.c | 1 + sys/powerpc/powerpc/openpic.c | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/powerpc/include/openpicvar.h b/sys/powerpc/include/openpicvar.h index 4f086f809f08..2aca4b38e845 100644 --- a/sys/powerpc/include/openpicvar.h +++ b/sys/powerpc/include/openpicvar.h @@ -36,6 +36,7 @@ #define OPENPIC_QUIRK_SINGLE_BIND 1 /* Bind interrupts to only 1 CPU */ #define OPENPIC_QUIRK_HIDDEN_IRQS 2 /* May have IRQs beyond FRR[NIRQ] */ +#define OPENPIC_QUIRK_WHOAMI_WORKS 4 /* WHOAMI register is present */ /* Names match the macros in openpicreg.h. */ struct openpic_timer { diff --git a/sys/powerpc/ofw/openpic_ofw.c b/sys/powerpc/ofw/openpic_ofw.c index 4083e9eba749..48e2038f2f53 100644 --- a/sys/powerpc/ofw/openpic_ofw.c +++ b/sys/powerpc/ofw/openpic_ofw.c @@ -125,6 +125,7 @@ openpic_ofw_attach(device_t dev) if (ofw_bus_is_compatible(dev, "fsl,mpic")) { sc->sc_quirks = OPENPIC_QUIRK_SINGLE_BIND; sc->sc_quirks |= OPENPIC_QUIRK_HIDDEN_IRQS; + sc->sc_quirks |= OPENPIC_QUIRK_WHOAMI_WORKS; } return (openpic_common_attach(dev, xref)); diff --git a/sys/powerpc/powerpc/openpic.c b/sys/powerpc/powerpc/openpic.c index 3cb4c544a91a..d0c0cc59afe5 100644 --- a/sys/powerpc/powerpc/openpic.c +++ b/sys/powerpc/powerpc/openpic.c @@ -469,8 +469,23 @@ openpic_ap_init(device_t dev) if (dev != root_pic) return; + /* + * Not everything implements the full OpenPIC specification. + * + * Notably the CPC945 Bridge and Memory Controller User Manual, which + * is in the PPC 970 (ie Apple G5) CPUs, calls out a set of + * deviations from the specification. Thus we can't just assume + * WHOAMI is available everywhere. + * + * See 9.5.3.3 - Deviations from the OpenPIC specification. + * Notably - the WhoAmI register is actually 0xF8000050 for all CPUs. + */ + sc = device_get_softc(dev); - PCPU_SET(pic, bus_read_4(sc->sc_memr, OPENPIC_WHOAMI)); + if (sc->sc_quirks & OPENPIC_QUIRK_WHOAMI_WORKS) + PCPU_SET(pic, bus_read_4(sc->sc_memr, OPENPIC_WHOAMI)); + else + PCPU_SET(pic, PCPU_GET(cpuid)); } static device_method_t openpic_methods[] = {