From nobody Wed Jun 10 04:01:09 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 4gZsX63D0Bz6gv4q for ; Wed, 10 Jun 2026 04:01:10 +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 4gZsX56dCmz3vxl for ; Wed, 10 Jun 2026 04:01:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781064069; 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=ssbL/A1jMOVS7Z+GuzWsMpIIutIy4hfrRhY16LIyuJo=; b=H1QBBcu62pGxUoaNHkI3iHRIlgUU7oljU1uR3zA0m4XeWl3mk120I9I75ZxkJ591LpaKU6 h6CmNLBHj93Enh3/gS/JRk/Jxmvvtb9jsgObb/zAAU2mxTB0r6zdLT4iG72733odj9l+rS m4vur4+QCDLXC6Dif2lwbUa5USejEHBO7JIx/fWKBEM8/CqyRc+XTO1drhaBSQqsorMX43 +p+rrtkg/zmPDdx+eNBRcvqLzBAxQf7ZH9WixaEAX4iToc2Y8qq4GPdPQxVvfMbMAqbtTZ DzKcqVDLXAZR5tT1zSUFsJXWZCTHtwT2P+M2F3Jivd71TzgGCXeUAZld4vkBlw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781064069; a=rsa-sha256; cv=none; b=rlgjAjvFRXw3nji0MYFWnn2enjJn7yGu4neg1W9hwVUk8c9Dm0WvwMJQIbcE38wUjw6Jo8 tc7zE+KeiH+URaEuXdQIWzqimbYCacv5/6FY9FBVxd5p5P5ioxMD7lWs4QlMdwogV9qn/z gA/5+QbZZDrNPcF4yGaYN9S+WjcOU+01tqybYJtbKGS4jqKw49hIiRj7qkQfVsoi0F2R5X U2p/NOLWysCb9bwgB5WhMFLzZHhF8lDmHy8Wjy1Ds2rNZQuZnlr+WsGAjX91ODbYUC461U aTGnZRJPrIUwzmwrKhxPKGtSbET48zFfWQyW+JzLdiPwMkGWMrIPOi/wCvANQw== 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=1781064069; 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=ssbL/A1jMOVS7Z+GuzWsMpIIutIy4hfrRhY16LIyuJo=; b=GPsBc0INaY+szWUbqwNUoAFBVetR0NTIu6MmLvJiRA4YeMEjTdj3wSabP53o8wFJwHP0c6 HAol7nqZr12KjdinsxTFqvTMHm1k+4roSVeXrm+TrDD16xJVIuLtJ1hFlP16EfgCt5pbOK XoF95LCZMuNIUdvZ8Mzh7vIosEDvmqDb9S9C0dvFzaKKB3BQK1+Aay+UCmk3XI76XyMXhL PHuPz+mljNy5U2qvCPU+3ZNihR6oHyTeKf5wDaK9hcEj6D5nBAv59sMMl6ivBPvUnobQ/8 mllhpOSNAKcba71bG3A3UzGiyLohwmy55n0r3t7pw8Zev578hl1VtpvfBRmwHA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gZsX56BjZz14M4 for ; Wed, 10 Jun 2026 04:01:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2645e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 10 Jun 2026 04:01:09 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 1f7337264f7d - stable/14 - pci: pci_host_generic: provide cleanup methods outside of detach 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1f7337264f7d03578f8f16dc84b1707639cc7116 Auto-Submitted: auto-generated Date: Wed, 10 Jun 2026 04:01:09 +0000 Message-Id: <6a28e185.2645e.63ef8b71@gitrepo.freebsd.org> The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1f7337264f7d03578f8f16dc84b1707639cc7116 commit 1f7337264f7d03578f8f16dc84b1707639cc7116 Author: Kyle Evans AuthorDate: 2026-05-09 02:46:24 +0000 Commit: Kyle Evans CommitDate: 2026-06-10 04:00:48 +0000 pci: pci_host_generic: provide cleanup methods outside of detach If device_attach() fails, we're expected to actually cleanup after ourselves because device_detach() will not be called. Factor out the cleanup bits that don't rely on attach having actually succeeded so that we can cleanup properly in bcm2838_pci. Reviewed by: andrew, imp (cherry picked from commit 31a94ec32b53ebf6227bc868ce4f7aa07650680d) --- sys/dev/pci/pci_host_generic.c | 15 +++++++++++---- sys/dev/pci/pci_host_generic.h | 1 + sys/dev/pci/pci_host_generic_fdt.c | 19 +++++++++++++++++++ sys/dev/pci/pci_host_generic_fdt.h | 1 + 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 0fa663c12a56..600aa7bed7f9 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -250,15 +250,22 @@ err_resource: int pci_host_generic_core_detach(device_t dev) { - struct generic_pcie_core_softc *sc; - int error, rid, tuple; - - sc = device_get_softc(dev); + int error; error = bus_generic_detach(dev); if (error != 0) return (error); + return (pci_host_generic_core_free(dev)); +} + +int +pci_host_generic_core_free(device_t dev) +{ + struct generic_pcie_core_softc *sc; + int rid, tuple; + + sc = device_get_softc(dev); for (tuple = 0; tuple < MAX_RANGES_TUPLES; tuple++) { rid = sc->ranges[tuple].rid; if (sc->ranges[tuple].size == 0) { diff --git a/sys/dev/pci/pci_host_generic.h b/sys/dev/pci/pci_host_generic.h index 2d15f06890db..ad2b55c29a7f 100644 --- a/sys/dev/pci/pci_host_generic.h +++ b/sys/dev/pci/pci_host_generic.h @@ -94,6 +94,7 @@ DECLARE_CLASS(generic_pcie_core_driver); int pci_host_generic_core_attach(device_t); int pci_host_generic_core_detach(device_t); +int pci_host_generic_core_free(device_t); struct resource *pci_host_generic_core_alloc_resource(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); int pci_host_generic_core_release_resource(device_t, device_t, int, int, diff --git a/sys/dev/pci/pci_host_generic_fdt.c b/sys/dev/pci/pci_host_generic_fdt.c index 05e77f46032f..b0ae82a67292 100644 --- a/sys/dev/pci/pci_host_generic_fdt.c +++ b/sys/dev/pci/pci_host_generic_fdt.c @@ -104,6 +104,25 @@ generic_pcie_fdt_probe(device_t dev) return (ENXIO); } +void +pci_host_generic_destroy_fdt(device_t dev) +{ + struct generic_pcie_fdt_softc *sc; + struct pci_ofw_devinfo *di; + + sc = device_get_softc(dev); + while (!STAILQ_EMPTY(&sc->pci_ofw_devlist)) { + di = STAILQ_FIRST(&sc->pci_ofw_devlist); + STAILQ_REMOVE_HEAD(&sc->pci_ofw_devlist, pci_ofw_link); + + ofw_bus_gen_destroy_devinfo(&di->di_dinfo); + free(di, M_DEVBUF); + } + + ofw_bus_destroy_iinfo(&sc->pci_iinfo); + (void)pci_host_generic_core_free(dev); +} + int pci_host_generic_setup_fdt(device_t dev) { diff --git a/sys/dev/pci/pci_host_generic_fdt.h b/sys/dev/pci/pci_host_generic_fdt.h index cc6e575f6056..790f781b23f0 100644 --- a/sys/dev/pci/pci_host_generic_fdt.h +++ b/sys/dev/pci/pci_host_generic_fdt.h @@ -46,6 +46,7 @@ DECLARE_CLASS(generic_pcie_fdt_driver); struct resource *pci_host_generic_alloc_resource(device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); int pci_host_generic_setup_fdt(device_t); +void pci_host_generic_destroy_fdt(device_t); int pci_host_generic_fdt_attach(device_t); int generic_pcie_get_id(device_t, device_t, enum pci_id_type, uintptr_t *);