/* Translate a physical address to a logical address. This will return the logical address of the first match.  */
unsigned long vdma_phys2log(unsigned long paddr)
/* Translate a physical address to a logical address. This will return the logical address of the first match.  */
unsigned long vdma_phys2log(unsigned long paddr)
{
	int i;
	int frame;
	frame = paddr & ~(VDMA_PAGESIZE - 1);
	for (i = 0; i < VDMA_PGTBL_ENTRIES; i++) {
		if (pgtbl[i].frame == frame)
			break;
	}
	if (i == VDMA_PGTBL_ENTRIES)
		return ~0UL;
	return (i << 12) + (paddr & (VDMA_PAGESIZE - 1));
}