if (bounce_isbounced(phys[i].addr))
if (bounce_vaddr(phys[i].addr))
isadma_map(addr, nbytes, phys, flags)	caddr_t addr;	vm_size_t nbytes;	struct isadma_seg *phys;	int flags;{	vm_offset_t pmask, thiskv, thisphys, nextphys;	vm_size_t datalen;	int seg, waitok, i;	if (flags & ISADMA_MAP_8BIT)		pmask = ~((64*1024)-1);	else if (flags & ISADMA_MAP_16BIT)		pmask = ~((128*1024)-1);	else		pmask = 0;	waitok = (flags & ISADMA_MAP_WAITOK) != 0;	thiskv = (vm_offset_t)addr;	datalen = nbytes;	thisphys = vtophys(thiskv);	seg = 0;	while (datalen > 0 && (seg == 0 || (flags & ISADMA_MAP_CONTIG) == 0)) {		if (thisphys == 0)			panic("isadma_map: no physical page present");		phys[seg].length = 0;		phys[seg].addr = thisphys;		nextphys = thisphys;		while (datalen > 0 && thisphys == nextphys) {			nextphys = trunc_page(thisphys) + NBPG;			phys[seg].length += min(nextphys-thisphys, datalen);			datalen -= min(nextphys-thisphys, datalen);			thiskv = trunc_page(thiskv) + NBPG;			if (datalen)				thisphys = vtophys(thiskv);		}		if (phys[seg].addr+phys[seg].length > 0xffffff) {			if (flags & ISADMA_MAP_CONTIG) {				phys[seg].length = nbytes;				datalen = 0;			}			if ((flags & ISADMA_MAP_BOUNCE) == 0)				phys[seg].addr = 0;			else				phys[seg].addr =				    bounce_alloc(phys[seg].length, pmask,						 waitok);			if (phys[seg].addr == 0) {				for (i = 0; i < seg; i++)					if (bounce_isbounced(phys[i].addr))						bounce_free(phys[i].addr,							    phys[i].length);				return 0;			}		}		seg++;	}	/* check all constraints */	if (datalen ||	    ((phys[0].addr ^ (phys[0].addr+phys[0].length-1)) & pmask) != 0 ||	    ((phys[0].addr & 1) && (flags & ISADMA_MAP_16BIT))) {		if ((flags & ISADMA_MAP_BOUNCE) == 0)			return 0;		if ((phys[0].addr = bounce_alloc(nbytes, pmask, waitok)) == 0)			return 0;		phys[0].length = nbytes;	}	return seg;}