From 3d0f3248eac46800370b58871ec49d0aa4f877f3 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 12 Sep 2008 14:41:53 +0000 Subject: [PATCH] Use the parent device's DMA tag when creating our own DMA tags. This fixes a panic on sparc64. Reviewed by: Florian Smeets flo kasimir.com --- sys/dev/tx/if_tx.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c index 5cef42ed3892..033c22bb980b 100644 --- a/sys/dev/tx/if_tx.c +++ b/sys/dev/tx/if_tx.c @@ -269,16 +269,17 @@ epic_attach(device_t dev) } /* Allocate DMA tags. */ - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES * EPIC_MAX_FRAGS, - EPIC_MAX_FRAGS, MCLBYTES, 0, NULL, NULL, &sc->mtag); + error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * EPIC_MAX_FRAGS, EPIC_MAX_FRAGS, MCLBYTES, 0, NULL, NULL, + &sc->mtag); if (error) { device_printf(dev, "couldn't allocate dma tag\n"); goto fail; } - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, + error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sizeof(struct epic_rx_desc) * RX_RING_SIZE, 1, sizeof(struct epic_rx_desc) * RX_RING_SIZE, 0, NULL, NULL, &sc->rtag); @@ -287,8 +288,8 @@ epic_attach(device_t dev) goto fail; } - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, + error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sizeof(struct epic_tx_desc) * TX_RING_SIZE, 1, sizeof(struct epic_tx_desc) * TX_RING_SIZE, 0, NULL, NULL, &sc->ttag); @@ -297,8 +298,8 @@ epic_attach(device_t dev) goto fail; } - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, + error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sizeof(struct epic_frag_list) * TX_RING_SIZE, 1, sizeof(struct epic_frag_list) * TX_RING_SIZE, 0, NULL, NULL, &sc->ftag);