Subject: Re: Announce: DEC AlphaServer 8400 is coming
To: Jason Thorpe <thorpej@shagadelic.org>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: port-alpha
Date: 07/28/2005 22:33:53
On Thu, 28 Jul 2005, Michael L. Hitch wrote:

> Kernelized RAIDframe activated
> scsibus0: waiting 2 seconds for devices to settle...
> scsibus1: waiting 2 seconds for devices to settle...
> stray isa irq 14
> atapibus0 at atabus0: 2 targets
> scsibus2: waiting 2 seconds for devices to settle...
> cd0 at atapibus0 drive 0: <HL-DT-ST CD-ROM GCR-8480B, , 2.11> cdrom
> removable
> scsibus3: waiting 2 seconds for devices to settle...
> cd0: 32-bit data port
> cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 1
> cd0(aceride0:0:0): using PIO mode 4, Ultra-DMA mode 1 (using DMA)
> panic: kernel diagnostic assertion "(map->_dm_flags &
> (BUS_DMA_READ|BUS_DMA_WRITE)) == 0" failed: file
> "/usr/NetBSD-current/src/sys/arch/alpha/common/bus_dma.c", line 246
> Stopped in pid 3.1 (mlxtask) at netbsd:cpu_Debugger+0x4:        ret
> zero,(ra
> )
> db{0}> t
> cpu_Debugger() at netbsd:cpu_Debugger+0x4
> panic() at netbsd:panic+0x208
> __assert() at netbsd:__assert+0x3c
> _bus_dmamap_load_direct() at netbsd:_bus_dmamap_load_direct+0x14c
> mlx_ccb_map() at netbsd:mlx_ccb_map+0x64
> mlx_enquire() at netbsd:mlx_enquire+0xb4
> mlx_periodic() at netbsd:mlx_periodic+0x204
> mlx_periodic_thread() at netbsd:mlx_periodic_thread+0xd4
> exception_return() at netbsd:exception_return
> --- root of call graph ---
>
> I wonder if the mlx driver is not doing a bus_dmamap_unload somewhere,
> and leaving the flags set?

That was the culprit.  mlx_enquire() allocates a ccb, allocates and maps a
buffer an initiates the enquire command.  The handler
[mlx_periodic_enquiry()] doesn't unmap the buffer.

This patch makes it work:

Index: sys/dev/ic/mlx.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/mlx.c,v
retrieving revision 1.33
diff -u -r1.33 mlx.c
--- sys/dev/ic/mlx.c    30 May 2005 04:43:47 -0000      1.33
+++ sys/dev/ic/mlx.c    29 Jul 2005 04:34:32 -0000
@@ -1121,6 +1121,7 @@
        u_int lsn;

        mlx = (struct mlx_softc *)mc->mc_mx.mx_dv;
+       mlx_ccb_unmap(mlx, mc);

        /*
         * Command completed OK?


--
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA