Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha/common Check for stale flags in the DMA map. ...
details: https://anonhg.NetBSD.org/src/rev/1dccdd0e0afb
branches: trunk
changeset: 583331:1dccdd0e0afb
user: mhitch <mhitch%NetBSD.org@localhost>
date: Sat Jul 30 17:25:51 2005 +0000
description:
Check for stale flags in the DMA map. This was causing crashes on an ES40
with more than 1GB of memory due to a bug in one of the drivers. From
Jason Thorpe.
diffstat:
sys/arch/alpha/common/bus_dma.c | 8 ++++++--
sys/arch/alpha/common/sgmap_typedep.c | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diffs (100 lines):
diff -r 69cf2cb92fb7 -r 1dccdd0e0afb sys/arch/alpha/common/bus_dma.c
--- a/sys/arch/alpha/common/bus_dma.c Sat Jul 30 16:37:36 2005 +0000
+++ b/sys/arch/alpha/common/bus_dma.c Sat Jul 30 17:25:51 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.58 2005/04/01 11:59:22 yamt Exp $ */
+/* $NetBSD: bus_dma.c,v 1.59 2005/07/30 17:25:51 mhitch Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.58 2005/04/01 11:59:22 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.59 2005/07/30 17:25:51 mhitch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -243,6 +243,7 @@
map->dm_mapsize = 0;
map->dm_nsegs = 0;
KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+ KASSERT((map->_dm_flags & (BUS_DMA_READ|BUS_DMA_WRITE)) == 0);
if (buflen > map->_dm_size)
return (EINVAL);
@@ -281,6 +282,7 @@
map->dm_mapsize = 0;
map->dm_nsegs = 0;
KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+ KASSERT((map->_dm_flags & (BUS_DMA_READ|BUS_DMA_WRITE)) == 0);
#ifdef DIAGNOSTIC
if ((m0->m_flags & M_PKTHDR) == 0)
@@ -371,6 +373,7 @@
map->dm_mapsize = 0;
map->dm_nsegs = 0;
KASSERT(map->dm_maxsegsz <= map->_dm_maxmaxsegsz);
+ KASSERT((map->_dm_flags & (BUS_DMA_READ|BUS_DMA_WRITE)) == 0);
resid = uio->uio_resid;
iov = uio->uio_iov;
@@ -441,6 +444,7 @@
map->dm_mapsize = 0;
map->dm_nsegs = 0;
map->_dm_window = NULL;
+ map->_dm_flags &= ~(BUS_DMA_READ|BUS_DMA_WRITE);
}
/*
diff -r 69cf2cb92fb7 -r 1dccdd0e0afb sys/arch/alpha/common/sgmap_typedep.c
--- a/sys/arch/alpha/common/sgmap_typedep.c Sat Jul 30 16:37:36 2005 +0000
+++ b/sys/arch/alpha/common/sgmap_typedep.c Sat Jul 30 17:25:51 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap_typedep.c,v 1.30 2005/07/28 04:58:03 thorpej Exp $ */
+/* $NetBSD: sgmap_typedep.c,v 1.31 2005/07/30 17:25:51 mhitch Exp $ */
/*-
* Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.30 2005/07/28 04:58:03 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sgmap_typedep.c,v 1.31 2005/07/30 17:25:51 mhitch Exp $");
#include "opt_ddb.h"
@@ -213,6 +213,7 @@
if (buflen > map->_dm_size)
return (EINVAL);
+ KASSERT((map->_dm_flags & (BUS_DMA_READ|BUS_DMA_WRITE)) == 0);
KASSERT((flags & (BUS_DMA_READ|BUS_DMA_WRITE)) !=
(BUS_DMA_READ|BUS_DMA_WRITE));
@@ -265,6 +266,7 @@
if (m0->m_pkthdr.len > map->_dm_size)
return (EINVAL);
+ KASSERT((map->_dm_flags & (BUS_DMA_READ|BUS_DMA_WRITE)) == 0);
KASSERT((flags & (BUS_DMA_READ|BUS_DMA_WRITE)) !=
(BUS_DMA_READ|BUS_DMA_WRITE));
@@ -322,6 +324,7 @@
map->dm_mapsize = 0;
map->dm_nsegs = 0;
+ KASSERT((map->_dm_flags & (BUS_DMA_READ|BUS_DMA_WRITE)) == 0);
KASSERT((flags & (BUS_DMA_READ|BUS_DMA_WRITE)) !=
(BUS_DMA_READ|BUS_DMA_WRITE));
@@ -388,6 +391,7 @@
struct alpha_sgmap *sgmap)
{
+ KASSERT((map->_dm_flags & (BUS_DMA_READ|BUS_DMA_WRITE)) == 0);
KASSERT((flags & (BUS_DMA_READ|BUS_DMA_WRITE)) !=
(BUS_DMA_READ|BUS_DMA_WRITE));
Home |
Main Index |
Thread Index |
Old Index