Use the new flags argument to pmap_kenter_pa for PMAP_NOCACHE.

This commit is contained in:
skrll 2009-11-11 16:08:31 +00:00
parent db8264b1d5
commit 1070b74721
3 changed files with 13 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.55 2009/11/07 07:27:43 cegger Exp $ */
/* $NetBSD: mainbus.c,v 1.56 2009/11/11 16:08:31 skrll Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.55 2009/11/07 07:27:43 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.56 2009/11/11 16:08:31 skrll Exp $");
#include "locators.h"
#include "power.h"
@ -1304,7 +1304,7 @@ mbus_dmamem_map(void *v, bus_dma_segment_t *segs, int nsegs, size_t size,
TAILQ_FOREACH(pg, pglist, pageq.queue) {
KASSERT(size != 0);
pa = VM_PAGE_TO_PHYS(pg);
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE | PMAP_NC, 0);
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, PMAP_NOCACHE);
va += PAGE_SIZE;
size -= PAGE_SIZE;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.54 2009/11/07 07:27:44 cegger Exp $ */
/* $NetBSD: pmap.c,v 1.55 2009/11/11 16:08:31 skrll Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.54 2009/11/07 07:27:44 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.55 2009/11/11 16:08:31 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1780,7 +1780,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
opte = pmap_pte_get(pde, va);
pte = pa | PTE_PROT(TLB_WIRED | TLB_REFTRAP |
pmap_prot(pmap_kernel(), prot & VM_PROT_ALL));
if (pa >= HPPA_IOBEGIN || (prot & PMAP_NC))
if (pa >= HPPA_IOBEGIN || (flags & PMAP_NOCACHE))
pte |= PTE_PROT(TLB_UNCACHEABLE);
pmap_kernel()->pm_stats.wired_count++;
pmap_kernel()->pm_stats.resident_count++;
@ -1797,7 +1797,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int flags)
mutex_enter(&pg->mdpage.pvh_lock);
if (prot & PMAP_NC)
if (flags & PMAP_NOCACHE)
pg->mdpage.pvh_attrs |= PVF_NC;
else {
struct pv_entry *pve;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.21 2009/05/24 06:53:35 skrll Exp $ */
/* $NetBSD: pmap.h,v 1.22 2009/11/11 16:08:31 skrll Exp $ */
/* $OpenBSD: pmap.h,v 1.35 2007/12/14 18:32:23 deraadt Exp $ */
@ -56,8 +56,6 @@ struct pmap {
struct pmap_statistics pm_stats;
};
#define PMAP_NC 0x100
/*
* Flags that indicate attributes of pages or mappings of pages.
*
@ -208,6 +206,11 @@ pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
((((va) & 0xc0000000) != 0xc0000000) ? \
(pmap)->pm_space : HPPA_SID_KERNEL)
/*
* MD flags that we use for pmap_kenter_pa:
*/
#define PMAP_NOCACHE 0x01 /* set the non-cacheable bit */
#endif /* _KERNEL */
#endif /* _HPPA_PMAP_H_ */