summaryrefslogtreecommitdiffstats
path: root/sys/pc98
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1997-08-28 09:15:31 +0000
committerkato <kato@FreeBSD.org>1997-08-28 09:15:31 +0000
commit5cd06fa9d929f55ce510b933fe6a231c580d7be1 (patch)
tree7c09ddc1033c341ab34468a08410c90964d60fee /sys/pc98
parente23235b4281d462b719252919371af12223c139c (diff)
downloadFreeBSD-src-5cd06fa9d929f55ce510b933fe6a231c580d7be1.zip
FreeBSD-src-5cd06fa9d929f55ce510b933fe6a231c580d7be1.tar.gz
Synchronize with sys/i386/isa/isa.c revision 1.103.
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/pc98/pc98.c59
1 files changed, 45 insertions, 14 deletions
diff --git a/sys/pc98/pc98/pc98.c b/sys/pc98/pc98/pc98.c
index 5571826..e1f18ba 100644
--- a/sys/pc98/pc98/pc98.c
+++ b/sys/pc98/pc98/pc98.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
- * $Id: pc98.c,v 1.38 1997/08/21 08:24:19 kato Exp $
+ * $Id: pc98.c,v 1.39 1997/08/26 15:08:52 kato Exp $
*/
/*
@@ -601,6 +601,7 @@ static u_int dma_bouncebufsize[8];
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;
#ifdef PC98
#define VALID_DMA_MASK (3)
@@ -670,6 +671,7 @@ isa_dma_acquire(chan)
return (EBUSY);
}
dma_inuse |= (1 << chan);
+ dma_auto_mode &= ~(1 << chan);
return (0);
}
@@ -701,6 +703,7 @@ isa_dma_release(chan)
}
dma_inuse &= ~(1 << chan);
+ dma_auto_mode &= ~(1 << chan);
}
#ifndef PC98
@@ -777,6 +780,12 @@ void isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
/* 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 (need_pre_dma_flush)
wbinvd(); /* wbinvd (WB cache flush) */
@@ -871,15 +880,10 @@ void isa_dmadone(int flags, caddr_t addr, int nbytes, int chan)
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)
+ if (((dma_busy & (1 << chan)) == 0) &&
+ (dma_auto_mode & (1 << chan)) == 0 )
printf("isa_dmadone: channel %d not busy\n", chan);
-#endif
+
if (dma_bounced & (1 << chan)) {
/* copy bounce buffer on read */
@@ -972,12 +976,14 @@ isa_dmastatus(int chan)
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 ;
+ }
- /* still busy? */
- if ((dma_busy & (1 << chan)) == 0) {
- return(0);
- }
-
#ifdef PC98
ffport = DMA1_FFC;
waport = DMA1_CHN(chan) + 2;
@@ -1016,6 +1022,31 @@ isa_dmastatus(int chan)
}
/*
+ * Stop a DMA transfer currently in progress.
+ */
+int
+isa_dmastop(int chan)
+{
+ if ((dma_inuse & (1 << chan)) == 0)
+ printf("isa_dmastop: channel %d not acquired\n", chan);
+
+ if (((dma_busy & (1 << chan)) == 0) &&
+ ((dma_auto_mode & (1 << chan)) == 0)) {
+ printf("chan %d not busy\n", chan);
+ return -2 ;
+ }
+
+ if ((chan & 4) == 0) {
+ outb(DMA1_SMSK, (chan & 3) | 4 /* disable mask */);
+ } else {
+#ifndef PC98
+ outb(DMA2_SMSK, (chan & 3) | 4 /* disable mask */);
+#endif
+ }
+ return(isa_dmastatus(chan));
+}
+
+/*
* Find the highest priority enabled display device. Since we can't
* distinguish display devices from ttys, depend on display devices
* being sensitive and before sensitive non-display devices (if any)
OpenPOWER on IntegriCloud