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.
This commit is contained in:
parent
056ff58f97
commit
2e8c0b59d2
|
@ -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 @@ _bus_dmamap_load_direct(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
|||
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 @@ _bus_dmamap_load_mbuf_direct(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
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 @@ _bus_dmamap_load_uio_direct(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
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 @@ _bus_dmamap_unload(bus_dma_tag_t t, bus_dmamap_t map)
|
|||
map->dm_mapsize = 0;
|
||||
map->dm_nsegs = 0;
|
||||
map->_dm_window = NULL;
|
||||
map->_dm_flags &= ~(BUS_DMA_READ|BUS_DMA_WRITE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 @@ __C(SGMAP_TYPE,_load)(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
|
|||
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 @@ __C(SGMAP_TYPE,_load_mbuf)(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
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 @@ __C(SGMAP_TYPE,_load_uio)(bus_dma_tag_t t, bus_dmamap_t map, struct uio *uio,
|
|||
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 @@ __C(SGMAP_TYPE,_load_raw)(bus_dma_tag_t t, bus_dmamap_t map,
|
|||
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));
|
||||
|
||||
|
|
Loading…
Reference in New Issue