Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2012 18:15:09 +0000 (UTC)
From:      Scott Long <scottl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232874 - in head/sys/dev: de glxsb hatm ipw ixgb ixgbe lmc mge mxge nve patm safe trm ubsec
Message-ID:  <201203121815.q2CIF9Qh078435@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: scottl
Date: Mon Mar 12 18:15:08 2012
New Revision: 232874
URL: http://svn.freebsd.org/changeset/base/232874

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

Modified:
  head/sys/dev/de/if_de.c
  head/sys/dev/glxsb/glxsb.c
  head/sys/dev/hatm/if_hatm.c
  head/sys/dev/ipw/if_ipw.c
  head/sys/dev/ipw/if_ipwvar.h
  head/sys/dev/ixgb/if_ixgb.c
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/ixgbe/ixv.c
  head/sys/dev/lmc/if_lmc.c
  head/sys/dev/mge/if_mge.c
  head/sys/dev/mxge/if_mxge.c
  head/sys/dev/nve/if_nve.c
  head/sys/dev/patm/if_patm_attach.c
  head/sys/dev/safe/safe.c
  head/sys/dev/trm/trm.c
  head/sys/dev/ubsec/ubsec.c

Modified: head/sys/dev/de/if_de.c
==============================================================================
--- head/sys/dev/de/if_de.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/de/if_de.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -4492,7 +4492,8 @@ tulip_busdma_allocring(device_t dev, tul
     /* 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, tul
     }
 
     /* 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_so
     /*
      * 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);

Modified: head/sys/dev/glxsb/glxsb.c
==============================================================================
--- head/sys/dev/glxsb/glxsb.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/glxsb/glxsb.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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 */

Modified: head/sys/dev/hatm/if_hatm.c
==============================================================================
--- head/sys/dev/hatm/if_hatm.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/hatm/if_hatm.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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)) {

Modified: head/sys/dev/ipw/if_ipw.c
==============================================================================
--- head/sys/dev/ipw/if_ipw.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/ipw/if_ipw.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -528,9 +528,21 @@ ipw_dma_alloc(struct ipw_softc *sc)
 	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);

Modified: head/sys/dev/ipw/if_ipwvar.h
==============================================================================
--- head/sys/dev/ipw/if_ipwvar.h	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/ipw/if_ipwvar.h	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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;

Modified: head/sys/dev/ixgb/if_ixgb.c
==============================================================================
--- head/sys/dev/ixgb/if_ixgb.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/ixgb/if_ixgb.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -1421,7 +1421,7 @@ ixgb_dma_malloc(struct adapter * adapter
 	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 ad
 	/*
 	 * 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 
 	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 */

Modified: head/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- head/sys/dev/ixgbe/ixgbe.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/ixgbe/ixgbe.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -2879,7 +2879,8 @@ ixgbe_allocate_transmit_buffers(struct t
 	/*
 	 * 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 */

Modified: head/sys/dev/ixgbe/ixv.c
==============================================================================
--- head/sys/dev/ixgbe/ixv.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/ixgbe/ixv.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -2158,7 +2158,8 @@ ixv_allocate_transmit_buffers(struct tx_
 	/*
 	 * 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 */

Modified: head/sys/dev/lmc/if_lmc.c
==============================================================================
--- head/sys/dev/lmc/if_lmc.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/lmc/if_lmc.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -2621,7 +2621,8 @@ create_ring(softc_t *sc, struct desc_rin
 #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,

Modified: head/sys/dev/mge/if_mge.c
==============================================================================
--- head/sys/dev/mge/if_mge.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/mge/if_mge.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -439,7 +439,7 @@ mge_alloc_desc_dma(struct mge_softc *sc,
 	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 */

Modified: head/sys/dev/mxge/if_mxge.c
==============================================================================
--- head/sys/dev/mxge/if_mxge.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/mxge/if_mxge.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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 */

Modified: head/sys/dev/nve/if_nve.c
==============================================================================
--- head/sys/dev/nve/if_nve.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/nve/if_nve.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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,

Modified: head/sys/dev/patm/if_patm_attach.c
==============================================================================
--- head/sys/dev/patm/if_patm_attach.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/patm/if_patm_attach.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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);

Modified: head/sys/dev/safe/safe.c
==============================================================================
--- head/sys/dev/safe/safe.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/safe/safe.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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 */

Modified: head/sys/dev/trm/trm.c
==============================================================================
--- head/sys/dev/trm/trm.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/trm/trm.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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 @@ bad:
 		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);
 }
 

Modified: head/sys/dev/ubsec/ubsec.c
==============================================================================
--- head/sys/dev/ubsec/ubsec.c	Mon Mar 12 18:13:59 2012	(r232873)
+++ head/sys/dev/ubsec/ubsec.c	Mon Mar 12 18:15:08 2012	(r232874)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203121815.q2CIF9Qh078435>