FreeBSD/sys/x86/isa/isa_dma.c
/*
 * Check for problems with the address range of a DMA transfer
 * (non-contiguous physical pages, outside of bus address space,
 * crossing DMA page boundaries).
 * Return true if special handling needed.
 */
Check for problems with the address range of a DMA transfer
(non-contiguous physical pages, outside of bus address space,
crossing DMA page boundaries).
Return true if special handling needed.
Check for problems with the address range of a DMA transfer ( non - contiguous physical pages outside of bus address space crossing DMA page boundaries ) . Return true if special handling needed .
static int
isa_dmarangecheck(caddr_t va, u_int length, int chan)
{
	vm_paddr_t phys, priorpage = 0;
	vm_offset_t endva;
	u_int dma_pgmsk = (chan & 4) ?  ~(128*1024-1) : ~(64*1024-1);
	endva = (vm_offset_t)round_page((vm_offset_t)va + length);
	for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
		phys = trunc_page(pmap_extract(kernel_pmap, (vm_offset_t)va));
		if (phys == 0)
			panic("isa_dmacheck: no physical page present");
		if (phys >= ISARAM_END)
			return (1);
		if (priorpage) {
			if (priorpage + PAGE_SIZE != phys)
				return (1);
			if (((u_int)priorpage ^ (u_int)phys) & dma_pgmsk)
				return (1);
		}
		priorpage = phys;
	}
	return (0);
}
static int isa_dmarangecheck ( caddr_t va , u_int length , int chan ) { vm_paddr_t phys , priorpage = 0 ; vm_offset_t endva ; u_int dma_pgmsk = ( chan & 4 ) ? ~ ( 128 * 1024 - 1 ) : ~ ( 64 * 1024 - 1 ) ; endva = ( vm_offset_t ) round_page ( ( vm_offset_t ) va + length ) ; for ( ; va < ( caddr_t ) endva ; va += PAGE_SIZE ) { phys = trunc_page ( pmap_extract ( kernel_pmap , ( vm_offset_t ) va ) ) ; if ( phys == 0 ) panic ( " " ) ; if ( phys >= ISARAM_END ) return ( 1 ) ; if ( priorpage ) { if ( priorpage + PAGE_SIZE != phys ) return ( 1 ) ; if ( ( ( u_int ) priorpage ^ ( u_int ) phys ) & dma_pgmsk ) return ( 1 ) ; } priorpage = phys ; } return ( 0 ) ; }
Check for problems with the address range of a DMA transfer
 (non-contiguous physical pages, outside of bus address space,
 crossing DMA page boundaries).
Check for problems with the address range of a DMA transfer ( non - contiguous physical pages outside of bus address space crossing DMA page boundaries ) .
/* check if crossing a DMA page boundary */