Mega busdma API commit.

Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
This commit is contained in:
Scott Long 2003-07-01 15:52:06 +00:00
parent dfebdcdf7c
commit f6b1c44d1f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117126
116 changed files with 878 additions and 162 deletions

View File

@ -64,6 +64,8 @@ struct bus_dma_tag {
int flags;
int ref_count;
int map_count;
bus_dma_lock_t *lockfunc;
void *lockfuncarg;
};
struct bounce_page {
@ -94,7 +96,6 @@ struct bus_dmamap {
vm_offset_t busaddress; /* address in bus space */
bus_dmamap_callback_t *callback;
void *callback_arg;
struct mtx *callback_mtx;
void *sgmaphandle; /* handle into sgmap */
STAILQ_ENTRY(bus_dmamap) links;
};
@ -129,6 +130,46 @@ run_filter(bus_dma_tag_t dmat, bus_addr_t paddr)
return (retval);
}
/*
* Convenience function for manipulating driver locks from busdma (during
* busdma_swi, for example). Drivers that don't provide their own locks
* should specify &Giant to dmat->lockfuncarg. Drivers that use their own
* non-mutex locking scheme don't have to use this at all.
*/
void
busdma_lock_mutex(void *arg, bus_dma_lock_op_t op)
{
struct mtx *dmtx;
dmtx = (struct mtx *)arg;
switch (op) {
case BUS_DMA_LOCK:
mtx_lock(dmtx);
break;
case BUS_DMA_UNLOCK:
mtx_unlock(dmtx);
break;
default:
panic("Unknown operation 0x%x for busdma_lock_mutex!", op);
}
}
/*
* dflt_lock should never get called. It gets put into the dma tag when
* lockfunc == NULL, which is only valid if the maps that are associated
* with the tag are meant to never be defered.
* XXX Should have a way to identify which driver is responsible here.
*/
static void
dflt_lock(void *arg, bus_dma_lock_op_t op)
{
#ifdef INVARIANTS
panic("driver error: busdma dflt_lock called");
#else
printf("DRIVER_ERROR: busdma dflt_lock called\n");
#endif
}
#define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4
/*
* Allocate a device specific dma_tag.
@ -138,7 +179,8 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
bus_size_t boundary, bus_addr_t lowaddr,
bus_addr_t highaddr, bus_dma_filter_t *filter,
void *filterarg, bus_size_t maxsize, int nsegments,
bus_size_t maxsegsz, int flags, bus_dma_tag_t *dmat)
bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
void *lockfuncarg, bus_dma_tag_t *dmat)
{
bus_dma_tag_t newtag;
int error = 0;
@ -163,6 +205,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
newtag->flags = flags;
newtag->ref_count = 1; /* Count ourself */
newtag->map_count = 0;
if (lockfunc != NULL) {
newtag->lockfunc = lockfunc;
newtag->lockfuncarg = lockfuncarg;
} else {
newtag->lockfunc = dflt_lock;
newtag->lockfuncarg = NULL;
}
/* Take into account any restrictions imposed by our parent tag */
if (parent != NULL) {
@ -926,18 +975,18 @@ free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage)
void
busdma_swi(void)
{
bus_dma_tag_t dmat;
struct bus_dmamap *map;
mtx_lock(&bounce_lock);
while ((map = STAILQ_FIRST(&bounce_map_callbacklist)) != NULL) {
STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links);
mtx_unlock(&bounce_lock);
if (map->callback_mtx != NULL)
mtx_lock(map->callback_mtx);
dmat = map->dmat;
(dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_LOCK);
bus_dmamap_load(map->dmat, map, map->buf, map->buflen,
map->callback, map->callback_arg, /*flags*/0);
if (map->callback_mtx != NULL)
mtx_unlock(map->callback_mtx);
(dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_UNLOCK);
mtx_lock(&bounce_lock);
}
mtx_unlock(&bounce_lock);

View File

@ -522,6 +522,17 @@ typedef struct bus_dma_segment {
*/
typedef int bus_dma_filter_t(void *, bus_addr_t);
/*
* A function that performs driver-specific syncronization on behalf of
* busdma.
*/
typedef enum {
BUS_DMA_LOCK = 0x01,
BUS_DMA_UNLOCK = 0x02,
} bus_dma_lock_op_t;
typedef void bus_dma_lock_t(void *, bus_dma_lock_op_t);
/*
* Allocate a device specific dma_tag encapsulating the constraints of
* the parent tag in addition to other restrictions specified:
@ -547,7 +558,8 @@ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignemnt,
bus_size_t boundary, bus_addr_t lowaddr,
bus_addr_t highaddr, bus_dma_filter_t *filtfunc,
void *filtfuncarg, bus_size_t maxsize, int nsegments,
bus_size_t maxsegsz, int flags, bus_dma_tag_t *dmat);
bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
void *lockfuncarg, bus_dma_tag_t *dmat);
int bus_dma_tag_destroy(bus_dma_tag_t dmat);
@ -629,4 +641,9 @@ void _bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map);
if ((dmamap) != NULL) \
_bus_dmamap_unload(dmat, dmamap)
/*
* Generic helper function for manipulating mutexes.
*/
void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op);
#endif /* _ALPHA_BUS_H_ */

View File

@ -53,6 +53,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@ -131,6 +133,8 @@ isa_dmainit(chan, bouncebufsize)
/*maxsize*/bouncebufsize,
/*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/BUS_DMA_ISA,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant,
&dma_tag[chan]) != 0) {
panic("isa_dmainit: unable to create dma tag\n");
}

View File

@ -62,6 +62,8 @@ struct bus_dma_tag {
int flags;
int ref_count;
int map_count;
bus_dma_lock_t *lockfunc;
void *lockfuncarg;
};
struct bounce_page {
@ -90,7 +92,6 @@ struct bus_dmamap {
bus_size_t buflen; /* unmapped buffer length */
bus_dmamap_callback_t *callback;
void *callback_arg;
struct mtx *callback_mtx;
STAILQ_ENTRY(bus_dmamap) links;
};
@ -136,6 +137,46 @@ run_filter(bus_dma_tag_t dmat, bus_addr_t paddr)
return (retval);
}
/*
* Convenience function for manipulating driver locks from busdma (during
* busdma_swi, for example). Drivers that don't provide their own locks
* should specify &Giant to dmat->lockfuncarg. Drivers that use their own
* non-mutex locking scheme don't have to use this at all.
*/
void
busdma_lock_mutex(void *arg, bus_dma_lock_op_t op)
{
struct mtx *dmtx;
dmtx = (struct mtx *)arg;
switch (op) {
case BUS_DMA_LOCK:
mtx_lock(dmtx);
break;
case BUS_DMA_UNLOCK:
mtx_unlock(dmtx);
break;
default:
panic("Unknown operation 0x%x for busdma_lock_mutex!", op);
}
}
/*
* dflt_lock should never get called. It gets put into the dma tag when
* lockfunc == NULL, which is only valid if the maps that are associated
* with the tag are meant to never be defered.
* XXX Should have a way to identify which driver is responsible here.
*/
static void
dflt_lock(void *arg, bus_dma_lock_op_t op)
{
#ifdef INVARIANTS
panic("driver error: busdma dflt_lock called");
#else
printf("DRIVER_ERROR: busdma dflt_lock called\n");
#endif
}
#define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4
/*
* Allocate a device specific dma_tag.
@ -145,7 +186,8 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
bus_size_t boundary, bus_addr_t lowaddr,
bus_addr_t highaddr, bus_dma_filter_t *filter,
void *filterarg, bus_size_t maxsize, int nsegments,
bus_size_t maxsegsz, int flags, bus_dma_tag_t *dmat)
bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
void *lockfuncarg, bus_dma_tag_t *dmat)
{
bus_dma_tag_t newtag;
int error = 0;
@ -171,6 +213,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
newtag->flags = flags;
newtag->ref_count = 1; /* Count ourself */
newtag->map_count = 0;
if (lockfunc != NULL) {
newtag->lockfunc = lockfunc;
newtag->lockfuncarg = lockfuncarg;
} else {
newtag->lockfunc = dflt_lock;
newtag->lockfuncarg = NULL;
}
/* Take into account any restrictions imposed by our parent tag */
if (parent != NULL) {
@ -862,18 +911,18 @@ free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage)
void
busdma_swi(void)
{
bus_dma_tag_t dmat;
struct bus_dmamap *map;
mtx_lock(&bounce_lock);
while ((map = STAILQ_FIRST(&bounce_map_callbacklist)) != NULL) {
STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links);
mtx_unlock(&bounce_lock);
if (map->callback_mtx != NULL)
mtx_lock(map->callback_mtx);
dmat = map->dmat;
(dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_LOCK);
bus_dmamap_load(map->dmat, map, map->buf, map->buflen,
map->callback, map->callback_arg, /*flags*/0);
if (map->callback_mtx != NULL)
mtx_unlock(map->callback_mtx);
(dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_UNLOCK);
mtx_lock(&bounce_lock);
}
mtx_unlock(&bounce_lock);

