summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2003-05-26 14:38:48 +0000
committerscottl <scottl@FreeBSD.org>2003-05-26 14:38:48 +0000
commit9a6ea2ebe33b0a8fa06ca6b0fb9dc29e0f939ad2 (patch)
tree87dacc62977284bf033a4a11e4bc79e451fee8b6 /sys/sparc64
parentb236dd249aa3ac4952cda1c0f65ca3e34ab36ea2 (diff)
downloadFreeBSD-src-9a6ea2ebe33b0a8fa06ca6b0fb9dc29e0f939ad2.zip
FreeBSD-src-9a6ea2ebe33b0a8fa06ca6b0fb9dc29e0f939ad2.tar.gz
De-orbit bus_dmamem_alloc_size from here too.
Pointed out by: des Pointy hat to: me
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/sparc64/bus_machdep.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c
index c3545b0..4aa045e 100644
--- a/sys/sparc64/sparc64/bus_machdep.c
+++ b/sys/sparc64/sparc64/bus_machdep.c
@@ -170,12 +170,8 @@ static int nexus_dmamap_load_uio(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
struct uio *, bus_dmamap_callback2_t *, void *, int);
static void nexus_dmamap_unload(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t);
static void nexus_dmamap_sync(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t, int);
-static int nexus_dmamem_alloc_size(bus_dma_tag_t, bus_dma_tag_t, void **, int,
- bus_dmamap_t *, u_long size);
static int nexus_dmamem_alloc(bus_dma_tag_t, bus_dma_tag_t, void **, int,
bus_dmamap_t *);
-static void nexus_dmamem_free_size(bus_dma_tag_t, bus_dma_tag_t, void *,
- bus_dmamap_t, u_long size);
static void nexus_dmamem_free(bus_dma_tag_t, bus_dma_tag_t, void *,
bus_dmamap_t);
@@ -228,9 +224,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
newtag->dt_dmamap_load_uio = NULL;
newtag->dt_dmamap_unload = NULL;
newtag->dt_dmamap_sync = NULL;
- newtag->dt_dmamem_alloc_size = NULL;
newtag->dt_dmamem_alloc = NULL;
- newtag->dt_dmamem_free_size = NULL;
newtag->dt_dmamem_free = NULL;
/* Take into account any restrictions imposed by our parent tag */
@@ -615,15 +609,12 @@ sparc64_dmamem_free_map(bus_dma_tag_t dmat, bus_dmamap_t map)
* by bus-specific DMA memory allocation functions.
*/
static int
-nexus_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)
+nexus_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
+ int flags, bus_dmamap_t *mapp)
{
- if (size > ddmat->dt_maxsize)
- return (ENOMEM);
-
- if ((size <= PAGE_SIZE)) {
- *vaddr = malloc(size, M_DEVBUF,
+ if ((ddmat->dt_maxsize <= PAGE_SIZE)) {
+ *vaddr = malloc(ddmat->dt_maxsize, M_DEVBUF,
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
} else {
/*
@@ -632,7 +623,7 @@ nexus_dmamem_alloc_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
* allocations yet though.
*/
mtx_lock(&Giant);
- *vaddr = contigmalloc(size, M_DEVBUF,
+ *vaddr = contigmalloc(ddmat->dt_maxsize, M_DEVBUF,
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
0ul, ddmat->dt_lowaddr,
ddmat->dt_alignment ? ddmat->dt_alignment : 1UL,
@@ -646,21 +637,13 @@ nexus_dmamem_alloc_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
return (0);
}
-static int
-nexus_dmamem_alloc(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void **vaddr,
- int flags, bus_dmamap_t *mapp)
-{
- return (sparc64_dmamem_alloc_size(pdmat, ddmat, vaddr, flags, mapp,
- ddmat->dt_maxsize));
-}
-
/*
* Common function for freeing DMA-safe memory. May be called by
* bus-specific DMA memory free functions.
*/
static void
-nexus_dmamem_free_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
- bus_dmamap_t map, bus_size_t size)
+nexus_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
+ bus_dmamap_t map)
{
sparc64_dmamem_free_map(ddmat, map);
@@ -668,18 +651,11 @@ nexus_dmamem_free_size(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
free(vaddr, M_DEVBUF);
else {
mtx_lock(&Giant);
- contigfree(vaddr, size, M_DEVBUF);
+ contigfree(vaddr, ddmat->dt_maxsize, M_DEVBUF);
mtx_unlock(&Giant);
}
}
-static void
-nexus_dmamem_free(bus_dma_tag_t pdmat, bus_dma_tag_t ddmat, void *vaddr,
- bus_dmamap_t map)
-{
- sparc64_dmamem_free_size(pdmat, ddmat, vaddr, map, ddmat->dt_maxsize);
-}
-
struct bus_dma_tag nexus_dmatag = {
NULL,
NULL,
@@ -703,9 +679,7 @@ struct bus_dma_tag nexus_dmatag = {
nexus_dmamap_unload,
nexus_dmamap_sync,
- nexus_dmamem_alloc_size,
nexus_dmamem_alloc,
- nexus_dmamem_free_size,
nexus_dmamem_free,
};
OpenPOWER on IntegriCloud