summaryrefslogtreecommitdiff
path: root/sys/arch/alpha/dev
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-03-20 22:48:59 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-03-20 22:48:59 +0000
commit94d5f472366ba926bb6cf877156fb85a6e813838 (patch)
tree9d1a00fb0833f69bfa8ab35eab9bf5a7bb29d059 /sys/arch/alpha/dev
parent1d23cc4c475d038d30faba78dbf60cc2c4d635ee (diff)
Since the sgmap is used in interrupts protect the extent with splvm.
nate@ ok. Should fix a bunch of random memory corruption problems on many machines. How we could live so long without it is beyond me. Now my traktor is happy.
Diffstat (limited to 'sys/arch/alpha/dev')
-rw-r--r--sys/arch/alpha/dev/sgmap_common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/arch/alpha/dev/sgmap_common.c b/sys/arch/alpha/dev/sgmap_common.c
index 979096ee45c..0e3015e258d 100644
--- a/sys/arch/alpha/dev/sgmap_common.c
+++ b/sys/arch/alpha/dev/sgmap_common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sgmap_common.c,v 1.3 2001/11/06 19:53:13 miod Exp $ */
+/* $OpenBSD: sgmap_common.c,v 1.4 2002/03/20 22:48:58 art Exp $ */
/* $NetBSD: sgmap_common.c,v 1.13 2000/06/29 09:02:57 mrg Exp $ */
/*-
@@ -155,6 +155,7 @@ alpha_sgmap_alloc(map, origlen, sgmap, flags)
{
int error;
bus_size_t len = origlen, boundary, alignment;
+ int s;
#ifdef DIAGNOSTIC
if (map->_dm_flags & DMAMAP_HAS_SGMAP)
@@ -190,9 +191,11 @@ alpha_sgmap_alloc(map, origlen, sgmap, flags)
origlen, len, map->_dm_sgvalen, map->_dm_boundary, boundary);
#endif
+ s = splvm();
error = extent_alloc(sgmap->aps_ex, map->_dm_sgvalen, alignment, 0,
boundary, (flags & BUS_DMA_NOWAIT) ? EX_NOWAIT : EX_WAITOK,
&map->_dm_sgva);
+ splx(s);
#if 0
printf("error %d _dm_sgva %x\n", error, map->_dm_sgva);
#endif
@@ -210,15 +213,18 @@ alpha_sgmap_free(map, sgmap)
bus_dmamap_t map;
struct alpha_sgmap *sgmap;
{
+ int s;
#ifdef DIAGNOSTIC
if ((map->_dm_flags & DMAMAP_HAS_SGMAP) == 0)
panic("alpha_sgmap_free: no sgva space to free");
#endif
+ s = splvm();
if (extent_free(sgmap->aps_ex, map->_dm_sgva, map->_dm_sgvalen,
EX_NOWAIT))
panic("alpha_sgmap_free");
+ splx(s);
map->_dm_flags &= ~DMAMAP_HAS_SGMAP;
}