View File

@ -131,6 +131,17 @@ typedef struct bus_dma_segment {
*/
typedef int bus_dma_filter_t(void *, bus_addr_t);
/*
* A function that performs driver-specific syncronization on behalf of
* busdma.
*/
typedef enum {
BUS_DMA_LOCK = 0x01,
BUS_DMA_UNLOCK = 0x02,
} bus_dma_lock_op_t;
typedef void bus_dma_lock_t(void *, bus_dma_lock_op_t);
/*
* Allocate a device specific dma_tag encapsulating the constraints of
* the parent tag in addition to other restrictions specified:
@ -156,7 +167,8 @@ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
bus_size_t boundary, bus_addr_t lowaddr,
bus_addr_t highaddr, bus_dma_filter_t *filtfunc,
void *filtfuncarg, bus_size_t maxsize, int nsegments,
bus_size_t maxsegsz, int flags, bus_dma_tag_t *dmat);
bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
void *lockfuncarg, bus_dma_tag_t *dmat);
int bus_dma_tag_destroy(bus_dma_tag_t dmat);
@ -238,4 +250,8 @@ void _bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map);
if ((dmamap) != NULL) \
_bus_dmamap_unload(dmat, dmamap)
/*
* Generic helper function for manipulating mutexes.
*/
void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op);
#endif /* _AMD64_BUS_DMA_H_ */

View File

@ -233,8 +233,15 @@ aac_attach(struct aac_softc *sc)
if ((error = aac_check_firmware(sc)) != 0)
return(error);
/* Init the sync fib lock */
/*
* Initialize locks
*/
AAC_LOCK_INIT(&sc->aac_sync_lock, "AAC sync FIB lock");
AAC_LOCK_INIT(&sc->aac_aifq_lock, "AAC AIF lock");
AAC_LOCK_INIT(&sc->aac_io_lock, "AAC I/O lock");
AAC_LOCK_INIT(&sc->aac_container_lock, "AAC container lock");
TAILQ_INIT(&sc->aac_container_tqh);
/*
* Initialise the adapter.
@ -247,14 +254,6 @@ aac_attach(struct aac_softc *sc)
*/
aac_describe_controller(sc);
/*
* Initialize locks
*/
AAC_LOCK_INIT(&sc->aac_aifq_lock, "AAC AIF lock");
TAILQ_INIT(&sc->aac_container_tqh);
AAC_LOCK_INIT(&sc->aac_container_lock, "AAC container lock");
AAC_LOCK_INIT(&sc->aac_io_lock, "AAC I/O lock");
/*
* Register to probe our containers later.
*/
@ -1450,6 +1449,8 @@ aac_init(struct aac_softc *sc)
AAC_MAXSGENTRIES, /* nsegments */
MAXBSIZE, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
busdma_lock_mutex, /* lockfunc */
&sc->aac_io_lock, /* lockfuncarg */
&sc->aac_buffer_dmat)) {
device_printf(sc->aac_dev, "can't allocate buffer DMA tag\n");
goto out;
@ -1471,6 +1472,7 @@ aac_init(struct aac_softc *sc)
AAC_FIB_COUNT *
sizeof(struct aac_fib), /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, NULL, /* No locking needed */
&sc->aac_fib_dmat)) {
device_printf(sc->aac_dev, "can't allocate FIB DMA tag\n");;
goto out;
@ -1490,6 +1492,7 @@ aac_init(struct aac_softc *sc)
1, /* nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, NULL, /* No locking needed */
&sc->aac_common_dmat)) {
device_printf(sc->aac_dev,
"can't allocate common structure DMA tag\n");

View File

@ -248,6 +248,7 @@ aac_pci_attach(device_t dev)
AAC_MAXSGENTRIES, /* nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
NULL, NULL, /* No locking needed */
&sc->aac_parent_dmat)) {
device_printf(sc->aac_dev, "can't allocate parent DMA tag\n");
goto out;

View File

@ -39,6 +39,8 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus_pio.h>
@ -183,6 +185,8 @@ adv_eisa_attach(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ ADV_EISA_MAX_DMA_COUNT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adv_b->parent_dmat);
if (error != 0) {
@ -221,6 +225,8 @@ adv_eisa_attach(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ ADV_EISA_MAX_DMA_COUNT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adv->parent_dmat);
if (error != 0) {
@ -252,6 +258,8 @@ adv_eisa_attach(device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&overrun_dmat) != 0) {
adv_free(adv);
goto bad;

View File

@ -50,6 +50,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <machine/bus_pio.h>
#include <machine/bus.h>
@ -230,6 +232,8 @@ adv_isa_probe(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ maxsegsz,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adv->parent_dmat);
if (error != 0) {
@ -256,6 +260,8 @@ adv_isa_probe(device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ NULL,
/* lockarg */ NULL,
&overrun_dmat) != 0) {
adv_free(adv);
bus_release_resource(dev, SYS_RES_IOPORT, 0,

View File

@ -63,6 +63,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <machine/bus_pio.h>
#include <machine/bus.h>
@ -197,6 +199,8 @@ adv_pci_attach(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ ADV_PCI_MAX_DMA_COUNT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adv->parent_dmat);
if (error != 0) {
@ -223,6 +227,8 @@ adv_pci_attach(device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&overrun_dmat) != 0) {
bus_dma_tag_destroy(adv->parent_dmat);
adv_free(adv);

View File

@ -51,6 +51,8 @@
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <machine/bus_pio.h>
#include <machine/bus.h>
@ -1331,6 +1333,8 @@ adv_attach(adv)
/* nsegments */ max_sg,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ BUS_DMA_ALLOCNOW,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adv->buffer_dmat) != 0) {
return (ENXIO);
}
@ -1350,6 +1354,8 @@ adv_attach(adv)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adv->sense_dmat) != 0) {
return (ENXIO);
}

View File

@ -39,6 +39,8 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus_pio.h>
@ -268,6 +270,8 @@ adw_pci_attach(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ ADW_PCI_MAX_DMA_COUNT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adw->parent_dmat);
adw->init_level++;

View File

@ -49,6 +49,8 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus_pio.h>
@ -1022,6 +1024,8 @@ adw_init(struct adw_softc *adw)
/* nsegments */ ADW_SGSIZE,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ BUS_DMA_ALLOCNOW,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adw->buffer_dmat) != 0) {
return (ENOMEM);
}
@ -1043,6 +1047,8 @@ adw_init(struct adw_softc *adw)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adw->carrier_dmat) != 0) {
return (ENOMEM);
}
@ -1102,6 +1108,8 @@ adw_init(struct adw_softc *adw)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adw->acb_dmat) != 0) {
return (ENOMEM);
}
@ -1137,6 +1145,8 @@ adw_init(struct adw_softc *adw)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&adw->sg_dmat) != 0) {
return (ENOMEM);
}

View File

@ -62,6 +62,8 @@
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <machine/bus_pio.h>
#include <machine/bus.h>
@ -492,6 +494,8 @@ aha_init(struct aha_softc* aha)
/* nsegments */ AHA_NSEG,
/* maxsegsz */ BUS_SPACE_MAXSIZE_24BIT,
/* flags */ BUS_DMA_ALLOCNOW,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&aha->buffer_dmat) != 0) {
goto error_exit;
}
@ -511,6 +515,8 @@ aha_init(struct aha_softc* aha)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_24BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&aha->mailbox_dmat) != 0) {
goto error_exit;
}
@ -551,6 +557,8 @@ aha_init(struct aha_softc* aha)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_24BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&aha->ccb_dmat) != 0) {
goto error_exit;
}
@ -585,6 +593,8 @@ aha_init(struct aha_softc* aha)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_24BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&aha->sg_dmat) != 0) {
goto error_exit;
}

View File

