diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2025-12-09 19:59:21 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2025-12-09 20:00:06 +0000 |
| commit | 575639548cef58590a1d70c29e47aae0e8d44153 (patch) | |
| tree | 8d9c9935a2619b8b25e22ebcf62c2d35cd297a3b | |
| parent | 12165ac8407cef2c0b96035a1a956e3a7fe48cec (diff) | |
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
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 --- a/sys/dev/ofw/ofwbus.c +++ b/sys/dev/ofw/ofwbus.c @@ -130,7 +130,7 @@ ofwbus_attach(device_t dev) } static struct resource * -ofwbus_alloc_resource(device_t bus, device_t child, int type, int *rid, +ofwbus_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 *rv; @@ -142,11 +142,11 @@ ofwbus_alloc_resource(device_t bus, device_t child, int type, int *rid, rle = NULL; if (!passthrough && isdefault) { rle = resource_list_find(BUS_GET_RESOURCE_LIST(bus, child), - type, *rid); + 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/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index b8fb7827dfbf..8cb1f47bccea 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -159,7 +159,7 @@ static int cbb_cardbus_activate_resource(device_t brdev, device_t child, static int cbb_cardbus_deactivate_resource(device_t brdev, device_t child, struct resource *res); static struct resource *cbb_cardbus_alloc_resource(device_t brdev, - device_t child, int type, int *rid, rman_res_t start, + device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); static int cbb_cardbus_release_resource(device_t brdev, device_t child, struct resource *res); @@ -1174,7 +1174,7 @@ cbb_cardbus_deactivate_resource(device_t brdev, device_t child, static struct resource * cbb_cardbus_alloc_resource(device_t brdev, 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 cbb_softc *sc = device_get_softc(brdev); int tmp; @@ -1219,13 +1219,13 @@ cbb_cardbus_alloc_resource(device_t brdev, device_t child, int type, res = BUS_ALLOC_RESOURCE(device_get_parent(brdev), child, type, rid, start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { - printf("cbb alloc res fail type %d rid %x\n", type, *rid); + printf("cbb alloc res fail type %d rid %x\n", type, rid); 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); } @@ -1338,7 +1338,7 @@ cbb_pcic_deactivate_resource(device_t brdev, device_t child, } static struct resource * -cbb_pcic_alloc_resource(device_t brdev, device_t child, int type, int *rid, +cbb_pcic_alloc_resource(device_t brdev, 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 = NULL; @@ -1382,10 +1382,10 @@ cbb_pcic_alloc_resource(device_t brdev, 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); } } @@ -1475,7 +1475,7 @@ cbb_deactivate_resource(device_t brdev, device_t child, struct resource *r) } struct resource * -cbb_alloc_resource(device_t brdev, device_t child, int type, int *rid, +cbb_alloc_resource(device_t brdev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct cbb_softc *sc = device_get_softc(brdev); diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c index a3e4dfa9ccf7..68769b1fb3f4 100644 --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -749,7 +749,7 @@ cbb_pci_filt(void *arg) } static struct resource * -cbb_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, +cbb_pci_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 cbb_softc *sc; diff --git a/sys/dev/pccbb/pccbbvar.h b/sys/dev/pccbb/pccbbvar.h index 95ffc06ef439..7f312aa794e5 100644 --- a/sys/dev/pccbb/pccbbvar.h +++ b/sys/dev/pccbb/pccbbvar.h @@ -110,7 +110,7 @@ extern int cbb_debug; int cbb_activate_resource(device_t brdev, device_t child, struct resource *r); struct resource *cbb_alloc_resource(device_t brdev, 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); void cbb_child_detached(device_t brdev, device_t child); int cbb_child_present(device_t parent, device_t child); diff --git a/sys/dev/pci/hostb_pci.c b/sys/dev/pci/hostb_pci.c index e6c10418a684..f59211a14de9 100644 --- a/sys/dev/pci/hostb_pci.c +++ b/sys/dev/pci/hostb_pci.c @@ -98,7 +98,7 @@ pci_hostb_write_ivar(device_t dev, device_t child, int which, uintptr_t value) } static struct resource * -pci_hostb_alloc_resource(device_t dev, device_t child, int type, int *rid, +pci_hostb_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) { diff --git a/sys/dev/pci/isa_pci.c b/sys/dev/pci/isa_pci.c index f63c63afc384..4d3401bdb5a8 100644 --- a/sys/dev/pci/isa_pci.c +++ b/sys/dev/pci/isa_pci.c @@ -52,7 +52,7 @@ static int isab_pci_probe(device_t dev); static int isab_pci_attach(device_t dev); static struct resource * isab_pci_alloc_resource(device_t dev, - device_t child, int type, int *rid, rman_res_t start, rman_res_t end, + device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); static int isab_pci_release_resource(device_t dev, device_t child, struct resource *r); @@ -165,7 +165,7 @@ isab_pci_attach(device_t dev) } static struct resource * -isab_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, +isab_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 isab_pci_softc *sc; @@ -182,7 +182,7 @@ isab_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, * For BARs, we cache the resource so that we only allocate it * from the PCI bus once. */ - bar = PCI_RID2BAR(*rid); + bar = PCI_RID2BAR(rid); if (bar < 0 || bar > PCIR_MAX_BAR_0) return (NULL); sc = device_get_softc(dev); diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index ac6c9259b135..6d929b2f236c 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -3914,7 +3914,7 @@ clear: } static struct resource * -pci_alloc_secbus(device_t dev, device_t child, int *rid, rman_res_t start, +pci_alloc_secbus(device_t dev, device_t child, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct pci_devinfo *dinfo; @@ -3939,16 +3939,16 @@ pci_alloc_secbus(device_t dev, device_t child, int *rid, rman_res_t start, return (NULL); } - if (*rid != 0) + if (rid != 0) return (NULL); - 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, + 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, start, end, count, flags & ~RF_ACTIVE); if (res == NULL) { - resource_list_delete(rl, PCI_RES_BUS, *rid); + resource_list_delete(rl, PCI_RES_BUS, rid); device_printf(child, "allocating %ju bus%s failed\n", count, count == 1 ? "" : "es"); return (NULL); @@ -5620,7 +5620,7 @@ out: } struct resource * -pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, +pci_alloc_multi_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_long num, u_int flags) { @@ -5645,7 +5645,7 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, * Can't alloc legacy interrupt once MSI messages have * been allocated. */ - if (*rid == 0 && (cfg->msi.msi_alloc > 0 || + if (rid == 0 && (cfg->msi.msi_alloc > 0 || cfg->msix.msix_alloc > 0)) return (NULL); @@ -5654,7 +5654,7 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, * routed and is deserving of an interrupt, try to * assign it one. */ - if (*rid == 0 && !PCI_INTERRUPT_VALID(cfg->intline) && + if (rid == 0 && !PCI_INTERRUPT_VALID(cfg->intline) && (cfg->intpin != 0)) pci_assign_interrupt(dev, child, 0); break; @@ -5666,7 +5666,7 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, * tree. */ if (cfg->hdrtype == PCIM_HDRTYPE_BRIDGE) { - switch (*rid) { + switch (rid) { case PCIR_IOBASEL_1: case PCIR_MEMBASE_1: case PCIR_PMBASEL_1: @@ -5679,9 +5679,9 @@ 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); + 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); @@ -5692,7 +5692,7 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid, } struct resource * -pci_alloc_resource(device_t dev, device_t child, int type, int *rid, +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) { #ifdef PCI_IOV diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index 49b131cd2299..05cf47687b1d 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -503,7 +503,7 @@ generic_pcie_translate_resource(device_t dev, int type, rman_res_t start, struct resource * pci_host_generic_core_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_core_softc *sc; struct resource *res; @@ -528,7 +528,7 @@ pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type, if (res == NULL) { device_printf(dev, "%s FAIL: type=%d, rid=%d, " "start=%016jx, end=%016jx, count=%016jx, flags=%x\n", - __func__, type, *rid, start, end, count, flags); + __func__, type, rid, start, end, count, flags); } return (res); } diff --git a/sys/dev/pci/pci_host_generic.h b/sys/dev/pci/pci_host_generic.h index 6579cd0918c4..aae60d8a1650 100644 --- a/sys/dev/pci/pci_host_generic.h +++ b/sys/dev/pci/pci_host_generic.h @@ -95,7 +95,7 @@ DECLARE_CLASS(generic_pcie_core_driver); int pci_host_generic_core_attach(device_t); int pci_host_generic_core_detach(device_t); struct resource *pci_host_generic_core_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); int pci_host_generic_core_release_resource(device_t, device_t, struct resource *); int generic_pcie_read_ivar(device_t, device_t, int, uintptr_t *); diff --git a/sys/dev/pci/pci_iov.c b/sys/dev/pci/pci_iov.c index 0efcfeac9eff..e0e47e11d401 100644 --- a/sys/dev/pci/pci_iov.c +++ b/sys/dev/pci/pci_iov.c @@ -350,7 +350,7 @@ pci_iov_alloc_bar(struct pci_devinfo *dinfo, int bar, pci_addr_t bar_shift) rid = iov->iov_pos + PCIR_SRIOV_BAR(bar); bar_size = 1 << bar_shift; - res = pci_alloc_multi_resource(bus, dev, SYS_RES_MEMORY, &rid, 0, + res = pci_alloc_multi_resource(bus, dev, SYS_RES_MEMORY, rid, 0, ~0, 1, iov->iov_num_vfs, RF_ACTIVE); if (res == NULL) @@ -1016,7 +1016,7 @@ pci_iov_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, } struct resource * -pci_vf_alloc_mem_resource(device_t dev, device_t child, int *rid, +pci_vf_alloc_mem_resource(device_t dev, device_t child, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct pci_devinfo *dinfo; @@ -1031,7 +1031,7 @@ pci_vf_alloc_mem_resource(device_t dev, device_t child, int *rid, dinfo = device_get_ivars(child); iov = dinfo->cfg.iov; - map = pci_find_bar(child, *rid); + map = pci_find_bar(child, rid); if (map == NULL) return (NULL); @@ -1055,21 +1055,21 @@ pci_vf_alloc_mem_resource(device_t dev, device_t child, int *rid, if (res == NULL) return (NULL); - rle = resource_list_add(&dinfo->resources, SYS_RES_MEMORY, *rid, + rle = resource_list_add(&dinfo->resources, SYS_RES_MEMORY, rid, bar_start, bar_end, 1); if (rle == NULL) { rman_release_resource(res); return (NULL); } - rman_set_rid(res, *rid); + rman_set_rid(res, rid); rman_set_type(res, SYS_RES_MEMORY); if (flags & RF_ACTIVE) { - error = bus_activate_resource(child, SYS_RES_MEMORY, *rid, res); + error = bus_activate_resource(child, SYS_RES_MEMORY, rid, res); if (error != 0) { resource_list_delete(&dinfo->resources, SYS_RES_MEMORY, - *rid); + rid); rman_release_resource(res); return (NULL); } diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 40ed5db4480e..788af7339418 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -695,7 +695,7 @@ pcib_free_secbus(device_t dev, struct pcib_secbus *bus) } static struct resource * -pcib_suballoc_bus(struct pcib_secbus *bus, device_t child, int *rid, +pcib_suballoc_bus(struct pcib_secbus *bus, device_t child, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; @@ -708,9 +708,9 @@ pcib_suballoc_bus(struct pcib_secbus *bus, device_t child, int *rid, if (bootverbose) device_printf(bus->dev, "allocated bus range (%ju-%ju) for rid %d of %s\n", - rman_get_start(res), rman_get_end(res), *rid, + rman_get_start(res), rman_get_end(res), rid, pcib_child_name(child)); - rman_set_rid(res, *rid); + rman_set_rid(res, rid); rman_set_type(res, PCI_RES_BUS); return (res); } @@ -745,7 +745,7 @@ pcib_grow_subbus(struct pcib_secbus *bus, rman_res_t new_end) } struct resource * -pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, int *rid, +pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; @@ -1661,7 +1661,7 @@ pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value) */ static struct resource * pcib_suballoc_resource(struct pcib_softc *sc, struct pcib_window *w, - device_t child, int type, int *rid, rman_res_t start, rman_res_t end, + 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; @@ -1677,13 +1677,13 @@ pcib_suballoc_resource(struct pcib_softc *sc, struct pcib_window *w, if (bootverbose) device_printf(sc->dev, "allocated %s range (%#jx-%#jx) for rid %x of %s\n", - w->name, rman_get_start(res), rman_get_end(res), *rid, + w->name, rman_get_start(res), rman_get_end(res), rid, pcib_child_name(child)); - rman_set_rid(res, *rid); + rman_set_rid(res, rid); rman_set_type(res, type); if (flags & RF_ACTIVE) { - if (bus_activate_resource(child, type, *rid, res) != 0) { + if (bus_activate_resource(child, type, rid, res) != 0) { rman_release_resource(res); return (NULL); } @@ -2032,7 +2032,7 @@ updatewin: * is set up to, or capable of handling them. */ static struct resource * -pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, +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 pcib_softc *sc; diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h index 3577c04d7043..262ce30ad023 100644 --- a/sys/dev/pci/pci_private.h +++ b/sys/dev/pci/pci_private.h @@ -151,11 +151,11 @@ struct resource *pci_reserve_map(device_t dev, device_t child, int type, rman_res_t count, u_int num, u_int flags); struct resource *pci_alloc_multi_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_long num, u_int flags); struct resource *pci_vf_alloc_mem_resource(device_t dev, device_t child, - 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 flags); int pci_vf_release_mem_resource(device_t dev, device_t child, struct resource *r); diff --git a/sys/dev/pci/pci_subr.c b/sys/dev/pci/pci_subr.c index 09633e56a24a..d705b7457eb9 100644 --- a/sys/dev/pci/pci_subr.c +++ b/sys/dev/pci/pci_subr.c @@ -200,7 +200,7 @@ pcib_host_res_decodes(struct pcib_host_resources *hr, int type, rman_res_t start struct resource * pcib_host_res_alloc(struct pcib_host_resources *hr, device_t dev, 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 resource_list_entry *rle; struct resource *r; @@ -241,7 +241,7 @@ restart: device_printf(hr->hr_pcib, "allocated type %d (%#jx-%#jx) for rid %x of %s\n", type, rman_get_start(r), rman_get_end(r), - *rid, pcib_child_name(dev)); + rid, pcib_child_name(dev)); return (r); } } @@ -327,7 +327,7 @@ pci_find_domain(int domain) } struct resource * -pci_domain_alloc_bus(int domain, device_t dev, int *rid, rman_res_t start, +pci_domain_alloc_bus(int domain, device_t dev, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct pci_domain *d; @@ -341,7 +341,7 @@ pci_domain_alloc_bus(int domain, device_t dev, int *rid, rman_res_t start, if (res == NULL) return (NULL); - rman_set_rid(res, *rid); + rman_set_rid(res, rid); rman_set_type(res, PCI_RES_BUS); return (res); } diff --git a/sys/dev/pci/pcib_private.h b/sys/dev/pci/pcib_private.h index 4c1f6e038ae1..24def7a4f032 100644 --- a/sys/dev/pci/pcib_private.h +++ b/sys/dev/pci/pcib_private.h @@ -52,7 +52,7 @@ int pcib_host_res_free(device_t pcib, int pcib_host_res_decodes(struct pcib_host_resources *hr, int type, rman_res_t start, rman_res_t end, u_int flags); struct resource *pcib_host_res_alloc(struct pcib_host_resources *hr, - device_t dev, int type, int *rid, rman_res_t start, + device_t dev, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int pcib_host_res_adjust(struct pcib_host_resources *hr, device_t dev, struct resource *r, rman_res_t start, @@ -138,7 +138,7 @@ typedef uint32_t pci_read_config_fn(int d, int b, int s, int f, int reg, int host_pcib_get_busno(pci_read_config_fn read_config, int bus, int slot, int func, uint8_t *busnum); -struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid, +struct resource *pci_domain_alloc_bus(int domain, device_t dev, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int pci_domain_adjust_bus(int domain, device_t dev, struct resource *r, rman_res_t start, rman_res_t end); @@ -149,7 +149,7 @@ int pci_domain_activate_bus(int domain, device_t dev, int pci_domain_deactivate_bus(int domain, device_t dev, struct resource *r); struct resource *pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, - int *rid, rman_res_t start, rman_res_t end, rman_res_t count, + int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); void pcib_free_secbus(device_t dev, struct pcib_secbus *bus); void pcib_setup_secbus(device_t dev, struct pcib_secbus *bus, diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index 09166c0cbea6..23340696f0f0 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -67,7 +67,7 @@ SYSCTL_DECL(_hw_pci); static struct vga_resource *lookup_res(struct vga_pci_softc *sc, int rid); static struct resource *vga_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, + int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); static int vga_pci_release_resource(device_t dev, device_t child, struct resource *r); @@ -212,7 +212,7 @@ vga_pci_map_bios(device_t dev, size_t *size) } if (rid == 0) return (NULL); - res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, &rid, 0, + res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, rid, 0, ~0, 1, RF_ACTIVE); if (res == NULL) { @@ -246,7 +246,7 @@ vga_pci_map_bios(device_t dev, size_t *size) /* * re-allocate */ - res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, &rid, 0, + res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, rid, 0, ~0, 1, RF_ACTIVE); if (res == NULL) { device_printf(dev, "vga_pci_alloc_resource failed\n"); @@ -424,7 +424,7 @@ lookup_res(struct vga_pci_softc *sc, int rid) } static struct resource * -vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, +vga_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 vga_resource *vr; @@ -436,7 +436,7 @@ vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, * For BARs, we cache the resource so that we only allocate it * from the PCI bus once. */ - vr = lookup_res(device_get_softc(dev), *rid); + vr = lookup_res(device_get_softc(dev), rid); if (vr == NULL) return (NULL); if (vr->vr_res == NULL) diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c index de75f4747709..b4f52ac7156e 100644 --- a/sys/dev/ppc/ppc.c +++ b/sys/dev/ppc/ppc.c @@ -1964,14 +1964,14 @@ ppc_write_ivar(device_t bus, device_t dev, int index, uintptr_t val) * interrupt handlers. */ struct resource * -ppc_alloc_resource(device_t bus, device_t child, int type, int *rid, +ppc_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 ppc_data *ppc = DEVTOSOFTC(bus); switch (type) { case SYS_RES_IRQ: - if (*rid == 0) + if (rid == 0) return (ppc->res_irq); break; } diff --git a/sys/dev/ppc/ppcvar.h b/sys/dev/ppc/ppcvar.h index 3697c8c35eef..c0a2bf86e592 100644 --- a/sys/dev/ppc/ppcvar.h +++ b/sys/dev/ppc/ppcvar.h @@ -41,7 +41,7 @@ u_char ppc_io(device_t, int, u_char *, int, u_char); int ppc_exec_microseq(device_t, struct ppb_microseq **); struct resource *ppc_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 ppc_release_resource(device_t bus, device_t child, struct resource *r); int ppc_reset_epp(device_t); int ppc_ecp_sync(device_t); diff --git a/sys/dev/puc/puc.c b/sys/dev/puc/puc.c index d55fdf63e70b..fe121d9e16e4 100644 --- a/sys/dev/puc/puc.c +++ b/sys/dev/puc/puc.c @@ -469,7 +469,7 @@ puc_bfe_probe(device_t dev, const struct puc_cfg *cfg) } struct resource * -puc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, +puc_bus_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 puc_port *port; @@ -487,7 +487,7 @@ puc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, port = device_get_ivars(child); KASSERT(port != NULL, ("%s %d", __func__, __LINE__)); - if (rid == NULL || *rid != 0) + if (rid != 0) return (NULL); /* We only support default allocations. */ diff --git a/sys/dev/puc/puc_bfe.h b/sys/dev/puc/puc_bfe.h index 43fff4d79930..32489bee6aa2 100644 --- a/sys/dev/puc/puc_bfe.h +++ b/sys/dev/puc/puc_bfe.h @@ -84,7 +84,7 @@ int puc_bfe_probe(device_t, const struct puc_cfg *); int puc_bus_child_location(device_t, device_t, struct sbuf *sb); int puc_bus_child_pnpinfo(device_t, device_t, struct sbuf *sb); -struct resource *puc_bus_alloc_resource(device_t, device_t, int, int *, +struct resource *puc_bus_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); int puc_bus_get_resource(device_t, device_t, int, int, rman_res_t *, rman_res_t *); int puc_bus_print_child(device_t, device_t); diff --git a/sys/dev/quicc/quicc_bfe.h b/sys/dev/quicc/quicc_bfe.h index e81e52d891aa..1a573ec9740e 100644 --- a/sys/dev/quicc/quicc_bfe.h +++ b/sys/dev/quicc/quicc_bfe.h @@ -59,7 +59,7 @@ int quicc_bfe_attach(device_t); int quicc_bfe_detach(device_t); int quicc_bfe_probe(device_t, u_int); -struct resource *quicc_bus_alloc_resource(device_t, device_t, int, int *, +struct resource *quicc_bus_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); int quicc_bus_get_resource(device_t, device_t, int, int, rman_res_t *, rman_res_t *); diff --git a/sys/dev/quicc/quicc_core.c b/sys/dev/quicc/quicc_core.c index 48c6a6be65f9..f9f1ab495768 100644 --- a/sys/dev/quicc/quicc_core.c +++ b/sys/dev/quicc/quicc_core.c @@ -251,7 +251,7 @@ quicc_bfe_probe(device_t dev, u_int clock) } struct resource * -quicc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, +quicc_bus_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 quicc_device *qd; @@ -265,7 +265,7 @@ quicc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, return (NULL); qd = device_get_ivars(child); - rle = resource_list_find(&qd->qd_rlist, type, *rid); + rle = resource_list_find(&qd->qd_rlist, type, rid); if (rle == NULL) return (NULL); diff --git a/sys/dev/scc/scc_bfe.h b/sys/dev/scc/scc_bfe.h index b743d0655cab..42956db82ab9 100644 --- a/sys/dev/scc/scc_bfe.h +++ b/sys/dev/scc/scc_bfe.h @@ -141,7 +141,7 @@ int scc_bfe_attach(device_t dev, u_int ipc); int scc_bfe_detach(device_t dev); int scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid); -struct resource *scc_bus_alloc_resource(device_t, device_t, int, int *, +struct resource *scc_bus_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); int scc_bus_get_resource(device_t, device_t, int, int, rman_res_t *, rman_res_t *); int scc_bus_read_ivar(device_t, device_t, int, uintptr_t *); diff --git a/sys/dev/scc/scc_core.c b/sys/dev/scc/scc_core.c index 48331ee5f42a..85821cbaf464 100644 --- a/sys/dev/scc/scc_core.c +++ b/sys/dev/scc/scc_core.c @@ -406,7 +406,7 @@ scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid) } struct resource * -scc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, +scc_bus_alloc_resource(device_t dev, device_t child, int type, int rid __unused, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource_list_entry *rle; @@ -425,7 +425,6 @@ scc_bus_alloc_resource(device_t dev, device_t child, int type, int *rid, rle = resource_list_find(&ch->ch_rlist, type, 0); if (rle == NULL) return (NULL); - *rid = 0; return (rle->res); } diff --git a/sys/dev/siis/siis.c b/sys/dev/siis/siis.c index eb6848eddee2..202fc24143b5 100644 --- a/sys/dev/siis/siis.c +++ b/sys/dev/siis/siis.c @@ -314,7 +314,7 @@ siis_intr(void *data) } static struct resource * -siis_alloc_resource(device_t dev, device_t child, int type, int *rid, +siis_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 siis_controller *ctlr = device_get_softc(dev); @@ -339,7 +339,7 @@ siis_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/sound/pci/csa.c b/sys/dev/sound/pci/csa.c index 4bd8ff029f43..836a6f4599e5 100644 --- a/sys/dev/sound/pci/csa.c +++ b/sys/dev/sound/pci/csa.c @@ -79,7 +79,7 @@ typedef struct csa_softc *sc_p; static int csa_probe(device_t dev); static int csa_attach(device_t dev); -static struct resource *csa_alloc_resource(device_t bus, device_t child, int type, int *rid, +static struct resource *csa_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); static int csa_release_resource(device_t bus, device_t child, struct resource *r); @@ -353,7 +353,7 @@ csa_resume(device_t dev) } static struct resource * -csa_alloc_resource(device_t bus, device_t child, int type, int *rid, +csa_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) { sc_p scp; @@ -364,12 +364,12 @@ csa_alloc_resource(device_t bus, device_t child, int type, int *rid, resp = &scp->res; switch (type) { case SYS_RES_IRQ: - if (*rid != 0) + if (rid != 0) return (NULL); res = resp->irq; break; case SYS_RES_MEMORY: - switch (*rid) { + switch (rid) { case PCIR_BAR(0): res = resp->io; break; diff --git a/sys/dev/sound/pci/fm801.c b/sys/dev/sound/pci/fm801.c index 39d12f8505d1..3c7b8d0f7540 100644 --- a/sys/dev/sound/pci/fm801.c +++ b/sys/dev/sound/pci/fm801.c @@ -708,7 +708,7 @@ fm801_pci_probe( device_t dev ) } static struct resource * -fm801_alloc_resource(device_t bus, device_t child, int type, int *rid, +fm801_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) { @@ -716,7 +716,7 @@ fm801_alloc_resource(device_t bus, device_t child, int type, int *rid, fm801 = pcm_getdevinfo(bus); - if (type == SYS_RES_IOPORT && *rid == PCIR_BAR(0)) + if (type == SYS_RES_IOPORT && rid == PCIR_BAR(0)) return (fm801->reg); return (NULL); diff --git a/sys/dev/spibus/acpi_spibus.c b/sys/dev/spibus/acpi_spibus.c index a3280ffa567f..5a7a11f5fe08 100644 --- a/sys/dev/spibus/acpi_spibus.c +++ b/sys/dev/spibus/acpi_spibus.c @@ -416,7 +416,7 @@ acpi_spibus_resume(device_t dev) #ifndef INTRNG /* Mostly copy of acpi_alloc_resource() */ static struct resource * -acpi_spibus_alloc_resource(device_t dev, device_t child, int type, int *rid, +acpi_spibus_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) { ACPI_RESOURCE ares; @@ -434,7 +434,7 @@ acpi_spibus_alloc_resource(device_t dev, device_t child, int type, int *rid, res = resource_list_alloc(rl, dev, child, type, rid, start, end, count, flags); if (res != NULL && type == SYS_RES_IRQ && - ACPI_SUCCESS(acpi_lookup_irq_resource(child, *rid, res, &ares))) + ACPI_SUCCESS(acpi_lookup_irq_resource(child, rid, res, &ares))) acpi_config_intr(child, &ares); return (res); diff --git a/sys/dev/vmd/vmd.c b/sys/dev/vmd/vmd.c index 0595a6c5be16..b7165583c275 100644 --- a/sys/dev/vmd/vmd.c +++ b/sys/dev/vmd/vmd.c @@ -432,14 +432,14 @@ vmd_get_rman(device_t dev, int type, u_int flags) } static struct resource * -vmd_alloc_resource(device_t dev, device_t child, int type, int *rid, +vmd_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 *res; if (type == SYS_RES_IRQ) { /* VMD hardware does not support legacy interrupts. */ - if (*rid == 0) + if (rid == 0) return (NULL); return (bus_generic_alloc_resource(dev, child, type, rid, start, end, count, flags | RF_SHAREABLE)); @@ -451,13 +451,13 @@ vmd_alloc_resource(device_t dev, device_t child, int type, int *rid, case SYS_RES_MEMORY: device_printf(dev, "allocated memory range (%#jx-%#jx) for rid %d of %s\n", - rman_get_start(res), rman_get_end(res), *rid, + rman_get_start(res), rman_get_end(res), rid, pcib_child_name(child)); break; case PCI_RES_BUS: device_printf(dev, "allocated bus range (%ju-%ju) for rid %d of %s\n", - rman_get_start(res), rman_get_end(res), *rid, + rman_get_start(res), rman_get_end(res), rid, pcib_child_name(child)); break; } diff --git a/sys/dev/vnic/mrml_bridge.c b/sys/dev/vnic/mrml_bridge.c index b77ef03ad072..d4b0e90b5cf1 100644 --- a/sys/dev/vnic/mrml_bridge.c +++ b/sys/dev/vnic/mrml_bridge.c @@ -49,7 +49,7 @@ static MALLOC_DEFINE(M_MRMLB, "MRML bridge", "Cavium MRML bridge"); static device_probe_t mrmlb_fdt_probe; static device_attach_t mrmlb_fdt_attach; -static struct resource * mrmlb_ofw_bus_alloc_res(device_t, device_t, int, int *, +static struct resource * mrmlb_ofw_bus_alloc_res(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static const struct ofw_bus_devinfo * mrmlb_ofw_get_devinfo(device_t, device_t); @@ -128,7 +128,7 @@ mrmlb_ofw_get_devinfo(device_t bus __unused, device_t child) } static struct resource * -mrmlb_ofw_bus_alloc_res(device_t bus, device_t child, int type, int *rid, +mrmlb_ofw_bus_alloc_res(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; @@ -143,7 +143,7 @@ mrmlb_ofw_bus_alloc_res(device_t bus, device_t child, int type, int *rid, 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/isa/isa_common.c b/sys/isa/isa_common.c index 41a63a3c676c..1641a5b0fb03 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -480,7 +480,7 @@ isa_claim_resources(device_t dev, device_t child) STAILQ_FOREACH(rle, rl, link) { if (!rle->res) { rid = rle->rid; - resource_list_alloc(rl, dev, child, rle->type, &rid, + resource_list_alloc(rl, dev, child, rle->type, rid, 0, ~0, 1, 0); } } diff --git a/sys/isa/isa_common.h b/sys/isa/isa_common.h index 767b132965dc..61d4a1db18ba 100644 --- a/sys/isa/isa_common.h +++ b/sys/isa/isa_common.h @@ -69,7 +69,7 @@ struct isa_device { */ extern void isa_init(device_t dev); extern struct resource *isa_alloc_resource(device_t bus, 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); extern int isa_release_resource(device_t bus, device_t child, struct resource *r); diff --git a/sys/kern/bus_if.m b/sys/kern/bus_if.m index 14659958e4b9..b9c916accd67 100644 --- a/sys/kern/bus_if.m +++ b/sys/kern/bus_if.m @@ -43,7 +43,7 @@ INTERFACE bus; CODE { static struct resource * null_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) { return (0); @@ -273,16 +273,15 @@ METHOD int rescan { * * This method is called by child devices of a bus to allocate resources. * The types are defined in <machine/resource.h>; the meaning of the - * resource-ID field varies from bus to bus (but @p *rid == 0 is always - * valid if the resource type is). If a resource was allocated and the - * caller did not use the RF_ACTIVE to specify that it should be + * resource-ID field varies from bus to bus. If a resource was allocated + * and the caller did not use the RF_ACTIVE to specify that it should be * activated immediately, the caller is responsible for calling * BUS_ACTIVATE_RESOURCE() when it actually uses the resource. * * @param _dev the parent device of @p _child * @param _child the device which is requesting an allocation * @param _type the type of resource to allocate - * @param _rid a pointer to the resource identifier + * @param _rid the resource identifier * @param _start hint at the start of the resource range - pass * @c 0 for any start address * @param _end hint at the end of the resource range - pass @@ -300,7 +299,7 @@ METHOD struct resource * alloc_resource { device_t _dev; device_t _child; int _type; - int *_rid; + int _rid; rman_res_t _start; rman_res_t _end; rman_res_t _count; diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 755d7d41899f..86538ac8b9d8 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -3109,7 +3109,7 @@ 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); @@ -3153,7 +3153,7 @@ resource_list_reserve(struct resource_list *rl, device_t bus, device_t child, */ struct resource * resource_list_alloc(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); @@ -3164,7 +3164,7 @@ resource_list_alloc(struct resource_list *rl, device_t bus, device_t child, type, rid, start, end, count, flags)); } - rle = resource_list_find(rl, type, *rid); + rle = resource_list_find(rl, type, rid); if (!rle) return (NULL); /* no resource of that type/rid */ @@ -3174,14 +3174,14 @@ resource_list_alloc(struct resource_list *rl, device_t bus, device_t child, if (rle->flags & RLE_ALLOCATED) return (NULL); if ((flags & RF_ACTIVE) && - bus_activate_resource(child, type, *rid, + bus_activate_resource(child, type, rid, rle->res) != 0) return (NULL); rle->flags |= RLE_ALLOCATED; return (rle->res); } device_printf(bus, - "resource entry %#x type %d for child %s is busy\n", *rid, + "resource entry %#x type %d for child %s is busy\n", rid, type, device_get_nameunit(child)); return (NULL); } @@ -4033,7 +4033,7 @@ bus_generic_translate_resource(device_t dev, int type, rman_res_t start, * BUS_ALLOC_RESOURCE() method of the parent of @p dev. */ struct resource * -bus_generic_alloc_resource(device_t dev, device_t child, int type, int *rid, +bus_generic_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) { /* Propagate up the bus hierarchy until someone handles it. */ @@ -4324,7 +4324,7 @@ bus_generic_rl_release_resource(device_t dev, device_t child, */ struct resource * bus_generic_rl_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 resource_list * rl = NULL; @@ -4349,7 +4349,7 @@ bus_generic_rl_alloc_resource(device_t dev, device_t child, int type, */ struct resource * bus_generic_rman_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 resource *r; struct rman *rm; @@ -4362,11 +4362,11 @@ bus_generic_rman_alloc_resource(device_t dev, device_t child, int type, child); if (r == NULL) return (NULL); - rman_set_rid(r, *rid); + rman_set_rid(r, rid); rman_set_type(r, type); if (flags & RF_ACTIVE) { - if (bus_activate_resource(child, type, *rid, r) != 0) { + if (bus_activate_resource(child, type, rid, r) != 0) { rman_release_resource(r); return (NULL); } @@ -4651,7 +4651,7 @@ bus_release_resources(device_t dev, const struct resource_spec *rs, * parent of @p dev. */ struct resource * -(bus_alloc_resource)(device_t dev, int type, int *rid, rman_res_t start, +(bus_alloc_resource)(device_t dev, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { struct resource *res; diff --git a/sys/powerpc/mpc85xx/isa.c b/sys/powerpc/mpc85xx/isa.c index d730ecb6f3e9..2ae6d4ef00af 100644 --- a/sys/powerpc/mpc85xx/isa.c +++ b/sys/powerpc/mpc85xx/isa.c @@ -44,7 +44,7 @@ isa_init(device_t dev) } struct resource * -isa_alloc_resource(device_t bus, device_t child, int type, int *rid, +isa_alloc_resource(device_t bus, device_t child, int type, int rid, u_long start, u_long end, u_long count, u_int flags) { struct isa_device* idev = DEVTOISA(child); @@ -55,17 +55,17 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid, passthrough = (device_get_parent(child) != bus) ? 1 : 0; if (!passthrough && !isdefault && - resource_list_find(rl, type, *rid) == NULL) { + resource_list_find(rl, type, rid) == NULL) { switch (type) { case SYS_RES_IOPORT: rids = ISA_PNP_NPORT; break; case SYS_RES_IRQ: rids = ISA_PNP_NIRQ; break; case SYS_RES_MEMORY: rids = ISA_PNP_NMEM; break; default: rids = 0; break; } - if (*rid < 0 || *rid >= rids) + if (rid < 0 || rid >= rids) return (NULL); - resource_list_add(rl, type, *rid, start, end, count); + resource_list_add(rl, type, rid, start, end, count); } return (resource_list_alloc(rl, bus, child, type, rid, start, end, diff --git a/sys/powerpc/mpc85xx/lbc.c b/sys/powerpc/mpc85xx/lbc.c index 1399ecf206b9..49ba2dfa192b 100644 --- a/sys/powerpc/mpc85xx/lbc.c +++ b/sys/powerpc/mpc85xx/lbc.c @@ -78,7 +78,7 @@ static int lbc_activate_resource(device_t bus, device_t child, static int lbc_deactivate_resource(device_t bus, device_t child, struct resource *r); static struct rman *lbc_get_rman(device_t, int, u_int); -static struct resource *lbc_alloc_resource(device_t, device_t, int, int *, +static struct resource *lbc_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int lbc_adjust_resource(device_t, device_t, struct resource *, rman_res_t, rman_res_t); @@ -697,7 +697,7 @@ lbc_get_rman(device_t bus, int type, u_int flags) } static struct resource * -lbc_alloc_resource(device_t bus, device_t child, int type, int *rid, +lbc_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 lbc_devinfo *di; @@ -721,16 +721,12 @@ lbc_alloc_resource(device_t bus, device_t child, int type, int *rid, if (type == SYS_RES_IOPORT) type = SYS_RES_MEMORY; - /* - * XXX: We are supposed to return a value to the user, so this - * doesn't seem right. - */ - rid = &di->di_bank; + rid = di->di_bank; - rle = resource_list_find(&di->di_res, type, *rid); + rle = resource_list_find(&di->di_res, type, rid); if (rle == NULL) { 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/powerpc/powermac/macgpio.c b/sys/powerpc/powermac/macgpio.c index b17ba3f64128..8b4b153087f5 100644 --- a/sys/powerpc/powermac/macgpio.c +++ b/sys/powerpc/powermac/macgpio.c @@ -69,7 +69,7 @@ static int macgpio_probe(device_t); static int macgpio_attach(device_t); static int macgpio_print_child(device_t dev, device_t child); static void macgpio_probe_nomatch(device_t, device_t); -static struct resource *macgpio_alloc_resource(device_t, device_t, int, int *, +static struct resource *macgpio_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int macgpio_activate_resource(device_t, device_t, struct resource *); @@ -260,7 +260,7 @@ macgpio_probe_nomatch(device_t dev, device_t child) } static struct resource * -macgpio_alloc_resource(device_t bus, device_t child, int type, int *rid, +macgpio_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) { diff --git a/sys/powerpc/powermac/macio.c b/sys/powerpc/powermac/macio.c index fbd99a1ac87d..e95ca1a34292 100644 --- a/sys/powerpc/powermac/macio.c +++ b/sys/powerpc/powermac/macio.c @@ -81,7 +81,7 @@ static int macio_attach(device_t); static int macio_print_child(device_t dev, device_t child); static void macio_probe_nomatch(device_t, device_t); static struct rman *macio_get_rman(device_t, int, u_int); -static struct resource *macio_alloc_resource(device_t, device_t, int, int *, +static struct resource *macio_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int macio_adjust_resource(device_t, device_t, struct resource *, @@ -521,7 +521,7 @@ macio_get_rman(device_t bus, int type, u_int flags) } static struct resource * -macio_alloc_resource(device_t bus, device_t child, int type, int *rid, +macio_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) { @@ -535,10 +535,10 @@ macio_alloc_resource(device_t bus, device_t child, int type, int *rid, case SYS_RES_MEMORY: case SYS_RES_IOPORT: rle = resource_list_find(&dinfo->mdi_resources, SYS_RES_MEMORY, - *rid); + rid); if (rle == NULL) { device_printf(bus, "no rle for %s memory %d\n", - device_get_nameunit(child), *rid); + device_get_nameunit(child), rid); return (NULL); } @@ -568,7 +568,7 @@ macio_alloc_resource(device_t bus, device_t child, int type, int *rid, type, rid, start, end, count, flags); rle = resource_list_find(&dinfo->mdi_resources, SYS_RES_IRQ, - *rid); + rid); if (rle == NULL) { if (dinfo->mdi_ninterrupts >= 6) { device_printf(bus, diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c index 8f3d567202c7..f88d90dd8844 100644 --- a/sys/powerpc/powermac/uninorth.c +++ b/sys/powerpc/powermac/uninorth.c @@ -72,7 +72,7 @@ static int unin_chip_attach(device_t); static int unin_chip_print_child(device_t dev, device_t child); static void unin_chip_probe_nomatch(device_t, device_t); static struct rman *unin_chip_get_rman(device_t, int, u_int); -static struct resource *unin_chip_alloc_resource(device_t, device_t, int, int *, +static struct resource *unin_chip_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int unin_chip_adjust_resource(device_t, device_t, @@ -478,7 +478,7 @@ unin_chip_get_rman(device_t bus, int type, u_int flags) } static struct resource * -unin_chip_alloc_resource(device_t bus, device_t child, int type, int *rid, +unin_chip_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) { @@ -492,10 +492,10 @@ unin_chip_alloc_resource(device_t bus, device_t child, int type, int *rid, case SYS_RES_MEMORY: case SYS_RES_IOPORT: rle = resource_list_find(&dinfo->udi_resources, SYS_RES_MEMORY, - *rid); + rid); if (rle == NULL) { device_printf(bus, "no rle for %s memory %d\n", - device_get_nameunit(child), *rid); + device_get_nameunit(child), rid); return (NULL); } @@ -527,7 +527,7 @@ unin_chip_alloc_resource(device_t bus, device_t child, int type, int *rid, flags); rle = resource_list_find(&dinfo->udi_resources, SYS_RES_IRQ, - *rid); + rid); if (rle == NULL) { if (dinfo->udi_ninterrupts >= 6) { device_printf(bus, diff --git a/sys/powerpc/ps3/ps3bus.c b/sys/powerpc/ps3/ps3bus.c index dc4026cb9a5e..086733a809df 100644 --- a/sys/powerpc/ps3/ps3bus.c +++ b/sys/powerpc/ps3/ps3bus.c @@ -59,7 +59,7 @@ static int ps3bus_read_ivar(device_t bus, device_t child, int which, uintptr_t *result); static struct rman *ps3bus_get_rman(device_t bus, int type, u_int flags); static struct resource *ps3bus_alloc_resource(device_t bus, 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 ps3bus_map_resource(device_t bus, device_t child, struct resource *r, struct resource_map_request *argsp, @@ -548,7 +548,7 @@ ps3bus_get_rman(device_t bus, int type, u_int flags) } static struct resource * -ps3bus_alloc_resource(device_t bus, device_t child, int type, int *rid, +ps3bus_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 ps3bus_devinfo *dinfo; @@ -560,10 +560,10 @@ ps3bus_alloc_resource(device_t bus, device_t child, int type, int *rid, switch (type) { case SYS_RES_MEMORY: rle = resource_list_find(&dinfo->resources, SYS_RES_MEMORY, - *rid); + rid); if (rle == NULL) { device_printf(bus, "no rle for %s memory %d\n", - device_get_nameunit(child), *rid); + device_get_nameunit(child), rid); return (NULL); } @@ -585,7 +585,7 @@ ps3bus_alloc_resource(device_t bus, device_t child, int type, int *rid, break; case SYS_RES_IRQ: rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, - *rid); + rid); adjstart = rle->start; adjcount = ulmax(count, rle->count); adjend = ulmax(rle->end, rle->start + adjcount - 1); diff --git a/sys/powerpc/psim/ata_iobus.c b/sys/powerpc/psim/ata_iobus.c index fff2cc659570..e9b48966779d 100644 --- a/sys/powerpc/psim/ata_iobus.c +++ b/sys/powerpc/psim/ata_iobus.c @@ -58,7 +58,7 @@ static int ata_iobus_attach(device_t dev); static int ata_iobus_probe(device_t dev); static int ata_iobus_print_child(device_t dev, device_t child); -struct resource *ata_iobus_alloc_resource(device_t, device_t, int, int *, +struct resource *ata_iobus_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int ata_iobus_release_resource(device_t, device_t, struct resource *); @@ -129,7 +129,7 @@ ata_iobus_print_child(device_t dev, device_t child) } struct resource * -ata_iobus_alloc_resource(device_t dev, device_t child, int type, int *rid, +ata_iobus_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) { @@ -152,14 +152,14 @@ ata_iobus_alloc_resource(device_t dev, device_t child, int type, int *rid, * The resource values are calculated from these registers */ if (type == SYS_RES_IOPORT) { - switch (*rid) { + switch (rid) { case ATA_IOADDR_RID: myrid = 0; start = ofw_regs[4]; end = start + ATA_IOSIZE - 1; count = ATA_IOSIZE; res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, - SYS_RES_MEMORY, &myrid, + SYS_RES_MEMORY, myrid, start, end, count, flags); break; @@ -169,7 +169,7 @@ ata_iobus_alloc_resource(device_t dev, device_t child, int type, int *rid, end = start + ATA_CTLIOSIZE - 1; count = ATA_CTLIOSIZE; res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, - SYS_RES_MEMORY, &myrid, + SYS_RES_MEMORY, myrid, start, end, count, flags); break; @@ -179,7 +179,7 @@ ata_iobus_alloc_resource(device_t dev, device_t child, int type, int *rid, } return (res); - } else if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) { + } else if (type == SYS_RES_IRQ && rid == ATA_IRQ_RID) { /* * Pass this on to the parent */ diff --git a/sys/powerpc/psim/iobus.c b/sys/powerpc/psim/iobus.c index 288d85effcc2..68f9a250fa2f 100644 --- a/sys/powerpc/psim/iobus.c +++ b/sys/powerpc/psim/iobus.c @@ -71,7 +71,7 @@ static void iobus_probe_nomatch(device_t, device_t); static int iobus_read_ivar(device_t, device_t, int, uintptr_t *); static int iobus_write_ivar(device_t, device_t, int, uintptr_t); static struct rman *iobus_get_rman(device_t, int, u_int); -static struct resource *iobus_alloc_resource(device_t, device_t, int, int *, +static struct resource *iobus_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); static int iobus_adjust_resource(device_t, device_t, struct resource *, @@ -319,7 +319,7 @@ iobus_get_rman(device_t bus, int type, u_int flags) } static struct resource * -iobus_alloc_resource(device_t bus, device_t child, int type, int *rid, +iobus_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) { diff --git a/sys/riscv/riscv/nexus.c b/sys/riscv/riscv/nexus.c index d08274aba9b2..c1a7d72f20c6 100644 --- a/sys/riscv/riscv/nexus.c +++ b/sys/riscv/riscv/nexus.c @@ -226,7 +226,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); @@ -241,7 +241,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/sys/bus.h b/sys/sys/bus.h index 86afc53da562..96e3da3498ea 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -381,7 +381,7 @@ void resource_list_delete(struct resource_list *rl, struct resource * resource_list_alloc(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_release(struct resource_list *rl, @@ -427,7 +427,7 @@ int bus_generic_adjust_resource(device_t bus, device_t child, rman_res_t end); struct resource * bus_generic_alloc_resource(device_t bus, 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 flags); int bus_generic_translate_resource(device_t dev, int type, rman_res_t start, rman_res_t *newstart); @@ -480,7 +480,7 @@ int bus_generic_setup_intr(device_t dev, device_t child, void *arg, void **cookiep); struct resource * - bus_generic_rl_alloc_resource(device_t, device_t, int, int *, + bus_generic_rl_alloc_resource(device_t, device_t, int, int, rman_res_t, rman_res_t, rman_res_t, u_int); void bus_generic_rl_delete_resource(device_t, device_t, int, int); int bus_generic_rl_get_resource(device_t, device_t, int, int, rman_res_t *, @@ -490,7 +490,7 @@ int bus_generic_rl_set_resource(device_t, device_t, int, int, rman_res_t, int bus_generic_rl_release_resource(device_t, device_t, struct resource *); struct resource * bus_generic_rman_alloc_resource(device_t dev, device_t child, int type, - int *rid, rman_res_t start, + int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int bus_generic_rman_adjust_resource(device_t dev, device_t child, @@ -544,7 +544,7 @@ int bus_adjust_resource(device_t child, struct resource *r, rman_res_t start, rman_res_t end); int bus_translate_resource(device_t child, int type, rman_res_t start, rman_res_t *newstart); -struct resource *bus_alloc_resource(device_t dev, int type, int *rid, +struct resource *bus_alloc_resource(device_t dev, int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int bus_activate_resource(device_t dev, struct resource *r); @@ -588,13 +588,13 @@ void bus_enumerate_hinted_children(device_t bus); void bus_identify_children(device_t dev); static __inline struct resource * -bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags) +bus_alloc_resource_any(device_t dev, int type, int rid, u_int flags) { return (bus_alloc_resource(dev, type, rid, 0, ~0, 1, flags)); } static __inline struct resource * -bus_alloc_resource_anywhere(device_t dev, int type, int *rid, +bus_alloc_resource_anywhere(device_t dev, int type, int rid, rman_res_t count, u_int flags) { return (bus_alloc_resource(dev, type, rid, 0, ~0, count, flags)); @@ -602,44 +602,44 @@ bus_alloc_resource_anywhere(device_t dev, int type, int *rid, /* Compat shims for bus_alloc_resource API. */ static __inline struct resource * -bus_alloc_resource_const(device_t dev, int type, int rid, rman_res_t start, +bus_alloc_resource_var(device_t dev, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) { - return (bus_alloc_resource(dev, type, &rid, start, end, count, flags)); + return (bus_alloc_resource(dev, type, *rid, start, end, count, flags)); } static __inline struct resource * -bus_alloc_resource_any_const(device_t dev, int type, int rid, u_int flags) +bus_alloc_resource_any_var(device_t dev, int type, int *rid, u_int flags) { - return (bus_alloc_resource(dev, type, &rid, 0, ~0, 1, flags)); + return (bus_alloc_resource(dev, type, *rid, 0, ~0, 1, flags)); } static __inline struct resource * -bus_alloc_resource_anywhere_const(device_t dev, int type, int rid, +bus_alloc_resource_anywhere_var(device_t dev, int type, int *rid, rman_res_t count, u_int flags) { - return (bus_alloc_resource(dev, type, &rid, 0, ~0, count, flags)); + return (bus_alloc_resource(dev, type, *rid, 0, ~0, count, flags)); } #define bus_alloc_resource(dev, type, rid, start, end, count, flags) \ _Generic((rid), \ - int *: bus_alloc_resource, \ - unsigned int *: bus_alloc_resource, \ - default: bus_alloc_resource_const) \ + int *: bus_alloc_resource_var, \ + unsigned int *: bus_alloc_resource_var, \ + default: bus_alloc_resource) \ ((dev), (type), (rid), (start), (end), (count), (flags)) #define bus_alloc_resource_any(dev, type, rid, flags) \ _Generic((rid), \ - int *: bus_alloc_resource_any, \ - unsigned int *: bus_alloc_resource_any, \ - default: bus_alloc_resource_any_const) \ + int *: bus_alloc_resource_any_var, \ + unsigned int *: bus_alloc_resource_any_var, \ + default: bus_alloc_resource_any) \ ((dev), (type), (rid), (flags)) #define bus_alloc_resource_anywhere(dev, type, rid, count, flags) \ _Generic((rid), \ - int *: bus_alloc_resource_anywhere, \ - unsigned int *: bus_alloc_resource_anywhere, \ - default: bus_alloc_resource_anywhere_const) \ + int *: bus_alloc_resource_anywhere_var, \ + unsigned int *: bus_alloc_resource_anywhere_var, \ + default: bus_alloc_resource_anywhere) \ ((dev), (type), (rid), (count), (flags)) /* Compat shims for simpler bus resource API. */ diff --git a/sys/sys/param.h b/sys/sys/param.h index bdfe4a1cfde3..003c28c082cb 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -74,7 +74,7 @@ * cannot include sys/param.h and should only be updated here. */ #undef __FreeBSD_version -#define __FreeBSD_version 1600004 +#define __FreeBSD_version 1600005 /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, diff --git a/sys/x86/include/legacyvar.h b/sys/x86/include/legacyvar.h index 919650db6d71..8a7618781b00 100644 --- a/sys/x86/include/legacyvar.h +++ b/sys/x86/include/legacyvar.h @@ -56,7 +56,7 @@ void legacy_pcib_write_config(device_t dev, u_int bus, u_int slot, int legacy_pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value); struct resource *legacy_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, + int type, int rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags); int legacy_pcib_adjust_resource(device_t dev, device_t child, struct resource *r, rman_res_t start, rman_res_t end); diff --git a/sys/x86/isa/isa.c b/sys/x86/isa/isa.c index 8e13f466a8e0..9d9bd444dc26 100644 --- a/sys/x86/isa/isa.c +++ b/sys/x86/isa/isa.c @@ -84,7 +84,7 @@ isa_init(device_t dev) * necessary to interpose a mapping layer here. */ struct resource * -isa_alloc_resource(device_t bus, device_t child, int type, int *rid, +isa_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) { /* @@ -97,31 +97,31 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid, struct resource_list_entry *rle; if (!passthrough && !isdefault) { - rle = resource_list_find(rl, type, *rid); + rle = resource_list_find(rl, type, rid); if (!rle) { - if (*rid < 0) + if (rid < 0) return 0; switch (type) { case SYS_RES_IRQ: - if (*rid >= ISA_NIRQ) + if (rid >= ISA_NIRQ) return 0; break; case SYS_RES_DRQ: - if (*rid >= ISA_NDRQ) + if (rid >= ISA_NDRQ) return 0; break; case SYS_RES_MEMORY: - if (*rid >= ISA_NMEM) + if (rid >= ISA_NMEM) return 0; break; case SYS_RES_IOPORT: - if (*rid >= ISA_NPORT) + if (rid >= ISA_NPORT) return 0; break; default: return 0; } - resource_list_add(rl, type, *rid, start, end, count); + resource_list_add(rl, type, rid, start, end, count); } } diff --git a/sys/x86/pci/pci_bus.c b/sys/x86/pci/pci_bus.c index bff64da3ae2d..dfb67aa479c9 100644 --- a/sys/x86/pci/pci_bus.c +++ b/sys/x86/pci/pci_bus.c @@ -592,7 +592,7 @@ hostb_alloc_start(int type, rman_res_t start, rman_res_t end, rman_res_t count) } struct resource * -legacy_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, +legacy_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) { diff --git a/sys/x86/pci/qpi.c b/sys/x86/pci/qpi.c index 21bf1b6738bc..16cef89093b5 100644 --- a/sys/x86/pci/qpi.c +++ b/sys/x86/pci/qpi.c @@ -249,7 +249,7 @@ qpi_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) } static struct resource * -qpi_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, +qpi_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) { diff --git a/sys/x86/x86/mptable_pci.c b/sys/x86/x86/mptable_pci.c index ab47910f971d..1c4decc9a3a8 100644 --- a/sys/x86/x86/mptable_pci.c +++ b/sys/x86/x86/mptable_pci.c @@ -96,7 +96,7 @@ mptable_is_vga_range(rman_res_t start, rman_res_t end) } static struct resource * -mptable_hostb_alloc_resource(device_t dev, device_t child, int type, int *rid, +mptable_hostb_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 mptable_hostb_softc *sc; diff --git a/sys/x86/x86/nexus.c b/sys/x86/x86/nexus.c index 0c59100add4c..a1c08cf252c7 100644 --- a/sys/x86/x86/nexus.c +++ b/sys/x86/x86/nexus.c @@ -345,7 +345,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) { @@ -361,7 +361,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; |
