aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include/asm/pgtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/include/asm/pgtable.h')
-rw-r--r--arch/arm/include/asm/pgtable.h88
1 files changed, 54 insertions, 34 deletions
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 8e21ef15bd74..110295c5461d 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -164,14 +164,30 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
164#define L_PTE_PRESENT (1 << 0) 164#define L_PTE_PRESENT (1 << 0)
165#define L_PTE_FILE (1 << 1) /* only when !PRESENT */ 165#define L_PTE_FILE (1 << 1) /* only when !PRESENT */
166#define L_PTE_YOUNG (1 << 1) 166#define L_PTE_YOUNG (1 << 1)
167#define L_PTE_BUFFERABLE (1 << 2) /* matches PTE */ 167#define L_PTE_BUFFERABLE (1 << 2) /* obsolete, matches PTE */
168#define L_PTE_CACHEABLE (1 << 3) /* matches PTE */ 168#define L_PTE_CACHEABLE (1 << 3) /* obsolete, matches PTE */
169#define L_PTE_USER (1 << 4) 169#define L_PTE_DIRTY (1 << 6)
170#define L_PTE_WRITE (1 << 5) 170#define L_PTE_WRITE (1 << 7)
171#define L_PTE_EXEC (1 << 6) 171#define L_PTE_USER (1 << 8)
172#define L_PTE_DIRTY (1 << 7) 172#define L_PTE_EXEC (1 << 9)
173#define L_PTE_SHARED (1 << 10) /* shared(v6), coherent(xsc3) */ 173#define L_PTE_SHARED (1 << 10) /* shared(v6), coherent(xsc3) */
174 174
175/*
176 * These are the memory types, defined to be compatible with
177 * pre-ARMv6 CPUs cacheable and bufferable bits: XXCB
178 */
179#define L_PTE_MT_UNCACHED (0x00 << 2) /* 0000 */
180#define L_PTE_MT_BUFFERABLE (0x01 << 2) /* 0001 */
181#define L_PTE_MT_WRITETHROUGH (0x02 << 2) /* 0010 */
182#define L_PTE_MT_WRITEBACK (0x03 << 2) /* 0011 */
183#define L_PTE_MT_MINICACHE (0x06 << 2) /* 0110 (sa1100, xscale) */
184#define L_PTE_MT_WRITEALLOC (0x07 << 2) /* 0111 */
185#define L_PTE_MT_DEV_SHARED (0x04 << 2) /* 0100 */
186#define L_PTE_MT_DEV_NONSHARED (0x0c << 2) /* 1100 */
187#define L_PTE_MT_DEV_WC (0x09 << 2) /* 1001 */
188#define L_PTE_MT_DEV_CACHED (0x0b << 2) /* 1011 */
189#define L_PTE_MT_MASK (0x0f << 2)
190
175#ifndef __ASSEMBLY__ 191#ifndef __ASSEMBLY__
176 192
177/* 193/*
@@ -180,23 +196,30 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
180 * as well as any architecture dependent bits like global/ASID and SMP 196 * as well as any architecture dependent bits like global/ASID and SMP
181 * shared mapping bits. 197 * shared mapping bits.
182 */ 198 */
183#define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_CACHEABLE | L_PTE_BUFFERABLE 199#define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG
184#define _L_PTE_READ L_PTE_USER | L_PTE_EXEC
185 200
186extern pgprot_t pgprot_user; 201extern pgprot_t pgprot_user;
187extern pgprot_t pgprot_kernel; 202extern pgprot_t pgprot_kernel;
188 203
189#define PAGE_NONE pgprot_user 204#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b))
190#define PAGE_COPY __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ) 205
191#define PAGE_SHARED __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ | \ 206#define PAGE_NONE pgprot_user
192 L_PTE_WRITE) 207#define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_WRITE)
193#define PAGE_READONLY __pgprot(pgprot_val(pgprot_user) | _L_PTE_READ) 208#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_WRITE | L_PTE_EXEC)
194#define PAGE_KERNEL pgprot_kernel 209#define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER)
195 210#define PAGE_COPY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_EXEC)
196#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT) 211#define PAGE_READONLY _MOD_PROT(pgprot_user, L_PTE_USER)
197#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ) 212#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_EXEC)
198#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | _L_PTE_READ | L_PTE_WRITE) 213#define PAGE_KERNEL pgprot_kernel
199#define __PAGE_READONLY __pgprot(_L_PTE_DEFAULT | _L_PTE_READ) 214#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_kernel, L_PTE_EXEC)
215
216#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT)
217#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_WRITE)
218#define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_WRITE | L_PTE_EXEC)
219#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER)
220#define __PAGE_COPY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_EXEC)
221#define __PAGE_READONLY __pgprot(_L_PTE_DEFAULT | L_PTE_USER)
222#define __PAGE_READONLY_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_EXEC)
200 223
201#endif /* __ASSEMBLY__ */ 224#endif /* __ASSEMBLY__ */
202 225
@@ -212,19 +235,19 @@ extern pgprot_t pgprot_kernel;
212#define __P001 __PAGE_READONLY 235#define __P001 __PAGE_READONLY
213#define __P010 __PAGE_COPY 236#define __P010 __PAGE_COPY
214#define __P011 __PAGE_COPY 237#define __P011 __PAGE_COPY
215#define __P100 __PAGE_READONLY 238#define __P100 __PAGE_READONLY_EXEC
216#define __P101 __PAGE_READONLY 239#define __P101 __PAGE_READONLY_EXEC
217#define __P110 __PAGE_COPY 240#define __P110 __PAGE_COPY_EXEC
218#define __P111 __PAGE_COPY 241#define __P111 __PAGE_COPY_EXEC
219 242
220#define __S000 __PAGE_NONE 243#define __S000 __PAGE_NONE
221#define __S001 __PAGE_READONLY 244#define __S001 __PAGE_READONLY
222#define __S010 __PAGE_SHARED 245#define __S010 __PAGE_SHARED
223#define __S011 __PAGE_SHARED 246#define __S011 __PAGE_SHARED
224#define __S100 __PAGE_READONLY 247#define __S100 __PAGE_READONLY_EXEC
225#define __S101 __PAGE_READONLY 248#define __S101 __PAGE_READONLY_EXEC
226#define __S110 __PAGE_SHARED 249#define __S110 __PAGE_SHARED_EXEC
227#define __S111 __PAGE_SHARED 250#define __S111 __PAGE_SHARED_EXEC
228 251
229#ifndef __ASSEMBLY__ 252#ifndef __ASSEMBLY__
230/* 253/*
@@ -286,8 +309,10 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
286/* 309/*
287 * Mark the prot value as uncacheable and unbufferable. 310 * Mark the prot value as uncacheable and unbufferable.
288 */ 311 */
289#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) & ~(L_PTE_CACHEABLE | L_PTE_BUFFERABLE)) 312#define pgprot_noncached(prot) \
290#define pgprot_writecombine(prot) __pgprot(pgprot_val(prot) & ~L_PTE_CACHEABLE) 313 __pgprot((pgprot_val(prot) & ~L_PTE_MT_MASK) | L_PTE_MT_UNCACHED)
314#define pgprot_writecombine(prot) \
315 __pgprot((pgprot_val(prot) & ~L_PTE_MT_MASK) | L_PTE_MT_BUFFERABLE)
291 316
292#define pmd_none(pmd) (!pmd_val(pmd)) 317#define pmd_none(pmd) (!pmd_val(pmd))
293#define pmd_present(pmd) (pmd_val(pmd)) 318#define pmd_present(pmd) (pmd_val(pmd))
@@ -320,11 +345,6 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
320#define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd))) 345#define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd)))
321 346
322/* 347/*
323 * Permanent address of a page. We never have highmem, so this is trivial.
324 */
325#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT))
326
327/*
328 * Conversion functions: convert a page and protection to a page entry, 348 * Conversion functions: convert a page and protection to a page entry,
329 * and a page entry and page directory to the page they refer to. 349 * and a page entry and page directory to the page they refer to.
330 */ 350 */