@ -34,6 +34,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <machine/bus_pio.h>
#include <machine/bus.h>
@ -255,6 +257,8 @@ aha_isa_attach(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_24BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&aha->parent_dmat) != 0) {
aha_free(aha);
bus_release_resource(dev, SYS_RES_IOPORT, aha->portrid, aha->port);

View File

@ -31,6 +31,8 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/module.h>
#include <sys/bus.h>
@ -184,6 +186,8 @@ aha_mca_attach (device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_24BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&sc->parent_dmat);
if (error) {
device_printf(dev, "bus_dma_tag_create() failed!\n");

View File

@ -33,6 +33,8 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus_pio.h>
@ -303,6 +305,8 @@ ahbattach(device_t dev)
/* nsegments */ AHB_NSEG,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ BUS_DMA_ALLOCNOW,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&ahb->buffer_dmat) != 0)
goto error_exit;
@ -322,6 +326,8 @@ ahbattach(device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&ahb->ecb_dmat) != 0)
goto error_exit;

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahc_eisa.c#11 $
* $Id: ahc_eisa.c,v 1.29 2003/05/03 23:27:57 gibbs Exp $
*
* $FreeBSD$
*/
@ -140,6 +140,8 @@ aic7770_attach(device_t dev)
/*nsegments*/AHC_NSEG,
/*maxsegsz*/AHC_MAXTRANSFER_SIZE,
/*flags*/0,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant,
&ahc->parent_dmat);
if (error != 0) {

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahc_pci.c#13 $
* $Id: ahc_pci.c,v 1.53 2003/05/03 23:27:57 gibbs Exp $
*
* $FreeBSD$
*/
@ -120,6 +120,8 @@ ahc_pci_attach(device_t dev)
/*nsegments*/AHC_NSEG,
/*maxsegsz*/AHC_MAXTRANSFER_SIZE,
/*flags*/0,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant,
&ahc->parent_dmat);
if (error != 0) {

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahd_pci.c#13 $
* $Id: ahd_pci.c,v 1.8 2003/05/03 23:27:57 gibbs Exp $
*
* $FreeBSD$
*/
@ -123,6 +123,8 @@ ahd_pci_attach(device_t dev)
/*nsegments*/AHD_NSEG,
/*maxsegsz*/AHD_MAXTRANSFER_SIZE,
/*flags*/0,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant,
&ahd->parent_dmat);
if (error != 0) {

View File

@ -109,7 +109,7 @@ typedef union ccb *ahd_io_ctx_t;
bus_dma_tag_create(parent_tag, alignment, boundary, \
lowaddr, highaddr, filter, filterarg, \
maxsize, nsegments, maxsegsz, flags, \
dma_tagp)
busdma_lock_mutex, &Giant, dma_tagp)
#define ahd_dma_tag_destroy(ahd, tag) \
bus_dma_tag_destroy(tag)

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: //depot/aic7xxx/freebsd/dev/aic7xxx/aic7xxx_osm.h#15 $
* $Id: aic7xxx_osm.h,v 1.22 2003/06/10 03:25:24 gibbs Exp $
*
* $FreeBSD$
*/
@ -122,7 +122,7 @@ typedef union ccb *ahc_io_ctx_t;
bus_dma_tag_create(parent_tag, alignment, boundary, \
lowaddr, highaddr, filter, filterarg, \
maxsize, nsegments, maxsegsz, flags, \
dma_tagp)
busdma_lock_mutex, &Giant, dma_tagp)
#define ahc_dma_tag_destroy(ahc, tag) \
bus_dma_tag_destroy(tag)

View File

@ -55,6 +55,8 @@
#include <sys/systm.h>
#include <sys/queue.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@ -2290,6 +2292,8 @@ amd_init(device_t dev)
/*maxsize*/MAXBSIZE, /*nsegments*/AMD_NSEG,
/*maxsegsz*/AMD_MAXTRANSFER_SIZE,
/*flags*/BUS_DMA_ALLOCNOW,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant,
&amd->buffer_dmat) != 0) {
if (bootverbose)
printf("amd_init: bus_dma_tag_create failure!\n");
@ -2305,7 +2309,9 @@ amd_init(device_t dev)
sizeof(struct scsi_sense_data) * MAX_SRB_CNT,
/*nsegments*/1,
/*maxsegsz*/AMD_MAXTRANSFER_SIZE,
/*flags*/0, &amd->sense_dmat) != 0) {
/*flags*/0,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &amd->sense_dmat) != 0) {
if (bootverbose)
device_printf(dev, "cannot create sense buffer dmat\n");
return (ENXIO);

View File

@ -249,6 +249,7 @@ amr_pci_attach(device_t dev)
MAXBSIZE, AMR_NSEG, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, NULL, /* lockfunc, lockarg */
&sc->amr_parent_dmat)) {
device_printf(dev, "can't allocate parent DMA tag\n");
goto out;
@ -265,6 +266,7 @@ amr_pci_attach(device_t dev)
MAXBSIZE, AMR_NSEG, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, &Giant, /* lockfunc, lockarg */
&sc->amr_buffer_dmat)) {
device_printf(sc->amr_dev, "can't allocate buffer DMA tag\n");
goto out;
@ -505,6 +507,8 @@ amr_sglist_map(struct amr_softc *sc)
segsize, 1, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->amr_sg_dmat);
if (error != 0) {
device_printf(sc->amr_dev, "can't allocate scatter/gather DMA tag\n");
@ -575,6 +579,8 @@ amr_setup_mbox(struct amr_softc *sc)
sizeof(struct amr_mailbox) + 16, 1, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->amr_mailbox_dmat);
if (error != 0) {
device_printf(sc->amr_dev, "can't allocate mailbox tag\n");

View File

@ -216,6 +216,8 @@ an_attach_pci(dev)
1, /* nsegments */
0xffff, /* maxsegsize XXX */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&sc->an_dtag);
if (error) {
printf("an%d: couldn't get DMA region\n", unit);

View File

@ -34,6 +34,8 @@
#include <sys/kernel.h>
#include <sys/endian.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <pci/pcivar.h>
#include <machine/bus.h>
@ -96,7 +98,8 @@ ata_dmaalloc(struct ata_channel *ch)
if (bus_dma_tag_create(NULL, 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL, MAXCTLDMASZ, ATA_DMA_ENTRIES,
BUS_SPACE_MAXSIZE_32BIT, 0, &ch->dma->dmatag)) {
BUS_SPACE_MAXSIZE_32BIT, 0, busdma_lock_mutex,
&Giant, &ch->dma->dmatag)) {
printf("DMA tag allocation failed, disabling DMA\n");
}
}
@ -105,7 +108,8 @@ ata_dmaalloc(struct ata_channel *ch)
BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL,
MAXTABSZ, 1, MAXTABSZ,
BUS_DMA_ALLOCNOW, &ch->dma->cdmatag)))
BUS_DMA_ALLOCNOW, busdma_lock_mutex,
&Giant, &ch->dma->cdmatag)))
return error;
}
if (!ch->dma->ddmatag) {
@ -113,7 +117,8 @@ ata_dmaalloc(struct ata_channel *ch)
BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL,
MAXPHYS, ATA_DMA_ENTRIES, MAXSEGSZ,
BUS_DMA_ALLOCNOW, &ch->dma->ddmatag)))
BUS_DMA_ALLOCNOW, busdma_lock_mutex,
&Giant, &ch->dma->ddmatag)))
return error;
}
if (!ch->dma->mdmatab) {

View File

@ -182,6 +182,8 @@ ath_pci_attach(device_t dev)
ATH_MAX_SCATTER, /* nsegments */
0xffff, /* maxsegsize XXX */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&sc->sc_dmat)) {
device_printf(dev, "cannot allocate DMA tag\n");
goto bad3;

View File

@ -45,6 +45,8 @@
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/bus.h>
@ -723,6 +725,8 @@ bt_init(device_t dev)
/* nsegments */ BT_NSEG,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ BUS_DMA_ALLOCNOW,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->buffer_dmat) != 0) {
goto error_exit;
}
@ -742,6 +746,8 @@ bt_init(device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->mailbox_dmat) != 0) {
goto error_exit;
}
@ -782,6 +788,8 @@ bt_init(device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->ccb_dmat) != 0) {
goto error_exit;
}
@ -816,6 +824,8 @@ bt_init(device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->sg_dmat) != 0) {
goto error_exit;
}

View File

