aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/pgtable.h
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-11-15 19:22:09 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-11-26 15:45:47 -0500
commitf6e3354d02aa1f30672e3671098c12cb49c7da25 (patch)
tree63e5731ea85afae946d8d393b7faeb7f84b02ee3 /arch/arm/include/asm/pgtable.h
parent97092e0c56830457af0639f6bd904537a150ea4a (diff)
ARM: pgtable: introduce pteval_t to represent a pte value
This makes everywhere dealing with pte values use the same type. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include/asm/pgtable.h')
-rw-r--r--arch/arm/include/asm/pgtable.h41
1 files changed, 21 insertions, 20 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 30b3a07dd998..50eb0b4278ec 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -10,6 +10,7 @@
10#ifndef _ASMARM_PGTABLE_H 10#ifndef _ASMARM_PGTABLE_H
11#define _ASMARM_PGTABLE_H 11#define _ASMARM_PGTABLE_H
12 12
13#include <linux/const.h>
13#include <asm-generic/4level-fixup.h> 14#include <asm-generic/4level-fixup.h>
14#include <asm/proc-fns.h> 15#include <asm/proc-fns.h>
15 16
@@ -161,30 +162,30 @@ extern void __pgd_error(const char *file, int line, pgd_t);
161 * The PTE table pointer refers to the hardware entries; the "Linux" 162 * The PTE table pointer refers to the hardware entries; the "Linux"
162 * entries are stored 1024 bytes below. 163 * entries are stored 1024 bytes below.
163 */ 164 */
164#define L_PTE_PRESENT (1 << 0) 165#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
165#define L_PTE_YOUNG (1 << 1) 166#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
166#define L_PTE_FILE (1 << 2) /* only when !PRESENT */ 167#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
167#define L_PTE_DIRTY (1 << 6) 168#define L_PTE_DIRTY (_AT(pteval_t, 1) << 6)
168#define L_PTE_WRITE (1 << 7) 169#define L_PTE_WRITE (_AT(pteval_t, 1) << 7)
169#define L_PTE_USER (1 << 8) 170#define L_PTE_USER (_AT(pteval_t, 1) << 8)
170#define L_PTE_EXEC (1 << 9) 171#define L_PTE_EXEC (_AT(pteval_t, 1) << 9)
171#define L_PTE_SHARED (1 << 10) /* shared(v6), coherent(xsc3) */ 172#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */
172 173
173/* 174/*
174 * These are the memory types, defined to be compatible with 175 * These are the memory types, defined to be compatible with
175 * pre-ARMv6 CPUs cacheable and bufferable bits: XXCB 176 * pre-ARMv6 CPUs cacheable and bufferable bits: XXCB
176 */ 177 */
177#define L_PTE_MT_UNCACHED (0x00 << 2) /* 0000 */ 178#define L_PTE_MT_UNCACHED (_AT(pteval_t, 0x00) << 2) /* 0000 */
178#define L_PTE_MT_BUFFERABLE (0x01 << 2) /* 0001 */ 179#define L_PTE_MT_BUFFERABLE (_AT(pteval_t, 0x01) << 2) /* 0001 */
179#define L_PTE_MT_WRITETHROUGH (0x02 << 2) /* 0010 */ 180#define L_PTE_MT_WRITETHROUGH (_AT(pteval_t, 0x02) << 2) /* 0010 */
180#define L_PTE_MT_WRITEBACK (0x03 << 2) /* 0011 */ 181#define L_PTE_MT_WRITEBACK (_AT(pteval_t, 0x03) << 2) /* 0011 */
181#define L_PTE_MT_MINICACHE (0x06 << 2) /* 0110 (sa1100, xscale) */ 182#define L_PTE_MT_MINICACHE (_AT(pteval_t, 0x06) << 2) /* 0110 (sa1100, xscale) */
182#define L_PTE_MT_WRITEALLOC (0x07 << 2) /* 0111 */ 183#define L_PTE_MT_WRITEALLOC (_AT(pteval_t, 0x07) << 2) /* 0111 */
183#define L_PTE_MT_DEV_SHARED (0x04 << 2) /* 0100 */ 184#define L_PTE_MT_DEV_SHARED (_AT(pteval_t, 0x04) << 2) /* 0100 */
184#define L_PTE_MT_DEV_NONSHARED (0x0c << 2) /* 1100 */ 185#define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */
185#define L_PTE_MT_DEV_WC (0x09 << 2) /* 1001 */ 186#define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */
186#define L_PTE_MT_DEV_CACHED (0x0b << 2) /* 1011 */ 187#define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
187#define L_PTE_MT_MASK (0x0f << 2) 188#define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)
188 189
189#ifndef __ASSEMBLY__ 190#ifndef __ASSEMBLY__
190 191
@@ -405,7 +406,7 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
405 406
406static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 407static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
407{ 408{
408 const unsigned long mask = L_PTE_EXEC | L_PTE_WRITE | L_PTE_USER; 409 const pteval_t mask = L_PTE_EXEC | L_PTE_WRITE | L_PTE_USER;
409 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); 410 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
410 return pte; 411 return pte;
411} 412}