Date: Mon, 26 May 2003 14:35:19 +0200 From: Dag-Erling Smorgrav <des@ofug.org> To: Scott Long <scottl@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/alpha/alpha busdma_machdep.c src/sys/alpha/include bus.h src/sys/amd64/amd64 busdma_machdep.c src/sys/amd64/include bus_dma.h src/sys/i386/i386 busdma_machdep.c src/sys/i386/include bus_dma.h src/sys/sparc64/include bus.h iommuvar.h ... Message-ID: <xzpllwt3myg.fsf@flood.ping.uio.no> In-Reply-To: <xzp7k8d52fj.fsf@flood.ping.uio.no> (Dag-Erling Smorgrav's message of "Mon, 26 May 2003 14:15:44 %2B0200") References: <200305260400.h4Q40qxI041677@repoman.freebsd.org> <xzp7k8d52fj.fsf@flood.ping.uio.no>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
You'll need (at least) the attached (untested) patch to fix it.
DES
--
Dag-Erling Smorgrav - des@ofug.org
[-- Attachment #2 --]
Index: sparc64/bus_machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/sparc64/sparc64/bus_machdep.c,v
retrieving revision 1.27
diff -u -r1.27 bus_machdep.c
--- sparc64/bus_machdep.c 10 Apr 2003 23:03:33 -0000 1.27
+++ sparc64/bus_machdep.c 26 May 2003 12:31:23 -0000
@@ -170,12 +170,8 @@
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 @@
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 */
@@ -610,74 +604,18 @@
dmat->dt_map_count--;
}
-/*
- * Common function for DMA-safe memory allocation. May be called
- * 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)
-{
-
- if (size > ddmat->dt_maxsize)
- return (ENOMEM);
-
- if ((size <= PAGE_SIZE)) {
- *vaddr = malloc(size, M_DEVBUF,
- (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK);
- } else {
- /*
- * XXX: Use contigmalloc until it is merged into this facility
- * and handles multi-seg allocations. Nobody is doing multi-seg
- * allocations yet though.
- */
- mtx_lock(&Giant);
- *vaddr = contigmalloc(size, M_DEVBUF,
- (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK,
- 0ul, ddmat->dt_lowaddr,
- ddmat->dt_alignment ? ddmat->dt_alignment : 1UL,
- ddmat->dt_boundary);
- mtx_unlock(&Giant);
- }
- if (*vaddr == NULL) {
- free(*mapp, M_DEVBUF);
- return (ENOMEM);
- }
- 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)
-{
-
- sparc64_dmamem_free_map(ddmat, map);
- if ((size <= PAGE_SIZE))
- free(vaddr, M_DEVBUF);
- else {
- mtx_lock(&Giant);
- contigfree(vaddr, size, M_DEVBUF);
- mtx_unlock(&Giant);
- }
+ return (sparc64_dmamem_alloc_size(pdmat, ddmat, vaddr, flags, mapp));
}
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);
+ sparc64_dmamem_free(pdmat, ddmat, vaddr, map);
}
struct bus_dma_tag nexus_dmatag = {
@@ -703,9 +641,7 @@
nexus_dmamap_unload,
nexus_dmamap_sync,
- nexus_dmamem_alloc_size,
nexus_dmamem_alloc,
- nexus_dmamem_free_size,
nexus_dmamem_free,
};
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpllwt3myg.fsf>
