From nobody Thu Feb 27 14:17:22 2025 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 4Z3YM71kyLz5qFxC; Thu, 27 Feb 2025 14:17:23 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z3YM717mdz3xBf; Thu, 27 Feb 2025 14:17:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740665843; 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=wkhK1BPH84nMllfwGmc0dnU8ctHJn0RND7aJcUJFVnw=; b=fc4YWA6gWbU/bY2wBSYTTKnwuwlzBWEaoaq8aNZcmAzrodz8Y/pI0N/B0nEpc2bEQh+2ds V60xk1FJnEuwUJTdb0W8zbpamyLJDa+OEYWhskg9HSp+c8A+yHx7yoNSehWRhbfJwL9wX1 DMiBiBE+DiuZjONdHWd565S7/91NGEGQ1ACDpPPNCtZ8fGHxHdm2VEKCPDE31vxrengg65 1I06e/VNcmIKANBMRIIvO0VhXA/b5owl8TPgcY6sHgm/c3q5DBGzWACSomk4Ro3CEWYCdy pBGJQhhkPEYxsAHuXn7wfsrxFecHG595H51539+fajP3Sble1Ks4IK4iDwUMBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740665843; a=rsa-sha256; cv=none; b=mnRwvNO9d3/X+M7A/jpTEjjQVOiPBRqUnpq51AeJTKFWE/v5PT0GsTcqWXsLyDfGNOKAEf BZ+DmR3hXMmyb3ssBXuf3hcbawO8nkWT7t0pH8IUfquElvH1h3n7DE32dBJ4DeVpzgPbx1 jZs34Dx9VmACKbhTmrZn9nYHNQL+XFB3w5jyjUuKEsT6SiHUSdw1sG4ZiRxbjYJtbrI3UE QHQ2IISPnqqwBy0TGRnn5FcSykl5jIn49zcD/b3VKSq+kGl/R5iwTwHx2zGTDCtHEzqbTd eePtSSRQS6UWGXeVGQfY+f51Z9wx6KlfTpkSAksovqVdt7wvwu1S7Vwv3QXspg== 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=1740665843; 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=wkhK1BPH84nMllfwGmc0dnU8ctHJn0RND7aJcUJFVnw=; b=e6kJKK3iQvDSLChZE0gB/oWihh9xYcJFXY4L9XExOgf+Y6TFMth3vegYn13iCXWMljwd+V ere3ikrTycLSudNfgxH5/79L3Rea5jMkhQgo7gFcd4H/rkW2U8II1i4NU63LNRMjGBkn4A MaHPoaefXNR/b3lzspJX9fkOjXAzH0wACKa8q6brK9rGSEykhSZtYNF4ku6Oj/zt5zbRz6 mad2K7cvaz+EtmSlJqm4XjVFnOltQtmqiW3Pe1wewM/4sAgMG43JiuV0H6nEMZdpM69h94 qUAhL4KLuowHllc2zW8/yiNLk6ydWhdT/XtRbyf48oBslBrZL5mLc3w7LRtIWw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Z3YM70l13zmf1; Thu, 27 Feb 2025 14:17:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 51REHNdd017258; Thu, 27 Feb 2025 14:17:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51REHMs1017255; Thu, 27 Feb 2025 14:17:22 GMT (envelope-from git) Date: Thu, 27 Feb 2025 14:17:22 GMT Message-Id: <202502271417.51REHMs1017255@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 385ad72523fe - stable/14 - pcib: Use rman_get_type in internal functions 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 385ad72523febc812f5f7b8b9b2ca167e7df6914 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=385ad72523febc812f5f7b8b9b2ca167e7df6914 commit 385ad72523febc812f5f7b8b9b2ca167e7df6914 Author: John Baldwin AuthorDate: 2024-03-13 22:05:54 +0000 Commit: John Baldwin CommitDate: 2025-02-27 13:09:23 +0000 pcib: Use rman_get_type in internal functions Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44127 (cherry picked from commit 582b84cd252d56f06556134b1103da3a0425fdbd) --- sys/dev/pci/pci_pci.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 68eab2a6633b..da09a917b9bc 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -164,9 +164,9 @@ SYSCTL_INT(_hw_pci, OID_AUTO, clear_pcib, CTLFLAG_RDTUN, &pci_clear_pcib, 0, * sub-allocated from one of our window resource managers. */ static struct pcib_window * -pcib_get_resource_window(struct pcib_softc *sc, int type, struct resource *r) +pcib_get_resource_window(struct pcib_softc *sc, struct resource *r) { - switch (type) { + switch (rman_get_type(r)) { case SYS_RES_IOPORT: if (rman_is_region_manager(r, &sc->io.rman)) return (&sc->io); @@ -188,14 +188,14 @@ pcib_get_resource_window(struct pcib_softc *sc, int type, struct resource *r) * resource managers? */ static int -pcib_is_resource_managed(struct pcib_softc *sc, int type, struct resource *r) +pcib_is_resource_managed(struct pcib_softc *sc, struct resource *r) { #ifdef PCI_RES_BUS - if (type == PCI_RES_BUS) + if (rman_get_type(r) == PCI_RES_BUS) return (rman_is_region_manager(r, &sc->bus.rman)); #endif - return (pcib_get_resource_window(sc, type, r) != NULL); + return (pcib_get_resource_window(sc, r) != NULL); } static int @@ -2386,7 +2386,7 @@ pcib_adjust_resource(device_t bus, device_t child, int type, struct resource *r, * If the resource wasn't sub-allocated from one of our region * managers then just pass the request up. */ - if (!pcib_is_resource_managed(sc, type, r)) + if (!pcib_is_resource_managed(sc, r)) return (bus_generic_adjust_resource(bus, child, type, r, start, end)); @@ -2411,7 +2411,7 @@ pcib_adjust_resource(device_t bus, device_t child, int type, struct resource *r, * Resource is managed and not a secondary bus number, must * be from one of our windows. */ - w = pcib_get_resource_window(sc, type, r); + w = pcib_get_resource_window(sc, r); KASSERT(w != NULL, ("%s: no window for resource (%#jx-%#jx) type %d", __func__, rman_get_start(r), rman_get_end(r), type)); @@ -2447,7 +2447,7 @@ pcib_release_resource(device_t dev, device_t child, int type, int rid, int error; sc = device_get_softc(dev); - if (pcib_is_resource_managed(sc, type, r)) { + if (pcib_is_resource_managed(sc, r)) { if (rman_get_flags(r) & RF_ACTIVE) { error = bus_deactivate_resource(child, type, rid, r); if (error) @@ -2466,7 +2466,7 @@ pcib_activate_resource(device_t dev, device_t child, int type, int rid, struct resource_map map; int error; - if (!pcib_is_resource_managed(sc, type, r)) + if (!pcib_is_resource_managed(sc, r)) return (bus_generic_activate_resource(dev, child, type, rid, r)); @@ -2495,7 +2495,7 @@ pcib_deactivate_resource(device_t dev, device_t child, int type, int rid, struct resource_map map; int error; - if (!pcib_is_resource_managed(sc, type, r)) + if (!pcib_is_resource_managed(sc, r)) return (bus_generic_deactivate_resource(dev, child, type, rid, r)); @@ -2533,7 +2533,7 @@ pcib_map_resource(device_t dev, device_t child, int type, struct resource *r, rman_res_t length, start; int error; - w = pcib_get_resource_window(sc, type, r); + w = pcib_get_resource_window(sc, r); if (w == NULL) return (bus_generic_map_resource(dev, child, type, r, argsp, map)); @@ -2563,7 +2563,7 @@ pcib_unmap_resource(device_t dev, device_t child, int type, struct resource *r, struct pcib_softc *sc = device_get_softc(dev); struct pcib_window *w; - w = pcib_get_resource_window(sc, type, r); + w = pcib_get_resource_window(sc, r); if (w != NULL) { r = pcib_find_parent_resource(w, r); if (r == NULL)