Go to the documentation of this file. 1 #ifndef _ASM_POWERPC_PAGE_H
2 #define _ASM_POWERPC_PAGE_H
14 #include <linux/types.h>
16 #include <asm/types.h>
18 #include <asm/asm-compat.h>
27 #if defined(CONFIG_PPC_256K_PAGES)
29 #elif defined(CONFIG_PPC_64K_PAGES)
31 #elif defined(CONFIG_PPC_16K_PAGES)
37 #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
40 #ifdef CONFIG_HUGETLB_PAGE
43 #define HPAGE_SHIFT PAGE_SHIFT
45 #define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
46 #define HPAGE_MASK (~(HPAGE_SIZE - 1))
47 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
48 #define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1)
52 #define __HAVE_ARCH_GATE_AREA 1
59 #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
91 #define KERNELBASE ASM_CONST(CONFIG_KERNEL_START)
92 #define PAGE_OFFSET ASM_CONST(CONFIG_PAGE_OFFSET)
93 #define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_PHYSICAL_START))
95 #if defined(CONFIG_NONSTATIC_KERNEL)
101 #ifdef CONFIG_RELOCATABLE_PPC32
102 extern long long virt_phys_offset;
106 #define PHYSICAL_START kernstart_addr
109 #define PHYSICAL_START ASM_CONST(CONFIG_PHYSICAL_START)
113 #ifdef CONFIG_RELOCATABLE_PPC32
114 #define VIRT_PHYS_OFFSET virt_phys_offset
116 #define VIRT_PHYS_OFFSET (KERNELBASE - PHYSICAL_START)
121 #define MEMORY_START 0UL
122 #elif defined(CONFIG_NONSTATIC_KERNEL)
123 #define MEMORY_START memstart_addr
125 #define MEMORY_START (PHYSICAL_START + PAGE_OFFSET - KERNELBASE)
128 #ifdef CONFIG_FLATMEM
129 #define ARCH_PFN_OFFSET ((unsigned long)(MEMORY_START >> PAGE_SHIFT))
130 #define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)
133 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
134 #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
135 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
211 #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + VIRT_PHYS_OFFSET))
212 #define __pa(x) ((unsigned long)(x) - VIRT_PHYS_OFFSET)
214 #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + PAGE_OFFSET - MEMORY_START))
215 #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START)
223 #define VM_DATA_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \
224 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
226 #define VM_DATA_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \
227 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
230 #include <asm/page_64.h>
232 #include <asm/page_32.h>
236 #define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
237 #define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1)))
240 #define _ALIGN(addr,size) _ALIGN_UP(addr,size)
246 #ifdef CONFIG_PPC_BOOK3E_64
247 #define is_kernel_addr(x) ((x) >= 0x8000000000000000ul)
249 #define is_kernel_addr(x) ((x) >= PAGE_OFFSET)
259 #define PD_HUGE 0x8000000000000000
261 #define PD_HUGE 0x80000000
268 #define HUGEPD_SHIFT_MASK 0x3f
272 #undef STRICT_MM_TYPECHECKS
274 #ifdef STRICT_MM_TYPECHECKS
279 #define pte_val(x) ((x).pte)
280 #define __pte(x) ((pte_t) { (x) })
285 #if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_PPC_STD_MMU_64)
293 typedef struct {
unsigned long pmd; }
pmd_t;
294 #define pmd_val(x) ((x).pmd)
295 #define __pmd(x) ((pmd_t) { (x) })
298 #ifndef CONFIG_PPC_64K_PAGES
299 typedef struct {
unsigned long pud; }
pud_t;
300 #define pud_val(x) ((x).pud)
301 #define __pud(x) ((pud_t) { (x) })
306 typedef struct {
unsigned long pgd; }
pgd_t;
307 #define pgd_val(x) ((x).pgd)
308 #define __pgd(x) ((pgd_t) { (x) })
312 #define pgprot_val(x) ((x).pgprot)
313 #define __pgprot(x) ((pgprot_t) { (x) })
322 #define pte_val(x) (x)
325 #if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_PPC_STD_MMU_64)
333 typedef unsigned long pmd_t;
334 #define pmd_val(x) (x)
337 #ifndef CONFIG_PPC_64K_PAGES
338 typedef unsigned long pud_t;
339 #define pud_val(x) (x)
345 #define pgd_val(x) (x)
346 #define pgprot_val(x) (x)
350 #define __pgprot(x) (x)
356 #ifdef CONFIG_HUGETLB_PAGE
357 static inline int hugepd_ok(
hugepd_t hpd)
362 #define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep))))
364 #define is_hugepd(pdep) 0
374 #ifdef CONFIG_PPC_SMLPAR
376 #define HAVE_ARCH_FREE_PAGE