Subject: port-amiga/1920: no DMA for fd & audio w/o grf_cc installed
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ezy@panix.com>
List: netbsd-bugs
Date: 01/10/1996 00:59:04
>Number:         1920
>Category:       port-amiga
>Synopsis:       no DMA for fd & audio w/o grf_cc installed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 10 01:20:01 1996
>Last-Modified:
>Originator:     Ezra Story
>Organization:

>Release:        1.1
>Environment:

System: NetBSD inca 1.1A NetBSD 1.1A (INCA) #75: Mon Jan 8 01:52:04 EST 1996 ezy@inca:/usr/src/sys/arch/amiga/compile/INCA amiga

>Description:
The code which handles the Amiga display is the only code which sets the
DMAF_MASTER bit in INTENA for the custom chips.  Therefore, if
you remove grf_cc, anything that uses custom chip DMA will fail.  I noticed
this when I took grf_cc out (I run only grf_cl) and the floppy stopped
working.  A perusal of the code revealed the error in fd.c and a similar
error in cc.c for the audio handler.  

>How-To-Repeat:
Don't compile grf_cc in the kernel.  The one section of code which enables
DMAF_MASTER is removed along with it, causing anything using custom chip
DMA (audio, fd) to fail. 

>Fix:
Simply set DMAF_MASTER when setting any DMA bits below it.

Patch fd.c and cc.c as follows:

*** old/fd.c	Wed Jan 10 00:36:59 1996
--- new/fd.c	Wed Jan 10 00:29:24 1996
***************
*** 360,366 ****
  	/*
  	 * enable disk related interrupts
  	 */
! 	custom.dmacon = DMAF_SETCLR | DMAF_DISK;
  	/* XXX why softint */
  	custom.intena = INTF_SETCLR |INTF_SOFTINT | INTF_DSKBLK;
  	ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_FLG;
--- 360,366 ----
  	/*
  	 * enable disk related interrupts
  	 */
! 	custom.dmacon = DMAF_SETCLR | DMAF_MASTER | DMAF_DISK;
  	/* XXX why softint */
  	custom.intena = INTF_SETCLR |INTF_SOFTINT | INTF_DSKBLK;
  	ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_FLG;
*** old/cc.c	Wed Jan 10 00:31:01 1996
--- new/cc.c	Wed Jan 10 00:31:01 1996
***************
*** 442,448 ****
  	 * turn on interrupts and enable dma for channels and
  	 */
  	custom.intena = INTF_SETCLR | (dmabits << 7);
! 	custom.dmacon = DMAF_SETCLR | dmabits;
  }
  
  /*
--- 442,448 ----
  	 * turn on interrupts and enable dma for channels and
  	 */
  	custom.intena = INTF_SETCLR | (dmabits << 7);
! 	custom.dmacon = DMAF_SETCLR | DMAF_MASTER | dmabits;
  }
  
  /*
>Audit-Trail:
>Unformatted: