FreeBSD/sys/powerpc/aim/mmu_oea.c
/*
 * Modify the WIMG settings of all mappings for a page.
 */
Modify the WIMG settings of all mappings for a page.
Modify the WIMG settings of all mappings for a page .
void
moea_page_set_memattr(mmu_t mmu, vm_page_t m, vm_memattr_t ma)
{
	struct	pvo_entry *pvo;
	struct	pvo_head *pvo_head;
	struct	pte *pt;
	pmap_t	pmap;
	u_int	lo;
	if ((m->oflags & VPO_UNMANAGED) != 0) {
		m->md.mdpg_cache_attrs = ma;
		return;
	}
	rw_wlock(&pvh_global_lock);
	pvo_head = vm_page_to_pvoh(m);
	lo = moea_calc_wimg(VM_PAGE_TO_PHYS(m), ma);
	LIST_FOREACH(pvo, pvo_head, pvo_vlink) {
		pmap = pvo->pvo_pmap;
		PMAP_LOCK(pmap);
		pt = moea_pvo_to_pte(pvo, -1);
		pvo->pvo_pte.pte.pte_lo &= ~PTE_WIMG;
		pvo->pvo_pte.pte.pte_lo |= lo;
		if (pt != NULL) {
			moea_pte_change(pt, &pvo->pvo_pte.pte,
			    pvo->pvo_vaddr);
			if (pvo->pvo_pmap == kernel_pmap)
				isync();
		}
		mtx_unlock(&moea_table_mutex);
		PMAP_UNLOCK(pmap);
	}
	m->md.mdpg_cache_attrs = ma;
	rw_wunlock(&pvh_global_lock);
}
void moea_page_set_memattr ( mmu_t mmu , vm_page_t m , vm_memattr_t ma ) { struct pvo_entry * pvo ; struct pvo_head * pvo_head ; struct pte * pt ; pmap_t pmap ; u_int lo ; if ( ( m -> oflags & VPO_UNMANAGED ) != 0 ) { m -> md . mdpg_cache_attrs = ma ; return ; } rw_wlock ( & pvh_global_lock ) ; pvo_head = vm_page_to_pvoh ( m ) ; lo = moea_calc_wimg ( VM_PAGE_TO_PHYS ( m ) , ma ) ; LIST_FOREACH ( pvo , pvo_head , pvo_vlink ) { pmap = pvo -> pvo_pmap ; PMAP_LOCK ( pmap ) ; pt = moea_pvo_to_pte ( pvo , -1 ) ; pvo -> pvo_pte . pte . pte_lo &= ~ PTE_WIMG ; pvo -> pvo_pte . pte . pte_lo |= lo ; if ( pt != NULL ) { moea_pte_change ( pt , & pvo -> pvo_pte . pte , pvo -> pvo_vaddr ) ; if ( pvo -> pvo_pmap == kernel_pmap ) isync ( ) ; } mtx_unlock ( & moea_table_mutex ) ; PMAP_UNLOCK ( pmap ) ; } m -> md . mdpg_cache_attrs = ma ; rw_wunlock ( & pvh_global_lock ) ; }
Modify the WIMG settings of all mappings for a page.
Modify the WIMG settings of all mappings for a page .