diff options
author | marius <marius@FreeBSD.org> | 2007-01-21 19:32:51 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2007-01-21 19:32:51 +0000 |
commit | 95a9b2142ae1f23ba99ffffc7acc4055f2c40cea (patch) | |
tree | 0022c3a9a6df560b7e242e09f139c9d0dd23011b | |
parent | 32ccb0b9691d9721a82fc29bc9002a655b8622b6 (diff) | |
download | FreeBSD-src-95a9b2142ae1f23ba99ffffc7acc4055f2c40cea.zip FreeBSD-src-95a9b2142ae1f23ba99ffffc7acc4055f2c40cea.tar.gz |
Change the remainder of the drivers for DMA'ing devices enabled in the
sparc64 GENERIC and the sound device drivers known working on sparc64
to use bus_get_dma_tag() to obtain the parent DMA tag so we can get rid
of the sparc64_root_dma_tag kludge eventually. Except for ath(4), sk(4),
stge(4) and ti(4) these changes are runtime tested (unless I booted up
the wrong kernels again...).
-rw-r--r-- | sys/dev/ath/if_ath.c | 2 | ||||
-rw-r--r-- | sys/dev/ath/if_ath_pci.c | 2 | ||||
-rw-r--r-- | sys/dev/esp/esp_sbus.c | 2 | ||||
-rw-r--r-- | sys/dev/firewire/fwohci_pci.c | 8 | ||||
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 31 | ||||
-rw-r--r-- | sys/dev/isp/isp_sbus.c | 16 | ||||
-rw-r--r-- | sys/dev/sk/if_sk.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/es137x.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/sbus/cs4231.c | 2 | ||||
-rw-r--r-- | sys/dev/stge/if_stge.c | 2 | ||||
-rw-r--r-- | sys/dev/sym/sym_hipd.c | 6 | ||||
-rw-r--r-- | sys/dev/ti/if_ti.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/ehci_pci.c | 8 | ||||
-rw-r--r-- | sys/dev/usb/uhci_pci.c | 8 | ||||
-rw-r--r-- | sys/pci/if_rl.c | 2 |
15 files changed, 57 insertions, 40 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 55e5f77..f0fe1ee 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -2511,7 +2511,7 @@ ath_descdma_setup(struct ath_softc *sc, /* * Setup DMA descriptor area. */ - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), /* parent */ PAGE_SIZE, 0, /* alignment, bounds */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c index a3e001b..20ca504 100644 --- a/sys/dev/ath/if_ath_pci.c +++ b/sys/dev/ath/if_ath_pci.c @@ -177,7 +177,7 @@ ath_pci_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 */ diff --git a/sys/dev/esp/esp_sbus.c b/sys/dev/esp/esp_sbus.c index ab31b96..6e13c36 100644 --- a/sys/dev/esp/esp_sbus.c +++ b/sys/dev/esp/esp_sbus.c @@ -262,7 +262,7 @@ esp_sbus_attach(device_t dev) /* Create a parent DMA tag based on this bus. */ error = bus_dma_tag_create( - NULL, /* parent */ + bus_get_dma_tag(dev), /* parent */ PAGE_SIZE, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index a1b7e26..b5801f0 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -357,7 +357,13 @@ fwohci_pci_attach(device_t self) return ENXIO; } - err = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1, + err = bus_dma_tag_create( +#if defined(__FreeBSD__) && __FreeBSD_version >= 700020 + /*parent*/bus_get_dma_tag(self), +#else + /*parent*/NULL, +#endif + /*alignment*/1, /*boundary*/0, #if BOUNCE_BUFFER_TEST /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index a1500cc..630ffd7 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -612,19 +612,19 @@ fxp_attach(device_t dev) sc->maxtxseg = FXP_NTXSEG; if (sc->flags & FXP_FLAG_EXT_RFA) sc->maxtxseg--; - error = bus_dma_tag_create(NULL, 2, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES * sc->maxtxseg, - sc->maxtxseg, MCLBYTES, 0, busdma_lock_mutex, &Giant, - &sc->fxp_mtag); + error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * sc->maxtxseg, sc->maxtxseg, MCLBYTES, 0, + busdma_lock_mutex, &Giant, &sc->fxp_mtag); if (error) { device_printf(dev, "could not allocate dma tag\n"); goto fail; } - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, sizeof(struct fxp_stats), 1, - sizeof(struct fxp_stats), 0, busdma_lock_mutex, &Giant, - &sc->fxp_stag); + error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + sizeof(struct fxp_stats), 1, sizeof(struct fxp_stats), 0, + busdma_lock_mutex, &Giant, &sc->fxp_stag); if (error) { device_printf(dev, "could not allocate dma tag\n"); goto fail; @@ -641,9 +641,10 @@ fxp_attach(device_t dev) goto fail; } - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, FXP_TXCB_SZ, 1, - FXP_TXCB_SZ, 0, busdma_lock_mutex, &Giant, &sc->cbl_tag); + error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + FXP_TXCB_SZ, 1, FXP_TXCB_SZ, 0, + busdma_lock_mutex, &Giant, &sc->cbl_tag); if (error) { device_printf(dev, "could not allocate dma tag\n"); goto fail; @@ -662,10 +663,10 @@ fxp_attach(device_t dev) goto fail; } - error = bus_dma_tag_create(NULL, 4, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, sizeof(struct fxp_cb_mcs), 1, - sizeof(struct fxp_cb_mcs), 0, busdma_lock_mutex, &Giant, - &sc->mcs_tag); + error = bus_dma_tag_create(bus_get_dma_tag(dev), 4, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + sizeof(struct fxp_cb_mcs), 1, sizeof(struct fxp_cb_mcs), 0, + busdma_lock_mutex, &Giant, &sc->mcs_tag); if (error) { device_printf(dev, "could not allocate dma tag\n"); goto fail; diff --git a/sys/dev/isp/isp_sbus.c b/sys/dev/isp/isp_sbus.c index 1b70a95..b45d5ea 100644 --- a/sys/dev/isp/isp_sbus.c +++ b/sys/dev/isp/isp_sbus.c @@ -479,6 +479,18 @@ imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) */ #define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1) +#if __FreeBSD_version < 700020 +#define BUS_DMA_ROOTARG NULL +#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ + bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ + busdma_lock_mutex, &Giant, z) +#else +#define BUS_DMA_ROOTARG bus_get_dma_tag(sbs->sbus_dev) +#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ + bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ + busdma_lock_mutex, &Giant, z) +#endif + static int isp_sbus_mbxdma(ispsoftc_t *isp) { @@ -497,10 +509,10 @@ isp_sbus_mbxdma(ispsoftc_t *isp) ISP_UNLOCK(isp); - if (bus_dma_tag_create(NULL, 1, BUS_SPACE_MAXADDR_24BIT+1, + if (isp_dma_tag_create(BUS_DMA_ROOTARG, 1, BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR_32BIT, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, ISP_NSEGS, - BUS_SPACE_MAXADDR_24BIT, 0, busdma_lock_mutex, &Giant, + BUS_SPACE_MAXADDR_24BIT, 0, &sbs->dmat)) { isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); ISP_LOCK(isp); diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 0f5d912..861707f 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -1945,7 +1945,8 @@ sk_dma_alloc(sc_if) * RAM. Until we have more clues of the breakage, disable DAC mode * by limiting DMA address to be in 32bit address space. */ - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create( + bus_get_dma_tag(sc_if->sk_if_dev),/* parent */ 1, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index e5aa86e..5d2ba37 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -1790,7 +1790,8 @@ es_pci_attach(device_t dev) goto bad; } - if (bus_dma_tag_create(/*parent*/NULL, /*alignment*/2, /*boundary*/0, + if (bus_dma_tag_create(/*parent*/bus_get_dma_tag(dev), + /*alignment*/2, /*boundary*/0, /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL, diff --git a/sys/dev/sound/sbus/cs4231.c b/sys/dev/sound/sbus/cs4231.c index 695b9e7..d463392 100644 --- a/sys/dev/sound/sbus/cs4231.c +++ b/sys/dev/sound/sbus/cs4231.c @@ -434,7 +434,7 @@ cs4231_attach_common(struct cs4231_softc *sc) CS4231_DEFAULT_BUF_SZ, CS4231_MAX_BUF_SZ); for (i = 0; i < sc->sc_nires; i++) { if (bus_dma_tag_create( - NULL, /* parent */ + bus_get_dma_tag(sc->sc_dev),/* parent */ 64, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ diff --git a/sys/dev/stge/if_stge.c b/sys/dev/stge/if_stge.c index 59711d0..61b5357 100644 --- a/sys/dev/stge/if_stge.c +++ b/sys/dev/stge/if_stge.c @@ -897,7 +897,7 @@ stge_dma_alloc(struct stge_softc *sc) int error, i; /* create parent tag. */ - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev),/* parent */ 1, 0, /* algnmnt, boundary */ STGE_DMA_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index 54849f6..0b258fd 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -8491,11 +8491,7 @@ sym_pci_attach(device_t dev) int i; bus_dma_tag_t bus_dmat; - /* - * I expected to be told about a parent - * DMA tag, but didn't find any. - */ - bus_dmat = NULL; + bus_dmat = bus_get_dma_tag(dev); /* * Only probed devices should be attached. diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 4440afa..b479811 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -2367,7 +2367,7 @@ ti_attach(dev) } /* Allocate the general information block and ring buffers. */ - if (bus_dma_tag_create(NULL, /* parent */ + if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 1, 0, /* algnmnt, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ diff --git a/sys/dev/usb/ehci_pci.c b/sys/dev/usb/ehci_pci.c index 357ea6f..212f2bf 100644 --- a/sys/dev/usb/ehci_pci.c +++ b/sys/dev/usb/ehci_pci.c @@ -423,10 +423,10 @@ ehci_pci_attach(device_t self) sc->sc_ncomp = ncomp; /* Allocate a parent dma tag for DMA maps */ - err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, - USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, - &sc->sc_bus.parent_dmatag); + err = bus_dma_tag_create(bus_get_dma_tag(self), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0, + NULL, NULL, &sc->sc_bus.parent_dmatag); if (err) { device_printf(self, "Could not allocate parent DMA tag (%d)\n", err); diff --git a/sys/dev/usb/uhci_pci.c b/sys/dev/usb/uhci_pci.c index bd4761f..6ca2037 100644 --- a/sys/dev/usb/uhci_pci.c +++ b/sys/dev/usb/uhci_pci.c @@ -351,10 +351,10 @@ uhci_pci_attach(device_t self) pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2); /* Allocate a parent dma tag for DMA maps */ - err = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, - USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, - &sc->sc_bus.parent_dmatag); + err = bus_dma_tag_create(bus_get_dma_tag(self), 1, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0, + NULL, NULL, &sc->sc_bus.parent_dmatag); if (err) { device_printf(self, "Could not allocate parent DMA tag (%d)\n", err); diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c index 29c1152..66abf6a 100644 --- a/sys/pci/if_rl.c +++ b/sys/pci/if_rl.c @@ -885,7 +885,7 @@ rl_attach(device_t dev) * Allocate the parent bus DMA tag appropriate for PCI. */ #define RL_NSEG_NEW 32 - error = bus_dma_tag_create(NULL, /* parent */ + error = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 1, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ |