Date: Wed, 1 Aug 2012 16:32:44 +0000 (UTC) From: Jakub Wojciech Klama <jceel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r238971 - in user/jceel/soc2012_armv6/sys/arm: arm include Message-ID: <201208011632.q71GWiDC074406@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jceel Date: Wed Aug 1 16:32:44 2012 New Revision: 238971 URL: http://svn.freebsd.org/changeset/base/238971 Log: Introduce pmap_kenter_device() function for device mappings which uses correct mapping type on armv6 and behaves identically to pmap_kenter_nocache() on armv5. Chance bus_space_map() default implementation to use above. Modified: user/jceel/soc2012_armv6/sys/arm/arm/bus_space_generic.c user/jceel/soc2012_armv6/sys/arm/arm/pmap-v6.c user/jceel/soc2012_armv6/sys/arm/arm/pmap.c user/jceel/soc2012_armv6/sys/arm/include/pmap.h Modified: user/jceel/soc2012_armv6/sys/arm/arm/bus_space_generic.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/arm/bus_space_generic.c Wed Aug 1 16:04:13 2012 (r238970) +++ user/jceel/soc2012_armv6/sys/arm/arm/bus_space_generic.c Wed Aug 1 16:32:44 2012 (r238971) @@ -80,12 +80,10 @@ generic_bs_map(void *t, bus_addr_t bpa, *bshp = va + offset; for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) { - pmap_kenter(va, pa); - pte = vtopte(va); - if (!(flags & BUS_SPACE_MAP_CACHEABLE)) { - *pte &= ~L2_S_CACHE_MASK; - PTE_SYNC(pte); - } + if (flags & BUS_SPACE_MAP_CACHEABLE) + pmap_kenter(va, pa); + else + pmap_kenter_device(va, pa); } return (0); Modified: user/jceel/soc2012_armv6/sys/arm/arm/pmap-v6.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/arm/pmap-v6.c Wed Aug 1 16:04:13 2012 (r238970) +++ user/jceel/soc2012_armv6/sys/arm/arm/pmap-v6.c Wed Aug 1 16:32:44 2012 (r238971) @@ -336,6 +336,7 @@ struct l2_dtable { /* pmap_kenter_internal flags */ #define KENTER_CACHE 0x1 #define KENTER_USER 0x2 +#define KENTER_DEVICE 0x4 /* * Given an L1 table index, calculate the corresponding l2_dtable index @@ -2072,6 +2073,9 @@ pmap_kenter_internal(vm_offset_t va, vm_ *pte = L2_S_PROTO | pa | pte_l2_s_cache_mode; pmap_set_prot(pte, VM_PROT_READ | VM_PROT_WRITE, flags & KENTER_USER); + } else if (flags & KENTER_DEVICE) { + *pte = L2_S_PROTO | pa | l2s_mem_types[PTE_DEVICE]; + pmap_set_prot(pte, VM_PROT_READ|VM_PROT_WRITE, 0); } else { *pte = L2_S_PROTO | pa; pmap_set_prot(pte, VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, @@ -2098,6 +2102,13 @@ pmap_kenter_nocache(vm_offset_t va, vm_p } void +pmap_kenter_device(vm_offset_t va, vm_paddr_t pa) +{ + + pmap_kenter_internal(va, pa, KENTER_DEVICE); +} + +void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa) { Modified: user/jceel/soc2012_armv6/sys/arm/arm/pmap.c ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/arm/pmap.c Wed Aug 1 16:04:13 2012 (r238970) +++ user/jceel/soc2012_armv6/sys/arm/arm/pmap.c Wed Aug 1 16:32:44 2012 (r238971) @@ -2859,6 +2859,13 @@ pmap_kenter_nocache(vm_offset_t va, vm_p } void +pmap_kenter_device(vm_offset_t va, vm_paddr_t pa) +{ + + pmap_kenter_nocache(va, pa); +} + +void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa) { Modified: user/jceel/soc2012_armv6/sys/arm/include/pmap.h ============================================================================== --- user/jceel/soc2012_armv6/sys/arm/include/pmap.h Wed Aug 1 16:04:13 2012 (r238970) +++ user/jceel/soc2012_armv6/sys/arm/include/pmap.h Wed Aug 1 16:32:44 2012 (r238971) @@ -232,6 +232,7 @@ void pmap_bootstrap(vm_offset_t, vm_offs int pmap_change_attr(vm_offset_t, vm_size_t, int); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void pmap_kenter_nocache(vm_offset_t va, vm_paddr_t pa); +void pmap_kenter_device(vm_offset_t va, vm_paddr_t pa); void *pmap_kenter_temp(vm_paddr_t pa, int i); void pmap_kenter_user(vm_offset_t va, vm_paddr_t pa); void pmap_kremove(vm_offset_t);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208011632.q71GWiDC074406>