diff options
author | msmith <msmith@FreeBSD.org> | 1997-07-29 05:24:36 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1997-07-29 05:24:36 +0000 |
commit | 481c9916674d2cd9120779ba92d7e8530ed04abd (patch) | |
tree | 75c025325df187d6ba41d6e0941b8a122806f1bc /sys/i386/isa/isa.c | |
parent | b1debf973d6a489bfe9c6511c94e356d6c024a47 (diff) | |
download | FreeBSD-src-481c9916674d2cd9120779ba92d7e8530ed04abd.zip FreeBSD-src-481c9916674d2cd9120779ba92d7e8530ed04abd.tar.gz |
Return to using disable/enable_intr() for guarding DMA register access.
Mask the read value from the count register in order to return zero correctly
after TC, as per intel datasheet : "If it is not autoinitialised, this
register will have a count of FFFFH after TC"
Diffstat (limited to 'sys/i386/isa/isa.c')
-rw-r--r-- | sys/i386/isa/isa.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/i386/isa/isa.c b/sys/i386/isa/isa.c index 81cbcfc..17d8780 100644 --- a/sys/i386/isa/isa.c +++ b/sys/i386/isa/isa.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * $Id: isa.c,v 1.97 1997/07/28 07:49:40 msmith Exp $ + * $Id: isa.c,v 1.98 1997/07/28 09:13:11 msmith Exp $ */ /* @@ -928,21 +928,24 @@ isa_dmastatus(int chan) waport = DMA2_CHN(chan - 4) + 2; } - ef = read_eflags(); /* get current flags */ disable_intr(); /* no interrupts Mr Jones! */ outb(ffport, 0); /* clear register LSB flipflop */ low1 = inb(waport); high1 = inb(waport); - outb(ffport, 0); /* clear again (paranoia?) */ + outb(ffport, 0); /* clear again */ low2 = inb(waport); high2 = inb(waport); - write_eflags(ef); /* restore flags */ + enable_intr(); /* enable interrupts again */ - /* now decide if a wrap has tried to skew our results */ + /* + * Now decide if a wrap has tried to skew our results. + * Note that after TC, the count will read 0xffff, while we want + * to return zero, so we add and then mask to compensate. + */ if (low1 >= low2) { - cnt = low1 + (high1 << 8) + 1; + cnt = (low1 + (high1 << 8) + 1) & 0xffff; } else { - cnt = low2 + (high2 << 8) + 1; + cnt = (low2 + (high2 << 8) + 1) & 0xffff; } if (chan >= 4) /* high channels move words */ |