Author: jhibbits
Date: Sat Feb 27 03:38:01 2016
New Revision: 296137
URL: https://svnweb.freebsd.org/changeset/base/296137

Log:
  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

Modified:
  head/sys/arm/xscale/i8134x/uart_bus_i81342.c
  head/sys/dev/aac/aac.c
  head/sys/dev/aacraid/aacraid.c
  head/sys/dev/aha/aha_isa.c
  head/sys/dev/aic/aic_isa.c
  head/sys/dev/aic/aic_pccard.c
  head/sys/dev/an/if_an.c
  head/sys/dev/ata/ata-card.c
  head/sys/dev/ata/ata-cbus.c
  head/sys/dev/ata/ata-isa.c
  head/sys/dev/cm/if_cm_isa.c
  head/sys/dev/cs/if_cs.c
  head/sys/dev/ct/ct_isa.c
  head/sys/dev/digi/digi_isa.c
  head/sys/dev/ed/if_ed.c
  head/sys/dev/fdc/fdc_isa.c
  head/sys/dev/fe/if_fe.c
  head/sys/dev/ichsmb/ichsmb_pci.c
  head/sys/dev/if_ndis/if_ndis_pccard.c
  head/sys/dev/iicbus/iicoc.c
  head/sys/dev/le/if_le_isa.c
  head/sys/dev/mse/mse_isa.c
  head/sys/dev/nsp/nsp_pccard.c
  head/sys/dev/oce/oce_hw.c
  head/sys/dev/pbio/pbio.c
  head/sys/dev/pccard/pccard.c
  head/sys/dev/pccard/pccard_cis.c
  head/sys/dev/pci/pci_pci.c
  head/sys/dev/ppc/ppc.c
  head/sys/dev/rc/rc.c
  head/sys/dev/rp/rp_isa.c
  head/sys/dev/sbni/if_sbni_isa.c
  head/sys/dev/scc/scc_core.c
  head/sys/dev/si/si_isa.c
  head/sys/dev/sio/sio.c
  head/sys/dev/smc/if_smc.c
  head/sys/dev/sn/if_sn.c
  head/sys/dev/snc/if_snc.c
  head/sys/dev/snc/if_snc_cbus.c
  head/sys/dev/sound/isa/gusc.c
  head/sys/dev/sound/isa/mss.c
  head/sys/dev/sound/isa/sbc.c
  head/sys/dev/wi/if_wi.c
  head/sys/dev/wl/if_wl.c
  head/sys/dev/xe/if_xe.c
  head/sys/i386/isa/spic.c
  head/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
  head/sys/pc98/cbus/sio.c

Modified: head/sys/arm/xscale/i8134x/uart_bus_i81342.c
==============================================================================
--- head/sys/arm/xscale/i8134x/uart_bus_i81342.c        Sat Feb 27 03:35:28 
2016        (r296136)
+++ head/sys/arm/xscale/i8134x/uart_bus_i81342.c        Sat Feb 27 03:38:01 
2016        (r296137)
@@ -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);

Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c      Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/aac/aac.c      Sat Feb 27 03:38:01 2016        (r296137)
@@ -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);

Modified: head/sys/dev/aacraid/aacraid.c
==============================================================================
--- head/sys/dev/aacraid/aacraid.c      Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/aacraid/aacraid.c      Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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,

Modified: head/sys/dev/aha/aha_isa.c
==============================================================================
--- head/sys/dev/aha/aha_isa.c  Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/aha/aha_isa.c  Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/dev/aic/aic_isa.c
==============================================================================
--- head/sys/dev/aic/aic_isa.c  Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/aic/aic_isa.c  Sat Feb 27 03:38:01 2016        (r296137)
@@ -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);

Modified: head/sys/dev/aic/aic_pccard.c
==============================================================================
--- head/sys/dev/aic/aic_pccard.c       Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/aic/aic_pccard.c       Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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);
 

Modified: head/sys/dev/an/if_an.c
==============================================================================
--- head/sys/dev/an/if_an.c     Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/an/if_an.c     Sat Feb 27 03:38:01 2016        (r296137)
@@ -394,8 +394,8 @@ an_alloc_port(device_t dev, int rid, int
        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 ri
        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, in
        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;

Modified: head/sys/dev/ata/ata-card.c
==============================================================================
--- head/sys/dev/ata/ata-card.c Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/ata/ata-card.c Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/dev/ata/ata-cbus.c
==============================================================================
--- head/sys/dev/ata/ata-cbus.c Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/ata/ata-cbus.c Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/dev/ata/ata-isa.c
==============================================================================
--- head/sys/dev/ata/ata-isa.c  Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/ata/ata-isa.c  Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;
     }

