svn commit: r296135 - in head/sys/dev: amdsbwd arcmsr hpt27xx hptmv hptnr hptrr sdhci sound/pci tws
Justin Hibbits
jhibbits at FreeBSD.org
Sat Feb 27 03:34:04 UTC 2016
Author: jhibbits
Date: Sat Feb 27 03:34:01 2016
New Revision: 296135
URL: https://svnweb.freebsd.org/changeset/base/296135
Log:
Replace several bus_alloc_resource() calls with bus_alloc_resource_any()
Most of these are BARs, and we allocate them in their entirety. The one outlier
in this is amdsbwd, which calls bus_set_resource() prior.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D5370 (partial)
Modified:
head/sys/dev/amdsbwd/amdsbwd.c
head/sys/dev/arcmsr/arcmsr.c
head/sys/dev/hpt27xx/hpt27xx_os_bsd.c
head/sys/dev/hptmv/entry.c
head/sys/dev/hptnr/hptnr_os_bsd.c
head/sys/dev/hptrr/hptrr_os_bsd.c
head/sys/dev/sdhci/sdhci_pci.c
head/sys/dev/sound/pci/als4000.c
head/sys/dev/sound/pci/cs4281.c
head/sys/dev/sound/pci/vibes.c
head/sys/dev/tws/tws.c
Modified: head/sys/dev/amdsbwd/amdsbwd.c
==============================================================================
--- head/sys/dev/amdsbwd/amdsbwd.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/amdsbwd/amdsbwd.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -395,8 +395,8 @@ amdsbwd_probe(device_t dev)
return (ENXIO);
}
rid = 0;
- res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0ul, ~0ul,
- AMDSB_PMIO_WIDTH, RF_ACTIVE | RF_SHAREABLE);
+ res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
+ RF_ACTIVE | RF_SHAREABLE);
if (res == NULL) {
device_printf(dev, "bus_alloc_resource for IO failed\n");
return (ENXIO);
Modified: head/sys/dev/arcmsr/arcmsr.c
==============================================================================
--- head/sys/dev/arcmsr/arcmsr.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/arcmsr/arcmsr.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -4143,7 +4143,7 @@ static u_int32_t arcmsr_initialize(devic
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_any(dev,SYS_RES_MEMORY, &rid0, 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 @@ static u_int32_t arcmsr_initialize(devic
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_any(dev,SYS_RES_MEMORY, &rid[i],
+ 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_any(dev, SYS_RES_MEMORY, &rid[i],
+ RF_ACTIVE);
}
if(acb->sys_res_arcmsr[i] == NULL) {
arcmsr_free_resource(acb);
@@ -4224,7 +4224,7 @@ static u_int32_t arcmsr_initialize(devic
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_any(dev,SYS_RES_MEMORY, &rid0, 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 @@ static u_int32_t arcmsr_initialize(devic
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_any(dev,SYS_RES_MEMORY, &rid0, 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));
Modified: head/sys/dev/hpt27xx/hpt27xx_os_bsd.c
==============================================================================
--- head/sys/dev/hpt27xx/hpt27xx_os_bsd.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/hpt27xx/hpt27xx_os_bsd.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -120,13 +120,13 @@ void *os_map_pci_bar(
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_any(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, 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_any(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, RF_ACTIVE);
hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset;
}
Modified: head/sys/dev/hptmv/entry.c
==============================================================================
--- head/sys/dev/hptmv/entry.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/hptmv/entry.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -1304,8 +1304,8 @@ init_adapter(IAL_ADAPTER_T *pAdapter)
/* 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_any(pAdapter->hpt_dev,
+ SYS_RES_MEMORY, &rid, RF_ACTIVE))
||
!(pMvSataAdapter->adapterIoBaseAddress = rman_get_virtual(pAdapter->mem_res)))
{
Modified: head/sys/dev/hptnr/hptnr_os_bsd.c
==============================================================================
--- head/sys/dev/hptnr/hptnr_os_bsd.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/hptnr/hptnr_os_bsd.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -106,13 +106,13 @@ void *os_map_pci_bar(
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_any(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, 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_any(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, RF_ACTIVE);
hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset;
}
Modified: head/sys/dev/hptrr/hptrr_os_bsd.c
==============================================================================
--- head/sys/dev/hptrr/hptrr_os_bsd.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/hptrr/hptrr_os_bsd.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -98,8 +98,8 @@ void *os_map_pci_bar(
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_any(hba->pcidev,
+ hba->pcibar[index].type, &hba->pcibar[index].rid, RF_ACTIVE);
hba->pcibar[index].base = (char *)rman_get_virtual(hba->pcibar[index].res) + offset;
return hba->pcibar[index].base;
Modified: head/sys/dev/sdhci/sdhci_pci.c
==============================================================================
--- head/sys/dev/sdhci/sdhci_pci.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/sdhci/sdhci_pci.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -330,8 +330,8 @@ sdhci_pci_attach(device_t dev)
/* 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_any(dev, SYS_RES_MEMORY,
+ &rid, RF_ACTIVE);
if (sc->mem_res[i] == NULL) {
device_printf(dev, "Can't allocate memory for slot %d\n", i);
continue;
Modified: head/sys/dev/sound/pci/als4000.c
==============================================================================
--- head/sys/dev/sound/pci/als4000.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/sound/pci/als4000.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -760,8 +760,8 @@ static int
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_any(dev, SYS_RES_IOPORT, &sc->regid,
+ RF_ACTIVE);
if (sc->reg == 0) {
device_printf(dev, "unable to allocate register space\n");
goto bad;
Modified: head/sys/dev/sound/pci/cs4281.c
==============================================================================
--- head/sys/dev/sound/pci/cs4281.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/sound/pci/cs4281.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -778,12 +778,11 @@ cs4281_pci_attach(device_t dev)
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_any(dev, sc->regtype, &sc->regid, 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_any(dev, sc->regtype, &sc->regid,
+ RF_ACTIVE);
if (!sc->reg) {
device_printf(dev, "unable to allocate register space\n");
goto bad;
@@ -793,8 +792,8 @@ cs4281_pci_attach(device_t dev)
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_any(dev, SYS_RES_MEMORY, &sc->memid,
+ RF_ACTIVE);
if (sc->mem == NULL) {
device_printf(dev, "unable to allocate fifo space\n");
goto bad;
Modified: head/sys/dev/sound/pci/vibes.c
==============================================================================
--- head/sys/dev/sound/pci/vibes.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/sound/pci/vibes.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -738,9 +738,8 @@ sv_attach(device_t dev) {
}
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_any(dev, sc->enh_type,
+ &sc->enh_rid, RF_ACTIVE);
if (sc->enh_reg == NULL) {
device_printf(dev, "sv_attach: cannot allocate enh\n");
return ENXIO;
@@ -831,9 +830,8 @@ sv_attach(device_t dev) {
/* 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_any(dev, sc->dmaa_type,
+ &sc->dmaa_rid, RF_ACTIVE);
if (sc->dmaa_reg == NULL) {
device_printf(dev, "sv_attach: cannot allocate dmaa\n");
goto fail;
@@ -850,9 +848,8 @@ sv_attach(device_t dev) {
/* 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_any(dev, sc->dmac_type,
+ &sc->dmac_rid, RF_ACTIVE);
if (sc->dmac_reg == NULL) {
device_printf(dev, "sv_attach: cannot allocate dmac\n");
goto fail;
Modified: head/sys/dev/tws/tws.c
==============================================================================
--- head/sys/dev/tws/tws.c Sat Feb 27 02:11:00 2016 (r296134)
+++ head/sys/dev/tws/tws.c Sat Feb 27 03:34:01 2016 (r296135)
@@ -257,8 +257,8 @@ tws_attach(device_t dev)
#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_any(dev, SYS_RES_MEMORY,
+ &(sc->mfa_res_id), RF_ACTIVE))
== NULL) {
tws_log(sc, ALLOC_MEMORY_RES);
goto attach_fail_2;
More information about the svn-src-all
mailing list