xref: /freebsd/sys/arm/include/vm.h (revision 83242da4a93025f6a4e053842db85a846c510f6d)
1e999111aSAlan Cox /*-
2e999111aSAlan Cox  * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu>
3e999111aSAlan Cox  * All rights reserved.
4e999111aSAlan Cox  *
5e999111aSAlan Cox  * Redistribution and use in source and binary forms, with or without
6e999111aSAlan Cox  * modification, are permitted provided that the following conditions
7e999111aSAlan Cox  * are met:
8e999111aSAlan Cox  * 1. Redistributions of source code must retain the above copyright
9e999111aSAlan Cox  *    notice, this list of conditions and the following disclaimer.
10e999111aSAlan Cox  * 2. Redistributions in binary form must reproduce the above copyright
11e999111aSAlan Cox  *    notice, this list of conditions and the following disclaimer in the
12e999111aSAlan Cox  *    documentation and/or other materials provided with the distribution.
13e999111aSAlan Cox  *
14e999111aSAlan Cox  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15e999111aSAlan Cox  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16e999111aSAlan Cox  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17e999111aSAlan Cox  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18e999111aSAlan Cox  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19e999111aSAlan Cox  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20e999111aSAlan Cox  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21e999111aSAlan Cox  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22e999111aSAlan Cox  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23e999111aSAlan Cox  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24e999111aSAlan Cox  * SUCH DAMAGE.
25e999111aSAlan Cox  *
26e999111aSAlan Cox  * $FreeBSD$
27e999111aSAlan Cox  */
28e999111aSAlan Cox 
29e999111aSAlan Cox #ifndef _MACHINE_VM_H_
30e999111aSAlan Cox #define	_MACHINE_VM_H_
31e999111aSAlan Cox 
3241a7c569SMichal Meloun #include <machine/acle-compat.h>
3341a7c569SMichal Meloun 
3441a7c569SMichal Meloun #if __ARM_ARCH >= 6
3584233ddbSIan Lepore #include <machine/pte-v6.h>
3684233ddbSIan Lepore 
3784233ddbSIan Lepore #define VM_MEMATTR_WB_WA		((vm_memattr_t)PTE2_ATTR_WB_WA)
3884233ddbSIan Lepore #define VM_MEMATTR_NOCACHE		((vm_memattr_t)PTE2_ATTR_NOCACHE)
3984233ddbSIan Lepore #define VM_MEMATTR_DEVICE		((vm_memattr_t)PTE2_ATTR_DEVICE)
4084233ddbSIan Lepore #define VM_MEMATTR_SO			((vm_memattr_t)PTE2_ATTR_SO)
41*83242da4SMichal Meloun #define VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)PTE2_ATTR_WT)
4284233ddbSIan Lepore 
4384233ddbSIan Lepore #define VM_MEMATTR_DEFAULT		VM_MEMATTR_WB_WA
44e53ea2abSMichal Meloun #define VM_MEMATTR_UNCACHEABLE		VM_MEMATTR_SO 	/* misused by DMA */
4541a7c569SMichal Meloun #ifdef _KERNEL
4641a7c569SMichal Meloun /* Don't export aliased VM_MEMATTR to userland */
47*83242da4SMichal Meloun #define VM_MEMATTR_WRITE_COMBINING 	VM_MEMATTR_WRITE_THROUGH /* for DRM */
48e53ea2abSMichal Meloun #define VM_MEMATTR_WRITE_BACK		VM_MEMATTR_WB_WA	/* for DRM */
4941a7c569SMichal Meloun #endif
5084233ddbSIan Lepore #else
5165d79ed7SOlivier Houchard /* Memory attribute configuration. */
523153e878SAlan Cox #define	VM_MEMATTR_DEFAULT	0
5365d79ed7SOlivier Houchard #define	VM_MEMATTR_UNCACHEABLE	1
5484233ddbSIan Lepore #endif
55e999111aSAlan Cox 
565797795fSAlan Cox #endif /* !_MACHINE_VM_H_ */
57