Go to the documentation of this file.
15 #ifndef _ASM_MICROBLAZE_PAGE_H
16 #define _ASM_MICROBLAZE_PAGE_H
19 #include <asm/setup.h>
20 #include <asm/asm-compat.h>
21 #include <linux/const.h>
26 #if defined(CONFIG_MICROBLAZE_64K_PAGES)
28 #elif defined(CONFIG_MICROBLAZE_16K_PAGES)
33 #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
34 #define PAGE_MASK (~(PAGE_SIZE-1))
36 #define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))
38 #define PTE_SHIFT (PAGE_SHIFT - 2)
43 #define ARCH_DMA_MINALIGN L1_CACHE_BYTES
45 #define ARCH_SLAB_MINALIGN L1_CACHE_BYTES
47 #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))
48 #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1)))
57 #define PAGE_OFFSET __page_offset
68 #define PAGE_OFFSET CONFIG_KERNEL_START
74 #define PTE_FMT "%.8lx"
78 # define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
79 # define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE)
81 # define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE)
82 # define copy_user_page(vto, vfrom, vaddr, topg) \
83 memcpy((vto), (vfrom), PAGE_SIZE)
89 typedef struct {
unsigned long pte; }
pte_t;
93 typedef struct {
unsigned long pmd; }
pmd_t;
94 typedef struct {
unsigned long pgd; }
pgd_t;
96 typedef struct {
unsigned long ste[64]; }
pmd_t;
101 # define pte_val(x) ((x).pte)
102 # define pgprot_val(x) ((x).pgprot)
105 # define pmd_val(x) ((x).pmd)
106 # define pgd_val(x) ((x).pgd)
108 # define pmd_val(x) ((x).ste[0])
109 # define pud_val(x) ((x).pue[0])
110 # define pgd_val(x) ((x).pge[0])
113 # define __pte(x) ((pte_t) { (x) })
114 # define __pmd(x) ((pmd_t) { (x) })
115 # define __pgd(x) ((pgd_t) { (x) })
116 # define __pgprot(x) ((pgprot_t) { (x) })
144 # define phys_to_pfn(phys) (PFN_DOWN(phys))
145 # define pfn_to_phys(pfn) (PFN_PHYS(pfn))
147 # define virt_to_pfn(vaddr) (phys_to_pfn((__pa(vaddr))))
148 # define pfn_to_virt(pfn) __va(pfn_to_phys((pfn)))
152 # define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
153 # define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT)
154 # define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
157 # define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr)))
158 # define page_to_virt(page) (pfn_to_virt(page_to_pfn(page)))
159 # define page_to_phys(page) (pfn_to_phys(page_to_pfn(page)))
160 # define page_to_bus(page) (page_to_phys(page))
161 # define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr)))
165 # define pfn_valid(pfn) (((pfn) >= min_low_pfn) && \
166 ((pfn) <= (min_low_pfn + max_mapnr)))
167 # define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
169 # define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT)
170 # define pfn_valid(pfn) ((pfn) < (max_mapnr + ARCH_PFN_OFFSET))
171 # define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
176 #define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr)))
178 # define __pa(x) __virt_to_phys((unsigned long)(x))
179 # define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
184 #define __virt_to_phys(addr) addr
185 #define __phys_to_virt(addr) addr
186 #define tophys(rd, rs) addik rd, rs, 0
187 #define tovirt(rd, rs) addik rd, rs, 0
189 #define __virt_to_phys(addr) \
190 ((addr) + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START)
191 #define __phys_to_virt(addr) \
192 ((addr) + CONFIG_KERNEL_START - CONFIG_KERNEL_BASE_ADDR)
193 #define tophys(rd, rs) \
194 addik rd, rs, (CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START)
195 #define tovirt(rd, rs) \
196 addik rd, rs, (CONFIG_KERNEL_START - CONFIG_KERNEL_BASE_ADDR)
199 #define TOPHYS(addr) __virt_to_phys(addr)
203 #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
204 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)