Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to

BUS_DMA_COHERENT.
This commit is contained in:
thorpej 1998-02-04 00:10:30 +00:00
parent 5fd0d10994
commit 2d403996b2
3 changed files with 16 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sgmap_typedep.c,v 1.7 1998/01/18 00:05:33 thorpej Exp $ */
/* $NetBSD: sgmap_typedep.c,v 1.8 1998/02/04 00:10:30 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.7 1998/01/18 00:05:33 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.8 1998/02/04 00:10:30 thorpej Exp $");
#ifdef SGMAP_LOG
@ -90,6 +90,7 @@ __C(SGMAP_TYPE,_load)(t, map, buf, buflen, p, flags, sgmap)
/*
* Make sure that on error condition we return "no valid mappings".
*/
map->dm_mapsize = 0;
map->dm_nsegs = 0;
if (buflen > map->_dm_size)
@ -224,6 +225,7 @@ __C(SGMAP_TYPE,_load)(t, map, buf, buflen, p, flags, sgmap)
Debugger();
#endif
map->dm_mapsize = buflen;
map->dm_nsegs = 1;
return (0);
}
@ -313,4 +315,10 @@ __C(SGMAP_TYPE,_unload)(t, map, sgmap)
*/
if ((map->_dm_flags & BUS_DMA_ALLOCNOW) == 0)
alpha_sgmap_free(map, sgmap);
/*
* Mark the mapping invalid.
*/
map->dm_mapsize = 0;
map->dm_nsegs = 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.h,v 1.16 1998/01/17 21:53:55 thorpej Exp $ */
/* $NetBSD: bus.h,v 1.17 1998/02/04 00:10:31 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -396,7 +396,7 @@ struct alpha_bus_space {
#define BUS_DMA_WAITOK 0x00 /* safe to sleep (pseudo-flag) */
#define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */
#define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */
#define BUS_DMAMEM_NOSYNC 0x04 /* map memory to not require sync */
#define BUS_DMA_COHERENT 0x04 /* hint: map memory DMA coherent */
#define BUS_DMA_BUS1 0x10 /* placeholders for bus functions... */
#define BUS_DMA_BUS2 0x20
#define BUS_DMA_BUS3 0x40
@ -559,6 +559,7 @@ struct alpha_bus_dmamap {
/*
* PUBLIC MEMBERS: these are used by machine-independent code.
*/
bus_size_t dm_mapsize; /* size of the mapping */
int dm_nsegs; /* # valid segments in mapping */
bus_dma_segment_t dm_segs[1]; /* segments; variable length */
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: ioasic.c,v 1.17 1998/01/19 02:56:05 thorpej Exp $ */
/* $NetBSD: ioasic.c,v 1.18 1998/02/04 00:10:32 thorpej Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.17 1998/01/19 02:56:05 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.18 1998/02/04 00:10:32 thorpej Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -414,7 +414,7 @@ ioasic_lance_dma_setup(sc)
return;
}
if (bus_dmamem_map(dmat, &seg, rseg, LE_IOASIC_MEMSIZE,
&le_iomem, BUS_DMA_NOWAIT|BUS_DMAMEM_NOSYNC)) {
&le_iomem, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
printf("%s: can't map DMA area for LANCE\n",
sc->sc_dv.dv_xname);
bus_dmamem_free(dmat, &seg, rseg);