More conversions of drivers to use the PCI parent DMA tag.

This commit is contained in:
Scott Long 2012-03-12 18:15:08 +00:00
parent 11ca697ba5
commit 62ce43ccc8
16 changed files with 82 additions and 37 deletions

View File

@ -4492,7 +4492,8 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
/* First, setup a tag. */
ri->ri_max = count;
size = count * sizeof(tulip_desc_t);
error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(bus_get_dma_tag(dev),
32, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL,
&ri->ri_ring_tag);
if (error) {
@ -4520,7 +4521,7 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
}
/* Allocate a tag for the data buffers. */
error = bus_dma_tag_create(NULL, align, 0,
error = bus_dma_tag_create(bus_get_dma_tag(dev), align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag);
if (error) {
@ -4600,7 +4601,7 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc)
/*
* Allocate a DMA tag, memory, and map for setup descriptor
*/
error = bus_dma_tag_create(NULL, 32, 0,
error = bus_dma_tag_create(bus_get_dma_tag(dev), 32, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0,
NULL, NULL, &sc->tulip_setup_tag);

View File

@ -397,7 +397,7 @@ glxsb_dma_alloc(struct glxsb_softc *sc)
dma->dma_size = GLXSB_MAX_AES_LEN * 2;
/* Setup DMA descriptor area */
rc = bus_dma_tag_create(NULL, /* parent */
rc = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), /* parent */
SB_AES_ALIGN, 0, /* alignments, bounds */
BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */

View File

@ -1722,7 +1722,7 @@ hatm_attach(device_t dev)
/*
* ALlocate a DMA tag for subsequent allocations
*/
if (bus_dma_tag_create(NULL, 1, 0,
if (bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL,
BUS_SPACE_MAXSIZE_32BIT, 1,
@ -1751,7 +1751,7 @@ hatm_attach(device_t dev)
* but this would not work. So make the maximum number of TPDs
* occupied by one packet a configuration parameter.
*/
if (bus_dma_tag_create(NULL, 1, 0,
if (bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
HE_MAX_PDU, 3 * HE_CONFIG_MAX_TPD_PER_PACKET, HE_MAX_PDU, 0,
NULL, NULL, &sc->tx_tag)) {

View File

@ -527,10 +527,22 @@ ipw_dma_alloc(struct ipw_softc *sc)
bus_addr_t physaddr;
int error, i;
/*
* Allocate parent DMA tag for subsequent allocations.
*/
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_UNRESTRICTED,
BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->parent_dmat);
if (error != 0) {
device_printf(sc->sc_dev, "could not create parent DMA tag\n");
goto fail;
}
/*
* Allocate and map tx ring.
*/
error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, IPW_TBD_SZ, 1, IPW_TBD_SZ, 0, NULL,
NULL, &sc->tbd_dmat);
if (error != 0) {
@ -556,7 +568,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
/*
* Allocate and map rx ring.
*/
error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, IPW_RBD_SZ, 1, IPW_RBD_SZ, 0, NULL,
NULL, &sc->rbd_dmat);
if (error != 0) {
@ -582,7 +594,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
/*
* Allocate and map status ring.
*/
error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(sc->parent_dmat, 4, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, IPW_STATUS_SZ, 1, IPW_STATUS_SZ, 0,
NULL, NULL, &sc->status_dmat);
if (error != 0) {
@ -611,7 +623,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
/*
* Allocate command DMA map.
*/
error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, sizeof (struct ipw_cmd), 1,
sizeof (struct ipw_cmd), 0, NULL, NULL, &sc->cmd_dmat);
if (error != 0) {
@ -629,7 +641,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
/*
* Allocate headers DMA maps.
*/
error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, sizeof (struct ipw_hdr), 1,
sizeof (struct ipw_hdr), 0, NULL, NULL, &sc->hdr_dmat);
if (error != 0) {
@ -652,7 +664,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
/*
* Allocate tx buffers DMA maps.
*/
error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, IPW_MAX_NSEG, MCLBYTES, 0,
NULL, NULL, &sc->txbuf_dmat);
if (error != 0) {
@ -684,7 +696,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
/*
* Pre-allocate rx buffers and DMA maps.
*/
error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(sc->parent_dmat, 1, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, MCLBYTES, 0, NULL,
NULL, &sc->rxbuf_dmat);
if (error != 0) {
@ -741,6 +753,10 @@ ipw_release(struct ipw_softc *sc)
struct ipw_soft_buf *sbuf;
int i;
if (sc->parent_dmat != NULL) {
bus_dma_tag_destroy(sc->parent_dmat);
}
if (sc->tbd_dmat != NULL) {
if (sc->stbd_list != NULL) {
bus_dmamap_unload(sc->tbd_dmat, sc->tbd_map);

View File

@ -117,6 +117,7 @@ struct ipw_softc {
int sc_tx_timer;
int sc_scan_timer;
bus_dma_tag_t parent_dmat;
bus_dma_tag_t tbd_dmat;
bus_dma_tag_t rbd_dmat;
bus_dma_tag_t status_dmat;

View File

@ -1421,7 +1421,7 @@ ixgb_dma_malloc(struct adapter * adapter, bus_size_t size,
int r;
dev = adapter->dev;
r = bus_dma_tag_create(NULL, /* parent */
r = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
PAGE_SIZE, 0, /* alignment, bounds */
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
@ -1513,7 +1513,7 @@ ixgb_setup_transmit_structures(struct adapter * adapter)
/*
* Setup DMA descriptor areas.
*/
if (bus_dma_tag_create(NULL, /* parent */
if (bus_dma_tag_create(bus_get_dma_tag(adapter->dev), /* parent */
PAGE_SIZE, 0, /* alignment, bounds */
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
@ -1851,7 +1851,7 @@ ixgb_allocate_receive_structures(struct adapter * adapter)
bzero(adapter->rx_buffer_area,
sizeof(struct ixgb_buffer) * adapter->num_rx_desc);
error = bus_dma_tag_create(NULL, /* parent */
error = bus_dma_tag_create(bus_get_dma_tag(adapter->dev),/* parent */
PAGE_SIZE, 0, /* alignment, bounds */
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */

View File

@ -2879,7 +2879,8 @@ ixgbe_allocate_transmit_buffers(struct tx_ring *txr)
/*
* Setup DMA descriptor areas.
*/
if ((error = bus_dma_tag_create(NULL, /* parent */
if ((error = bus_dma_tag_create(
bus_get_dma_tag(adapter->dev), /* parent */
1, 0, /* alignment, bounds */
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */

View File

@ -2158,7 +2158,8 @@ ixv_allocate_transmit_buffers(struct tx_ring *txr)
/*
* Setup DMA descriptor areas.
*/
if ((error = bus_dma_tag_create(NULL, /* parent */
if ((error = bus_dma_tag_create(
bus_get_dma_tag(adapter->dev), /* parent */
1, 0, /* alignment, bounds */
BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */

View File

@ -2621,7 +2621,8 @@ create_ring(softc_t *sc, struct desc_ring *ring, int num_descs)
#ifdef __FreeBSD__
/* Create a DMA tag for descriptors and buffers. */
if ((error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT,
if ((error = bus_dma_tag_create(bus_get_dma_tag(sc->dev),
4, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE, 2, PAGE_SIZE, BUS_DMA_ALLOCNOW,
# if (__FreeBSD_version >= 502000)
NULL, NULL,

View File

@ -439,7 +439,7 @@ mge_alloc_desc_dma(struct mge_softc *sc, struct mge_desc_wrapper* tab,
tab[size - 1].mge_desc->next_desc = desc_paddr;
/* Allocate a busdma tag for mbufs. */
error = bus_dma_tag_create(NULL, /* parent */
error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), /* parent */
8, 0, /* alignment, boundary */
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
@ -477,7 +477,7 @@ mge_allocate_dma(struct mge_softc *sc)
int i;
/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
error = bus_dma_tag_create(NULL, /* parent */
error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), /* parent */
16, 0, /* alignment, boundary */
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */

View File

@ -4662,7 +4662,7 @@ mxge_attach(device_t dev)
goto abort_with_nothing;
}
err = bus_dma_tag_create(NULL, /* parent */
err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
1, /* alignment */
0, /* boundary */
BUS_SPACE_MAXADDR, /* low */

View File

@ -371,7 +371,8 @@ nve_attach(device_t dev)
goto fail;
}
/* Allocate DMA tags */
error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(bus_get_dma_tag(dev),
4, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES * NV_MAX_FRAGS,
NV_MAX_FRAGS, MCLBYTES, 0,
busdma_lock_mutex, &Giant,
@ -380,7 +381,8 @@ nve_attach(device_t dev)
device_printf(dev, "couldn't allocate dma tag\n");
goto fail;
}
error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(bus_get_dma_tag(dev),
4, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL,
sizeof(struct nve_rx_desc) * RX_RING_SIZE, 1,
sizeof(struct nve_rx_desc) * RX_RING_SIZE, 0,
@ -390,7 +392,8 @@ nve_attach(device_t dev)
device_printf(dev, "couldn't allocate dma tag\n");
goto fail;
}
error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT,
error = bus_dma_tag_create(bus_get_dma_tag(dev),
4, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL,
sizeof(struct nve_tx_desc) * TX_RING_SIZE, 1,
sizeof(struct nve_tx_desc) * TX_RING_SIZE, 0,

View File

@ -404,7 +404,7 @@ patm_attach(device_t dev)
* Don't use BUS_DMA_ALLOCNOW, because we never need bouncing with
* bus_dmamem_alloc()
*/
error = bus_dma_tag_create(NULL, PAGE_SIZE, 0,
error = bus_dma_tag_create(bus_get_dma_tag(dev), PAGE_SIZE, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL, sizeof(struct patm_scd), 1,
sizeof(struct patm_scd), 0, NULL, NULL, &sc->scd_tag);
@ -774,7 +774,8 @@ patm_sq_init(struct patm_softc *sc)
* Don't use BUS_DMA_ALLOCNOW, because we never need bouncing with
* bus_dmamem_alloc()
*/
error = bus_dma_tag_create(NULL, PATM_SQ_ALIGNMENT, 0,
error = bus_dma_tag_create(bus_get_dma_tag(sc->dev),
PATM_SQ_ALIGNMENT, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL, sc->sq_size, 1, sc->sq_size,
0, NULL, NULL, &sc->sq_tag);
@ -827,7 +828,7 @@ patm_rbuf_init(struct patm_softc *sc)
* Don't use BUS_DMA_ALLOCNOW, because we never need bouncing with
* bus_dmamem_alloc()
*/
if ((error = bus_dma_tag_create(NULL, PAGE_SIZE, 0,
if ((error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), PAGE_SIZE, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
SMBUF_PAGE_SIZE, 1, SMBUF_PAGE_SIZE, 0,
NULL, NULL, &sc->sbuf_tag)) != 0) {
@ -855,7 +856,7 @@ patm_rbuf_init(struct patm_softc *sc)
* maps using one tag. Rather use BUS_DMA_NOWAIT when loading the map
* to prevent EINPROGRESS.
*/
if ((error = bus_dma_tag_create(NULL, 4, 0,
if ((error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 4, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
MCLBYTES, 1, MCLBYTES, 0,
NULL, NULL, &sc->lbuf_tag)) != 0) {
@ -900,7 +901,7 @@ patm_txmap_init(struct patm_softc *sc)
struct patm_txmap *map;
/* get transmission tag */
error = bus_dma_tag_create(NULL, 1, 0,
error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL, 65536, IDT_SCQ_SIZE - 1, 65536,
0, NULL, NULL, &sc->tx_tag);

View File

@ -288,7 +288,7 @@ safe_attach(device_t dev)
/*
* Setup DMA descriptor area.
*/
if (bus_dma_tag_create(NULL, /* parent */
if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
1, /* alignment */
SAFE_DMA_BOUNDARY, /* boundary */
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
@ -303,7 +303,7 @@ safe_attach(device_t dev)
device_printf(dev, "cannot allocate DMA tag\n");
goto bad4;
}
if (bus_dma_tag_create(NULL, /* parent */
if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
1, /* alignment */
SAFE_MAX_DSIZE, /* boundary */
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
@ -1803,7 +1803,7 @@ safe_dma_malloc(
{
int r;
r = bus_dma_tag_create(NULL, /* parent */
r = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), /* parent */
sizeof(u_int32_t), 0, /* alignment, bounds */
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */

View File

@ -3415,6 +3415,22 @@ trm_init(u_int16_t unit, device_t dev)
pACB->tag = rman_get_bustag(pACB->iores);
pACB->bsh = rman_get_bushandle(pACB->iores);
if (bus_dma_tag_create(
/*parent_dmat*/ bus_get_dma_tag(dev),
/*alignment*/ 1,
/*boundary*/ 0,
/*lowaddr*/ BUS_SPACE_MAXADDR,
/*highaddr*/ BUS_SPACE_MAXADDR,
/*filter*/ NULL,
/*filterarg*/ NULL,
/*maxsize*/ BUS_SPACE_MAXSIZE_32BIT,
/*nsegments*/ BUS_SPACE_UNRESTRICTED,
/*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT,
/*flags*/ 0,
/*lockfunc*/ NULL,
/*lockarg*/ NULL,
/* dmat */ &pACB->parent_dmat) != 0)
goto bad;
if (bus_dma_tag_create(
/*parent_dmat*/ pACB->parent_dmat,
/*alignment*/ 1,
/*boundary*/ 0,
@ -3458,7 +3474,9 @@ trm_init(u_int16_t unit, device_t dev)
TRM_MAX_SRB_CNT * sizeof(TRM_SRB), trm_mapSRB, pACB,
/* flags */0);
/* Create, allocate, and map DMA buffers for autosense data */
if (bus_dma_tag_create(/*parent_dmat*/NULL, /*alignment*/1,
if (bus_dma_tag_create(
/*parent_dmat*/pACB->parent_dmat,
/*alignment*/1,
/*boundary*/0,
/*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
/*highaddr*/BUS_SPACE_MAXADDR,
@ -3495,7 +3513,7 @@ trm_init(u_int16_t unit, device_t dev)
}
bzero(pACB->pFreeSRB, TRM_MAX_SRB_CNT * sizeof(TRM_SRB));
if (bus_dma_tag_create(
/*parent_dmat*/NULL,
/*parent_dmat*/pACB->parent_dmat,
/*alignment*/ 1,
/*boundary*/ 0,
/*lowaddr*/ BUS_SPACE_MAXADDR,
@ -3546,6 +3564,8 @@ trm_init(u_int16_t unit, device_t dev)
bus_dma_tag_destroy(pACB->srb_dmat);
if (pACB->buffer_dmat)
bus_dma_tag_destroy(pACB->buffer_dmat);
if (pACB->parent_dmat)
bus_dma_tag_destroy(pACB->parent_dmat);
return (NULL);
}

View File

@ -369,7 +369,7 @@ ubsec_attach(device_t dev)
/*
* Setup DMA descriptor area.
*/
if (bus_dma_tag_create(NULL, /* parent */
if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
1, 0, /* alignment, bounds */
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
@ -1855,7 +1855,7 @@ ubsec_dma_malloc(
int r;
/* XXX could specify sc_dmat as parent but that just adds overhead */
r = bus_dma_tag_create(NULL, /* parent */
r = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), /* parent */
1, 0, /* alignment, bounds */
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */