if (di->flags != 0) {
if (di->active) {
isadma_start(addr, nbytes, chan, flags)	caddr_t addr;	vm_size_t nbytes;	int chan;	int flags;{	struct dma_info *di;	int waport;	int mflags;	vm_size_t size;#ifdef ISADMA_DEBUG	if (chan < 0 || chan > 7 ||	    (((flags & DMAMODE_READ) != 0) + ((flags & DMAMODE_WRITE) != 0) +	    ((flags & DMAMODE_LOOP) != 0) != 1) ||	    ((chan & 4) ? (nbytes >= (1<<17) || nbytes & 1 || (u_int)addr & 1) :	    (nbytes >= (1<<16))))		panic("isadma_start: impossible request"); #endif	di = dma_info+chan;	if (di->flags != 0) {		log(LOG_ERR,"isadma_start: old request active on %d\n",chan);		isadma_abort(chan);	}	di->flags = flags;	di->addr = addr;	di->nbytes = nbytes;	mflags = ISADMA_MAP_WAITOK | ISADMA_MAP_BOUNCE | ISADMA_MAP_CONTIG;	mflags |= (chan & 4) ? ISADMA_MAP_16BIT : ISADMA_MAP_8BIT;	if (isadma_map(addr, nbytes, di->phys, mflags) != 1)		panic("isadma_start: cannot map");	/* XXX Will this do what we want with DMAMODE_LOOP?  */	if ((flags & DMAMODE_READ) == 0)		isadma_copytobuf(addr, nbytes, 1, di->phys);	dma_finished &= ~(1 << chan);	if ((chan & 4) == 0) {		/*		 * Program one of DMA channels 0..3.  These are		 * byte mode channels.		 */		/* set dma channel mode, and reset address ff */		outb(DMA1_MODE, chan | dmamode[flags]);		outb(DMA1_FFC, 0);		/* send start address */		waport = DMA1_CHN(chan);		outb(dmapageport[0][chan], di->phys[0].addr>>16);		outb(waport, di->phys[0].addr);		outb(waport, di->phys[0].addr>>8);		/* send count */		outb(waport + 1, --nbytes);		outb(waport + 1, nbytes>>8);		/* unmask channel */		outb(DMA1_SMSK, chan | DMA37SM_CLEAR);	} else {		/*		 * Program one of DMA channels 4..7.  These are		 * word mode channels.		 */		/* set dma channel mode, and reset address ff */		outb(DMA2_MODE, (chan & 3) | dmamode[flags]);		outb(DMA2_FFC, 0);		/* send start address */		waport = DMA2_CHN(chan & 3);		outb(dmapageport[1][chan], di->phys[0].addr>>16);		outb(waport, di->phys[0].addr>>1);		outb(waport, di->phys[0].addr>>9);		/* send count */		nbytes >>= 1;		outb(waport + 2, --nbytes);		outb(waport + 2, nbytes>>8);		/* unmask channel */		outb(DMA2_SMSK, (chan & 3) | DMA37SM_CLEAR);	}}