Subject: Re: aha 1542: DMA beyond end of ISA
To: David Mazieres <dm@denhaag.lcs.mit.edu>
From: Michael L. VanLoon -- HeadCandy.com <michaelv@HeadCandy.com>
List: port-i386
Date: 09/17/1995 01:35:44
>I am running a very current NetBSD-current on an ISA system with
>32Megs of RAM and an Ateptek 1542B SCSI controller.  If I don't change
>machdep.c to pretend I only have 16 Megs of RAM, I get a "DMA beyond
>end of ISA" message after running for a while (though it lasts a
>pretty long time even with X windows and multiple emacses).

You're just playing with a time bomb.

>I am puzzled since isadma.c appears to check the range of all ISA DMA
>transfers and move them to bounce buffers when they are out of range.

No.  That's for DMAs initiated from the *motherboard's* own DMA
controllers.  Your 1542 (and any decent SCSI controller) does the DMA
with it's own controller on the SCSI board.  This is constrained
because the ISA bus only has 24 address lines (hence, 16MB of memory
[i.e. 2^24 bytes]).

>Is this a know problem?

Yes.

>Can someone give me a hint as to why this is
>happening

Because you can't do that.

>and what I would need to do to fix the problem?

1) Set your system down to 16MB of RAM, and wait until it gets fixed.
2) Run something else that already has bounce-buffers (FreeBSD or
   Linux).
3) Help write the DMA bounce-buffer code that several people have been
   discussing recently.
4) Make a quick-and-dirty hack that will get you by for awhile.

>Presumably
>there's either something fundamentally tricky about the Adaptek, or
>there's a quick and dirty fix possible that just hasn't been included
>in NetBSD because it's 386 specific.

Not exactly.  There's something fundamentally broken about the ISA bus
-- it's slow and it only has 24 address lines.  The 1542, and every
other busmaster ISA card, is only a victim.

And, yes, the fix in Linux and FreeBSD hasn't been included because
it's a very i386-specific fix.  It is currently being discussed how to
do this in a very architecture-neutral way for NetBSD.  I don't know
how close an actual implementation is, though.

>If the latter, I'd at least like
>to make a quick and dirty fix to my kernel...

There may be someone who has such a patch -- I'm not sure.  The
FreeBSD and Linux fixes probably would be impossible to port since
their respective vm systems are totally different from NetBSD's.

If you want to figure out a quick hack in the mean time, though, you
would want to start looking in /sys/dev/isa/aha1542.c.

-----------------------------------------------------------------------------
  Michael L. VanLoon                                 michaelv@HeadCandy.com
       --<  Free your mind and your machine -- NetBSD free un*x  >--
     NetBSD working ports: 386+PC, Mac 68k, Amiga, HP300, Sun3, Sun4,
                           DEC PMAX (MIPS), DEC Alpha, PC532
     NetBSD ports in progress: VAX, Atari 68k, others...
-----------------------------------------------------------------------------