Subject: Re: Announce: DEC AlphaServer 8400 is coming
To: Michael L.Hitch <mhitch@lightning.msu.montana.edu>
From: Jason Thorpe <thorpej@shagadelic.org>
List: port-alpha
Date: 07/28/2005 06:51:41
--Apple-Mail-9-370096916
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
On Jul 27, 2005, at 10:11 PM, Michael L. Hitch wrote:
> Aha - I see what happened, but not why yet. The sgmap_load
> checks the
> flags passed as an argument for BUS_DMA_READ being zero, an the
> sgmap_unload checks the flags in map->_dm_flags. The problem
> occurs when
> BUS_DMA_READ is cleared in the passed argument, but is set in
> map->_dm_flags. I don't know why that is yet.
Ok, here is an actual patch to try.
If this works for you, will you please check it in? I am going to be
away from my source tree machine until Sunday night starting in about
2 hours.
Thanks!
-- thorpej
--Apple-Mail-9-370096916
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
x-mac-type=54455854;
x-unix-mode=0755;
x-mac-creator=74747874;
name="alpha-dma-rw-patch.txt"
Content-Disposition: attachment;
filename=alpha-dma-rw-patch.txt
Index: bus_dma.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/common/bus_dma.c,v
retrieving revision 1.58
diff -u -p -r1.58 bus_dma.c
--- bus_dma.c 1 Apr 2005 11:59:22 -0000 1.58
+++ bus_dma.c 28 Jul 2005 13:49:16 -0000
@@ -243,6 +243,7 @@ _bus_dmamap_load_direct(bus_dma_tag_t t,
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
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_
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_
map->dm_mapsize = 0;
map->dm_nsegs = 0;
map->_dm_window = NULL;
+ map->_dm_flags &= ~(BUS_DMA_READ|BUS_DMA_WRITE);
}
/*
Index: sgmap_typedep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/alpha/common/sgmap_typedep.c,v
retrieving revision 1.30
diff -u -p -r1.30 sgmap_typedep.c
--- sgmap_typedep.c 28 Jul 2005 04:58:03 -0000 1.30
+++ sgmap_typedep.c 28 Jul 2005 13:49:16 -0000
@@ -213,6 +213,7 @@ __C(SGMAP_TYPE,_load)(bus_dma_tag_t t, b
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
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
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
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));
--Apple-Mail-9-370096916
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
--Apple-Mail-9-370096916--