@ -33,6 +33,8 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus_pio.h>
@ -313,6 +315,8 @@ bt_eisa_attach(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg, */ &Giant,
&bt->parent_dmat) != 0) {
bt_eisa_release_resources(dev);
return -1;

View File

@ -33,6 +33,8 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus_pio.h>
@ -243,6 +245,8 @@ bt_isa_attach(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->parent_dmat) != 0) {
bt_isa_release_resources(dev);
return (ENOMEM);
@ -269,6 +273,8 @@ bt_isa_attach(device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->sense_dmat) != 0) {
bt_isa_release_resources(dev);
return (ENOMEM);

View File

@ -37,6 +37,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <machine/cpufunc.h>
#include <machine/md_var.h>
@ -228,6 +230,8 @@ bt_mca_attach (device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->parent_dmat) != 0) {
bt_mca_release_resources(dev);
return (ENOMEM);
@ -251,6 +255,8 @@ bt_mca_attach (device_t dev)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->sense_dmat) != 0) {
bt_mca_release_resources(dev);
return (ENOMEM);

View File

@ -32,6 +32,8 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <pci/pcireg.h>
@ -184,6 +186,8 @@ bt_pci_attach(device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&bt->parent_dmat) != 0) {
bt_pci_release_resources(dev);
return (ENOMEM);

View File

@ -600,6 +600,7 @@ ciss_init_pci(struct ciss_softc *sc)
MAXBSIZE, CISS_COMMAND_SG_LENGTH, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, NULL, /* lockfunc, lockarg */
&sc->ciss_parent_dmat)) {
ciss_printf(sc, "can't allocate parent DMA tag\n");
return(ENOMEM);
@ -617,6 +618,7 @@ ciss_init_pci(struct ciss_softc *sc)
MAXBSIZE, CISS_COMMAND_SG_LENGTH, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, &Giant, /* lockfunc, lockarg */
&sc->ciss_buffer_dmat)) {
ciss_printf(sc, "can't allocate buffer DMA tag\n");
return(ENOMEM);
@ -745,6 +747,7 @@ ciss_init_requests(struct ciss_softc *sc)
sc->ciss_max_requests, 1, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, &Giant, /* lockfunc, lockarg */
&sc->ciss_command_dmat)) {
ciss_printf(sc, "can't allocate command DMA tag\n");
return(ENOMEM);

View File

@ -240,7 +240,8 @@ ct_isa_attach(device_t dev)
BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR,
NULL, NULL, MAXBSIZE, 1,
BUS_SPACE_MAXSIZE_32BIT,
BUS_DMA_ALLOCNOW, &ct->sc_dmat) != 0) {
BUS_DMA_ALLOCNOW, NULL, NULL,
&ct->sc_dmat) != 0) {
device_printf(dev, "can't set up ISA DMA map\n");
ct_space_unmap(dev, ct);
return ENXIO;
@ -254,7 +255,7 @@ ct_isa_attach(device_t dev)
}
bus_dmamap_load(ct->sc_dmat, ct->sc_dmamapt, vaddr, MAXBSIZE,
ct_dmamap, &addr, 0);
ct_dmamap, &addr, BUS_DMA_NOWAIT);
/* setup machdep softc */
bs->sc_hw = hw;

View File

@ -30,6 +30,8 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus_pio.h>
@ -128,7 +130,9 @@ dpt_eisa_attach (device_t dev)
/* maxsize */ BUS_SPACE_MAXSIZE_32BIT,
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */0,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&dpt->parent_dmat) != 0) {
error = ENXIO;
goto bad;

View File

@ -189,6 +189,8 @@ dpt_isa_attach (device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&dpt->parent_dmat) != 0) {
error = ENXIO;
goto bad;

View File

@ -33,6 +33,8 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus_memio.h>
@ -144,6 +146,8 @@ dpt_pci_attach (device_t dev)
/* nsegments */ ~0,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&dpt->parent_dmat) != 0) {
dpt_free(dpt);
error = ENXIO;

View File

@ -1304,6 +1304,8 @@ dpt_init(struct dpt_softc *dpt)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&dpt->sg_dmat) != 0) {
goto error_exit;
}
@ -1431,6 +1433,8 @@ dpt_init(struct dpt_softc *dpt)
/* nsegments */ dpt->sgsize,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ BUS_DMA_ALLOCNOW,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&dpt->buffer_dmat) != 0) {
printf("dpt: bus_dma_tag_create(...,dpt->buffer_dmat) failed\n");
goto error_exit;
@ -1452,6 +1456,8 @@ dpt_init(struct dpt_softc *dpt)
/* nsegments */ 1,
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&dpt->dccb_dmat) != 0) {
printf("dpt: bus_dma_tag_create(...,dpt->dccb_dmat) failed\n");
goto error_exit;

View File

@ -1804,6 +1804,8 @@ em_dma_malloc(struct adapter *adapter, bus_size_t size,
1, /* nsegments */
size, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&dma->dma_tag);
if (r != 0) {
printf("em%d: em_dma_malloc: bus_dma_tag_create failed; "
@ -1908,6 +1910,8 @@ em_setup_transmit_structures(struct adapter * adapter)
EM_MAX_SCATTER, /* nsegments */
MCLBYTES * 8, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&adapter->txtag)) {
printf("em%d: Unable to allocate TX DMA tag\n", adapter->unit);
return (ENOMEM);
@ -2283,6 +2287,8 @@ em_allocate_receive_structures(struct adapter * adapter)
1, /* nsegments */
MCLBYTES, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&adapter->rxtag);
if (error != 0) {
printf("em%d: em_allocate_receive_structures: "

View File

@ -2706,7 +2706,8 @@ en_dmaprobe(struct en_softc *sc)
*/
err = bus_dma_tag_create(NULL, MIDDMA_MAXBURST, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
3 * MIDDMA_MAXBURST, 1, 3 * MIDDMA_MAXBURST, 0, &tag);
3 * MIDDMA_MAXBURST, 1, 3 * MIDDMA_MAXBURST, 0, busdma_lock_mutex,
&Giant, &tag);
if (err)
panic("%s: cannot create test DMA tag %d", __func__, err);
@ -2918,7 +2919,8 @@ en_attach(struct en_softc *sc)
if (bus_dma_tag_create(NULL, 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
EN_TXSZ * 1024, EN_MAX_DMASEG, EN_TXSZ * 1024, 0, &sc->txtag))
EN_TXSZ * 1024, EN_MAX_DMASEG, EN_TXSZ * 1024, 0, busdma_lock_mutex,
&Giant, &sc->txtag))
goto fail;
sc->map_zone = uma_zcreate("en dma maps", sizeof(struct en_map),

View File

@ -935,9 +935,8 @@ alloc_dma_memory(struct fatm_softc *sc, const char *nm, struct fatm_mem *mem)
if (bus_dma_tag_create(sc->parent_dmat, mem->align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL,
mem->size, 1,
BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW, &mem->dmat)) {
NULL, NULL, mem->size, 1, BUS_SPACE_MAXSIZE_32BIT,
BUS_DMA_ALLOCNOW, NULL, NULL, &mem->dmat)) {
if_printf(&sc->ifatm.ifnet, "could not allocate %s DMA tag\n",
nm);
return (ENOMEM);
@ -980,7 +979,7 @@ alloc_dma_memoryX(struct fatm_softc *sc, const char *nm, struct fatm_mem *mem)
if (bus_dma_tag_create(NULL, mem->align, 0,
BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR,
NULL, NULL, mem->size, 1, mem->size,
BUS_DMA_ALLOCNOW, &mem->dmat)) {
BUS_DMA_ALLOCNOW, NULL, NULL, &mem->dmat)) {
if_printf(&sc->ifatm.ifnet, "could not allocate %s DMA tag\n",
nm);
return (ENOMEM);
@ -2877,9 +2876,9 @@ fatm_attach(device_t dev)
*/
if (bus_dma_tag_create(NULL, 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL,
BUS_SPACE_MAXSIZE_32BIT, MAXDMASEGS,
BUS_SPACE_MAXSIZE_32BIT, 0, &sc->parent_dmat)) {
NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, MAXDMASEGS,
BUS_SPACE_MAXSIZE_32BIT, 0, busdma_lock_mutex, &Giant,
&sc->parent_dmat)) {
if_printf(ifp, "could not allocate parent DMA tag\n");
error = ENOMEM;
goto fail;
@ -2891,8 +2890,8 @@ fatm_attach(device_t dev)
*/
if (bus_dma_tag_create(sc->parent_dmat, 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL,
MCLBYTES, 1, MCLBYTES, 0, &sc->rbuf_tag)) {
NULL, NULL, MCLBYTES, 1, MCLBYTES, 0,
busdma_lock_mutex, &Giant, &sc->rbuf_tag)) {
if_printf(ifp, "could not allocate rbuf DMA tag\n");
error = ENOMEM;
goto fail;
@ -2905,7 +2904,7 @@ fatm_attach(device_t dev)
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL,
FATM_MAXPDU, TPD_EXTENSIONS + TXD_FIXED, MCLBYTES, 0,
&sc->tx_tag)) {
busdma_lock_mutex, &Giant, &sc->tx_tag)) {
if_printf(ifp, "could not allocate tx DMA tag\n");
error = ENOMEM;
goto fail;

View File

@ -38,6 +38,8 @@
#include <sys/types.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/bus.h>
#include <machine/bus.h>
@ -74,7 +76,8 @@ fwdma_malloc(struct firewire_comm *fc, int alignment, bus_size_t size,
/*maxsize*/ size,
/*nsegments*/ 1,
/*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT,
/*flags*/ BUS_DMA_ALLOCNOW, &dma->dma_tag);
/*flags*/ BUS_DMA_ALLOCNOW,
/*lockfunc*/busdma_lock_mutex,/*lockarg*/&Giant, &dma->dma_tag);
if (err) {
printf("fwdma_malloc: failed(1)\n");
return(NULL);
@ -167,7 +170,9 @@ fwdma_malloc_multiseg(struct firewire_comm *fc, int alignment,
/*maxsize*/ ssize,
/*nsegments*/ 1,
/*maxsegsz*/ BUS_SPACE_MAXSIZE_32BIT,
/*flags*/ BUS_DMA_ALLOCNOW, &am->dma_tag)) {
/*flags*/ BUS_DMA_ALLOCNOW,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &am->dma_tag)) {
printf("fwdma_malloc_multiseg: tag_create failed\n");
free(am, M_FW);
return(NULL);

View File

@ -1187,7 +1187,9 @@ fwohci_db_init(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
/*maxsize*/ dbch->xferq.psize,
/*nsegments*/ dbch->ndesc > 3 ? dbch->ndesc - 2 : 1,
/*maxsegsz*/ MAX_REQCOUNT,
/*flags*/ 0, &dbch->dmat))
/*flags*/ 0,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &dbch->dmat))
return;
/* allocate DB entries and attach one to each DMA channels */

