1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-19 15:33:56 +00:00

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
This commit is contained in:
Justin Hibbits 2016-02-27 03:38:01 +00:00
parent ac6c1372f4
commit c47476d7e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296137
48 changed files with 184 additions and 166 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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,

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -394,8 +394,8 @@ an_alloc_port(device_t dev, int rid, int size)
struct an_softc *sc = device_get_softc(dev);
struct resource *res;
res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0ul, ~0ul, size, RF_ACTIVE);
res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
size, RF_ACTIVE);
if (res) {
sc->port_rid = rid;
sc->port_res = res;
@ -413,8 +413,8 @@ int an_alloc_memory(device_t dev, int rid, int size)
struct an_softc *sc = device_get_softc(dev);
struct resource *res;
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
0ul, ~0ul, size, RF_ACTIVE);
res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid,
size, RF_ACTIVE);
if (res) {
sc->mem_rid = rid;
sc->mem_res = res;
@ -433,8 +433,8 @@ int an_alloc_aux_memory(device_t dev, int rid, int size)
struct an_softc *sc = device_get_softc(dev);
struct resource *res;
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
0ul, ~0ul, size, RF_ACTIVE);
res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid,
size, RF_ACTIVE);
if (res) {
sc->mem_aux_rid = rid;
sc->mem_aux_res = res;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -406,8 +406,8 @@ cs_alloc_port(device_t dev, int rid, int size)
struct cs_softc *sc = device_get_softc(dev);
struct resource *res;
res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0ul, ~0ul, size, RF_ACTIVE);
res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
size, RF_ACTIVE);
if (res == NULL)
return (ENOENT);
sc->port_rid = rid;

View File

@ -318,8 +318,8 @@ ct_space_map(device_t dev, struct bshw *hw,
*memhp = NULL;
port_rid = 0;
*iohp = bus_alloc_resource(dev, SYS_RES_IOPORT, &port_rid, 0ul, ~0ul,
BSHW_IOSZ, RF_ACTIVE);
*iohp = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &port_rid,
BSHW_IOSZ, RF_ACTIVE);
if (*iohp == NULL)
return ENXIO;
@ -327,8 +327,8 @@ ct_space_map(device_t dev, struct bshw *hw,
return 0;
mem_rid = 0;
*memhp = bus_alloc_resource(dev, SYS_RES_MEMORY, &mem_rid, 0ul, ~0ul,
BSHW_MEMSZ, RF_ACTIVE);
*memhp = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &mem_rid,
BSHW_MEMSZ, RF_ACTIVE);
if (*memhp == NULL) {
bus_release_resource(dev, SYS_RES_IOPORT, port_rid, *iohp);
return ENXIO;

View File

@ -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);

View File

