Subject: port-amiga/2672: Fix for DMA problem in Z3 Fastlane SCSI driver
To: None <gnats-bugs@NetBSD.ORG>
From: None <tron@colwyn.owl.de>
List: netbsd-bugs
Date: 08/04/1996 00:55:17
>Number:         2672
>Category:       port-amiga
>Synopsis:       Fix for DMA problem in Z3 Fastlane SCSI driver
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug  3 19:05:01 1996
>Last-Modified:
>Originator:     Matthias Scheler
>Organization:
Matthias Scheler
tron@colwyn.owl.de
>Release:        1.2_BETA
>Environment:
System: NetBSD lyssa 1.2_BETA NetBSD 1.2_BETA (LYSSA) #5: Sat Aug  3 17:12:23 MET DST 1996     tron@lyssa:/usr/src/sys/arch/amiga/compile/LYSSA amiga


>Description:
One of the many bugs of the Z3 Fastlane SCSI driver is that dump didn't
work. Any try to dump a partition to "/dev/null", standard output or a
remote tape drive (local tapes won't work anyway due to other bugs in
this driver) caused lots of strange "Warning: undefined file type ..."
error messages and produced an unreadable dump. After getting a hint
concerning one of the hardware restrictions of Z3 Fastlane by Ignatios
I looked at the DMA engine and found out that it tries to do transfers
with non longword aligned length which won't work. After fixing this
I was able to dump my partitions successfully on a tape and to restore
it on an NetBSD-i386 system. A host to host dump via network to install
another NetBSD-amiga system worked also fine. So I think that this patch
should be applied *BEFORE* the 1.2 release because it makes this pesky
driver a little bit more usable.

>How-To-Repeat:
Try "dump u0f /dev/null /" on a system where "/" is located on a harddisk
connected to a Z3 Fastlane.

>Fix:
*** src/sys/arch/amiga/dev/flsc.c.orig	Tue Jun 11 13:40:53 1996
--- src/sys/arch/amiga/dev/flsc.c	Sat Aug  3 17:10:55 1996
*************** flsc_need_bump(sc, ptr, len)
*** 341,354 ****
  {
  	int	p;
  
! 	p = (int)ptr & 0x03;
! 
! 	if (p) {
! 		p = 4-p;
! 	    
! 		if (len < 256)
! 			p = len;
  	}
  
  	return(p);
  }
--- 341,351 ----
  {
  	int	p;
  
! 	if (((int)ptr & 0x03) || (len & 0x03)) {
! 		if (len < 256) p = len;
! 		else p = 256;
  	}
+ 	else p = 0;
  
  	return(p);
  }

>Audit-Trail:
>Unformatted: