From 2d403996b2020f176888531d5de91828732a624c Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 4 Feb 1998 00:10:30 +0000 Subject: [PATCH] Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to BUS_DMA_COHERENT. --- sys/arch/alpha/common/sgmap_typedep.c | 12 ++++++++++-- sys/arch/alpha/include/bus.h | 5 +++-- sys/arch/alpha/tc/ioasic.c | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/arch/alpha/common/sgmap_typedep.c b/sys/arch/alpha/common/sgmap_typedep.c index 8fcccc5df13f..283c43667951 100644 --- a/sys/arch/alpha/common/sgmap_typedep.c +++ b/sys/arch/alpha/common/sgmap_typedep.c @@ -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; } diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h index a439da5fa76b..6847a3869956 100644 --- a/sys/arch/alpha/include/bus.h +++ b/sys/arch/alpha/include/bus.h @@ -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 */ }; diff --git a/sys/arch/alpha/tc/ioasic.c b/sys/arch/alpha/tc/ioasic.c index 8a68dd167301..62235669df4e 100644 --- a/sys/arch/alpha/tc/ioasic.c +++ b/sys/arch/alpha/tc/ioasic.c @@ -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 /* 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 #include @@ -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);