unsigned long eeh_token_to_phys(unsigned long token) { if (REGION_ID(token) == EEH_REGION_ID) { unsigned long vaddr = IO_TOKEN_TO_ADDR(token); pte_t *ptep = find_linux_pte(ioremap_mm.pgd, vaddr); unsigned long pa = pte_pagenr(*ptep) << PAGE_SHIFT; return pa | (vaddr & (PAGE_SIZE-1)); } else return token; }
/* XXX This routine could be used with iterate_page() to replace * unmap_uncached_page() and save a little code space but I didn't * do that since I'm not certain whether this is the right path. -PB */ static void unmap_cached_pte(pte_t * pte, unsigned long arg) { pte_t page = *pte; pte_clear(pte); if (!pte_none(page)) { if (pte_present(page)) { unsigned long map_nr = pte_pagenr(page); if (map_nr < max_mapnr) __free_page(mem_map + map_nr); } else { printk(KERN_CRIT "Whee.. Swapped out page in kernel page table\n"); } } }