@ -164,8 +164,8 @@ ed_alloc_port(device_t dev, int rid, int size)
struct ed_softc *sc = device_get_softc(dev);
struct resource *res;
res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0ul, ~0ul, size, RF_ACTIVE);
res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
size, RF_ACTIVE);
if (res) {
sc->port_res = res;
sc->port_used = size;
@ -185,8 +185,8 @@ ed_alloc_memory(device_t dev, int rid, int size)
struct ed_softc *sc = device_get_softc(dev);
struct resource *res;
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
0ul, ~0ul, size, RF_ACTIVE);
res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid,
size, RF_ACTIVE);
if (res) {
sc->mem_res = res;
sc->mem_used = size;

View File

@ -89,8 +89,8 @@ fdc_isa_alloc_resources(device_t dev, struct fdc_data *fdc)
nport = isa_get_logicalid(dev) ? 1 : 6;
for (rid = 0; ; rid++) {
newrid = rid;
res = bus_alloc_resource(dev, SYS_RES_IOPORT, &newrid,
0ul, ~0ul, rid == 0 ? nport : 1, RF_ACTIVE);
res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &newrid,
rid == 0 ? nport : 1, RF_ACTIVE);
if (res == NULL)
break;
/*

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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");

View File

@ -209,7 +209,7 @@ le_isa_probe_legacy(device_t dev, const struct le_isa_param *leip)
sc = &lesc->sc_am7990.lsc;
i = 0;
lesc->sc_rres = bus_alloc_resource(dev, SYS_RES_IOPORT, &i, 0, ~0,
lesc->sc_rres = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &i,
leip->iosize, RF_ACTIVE);
if (lesc->sc_rres == NULL)
return (ENXIO);
@ -282,8 +282,8 @@ le_isa_attach(device_t dev)
for (i = 0; i < sizeof(le_isa_params) /
sizeof(le_isa_params[0]); i++) {
if (le_isa_probe_legacy(dev, &le_isa_params[i]) == 0) {
lesc->sc_rres = bus_alloc_resource(dev,
SYS_RES_IOPORT, &j, 0, ~0,
lesc->sc_rres = bus_alloc_resource_anywhere(dev,
SYS_RES_IOPORT, &j,
le_isa_params[i].iosize, RF_ACTIVE);
rap = le_isa_params[i].rap;
rdp = le_isa_params[i].rdp;

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -693,8 +693,8 @@ pccard_function_enable(struct pccard_function *pf)
}
if (tmp == NULL) {
pf->ccr_rid = 0;
pf->ccr_res = bus_alloc_resource(dev, SYS_RES_MEMORY,
&pf->ccr_rid, 0, ~0, PCCARD_MEM_PAGE_SIZE, RF_ACTIVE);
pf->ccr_res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY,
&pf->ccr_rid, PCCARD_MEM_PAGE_SIZE, RF_ACTIVE);
if (!pf->ccr_res)
goto bad;
DEVPRINTF((dev, "ccr_res == %#lx-%#lx, base=%#x\n",

View File

@ -140,7 +140,7 @@ pccard_scan_cis(device_t bus, device_t dev, pccard_scan_t fct, void *arg)
* would make cards work better, but it is easy enough to test.
*/
rid = 0;
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0,
res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid,
PCCARD_CIS_SIZE, RF_ACTIVE | rman_make_alignment_flags(64*1024));
if (res == NULL) {
device_printf(dev, "can't alloc memory to read attributes\n");

View File

@ -577,14 +577,14 @@ pcib_setup_secbus(device_t dev, struct pcib_secbus *bus, int min_count)
* if one exists, or a new bus range if one does not.
*/
rid = 0;
bus->res = bus_alloc_resource(dev, PCI_RES_BUS, &rid, 0ul, ~0ul,
bus->res = bus_alloc_resource_anywhere(dev, PCI_RES_BUS, &rid,
min_count, 0);
if (bus->res == NULL) {
/*
* Fall back to just allocating a range of a single bus
* number.
*/
bus->res = bus_alloc_resource(dev, PCI_RES_BUS, &rid, 0ul, ~0ul,
bus->res = bus_alloc_resource_anywhere(dev, PCI_RES_BUS, &rid,
1, 0);
} else if (rman_get_size(bus->res) < min_count)
/*

View File

@ -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");

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -129,8 +129,8 @@ scc_bfe_attach(device_t dev, u_int ipc)
* Re-allocate. We expect that the softc contains the information
* collected by scc_bfe_probe() intact.
*/
sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid,
0, ~0, cl->cl_channels * size, RF_ACTIVE);
sc->sc_rres = bus_alloc_resource_anywhere(dev, sc->sc_rtype,
&sc->sc_rrid, cl->cl_channels * size, RF_ACTIVE);
if (sc->sc_rres == NULL)
return (ENXIO);
sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres);
@ -378,13 +378,13 @@ scc_bfe_probe(device_t dev, u_int regshft, u_int rclk, u_int rid)
*/
sc->sc_rrid = rid;
sc->sc_rtype = SYS_RES_MEMORY;
sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid,
0, ~0, cl->cl_channels * size, RF_ACTIVE);
sc->sc_rres = bus_alloc_resource_anywhere(dev, sc->sc_rtype,
&sc->sc_rrid, cl->cl_channels * size, RF_ACTIVE);
if (sc->sc_rres == NULL) {
sc->sc_rrid = rid;
sc->sc_rtype = SYS_RES_IOPORT;
sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype,
&sc->sc_rrid, 0, ~0, cl->cl_channels * size, RF_ACTIVE);
sc->sc_rres = bus_alloc_resource_anywhere(dev, sc->sc_rtype,
&sc->sc_rrid, cl->cl_channels * size, RF_ACTIVE);
if (sc->sc_rres == NULL)
return (ENXIO);
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -1289,8 +1289,8 @@ mss_probe(device_t dev)
mss->irq_rid = 0;
mss->drq1_rid = 0;
mss->drq2_rid = -1;
mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &mss->io_rid,
0, ~0, 8, RF_ACTIVE);
mss->io_base = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT,
&mss->io_rid, 8, RF_ACTIVE);
if (!mss->io_base) {
BVDDB(printf("mss_probe: no address given, try 0x%x\n", 0x530));
mss->io_rid = 0;
@ -1298,8 +1298,9 @@ mss_probe(device_t dev)
setres = 1;
bus_set_resource(dev, SYS_RES_IOPORT, mss->io_rid,
0x530, 8);
mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &mss->io_rid,
0, ~0, 8, RF_ACTIVE);
mss->io_base = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT,
&mss->io_rid,
8, RF_ACTIVE);
}
if (!mss->io_base) goto no;
@ -2091,8 +2092,8 @@ opti_init(device_t dev, struct mss_info *mss)
return ENXIO;
if (!mss->io_base)
mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT,
&mss->io_rid, 0, ~0, 8, RF_ACTIVE);
mss->io_base = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT,
&mss->io_rid, 8, RF_ACTIVE);
if (!mss->io_base) /* No hint specified, use 0x530 */
mss->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT,
@ -2275,8 +2276,9 @@ guspcm_attach(device_t dev)
if (flags & DV_F_DUAL_DMA)
mss->drq2_rid = 0;
mss->conf_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &mss->conf_rid,
0, ~0, 8, RF_ACTIVE);
mss->conf_base = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT,
&mss->conf_rid,
8, RF_ACTIVE);
if (mss->conf_base == NULL) {
mss_release_resources(mss, dev);

View File

@ -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);

View File

@ -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");

View File

@ -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;

View File

@ -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"));

View File

@ -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;
}

View File

@ -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;

View File

@ -795,7 +795,7 @@ sioprobe(dev, xrid, rclk, noprobe)
} else if (iod.if_type == COM_IF_MODEM_CARD ||
iod.if_type == COM_IF_RSA98III ||
isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE);
} else {
port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid,
@ -803,8 +803,8 @@ sioprobe(dev, xrid, rclk, noprobe)
if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE);
}
#else
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, IO_COMSIZE, RF_ACTIVE);
port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
IO_COMSIZE, RF_ACTIVE);
#endif
if (!port)
return (ENXIO);
@ -1384,7 +1384,7 @@ sioattach(dev, xrid, rclk)
} else if (if_type == COM_IF_MODEM_CARD ||
if_type == COM_IF_RSA98III ||
isa_get_vendorid(dev)) {
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE);
} else {
port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid,
@ -1392,8 +1392,8 @@ sioattach(dev, xrid, rclk)
if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE);
}
#else
port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
0, ~0, IO_COMSIZE, RF_ACTIVE);
port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid,
IO_COMSIZE, RF_ACTIVE);
#endif
if (!port)
return (ENXIO);