From nobody Tue Dec 9 20:12:33 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 4dQqlQ0M8Cz6Jl1X for ; Tue, 09 Dec 2025 20:12:34 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dQqlP4Llfz3wFK for ; Tue, 09 Dec 2025 20:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765311153; 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=J713WTXvITnv93bRGkGmE869Wcgm2mbDotNjvbRQoZQ=; b=btmVEg4pPokRlZKzeF232Z79+cfMuEqJ6TFx+NbD09BAJ9y/xyVGshYRvr2dLipASJUbpX Ab7+cGYBd+8dqa3nMbj23xMN2AFyg9R5nsdLWvjPIIveIqq8xKB7vKxR7gebSwQA3p0o1P wPtWLiPNCb3toyWUnFNJipwlNMV3Ki0S6JzpRNrj029FELremwTM6jsph8ylnBTa3K8g/S V8k1HCnQNZ4INibOZCneU+INP8mMbZiJvIQNpNMO+u9XVaIImkPrcn2+ji3d/5pr0XM6YW UObpnwctcHCIWq68OawPYoud7nyVOOpCkgkU7RVBR6OyDTqC8QRGtOkBOYBHxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765311153; 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=J713WTXvITnv93bRGkGmE869Wcgm2mbDotNjvbRQoZQ=; b=OfR0/KcKpTt90BiN11fNGe9YF5zsLwIHPonUQLseAqjbSrnynJBAyy1/ySJHSp8G7Bd0dh Vsn2LR15M8VlFkuocwYWEQaNIFAqVLQltO7O0F2Hl7gXJ0IT8169mCYlp/PwJaG5arMiog TkTph145ly4+7jn8kaMVDRfJUG9ETGtAYOYMF+3K4rzPenPPAYYnC5f0VitdiApXPToQWe PF09Z4OKsYNP0vvo/SVi8bE1cRCOW+PX3Yq7jkRRbrS4fTkFL5yBC2yYN4eOehsVMnV7g5 gxDEn3PcTqoetZspTMqE2UhzUh1VhE9sTWjmw23B5K4bHyTzYosqP0bjGmOIRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765311153; a=rsa-sha256; cv=none; b=DK21HLlIbVeEIXLzuq4fnasTnhtciqSl7eKULmXTxq0dOO2qDprU6DcO8nkuJhx9Ndb5EV zLIsbJdA1IJGW9qbWYNeJ+7Hsho7eyu0a50+vCqZzqyXzJhnIo66TCzIqQA95+5z8A+6Mf 1CMzPvJfYqQJOSUPeegWb9TrtGZdhlI2WEnGkX8772BP5Rzl4m5ZQgnwILivlETKiLgg0P RLP9JCJRTBOZAjAHd/70WgfBpakAWcfkywBTb+dYT4H2VxftM51jQYWLqCk+v+ZvYxHQyK 5O5dN9xQwPBbJCXGnHPEUGbjHMxWDOeIHxk2KN2Xx2IpcF4tRphzOzYZF9dWZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dQqlP3t4pz1CVr for ; Tue, 09 Dec 2025 20:12:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30b27 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 09 Dec 2025 20:12:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: d9f1922a33ee - main - pci_reserve_map: Pass rid by value 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/main X-Git-Reftype: branch X-Git-Commit: d9f1922a33eeea6b9eed29b158acaf4387568485 Auto-Submitted: auto-generated Date: Tue, 09 Dec 2025 20:12:33 +0000 Message-Id: <693882b1.30b27.449b5b87@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d9f1922a33eeea6b9eed29b158acaf4387568485 commit d9f1922a33eeea6b9eed29b158acaf4387568485 Author: John Baldwin AuthorDate: 2025-12-09 20:02:33 +0000 Commit: John Baldwin CommitDate: 2025-12-09 20:02:33 +0000 pci_reserve_map: Pass rid by value Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53404 --- sys/compat/linuxkpi/common/src/linux_pci.c | 2 +- sys/dev/pci/pci.c | 30 +++++++++++++++--------------- sys/dev/pci/pci_private.h | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index fb3f648df496..df5255d8a6ca 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -547,7 +547,7 @@ linux_pci_reserve_bar(struct pci_dev *pdev, struct resource_list *rl, dev = pdev->pdrv != NULL && pdev->pdrv->isdrm ? device_get_parent(pdev->dev.bsddev) : pdev->dev.bsddev; - res = pci_reserve_map(device_get_parent(dev), dev, type, &rid, 0, ~0, + res = pci_reserve_map(device_get_parent(dev), dev, type, rid, 0, ~0, 1, 1, 0); if (res == NULL) return (NULL); diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index d42388a15a04..a46813cc155a 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -5505,7 +5505,7 @@ DB_SHOW_COMMAND_FLAGS(pciregs, db_pci_dump, DB_CMD_MEMSAFE) #endif /* DDB */ struct resource * -pci_reserve_map(device_t dev, device_t child, int type, int *rid, +pci_reserve_map(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int num, u_int flags) { @@ -5520,10 +5520,10 @@ pci_reserve_map(device_t dev, device_t child, int type, int *rid, res = NULL; /* If rid is managed by EA, ignore it */ - if (pci_ea_is_enabled(child, *rid)) + if (pci_ea_is_enabled(child, rid)) goto out; - pm = pci_find_bar(child, *rid); + pm = pci_find_bar(child, rid); if (pm != NULL) { /* This is a BAR that we failed to allocate earlier. */ mapsize = pm->pm_size; @@ -5537,28 +5537,28 @@ pci_reserve_map(device_t dev, device_t child, int type, int *rid, * have a atapci device in legacy mode and it fails * here, that other code is broken. */ - pci_read_bar(child, *rid, &map, &testval, NULL); + pci_read_bar(child, rid, &map, &testval, NULL); /* * Determine the size of the BAR and ignore BARs with a size * of 0. Device ROM BARs use a different mask value. */ - if (PCIR_IS_BIOS(&dinfo->cfg, *rid)) + if (PCIR_IS_BIOS(&dinfo->cfg, rid)) mapsize = pci_romsize(testval); else mapsize = pci_mapsize(testval); if (mapsize == 0) goto out; - pm = pci_add_bar(child, *rid, map, mapsize); + pm = pci_add_bar(child, rid, map, mapsize); } - if (PCI_BAR_MEM(map) || PCIR_IS_BIOS(&dinfo->cfg, *rid)) { + if (PCI_BAR_MEM(map) || PCIR_IS_BIOS(&dinfo->cfg, rid)) { if (type != SYS_RES_MEMORY) { if (bootverbose) device_printf(dev, "child %s requested type %d for rid %#x," " but the BAR says it is an memio\n", - device_get_nameunit(child), type, *rid); + device_get_nameunit(child), type, rid); goto out; } } else { @@ -5567,7 +5567,7 @@ pci_reserve_map(device_t dev, device_t child, int type, int *rid, device_printf(dev, "child %s requested type %d for rid %#x," " but the BAR says it is an ioport\n", - device_get_nameunit(child), type, *rid); + device_get_nameunit(child), type, rid); goto out; } } @@ -5589,20 +5589,20 @@ pci_reserve_map(device_t dev, device_t child, int type, int *rid, * Allocate enough resource, and then write back the * appropriate BAR for that resource. */ - resource_list_add(rl, type, *rid, start, end, count); - res = resource_list_reserve(rl, dev, child, type, *rid, start, end, + resource_list_add(rl, type, rid, start, end, count); + res = resource_list_reserve(rl, dev, child, type, rid, start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { - resource_list_delete(rl, type, *rid); + resource_list_delete(rl, type, rid); device_printf(child, "%#jx bytes of rid %#x res %d failed (%#jx, %#jx).\n", - count, *rid, type, start, end); + count, rid, type, start, end); goto out; } if (bootverbose) device_printf(child, "Lazy allocation of %#jx bytes rid %#x type %d at %#jx\n", - count, *rid, type, rman_get_start(res)); + count, rid, type, rman_get_start(res)); /* Disable decoding via the CMD register before updating the BAR */ cmd = pci_read_config(child, PCIR_COMMAND, 2); @@ -5680,7 +5680,7 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int rid, /* Reserve resources for this BAR if needed. */ rle = resource_list_find(rl, type, rid); if (rle == NULL) { - res = pci_reserve_map(dev, child, type, &rid, start, end, + res = pci_reserve_map(dev, child, type, rid, start, end, count, num, flags); if (res == NULL) return (NULL); diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h index 262ce30ad023..da8f9c02088e 100644 --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -147,7 +147,7 @@ struct pci_map *pci_add_bar(device_t dev, int reg, pci_addr_t value, pci_addr_t size); struct resource *pci_reserve_map(device_t dev, device_t child, int type, - int *rid, rman_res_t start, rman_res_t end, + int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int num, u_int flags); struct resource *pci_alloc_multi_resource(device_t dev, device_t child,