The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d9f1922a33eeea6b9eed29b158acaf4387568485

commit d9f1922a33eeea6b9eed29b158acaf4387568485
Author:     John Baldwin <[email protected]>
AuthorDate: 2025-12-09 20:02:33 +0000
Commit:     John Baldwin <[email protected]>
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,

Reply via email to