From owner-svn-src-user@FreeBSD.ORG Wed Aug 1 16:32:44 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1CE21065672; Wed, 1 Aug 2012 16:32:44 +0000 (UTC) (envelope-from jceel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBED98FC15; Wed, 1 Aug 2012 16:32:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q71GWimb074411; Wed, 1 Aug 2012 16:32:44 GMT (envelope-from jceel@svn.freebsd.org) Received: (from jceel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q71GWiDC074406; Wed, 1 Aug 2012 16:32:44 GMT (envelope-from jceel@svn.freebsd.org) Message-Id: <201208011632.q71GWiDC074406@svn.freebsd.org> From: Jakub Wojciech Klama Date: Wed, 1 Aug 2012 16:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238971 - in user/jceel/soc2012_armv6/sys/arm: arm include X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Aug 2012 16:32:44 -0000 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);