From c47476d7e6801deffc8b3c057d0fbf7d2335a0c2 Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Sat, 27 Feb 2016 03:38:01 +0000 Subject: [PATCH] Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere(). Most calls to bus_alloc_resource() use "anywhere" as the range, with a given count. Migrate these to use the new bus_alloc_resource_anywhere() API. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D5370 --- sys/arm/xscale/i8134x/uart_bus_i81342.c | 4 ++-- sys/dev/aac/aac.c | 4 ++-- sys/dev/aacraid/aacraid.c | 4 ++-- sys/dev/aha/aha_isa.c | 8 +++---- sys/dev/aic/aic_isa.c | 4 ++-- sys/dev/aic/aic_pccard.c | 4 ++-- sys/dev/an/if_an.c | 12 +++++----- sys/dev/ata/ata-card.c | 8 +++---- sys/dev/ata/ata-cbus.c | 8 +++---- sys/dev/ata/ata-isa.c | 16 +++++++------- sys/dev/cm/if_cm_isa.c | 8 +++---- sys/dev/cs/if_cs.c | 4 ++-- sys/dev/ct/ct_isa.c | 8 +++---- sys/dev/digi/digi_isa.c | 16 +++++++------- sys/dev/ed/if_ed.c | 8 +++---- sys/dev/fdc/fdc_isa.c | 4 ++-- sys/dev/fe/if_fe.c | 4 ++-- sys/dev/ichsmb/ichsmb_pci.c | 8 +++---- sys/dev/if_ndis/if_ndis_pccard.c | 4 ++-- sys/dev/iicbus/iicoc.c | 4 ++-- sys/dev/le/if_le_isa.c | 6 ++--- sys/dev/mse/mse_isa.c | 8 +++---- sys/dev/nsp/nsp_pccard.c | 5 +++-- sys/dev/oce/oce_hw.c | 5 ++--- sys/dev/pbio/pbio.c | 8 +++---- sys/dev/pccard/pccard.c | 4 ++-- sys/dev/pccard/pccard_cis.c | 2 +- sys/dev/pci/pci_pci.c | 4 ++-- sys/dev/ppc/ppc.c | 16 ++++++++------ sys/dev/rc/rc.c | 4 ++-- sys/dev/rp/rp_isa.c | 4 ++-- sys/dev/sbni/if_sbni_isa.c | 5 +++-- sys/dev/scc/scc_core.c | 12 +++++----- sys/dev/si/si_isa.c | 6 ++--- sys/dev/sio/sio.c | 8 +++---- sys/dev/smc/if_smc.c | 8 +++---- sys/dev/sn/if_sn.c | 4 ++-- sys/dev/snc/if_snc.c | 8 +++---- sys/dev/snc/if_snc_cbus.c | 6 ++--- sys/dev/sound/isa/gusc.c | 22 ++++++++++++++----- sys/dev/sound/isa/mss.c | 18 ++++++++------- sys/dev/sound/isa/sbc.c | 11 ++++++---- sys/dev/wi/if_wi.c | 4 ++-- sys/dev/wl/if_wl.c | 4 ++-- sys/dev/xe/if_xe.c | 8 +++---- sys/i386/isa/spic.c | 4 ++-- .../bluetooth/drivers/bt3c/ng_bt3c_pccard.c | 4 ++-- sys/pc98/cbus/sio.c | 12 +++++----- 48 files changed, 184 insertions(+), 166 deletions(-) diff --git a/sys/arm/xscale/i8134x/uart_bus_i81342.c b/sys/arm/xscale/i8134x/uart_bus_i81342.c index fc99d07cf6e8..34df098e74c9 100644 --- a/sys/arm/xscale/i8134x/uart_bus_i81342.c +++ b/sys/arm/xscale/i8134x/uart_bus_i81342.c @@ -74,8 +74,8 @@ uart_i81342_probe(device_t dev) sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs); bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas)); } - sc->sc_rres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->sc_rrid, - 0, ~0, uart_getrange(sc->sc_class), RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->sc_rrid, uart_getrange(sc->sc_class), RF_ACTIVE); sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 1e53ac3cc0d9..0069a8a71efc 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -1780,8 +1780,8 @@ aac_check_firmware(struct aac_softc *sc) rid = rman_get_rid(sc->aac_regs_res1); bus_release_resource(sc->aac_dev, SYS_RES_MEMORY, rid, sc->aac_regs_res1); - sc->aac_regs_res1 = bus_alloc_resource(sc->aac_dev, - SYS_RES_MEMORY, &rid, 0ul, ~0ul, atu_size, RF_ACTIVE); + sc->aac_regs_res1 = bus_alloc_resource_anywhere(sc->aac_dev, + SYS_RES_MEMORY, &rid, atu_size, RF_ACTIVE); if (sc->aac_regs_res1 == NULL) { sc->aac_regs_res1 = bus_alloc_resource_any( sc->aac_dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); diff --git a/sys/dev/aacraid/aacraid.c b/sys/dev/aacraid/aacraid.c index 7c300a6a85bd..26b229626b13 100644 --- a/sys/dev/aacraid/aacraid.c +++ b/sys/dev/aacraid/aacraid.c @@ -1663,9 +1663,9 @@ aac_check_firmware(struct aac_softc *sc) bus_release_resource( sc->aac_dev, SYS_RES_MEMORY, sc->aac_regs_rid0, sc->aac_regs_res0); - sc->aac_regs_res0 = bus_alloc_resource( + sc->aac_regs_res0 = bus_alloc_resource_anywhere( sc->aac_dev, SYS_RES_MEMORY, &sc->aac_regs_rid0, - 0ul, ~0ul, atu_size, RF_ACTIVE); + atu_size, RF_ACTIVE); if (sc->aac_regs_res0 == NULL) { sc->aac_regs_res0 = bus_alloc_resource_any( sc->aac_dev, SYS_RES_MEMORY, diff --git a/sys/dev/aha/aha_isa.c b/sys/dev/aha/aha_isa.c index ef884e9b7e78..c4e7ba90db0b 100644 --- a/sys/dev/aha/aha_isa.c +++ b/sys/dev/aha/aha_isa.c @@ -120,8 +120,8 @@ aha_isa_probe(device_t dev) return (ENXIO); port_rid = 0; - aha->port = bus_alloc_resource(dev, SYS_RES_IOPORT, &port_rid, - 0ul, ~0ul, AHA_NREGS, RF_ACTIVE); + aha->port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &port_rid, + AHA_NREGS, RF_ACTIVE); if (aha->port == NULL) return (ENXIO); @@ -191,8 +191,8 @@ aha_isa_attach(device_t dev) aha->dev = dev; aha->portrid = 0; - aha->port = bus_alloc_resource(dev, SYS_RES_IOPORT, &aha->portrid, - 0ul, ~0ul, AHA_NREGS, RF_ACTIVE); + aha->port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &aha->portrid, AHA_NREGS, RF_ACTIVE); if (!aha->port) { device_printf(dev, "Unable to allocate I/O ports\n"); goto fail; diff --git a/sys/dev/aic/aic_isa.c b/sys/dev/aic/aic_isa.c index 1671802863c5..7e8c23954c35 100644 --- a/sys/dev/aic/aic_isa.c +++ b/sys/dev/aic/aic_isa.c @@ -75,8 +75,8 @@ aic_isa_alloc_resources(device_t dev) sc->sc_port = sc->sc_irq = sc->sc_drq = NULL; rid = 0; - sc->sc_port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, AIC_ISA_PORTSIZE, RF_ACTIVE); + sc->sc_port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + AIC_ISA_PORTSIZE, RF_ACTIVE); if (!sc->sc_port) { device_printf(dev, "I/O port allocation failed\n"); return (ENOMEM); diff --git a/sys/dev/aic/aic_pccard.c b/sys/dev/aic/aic_pccard.c index ef6dd9e5f076..c16c90ec67d6 100644 --- a/sys/dev/aic/aic_pccard.c +++ b/sys/dev/aic/aic_pccard.c @@ -77,8 +77,8 @@ aic_pccard_alloc_resources(device_t dev) sc->sc_port = sc->sc_irq = NULL; rid = 0; - sc->sc_port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, AIC_PCCARD_PORTSIZE, RF_ACTIVE); + sc->sc_port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + AIC_PCCARD_PORTSIZE, RF_ACTIVE); if (!sc->sc_port) return (ENOMEM); diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index 3433cd5d29a7..1f37b59dbf74 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -394,8 +394,8 @@ an_alloc_port(device_t dev, int rid, int size) struct an_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + size, RF_ACTIVE); if (res) { sc->port_rid = rid; sc->port_res = res; @@ -413,8 +413,8 @@ int an_alloc_memory(device_t dev, int rid, int size) struct an_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid, + size, RF_ACTIVE); if (res) { sc->mem_rid = rid; sc->mem_res = res; @@ -433,8 +433,8 @@ int an_alloc_aux_memory(device_t dev, int rid, int size) struct an_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid, + size, RF_ACTIVE); if (res) { sc->mem_aux_rid = rid; sc->mem_aux_res = res; diff --git a/sys/dev/ata/ata-card.c b/sys/dev/ata/ata-card.c index 4b0a3d1335c6..5aa5a9b480f8 100644 --- a/sys/dev/ata/ata-card.c +++ b/sys/dev/ata/ata-card.c @@ -98,8 +98,8 @@ ata_pccard_attach(device_t dev) /* allocate the io range to get start and length */ rid = ATA_IOADDR_RID; - if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - ATA_IOSIZE, RF_ACTIVE))) + if (!(io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + ATA_IOSIZE, RF_ACTIVE))) return (ENXIO); /* setup the resource vectors */ @@ -119,8 +119,8 @@ ata_pccard_attach(device_t dev) } else { rid = ATA_CTLADDR_RID; - if (!(ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - ATA_CTLIOSIZE, RF_ACTIVE))) { + if (!(ctlio = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + ATA_CTLIOSIZE, RF_ACTIVE))) { bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); for (i = ATA_DATA; i < ATA_MAX_RES; i++) ch->r_io[i].res = NULL; diff --git a/sys/dev/ata/ata-cbus.c b/sys/dev/ata/ata-cbus.c index 793601d092e4..4165ea6a947a 100644 --- a/sys/dev/ata/ata-cbus.c +++ b/sys/dev/ata/ata-cbus.c @@ -75,8 +75,8 @@ ata_cbus_probe(device_t dev) /* allocate the ioport range */ rid = ATA_IOADDR_RID; - if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - ATA_PC98_IOSIZE, RF_ACTIVE))) + if (!(io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + ATA_PC98_IOSIZE, RF_ACTIVE))) return ENOMEM; /* calculate & set the altport range */ @@ -106,8 +106,8 @@ ata_cbus_attach(device_t dev) /* allocate resources */ rid = ATA_IOADDR_RID; - if (!(ctlr->io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - ATA_PC98_IOSIZE, RF_ACTIVE))) + if (!(ctlr->io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + ATA_PC98_IOSIZE, RF_ACTIVE))) return ENOMEM; rid = ATA_PC98_CTLADDR_RID; diff --git a/sys/dev/ata/ata-isa.c b/sys/dev/ata/ata-isa.c index 43b8533bcfc9..b29851342b98 100644 --- a/sys/dev/ata/ata-isa.c +++ b/sys/dev/ata/ata-isa.c @@ -69,8 +69,8 @@ ata_isa_probe(device_t dev) /* allocate the io port range */ rid = ATA_IOADDR_RID; - if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - ATA_IOSIZE, RF_ACTIVE))) + if (!(io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + ATA_IOSIZE, RF_ACTIVE))) return ENXIO; /* set the altport range */ @@ -81,8 +81,8 @@ ata_isa_probe(device_t dev) /* allocate the altport range */ rid = ATA_CTLADDR_RID; - if (!(ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - ATA_CTLIOSIZE, RF_ACTIVE))) { + if (!(ctlio = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + ATA_CTLIOSIZE, RF_ACTIVE))) { bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); return ENXIO; } @@ -109,8 +109,8 @@ ata_isa_attach(device_t dev) /* allocate the io port range */ rid = ATA_IOADDR_RID; - if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - ATA_IOSIZE, RF_ACTIVE))) + if (!(io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + ATA_IOSIZE, RF_ACTIVE))) return ENXIO; /* set the altport range */ @@ -121,8 +121,8 @@ ata_isa_attach(device_t dev) /* allocate the altport range */ rid = ATA_CTLADDR_RID; - if (!(ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - ATA_CTLIOSIZE, RF_ACTIVE))) { + if (!(ctlio = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + ATA_CTLIOSIZE, RF_ACTIVE))) { bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); return ENXIO; } diff --git a/sys/dev/cm/if_cm_isa.c b/sys/dev/cm/if_cm_isa.c index adcd31fb45fa..09083743ea1c 100644 --- a/sys/dev/cm/if_cm_isa.c +++ b/sys/dev/cm/if_cm_isa.c @@ -63,8 +63,8 @@ cm_isa_probe(dev) int rid; rid = 0; - sc->port_res = bus_alloc_resource( - dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul, CM_IO_PORTS, RF_ACTIVE); + sc->port_res = bus_alloc_resource_anywhere( + dev, SYS_RES_IOPORT, &rid, CM_IO_PORTS, RF_ACTIVE); if (sc->port_res == NULL) return (ENOENT); @@ -74,8 +74,8 @@ cm_isa_probe(dev) } rid = 0; - sc->mem_res = bus_alloc_resource( - dev, SYS_RES_MEMORY, &rid, 0ul, ~0ul, CM_MEM_SIZE, RF_ACTIVE); + sc->mem_res = bus_alloc_resource_anywhere( + dev, SYS_RES_MEMORY, &rid, CM_MEM_SIZE, RF_ACTIVE); if (sc->mem_res == NULL) { cm_release_resources(dev); return (ENOENT); diff --git a/sys/dev/cs/if_cs.c b/sys/dev/cs/if_cs.c index 770efe8c1e3f..af8a93e861b2 100644 --- a/sys/dev/cs/if_cs.c +++ b/sys/dev/cs/if_cs.c @@ -406,8 +406,8 @@ cs_alloc_port(device_t dev, int rid, int size) struct cs_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + size, RF_ACTIVE); if (res == NULL) return (ENOENT); sc->port_rid = rid; diff --git a/sys/dev/ct/ct_isa.c b/sys/dev/ct/ct_isa.c index b6a937045fea..601f7fb06569 100644 --- a/sys/dev/ct/ct_isa.c +++ b/sys/dev/ct/ct_isa.c @@ -318,8 +318,8 @@ ct_space_map(device_t dev, struct bshw *hw, *memhp = NULL; port_rid = 0; - *iohp = bus_alloc_resource(dev, SYS_RES_IOPORT, &port_rid, 0ul, ~0ul, - BSHW_IOSZ, RF_ACTIVE); + *iohp = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &port_rid, + BSHW_IOSZ, RF_ACTIVE); if (*iohp == NULL) return ENXIO; @@ -327,8 +327,8 @@ ct_space_map(device_t dev, struct bshw *hw, return 0; mem_rid = 0; - *memhp = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, 0ul, ~0ul, - BSHW_MEMSZ, RF_ACTIVE); + *memhp = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &mem_rid, + BSHW_MEMSZ, RF_ACTIVE); if (*memhp == NULL) { bus_release_resource(dev, SYS_RES_IOPORT, port_rid, *iohp); return ENXIO; diff --git a/sys/dev/digi/digi_isa.c b/sys/dev/digi/digi_isa.c index d0741ac7439c..647ea1d8bc56 100644 --- a/sys/dev/digi/digi_isa.c +++ b/sys/dev/digi/digi_isa.c @@ -277,8 +277,8 @@ digi_isa_probe(device_t dev) /* Temporarily map our io ports */ sc->res.iorid = 0; - sc->res.io = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->res.iorid, - 0ul, ~0ul, IO_SIZE, RF_ACTIVE); + sc->res.io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->res.iorid, IO_SIZE, RF_ACTIVE); if (sc->res.io == NULL) return (ENXIO); @@ -291,8 +291,8 @@ digi_isa_probe(device_t dev) /* Temporarily map our memory */ sc->res.mrid = 0; - sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, - 0ul, ~0ul, sc->win_size, 0); + sc->res.mem = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, + &sc->res.mrid, sc->win_size, 0); if (sc->res.mem == NULL) { device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); bus_release_resource(dev, SYS_RES_IOPORT, sc->res.iorid, @@ -342,8 +342,8 @@ digi_isa_attach(device_t dev) /* Allocate resources (verified in digi_isa_probe()) */ sc->res.iorid = 0; - sc->res.io = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->res.iorid, - 0ul, ~0ul, iosize, RF_ACTIVE); + sc->res.io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->res.iorid, iosize, RF_ACTIVE); if (sc->res.io == NULL) return (ENXIO); @@ -356,8 +356,8 @@ digi_isa_attach(device_t dev) callout_handle_init(&sc->inttest); sc->res.mrid = 0; - sc->res.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->res.mrid, - 0ul, ~0ul, msize, RF_ACTIVE); + sc->res.mem = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, + &sc->res.mrid, msize, RF_ACTIVE); if (sc->res.mem == NULL) { device_printf(dev, "0x%lx: Memory range is in use\n", sc->pmem); sc->hidewin(sc); diff --git a/sys/dev/ed/if_ed.c b/sys/dev/ed/if_ed.c index 95d80f690643..1fb403793169 100644 --- a/sys/dev/ed/if_ed.c +++ b/sys/dev/ed/if_ed.c @@ -164,8 +164,8 @@ ed_alloc_port(device_t dev, int rid, int size) struct ed_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + size, RF_ACTIVE); if (res) { sc->port_res = res; sc->port_used = size; @@ -185,8 +185,8 @@ ed_alloc_memory(device_t dev, int rid, int size) struct ed_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid, + size, RF_ACTIVE); if (res) { sc->mem_res = res; sc->mem_used = size; diff --git a/sys/dev/fdc/fdc_isa.c b/sys/dev/fdc/fdc_isa.c index ab7057d260b4..9e517e8569d4 100644 --- a/sys/dev/fdc/fdc_isa.c +++ b/sys/dev/fdc/fdc_isa.c @@ -89,8 +89,8 @@ fdc_isa_alloc_resources(device_t dev, struct fdc_data *fdc) nport = isa_get_logicalid(dev) ? 1 : 6; for (rid = 0; ; rid++) { newrid = rid; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &newrid, - 0ul, ~0ul, rid == 0 ? nport : 1, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &newrid, + rid == 0 ? nport : 1, RF_ACTIVE); if (res == NULL) break; /* diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 1be74f9d2c8b..28841b783777 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -881,8 +881,8 @@ fe_alloc_port(device_t dev, int size) int rid; rid = 0; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, size, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + size, RF_ACTIVE); if (res) { sc->port_used = size; sc->port_res = res; diff --git a/sys/dev/ichsmb/ichsmb_pci.c b/sys/dev/ichsmb/ichsmb_pci.c index fc8024a09e2a..8f3f106ca9b8 100644 --- a/sys/dev/ichsmb/ichsmb_pci.c +++ b/sys/dev/ichsmb/ichsmb_pci.c @@ -241,11 +241,11 @@ ichsmb_pci_attach(device_t dev) /* Allocate an I/O range */ sc->io_rid = ICH_SMB_BASE; - sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->io_rid, 0, ~0, 16, RF_ACTIVE); + sc->io_res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->io_rid, 16, RF_ACTIVE); if (sc->io_res == NULL) - sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->io_rid, 0ul, ~0ul, 32, RF_ACTIVE); + sc->io_res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->io_rid, 32, RF_ACTIVE); if (sc->io_res == NULL) { device_printf(dev, "can't map I/O\n"); error = ENXIO; diff --git a/sys/dev/if_ndis/if_ndis_pccard.c b/sys/dev/if_ndis/if_ndis_pccard.c index 7f3cd98d4029..7cbc0cef8753 100644 --- a/sys/dev/if_ndis/if_ndis_pccard.c +++ b/sys/dev/if_ndis/if_ndis_pccard.c @@ -280,8 +280,8 @@ ndis_alloc_amem(arg) sc = arg; rid = NDIS_AM_RID; - sc->ndis_res_am = bus_alloc_resource(sc->ndis_dev, SYS_RES_MEMORY, - &rid, 0UL, ~0UL, 0x1000, RF_ACTIVE); + sc->ndis_res_am = bus_alloc_resource_anywhere(sc->ndis_dev, + SYS_RES_MEMORY, &rid, 0x1000, RF_ACTIVE); if (sc->ndis_res_am == NULL) { device_printf(sc->ndis_dev, diff --git a/sys/dev/iicbus/iicoc.c b/sys/dev/iicbus/iicoc.c index c55d6fe4dc89..1186b514879c 100644 --- a/sys/dev/iicbus/iicoc.c +++ b/sys/dev/iicbus/iicoc.c @@ -207,8 +207,8 @@ iicoc_attach(device_t dev) sc->dev = dev; mtx_init(&sc->sc_mtx, "iicoc", "iicoc", MTX_DEF); sc->mem_rid = 0; - sc->mem_res = bus_alloc_resource(dev, - SYS_RES_MEMORY, &sc->mem_rid, 0ul, ~0ul, 0x100, RF_ACTIVE); + sc->mem_res = bus_alloc_resource_anywhere(dev, + SYS_RES_MEMORY, &sc->mem_rid, 0x100, RF_ACTIVE); if (sc->mem_res == NULL) { device_printf(dev, "Could not allocate bus resource.\n"); diff --git a/sys/dev/le/if_le_isa.c b/sys/dev/le/if_le_isa.c index 2c5aed717f6c..f2a77dd63404 100644 --- a/sys/dev/le/if_le_isa.c +++ b/sys/dev/le/if_le_isa.c @@ -209,7 +209,7 @@ le_isa_probe_legacy(device_t dev, const struct le_isa_param *leip) sc = &lesc->sc_am7990.lsc; i = 0; - lesc->sc_rres = bus_alloc_resource(dev, SYS_RES_IOPORT, &i, 0, ~0, + lesc->sc_rres = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &i, leip->iosize, RF_ACTIVE); if (lesc->sc_rres == NULL) return (ENXIO); @@ -282,8 +282,8 @@ le_isa_attach(device_t dev) for (i = 0; i < sizeof(le_isa_params) / sizeof(le_isa_params[0]); i++) { if (le_isa_probe_legacy(dev, &le_isa_params[i]) == 0) { - lesc->sc_rres = bus_alloc_resource(dev, - SYS_RES_IOPORT, &j, 0, ~0, + lesc->sc_rres = bus_alloc_resource_anywhere(dev, + SYS_RES_IOPORT, &j, le_isa_params[i].iosize, RF_ACTIVE); rap = le_isa_params[i].rap; rdp = le_isa_params[i].rdp; diff --git a/sys/dev/mse/mse_isa.c b/sys/dev/mse/mse_isa.c index c18759d28562..8cc85babecd2 100644 --- a/sys/dev/mse/mse_isa.c +++ b/sys/dev/mse/mse_isa.c @@ -206,8 +206,8 @@ mse_isa_probe(device_t dev) sc = device_get_softc(dev); rid = 0; - sc->sc_port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - MSE_IOSIZE, RF_ACTIVE); + sc->sc_port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + MSE_IOSIZE, RF_ACTIVE); if (sc->sc_port == NULL) return ENXIO; @@ -243,8 +243,8 @@ mse_isa_attach(device_t dev) sc = device_get_softc(dev); rid = 0; - sc->sc_port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, - MSE_IOSIZE, RF_ACTIVE); + sc->sc_port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + MSE_IOSIZE, RF_ACTIVE); if (sc->sc_port == NULL) return ENXIO; diff --git a/sys/dev/nsp/nsp_pccard.c b/sys/dev/nsp/nsp_pccard.c index 75fc07603869..a784cadccfcc 100644 --- a/sys/dev/nsp/nsp_pccard.c +++ b/sys/dev/nsp/nsp_pccard.c @@ -124,8 +124,9 @@ nsp_alloc_resource(device_t dev) mtx_init(&sc->sc_sclow.sl_lock, "nsp", NULL, MTX_DEF); sc->port_rid = 0; - sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, - 0, ~0, NSP_IOSIZE, RF_ACTIVE); + sc->port_res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->port_rid, NSP_IOSIZE, + RF_ACTIVE); if (sc->port_res == NULL) { nsp_release_resource(dev); return(ENOMEM); diff --git a/sys/dev/oce/oce_hw.c b/sys/dev/oce/oce_hw.c index 8d292880e3cb..aad5795a97e5 100644 --- a/sys/dev/oce/oce_hw.c +++ b/sys/dev/oce/oce_hw.c @@ -268,9 +268,8 @@ oce_hw_pci_alloc(POCE_SOFTC sc) SYS_RES_MEMORY, &rr, RF_ACTIVE|RF_SHAREABLE); else - sc->devcfg_res = bus_alloc_resource(sc->dev, - SYS_RES_MEMORY, &rr, - 0ul, ~0ul, 32768, + sc->devcfg_res = bus_alloc_resource_anywhere(sc->dev, + SYS_RES_MEMORY, &rr, 32768, RF_ACTIVE|RF_SHAREABLE); if (!sc->devcfg_res) diff --git a/sys/dev/pbio/pbio.c b/sys/dev/pbio/pbio.c index 536e6fbdf218..ebb0e33c8661 100644 --- a/sys/dev/pbio/pbio.c +++ b/sys/dev/pbio/pbio.c @@ -170,8 +170,8 @@ pbioprobe(device_t dev) if (isa_get_logicalid(dev)) /* skip PnP probes */ return (ENXIO); rid = 0; - scp->res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0, ~0, IO_PBIOSIZE, RF_ACTIVE); + scp->res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + IO_PBIOSIZE, RF_ACTIVE); if (scp->res == NULL) return (ENXIO); @@ -225,8 +225,8 @@ pbioattach (device_t dev) sc = device_get_softc(dev); unit = device_get_unit(dev); rid = 0; - sc->res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0, ~0, IO_PBIOSIZE, RF_ACTIVE); + sc->res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + IO_PBIOSIZE, RF_ACTIVE); if (sc->res == NULL) return (ENXIO); sc->bst = rman_get_bustag(sc->res); diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c index 746b50947d92..1b91d64cb7c4 100644 --- a/sys/dev/pccard/pccard.c +++ b/sys/dev/pccard/pccard.c @@ -693,8 +693,8 @@ pccard_function_enable(struct pccard_function *pf) } if (tmp == NULL) { pf->ccr_rid = 0; - pf->ccr_res = bus_alloc_resource(dev, SYS_RES_MEMORY, - &pf->ccr_rid, 0, ~0, PCCARD_MEM_PAGE_SIZE, RF_ACTIVE); + pf->ccr_res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, + &pf->ccr_rid, PCCARD_MEM_PAGE_SIZE, RF_ACTIVE); if (!pf->ccr_res) goto bad; DEVPRINTF((dev, "ccr_res == %#lx-%#lx, base=%#x\n", diff --git a/sys/dev/pccard/pccard_cis.c b/sys/dev/pccard/pccard_cis.c index dbd71658df2f..4bd06b56cccc 100644 --- a/sys/dev/pccard/pccard_cis.c +++ b/sys/dev/pccard/pccard_cis.c @@ -140,7 +140,7 @@ pccard_scan_cis(device_t bus, device_t dev, pccard_scan_t fct, void *arg) * would make cards work better, but it is easy enough to test. */ rid = 0; - res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, + res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid, PCCARD_CIS_SIZE, RF_ACTIVE | rman_make_alignment_flags(64*1024)); if (res == NULL) { device_printf(dev, "can't alloc memory to read attributes\n"); diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 6f9a22c5ce15..4c9b0ca937f6 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -577,14 +577,14 @@ pcib_setup_secbus(device_t dev, struct pcib_secbus *bus, int min_count) * if one exists, or a new bus range if one does not. */ rid = 0; - bus->res = bus_alloc_resource(dev, PCI_RES_BUS, &rid, 0ul, ~0ul, + bus->res = bus_alloc_resource_anywhere(dev, PCI_RES_BUS, &rid, min_count, 0); if (bus->res == NULL) { /* * Fall back to just allocating a range of a single bus * number. */ - bus->res = bus_alloc_resource(dev, PCI_RES_BUS, &rid, 0ul, ~0ul, + bus->res = bus_alloc_resource_anywhere(dev, PCI_RES_BUS, &rid, 1, 0); } else if (rman_get_size(bus->res) < min_count) /* diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c index 17a4a0420f4b..a23f06ce772a 100644 --- a/sys/dev/ppc/ppc.c +++ b/sys/dev/ppc/ppc.c @@ -1721,19 +1721,21 @@ ppc_probe(device_t dev, int rid) /* IO port is mandatory */ /* Try "extended" IO port range...*/ - ppc->res_ioport = bus_alloc_resource(dev, SYS_RES_IOPORT, - &ppc->rid_ioport, 0, ~0, - IO_LPTSIZE_EXTENDED, RF_ACTIVE); + ppc->res_ioport = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &ppc->rid_ioport, + IO_LPTSIZE_EXTENDED, + RF_ACTIVE); if (ppc->res_ioport != 0) { if (bootverbose) device_printf(dev, "using extended I/O port range\n"); } else { /* Failed? If so, then try the "normal" IO port range... */ - ppc->res_ioport = bus_alloc_resource(dev, SYS_RES_IOPORT, - &ppc->rid_ioport, 0, ~0, - IO_LPTSIZE_NORMAL, - RF_ACTIVE); + ppc->res_ioport = bus_alloc_resource_anywhere(dev, + SYS_RES_IOPORT, + &ppc->rid_ioport, + IO_LPTSIZE_NORMAL, + RF_ACTIVE); if (ppc->res_ioport != 0) { if (bootverbose) device_printf(dev, "using normal I/O port range\n"); diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 0c11358c2179..1e8a23a8cfda 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -242,8 +242,8 @@ rc_attach(device_t dev) error = ENOMEM; for (i = 0; i < IOBASE_ADDRS; i++) { x = i; - sc->sc_port[i] = bus_alloc_resource(dev, SYS_RES_IOPORT, &x, - 0ul, ~0ul, 0x10, RF_ACTIVE); + sc->sc_port[i] = bus_alloc_resource_anywhere(dev, + SYS_RES_IOPORT, &x, 0x10, RF_ACTIVE); if (x != i) { device_printf(dev, "ioport %d was rid %d\n", i, x); goto fail; diff --git a/sys/dev/rp/rp_isa.c b/sys/dev/rp/rp_isa.c index 2f612308f45b..9ea7fc04e277 100644 --- a/sys/dev/rp/rp_isa.c +++ b/sys/dev/rp/rp_isa.c @@ -194,10 +194,10 @@ rp_probe(device_t dev) ctlp->io_rid[0] = 0; if (rp_controller != NULL) { controller = rp_controller; - ctlp->io[0] = bus_alloc_resource(dev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0, ~0, 0x40, RF_ACTIVE); + ctlp->io[0] = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0x40, RF_ACTIVE); } else { controller = rp_controller = ctlp; - ctlp->io[0] = bus_alloc_resource(dev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0, ~0, 0x44, RF_ACTIVE); + ctlp->io[0] = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0x44, RF_ACTIVE); } if (ctlp->io[0] == NULL) { device_printf(dev, "rp_attach: Resource not available.\n"); diff --git a/sys/dev/sbni/if_sbni_isa.c b/sys/dev/sbni/if_sbni_isa.c index e27ce148fff0..61a239841b19 100644 --- a/sys/dev/sbni/if_sbni_isa.c +++ b/sys/dev/sbni/if_sbni_isa.c @@ -86,8 +86,9 @@ sbni_probe_isa(device_t dev) sc = device_get_softc(dev); - sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid, - 0ul, ~0ul, SBNI_PORTS, RF_ACTIVE); + sc->io_res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->io_rid, SBNI_PORTS, + RF_ACTIVE); if (!sc->io_res) { printf("sbni: cannot allocate io ports!\n"); return (ENOENT); diff --git a/sys/dev/scc/scc_core.c b/sys/dev/scc/scc_core.c index 6b0558a95fe9..905fc64ea153 100644 --- a/sys/dev/scc/scc_core.c +++ b/sys/dev/scc/scc_core.c @@ -129,8 +129,8 @@ scc_bfe_attach(device_t dev, u_int ipc) * Re-allocate. We expect that the softc contains the information * collected by scc_bfe_probe() intact. */ - sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid, - 0, ~0, cl->cl_channels * size, RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_anywhere(dev, sc->sc_rtype, + &sc->sc_rrid, cl->cl_channels * size, RF_ACTIVE); if (sc->sc_rres == NULL) return (ENXIO); sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); @@ -378,13 +378,13 @@ scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid) */ sc->sc_rrid = rid; sc->sc_rtype = SYS_RES_MEMORY; - sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid, - 0, ~0, cl->cl_channels * size, RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_anywhere(dev, sc->sc_rtype, + &sc->sc_rrid, cl->cl_channels * size, RF_ACTIVE); if (sc->sc_rres == NULL) { sc->sc_rrid = rid; sc->sc_rtype = SYS_RES_IOPORT; - sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, - &sc->sc_rrid, 0, ~0, cl->cl_channels * size, RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_anywhere(dev, sc->sc_rtype, + &sc->sc_rrid, cl->cl_channels * size, RF_ACTIVE); if (sc->sc_rres == NULL) return (ENXIO); } diff --git a/sys/dev/si/si_isa.c b/sys/dev/si/si_isa.c index f6d5ab6acece..9c0b81b58b3c 100644 --- a/sys/dev/si/si_isa.c +++ b/sys/dev/si/si_isa.c @@ -58,9 +58,9 @@ si_isa_probe(device_t dev) unit = device_get_unit(dev); sc->sc_mem_rid = 0; - sc->sc_mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, - &sc->sc_mem_rid, - 0, ~0, SIPROBEALLOC, RF_ACTIVE); + sc->sc_mem_res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, + &sc->sc_mem_rid, + SIPROBEALLOC, RF_ACTIVE); if (!sc->sc_mem_res) { device_printf(dev, "cannot allocate memory resource\n"); return ENXIO; diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 324a80be0829..c27b7bcb3f19 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -444,8 +444,8 @@ sioprobe(dev, xrid, rclk, noprobe) struct resource *port; rid = xrid; - port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0, ~0, IO_COMSIZE, RF_ACTIVE); + port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + IO_COMSIZE, RF_ACTIVE); if (!port) return (ENXIO); @@ -884,8 +884,8 @@ sioattach(dev, xrid, rclk) struct tty *tp; rid = xrid; - port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0, ~0, IO_COMSIZE, RF_ACTIVE); + port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + IO_COMSIZE, RF_ACTIVE); if (!port) return (ENXIO); diff --git a/sys/dev/smc/if_smc.c b/sys/dev/smc/if_smc.c index 407482eea127..3701cb15b0cb 100644 --- a/sys/dev/smc/if_smc.c +++ b/sys/dev/smc/if_smc.c @@ -234,7 +234,7 @@ smc_probe(device_t dev) if (sc->smc_usemem) type = SYS_RES_MEMORY; - reg = bus_alloc_resource(dev, type, &rid, 0, ~0, 16, RF_ACTIVE); + reg = bus_alloc_resource_anywhere(dev, type, &rid, 16, RF_ACTIVE); if (reg == NULL) { if (bootverbose) device_printf(dev, @@ -328,15 +328,15 @@ smc_attach(device_t dev) type = SYS_RES_MEMORY; sc->smc_reg_rid = 0; - sc->smc_reg = bus_alloc_resource(dev, type, &sc->smc_reg_rid, 0, ~0, + sc->smc_reg = bus_alloc_resource_anywhere(dev, type, &sc->smc_reg_rid, 16, RF_ACTIVE); if (sc->smc_reg == NULL) { error = ENXIO; goto done; } - sc->smc_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->smc_irq_rid, 0, - ~0, 1, RF_ACTIVE | RF_SHAREABLE); + sc->smc_irq = bus_alloc_resource_anywhere(dev, SYS_RES_IRQ, + &sc->smc_irq_rid, 1, RF_ACTIVE | RF_SHAREABLE); if (sc->smc_irq == NULL) { error = ENXIO; goto done; diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index c1fbc9ad8ac7..77ec927e6705 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -1216,8 +1216,8 @@ sn_activate(device_t dev) struct sn_softc *sc = device_get_softc(dev); sc->port_rid = 0; - sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, - 0, ~0, SMC_IO_EXTENT, RF_ACTIVE); + sc->port_res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->port_rid, SMC_IO_EXTENT, RF_ACTIVE); if (!sc->port_res) { if (bootverbose) device_printf(dev, "Cannot allocate ioport\n"); diff --git a/sys/dev/snc/if_snc.c b/sys/dev/snc/if_snc.c index 92631a4eb0d8..99f458354a7d 100644 --- a/sys/dev/snc/if_snc.c +++ b/sys/dev/snc/if_snc.c @@ -72,8 +72,8 @@ snc_alloc_port(device_t dev, int rid) struct snc_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, SNEC_NREGS, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + SNEC_NREGS, RF_ACTIVE); if (res) { sc->ioport = res; sc->ioport_rid = rid; @@ -95,8 +95,8 @@ snc_alloc_memory(device_t dev, int rid) struct snc_softc *sc = device_get_softc(dev); struct resource *res; - res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0ul, ~0ul, SNEC_NMEMS, RF_ACTIVE); + res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid, + SNEC_NMEMS, RF_ACTIVE); if (res) { sc->iomem = res; sc->iomem_rid = rid; diff --git a/sys/dev/snc/if_snc_cbus.c b/sys/dev/snc/if_snc_cbus.c index eea025034e61..484b677967a3 100644 --- a/sys/dev/snc/if_snc_cbus.c +++ b/sys/dev/snc/if_snc_cbus.c @@ -147,9 +147,9 @@ snc_isa_probe(device_t dev) for (port = 0x0888; port <= 0x3888; port += 0x1000) { bus_set_resource(dev, SYS_RES_IOPORT, rid, port, SNEC_NREGS); - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, SNEC_NREGS, - 0 /* !RF_ACTIVE */); + res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &rid, SNEC_NREGS, + 0 /* !RF_ACTIVE */); if (res) break; } diff --git a/sys/dev/sound/isa/gusc.c b/sys/dev/sound/isa/gusc.c index d6fd90f73417..bcb5957ab055 100644 --- a/sys/dev/sound/isa/gusc.c +++ b/sys/dev/sound/isa/gusc.c @@ -495,8 +495,12 @@ alloc_resource(sc_p scp) if (scp->io[i] == NULL) { scp->io_rid[i] = i; if (base == 0) - scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i], - 0, ~0, io_range[i], RF_ACTIVE); + scp->io[i] = + bus_alloc_resource_anywhere(scp->dev, + SYS_RES_IOPORT, + &scp->io_rid[i], + io_range[i], + RF_ACTIVE); else scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i], base + io_offset[i], @@ -540,8 +544,11 @@ alloc_resource(sc_p scp) case LOGICALID_OPL: if (scp->io[0] == NULL) { scp->io_rid[0] = 0; - scp->io[0] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[0], - 0, ~0, io_range[0], RF_ACTIVE); + scp->io[0] = bus_alloc_resource_anywhere(scp->dev, + SYS_RES_IOPORT, + &scp->io_rid[0], + io_range[0], + RF_ACTIVE); if (scp->io[0] == NULL) return (1); scp->io_alloced[0] = 0; @@ -550,8 +557,11 @@ alloc_resource(sc_p scp) case LOGICALID_MIDI: if (scp->io[0] == NULL) { scp->io_rid[0] = 0; - scp->io[0] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[0], - 0, ~0, io_range[0], RF_ACTIVE); + scp->io[0] = bus_alloc_resource_anywhere(scp->dev, + SYS_RES_IOPORT, + &scp->io_rid[0], + io_range[0], + RF_ACTIVE); if (scp->io[0] == NULL) return (1); scp->io_alloced[0] = 0; diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c index cc62df3bbaca..7aaef06352a5 100644 --- a/sys/dev/sound/isa/mss.c +++ b/sys/dev/sound/isa/mss.c @@ -1289,8 +1289,8 @@ mss_probe(device_t dev) mss->irq_rid = 0; mss->drq1_rid = 0; mss->drq2_rid = -1; - mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &mss->io_rid, - 0, ~0, 8, RF_ACTIVE); + mss->io_base = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &mss->io_rid, 8, RF_ACTIVE); if (!mss->io_base) { BVDDB(printf("mss_probe: no address given, try 0x%x\n", 0x530)); mss->io_rid = 0; @@ -1298,8 +1298,9 @@ mss_probe(device_t dev) setres = 1; bus_set_resource(dev, SYS_RES_IOPORT, mss->io_rid, 0x530, 8); - mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &mss->io_rid, - 0, ~0, 8, RF_ACTIVE); + mss->io_base = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &mss->io_rid, + 8, RF_ACTIVE); } if (!mss->io_base) goto no; @@ -2091,8 +2092,8 @@ opti_init(device_t dev, struct mss_info *mss) return ENXIO; if (!mss->io_base) - mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, - &mss->io_rid, 0, ~0, 8, RF_ACTIVE); + mss->io_base = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &mss->io_rid, 8, RF_ACTIVE); if (!mss->io_base) /* No hint specified, use 0x530 */ mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, @@ -2275,8 +2276,9 @@ guspcm_attach(device_t dev) if (flags & DV_F_DUAL_DMA) mss->drq2_rid = 0; - mss->conf_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &mss->conf_rid, - 0, ~0, 8, RF_ACTIVE); + mss->conf_base = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &mss->conf_rid, + 8, RF_ACTIVE); if (mss->conf_base == NULL) { mss_release_resources(mss, dev); diff --git a/sys/dev/sound/isa/sbc.c b/sys/dev/sound/isa/sbc.c index 3a323651b116..6a8e1d34f144 100644 --- a/sys/dev/sound/isa/sbc.c +++ b/sys/dev/sound/isa/sbc.c @@ -301,8 +301,8 @@ sbc_probe(device_t dev) io = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, pcm_iat, 16, RF_ACTIVE); #else - io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0, ~0, 16, RF_ACTIVE); + io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + 16, RF_ACTIVE); #endif if (!io) goto bad; #ifdef PC98 @@ -708,8 +708,11 @@ alloc_resource(struct sbc_softc *scp) io_range[i]); #else scp->io_rid[i] = i; - scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i], - 0, ~0, io_range[i], RF_ACTIVE); + scp->io[i] = bus_alloc_resource_anywhere(scp->dev, + SYS_RES_IOPORT, + &scp->io_rid[i], + io_range[i], + RF_ACTIVE); #endif if (i == 0 && scp->io[i] == NULL) return (1); diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index 8f9d1a0e7525..632bd76ffcc5 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -1995,8 +1995,8 @@ wi_alloc(device_t dev, int rid) if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) { sc->iobase_rid = rid; - sc->iobase = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->iobase_rid, 0, ~0, (1 << 6), + sc->iobase = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->iobase_rid, (1 << 6), rman_make_alignment_flags(1 << 6) | RF_ACTIVE); if (sc->iobase == NULL) { device_printf(dev, "No I/O space?!\n"); diff --git a/sys/dev/wl/if_wl.c b/sys/dev/wl/if_wl.c index b3b92d6c2798..7146a25755d6 100644 --- a/sys/dev/wl/if_wl.c +++ b/sys/dev/wl/if_wl.c @@ -604,8 +604,8 @@ wl_allocate_resources(device_t device) struct wl_softc *sc = device_get_softc(device); int ports = 16; /* Number of ports */ - sc->res_ioport = bus_alloc_resource(device, SYS_RES_IOPORT, - &sc->rid_ioport, 0ul, ~0ul, ports, RF_ACTIVE); + sc->res_ioport = bus_alloc_resource_anywhere(device, SYS_RES_IOPORT, + &sc->rid_ioport, ports, RF_ACTIVE); if (sc->res_ioport == NULL) goto errexit; diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c index 4975fd53726b..d6ccae9ea5b9 100644 --- a/sys/dev/xe/if_xe.c +++ b/sys/dev/xe/if_xe.c @@ -1964,8 +1964,8 @@ xe_activate(device_t dev) if (!sc->modem) { sc->port_rid = 0; /* 0 is managed by pccard */ - sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->port_rid, 0ul, ~0ul, 16, RF_ACTIVE); + sc->port_res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->port_rid, 16, RF_ACTIVE); } else if (sc->dingo) { /* * Find a 16 byte aligned ioport for the card. @@ -1998,8 +1998,8 @@ xe_activate(device_t dev) */ DEVPRINTF(1, (dev, "Finding I/O port for CEM2/CEM3\n")); sc->ce2_port_rid = 0; /* 0 is managed by pccard */ - sc->ce2_port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->ce2_port_rid, 0ul, ~0ul, 8, RF_ACTIVE); + sc->ce2_port_res = bus_alloc_resource_anywhere(dev, + SYS_RES_IOPORT, &sc->ce2_port_rid, 8, RF_ACTIVE); if (sc->ce2_port_res == NULL) { DEVPRINTF(1, (dev, "Cannot allocate I/O port for modem\n")); diff --git a/sys/i386/isa/spic.c b/sys/i386/isa/spic.c index 89ebb57e469f..2444333bfe33 100644 --- a/sys/i386/isa/spic.c +++ b/sys/i386/isa/spic.c @@ -234,8 +234,8 @@ spic_probe(device_t dev) bzero(sc, sizeof(struct spic_softc)); - if (!(sc->sc_port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->sc_port_rid, 0, ~0, 5, RF_ACTIVE))) { + if (!(sc->sc_port_res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->sc_port_rid, 5, RF_ACTIVE))) { device_printf(dev,"Couldn't map I/O\n"); return ENXIO; } diff --git a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c index 634eb543123c..f3c43097a6c6 100644 --- a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c +++ b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c @@ -615,8 +615,8 @@ bt3c_pccard_attach(device_t dev) /* Allocate I/O ports */ sc->iobase_rid = 0; - sc->iobase = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->iobase_rid, - 0, ~0, 8, RF_ACTIVE); + sc->iobase = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, + &sc->iobase_rid, 8, RF_ACTIVE); if (sc->iobase == NULL) { device_printf(dev, "Could not allocate I/O ports\n"); goto bad; diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index d128658bf222..3e793680ea2b 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -795,7 +795,7 @@ sioprobe(dev, xrid, rclk, noprobe) } else if (iod.if_type == COM_IF_MODEM_CARD || iod.if_type == COM_IF_RSA98III || isa_get_vendorid(dev)) { - port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, + port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE); } else { port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, @@ -803,8 +803,8 @@ sioprobe(dev, xrid, rclk, noprobe) if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE); } #else - port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0, ~0, IO_COMSIZE, RF_ACTIVE); + port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + IO_COMSIZE, RF_ACTIVE); #endif if (!port) return (ENXIO); @@ -1384,7 +1384,7 @@ sioattach(dev, xrid, rclk) } else if (if_type == COM_IF_MODEM_CARD || if_type == COM_IF_RSA98III || isa_get_vendorid(dev)) { - port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0, + port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE); } else { port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, @@ -1392,8 +1392,8 @@ sioattach(dev, xrid, rclk) if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE); } #else - port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0, ~0, IO_COMSIZE, RF_ACTIVE); + port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, + IO_COMSIZE, RF_ACTIVE); #endif if (!port) return (ENXIO);