diff options
Diffstat (limited to 'include/asm-powerpc/page.h')
-rw-r--r-- | include/asm-powerpc/page.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h index 18c1e5ee81a3..76d7cb4b4ffc 100644 --- a/include/asm-powerpc/page.h +++ b/include/asm-powerpc/page.h | |||
@@ -37,8 +37,30 @@ | |||
37 | */ | 37 | */ |
38 | #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) | 38 | #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) |
39 | 39 | ||
40 | /* | ||
41 | * KERNELBASE is the virtual address of the start of the kernel, it's often | ||
42 | * the same as PAGE_OFFSET, but _might not be_. | ||
43 | * | ||
44 | * The kdump dump kernel is one example where KERNELBASE != PAGE_OFFSET. | ||
45 | * | ||
46 | * To get a physical address from a virtual one you subtract PAGE_OFFSET, | ||
47 | * _not_ KERNELBASE. | ||
48 | * | ||
49 | * If you want to know something's offset from the start of the kernel you | ||
50 | * should subtract KERNELBASE. | ||
51 | * | ||
52 | * If you want to test if something's a kernel address, use is_kernel_addr(). | ||
53 | */ | ||
54 | |||
55 | #ifdef CONFIG_CRASH_DUMP | ||
56 | /* Kdump kernel runs at 32 MB, change at your peril. */ | ||
57 | #define PHYSICAL_START 0x2000000 | ||
58 | #else | ||
59 | #define PHYSICAL_START 0x0 | ||
60 | #endif | ||
61 | |||
40 | #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) | 62 | #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) |
41 | #define KERNELBASE PAGE_OFFSET | 63 | #define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) |
42 | 64 | ||
43 | #ifdef CONFIG_DISCONTIGMEM | 65 | #ifdef CONFIG_DISCONTIGMEM |
44 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) | 66 | #define page_to_pfn(page) discontigmem_page_to_pfn(page) |
@@ -56,7 +78,7 @@ | |||
56 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 78 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
57 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 79 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
58 | 80 | ||
59 | #define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) | 81 | #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) |
60 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) | 82 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) |
61 | 83 | ||
62 | /* | 84 | /* |
@@ -86,6 +108,12 @@ | |||
86 | /* to align the pointer to the (next) page boundary */ | 108 | /* to align the pointer to the (next) page boundary */ |
87 | #define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) | 109 | #define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) |
88 | 110 | ||
111 | /* | ||
112 | * Don't compare things with KERNELBASE or PAGE_OFFSET to test for | ||
113 | * "kernelness", use is_kernel_addr() - it should do what you want. | ||
114 | */ | ||
115 | #define is_kernel_addr(x) ((x) >= PAGE_OFFSET) | ||
116 | |||
89 | #ifndef __ASSEMBLY__ | 117 | #ifndef __ASSEMBLY__ |
90 | 118 | ||
91 | #undef STRICT_MM_TYPECHECKS | 119 | #undef STRICT_MM_TYPECHECKS |