diff options
author | phk <phk@FreeBSD.org> | 2004-07-05 20:37:42 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-07-05 20:37:42 +0000 |
commit | 290617ea0ebdeb45c43aa0913abbf73a3a055794 (patch) | |
tree | 59b58816ac157fb3a1b5460ccec0a9f843d11541 /sys/i386/isa | |
parent | 4a1a7c3a8340d90949eb6ed19ef3655b55c2417b (diff) | |
download | FreeBSD-src-290617ea0ebdeb45c43aa0913abbf73a3a055794.zip FreeBSD-src-290617ea0ebdeb45c43aa0913abbf73a3a055794.tar.gz |
Something funny happened on the way to the floppy driver today...
When two drivers share an ISA DMA channel, they both call isa_dmainit()
and the second call fails if DIAGNOSTIC is on.
If isa_dmainit() was already called successfully, just return silently.
This only works if both drivers agree on the bounce buffer size,
but since sharing DMA is usually only possible on very special
hardware and then typically only for devices of the same type (which
would have multiple instances of the same device driver), this is
not a problem in practice.
Diffstat (limited to 'sys/i386/isa')
-rw-r--r-- | sys/i386/isa/isa_dma.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/i386/isa/isa_dma.c b/sys/i386/isa/isa_dma.c index b203666..23dc07d 100644 --- a/sys/i386/isa/isa_dma.c +++ b/sys/i386/isa/isa_dma.c @@ -101,12 +101,20 @@ isa_dmainit(chan, bouncebufsize) { void *buf; + /* + * If a DMA channel is shared, both drivers have to call isa_dmainit + * since they don't know that the other driver will do it. + * Just return if we're already set up good. + * XXX: this only works if they agree on the bouncebuf size. This + * XXX: is typically the case since they are multiple instances of + * XXX: the same driver. + */ + if (dma_bouncebuf[chan] != NULL) + return; + #ifdef DIAGNOSTIC if (chan & ~VALID_DMA_MASK) panic("isa_dmainit: channel out of range"); - - if (dma_bouncebuf[chan] != NULL) - panic("isa_dmainit: impossible request"); #endif dma_bouncebufsize[chan] = bouncebufsize; |