De-orbit bus_dmamem_alloc_size(). It's a hack and was never used anyways.
No need for it to pollute the 5.x API any further. Approved by: re (bmah)
This commit is contained in:
parent
ca1c469cc7
commit
c87d464f28
@ -350,18 +350,14 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map)
|
||||
* A dmamap to for use with dmamap_load is also allocated.
|
||||
*/
|
||||
int
|
||||
bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp, bus_size_t size)
|
||||
bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp)
|
||||
{
|
||||
|
||||
if (size > dmat->maxsize)
|
||||
return (ENOMEM);
|
||||
|
||||
/* If we succeed, no mapping/bouncing will be required */
|
||||
*mapp = &nobounce_dmamap;
|
||||
|
||||
if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) {
|
||||
*vaddr = malloc(size, M_DEVBUF,
|
||||
if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) {
|
||||
*vaddr = malloc(dmat->maxsize, M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||
} else {
|
||||
/*
|
||||
@ -370,7 +366,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
* multi-seg allocations yet though.
|
||||
*/
|
||||
mtx_lock(&Giant);
|
||||
*vaddr = contigmalloc(size, M_DEVBUF,
|
||||
*vaddr = contigmalloc(dmat->maxsize, M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
|
||||
0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
|
||||
dmat->boundary);
|
||||
@ -381,20 +377,12 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp)
|
||||
{
|
||||
return (bus_dmamem_alloc_size(dmat, vaddr, flags, mapp, dmat->maxsize));
|
||||
}
|
||||
|
||||
/*
|
||||
* Free a piece of memory and it's allociated dmamap, that was allocated
|
||||
* via bus_dmamem_alloc.
|
||||
*/
|
||||
void
|
||||
bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
bus_size_t size)
|
||||
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
|
||||
{
|
||||
/*
|
||||
* dmamem does not need to be bounced, so the map should be
|
||||
@ -402,21 +390,15 @@ bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
*/
|
||||
if (map != &nobounce_dmamap)
|
||||
panic("bus_dmamem_free: Invalid map freed\n");
|
||||
if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem))
|
||||
if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem))
|
||||
free(vaddr, M_DEVBUF);
|
||||
else {
|
||||
mtx_lock(&Giant);
|
||||
contigfree(vaddr, size, M_DEVBUF);
|
||||
contigfree(vaddr, dmat->maxsize, M_DEVBUF);
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
|
||||
{
|
||||
bus_dmamem_free_size(dmat, vaddr, map, dmat->maxsize);
|
||||
}
|
||||
|
||||
#define BUS_DMAMAP_NSEGS ((64 * 1024 / PAGE_SIZE) + 1)
|
||||
|
||||
/*
|
||||
|
@ -567,9 +567,6 @@ int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map);
|
||||
* bus device space based on the constraints lited in the dma tag.
|
||||
* A dmamap to for use with dmamap_load is also allocated.
|
||||
*/
|
||||
int bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp, bus_size_t size);
|
||||
|
||||
int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp);
|
||||
|
||||
@ -577,9 +574,6 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
* Free a piece of memory and it's allociated dmamap, that was allocated
|
||||
* via bus_dmamem_alloc.
|
||||
*/
|
||||
void bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
bus_size_t size);
|
||||
|
||||
void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
|
||||
|
||||
/*
|
||||
|
@ -338,19 +338,15 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map)
|
||||
* A dmamap to for use with dmamap_load is also allocated.
|
||||
*/
|
||||
int
|
||||
bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp, bus_size_t size)
|
||||
bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp)
|
||||
{
|
||||
|
||||
if (size > dmat->maxsize)
|
||||
return (ENOMEM);
|
||||
|
||||
/* If we succeed, no mapping/bouncing will be required */
|
||||
*mapp = NULL;
|
||||
|
||||
if ((size <= PAGE_SIZE) &&
|
||||
if ((dmat->maxsize <= PAGE_SIZE) &&
|
||||
dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) {
|
||||
*vaddr = malloc(size, M_DEVBUF,
|
||||
*vaddr = malloc(dmat->maxsize, M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||
} else {
|
||||
/*
|
||||
@ -359,7 +355,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
* multi-seg allocations yet though.
|
||||
*/
|
||||
mtx_lock(&Giant);
|
||||
*vaddr = contigmalloc(size, M_DEVBUF,
|
||||
*vaddr = contigmalloc(dmat->maxsize, M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
|
||||
0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
|
||||
dmat->boundary);
|
||||
@ -370,20 +366,12 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp)
|
||||
{
|
||||
return (bus_dmamem_alloc_size(dmat, vaddr, flags, mapp, dmat->maxsize));
|
||||
}
|
||||
|
||||
/*
|
||||
* Free a piece of memory and it's allociated dmamap, that was allocated
|
||||
* via bus_dmamem_alloc. Make the same choice for free/contigfree.
|
||||
*/
|
||||
void
|
||||
bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
bus_size_t size)
|
||||
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
|
||||
{
|
||||
/*
|
||||
* dmamem does not need to be bounced, so the map should be
|
||||
@ -391,21 +379,16 @@ bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
*/
|
||||
if (map != NULL)
|
||||
panic("bus_dmamem_free: Invalid map freed\n");
|
||||
if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem))
|
||||
if ((dmat->maxsize <= PAGE_SIZE)
|
||||
&& dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem))
|
||||
free(vaddr, M_DEVBUF);
|
||||
else {
|
||||
mtx_lock(&Giant);
|
||||
contigfree(vaddr, size, M_DEVBUF);
|
||||
contigfree(vaddr, dmat->maxsize, M_DEVBUF);
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
|
||||
{
|
||||
bus_dmamem_free_size(dmat, vaddr, map, dmat->maxsize);
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility function to load a linear buffer. lastaddrp holds state
|
||||
* between invocations (for multiple-buffer loads). segp contains
|
||||
|
@ -176,9 +176,6 @@ int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map);
|
||||
* bus device space based on the constraints lited in the dma tag.
|
||||
* A dmamap to for use with dmamap_load is also allocated.
|
||||
*/
|
||||
int bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp, bus_size_t size);
|
||||
|
||||
int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp);
|
||||
|
||||
@ -186,9 +183,6 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
* Free a piece of memory and it's allociated dmamap, that was allocated
|
||||
* via bus_dmamem_alloc.
|
||||
*/
|
||||
void bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
bus_size_t size);
|
||||
|
||||
void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
|
||||
|
||||
/*
|
||||
|
@ -338,19 +338,15 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map)
|
||||
* A dmamap to for use with dmamap_load is also allocated.
|
||||
*/
|
||||
int
|
||||
bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp, bus_size_t size)
|
||||
bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp)
|
||||
{
|
||||
|
||||
if (size > dmat->maxsize)
|
||||
return (ENOMEM);
|
||||
|
||||
/* If we succeed, no mapping/bouncing will be required */
|
||||
*mapp = NULL;
|
||||
|
||||
if ((size <= PAGE_SIZE) &&
|
||||
if ((dmat->maxsize <= PAGE_SIZE) &&
|
||||
dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem)) {
|
||||
*vaddr = malloc(size, M_DEVBUF,
|
||||
*vaddr = malloc(dmat->maxsize, M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
|
||||
} else {
|
||||
/*
|
||||
@ -359,7 +355,7 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
* multi-seg allocations yet though.
|
||||
*/
|
||||
mtx_lock(&Giant);
|
||||
*vaddr = contigmalloc(size, M_DEVBUF,
|
||||
*vaddr = contigmalloc(dmat->maxsize, M_DEVBUF,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
|
||||
0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul,
|
||||
dmat->boundary);
|
||||
@ -370,20 +366,12 @@ bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp)
|
||||
{
|
||||
return (bus_dmamem_alloc_size(dmat, vaddr, flags, mapp, dmat->maxsize));
|
||||
}
|
||||
|
||||
/*
|
||||
* Free a piece of memory and it's allociated dmamap, that was allocated
|
||||
* via bus_dmamem_alloc. Make the same choice for free/contigfree.
|
||||
*/
|
||||
void
|
||||
bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
bus_size_t size)
|
||||
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
|
||||
{
|
||||
/*
|
||||
* dmamem does not need to be bounced, so the map should be
|
||||
@ -391,21 +379,16 @@ bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
*/
|
||||
if (map != NULL)
|
||||
panic("bus_dmamem_free: Invalid map freed\n");
|
||||
if ((size <= PAGE_SIZE) && dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem))
|
||||
if ((dmat->maxsize <= PAGE_SIZE)
|
||||
&& dmat->lowaddr >= ptoa((vm_paddr_t)Maxmem))
|
||||
free(vaddr, M_DEVBUF);
|
||||
else {
|
||||
mtx_lock(&Giant);
|
||||
contigfree(vaddr, size, M_DEVBUF);
|
||||
contigfree(vaddr, dmat->maxsize, M_DEVBUF);
|
||||
mtx_unlock(&Giant);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
|
||||
{
|
||||
bus_dmamem_free_size(dmat, vaddr, map, dmat->maxsize);
|
||||
}
|
||||
|
||||
/*
|
||||
* Utility function to load a linear buffer. lastaddrp holds state
|
||||
* between invocations (for multiple-buffer loads). segp contains
|
||||
|
@ -176,9 +176,6 @@ int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map);
|
||||
* bus device space based on the constraints lited in the dma tag.
|
||||
* A dmamap to for use with dmamap_load is also allocated.
|
||||
*/
|
||||
int bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp, bus_size_t size);
|
||||
|
||||
int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp);
|
||||
|
||||
@ -186,9 +183,6 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
* Free a piece of memory and it's allociated dmamap, that was allocated
|
||||
* via bus_dmamem_alloc.
|
||||
*/
|
||||
void bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
bus_size_t size);
|
||||
|
||||
void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
|
||||
|
||||
/*
|
||||
|
@ -980,12 +980,8 @@ struct bus_dma_tag {
|
||||
/*
|
||||
* DMA memory utility functions.
|
||||
*/
|
||||
int (*dt_dmamem_alloc_size)(bus_dma_tag_t, bus_dma_tag_t, void **,
|
||||
int, bus_dmamap_t *, bus_size_t size);
|
||||
int (*dt_dmamem_alloc)(bus_dma_tag_t, bus_dma_tag_t, void **, int,
|
||||
bus_dmamap_t *);
|
||||
void (*dt_dmamem_free_size)(bus_dma_tag_t, bus_dma_tag_t, void *,
|
||||
bus_dmamap_t, bus_size_t size);
|
||||
void (*dt_dmamem_free)(bus_dma_tag_t, bus_dma_tag_t, void *,
|
||||
bus_dmamap_t);
|
||||
};
|
||||
@ -1095,19 +1091,6 @@ sparc64_dmamap_sync(bus_dma_tag_t pt, bus_dma_tag_t dt, bus_dmamap_t m, int op)
|
||||
#define bus_dmamap_sync(t, m, op) \
|
||||
sparc64_dmamap_sync((t), (t), (m), (op))
|
||||
|
||||
static __inline int
|
||||
sparc64_dmamem_alloc_size(bus_dma_tag_t pt, bus_dma_tag_t dt, void **v, int f,
|
||||
bus_dmamap_t *m, bus_size_t s)
|
||||
{
|
||||
bus_dma_tag_t lt;
|
||||
|
||||
for (lt = pt; lt->dt_dmamem_alloc_size == NULL; lt = lt->dt_parent)
|
||||
;
|
||||
return ((*lt->dt_dmamem_alloc_size)(lt, dt, v, f, m, s));
|
||||
}
|
||||
#define bus_dmamem_alloc_size(t, v, f, m, s) \
|
||||
sparc64_dmamem_alloc_size((t), (t), (v), (f), (m), (s))
|
||||
|
||||
static __inline int
|
||||
sparc64_dmamem_alloc(bus_dma_tag_t pt, bus_dma_tag_t dt, void **v, int f,
|
||||
bus_dmamap_t *m)
|
||||
@ -1121,19 +1104,6 @@ sparc64_dmamem_alloc(bus_dma_tag_t pt, bus_dma_tag_t dt, void **v, int f,
|
||||
#define bus_dmamem_alloc(t, v, f, m) \
|
||||
sparc64_dmamem_alloc((t), (t), (v), (f), (m))
|
||||
|
||||
static __inline void
|
||||
sparc64_dmamem_free_size(bus_dma_tag_t pt, bus_dma_tag_t dt, void *v,
|
||||
bus_dmamap_t m, bus_size_t s)
|
||||
{
|
||||
bus_dma_tag_t lt;
|
||||
|
||||
for (lt = pt; lt->dt_dmamem_free_size == NULL; lt = lt->dt_parent)
|
||||
;
|
||||
(*lt->dt_dmamem_free_size)(lt, dt, v, m, s);
|
||||
}
|
||||
#define bus_dmamem_free_size(t, v, m, s) \
|
||||
sparc64_dmamem_free_size((t), (t), (v), (m), (s))
|
||||
|
||||
static __inline void
|
||||
sparc64_dmamem_free(bus_dma_tag_t pt, bus_dma_tag_t dt, void *v,
|
||||
bus_dmamap_t m)
|
||||
|
@ -95,12 +95,8 @@ void iommu_dvmamap_unload(bus_dma_tag_t, bus_dma_tag_t, struct iommu_state *,
|
||||
bus_dmamap_t);
|
||||
void iommu_dvmamap_sync(bus_dma_tag_t, bus_dma_tag_t, struct iommu_state *,
|
||||
bus_dmamap_t, int);
|
||||
int iommu_dvmamem_alloc_size(bus_dma_tag_t, bus_dma_tag_t, struct iommu_state *,
|
||||
void **, int, bus_dmamap_t *, bus_size_t size);
|
||||
int iommu_dvmamem_alloc(bus_dma_tag_t, bus_dma_tag_t, struct iommu_state *,
|
||||
void **, int, bus_dmamap_t *);
|
||||
void iommu_dvmamem_free_size(bus_dma_tag_t, bus_dma_tag_t, struct iommu_state *,
|
||||
void *, bus_dmamap_t, bus_size_t size);
|
||||
void iommu_dvmamem_free(bus_dma_tag_t, bus_dma_tag_t, struct iommu_state *,
|
||||
void *, bus_dmamap_t);
|
||||
|
||||
|
@ -112,12 +112,8 @@ static int psycho_dmamap_load_uio(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
|
||||
struct uio *, bus_dmamap_callback2_t *, void *, int);
|
||||
static void psycho_dmamap_unload(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t);
|
||||
static void psycho_dmamap_sync(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t, int);
|
||||
static int psycho_dmamem_alloc_size(bus_dma_tag_t, bus_dma_tag_t, void **, int,
|
||||
bus_dmamap_t *, bus_size_t size);
|
||||
static int psycho_dmamem_alloc(bus_dma_tag_t, bus_dma_tag_t, void **, int,
|
||||
bus_dmamap_t *);
|
||||
static void psycho_dmamem_free_size(bus_dma_tag_t, bus_dma_tag_t, void *,
|
||||
bus_dmamap_t, bus_size_t size);
|
||||
static void psycho_dmamem_free(bus_dma_tag_t, bus_dma_tag_t, void *,
|
||||
bus_dmamap_t);
|
||||
|
||||
@ -501,9 +497,7 @@ psycho_attach(device_t dev)
|
||||
sc->sc_dmat->dt_dmamap_load_uio = psycho_dmamap_load_uio;
|
||||
sc->sc_dmat->dt_dmamap_unload = psycho_dmamap_unload;
|
||||
sc->sc_dmat->dt_dmamap_sync = psycho_dmamap_sync;
|
||||
sc->sc_dmat->dt_dmamem_alloc_size = psycho_dmamem_alloc_size;
|
||||
sc->sc_dmat->dt_dmamem_alloc = psycho_dmamem_alloc;
|
||||
sc->sc_dmat->dt_dmamem_free_size = psycho_dmamem_free_size;
|
||||
sc->sc_dmat->dt_dmamem_free = psycho_dmamem_free;
|
||||
/* XXX: register as root dma tag (kluge). */
|
||||
sparc64_root_dma_tag = sc->sc_dmat;
|
||||
@ -1319,17 +1313,6 @@ psycho_alloc_bus_tag(struct psycho_softc *sc, int type)
|
||||
/*
|
||||
* hooks into the iommu dvma calls.
|
||||
*/
|
||||
static int
|
||||
psycho_dmamem_alloc_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
||||
int flags, bus_dmamap_t *mapp, bus_size_t size)
|
||||
{
|
||||
struct psycho_softc *sc;
|
||||
|
||||
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||
return (iommu_dvmamem_alloc_size(pdmat, ddmat, sc->sc_is, vaddr, flags,
|
||||
mapp, size));
|
||||
}
|
||||
|
||||
static int
|
||||
psycho_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
||||
int flags, bus_dmamap_t *mapp)
|
||||
@ -1341,16 +1324,6 @@ psycho_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
||||
mapp));
|
||||
}
|
||||
|
||||
static void
|
||||
psycho_dmamem_free_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
|
||||
bus_dmamap_t map, bus_size_t size)
|
||||
{
|
||||
struct psycho_softc *sc;
|
||||
|
||||
sc = (struct psycho_softc *)pdmat->dt_cookie;
|
||||
iommu_dvmamem_free_size(pdmat, ddmat, sc->sc_is, vaddr, map, size);
|
||||
}
|
||||
|
||||
static void
|
||||
psycho_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
|
||||
bus_dmamap_t map)
|
||||
|
@ -243,12 +243,8 @@ static int sbus_dmamap_load_uio(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
|
||||
struct uio *, bus_dmamap_callback2_t *, void *, int);
|
||||
static void sbus_dmamap_unload(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t);
|
||||
static void sbus_dmamap_sync(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t, int);
|
||||
static int sbus_dmamem_alloc_size(bus_dma_tag_t, bus_dma_tag_t, void **, int,
|
||||
bus_dmamap_t *, bus_size_t size);
|
||||
static int sbus_dmamem_alloc(bus_dma_tag_t, bus_dma_tag_t, void **, int,
|
||||
bus_dmamap_t *);
|
||||
static void sbus_dmamem_free_size(bus_dma_tag_t, bus_dma_tag_t, void *,
|
||||
bus_dmamap_t, bus_size_t);
|
||||
static void sbus_dmamem_free(bus_dma_tag_t, bus_dma_tag_t, void *,
|
||||
bus_dmamap_t);
|
||||
|
||||
@ -352,9 +348,7 @@ sbus_probe(device_t dev)
|
||||
sc->sc_cdmatag->dt_dmamap_load_uio = sbus_dmamap_load_uio;
|
||||
sc->sc_cdmatag->dt_dmamap_unload = sbus_dmamap_unload;
|
||||
sc->sc_cdmatag->dt_dmamap_sync = sbus_dmamap_sync;
|
||||
sc->sc_cdmatag->dt_dmamem_alloc_size = sbus_dmamem_alloc_size;
|
||||
sc->sc_cdmatag->dt_dmamem_alloc = sbus_dmamem_alloc;
|
||||
sc->sc_cdmatag->dt_dmamem_free_size = sbus_dmamem_free_size;
|
||||
sc->sc_cdmatag->dt_dmamem_free = sbus_dmamem_free;
|
||||
/* XXX: register as root dma tag (kluge). */
|
||||
sparc64_root_dma_tag = sc->sc_cdmatag;
|
||||
@ -992,16 +986,6 @@ sbus_dmamap_sync(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, bus_dmamap_t map,
|
||||
iommu_dvmamap_sync(pdmat, ddmat, &sc->sc_is, map, op);
|
||||
}
|
||||
|
||||
static int
|
||||
sbus_dmamem_alloc_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
||||
int flags, bus_dmamap_t *mapp, bus_size_t size)
|
||||
{
|
||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||
|
||||
return (iommu_dvmamem_alloc_size(pdmat, ddmat, &sc->sc_is, vaddr, flags,
|
||||
mapp, size));
|
||||
}
|
||||
|
||||
static int
|
||||
sbus_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
||||
int flags, bus_dmamap_t *mapp)
|
||||
@ -1012,15 +996,6 @@ sbus_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
|
||||
mapp));
|
||||
}
|
||||
|
||||
static void
|
||||
sbus_dmamem_free_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
|
||||
bus_dmamap_t map, bus_size_t size)
|
||||
{
|
||||
struct sbus_softc *sc = (struct sbus_softc *)pdmat->dt_cookie;
|
||||
|
||||
iommu_dvmamem_free_size(pdmat, ddmat, &sc->sc_is, vaddr, map, size);
|
||||
}
|
||||
|
||||
static void
|
||||
sbus_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
|
||||
bus_dmamap_t map)
|
||||
|
@ -668,22 +668,18 @@ iommu_dvma_vallocseg(bus_dma_tag_t dt, struct iommu_state *is, bus_dmamap_t map,
|
||||
}
|
||||
|
||||
int
|
||||
iommu_dvmamem_alloc_size(bus_dma_tag_t pt, bus_dma_tag_t dt,
|
||||
struct iommu_state *is, void **vaddr, int flags, bus_dmamap_t *mapp,
|
||||
bus_size_t size)
|
||||
iommu_dvmamem_alloc(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
||||
void **vaddr, int flags, bus_dmamap_t *mappe)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (size > dt->dt_maxsize)
|
||||
return (ENOMEM);
|
||||
|
||||
/*
|
||||
* XXX: This will break for 32 bit transfers on machines with more than
|
||||
* 16G (1 << 34 bytes) of memory.
|
||||
*/
|
||||
if ((error = sparc64_dmamem_alloc_map(dt, mapp)) != 0)
|
||||
return (error);
|
||||
if ((*vaddr = malloc(size, M_IOMMU,
|
||||
if ((*vaddr = malloc(dt->dt_maxsize, M_IOMMU,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) {
|
||||
error = ENOMEM;
|
||||
sparc64_dmamem_free_map(dt, *mapp);
|
||||
@ -694,33 +690,18 @@ iommu_dvmamem_alloc_size(bus_dma_tag_t pt, bus_dma_tag_t dt,
|
||||
* Try to preallocate DVMA space. If this fails, it is retried at load
|
||||
* time.
|
||||
*/
|
||||
iommu_dvma_valloc(dt, is, *mapp, IOMMU_SIZE_ROUNDUP(size));
|
||||
iommu_dvma_valloc(dt, is, *mapp, IOMMU_SIZE_ROUNDUP(dt->dt_maxsize));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
iommu_dvmamem_alloc(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
||||
void **vaddr, int flags, bus_dmamap_t *mapp)
|
||||
{
|
||||
return (iommu_dvmamem_alloc_size(pt, dt, is, vaddr, flags, mapp,
|
||||
dt->dt_maxsize));
|
||||
}
|
||||
|
||||
void
|
||||
iommu_dvmamem_free_size(bus_dma_tag_t pt, bus_dma_tag_t dt,
|
||||
struct iommu_state *is, void *vaddr, bus_dmamap_t map, bus_size_t size)
|
||||
{
|
||||
|
||||
iommu_dvma_vfree(is, map);
|
||||
sparc64_dmamem_free_map(dt, map);
|
||||
free(vaddr, M_IOMMU);
|
||||
}
|
||||
|
||||
void
|
||||
iommu_dvmamem_free(bus_dma_tag_t pt, bus_dma_tag_t dt, struct iommu_state *is,
|
||||
void *vaddr, bus_dmamap_t map)
|
||||
{
|
||||
iommu_dvmamem_free_size(pt, dt, is, vaddr, map, dt->dt_maxsize);
|
||||
|
||||
iommu_dvma_vfree(is, map);
|
||||
sparc64_dmamem_free_map(dt, map);
|
||||
free(vaddr, M_IOMMU);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -176,9 +176,6 @@ int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map);
|
||||
* bus device space based on the constraints lited in the dma tag.
|
||||
* A dmamap to for use with dmamap_load is also allocated.
|
||||
*/
|
||||
int bus_dmamem_alloc_size(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp, bus_size_t size);
|
||||
|
||||
int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
bus_dmamap_t *mapp);
|
||||
|
||||
@ -186,9 +183,6 @@ int bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
|
||||
* Free a piece of memory and it's allociated dmamap, that was allocated
|
||||
* via bus_dmamem_alloc.
|
||||
*/
|
||||
void bus_dmamem_free_size(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map,
|
||||
bus_size_t size);
|
||||
|
||||
void bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user