The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=575639548cef58590a1d70c29e47aae0e8d44153
commit 575639548cef58590a1d70c29e47aae0e8d44153 Author: John Baldwin <[email protected]> AuthorDate: 2025-12-09 19:59:21 +0000 Commit: John Baldwin <[email protected]> CommitDate: 2025-12-09 20:00:06 +0000 bus_alloc_resource: Pass rid by value to BUS_ALLOC_RESOURCE DEVMETHOD The wrapper functions such as bus_alloc_resource_any() still support passing the rid by value or pointer, but the underlying implementation now passes by value. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53402 --- sys/arm/arm/gic.c | 6 ++--- sys/arm/mv/mv_pci.c | 4 ++-- sys/arm/mv/mv_pci_ctrl.c | 6 ++--- sys/arm64/arm64/gic_v3.c | 4 ++-- sys/arm64/arm64/nexus.c | 4 ++-- sys/arm64/cavium/thunder_pcie_common.c | 4 ++-- sys/arm64/cavium/thunder_pcie_common.h | 2 +- sys/arm64/cavium/thunder_pcie_fdt.c | 6 ++--- sys/arm64/cavium/thunder_pcie_pem.c | 6 ++--- sys/dev/acpica/acpi.c | 10 ++++---- sys/dev/acpica/acpi_pcib_acpi.c | 6 ++--- sys/dev/agp/agp_i810.c | 2 +- sys/dev/ahci/ahci.c | 10 ++++---- sys/dev/ahci/ahci.h | 2 +- sys/dev/ata/ata-pci.c | 12 +++++----- sys/dev/ata/ata-pci.h | 2 +- sys/dev/atkbdc/atkbdc_isa.c | 6 ++--- sys/dev/bhnd/bhnd_subr.c | 2 +- sys/dev/bhnd/bhndb/bhndb.c | 14 +++++------ sys/dev/bhnd/cores/chipc/chipc.c | 8 +++---- sys/dev/dpaa/fman.c | 8 +++---- sys/dev/dpaa/fman.h | 2 +- sys/dev/dpaa2/dpaa2_mc.c | 4 ++-- sys/dev/dpaa2/dpaa2_mc.h | 2 +- sys/dev/dpaa2/dpaa2_rc.c | 6 ++--- sys/dev/exca/exca.c | 8 +++---- sys/dev/fdt/simplebus.c | 8 +++---- sys/dev/gpio/gpiobus.c | 4 ++-- sys/dev/hyperv/pcib/vmbus_pcib.c | 4 ++-- sys/dev/hyperv/vmbus/vmbus.c | 6 ++--- sys/dev/mvs/mvs_pci.c | 4 ++-- sys/dev/mvs/mvs_soc.c | 4 ++-- sys/dev/ofw/ofw_pcib.c | 4 ++-- sys/dev/ofw/ofwbus.c | 6 ++--- sys/dev/pccbb/pccbb.c | 22 ++++++++--------- sys/dev/pccbb/pccbb_pci.c | 2 +- sys/dev/pccbb/pccbbvar.h | 2 +- sys/dev/pci/hostb_pci.c | 2 +- sys/dev/pci/isa_pci.c | 6 ++--- sys/dev/pci/pci.c | 28 +++++++++++----------- sys/dev/pci/pci_host_generic.c | 4 ++-- sys/dev/pci/pci_host_generic.h | 2 +- sys/dev/pci/pci_iov.c | 14 +++++------ sys/dev/pci/pci_pci.c | 18 +++++++------- sys/dev/pci/pci_private.h | 4 ++-- sys/dev/pci/pci_subr.c | 8 +++---- sys/dev/pci/pcib_private.h | 6 ++--- sys/dev/pci/vga_pci.c | 10 ++++---- sys/dev/ppc/ppc.c | 4 ++-- sys/dev/ppc/ppcvar.h | 2 +- sys/dev/puc/puc.c | 4 ++-- sys/dev/puc/puc_bfe.h | 2 +- sys/dev/quicc/quicc_bfe.h | 2 +- sys/dev/quicc/quicc_core.c | 4 ++-- sys/dev/scc/scc_bfe.h | 2 +- sys/dev/scc/scc_core.c | 3 +-- sys/dev/siis/siis.c | 4 ++-- sys/dev/sound/pci/csa.c | 8 +++---- sys/dev/sound/pci/fm801.c | 4 ++-- sys/dev/spibus/acpi_spibus.c | 4 ++-- sys/dev/vmd/vmd.c | 8 +++---- sys/dev/vnic/mrml_bridge.c | 6 ++--- sys/isa/isa_common.c | 2 +- sys/isa/isa_common.h | 2 +- sys/kern/bus_if.m | 11 ++++----- sys/kern/subr_bus.c | 22 ++++++++--------- sys/powerpc/mpc85xx/isa.c | 8 +++---- sys/powerpc/mpc85xx/lbc.c | 14 ++++------- sys/powerpc/powermac/macgpio.c | 4 ++-- sys/powerpc/powermac/macio.c | 10 ++++---- sys/powerpc/powermac/uninorth.c | 10 ++++---- sys/powerpc/ps3/ps3bus.c | 10 ++++---- sys/powerpc/psim/ata_iobus.c | 12 +++++----- sys/powerpc/psim/iobus.c | 4 ++-- sys/riscv/riscv/nexus.c | 4 ++-- sys/sys/bus.h | 44 +++++++++++++++++----------------- sys/sys/param.h | 2 +- sys/x86/include/legacyvar.h | 2 +- sys/x86/isa/isa.c | 16 ++++++------- sys/x86/pci/pci_bus.c | 2 +- sys/x86/pci/qpi.c | 2 +- sys/x86/x86/mptable_pci.c | 2 +- sys/x86/x86/nexus.c | 4 ++-- 83 files changed, 276 insertions(+), 282 deletions(-) diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index c1b2cf626ed8..e33bda4886b9 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -436,7 +436,7 @@ arm_gic_print_child(device_t bus, device_t child) } static struct resource * -arm_gic_alloc_resource(device_t bus, device_t child, int type, int *rid, +arm_gic_alloc_resource(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) { struct arm_gic_softc *sc; @@ -458,11 +458,11 @@ arm_gic_alloc_resource(device_t bus, device_t child, int type, int *rid, if (type == SYS_RES_IOPORT) type = SYS_RES_MEMORY; - rle = resource_list_find(rl, type, *rid); + rle = resource_list_find(rl, type, rid); if (rle == NULL) { if (bootverbose) device_printf(bus, "no default resources for " - "rid = %d, type = %d\n", *rid, type); + "rid = %d, type = %d\n", rid, type); return (NULL); } start = rle->start; diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c index 5983076d6be8..e34794b2b109 100644 --- a/sys/arm/mv/mv_pci.c +++ b/sys/arm/mv/mv_pci.c @@ -343,7 +343,7 @@ static int mv_pcib_probe(device_t); static int mv_pcib_attach(device_t); static struct rman *mv_pcib_get_rman(device_t, int, u_int); -static struct resource *mv_pcib_alloc_resource(device_t, device_t, int, int *, +static struct resource *mv_pcib_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int mv_pcib_adjust_resource(device_t, device_t, struct resource *, rman_res_t, rman_res_t); @@ -905,7 +905,7 @@ mv_pcib_get_rman(device_t dev, int type, u_int flags) } static struct resource * -mv_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, +mv_pcib_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct mv_pcib_softc *sc = device_get_softc(dev); diff --git a/sys/arm/mv/mv_pci_ctrl.c b/sys/arm/mv/mv_pci_ctrl.c index 902c0e129dbb..ca32531274a7 100644 --- a/sys/arm/mv/mv_pci_ctrl.c +++ b/sys/arm/mv/mv_pci_ctrl.c @@ -54,7 +54,7 @@ static int mv_pcib_ctrl_attach(device_t); static device_t mv_pcib_ctrl_add_child(device_t, u_int, const char *, int); static const struct ofw_bus_devinfo * mv_pcib_ctrl_get_devinfo(device_t, device_t); static struct resource * mv_pcib_ctrl_alloc_resource(device_t, device_t, int, - int *, rman_res_t, rman_res_t, rman_res_t, u_int); + int, rman_res_t, rman_res_t, rman_res_t, u_int); void mv_pcib_ctrl_init(device_t, phandle_t); static int mv_pcib_ofw_bus_attach(device_t); @@ -236,7 +236,7 @@ mv_pcib_ctrl_add_child(device_t dev, u_int order, const char *name, int unit) } static struct resource * -mv_pcib_ctrl_alloc_resource(device_t bus, device_t child, int type, int *rid, +mv_pcib_ctrl_alloc_resource(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) { struct mv_pcib_ctrl_devinfo *di; @@ -251,7 +251,7 @@ mv_pcib_ctrl_alloc_resource(device_t bus, device_t child, int type, int *rid, return (NULL); /* Find defaults for this rid */ - rle = resource_list_find(&di->di_rl, type, *rid); + rle = resource_list_find(&di->di_rl, type, rid); if (rle == NULL) return (NULL); diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c index d74cdc20dd20..3d9f5f2628fb 100644 --- a/sys/arm64/arm64/gic_v3.c +++ b/sys/arm64/arm64/gic_v3.c @@ -543,7 +543,7 @@ gic_v3_write_ivar(device_t dev, device_t child, int which, uintptr_t value) } static struct resource * -gic_v3_alloc_resource(device_t bus, device_t child, int type, int *rid, +gic_v3_alloc_resource(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) { struct gic_v3_softc *sc; @@ -563,7 +563,7 @@ gic_v3_alloc_resource(device_t bus, device_t child, int type, int *rid, return (NULL); /* Find defaults for this rid */ - rle = resource_list_find(rl, type, *rid); + rle = resource_list_find(rl, type, rid); if (rle == NULL) return (NULL); diff --git a/sys/arm64/arm64/nexus.c b/sys/arm64/arm64/nexus.c index 012bf859eb3c..d2e152b2a0c0 100644 --- a/sys/arm64/arm64/nexus.c +++ b/sys/arm64/arm64/nexus.c @@ -246,7 +246,7 @@ nexus_get_rman(device_t bus, int type, u_int flags) * child of one of our descendants, not a direct child of nexus0. */ static struct resource * -nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, +nexus_alloc_resource(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) { struct nexus_device *ndev = DEVTONX(child); @@ -261,7 +261,7 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid, if (RMAN_IS_DEFAULT_RANGE(start, end) && (count == 1)) { if (device_get_parent(child) != bus || ndev == NULL) return (NULL); - rle = resource_list_find(&ndev->nx_resources, type, *rid); + rle = resource_list_find(&ndev->nx_resources, type, rid); if (rle == NULL) return (NULL); start = rle->start; diff --git a/sys/arm64/cavium/thunder_pcie_common.c b/sys/arm64/cavium/thunder_pcie_common.c index 1fe6b1a683be..410e8600c0ab 100644 --- a/sys/arm64/cavium/thunder_pcie_common.c +++ b/sys/arm64/cavium/thunder_pcie_common.c @@ -169,7 +169,7 @@ thunder_pcie_identify_ecam(device_t dev, int *ecam) #ifdef THUNDERX_PASS_1_1_ERRATA struct resource * -thunder_pcie_alloc_resource(device_t dev, device_t child, int type, int *rid, +thunder_pcie_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { pci_addr_t map, testval; @@ -183,7 +183,7 @@ thunder_pcie_alloc_resource(device_t dev, device_t child, int type, int *rid, if (((type == SYS_RES_IOPORT) || (type == SYS_RES_MEMORY)) && RMAN_IS_DEFAULT_RANGE(start, end)) { /* Read BAR manually to get resource address and size */ - pci_read_bar(child, *rid, &map, &testval, NULL); + pci_read_bar(child, rid, &map, &testval, NULL); /* Mask the information bits */ if (PCI_BAR_MEM(map)) diff --git a/sys/arm64/cavium/thunder_pcie_common.h b/sys/arm64/cavium/thunder_pcie_common.h index 49cb7be62027..2e0fc9a2f309 100644 --- a/sys/arm64/cavium/thunder_pcie_common.h +++ b/sys/arm64/cavium/thunder_pcie_common.h @@ -39,7 +39,7 @@ uint64_t range_addr_pci_to_phys(struct pcie_range *, uint64_t); int thunder_pcie_identify_ecam(device_t, int *); #ifdef THUNDERX_PASS_1_1_ERRATA struct resource *thunder_pcie_alloc_resource(device_t, - device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); + device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); #endif #endif /* _CAVIUM_THUNDER_PCIE_COMMON_H_ */ diff --git a/sys/arm64/cavium/thunder_pcie_fdt.c b/sys/arm64/cavium/thunder_pcie_fdt.c index 87dc113ad781..a95a0f2c1563 100644 --- a/sys/arm64/cavium/thunder_pcie_fdt.c +++ b/sys/arm64/cavium/thunder_pcie_fdt.c @@ -55,7 +55,7 @@ #ifdef THUNDERX_PASS_1_1_ERRATA static struct resource * thunder_pcie_fdt_alloc_resource(device_t, device_t, - int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); + int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int thunder_pcie_fdt_release_resource(device_t, device_t, struct resource*); #endif @@ -228,7 +228,7 @@ thunder_pcie_fdt_get_id(device_t pci, device_t child, enum pci_id_type type, #ifdef THUNDERX_PASS_1_1_ERRATA struct resource * thunder_pcie_fdt_alloc_resource(device_t dev, device_t child, int type, - int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) + int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct generic_pcie_fdt_softc *sc; struct thunder_pcie_ofw_devinfo *di; @@ -253,7 +253,7 @@ thunder_pcie_fdt_alloc_resource(device_t dev, device_t child, int type, type = SYS_RES_MEMORY; /* Find defaults for this rid */ - rle = resource_list_find(&di->di_rl, type, *rid); + rle = resource_list_find(&di->di_rl, type, rid); if (rle == NULL) return (NULL); diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c index b01dfecb347e..04b892b91c56 100644 --- a/sys/arm64/cavium/thunder_pcie_pem.c +++ b/sys/arm64/cavium/thunder_pcie_pem.c @@ -124,7 +124,7 @@ static int thunder_pem_activate_resource(device_t, device_t, struct resource *); static int thunder_pem_adjust_resource(device_t, device_t, struct resource *, rman_res_t, rman_res_t); static struct resource * thunder_pem_alloc_resource(device_t, device_t, int, - int *, rman_res_t, rman_res_t, rman_res_t, u_int); + int, rman_res_t, rman_res_t, rman_res_t, u_int); static int thunder_pem_alloc_msi(device_t, device_t, int, int, int *); static int thunder_pem_release_msi(device_t, device_t, int, int *); static int thunder_pem_alloc_msix(device_t, device_t, int *); @@ -651,7 +651,7 @@ thunder_pem_write_config(device_t dev, u_int bus, u_int slot, } static struct resource * -thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid, +thunder_pem_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct thunder_pem_softc *sc = device_get_softc(dev); @@ -694,7 +694,7 @@ thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid, if (res == NULL && bootverbose) { device_printf(dev, "%s FAIL: type=%d, rid=%d, " "start=%016lx, end=%016lx, count=%016lx, flags=%x\n", - __func__, type, *rid, start, end, count, flags); + __func__, type, rid, start, end, count, flags); } return (res); diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 54e0d7be7920..a40ee709e762 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1562,7 +1562,7 @@ acpi_set_resource(device_t dev, device_t child, int type, int rid, } static struct resource * -acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, +acpi_alloc_resource(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) { #ifndef INTRNG @@ -1590,8 +1590,8 @@ acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, * add the resource before allocating it. Note that these * resources will not be reserved. */ - if (!isdefault && resource_list_find(rl, type, *rid) == NULL) - resource_list_add(rl, type, *rid, start, end, count); + if (!isdefault && resource_list_find(rl, type, rid) == NULL) + resource_list_add(rl, type, rid, start, end, count); res = resource_list_alloc(rl, bus, child, type, rid, start, end, count, flags); #ifndef INTRNG @@ -1604,7 +1604,7 @@ acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, * * XXX: Should we handle the lookup failing? */ - if (ACPI_SUCCESS(acpi_lookup_irq_resource(child, *rid, res, &ares))) + if (ACPI_SUCCESS(acpi_lookup_irq_resource(child, rid, res, &ares))) acpi_config_intr(child, &ares); } #endif @@ -1616,7 +1616,7 @@ acpi_alloc_resource(device_t bus, device_t child, int type, int *rid, * system resource regions. */ if (res == NULL && isdefault) { - rle = resource_list_find(rl, type, *rid); + rle = resource_list_find(rl, type, rid); if (rle != NULL) { start = rle->start; end = rle->end; diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c index 2fadd6cd32ee..eb23460ee358 100644 --- a/sys/dev/acpica/acpi_pcib_acpi.c +++ b/sys/dev/acpica/acpi_pcib_acpi.c @@ -90,7 +90,7 @@ static int acpi_pcib_map_msi(device_t pcib, device_t dev, static int acpi_pcib_alloc_msix(device_t pcib, device_t dev, int *irq); static struct resource *acpi_pcib_acpi_alloc_resource(device_t dev, - device_t child, int type, int *rid, + device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); static int acpi_pcib_acpi_adjust_resource(device_t dev, @@ -423,7 +423,7 @@ acpi_pcib_acpi_attach(device_t dev) sc->ap_bus = start; else { rid = 0; - bus_res = pci_domain_alloc_bus(sc->ap_segment, dev, &rid, 0, + bus_res = pci_domain_alloc_bus(sc->ap_segment, dev, rid, 0, PCI_BUSMAX, 1, 0); if (bus_res == NULL) { device_printf(dev, @@ -605,7 +605,7 @@ acpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, } struct resource * -acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, +acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct acpi_hpcib_softc *sc; diff --git a/sys/dev/agp/agp_i810.c b/sys/dev/agp/agp_i810.c index 9d955745f673..371eac691916 100644 --- a/sys/dev/agp/agp_i810.c +++ b/sys/dev/agp/agp_i810.c @@ -2025,7 +2025,7 @@ agp_i915_chipset_flush_alloc_page(device_t dev, uint64_t start, uint64_t end) vga = device_get_parent(dev); sc->sc_flush_page_rid = 100; sc->sc_flush_page_res = BUS_ALLOC_RESOURCE(device_get_parent(vga), dev, - SYS_RES_MEMORY, &sc->sc_flush_page_rid, start, end, PAGE_SIZE, + SYS_RES_MEMORY, sc->sc_flush_page_rid, start, end, PAGE_SIZE, RF_ACTIVE); if (sc->sc_flush_page_res == NULL) { device_printf(dev, "Failed to allocate flush page at 0x%jx\n", diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index 4ef3259dd10f..4275131d6396 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -576,7 +576,7 @@ ahci_intr_one_edge(void *data) } struct resource * -ahci_alloc_resource(device_t dev, device_t child, int type, int *rid, +ahci_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct ahci_controller *ctlr = device_get_softc(dev); @@ -606,14 +606,14 @@ ahci_alloc_resource(device_t dev, device_t child, int type, int *rid, size = 128; } else if ((ctlr->caps & AHCI_CAP_EMS) == 0) { break; - } else if (*rid == 0) { + } else if (rid == 0) { offset = AHCI_EM_CTL; size = 4; } else { offset = (ctlr->emloc & 0xffff0000) >> 14; size = (ctlr->emloc & 0x0000ffff) << 2; - if (*rid != 1) { - if (*rid == 2 && (ctlr->capsem & + if (rid != 1) { + if (rid == 2 && (ctlr->capsem & (AHCI_EM_XMT | AHCI_EM_SMB)) == 0) offset += size; else @@ -634,7 +634,7 @@ ahci_alloc_resource(device_t dev, device_t child, int type, int *rid, } break; case SYS_RES_IRQ: - if (*rid == ATA_IRQ_RID) + if (rid == ATA_IRQ_RID) res = ctlr->irqs[0].r_irq; break; } diff --git a/sys/dev/ahci/ahci.h b/sys/dev/ahci/ahci.h index 8b51b1e0b3ae..d72e332fab79 100644 --- a/sys/dev/ahci/ahci.h +++ b/sys/dev/ahci/ahci.h @@ -654,7 +654,7 @@ int ahci_attach(device_t dev); int ahci_detach(device_t dev); int ahci_setup_interrupt(device_t dev); int ahci_print_child(device_t dev, device_t child); -struct resource *ahci_alloc_resource(device_t dev, device_t child, int type, int *rid, +struct resource *ahci_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int ahci_release_resource(device_t dev, device_t child, struct resource *r); int ahci_setup_intr(device_t dev, device_t child, struct resource *irq, diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index cb44f98c406d..9ac9da092bc7 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -216,7 +216,7 @@ ata_pci_write_config(device_t dev, device_t child, int reg, } struct resource * -ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, +ata_pci_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { @@ -228,7 +228,7 @@ ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, int myrid; if (type == SYS_RES_IOPORT) { - switch (*rid) { + switch (rid) { case ATA_IOADDR_RID: if (controller->legacy) { start = (unit ? ATA_SECONDARY : ATA_PRIMARY); @@ -237,7 +237,7 @@ ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, } myrid = PCIR_BAR(0) + (unit << 3); res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, &myrid, + SYS_RES_IOPORT, myrid, start, end, count, flags); break; case ATA_CTLADDR_RID: @@ -249,12 +249,12 @@ ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, } myrid = PCIR_BAR(1) + (unit << 3); res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, &myrid, + SYS_RES_IOPORT, myrid, start, end, count, flags); break; } } - if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) { + if (type == SYS_RES_IRQ && rid == ATA_IRQ_RID) { if (controller->legacy) { int irq = (unit == 0 ? 14 : 15); @@ -265,7 +265,7 @@ ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, } } else { if (type == SYS_RES_IRQ) { - if (*rid != ATA_IRQ_RID) + if (rid != ATA_IRQ_RID) return (NULL); res = controller->r_irq; } else { diff --git a/sys/dev/ata/ata-pci.h b/sys/dev/ata/ata-pci.h index cad9441a21ae..630d0184c820 100644 --- a/sys/dev/ata/ata-pci.h +++ b/sys/dev/ata/ata-pci.h @@ -537,7 +537,7 @@ void ata_pci_write_config(device_t dev, device_t child, int reg, uint32_t val, int width); int ata_pci_print_child(device_t dev, device_t child); int ata_pci_child_location(device_t dev, device_t child, struct sbuf *sb); -struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); +struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int ata_pci_release_resource(device_t dev, device_t child, struct resource *r); int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep); int ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie); diff --git a/sys/dev/atkbdc/atkbdc_isa.c b/sys/dev/atkbdc/atkbdc_isa.c index 057ebbc7ec0d..062c5fc491e8 100644 --- a/sys/dev/atkbdc/atkbdc_isa.c +++ b/sys/dev/atkbdc/atkbdc_isa.c @@ -50,7 +50,7 @@ static int atkbdc_isa_attach(device_t dev); static device_t atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit); static struct resource *atkbdc_isa_alloc_resource(device_t dev, device_t child, - int type, int *rid, rman_res_t start, rman_res_t end, + int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); static int atkbdc_isa_release_resource(device_t dev, device_t child, struct resource *r); @@ -293,13 +293,13 @@ atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit) } struct resource * -atkbdc_isa_alloc_resource(device_t dev, device_t child, int type, int *rid, +atkbdc_isa_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { atkbdc_softc_t *sc; sc = *(atkbdc_softc_t **)device_get_softc(dev); - if (type == SYS_RES_IRQ && *rid == KBDC_RID_KBD && sc->irq != NULL) + if (type == SYS_RES_IRQ && rid == KBDC_RID_KBD && sc->irq != NULL) return (sc->irq); return (bus_generic_rl_alloc_resource(dev, child, type, rid, start, end, count, flags)); diff --git a/sys/dev/bhnd/bhnd_subr.c b/sys/dev/bhnd/bhnd_subr.c index 4818fffd5659..ac4f69db8cae 100644 --- a/sys/dev/bhnd/bhnd_subr.c +++ b/sys/dev/bhnd/bhnd_subr.c @@ -2201,7 +2201,7 @@ bhnd_bus_generic_alloc_resource(device_t dev, device_t child, int type, res = NULL; /* Allocate the real bus resource (without activating it) */ - res = BUS_ALLOC_RESOURCE(dev, child, type, rid, start, end, count, + res = BUS_ALLOC_RESOURCE(dev, child, type, *rid, start, end, count, (flags & ~RF_ACTIVE)); if (res == NULL) return (NULL); diff --git a/sys/dev/bhnd/bhndb/bhndb.c b/sys/dev/bhnd/bhndb/bhndb.c index f9d56a9b9226..90ae719787dc 100644 --- a/sys/dev/bhnd/bhndb/bhndb.c +++ b/sys/dev/bhnd/bhndb/bhndb.c @@ -937,7 +937,7 @@ bhndb_get_service_registry(device_t dev, device_t child) */ static struct resource * bhndb_alloc_resource(device_t dev, device_t child, int type, - int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) + int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct bhndb_softc *sc; struct resource_list_entry *rle; @@ -964,11 +964,11 @@ bhndb_alloc_resource(device_t dev, device_t child, int type, if (!passthrough && isdefault) { /* Fetch the resource list entry. */ rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), - type, *rid); + type, rid); if (rle == NULL) { device_printf(dev, "default resource %#x type %d for child %s " - "not found\n", *rid, type, + "not found\n", rid, type, device_get_nameunit(child)); return (NULL); @@ -977,7 +977,7 @@ bhndb_alloc_resource(device_t dev, device_t child, int type, if (rle->res != NULL) { device_printf(dev, "resource entry %#x type %d for child %s is busy\n", - *rid, type, device_get_nameunit(child)); + rid, type, device_get_nameunit(child)); return (NULL); } @@ -997,17 +997,17 @@ bhndb_alloc_resource(device_t dev, device_t child, int type, if (rv == NULL) return (NULL); - rman_set_rid(rv, *rid); + rman_set_rid(rv, rid); rman_set_type(rv, type); /* Activate */ if (flags & RF_ACTIVE) { - error = bus_activate_resource(child, type, *rid, rv); + error = bus_activate_resource(child, type, rid, rv); if (error) { device_printf(dev, "failed to activate entry %#x type %d for " "child %s: %d\n", - *rid, type, device_get_nameunit(child), error); + rid, type, device_get_nameunit(child), error); rman_release_resource(rv); diff --git a/sys/dev/bhnd/cores/chipc/chipc.c b/sys/dev/bhnd/cores/chipc/chipc.c index 24697a8f0b17..8d62bbcc4712 100644 --- a/sys/dev/bhnd/cores/chipc/chipc.c +++ b/sys/dev/bhnd/cores/chipc/chipc.c @@ -765,7 +765,7 @@ chipc_get_rman(device_t dev, int type, u_int flags) static struct resource * chipc_alloc_resource(device_t dev, device_t child, int type, - int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) + int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct chipc_softc *sc; struct chipc_region *cr; @@ -793,11 +793,11 @@ chipc_alloc_resource(device_t dev, device_t child, int type, if (!passthrough && isdefault) { /* Fetch the resource list entry. */ rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), - type, *rid); + type, rid); if (rle == NULL) { device_printf(dev, "default resource %#x type %d for child %s " - "not found\n", *rid, type, + "not found\n", rid, type, device_get_nameunit(child)); return (NULL); } @@ -806,7 +806,7 @@ chipc_alloc_resource(device_t dev, device_t child, int type, device_printf(dev, "resource entry %#x type %d for child %s is busy " "[%d]\n", - *rid, type, device_get_nameunit(child), + rid, type, device_get_nameunit(child), rman_get_flags(rle->res)); return (NULL); diff --git a/sys/dev/dpaa/fman.c b/sys/dev/dpaa/fman.c index 6f63e50f3a14..393c28487ba9 100644 --- a/sys/dev/dpaa/fman.c +++ b/sys/dev/dpaa/fman.c @@ -148,7 +148,7 @@ fman_release_resource(device_t bus, device_t child, struct resource *res) } struct resource * -fman_alloc_resource(device_t bus, device_t child, int type, int *rid, +fman_alloc_resource(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) { struct fman_softc *sc; @@ -166,7 +166,7 @@ fman_alloc_resource(device_t bus, device_t child, int type, int *rid, KASSERT(!(isdefault && passthrough), ("%s: passthrough of default allocation", __func__)); if (!passthrough) { - rle = resource_list_find(rl, type, *rid); + rle = resource_list_find(rl, type, rid); if (rle == NULL) return (NULL); KASSERT(rle->res == NULL, @@ -189,10 +189,10 @@ fman_alloc_resource(device_t bus, device_t child, int type, int *rid, end, count, flags & ~RF_ACTIVE, child); if (res == NULL) return (NULL); - rman_set_rid(res, *rid); + rman_set_rid(res, rid); rman_set_type(res, type); if ((flags & RF_ACTIVE) != 0 && bus_activate_resource( - child, type, *rid, res) != 0) { + child, type, rid, res) != 0) { rman_release_resource(res); return (NULL); } diff --git a/sys/dev/dpaa/fman.h b/sys/dev/dpaa/fman.h index 4c30a633ae3e..a2ada5e16ffb 100644 --- a/sys/dev/dpaa/fman.h +++ b/sys/dev/dpaa/fman.h @@ -54,7 +54,7 @@ struct fman_softc { * @{ */ struct resource * fman_alloc_resource(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 rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int fman_activate_resource(device_t bus, device_t child, struct resource *res); int fman_release_resource(device_t bus, device_t child, struct resource *res); diff --git a/sys/dev/dpaa2/dpaa2_mc.c b/sys/dev/dpaa2/dpaa2_mc.c index 8abfc3bfe1cc..9702bdbe13ba 100644 --- a/sys/dev/dpaa2/dpaa2_mc.c +++ b/sys/dev/dpaa2/dpaa2_mc.c @@ -300,7 +300,7 @@ dpaa2_mc_detach(device_t dev) */ struct resource * -dpaa2_mc_alloc_resource(device_t mcdev, device_t child, int type, int *rid, +dpaa2_mc_alloc_resource(device_t mcdev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; @@ -333,7 +333,7 @@ dpaa2_mc_alloc_resource(device_t mcdev, device_t child, int type, int *rid, return (res); fail: device_printf(mcdev, "%s() failed: type=%d, rid=%d, start=%#jx, " - "end=%#jx, count=%#jx, flags=%x\n", __func__, type, *rid, start, end, + "end=%#jx, count=%#jx, flags=%x\n", __func__, type, rid, start, end, count, flags); return (NULL); } diff --git a/sys/dev/dpaa2/dpaa2_mc.h b/sys/dev/dpaa2/dpaa2_mc.h index 5ddac7aa2720..416b77a11351 100644 --- a/sys/dev/dpaa2/dpaa2_mc.h +++ b/sys/dev/dpaa2/dpaa2_mc.h @@ -181,7 +181,7 @@ int dpaa2_mc_detach(device_t dev); struct rman *dpaa2_mc_rman(device_t mcdev, int type, u_int flags); struct resource * dpaa2_mc_alloc_resource(device_t mcdev, device_t child, - int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, + int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int dpaa2_mc_adjust_resource(device_t mcdev, device_t child, struct resource *r, rman_res_t start, rman_res_t end); diff --git a/sys/dev/dpaa2/dpaa2_rc.c b/sys/dev/dpaa2/dpaa2_rc.c index 3cb2fdfeaa2e..c360b6fcc929 100644 --- a/sys/dev/dpaa2/dpaa2_rc.c +++ b/sys/dev/dpaa2/dpaa2_rc.c @@ -225,7 +225,7 @@ dpaa2_rc_delete_resource(device_t rcdev, device_t child, int type, int rid) } static struct resource * -dpaa2_rc_alloc_multi_resource(device_t rcdev, device_t child, int type, int *rid, +dpaa2_rc_alloc_multi_resource(device_t rcdev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list *rl; @@ -243,7 +243,7 @@ dpaa2_rc_alloc_multi_resource(device_t rcdev, device_t child, int type, int *rid * dedicated software portal interrupt wire. * See registers SWP_INTW0_CFG to SWP_INTW3_CFG for details. */ - if (type == SYS_RES_IRQ && *rid == 0) + if (type == SYS_RES_IRQ && rid == 0) return (NULL); return (resource_list_alloc(rl, rcdev, child, type, rid, @@ -251,7 +251,7 @@ dpaa2_rc_alloc_multi_resource(device_t rcdev, device_t child, int type, int *rid } static struct resource * -dpaa2_rc_alloc_resource(device_t rcdev, device_t child, int type, int *rid, +dpaa2_rc_alloc_resource(device_t rcdev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { if (device_get_parent(child) != rcdev) diff --git a/sys/dev/exca/exca.c b/sys/dev/exca/exca.c index 44cb399cd49e..27a439f2598c 100644 --- a/sys/dev/exca/exca.c +++ b/sys/dev/exca/exca.c @@ -858,7 +858,7 @@ exca_deactivate_resource(struct exca_softc *exca, device_t child, #if 0 static struct resource * -exca_alloc_resource(struct exca_softc *sc, device_t child, int type, int *rid, +exca_alloc_resource(struct exca_softc *sc, device_t child, int type, int rid, u_long start, u_long end, u_long count, uint flags) { struct resource *res = NULL; @@ -895,10 +895,10 @@ exca_alloc_resource(struct exca_softc *sc, device_t child, int type, int *rid, start, end, count, flags & ~RF_ACTIVE); if (res == NULL) return (NULL); - cbb_insert_res(sc, res, type, *rid); + cbb_insert_res(sc, res, type, rid); if (flags & RF_ACTIVE) { - if (bus_activate_resource(child, type, *rid, res) != 0) { - bus_release_resource(child, type, *rid, res); + if (bus_activate_resource(child, type, rid, res) != 0) { + bus_release_resource(child, type, rid, res); return (NULL); } } diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c index 3e77f13104ff..3ad6515ed3b7 100644 --- a/sys/dev/fdt/simplebus.c +++ b/sys/dev/fdt/simplebus.c @@ -48,7 +48,7 @@ */ static int simplebus_probe(device_t dev); static struct resource *simplebus_alloc_resource(device_t, device_t, int, - int *, rman_res_t, rman_res_t, rman_res_t, u_int); + int, rman_res_t, rman_res_t, rman_res_t, u_int); static void simplebus_probe_nomatch(device_t bus, device_t child); static int simplebus_print_child(device_t bus, device_t child); static device_t simplebus_add_child(device_t dev, u_int order, @@ -460,7 +460,7 @@ simplebus_get_property(device_t bus, device_t child, const char *propname, } static struct resource * -simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, +simplebus_alloc_resource(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) { struct simplebus_softc *sc; @@ -478,11 +478,11 @@ simplebus_alloc_resource(device_t bus, device_t child, int type, int *rid, if ((di = device_get_ivars(child)) == NULL) return (NULL); - rle = resource_list_find(&di->rl, type, *rid); + rle = resource_list_find(&di->rl, type, rid); if (rle == NULL) { if (bootverbose) device_printf(bus, "no default resources for " - "rid = %d, type = %d\n", *rid, type); + "rid = %d, type = %d\n", rid, type); return (NULL); } start = rle->start; diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c index 596e468d35f3..848abe025f52 100644 --- a/sys/dev/gpio/gpiobus.c +++ b/sys/dev/gpio/gpiobus.c @@ -864,7 +864,7 @@ gpiobus_get_rman(device_t bus, int type, u_int flags) } static struct resource * -gpiobus_alloc_resource(device_t bus, device_t child, int type, int *rid, +gpiobus_alloc_resource(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) { struct resource_list *rl; @@ -876,7 +876,7 @@ gpiobus_alloc_resource(device_t bus, device_t child, int type, int *rid, rl = BUS_GET_RESOURCE_LIST(bus, child); if (rl == NULL) return (NULL); - rle = resource_list_find(rl, type, *rid); + rle = resource_list_find(rl, type, rid); if (rle == NULL) return (NULL); start = rle->start; diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c b/sys/dev/hyperv/pcib/vmbus_pcib.c index 7b755e5f9c63..c90d1e1fb028 100644 --- a/sys/dev/hyperv/pcib/vmbus_pcib.c +++ b/sys/dev/hyperv/pcib/vmbus_pcib.c @@ -1663,7 +1663,7 @@ vmbus_pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t val) } static struct resource * -vmbus_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, +vmbus_pcib_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { unsigned int bar_no; @@ -1687,7 +1687,7 @@ vmbus_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, if (!hpdev) return (NULL); - bar_no = PCI_RID2BAR(*rid); + bar_no = PCI_RID2BAR(rid); if (bar_no >= MAX_NUM_BARS) return (NULL); diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index 115d4af599ee..15683f21ea6a 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -92,7 +92,7 @@ static int vmbus_read_ivar(device_t, device_t, int, uintptr_t *); static int vmbus_child_pnpinfo(device_t, device_t, struct sbuf *); static struct resource *vmbus_alloc_resource(device_t dev, - device_t child, int type, int *rid, + device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); static int vmbus_alloc_msi(device_t bus, device_t dev, @@ -1062,7 +1062,7 @@ vmbus_sysctl_version(SYSCTL_HANDLER_ARGS) * For the release function, we can use bus_generic_release_resource(). */ static struct resource * -vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid, +vmbus_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { device_t parent = device_get_parent(dev); @@ -1346,7 +1346,7 @@ vmbus_fb_mmio_res(device_t dev) fb_start, fb_count, fb_height * fb_width); hv_fb_res = pcib_host_res_alloc(&sc->vmbus_mmio_res, dev, - SYS_RES_MEMORY, &rid, fb_start, fb_end, fb_count, + SYS_RES_MEMORY, rid, fb_start, fb_end, fb_count, RF_ACTIVE | rman_make_alignment_flags(PAGE_SIZE)); if (hv_fb_res && bootverbose) diff --git a/sys/dev/mvs/mvs_pci.c b/sys/dev/mvs/mvs_pci.c index f0df709db732..322da77968cf 100644 --- a/sys/dev/mvs/mvs_pci.c +++ b/sys/dev/mvs/mvs_pci.c @@ -389,7 +389,7 @@ mvs_intr(void *data) } static struct resource * -mvs_alloc_resource(device_t dev, device_t child, int type, int *rid, +mvs_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { @@ -415,7 +415,7 @@ mvs_alloc_resource(device_t dev, device_t child, int type, int *rid, } break; case SYS_RES_IRQ: - if (*rid == ATA_IRQ_RID) + if (rid == ATA_IRQ_RID) res = ctlr->irq.r_irq; break; } diff --git a/sys/dev/mvs/mvs_soc.c b/sys/dev/mvs/mvs_soc.c index 5bafc07847b4..8dc5ed7a3034 100644 --- a/sys/dev/mvs/mvs_soc.c +++ b/sys/dev/mvs/mvs_soc.c @@ -329,7 +329,7 @@ mvs_intr(void *data) } static struct resource * -mvs_alloc_resource(device_t dev, device_t child, int type, int *rid, +mvs_alloc_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct mvs_controller *ctlr = device_get_softc(dev); @@ -354,7 +354,7 @@ mvs_alloc_resource(device_t dev, device_t child, int type, int *rid, } break; case SYS_RES_IRQ: - if (*rid == ATA_IRQ_RID) + if (rid == ATA_IRQ_RID) res = ctlr->irq.r_irq; break; } diff --git a/sys/dev/ofw/ofw_pcib.c b/sys/dev/ofw/ofw_pcib.c index 0cfddd155e52..268fff0f9074 100644 --- a/sys/dev/ofw/ofw_pcib.c +++ b/sys/dev/ofw/ofw_pcib.c @@ -66,7 +66,7 @@ */ static struct rman *ofw_pcib_get_rman(device_t, int, u_int); static struct resource * ofw_pcib_alloc_resource(device_t, device_t, - int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); + int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int ofw_pcib_release_resource(device_t, device_t, struct resource *); static int ofw_pcib_activate_resource(device_t, device_t, struct resource *); static int ofw_pcib_deactivate_resource(device_t, device_t, struct resource *); @@ -419,7 +419,7 @@ ofw_pcib_nranges(phandle_t node, struct ofw_pci_cell_info *info) } static struct resource * -ofw_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, +ofw_pcib_alloc_resource(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) { struct ofw_pci_softc *sc; diff --git a/sys/dev/ofw/ofwbus.c b/sys/dev/ofw/ofwbus.c index d66befcb7314..d03107e53391 100644 *** 1629 LINES SKIPPED ***
