The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e279724ae5a720c84cd86f1ce6fdac31fb94e735
commit e279724ae5a720c84cd86f1ce6fdac31fb94e735 Author: John Baldwin <[email protected]> AuthorDate: 2025-12-09 20:00:20 +0000 Commit: John Baldwin <[email protected]> CommitDate: 2025-12-09 20:00:20 +0000 resource_list_reserve: Pass rid by value Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53403 --- sys/dev/acpica/acpi.c | 2 +- sys/dev/dpaa2/dpaa2_rc.c | 2 +- sys/dev/pci/pci.c | 23 +++++++++++------------ sys/kern/subr_bus.c | 6 +++--- sys/sys/bus.h | 2 +- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index a40ee709e762..408570f53a21 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1525,7 +1525,7 @@ acpi_reserve_resources(device_t dev) * acpi_alloc_resource() will sub-alloc from the system * resource. */ - resource_list_reserve(rl, dev, children[i], rle->type, &rle->rid, + resource_list_reserve(rl, dev, children[i], rle->type, rle->rid, rle->start, rle->end, rle->count, 0); } } diff --git a/sys/dev/dpaa2/dpaa2_rc.c b/sys/dev/dpaa2/dpaa2_rc.c index c360b6fcc929..36cacd1daa4b 100644 --- a/sys/dev/dpaa2/dpaa2_rc.c +++ b/sys/dev/dpaa2/dpaa2_rc.c @@ -3321,7 +3321,7 @@ dpaa2_rc_add_res(device_t rcdev, device_t child, enum dpaa2_dev_type devtype, /* Reserve a newly added DPAA2 resource. */ res = resource_list_reserve(&dinfo->resources, rcdev, child, devtype, - rid, (rman_res_t) dpaa2_dev, (rman_res_t) dpaa2_dev, 1, + *rid, (rman_res_t) dpaa2_dev, (rman_res_t) dpaa2_dev, 1, flags & ~RF_ACTIVE); if (!res) { device_printf(rcdev, "%s: failed to reserve %s (rid=%d) for: %s " diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 6d929b2f236c..d42388a15a04 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -3481,7 +3481,7 @@ pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, * driver for this device will later inherit this resource in * pci_alloc_resource(). */ - res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, + res = resource_list_reserve(rl, bus, dev, type, reg, start, end, count, flags); if ((pci_do_realloc_bars || pci_has_quirk(pci_get_devid(dev), PCI_QUIRK_REALLOC_BAR)) @@ -3494,7 +3494,7 @@ pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, */ resource_list_delete(rl, type, reg); resource_list_add(rl, type, reg, 0, ~0, count); - res = resource_list_reserve(rl, bus, dev, type, ®, 0, ~0, + res = resource_list_reserve(rl, bus, dev, type, reg, 0, ~0, count, flags); } if (res == NULL) { @@ -3553,11 +3553,11 @@ pci_ata_maps(device_t bus, device_t dev, struct resource_list *rl, int force, } else { rid = PCIR_BAR(0); resource_list_add(rl, type, rid, 0x1f0, 0x1f7, 8); - (void)resource_list_reserve(rl, bus, dev, type, &rid, 0x1f0, + (void)resource_list_reserve(rl, bus, dev, type, rid, 0x1f0, 0x1f7, 8, 0); rid = PCIR_BAR(1); resource_list_add(rl, type, rid, 0x3f6, 0x3f6, 1); - (void)resource_list_reserve(rl, bus, dev, type, &rid, 0x3f6, + (void)resource_list_reserve(rl, bus, dev, type, rid, 0x3f6, 0x3f6, 1, 0); } if (progif & PCIP_STORAGE_IDE_MODESEC) { @@ -3568,11 +3568,11 @@ pci_ata_maps(device_t bus, device_t dev, struct resource_list *rl, int force, } else { rid = PCIR_BAR(2); resource_list_add(rl, type, rid, 0x170, 0x177, 8); - (void)resource_list_reserve(rl, bus, dev, type, &rid, 0x170, + (void)resource_list_reserve(rl, bus, dev, type, rid, 0x170, 0x177, 8, 0); rid = PCIR_BAR(3); resource_list_add(rl, type, rid, 0x376, 0x376, 1); - (void)resource_list_reserve(rl, bus, dev, type, &rid, 0x376, + (void)resource_list_reserve(rl, bus, dev, type, rid, 0x376, 0x376, 1, 0); } pci_add_map(bus, dev, PCIR_BAR(4), rl, force, @@ -3815,7 +3815,7 @@ pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, struct resource *res; char *cp; rman_res_t start, end, count; - int rid, sec_bus, sec_reg, sub_bus, sub_reg, sup_bus; + int sec_bus, sec_reg, sub_bus, sub_reg, sup_bus; switch (cfg->hdrtype & PCIM_HDRTYPE) { case PCIM_HDRTYPE_BRIDGE: @@ -3895,8 +3895,7 @@ pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, if (pci_clear_buses) goto clear; - rid = 0; - res = resource_list_reserve(rl, bus, dev, PCI_RES_BUS, &rid, + res = resource_list_reserve(rl, bus, dev, PCI_RES_BUS, 0, start, end, count, 0); if (res != NULL) return; @@ -3945,7 +3944,7 @@ pci_alloc_secbus(device_t dev, device_t child, int rid, rman_res_t start, if (resource_list_find(rl, PCI_RES_BUS, rid) == NULL) resource_list_add(rl, PCI_RES_BUS, rid, start, end, count); if (!resource_list_reserved(rl, PCI_RES_BUS, rid)) { - res = resource_list_reserve(rl, dev, child, PCI_RES_BUS, &rid, + res = resource_list_reserve(rl, dev, child, PCI_RES_BUS, rid, start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { resource_list_delete(rl, PCI_RES_BUS, rid); @@ -4106,7 +4105,7 @@ pci_add_resources_ea(device_t bus, device_t dev, int alloc_iov) continue; resource_list_add(rl, type, rid, start, end, count); - res = resource_list_reserve(rl, bus, dev, type, &rid, start, end, count, + res = resource_list_reserve(rl, bus, dev, type, rid, start, end, count, flags); if (res == NULL) { resource_list_delete(rl, type, rid); @@ -5591,7 +5590,7 @@ pci_reserve_map(device_t dev, device_t child, int type, int *rid, * 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, + res = resource_list_reserve(rl, dev, child, type, *rid, start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { resource_list_delete(rl, type, *rid); diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 86538ac8b9d8..d2363d6c625e 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -3096,7 +3096,7 @@ resource_list_delete(struct resource_list *rl, int type, int rid) */ struct resource * resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, - int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) + int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list_entry *rle = NULL; int passthrough = (device_get_parent(child) != bus); @@ -3109,10 +3109,10 @@ resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, panic( "resource_list_reserve() should only reserve inactive resources"); - r = resource_list_alloc(rl, bus, child, type, *rid, start, end, count, + r = resource_list_alloc(rl, bus, child, type, rid, start, end, count, flags); if (r != NULL) { - rle = resource_list_find(rl, type, *rid); + rle = resource_list_find(rl, type, rid); rle->flags |= RLE_RESERVED; } return (r); diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 96e3da3498ea..10f596654150 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -393,7 +393,7 @@ int resource_list_release_active(struct resource_list *rl, struct resource * resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, - int type, int *rid, + int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int resource_list_unreserve(struct resource_list *rl,
