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...).
This commit is contained in:
Marius Strobl 2007-01-21 19:32:51 +00:00
parent e54f674652
commit c2175ff5ca
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166165
15 changed files with 57 additions and 40 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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,

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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,

View File

@ -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 */

View File

@ -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 */

View File

@ -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.

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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 */