Modified: head/sys/dev/cm/if_cm_isa.c
==============================================================================
--- head/sys/dev/cm/if_cm_isa.c Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/cm/if_cm_isa.c Sat Feb 27 03:38:01 2016        (r296137)
@@ -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);

Modified: head/sys/dev/cs/if_cs.c
==============================================================================
--- head/sys/dev/cs/if_cs.c     Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/cs/if_cs.c     Sat Feb 27 03:38:01 2016        (r296137)
@@ -406,8 +406,8 @@ cs_alloc_port(device_t dev, int rid, int
        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;

Modified: head/sys/dev/ct/ct_isa.c
==============================================================================
--- head/sys/dev/ct/ct_isa.c    Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/ct/ct_isa.c    Sat Feb 27 03:38:01 2016        (r296137)
@@ -318,8 +318,8 @@ ct_space_map(device_t dev, struct bshw *
        *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 *
                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;

Modified: head/sys/dev/digi/digi_isa.c
==============================================================================
--- head/sys/dev/digi/digi_isa.c        Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/digi/digi_isa.c        Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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);

Modified: head/sys/dev/ed/if_ed.c
==============================================================================
--- head/sys/dev/ed/if_ed.c     Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/ed/if_ed.c     Sat Feb 27 03:38:01 2016        (r296137)
@@ -164,8 +164,8 @@ ed_alloc_port(device_t dev, int rid, int
        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, i
        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;

Modified: head/sys/dev/fdc/fdc_isa.c
==============================================================================
--- head/sys/dev/fdc/fdc_isa.c  Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/fdc/fdc_isa.c  Sat Feb 27 03:38:01 2016        (r296137)
@@ -89,8 +89,8 @@ fdc_isa_alloc_resources(device_t dev, st
        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;
                /*

Modified: head/sys/dev/fe/if_fe.c
==============================================================================
--- head/sys/dev/fe/if_fe.c     Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/fe/if_fe.c     Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/dev/ichsmb/ichsmb_pci.c
==============================================================================
--- head/sys/dev/ichsmb/ichsmb_pci.c    Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/ichsmb/ichsmb_pci.c    Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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;

Modified: head/sys/dev/if_ndis/if_ndis_pccard.c
==============================================================================
--- head/sys/dev/if_ndis/if_ndis_pccard.c       Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/if_ndis/if_ndis_pccard.c       Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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,

Modified: head/sys/dev/iicbus/iicoc.c
==============================================================================
--- head/sys/dev/iicbus/iicoc.c Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/iicbus/iicoc.c Sat Feb 27 03:38:01 2016        (r296137)
@@ -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");

Modified: head/sys/dev/le/if_le_isa.c
==============================================================================
--- head/sys/dev/le/if_le_isa.c Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/le/if_le_isa.c Sat Feb 27 03:38:01 2016        (r296137)
@@ -209,7 +209,7 @@ le_isa_probe_legacy(device_t dev, const 
        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;

Modified: head/sys/dev/mse/mse_isa.c
==============================================================================
--- head/sys/dev/mse/mse_isa.c  Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/mse/mse_isa.c  Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;
 

Modified: head/sys/dev/nsp/nsp_pccard.c
==============================================================================
--- head/sys/dev/nsp/nsp_pccard.c       Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/nsp/nsp_pccard.c       Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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);

Modified: head/sys/dev/oce/oce_hw.c
==============================================================================
--- head/sys/dev/oce/oce_hw.c   Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/oce/oce_hw.c   Sat Feb 27 03:38:01 2016        (r296137)
@@ -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)

Modified: head/sys/dev/pbio/pbio.c
==============================================================================
--- head/sys/dev/pbio/pbio.c    Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/pbio/pbio.c    Sat Feb 27 03:38:01 2016        (r296137)
@@ -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);

Modified: head/sys/dev/pccard/pccard.c
==============================================================================
--- head/sys/dev/pccard/pccard.c        Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/pccard/pccard.c        Sat Feb 27 03:38:01 2016        
(r296137)
@@ -693,8 +693,8 @@ pccard_function_enable(struct pccard_fun
        }
        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",

Modified: head/sys/dev/pccard/pccard_cis.c
==============================================================================
--- head/sys/dev/pccard/pccard_cis.c    Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/pccard/pccard_cis.c    Sat Feb 27 03:38:01 2016        
(r296137)
@@ -140,7 +140,7 @@ pccard_scan_cis(device_t bus, device_t d
         * 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");

Modified: head/sys/dev/pci/pci_pci.c
==============================================================================
--- head/sys/dev/pci/pci_pci.c  Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/pci/pci_pci.c  Sat Feb 27 03:38:01 2016        (r296137)
@@ -577,14 +577,14 @@ pcib_setup_secbus(device_t dev, struct p
         * 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)
                /*

Modified: head/sys/dev/ppc/ppc.c
==============================================================================
--- head/sys/dev/ppc/ppc.c      Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/ppc/ppc.c      Sat Feb 27 03:38:01 2016        (r296137)
@@ -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");

Modified: head/sys/dev/rc/rc.c
==============================================================================
--- head/sys/dev/rc/rc.c        Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/rc/rc.c        Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/dev/rp/rp_isa.c
==============================================================================
--- head/sys/dev/rp/rp_isa.c    Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/rp/rp_isa.c    Sat Feb 27 03:38:01 2016        (r296137)
@@ -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");

Modified: head/sys/dev/sbni/if_sbni_isa.c
==============================================================================
--- head/sys/dev/sbni/if_sbni_isa.c     Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/sbni/if_sbni_isa.c     Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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);

Modified: head/sys/dev/scc/scc_core.c
==============================================================================
--- head/sys/dev/scc/scc_core.c Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/scc/scc_core.c Sat Feb 27 03:38:01 2016        (r296137)
@@ -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 regshf
         */
        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);
        }

Modified: head/sys/dev/si/si_isa.c
==============================================================================
--- head/sys/dev/si/si_isa.c    Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/si/si_isa.c    Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/dev/sio/sio.c
==============================================================================
--- head/sys/dev/sio/sio.c      Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/sio/sio.c      Sat Feb 27 03:38:01 2016        (r296137)
@@ -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);
 

Modified: head/sys/dev/smc/if_smc.c
==============================================================================
--- head/sys/dev/smc/if_smc.c   Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/smc/if_smc.c   Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/dev/sn/if_sn.c
==============================================================================
--- head/sys/dev/sn/if_sn.c     Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/sn/if_sn.c     Sat Feb 27 03:38:01 2016        (r296137)
@@ -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");

Modified: head/sys/dev/snc/if_snc.c
==============================================================================
--- head/sys/dev/snc/if_snc.c   Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/snc/if_snc.c   Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/dev/snc/if_snc_cbus.c
==============================================================================
--- head/sys/dev/snc/if_snc_cbus.c      Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/snc/if_snc_cbus.c      Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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;
                }
 

Modified: head/sys/dev/sound/isa/gusc.c
==============================================================================
--- head/sys/dev/sound/isa/gusc.c       Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/sound/isa/gusc.c       Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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;

Modified: head/sys/dev/sound/isa/mss.c
==============================================================================
--- head/sys/dev/sound/isa/mss.c        Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/sound/isa/mss.c        Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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 
                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);

Modified: head/sys/dev/sound/isa/sbc.c
==============================================================================
--- head/sys/dev/sound/isa/sbc.c        Sat Feb 27 03:35:28 2016        
(r296136)
+++ head/sys/dev/sound/isa/sbc.c        Sat Feb 27 03:38:01 2016        
(r296137)
@@ -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);

Modified: head/sys/dev/wi/if_wi.c
==============================================================================
--- head/sys/dev/wi/if_wi.c     Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/wi/if_wi.c     Sat Feb 27 03:38:01 2016        (r296137)
@@ -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");

Modified: head/sys/dev/wl/if_wl.c
==============================================================================
--- head/sys/dev/wl/if_wl.c     Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/wl/if_wl.c     Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;
 

Modified: head/sys/dev/xe/if_xe.c
==============================================================================
--- head/sys/dev/xe/if_xe.c     Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/dev/xe/if_xe.c     Sat Feb 27 03:38:01 2016        (r296137)
@@ -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"));

Modified: head/sys/i386/isa/spic.c
==============================================================================
--- head/sys/i386/isa/spic.c    Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/i386/isa/spic.c    Sat Feb 27 03:38:01 2016        (r296137)
@@ -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;
        }

Modified: head/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
==============================================================================
--- head/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c   Sat Feb 27 
03:35:28 2016        (r296136)
+++ head/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c   Sat Feb 27 
03:38:01 2016        (r296137)
@@ -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;

Modified: head/sys/pc98/cbus/sio.c
==============================================================================
--- head/sys/pc98/cbus/sio.c    Sat Feb 27 03:35:28 2016        (r296136)
+++ head/sys/pc98/cbus/sio.c    Sat Feb 27 03:38:01 2016        (r296137)
@@ -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,

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to