Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Aug 1997 21:19:19 -0700
From:      Amancio Hasty <hasty@rah.star-gate.com>
To:        hackers@freebsd.org
Subject:   isa.c patch
Message-ID:  <199708260419.VAA00268@rah.star-gate.com>

next in thread | raw e-mail | index | archive | help
Here is a patch to alleviate the current problem with the  dma interface
and the sound driver which uses auto dma.

The  dma interface functionality remains however it now checks
to see if a dma is operating in auto dma mode and if so it bypasses
the busy flag check . I have modified the sound driver 3.5  to 
adjust for this new behavior and tested it under FreeBSD 3.0 -current


        Amancio

*** isa.c.orig	Mon Aug 25 21:04:10 1997
--- isa.c	Mon Aug 25 21:04:22 1997
***************
*** 570,575 ****
--- 570,576 ----
  static u_int8_t	dma_bounced = 0;
  static u_int8_t	dma_busy = 0;		/* Used in isa_dmastart() */
  static u_int8_t	dma_inuse = 0;		/* User for acquire/release */
+ static u_int8_t dma_auto_mode = 0;
  
  #define VALID_DMA_MASK (7)
  
***************
*** 631,636 ****
--- 632,638 ----
  		return (EBUSY);
  	}
  	dma_inuse |= (1 << chan);
+ 	dma_auto_mode &= ~(1 << chan);
  
  	return (0);
  }
***************
*** 662,667 ****
--- 664,670 ----
  	}
  
  	dma_inuse &= ~(1 << chan);
+ 	dma_auto_mode &= ~(1 << chan);
  }
  
  /*
***************
*** 736,741 ****
--- 739,750 ----
  	/* translate to physical */
  	phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
  
+ 	if (flags & B_RAW) {
+ 	    dma_auto_mode |= (1 << chan);
+ 	} else { 
+ 	    dma_auto_mode &= ~(1 << chan);
+ 	}
+ 
  	if ((chan & 4) == 0) {
  		/*
  		 * Program one of DMA channels 0..3.  These are
***************
*** 816,830 ****
  		printf("isa_dmadone: channel %d not acquired\n", chan);
  #endif
  
! #if 0
! 	/*
! 	 * XXX This should be checked, but drivers like ad1848 only call
! 	 * isa_dmastart() once because they use Auto DMA mode.  If we
! 	 * leave this in, drivers that do this will print this continuously.
! 	 */
! 	if ((dma_busy & (1 << chan)) == 0)
  		printf("isa_dmadone: channel %d not busy\n", chan);
! #endif
  
  	if (dma_bounced & (1 << chan)) {
  		/* copy bounce buffer on read */
--- 825,834 ----
  		printf("isa_dmadone: channel %d not acquired\n", chan);
  #endif
  
! 	if (((dma_busy & (1 << chan)) == 0) && 
! 	    (dma_auto_mode & (1 << chan)) == 0 )
  		printf("isa_dmadone: channel %d not busy\n", chan);
! 
  
  	if (dma_bounced & (1 << chan)) {
  		/* copy bounce buffer on read */
***************
*** 913,924 ****
  		printf("isa_dmastatus: channel %d not active\n", chan);
  		return(-1);
  	}
  
! 	/* still busy? */
! 	if ((dma_busy & (1 << chan)) == 0) {
! 		return(0);
! 	}
! 	
  	if (chan < 4) {			/* low DMA controller */
  		ffport = DMA1_FFC;
  		waport = DMA1_CHN(chan) + 1;
--- 917,929 ----
  		printf("isa_dmastatus: channel %d not active\n", chan);
  		return(-1);
  	}
+ 	/* channel busy? */
  
! 	if (((dma_busy & (1 << chan)) == 0) &&
! 	    (dma_auto_mode & (1 << chan)) == 0 ) {
! 	    printf("chan %d not busy\n", chan);
! 	    return -2 ;
! 	}	
  	if (chan < 4) {			/* low DMA controller */
  		ffport = DMA1_FFC;
  		waport = DMA1_CHN(chan) + 1;





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708260419.VAA00268>