View File

@ -45,6 +45,8 @@
#include <machine/bus.h>
#include <sys/rman.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <machine/resource.h>
#if __FreeBSD_version < 500000
@ -299,7 +301,8 @@ fwohci_pci_attach(device_t self)
/*nsegments*/0x20,
/*maxsegsz*/0x8000,
/*flags*/BUS_DMA_ALLOCNOW,
&sc->fc.dmat);
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->fc.dmat);
if (err != 0) {
printf("fwohci_pci_attach: Could not allocate DMA tag "
"- error %d\n", err);

View File

@ -43,6 +43,8 @@
#include <sys/sysctl.h>
#include <machine/bus.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#if __FreeBSD_version < 500106
#include <sys/devicestat.h> /* for struct devstat */
@ -1828,7 +1830,8 @@ END_DEBUG
/*maxsize*/0x100000, /*nsegments*/SBP_IND_MAX,
/*maxsegsz*/SBP_SEG_MAX,
/*flags*/BUS_DMA_ALLOCNOW,
&sbp->dmat);
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sbp->dmat);
if (error != 0) {
printf("sbp_attach: Could not allocate DMA tag "
"- error %d\n", error);

View File

@ -622,7 +622,7 @@ fxp_attach(device_t dev)
maxtxseg = sc->flags & FXP_FLAG_EXT_RFA ? FXP_NTXSEG - 1 : FXP_NTXSEG;
error = bus_dma_tag_create(NULL, 2, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES * maxtxseg,
maxtxseg, MCLBYTES, 0, &sc->fxp_mtag);
maxtxseg, MCLBYTES, 0, busdma_lock_mutex, &Giant, &sc->fxp_mtag);
if (error) {
device_printf(dev, "could not allocate dma tag\n");
goto fail;
@ -630,7 +630,8 @@ fxp_attach(device_t dev)
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, &sc->fxp_stag);
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;
@ -650,7 +651,7 @@ fxp_attach(device_t dev)
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, &sc->cbl_tag);
FXP_TXCB_SZ, 0, busdma_lock_mutex, &Giant, &sc->cbl_tag);
if (error) {
device_printf(dev, "could not allocate dma tag\n");
goto fail;
@ -672,7 +673,8 @@ fxp_attach(device_t dev)
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, &sc->mcs_tag);
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

@ -133,13 +133,13 @@ gem_attach(sc)
error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, GEM_NSEGS,
BUS_SPACE_MAXSIZE_32BIT, 0, &sc->sc_pdmatag);
BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->sc_pdmatag);
if (error)
return (error);
error = bus_dma_tag_create(sc->sc_pdmatag, 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MAXBSIZE,
1, BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW,
1, BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW, NULL, NULL,
&sc->sc_rdmatag);
if (error)
goto fail_ptag;
@ -147,7 +147,7 @@ gem_attach(sc)
error = bus_dma_tag_create(sc->sc_pdmatag, 1, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
GEM_TD_BUFSIZE, GEM_NTXDESC, BUS_SPACE_MAXSIZE_32BIT,
BUS_DMA_ALLOCNOW, &sc->sc_tdmatag);
BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_tdmatag);
if (error)
goto fail_rtag;
@ -155,7 +155,7 @@ gem_attach(sc)
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
sizeof(struct gem_control_data), 1,
sizeof(struct gem_control_data), BUS_DMA_ALLOCNOW,
&sc->sc_cdmatag);
busdma_lock_mutex, &Giant, &sc->sc_cdmatag);
if (error)
goto fail_ttag;

View File

@ -214,7 +214,8 @@ hatm_alloc_dmamem(struct hatm_softc *sc, const char *what, struct dmamem *mem)
error = bus_dma_tag_create(sc->parent_tag, mem->align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL, mem->size, 1,
BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW, &mem->tag);
BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW,
busdma_lock_mutex, &Giant, &mem->tag);
if (error) {
if_printf(&sc->ifatm.ifnet, "DMA tag create (%s)\n", what);
return (error);
@ -1712,7 +1713,8 @@ hatm_attach(device_t dev)
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL,
BUS_SPACE_MAXSIZE_32BIT, 1,
BUS_SPACE_MAXSIZE_32BIT, 0, &sc->parent_tag)) {
BUS_SPACE_MAXSIZE_32BIT, 0,
busdma_lock_mutex, &Giant, &sc->parent_tag)) {
device_printf(dev, "could not allocate DMA tag\n");
error = ENOMEM;
goto failed;
@ -1722,7 +1724,8 @@ hatm_attach(device_t dev)
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL,
MBUF_ALLOC_SIZE, 1,
MBUF_ALLOC_SIZE, 0, &sc->mbuf_tag)) {
MBUF_ALLOC_SIZE, 0,
busdma_lock_mutex, &Giant, &sc->mbuf_tag)) {
device_printf(dev, "could not allocate mbuf DMA tag\n");
error = ENOMEM;
goto failed;
@ -1738,7 +1741,7 @@ hatm_attach(device_t dev)
if (bus_dma_tag_create(NULL, 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,
&sc->tx_tag)) {
busdma_lock_mutex, &Giant, &sc->tx_tag)) {
device_printf(dev, "could not allocate TX tag\n");
error = ENOMEM;
goto failed;

View File

@ -340,6 +340,8 @@ hifn_attach(device_t dev)
MAX_SCATTER, /* nsegments */
HIFN_MAX_SEGLEN, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&sc->sc_dmat)) {
device_printf(dev, "cannot allocate DMA tag\n");
goto fail_io1;

View File

@ -191,27 +191,28 @@ hme_config(struct hme_softc *sc)
error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, size, HME_NTXDESC + HME_NRXDESC + 1,
BUS_SPACE_MAXSIZE_32BIT, 0, &sc->sc_pdmatag);
BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->sc_pdmatag);
if (error)
return (error);
error = bus_dma_tag_create(sc->sc_pdmatag, 2048, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, size,
1, BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW, &sc->sc_cdmatag);
1, BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW, busdma_lock_mutex,
&Giant, &sc->sc_cdmatag);
if (error)
goto fail_ptag;
error = bus_dma_tag_create(sc->sc_pdmatag, max(0x10, sc->sc_burst), 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES,
HME_NRXDESC, BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW,
&sc->sc_rdmatag);
NULL, NULL, &sc->sc_rdmatag);
if (error)
goto fail_ctag;
error = bus_dma_tag_create(sc->sc_pdmatag, max(0x10, sc->sc_burst), 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES,
HME_NTXDESC, BUS_SPACE_MAXSIZE_32BIT, BUS_DMA_ALLOCNOW,
&sc->sc_tdmatag);
NULL, NULL, &sc->sc_tdmatag);
if (error)
goto fail_rtag;

View File

@ -205,7 +205,8 @@ ida_init(struct ida_softc *ida)
/*filter*/NULL, /*filterarg*/NULL,
IDA_QCB_MAX * sizeof(struct ida_hardware_qcb),
/*nsegments*/1, /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
/*flags*/0, &ida->hwqcb_dmat);
/*flags*/0, /*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
&ida->hwqcb_dmat);
if (error)
return (ENOMEM);
@ -215,7 +216,8 @@ ida_init(struct ida_softc *ida)
/*lowaddr*/BUS_SPACE_MAXADDR, /*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/MAXBSIZE, /*nsegments*/IDA_NSEG,
/*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT, /*flags*/0, &ida->buffer_dmat);
/*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT, /*flags*/0,
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant, &ida->buffer_dmat);
if (error)
return (ENOMEM);

View File

@ -303,6 +303,8 @@ ida_eisa_attach(device_t dev)
/* nsegments */ IDA_NSEG,
/* maxsegsize */ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ BUS_DMA_ALLOCNOW,
/* lockfunc */ NULL,
/* lockarg */ NULL,
&ida->parent_dmat);
if (error != 0) {

View File

@ -267,7 +267,7 @@ ida_pci_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/MAXBSIZE, /*nsegments*/IDA_NSEG,
/*maxsegsize*/BUS_SPACE_MAXSIZE_32BIT, /*flags*/BUS_DMA_ALLOCNOW,
&ida->parent_dmat);
/*lockfunc*/NULL, /*lockarg*/NULL, &ida->parent_dmat);
if (error != 0) {
device_printf(dev, "can't allocate DMA tag\n");
ida_free(ida);

View File

@ -212,6 +212,7 @@ iir_init(struct gdt_softc *gdt)
/*maxsize*/MAXBSIZE, /*nsegments*/GDT_MAXSG,
/*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
/*flags*/BUS_DMA_ALLOCNOW,
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
&gdt->sc_buffer_dmat) != 0) {
printf("iir%d: bus_dma_tag_create(...,gdt->sc_buffer_dmat) failed\n",
gdt->sc_hanum);
@ -230,7 +231,8 @@ iir_init(struct gdt_softc *gdt)
GDT_MAXCMDS * sizeof(struct gdt_ccb), /* maxsize */
/*nsegments*/1,
/*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
/*flags*/0, &gdt->sc_gccb_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &gdt->sc_gccb_dmat) != 0) {
printf("iir%d: bus_dma_tag_create(...,gdt->sc_gccb_dmat) failed\n",
gdt->sc_hanum);
return (1);

View File

@ -46,6 +46,8 @@
#include <sys/systm.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/module.h>
#include <sys/bus.h>
@ -322,7 +324,8 @@ iir_pci_attach(device_t dev)
/*maxsize*/BUS_SPACE_MAXSIZE_32BIT,
/*nsegments*/GDT_MAXSG,
/*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
/*flags*/0, &gdt->sc_parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &gdt->sc_parent_dmat) != 0) {
error = ENXIO;
goto err;
}

View File

@ -337,6 +337,8 @@ int ips_adapter_init(ips_softc_t *sc)
/* maxsegsize*/ IPS_COMMAND_LEN +
IPS_MAX_SG_LEN,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&sc->command_dmatag) != 0) {
device_printf(sc->dev, "can't alloc command dma tag\n");
goto error;
@ -352,6 +354,8 @@ int ips_adapter_init(ips_softc_t *sc)
/* numsegs */ IPS_MAX_SG_ELEMENTS,
/* maxsegsize*/ IPS_MAX_IOBUF_SIZE,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&sc->sg_dmatag) != 0) {
device_printf(sc->dev, "can't alloc SG dma tag\n");
goto error;
@ -546,6 +550,8 @@ static int ips_copperhead_queue_init(ips_softc_t *sc)
/* numsegs */ 1,
/* maxsegsize*/ sizeof(ips_copper_queue_t),
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&dmatag) != 0) {
device_printf(sc->dev, "can't alloc dma tag for statue queue\n");
error = ENOMEM;

View File

@ -224,6 +224,8 @@ static int ips_send_adapter_info_cmd(ips_command_t *command)
/* numsegs */ 1,
/* maxsegsize*/ IPS_ADAPTER_INFO_LEN,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&command->data_dmatag) != 0) {
printf("ips: can't alloc dma tag for adapter status\n");
error = ENOMEM;
@ -329,6 +331,8 @@ static int ips_send_drive_info_cmd(ips_command_t *command)
/* numsegs */ 1,
/* maxsegsize*/ IPS_DRIVE_INFO_LEN,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&command->data_dmatag) != 0) {
printf("ips: can't alloc dma tag for drive status\n");
error = ENOMEM;
@ -497,6 +501,8 @@ static int ips_read_nvram(ips_command_t *command){
/* numsegs */ 1,
/* maxsegsize*/ IPS_NVRAM_PAGE_SIZE,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&command->data_dmatag) != 0) {
printf("ips: can't alloc dma tag for nvram\n");
error = ENOMEM;

View File

@ -98,6 +98,8 @@ static int ips_ioctl_cmd(ips_softc_t *sc, ips_ioctl_t *ioctl_cmd, ips_user_reque
/* numsegs */ 1,
/* maxsegsize*/ ioctl_cmd->datasize,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&ioctl_cmd->dmatag) != 0) {
return ENOMEM;
}

View File

@ -128,6 +128,8 @@ static int ips_pci_attach(device_t dev)
/* numsegs */ IPS_MAX_SG_ELEMENTS,
/* maxsegsize*/ BUS_SPACE_MAXSIZE_32BIT,
/* flags */ 0,
/* lockfunc */ busdma_lock_mutex,
/* lockarg */ &Giant,
&sc->adapter_dmatag) != 0) {
printf("IPS can't alloc dma tag\n");
goto error;

View File

@ -1097,7 +1097,8 @@ isp_pci_mbxdma(struct ispsoftc *isp)
ISP_UNLOCK(isp);
if (bus_dma_tag_create(NULL, 1, slim+1, alim, alim,
NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, &pcs->dmat)) {
NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0,
busdma_lock_mutex, &Giant, &pcs->dmat)) {
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
ISP_LOCK(isp);
return(1);
@ -1131,7 +1132,8 @@ isp_pci_mbxdma(struct ispsoftc *isp)
ns = (len / PAGE_SIZE) + 1;
if (bus_dma_tag_create(pcs->dmat, QENTRY_LEN, slim+1, alim, alim,
NULL, NULL, len, ns, slim, 0, &isp->isp_cdmat)) {
NULL, NULL, len, ns, slim, 0, busdma_lock_mutex, &Giant,
&isp->isp_cdmat)) {
isp_prt(isp, ISP_LOGERR,
"cannot create a dma tag for control spaces");
free(pcs->dmaps, M_DEVBUF);

View File

@ -491,7 +491,8 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
if (bus_dma_tag_create(NULL, 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, &sbs->dmat)) {
BUS_SPACE_MAXADDR_24BIT, 0, busdma_lock_mutex, &Giant,
&sbs->dmat)) {
isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
ISP_LOCK(isp);
return(1);
@ -522,7 +523,8 @@ isp_sbus_mbxdma(struct ispsoftc *isp)
ns = (len / PAGE_SIZE) + 1;
if (bus_dma_tag_create(sbs->dmat, QENTRY_LEN, BUS_SPACE_MAXADDR_24BIT-1,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR_32BIT, NULL, NULL,
len, ns, BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_cdmat)) {
len, ns, BUS_SPACE_MAXADDR_24BIT, 0, busdma_lock_mutex, &Giant,
&isp->isp_cdmat)) {
isp_prt(isp, ISP_LOGERR,
"cannot create a dma tag for control spaces");
free(sbs->dmaps, M_DEVBUF);

View File

@ -215,6 +215,8 @@ lnc_isa_attach(device_t dev)
1, /* nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->dmat);
if (err) {

View File

@ -212,6 +212,8 @@ lnc_isa_attach(device_t dev)
1, /* nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->dmat);
if (err) {

View File

@ -154,6 +154,8 @@ lnc_pci_attach(device_t dev)
1, /* nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->dmat);
if (err) {

View File

@ -249,6 +249,8 @@ mlx_sglist_map(struct mlx_softc *sc)
segsize, 1, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->mlx_sg_dmat);
if (error != 0) {
device_printf(sc->mlx_dev, "can't allocate scatter/gather DMA tag\n");
@ -375,6 +377,8 @@ mlx_attach(struct mlx_softc *sc)
MAXBSIZE, MLX_NSEG, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->mlx_buffer_dmat);
if (error != 0) {
device_printf(sc->mlx_dev, "can't allocate buffer DMA tag\n");

View File

@ -196,6 +196,8 @@ mlx_pci_attach(device_t dev)
MAXBSIZE, MLX_NSEG, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&sc->mlx_parent_dmat);
if (error != 0) {
device_printf(dev, "can't allocate parent DMA tag\n");

View File

@ -407,6 +407,8 @@ mly_pci_attach(struct mly_softc *sc)
MAXBSIZE, MLY_MAX_SGENTRIES, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&sc->mly_parent_dmat)) {
mly_printf(sc, "can't allocate parent DMA tag\n");
goto fail;
@ -423,6 +425,8 @@ mly_pci_attach(struct mly_softc *sc)
MAXBSIZE, MLY_MAX_SGENTRIES, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->mly_buffer_dmat)) {
mly_printf(sc, "can't allocate buffer DMA tag\n");
goto fail;
@ -439,6 +443,8 @@ mly_pci_attach(struct mly_softc *sc)
sizeof(union mly_command_packet) * MLY_MAX_COMMANDS, 1, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->mly_packet_dmat)) {
mly_printf(sc, "can't allocate command packet DMA tag\n");
goto fail;
@ -586,6 +592,8 @@ mly_sg_map(struct mly_softc *sc)
segsize, 1, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->mly_sg_dmat)) {
mly_printf(sc, "can't allocate scatter/gather DMA tag\n");
return(ENOMEM);
@ -639,6 +647,8 @@ mly_mmbox_map(struct mly_softc *sc)
sizeof(struct mly_mmbox), 1, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->mly_mmbox_dmat)) {
mly_printf(sc, "can't allocate memory mailbox DMA tag\n");
return(ENOMEM);

View File

@ -502,7 +502,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
if (bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT,
BUS_SPACE_MAXSIZE_32BIT, BUS_SPACE_UNRESTRICTED, 0,
&mpt->parent_dmat) != 0) {
busdma_lock_mutex, &Giant, &mpt->parent_dmat) != 0) {
device_printf(dev, "cannot create parent dma tag\n");
return (1);
}
@ -511,7 +511,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE,
0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, PAGE_SIZE, 1, BUS_SPACE_MAXSIZE_32BIT, 0,
&mpt->reply_dmat) != 0) {
busdma_lock_mutex, &Giant, &mpt->reply_dmat) != 0) {
device_printf(dev, "cannot create a dma tag for replies\n");
return (1);
}
@ -542,7 +542,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE,
0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, MAXBSIZE, MPT_SGL_MAX, BUS_SPACE_MAXSIZE_32BIT, 0,
&mpt->buffer_dmat) != 0) {
busdma_lock_mutex, &Giant, &mpt->buffer_dmat) != 0) {
device_printf(dev,
"cannot create a dma tag for data buffers\n");
return (1);
@ -552,7 +552,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
if (bus_dma_tag_create(mpt->parent_dmat, PAGE_SIZE,
0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL, MPT_REQ_MEM_SIZE(mpt), 1, BUS_SPACE_MAXSIZE_32BIT, 0,
&mpt->request_dmat) != 0) {
busdma_lock_mutex, &Giant, &mpt->request_dmat) != 0) {
device_printf(dev, "cannot create a dma tag for requests\n");
return (1);
}

View File

@ -611,7 +611,8 @@ ad1816_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/ad1816->bufsize, /*nsegments*/1,
/*maxsegz*/0x3ffff,
/*flags*/0, &ad1816->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/ &Giant, &ad1816->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto no;
}

View File

@ -855,7 +855,8 @@ ess_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsize, /*nsegments*/1,
/*maxsegz*/0x3ffff,
/*flags*/0, &sc->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto no;
}

View File

@ -1720,8 +1720,9 @@ mss_doattach(device_t dev, struct mss_info *mss)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/mss->bufsize, /*nsegments*/1,
/*maxsegz*/0x3ffff,
/*flags*/0, &mss->parent_dmat) != 0) {
/*maxsegz*/0x3ffff, /*flags*/0,
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
&mss->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto no;
}

View File

@ -812,8 +812,9 @@ sb16_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sb->bufsize, /*nsegments*/1,
/*maxsegz*/0x3ffff,
/*flags*/0, &sb->parent_dmat) != 0) {
/*maxsegz*/0x3ffff, /*flags*/0,
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
&sb->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto no;
}

View File

@ -723,8 +723,9 @@ sb_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sb->bufsize, /*nsegments*/1,
/*maxsegz*/0x3ffff,
/*flags*/0, &sb->parent_dmat) != 0) {
/*maxsegz*/0x3ffff, /*flags*/0,
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
&sb->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto no;
}

View File

@ -745,7 +745,8 @@ als_resource_grab(device_t dev, struct sc_info *sc)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsz,
/*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &sc->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -545,7 +545,7 @@ au88x0_pci_attach(device_t dev)
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, /* restrict to 4GB */
NULL, NULL, /* no filter */
aui->aui_bufsize, 1, aui->aui_bufsize,
0, &aui->aui_dmat);
0, busdma_lock_mutex, &Giant, &aui->aui_dmat);
if (error != 0) {
device_printf(dev, "failed to create DMA tag\n");
goto failed;

View File

@ -641,7 +641,8 @@ au_pci_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/AU_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &au->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &au->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -876,6 +876,8 @@ cmi_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsz, /*nsegments*/1,
/*maxsegz*/0x3ffff, /*flags*/0,
/*lockfunc*/busdma_lock_mutex,
/*lockfunc*/&Giant,
&sc->parent_dmat) != 0) {
device_printf(dev, "cmi_attach: Unable to create dma tag\n");
goto bad;

View File

@ -830,7 +830,8 @@ cs4281_pci_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsz, /*nsegments*/1,
/*maxsegz*/0x3ffff,
/*flags*/0, &sc->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -679,7 +679,8 @@ csa_allocres(struct csa_info *csa, device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/CS461x_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &csa->parent_dmat) != 0)
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &csa->parent_dmat) != 0)
return (1);
return (0);

View File

@ -828,7 +828,8 @@ ds_init(struct sc_info *sc)
if (sc->regbase == NULL) {
if (bus_dma_tag_create(NULL, 2, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL, memsz, 1, memsz, 0, &sc->control_dmat))
NULL, NULL, memsz, 1, memsz, 0, busdma_lock_mutex,
&Giant, &sc->control_dmat))
return -1;
if (bus_dmamem_alloc(sc->control_dmat, &buf, BUS_DMA_NOWAIT, &sc->map))
return -1;
@ -968,7 +969,8 @@ ds_pci_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &sc->buffer_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->buffer_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -1494,7 +1494,8 @@ emu_pci_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &sc->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -902,7 +902,8 @@ es_pci_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/es->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &es->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &es->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -632,7 +632,8 @@ fm801_pci_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/fm801->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &fm801->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &fm801->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto oops;
}

View File

@ -708,7 +708,8 @@ ich_pci_attach(device_t dev)
sc->bufsz = pcm_getbuffersize(dev, 4096, ICH_DEFAULT_BUFSZ, ICH_MAX_BUFSZ);
if (bus_dma_tag_create(NULL, 8, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL, sc->bufsz, 1, 0x3ffff, 0, &sc->dmat) != 0) {
NULL, NULL, sc->bufsz, 1, 0x3ffff, 0,
busdma_lock_mutex, &Giant, &sc->dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -972,7 +972,8 @@ agg_attach(device_t dev)
/*lowaddr*/MAESTRO_MAXADDR, /*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/ess->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &ess->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &ess->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -1146,7 +1146,8 @@ m3_pci_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsz, /*nsegments*/1,
/*maxsegz*/0x3ffff,
/*flags*/0, &sc->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -991,7 +991,8 @@ ess_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsz, /*nsegments*/1,
/*maxsegz*/0x3ffff,
/*flags*/0, &sc->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto no;
}

View File

@ -854,7 +854,8 @@ tr_pci_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/tr->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &tr->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &tr->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -792,7 +792,8 @@ via_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/via->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &via->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &via->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}
@ -808,7 +809,8 @@ via_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/NSEGS * sizeof(struct via_dma_op),
/*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &via->sgd_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &via->sgd_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -544,7 +544,8 @@ via_attach(device_t dev)
/*highaddr*/BUS_SPACE_MAXADDR,
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/via->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &via->parent_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &via->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}
@ -560,7 +561,8 @@ via_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/NSEGS * sizeof(struct via_dma_op),
/*nsegments*/1, /*maxsegz*/0x3ffff,
/*flags*/0, &via->sgd_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &via->sgd_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;
}

View File

@ -776,7 +776,8 @@ sv_attach(device_t dev) {
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/sc->bufsz, /*nsegments*/1,
/*maxsegz*/0x3ffff, /*flags*/0,
&sc->parent_dmat) != 0) {
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
device_printf(dev, "sv_attach: Unable to create dma tag\n");
goto fail;
}

View File

@ -307,6 +307,8 @@ ua_attach(device_t dev)
/*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/bufsz, /*nsegments*/1,
/*maxsegz*/0x3fff, /*flags*/0,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant,
&ua->parent_dmat) != 0) {
device_printf(dev, "unable to create dma tag\n");
goto bad;

View File

@ -89,6 +89,8 @@
#include <sys/malloc.h>
#include <sys/endian.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#ifdef FreeBSD_Bus_Io_Abstraction
#include <sys/module.h>
#include <sys/bus.h>
@ -783,7 +785,8 @@ static m_pool_s *___cre_dma_pool(bus_dma_tag_t dev_dmat)
BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR_32BIT,
NULL, NULL, MEMO_CLUSTER_SIZE, 1,
MEMO_CLUSTER_SIZE, 0, &mp->dmat)) {
MEMO_CLUSTER_SIZE, 0,
busdma_lock_mutex, &Giant, &mp->dmat)) {
mp->getp = ___dma_getp;
#ifdef MEMO_FREE_UNUSED
mp->freep = ___dma_freep;
@ -9130,7 +9133,8 @@ sym_pci_attach2(pcici_t pci_tag, int unit)
BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
NULL, NULL,
BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG,
(1<<24), 0, &np->data_dmat)) {
(1<<24), 0, busdma_lock_mutex, &Giant,
&np->data_dmat)) {
device_printf(dev, "failed to create DMA tag.\n");
goto attach_failed;
}

View File

@ -3016,6 +3016,8 @@ trm_initSRB(PACB pACB)
/*nsegments*/ 1,
/*maxsegsz*/ TRM_MAXTRANSFER_SIZE,
/*flags*/ 0,
/*lockfunc*/ busdma_lock_mutex,
/*lockarg*/ &Giant,
/*dmat*/ &pSRB->sg_dmat) != 0) {
return ENXIO;
}
@ -3408,18 +3410,21 @@ trm_init(u_int16_t unit, device_t dev)
pACB->dev = dev;
pACB->tag = rman_get_bustag(pACB->iores);
pACB->bsh = rman_get_bushandle(pACB->iores);
if (bus_dma_tag_create(/*parent_dmat*/ pACB->parent_dmat,
/*alignment*/ 1,
/*boundary*/ 0,
/*lowaddr*/ BUS_SPACE_MAXADDR,
/*highaddr*/ BUS_SPACE_MAXADDR,
/*filter*/ NULL,
/*filterarg*/ NULL,
/*maxsize*/ MAXBSIZE,
/*nsegments*/ TRM_NSEG,
/*maxsegsz*/ TRM_MAXTRANSFER_SIZE,
/*flags*/ BUS_DMA_ALLOCNOW,
&pACB->buffer_dmat) != 0)
if (bus_dma_tag_create(
/*parent_dmat*/ pACB->parent_dmat,
/*alignment*/ 1,
/*boundary*/ 0,
/*lowaddr*/ BUS_SPACE_MAXADDR,
/*highaddr*/ BUS_SPACE_MAXADDR,
/*filter*/ NULL,
/*filterarg*/ NULL,
/*maxsize*/ MAXBSIZE,
/*nsegments*/ TRM_NSEG,
/*maxsegsz*/ TRM_MAXTRANSFER_SIZE,
/*flags*/ BUS_DMA_ALLOCNOW,
/*lockfunc*/ busdma_lock_mutex,
/*lockarg*/ &Giant,
/* dmat */ &pACB->buffer_dmat) != 0)
goto bad;
/* DMA tag for our ccb structures */
if (bus_dma_tag_create(
@ -3433,7 +3438,9 @@ trm_init(u_int16_t unit, device_t dev)
/*maxsize*/ TRM_MAX_SRB_CNT * sizeof(TRM_SRB),
/*nsegments*/ 1,
/*maxsegsz*/ TRM_MAXTRANSFER_SIZE,
/*flags*/ 0,
/*flags*/ 0,
/*lockfunc*/ busdma_lock_mutex,
/*lockarg*/ &Giant,
/*dmat*/ &pACB->srb_dmat) != 0) {
printf("trm_init %d: bus_dma_tag_create SRB failure\n", unit);
goto bad;
@ -3455,7 +3462,8 @@ trm_init(u_int16_t unit, device_t dev)
sizeof(struct scsi_sense_data) * TRM_MAX_SRB_CNT,
/*nsegments*/1,
/*maxsegsz*/TRM_MAXTRANSFER_SIZE,
/*flags*/0, &pACB->sense_dmat) != 0) {
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant, &pACB->sense_dmat) != 0) {
if (bootverbose)
device_printf(dev, "cannot create sense buffer dmat\n");
goto bad;

View File

@ -233,6 +233,8 @@ twe_attach(device_t dev)
MAXBSIZE, TWE_MAX_SGL_LENGTH, /* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&sc->twe_parent_dmat)) {
twe_printf(sc, "can't allocate parent DMA tag\n");
twe_free(sc);
@ -265,6 +267,8 @@ twe_attach(device_t dev)
MAXBSIZE, TWE_MAX_SGL_LENGTH,/* maxsize, nsegments */
BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */
0, /* flags */
busdma_lock_mutex, /* lockfunc */
&Giant, /* lockarg */
&sc->twe_buffer_dmat)) {
twe_printf(sc, "can't allocate data buffer DMA tag\n");
twe_free(sc);

View File

@ -280,7 +280,7 @@ epic_attach(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, &sc->mtag);
EPIC_MAX_FRAGS, MCLBYTES, 0, busdma_lock_mutex, &Giant, &sc->mtag);
if (error) {
device_printf(dev, "couldn't allocate dma tag\n");
goto fail;
@ -289,7 +289,8 @@ epic_attach(dev)
error = bus_dma_tag_create(NULL, 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, &sc->rtag);
1, sizeof(struct epic_rx_desc) * RX_RING_SIZE, 0, busdma_lock_mutex,
&Giant, &sc->rtag);
if (error) {
device_printf(dev, "couldn't allocate dma tag\n");
goto fail;
@ -298,7 +299,8 @@ epic_attach(dev)
error = bus_dma_tag_create(NULL, 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, &sc->ttag);
1, sizeof(struct epic_tx_desc) * TX_RING_SIZE, 0,
busdma_lock_mutex, &Giant, &sc->ttag);
if (error) {
device_printf(dev, "couldn't allocate dma tag\n");
goto fail;
@ -307,7 +309,8 @@ epic_attach(dev)
error = bus_dma_tag_create(NULL, 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, &sc->ftag);
1, sizeof(struct epic_frag_list) * TX_RING_SIZE, 0,
busdma_lock_mutex, &Giant, &sc->ftag);
if (error) {
device_printf(dev, "couldn't allocate dma tag\n");
goto fail;

View File

@ -367,6 +367,7 @@ ubsec_attach(device_t dev)
UBS_MAX_SCATTER, /* nsegments */
0xffff, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, NULL, /* lockfunc, lockarg */
&sc->sc_dmat)) {
device_printf(dev, "cannot allocate DMA tag\n");
goto bad4;
@ -1851,6 +1852,7 @@ ubsec_dma_malloc(
1, /* nsegments */
size, /* maxsegsize */
BUS_DMA_ALLOCNOW, /* flags */
NULL, NULL, /* lockfunc, lockarg */
&dma->dma_tag);
if (r != 0) {
device_printf(sc->sc_dev, "ubsec_dma_malloc: "

View File

@ -553,6 +553,8 @@ wds_attach(device_t dev)
/*maxsize*/ sizeof(* wp->dx),
/*nsegments*/ 1,
/*maxsegsz*/ sizeof(* wp->dx), /*flags*/ 0,
/*lockfunc*/busdma_lock_mutex,
/*lockarg*/&Giant,
&wp->bustag);
if (error)
goto bad;

View File

@ -765,6 +765,14 @@ wi_stop(struct ifnet *ifp, int disable)
ieee80211_new_state(ifp, IEEE80211_S_INIT, -1);
if (sc->sc_enabled && !sc->wi_gone) {
int i;
/* wait for the busy bit to clear */
for (i = 50; i > 0; i--) { /* 5s */
if (!(CSR_READ_2(sc, WI_COMMAND) & WI_CMD_BUSY))
break;
printf("Sleeping for 10ms in wi_stop\n");
DELAY(10*10000); /* 10 m sec */
}
CSR_WRITE_2(sc, WI_INT_EN, 0);
wi_cmd(sc, WI_CMD_DISABLE | sc->sc_portnum, 0, 0, 0);
if (disable) {
@ -1440,7 +1448,9 @@ wi_rx_intr(struct wi_softc *sc)
if (ic->ic_opmode == IEEE80211_M_IBSS && dir == IEEE80211_FC1_DIR_NODS)
wi_sync_bssid(sc, wh->i_addr3);
WI_UNLOCK(sc);
ieee80211_input(ifp, m, rssi, rstamp, 0);
WI_LOCK(sc);
}
static void

View File

@ -315,7 +315,8 @@ acpi_alloc_wakeup_handler(void)
if (bus_dma_tag_create(/* parent */ NULL, /* alignment */ 2, 0,
/* lowaddr below 1MB */ 0x9ffff,
/* highaddr */ BUS_SPACE_MAXADDR, NULL, NULL,
PAGE_SIZE, 1, PAGE_SIZE, 0, &acpi_waketag) != 0) {
PAGE_SIZE, 1, PAGE_SIZE, 0, busdma_lock_mutex,
&Giant, &acpi_waketag) != 0) {
printf("acpi_alloc_wakeup_handler: unable to create wake tag\n");
return;
}

Some files were not shown because too many files have changed in this diff Show More