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.
This commit is contained in:
parent
4a1a7c3a83
commit
290617ea0e
@ -101,12 +101,20 @@ isa_dmainit(chan, bouncebufsize)
|
|||||||
{
|
{
|
||||||
void *buf;
|
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
|
#ifdef DIAGNOSTIC
|
||||||
if (chan & ~VALID_DMA_MASK)
|
if (chan & ~VALID_DMA_MASK)
|
||||||
panic("isa_dmainit: channel out of range");
|
panic("isa_dmainit: channel out of range");
|
||||||
|
|
||||||
if (dma_bouncebuf[chan] != NULL)
|
|
||||||
panic("isa_dmainit: impossible request");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dma_bouncebufsize[chan] = bouncebufsize;
|
dma_bouncebufsize[chan] = bouncebufsize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user