diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-11-15 19:22:09 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-11-26 15:45:47 -0500 |
commit | f6e3354d02aa1f30672e3671098c12cb49c7da25 (patch) | |
tree | 63e5731ea85afae946d8d393b7faeb7f84b02ee3 | |
parent | 97092e0c56830457af0639f6bd904537a150ea4a (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>
-rw-r--r-- | arch/arm/include/asm/page.h | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/pgtable.h | 41 | ||||
-rw-r--r-- | arch/arm/mm/fault-armv.c | 2 | ||||
-rw-r--r-- | arch/arm/mm/mm.h | 2 | ||||
-rw-r--r-- | arch/arm/mm/mmu.c | 2 |
5 files changed, 28 insertions, 25 deletions
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h index a485ac3c8696..f51a69595f6e 100644 --- a/arch/arm/include/asm/page.h +++ b/arch/arm/include/asm/page.h | |||
@@ -151,13 +151,15 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from, | |||
151 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) | 151 | #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) |
152 | extern void copy_page(void *to, const void *from); | 152 | extern void copy_page(void *to, const void *from); |
153 | 153 | ||
154 | typedef unsigned long pteval_t; | ||
155 | |||
154 | #undef STRICT_MM_TYPECHECKS | 156 | #undef STRICT_MM_TYPECHECKS |
155 | 157 | ||
156 | #ifdef STRICT_MM_TYPECHECKS | 158 | #ifdef STRICT_MM_TYPECHECKS |
157 | /* | 159 | /* |
158 | * These are used to make use of C type-checking.. | 160 | * These are used to make use of C type-checking.. |
159 | */ | 161 | */ |
160 | typedef struct { unsigned long pte; } pte_t; | 162 | typedef struct { pteval_t pte; } pte_t; |
161 | typedef struct { unsigned long pmd; } pmd_t; | 163 | typedef struct { unsigned long pmd; } pmd_t; |
162 | typedef struct { unsigned long pgd[2]; } pgd_t; | 164 | typedef struct { unsigned long pgd[2]; } pgd_t; |
163 | typedef struct { unsigned long pgprot; } pgprot_t; | 165 | typedef struct { unsigned long pgprot; } pgprot_t; |
@@ -175,7 +177,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; | |||
175 | /* | 177 | /* |
176 | * .. while these make it easier on the compiler | 178 | * .. while these make it easier on the compiler |
177 | */ | 179 | */ |
178 | typedef unsigned long pte_t; | 180 | typedef pteval_t pte_t; |
179 | typedef unsigned long pmd_t; | 181 | typedef unsigned long pmd_t; |
180 | typedef unsigned long pgd_t[2]; | 182 | typedef unsigned long pgd_t[2]; |
181 | typedef unsigned long pgprot_t; | 183 | typedef unsigned long pgprot_t; |
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 | ||
406 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 407 | static 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 | } |
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c index 83e59f870426..01210dba0221 100644 --- a/arch/arm/mm/fault-armv.c +++ b/arch/arm/mm/fault-armv.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #include "mm.h" | 27 | #include "mm.h" |
28 | 28 | ||
29 | static unsigned long shared_pte_mask = L_PTE_MT_BUFFERABLE; | 29 | static pteval_t shared_pte_mask = L_PTE_MT_BUFFERABLE; |
30 | 30 | ||
31 | #if __LINUX_ARM_ARCH__ < 6 | 31 | #if __LINUX_ARM_ARCH__ < 6 |
32 | /* | 32 | /* |
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h index 6630620380a4..36960df5fb76 100644 --- a/arch/arm/mm/mm.h +++ b/arch/arm/mm/mm.h | |||
@@ -16,7 +16,7 @@ static inline pmd_t *pmd_off_k(unsigned long virt) | |||
16 | } | 16 | } |
17 | 17 | ||
18 | struct mem_type { | 18 | struct mem_type { |
19 | unsigned int prot_pte; | 19 | pteval_t prot_pte; |
20 | unsigned int prot_l1; | 20 | unsigned int prot_l1; |
21 | unsigned int prot_sect; | 21 | unsigned int prot_sect; |
22 | unsigned int domain; | 22 | unsigned int domain; |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 9568f8632ae3..94ee0930d690 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -62,7 +62,7 @@ struct cachepolicy { | |||
62 | const char policy[16]; | 62 | const char policy[16]; |
63 | unsigned int cr_mask; | 63 | unsigned int cr_mask; |
64 | unsigned int pmd; | 64 | unsigned int pmd; |
65 | unsigned int pte; | 65 | pteval_t pte; |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static struct cachepolicy cache_policies[] __initdata = { | 68 | static struct cachepolicy cache_policies[] __initdata = { |