Go to the documentation of this file.
8 #ifndef __ASM_AVR32_PGTABLE_H
9 #define __ASM_AVR32_PGTABLE_H
11 #include <asm/addrspace.h>
14 #include <linux/sched.h>
21 #include <asm/pgtable-2level.h>
27 #define PMD_SIZE (1UL << PMD_SHIFT)
28 #define PMD_MASK (~(PMD_SIZE-1))
29 #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
30 #define PGDIR_MASK (~(PGDIR_SIZE-1))
32 #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
33 #define FIRST_USER_ADDRESS 0
44 #define ZERO_PAGE(vaddr) (empty_zero_page)
62 #define VMALLOC_OFFSET (8 * 1024 * 1024)
63 #define VMALLOC_START (P3SEG + VMALLOC_OFFSET)
64 #define VMALLOC_END (P4SEG - VMALLOC_OFFSET)
71 #define _TLBEHI_BIT_VALID 9
72 #define _TLBEHI_VALID (1 << _TLBEHI_BIT_VALID)
74 #define _PAGE_BIT_WT 0
75 #define _PAGE_BIT_DIRTY 1
76 #define _PAGE_BIT_SZ0 2
77 #define _PAGE_BIT_SZ1 3
78 #define _PAGE_BIT_EXECUTE 4
79 #define _PAGE_BIT_RW 5
80 #define _PAGE_BIT_USER 6
81 #define _PAGE_BIT_BUFFER 7
82 #define _PAGE_BIT_GLOBAL 8
83 #define _PAGE_BIT_CACHABLE 9
86 #define _PAGE_BIT_PRESENT 10
87 #define _PAGE_BIT_ACCESSED 11
90 #define _PAGE_BIT_FILE 0
92 #define _PAGE_WT (1 << _PAGE_BIT_WT)
93 #define _PAGE_DIRTY (1 << _PAGE_BIT_DIRTY)
94 #define _PAGE_EXECUTE (1 << _PAGE_BIT_EXECUTE)
95 #define _PAGE_RW (1 << _PAGE_BIT_RW)
96 #define _PAGE_USER (1 << _PAGE_BIT_USER)
97 #define _PAGE_BUFFER (1 << _PAGE_BIT_BUFFER)
98 #define _PAGE_GLOBAL (1 << _PAGE_BIT_GLOBAL)
99 #define _PAGE_CACHABLE (1 << _PAGE_BIT_CACHABLE)
102 #define _PAGE_ACCESSED (1 << _PAGE_BIT_ACCESSED)
103 #define _PAGE_PRESENT (1 << _PAGE_BIT_PRESENT)
104 #define _PAGE_FILE (1 << _PAGE_BIT_FILE)
116 #define _PAGE_TYPE_MASK ((1 << _PAGE_BIT_SZ0) | (1 << _PAGE_BIT_SZ1))
117 #define _PAGE_TYPE_NONE (0 << _PAGE_BIT_SZ0)
118 #define _PAGE_TYPE_SMALL (1 << _PAGE_BIT_SZ0)
119 #define _PAGE_TYPE_MEDIUM (2 << _PAGE_BIT_SZ0)
120 #define _PAGE_TYPE_LARGE (3 << _PAGE_BIT_SZ0)
128 #define _PAGE_FLAGS_HARDWARE_MASK 0xfffff3ff
130 #define _PAGE_FLAGS_CACHE_MASK (_PAGE_CACHABLE | _PAGE_BUFFER | _PAGE_WT)
133 #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY \
134 | _PAGE_FLAGS_CACHE_MASK)
136 #define _PAGE_FLAGS_READ (_PAGE_CACHABLE | _PAGE_BUFFER)
137 #define _PAGE_FLAGS_WRITE (_PAGE_FLAGS_READ | _PAGE_RW | _PAGE_DIRTY)
139 #define _PAGE_NORMAL(x) __pgprot((x) | _PAGE_PRESENT | _PAGE_TYPE_SMALL \
142 #define PAGE_NONE (_PAGE_ACCESSED | _PAGE_TYPE_NONE)
143 #define PAGE_READ (_PAGE_FLAGS_READ | _PAGE_USER)
144 #define PAGE_EXEC (_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_USER)
145 #define PAGE_WRITE (_PAGE_FLAGS_WRITE | _PAGE_USER)
146 #define PAGE_KERNEL _PAGE_NORMAL(_PAGE_FLAGS_WRITE | _PAGE_EXECUTE | _PAGE_GLOBAL)
147 #define PAGE_KERNEL_RO _PAGE_NORMAL(_PAGE_FLAGS_READ | _PAGE_EXECUTE | _PAGE_GLOBAL)
149 #define _PAGE_P(x) _PAGE_NORMAL((x) & ~(_PAGE_RW | _PAGE_DIRTY))
150 #define _PAGE_S(x) _PAGE_NORMAL(x)
152 #define PAGE_COPY _PAGE_P(PAGE_WRITE | PAGE_READ)
153 #define PAGE_SHARED _PAGE_S(PAGE_WRITE | PAGE_READ)
166 #define __P000 __pgprot(PAGE_NONE)
167 #define __P001 _PAGE_P(PAGE_READ)
168 #define __P010 _PAGE_P(PAGE_WRITE)
169 #define __P011 _PAGE_P(PAGE_WRITE | PAGE_READ)
170 #define __P100 _PAGE_P(PAGE_EXEC)
171 #define __P101 _PAGE_P(PAGE_EXEC | PAGE_READ)
172 #define __P110 _PAGE_P(PAGE_EXEC | PAGE_WRITE)
173 #define __P111 _PAGE_P(PAGE_EXEC | PAGE_WRITE | PAGE_READ)
175 #define __S000 __pgprot(PAGE_NONE)
176 #define __S001 _PAGE_S(PAGE_READ)
177 #define __S010 _PAGE_S(PAGE_WRITE)
178 #define __S011 _PAGE_S(PAGE_WRITE | PAGE_READ)
179 #define __S100 _PAGE_S(PAGE_EXEC)
180 #define __S101 _PAGE_S(PAGE_EXEC | PAGE_READ)
181 #define __S110 _PAGE_S(PAGE_EXEC | PAGE_WRITE)
182 #define __S111 _PAGE_S(PAGE_EXEC | PAGE_WRITE | PAGE_READ)
184 #define pte_none(x) (!pte_val(x))
185 #define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
187 #define pte_clear(mm,addr,xp) \
189 set_pte_at(mm, addr, xp, __pte(0)); \
257 #define pmd_none(x) (!pmd_val(x))
258 #define pmd_present(x) (pmd_val(x))
265 #define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
271 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
272 #define pte_page(x) (pfn_to_page(pte_pfn(x)))
277 #define pgprot_noncached(prot) \
278 __pgprot(pgprot_val(prot) & ~(_PAGE_BUFFER | _PAGE_CACHABLE))
283 #define pgprot_writecombine(prot) \
284 __pgprot((pgprot_val(prot) & ~_PAGE_CACHABLE) | _PAGE_BUFFER)
292 #define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
301 #define page_pte(page) page_pte_prot(page, __pgprot(0))
303 #define pmd_page_vaddr(pmd) pmd_val(pmd)
304 #define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
307 #define pgd_index(address) (((address) >> PGDIR_SHIFT) \
308 & (PTRS_PER_PGD - 1))
309 #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
312 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
315 #define pte_index(address) \
316 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
317 #define pte_offset(dir, address) \
318 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
319 #define pte_offset_kernel(dir, address) \
320 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
321 #define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
322 #define pte_unmap(pte) do { } while (0)
343 #define __swp_type(x) (((x).val >> 4) & 0x3f)
344 #define __swp_offset(x) ((x).val >> 11)
345 #define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
346 #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
347 #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
354 #define PTE_FILE_MAX_BITS 30
355 #define pte_to_pgoff(pte) (((pte_val(pte) >> 1) & 0x1ff) \
356 | ((pte_val(pte) >> 11) << 9))
357 #define pgoff_to_pte(off) ((pte_t) { ((((off) & 0x1ff) << 1) \
358 | (((off) >> 9) << 11) \
363 #define kern_addr_valid(addr) (1)
365 #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
366 remap_pfn_range(vma, vaddr, pfn, size, prot)
369 #define pgtable_cache_init() do { } while(0)