Date: Wed, 22 Sep 2010 02:26:07 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r212989 - in head/sys/mips: include mips sibyte Message-ID: <201009220226.o8M2Q789013713@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: neel Date: Wed Sep 22 02:26:07 2010 New Revision: 212989 URL: http://svn.freebsd.org/changeset/base/212989 Log: Enforce that 'pmap_kenter()' is only used to establish cacheable mappings. Mappings with other cacheability attributes can be established, if needed, by using 'pmap_kenter_attr()'. Suggested by: jchandra, imp Modified: head/sys/mips/include/pmap.h head/sys/mips/mips/pmap.c head/sys/mips/sibyte/sb_zbpci.c Modified: head/sys/mips/include/pmap.h ============================================================================== --- head/sys/mips/include/pmap.h Wed Sep 22 01:39:55 2010 (r212988) +++ head/sys/mips/include/pmap.h Wed Sep 22 02:26:07 2010 (r212989) @@ -154,6 +154,7 @@ void pmap_unmapdev(vm_offset_t, vm_size_ vm_offset_t pmap_steal_memory(vm_size_t size); int page_is_managed(vm_offset_t pa); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); +void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr); void pmap_kremove(vm_offset_t va); void *pmap_kenter_temporary(vm_paddr_t pa, int i); void pmap_kenter_temporary_free(vm_paddr_t pa); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Wed Sep 22 01:39:55 2010 (r212988) +++ head/sys/mips/mips/pmap.c Wed Sep 22 02:26:07 2010 (r212989) @@ -828,7 +828,7 @@ retry: /* * add a wired page to the kva */ -static void +void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int attr) { pt_entry_t *pte; @@ -849,14 +849,11 @@ pmap_kenter_attr(vm_offset_t va, vm_padd void pmap_kenter(vm_offset_t va, vm_paddr_t pa) { - int attr; - if (is_cacheable_mem(pa)) - attr = PTE_C_CACHE; - else - attr = PTE_C_UNCACHED; + KASSERT(is_cacheable_mem(pa), + ("pmap_kenter: memory at 0x%lx is not cacheable", (u_long)pa)); - pmap_kenter_attr(va, pa, attr); + pmap_kenter_attr(va, pa, PTE_C_CACHE); } /* Modified: head/sys/mips/sibyte/sb_zbpci.c ============================================================================== --- head/sys/mips/sibyte/sb_zbpci.c Wed Sep 22 01:39:55 2010 (r212988) +++ head/sys/mips/sibyte/sb_zbpci.c Wed Sep 22 02:26:07 2010 (r212989) @@ -349,7 +349,7 @@ zbpci_config_space_va(int bus, int slot, pa_page = pa & ~(PAGE_SIZE - 1); if (zbpci_config_space[cpu].paddr != pa_page) { pmap_kremove(va_page); - pmap_kenter(va_page, pa_page); + pmap_kenter_attr(va_page, pa_page, PTE_C_UNCACHED); zbpci_config_space[cpu].paddr = pa_page; } return (va_page + (pa - pa_page));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009220226.o8M2Q789013713>