Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148054242
D5370.1785231682.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
50 KB
Referenced Files
None
Subscribers
None
D5370.1785231682.diff
View Options
Index: share/man/man9/bus_alloc_resource.9
===================================================================
--- share/man/man9/bus_alloc_resource.9
+++ share/man/man9/bus_alloc_resource.9
@@ -34,6 +34,7 @@
.Sh NAME
.Nm bus_alloc_resource ,
.Nm bus_alloc_resource_any
+.Nm bus_alloc_resource_anywhere
.Nd allocate resources from a parent bus
.Sh SYNOPSIS
.In sys/param.h
@@ -49,6 +50,10 @@
.Fc
.Ft struct resource *
.Fn bus_alloc_resource_any "device_t dev" "int type" "int *rid" "u_int flags"
+.Fc
+.Ft struct resource *
+.Fn bus_alloc_resource_anywhere
+.Fa "device_t dev" "int type" "int *rid" "rman_res_t count" "u_int flags"
.Sh DESCRIPTION
This is an easy interface to the resource-management functions.
It hides the indirection through the parent's method table.
@@ -57,9 +62,12 @@
.Pp
The
.Fn bus_alloc_resource_any
-function is a convenience wrapper for
+and
+.Fn bus_alloc_resource_anywhere
+functions are convenience wrappers for
.Fn bus_alloc_resource .
-It sets the values for
+.Fn bus_alloc_resource_any
+sets
.Fa start ,
.Fa end ,
and
@@ -67,6 +75,14 @@
to the default resource (see description of
.Fa start
below).
+.Fn bus_alloc_resource_anywhere
+sets
+.Fa start
+and
+.Fa end
+to the default resource and uses the provided
+.Fa count
+argument.
.Pp
The arguments are as follows:
.Bl -item
Index: sys/arm/xscale/i8134x/uart_bus_i81342.c
===================================================================
--- sys/arm/xscale/i8134x/uart_bus_i81342.c
+++ sys/arm/xscale/i8134x/uart_bus_i81342.c
@@ -74,8 +74,8 @@
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);
Index: sys/dev/aac/aac.c
===================================================================
--- sys/dev/aac/aac.c
+++ sys/dev/aac/aac.c
@@ -1780,8 +1780,8 @@
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);
Index: sys/dev/aacraid/aacraid.c
===================================================================
--- sys/dev/aacraid/aacraid.c
+++ sys/dev/aacraid/aacraid.c
@@ -1663,9 +1663,9 @@
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,
Index: sys/dev/aha/aha_isa.c
===================================================================
--- sys/dev/aha/aha_isa.c
+++ sys/dev/aha/aha_isa.c
@@ -120,8 +120,8 @@
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->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;
Index: sys/dev/aic/aic_isa.c
===================================================================
--- sys/dev/aic/aic_isa.c
+++ sys/dev/aic/aic_isa.c
@@ -75,8 +75,8 @@
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);
Index: sys/dev/aic/aic_pccard.c
===================================================================
--- sys/dev/aic/aic_pccard.c
+++ sys/dev/aic/aic_pccard.c
@@ -77,8 +77,8 @@
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);
Index: sys/dev/amdsbwd/amdsbwd.c
===================================================================
--- sys/dev/amdsbwd/amdsbwd.c
+++ sys/dev/amdsbwd/amdsbwd.c
@@ -395,7 +395,7 @@
return (ENXIO);
}
rid = 0;
- res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul,
+ res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
AMDSB_PMIO_WIDTH, RF_ACTIVE | RF_SHAREABLE);
if (res == NULL) {
device_printf(dev, "bus_alloc_resource for IO failed\n");
Index: sys/dev/an/if_an.c
===================================================================
--- sys/dev/an/if_an.c
+++ sys/dev/an/if_an.c
@@ -394,8 +394,8 @@
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 @@
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 @@
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;
Index: sys/dev/arcmsr/arcmsr.c
===================================================================
--- sys/dev/arcmsr/arcmsr.c
+++ sys/dev/arcmsr/arcmsr.c
@@ -4143,7 +4143,7 @@
u_int32_t rid0 = PCIR_BAR(0);
vm_offset_t mem_base0;
- acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0ul, ~0ul, 0x1000, RF_ACTIVE);
+ acb->sys_res_arcmsr[0] = bus_alloc_resource_anywhere(dev,SYS_RES_MEMORY, &rid0, 0x1000, RF_ACTIVE);
if(acb->sys_res_arcmsr[0] == NULL) {
arcmsr_free_resource(acb);
printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev));
@@ -4177,11 +4177,11 @@
size = sizeof(struct HBB_DOORBELL);
for(i=0; i < 2; i++) {
if(i == 0) {
- acb->sys_res_arcmsr[i] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid[i],
- 0ul, ~0ul, size, RF_ACTIVE);
+ acb->sys_res_arcmsr[i] = bus_alloc_resource_anywhere(dev,SYS_RES_MEMORY, &rid[i],
+ size, RF_ACTIVE);
} else {
- acb->sys_res_arcmsr[i] = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid[i],
- 0ul, ~0ul, sizeof(struct HBB_RWBUFFER), RF_ACTIVE);
+ acb->sys_res_arcmsr[i] = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid[i],
+ sizeof(struct HBB_RWBUFFER), RF_ACTIVE);
}
if(acb->sys_res_arcmsr[i] == NULL) {
arcmsr_free_resource(acb);
@@ -4224,7 +4224,7 @@
u_int32_t rid0 = PCIR_BAR(1);
vm_offset_t mem_base0;
- acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0ul, ~0ul, sizeof(struct HBC_MessageUnit), RF_ACTIVE);
+ acb->sys_res_arcmsr[0] = bus_alloc_resource_anywhere(dev,SYS_RES_MEMORY, &rid0, sizeof(struct HBC_MessageUnit), RF_ACTIVE);
if(acb->sys_res_arcmsr[0] == NULL) {
arcmsr_free_resource(acb);
printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev));
@@ -4251,7 +4251,7 @@
u_int32_t rid0 = PCIR_BAR(0);
vm_offset_t mem_base0;
- acb->sys_res_arcmsr[0] = bus_alloc_resource(dev,SYS_RES_MEMORY, &rid0, 0ul, ~0ul, sizeof(struct HBD_MessageUnit), RF_ACTIVE);
+ acb->sys_res_arcmsr[0] = bus_alloc_resource_anywhere(dev,SYS_RES_MEMORY, &rid0, sizeof(struct HBD_MessageUnit), RF_ACTIVE);
if(acb->sys_res_arcmsr[0] == NULL) {
arcmsr_free_resource(acb);
printf("arcmsr%d: bus_alloc_resource failure!\n", device_get_unit(dev));
Index: sys/dev/ata/ata-card.c
===================================================================
--- sys/dev/ata/ata-card.c
+++ sys/dev/ata/ata-card.c
@@ -98,8 +98,8 @@
/* 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 @@
}
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;
Index: sys/dev/ata/ata-cbus.c
===================================================================
--- sys/dev/ata/ata-cbus.c
+++ sys/dev/ata/ata-cbus.c
@@ -75,8 +75,8 @@
/* 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 @@
/* 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;
Index: sys/dev/ata/ata-isa.c
===================================================================
--- sys/dev/ata/ata-isa.c
+++ sys/dev/ata/ata-isa.c
@@ -69,8 +69,8 @@
/* 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 @@
/* 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 @@
/* 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 @@
/* 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;
}
Index: sys/dev/cm/if_cm_isa.c
===================================================================
--- sys/dev/cm/if_cm_isa.c
+++ sys/dev/cm/if_cm_isa.c
@@ -63,8 +63,8 @@
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 @@
}
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);
Index: sys/dev/cs/if_cs.c
===================================================================
--- sys/dev/cs/if_cs.c
+++ sys/dev/cs/if_cs.c
@@ -406,8 +406,8 @@
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;
Index: sys/dev/ct/ct_isa.c
===================================================================
--- sys/dev/ct/ct_isa.c
+++ sys/dev/ct/ct_isa.c
@@ -318,8 +318,8 @@
*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 @@
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;
Index: sys/dev/digi/digi_isa.c
===================================================================
--- sys/dev/digi/digi_isa.c
+++ sys/dev/digi/digi_isa.c
@@ -277,8 +277,8 @@
/* 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 @@
/* 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 @@
/* 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 @@
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);
Index: sys/dev/ed/if_ed.c
===================================================================
--- sys/dev/ed/if_ed.c
+++ sys/dev/ed/if_ed.c
@@ -164,8 +164,8 @@
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 @@
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;
Index: sys/dev/fdc/fdc_isa.c
===================================================================
--- sys/dev/fdc/fdc_isa.c
+++ sys/dev/fdc/fdc_isa.c
@@ -89,8 +89,8 @@
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;
/*
Index: sys/dev/fe/if_fe.c
===================================================================
--- sys/dev/fe/if_fe.c
+++ sys/dev/fe/if_fe.c
@@ -881,8 +881,8 @@
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;
Index: sys/dev/hpt27xx/hpt27xx_os_bsd.c
===================================================================
--- sys/dev/hpt27xx/hpt27xx_os_bsd.c
+++ sys/dev/hpt27xx/hpt27xx_os_bsd.c
@@ -120,13 +120,13 @@
if (base & 1) {
hba->pcibar[index].type = SYS_RES_IOPORT;
- hba->pcibar[index].res = bus_alloc_resource(hba->pcidev,
- hba->pcibar[index].type, &hba->pcibar[index].rid, 0, ~0, length, RF_ACTIVE);
+ hba->pcibar[index].res = bus_alloc_resource_anywhere(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, length, RF_ACTIVE);
hba->pcibar[index].base = (void *)(unsigned long)(base & ~0x1);
} else {
hba->pcibar[index].type = SYS_RES_MEMORY;
- hba->pcibar[index].res = bus_alloc_resource(hba->pcidev,
- hba->pcibar[index].type, &hba->pcibar[index].rid, 0, ~0, length, RF_ACTIVE);
+ hba->pcibar[index].res = bus_alloc_resource_anywhere(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, length, RF_ACTIVE);
hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset;
}
Index: sys/dev/hptmv/entry.c
===================================================================
--- sys/dev/hptmv/entry.c
+++ sys/dev/hptmv/entry.c
@@ -1304,8 +1304,9 @@
/* also map EPROM address */
rid = 0x10;
- if (!(pAdapter->mem_res = bus_alloc_resource(pAdapter->hpt_dev, SYS_RES_MEMORY, &rid,
- 0, ~0, MV_SATA_PCI_BAR0_SPACE_SIZE+0x40000, RF_ACTIVE))
+ if (!(pAdapter->mem_res = bus_alloc_resource_anywhere(pAdapter->hpt_dev,
+ SYS_RES_MEMORY, &rid,
+ MV_SATA_PCI_BAR0_SPACE_SIZE+0x40000, RF_ACTIVE))
||
!(pMvSataAdapter->adapterIoBaseAddress = rman_get_virtual(pAdapter->mem_res)))
{
Index: sys/dev/hptnr/hptnr_os_bsd.c
===================================================================
--- sys/dev/hptnr/hptnr_os_bsd.c
+++ sys/dev/hptnr/hptnr_os_bsd.c
@@ -106,13 +106,13 @@
if (base & 1) {
hba->pcibar[index].type = SYS_RES_IOPORT;
- hba->pcibar[index].res = bus_alloc_resource(hba->pcidev,
- hba->pcibar[index].type, &hba->pcibar[index].rid, 0, ~0, length, RF_ACTIVE);
+ hba->pcibar[index].res = bus_alloc_resource_anywhere(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, length, RF_ACTIVE);
hba->pcibar[index].base = (void *)(unsigned long)(base & ~0x1);
} else {
hba->pcibar[index].type = SYS_RES_MEMORY;
- hba->pcibar[index].res = bus_alloc_resource(hba->pcidev,
- hba->pcibar[index].type, &hba->pcibar[index].rid, 0, ~0, length, RF_ACTIVE);
+ hba->pcibar[index].res = bus_alloc_resource_anywhere(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, length, RF_ACTIVE);
hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset;
}
Index: sys/dev/hptrr/hptrr_os_bsd.c
===================================================================
--- sys/dev/hptrr/hptrr_os_bsd.c
+++ sys/dev/hptrr/hptrr_os_bsd.c
@@ -98,8 +98,8 @@
else
hba->pcibar[index].type = SYS_RES_MEMORY;
- hba->pcibar[index].res = bus_alloc_resource(hba->pcidev,
- hba->pcibar[index].type, &hba->pcibar[index].rid, 0, ~0, length, RF_ACTIVE);
+ hba->pcibar[index].res = bus_alloc_resource_anywhere(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, length, RF_ACTIVE);
hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset;
return hba->pcibar[index].base;
Index: sys/dev/ichsmb/ichsmb_pci.c
===================================================================
--- sys/dev/ichsmb/ichsmb_pci.c
+++ sys/dev/ichsmb/ichsmb_pci.c
@@ -241,11 +241,11 @@
/* 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;
Index: sys/dev/if_ndis/if_ndis_pccard.c
===================================================================
--- sys/dev/if_ndis/if_ndis_pccard.c
+++ sys/dev/if_ndis/if_ndis_pccard.c
@@ -280,8 +280,8 @@
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,
Index: sys/dev/iicbus/iicoc.c
===================================================================
--- sys/dev/iicbus/iicoc.c
+++ sys/dev/iicbus/iicoc.c
@@ -207,8 +207,8 @@
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");
Index: sys/dev/le/if_le_isa.c
===================================================================
--- sys/dev/le/if_le_isa.c
+++ sys/dev/le/if_le_isa.c
@@ -209,7 +209,7 @@
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 @@
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;
Index: sys/dev/mse/mse_isa.c
===================================================================
--- sys/dev/mse/mse_isa.c
+++ sys/dev/mse/mse_isa.c
@@ -206,8 +206,8 @@
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 @@
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;
Index: sys/dev/nsp/nsp_pccard.c
===================================================================
--- sys/dev/nsp/nsp_pccard.c
+++ sys/dev/nsp/nsp_pccard.c
@@ -124,8 +124,9 @@
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);
Index: sys/dev/oce/oce_hw.c
===================================================================
--- sys/dev/oce/oce_hw.c
+++ sys/dev/oce/oce_hw.c
@@ -268,9 +268,8 @@
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)
Index: sys/dev/pbio/pbio.c
===================================================================
--- sys/dev/pbio/pbio.c
+++ sys/dev/pbio/pbio.c
@@ -170,8 +170,8 @@
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 @@
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);
Index: sys/dev/pccard/pccard.c
===================================================================
--- sys/dev/pccard/pccard.c
+++ sys/dev/pccard/pccard.c
@@ -693,8 +693,8 @@
}
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",
Index: sys/dev/pccard/pccard_cis.c
===================================================================
--- sys/dev/pccard/pccard_cis.c
+++ sys/dev/pccard/pccard_cis.c
@@ -140,7 +140,7 @@
* 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");
Index: sys/dev/pci/pci_pci.c
===================================================================
--- sys/dev/pci/pci_pci.c
+++ sys/dev/pci/pci_pci.c
@@ -577,14 +577,14 @@
* 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)
/*
Index: sys/dev/ppc/ppc.c
===================================================================
--- sys/dev/ppc/ppc.c
+++ sys/dev/ppc/ppc.c
@@ -1721,19 +1721,21 @@
/* 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");
Index: sys/dev/rc/rc.c
===================================================================
--- sys/dev/rc/rc.c
+++ sys/dev/rc/rc.c
@@ -242,8 +242,8 @@
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;
Index: sys/dev/rp/rp_isa.c
===================================================================
--- sys/dev/rp/rp_isa.c
+++ sys/dev/rp/rp_isa.c
@@ -194,10 +194,10 @@
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(_anywheredev, SYS_RES_IOPORT, &ctlp->io_rid[0], 0x44, RF_ACTIVE);
}
if (ctlp->io[0] == NULL) {
device_printf(dev, "rp_attach: Resource not available.\n");
Index: sys/dev/sbni/if_sbni_isa.c
===================================================================
--- sys/dev/sbni/if_sbni_isa.c
+++ sys/dev/sbni/if_sbni_isa.c
@@ -86,8 +86,9 @@
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);
Index: sys/dev/scc/scc_core.c
===================================================================
--- sys/dev/scc/scc_core.c
+++ sys/dev/scc/scc_core.c
@@ -129,8 +129,8 @@
* 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 @@
*/
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);
}
Index: sys/dev/sdhci/sdhci_pci.c
===================================================================
--- sys/dev/sdhci/sdhci_pci.c
+++ sys/dev/sdhci/sdhci_pci.c
@@ -330,8 +330,8 @@
/* Allocate memory. */
rid = PCIR_BAR(bar + i);
- sc->mem_res[i] = bus_alloc_resource(dev, SYS_RES_MEMORY,
- &rid, 0ul, ~0ul, 0x100, RF_ACTIVE);
+ sc->mem_res[i] = bus_alloc_resource_anywhere(dev,
+ SYS_RES_MEMORY, &rid, 0x100, RF_ACTIVE);
if (sc->mem_res[i] == NULL) {
device_printf(dev, "Can't allocate memory for slot %d\n", i);
continue;
Index: sys/dev/si/si_isa.c
===================================================================
--- sys/dev/si/si_isa.c
+++ sys/dev/si/si_isa.c
@@ -58,9 +58,9 @@
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;
Index: sys/dev/sio/sio.c
===================================================================
--- sys/dev/sio/sio.c
+++ sys/dev/sio/sio.c
@@ -444,8 +444,8 @@
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 @@
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);
Index: sys/dev/smc/if_smc.c
===================================================================
--- sys/dev/smc/if_smc.c
+++ sys/dev/smc/if_smc.c
@@ -234,7 +234,7 @@
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 @@
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;
Index: sys/dev/sn/if_sn.c
===================================================================
--- sys/dev/sn/if_sn.c
+++ sys/dev/sn/if_sn.c
@@ -1216,8 +1216,8 @@
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");
Index: sys/dev/snc/if_snc.c
===================================================================
--- sys/dev/snc/if_snc.c
+++ sys/dev/snc/if_snc.c
@@ -72,8 +72,8 @@
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 @@
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;
Index: sys/dev/snc/if_snc_cbus.c
===================================================================
--- sys/dev/snc/if_snc_cbus.c
+++ sys/dev/snc/if_snc_cbus.c
@@ -147,9 +147,9 @@
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;
}
Index: sys/dev/sound/isa/gusc.c
===================================================================
--- sys/dev/sound/isa/gusc.c
+++ sys/dev/sound/isa/gusc.c
@@ -495,8 +495,12 @@
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 @@
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 @@
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;
Index: sys/dev/sound/isa/mss.c
===================================================================
--- sys/dev/sound/isa/mss.c
+++ sys/dev/sound/isa/mss.c
@@ -1289,8 +1289,8 @@
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 @@
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 @@
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 @@
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);
Index: sys/dev/sound/isa/sbc.c
===================================================================
--- sys/dev/sound/isa/sbc.c
+++ sys/dev/sound/isa/sbc.c
@@ -301,8 +301,8 @@
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 @@
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);
Index: sys/dev/sound/pci/als4000.c
===================================================================
--- sys/dev/sound/pci/als4000.c
+++ sys/dev/sound/pci/als4000.c
@@ -760,8 +760,8 @@
als_resource_grab(device_t dev, struct sc_info *sc)
{
sc->regid = PCIR_BAR(0);
- sc->reg = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->regid, 0, ~0,
- ALS_CONFIG_SPACE_BYTES, RF_ACTIVE);
+ sc->reg = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &sc->regid,
+ ALS_CONFIG_SPACE_BYTES, RF_ACTIVE);
if (sc->reg == 0) {
device_printf(dev, "unable to allocate register space\n");
goto bad;
Index: sys/dev/sound/pci/cs4281.c
===================================================================
--- sys/dev/sound/pci/cs4281.c
+++ sys/dev/sound/pci/cs4281.c
@@ -778,12 +778,12 @@
sc->regid = PCIR_BAR(0);
sc->regtype = SYS_RES_MEMORY;
- sc->reg = bus_alloc_resource(dev, sc->regtype, &sc->regid,
- 0, ~0, CS4281PCI_BA0_SIZE, RF_ACTIVE);
+ sc->reg = bus_alloc_resource_anywhere(dev, sc->regtype, &sc->regid,
+ CS4281PCI_BA0_SIZE, RF_ACTIVE);
if (!sc->reg) {
sc->regtype = SYS_RES_IOPORT;
- sc->reg = bus_alloc_resource(dev, sc->regtype, &sc->regid,
- 0, ~0, CS4281PCI_BA0_SIZE, RF_ACTIVE);
+ sc->reg = bus_alloc_resource_anywhere(dev, sc->regtype, &sc->regid,
+ CS4281PCI_BA0_SIZE, RF_ACTIVE);
if (!sc->reg) {
device_printf(dev, "unable to allocate register space\n");
goto bad;
@@ -793,8 +793,8 @@
sc->sh = rman_get_bushandle(sc->reg);
sc->memid = PCIR_BAR(1);
- sc->mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->memid, 0,
- ~0, CS4281PCI_BA1_SIZE, RF_ACTIVE);
+ sc->mem = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &sc->memid,
+ CS4281PCI_BA1_SIZE, RF_ACTIVE);
if (sc->mem == NULL) {
device_printf(dev, "unable to allocate fifo space\n");
goto bad;
Index: sys/dev/sound/pci/vibes.c
===================================================================
--- sys/dev/sound/pci/vibes.c
+++ sys/dev/sound/pci/vibes.c
@@ -738,9 +738,10 @@
}
sc->enh_rid = SV_PCI_ENHANCED;
sc->enh_type = SYS_RES_IOPORT;
- sc->enh_reg = bus_alloc_resource(dev, sc->enh_type,
- &sc->enh_rid, 0, ~0,
- SV_PCI_ENHANCED_SIZE, RF_ACTIVE);
+ sc->enh_reg = bus_alloc_resource_anywhere(dev, sc->enh_type,
+ &sc->enh_rid,
+ SV_PCI_ENHANCED_SIZE,
+ RF_ACTIVE);
if (sc->enh_reg == NULL) {
device_printf(dev, "sv_attach: cannot allocate enh\n");
return ENXIO;
@@ -831,9 +832,10 @@
/* Cache resource short-cuts for dma_a */
sc->dmaa_rid = SV_PCI_DMAA;
sc->dmaa_type = SYS_RES_IOPORT;
- sc->dmaa_reg = bus_alloc_resource(dev, sc->dmaa_type,
- &sc->dmaa_rid, 0, ~0,
- SV_PCI_ENHANCED_SIZE, RF_ACTIVE);
+ sc->dmaa_reg = bus_alloc_resource_anywhere(dev, sc->dmaa_type,
+ &sc->dmaa_rid,
+ SV_PCI_ENHANCED_SIZE,
+ RF_ACTIVE);
if (sc->dmaa_reg == NULL) {
device_printf(dev, "sv_attach: cannot allocate dmaa\n");
goto fail;
@@ -850,9 +852,10 @@
/* Cache resource short-cuts for dma_c */
sc->dmac_rid = SV_PCI_DMAC;
sc->dmac_type = SYS_RES_IOPORT;
- sc->dmac_reg = bus_alloc_resource(dev, sc->dmac_type,
- &sc->dmac_rid, 0, ~0,
- SV_PCI_ENHANCED_SIZE, RF_ACTIVE);
+ sc->dmac_reg = bus_alloc_resource_anywhere(dev, sc->dmac_type,
+ &sc->dmac_rid,
+ SV_PCI_ENHANCED_SIZE,
+ RF_ACTIVE);
if (sc->dmac_reg == NULL) {
device_printf(dev, "sv_attach: cannot allocate dmac\n");
goto fail;
Index: sys/dev/tws/tws.c
===================================================================
--- sys/dev/tws/tws.c
+++ sys/dev/tws/tws.c
@@ -257,8 +257,8 @@
#ifndef TWS_PULL_MODE_ENABLE
/* Allocate bus space for inbound mfa */
sc->mfa_res_id = TWS_PCI_BAR2; /* BAR2 offset */
- if ((sc->mfa_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
- &(sc->mfa_res_id), 0, ~0, 0x100000, RF_ACTIVE))
+ if ((sc->mfa_res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY,
+ &(sc->mfa_res_id), 0x100000, RF_ACTIVE))
== NULL) {
tws_log(sc, ALLOC_MEMORY_RES);
goto attach_fail_2;
Index: sys/dev/wi/if_wi.c
===================================================================
--- sys/dev/wi/if_wi.c
+++ sys/dev/wi/if_wi.c
@@ -1995,8 +1995,8 @@
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");
Index: sys/dev/wl/if_wl.c
===================================================================
--- sys/dev/wl/if_wl.c
+++ sys/dev/wl/if_wl.c
@@ -604,8 +604,8 @@
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;
Index: sys/dev/xe/if_xe.c
===================================================================
--- sys/dev/xe/if_xe.c
+++ sys/dev/xe/if_xe.c
@@ -1964,8 +1964,8 @@
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 @@
*/
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"));
Index: sys/i386/isa/spic.c
===================================================================
--- sys/i386/isa/spic.c
+++ sys/i386/isa/spic.c
@@ -234,8 +234,8 @@
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;
}
Index: sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
===================================================================
--- sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
+++ sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c
@@ -615,8 +615,8 @@
/* 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;
Index: sys/pc98/cbus/sio.c
===================================================================
--- sys/pc98/cbus/sio.c
+++ sys/pc98/cbus/sio.c
@@ -795,7 +795,7 @@
} 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 @@
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 @@
} 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 @@
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);
Index: sys/sys/bus.h
===================================================================
--- sys/sys/bus.h
+++ sys/sys/bus.h
@@ -481,6 +481,13 @@
return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags));
}
+static __inline struct resource *
+bus_alloc_resource_anywhere(device_t dev, int type, int *rid,
+ rman_res_t count, u_int flags)
+{
+ return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, count, flags));
+}
+
/*
* Access functions for device.
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jul 28, 9:41 AM (20 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29289352
Default Alt Text
D5370.1785231682.diff (50 KB)
Attached To
Mode
D5370: Add the bus_alloc_resource_anywhere() convenience function, and use it.
Attached
Detach File
Event Timeline
Log In to Comment