diff options
Diffstat (limited to 'arch/powerpc/include/asm/page.h')
-rw-r--r-- | arch/powerpc/include/asm/page.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index e96d52a516ba..53b64be40eb2 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h | |||
@@ -108,8 +108,21 @@ extern phys_addr_t kernstart_addr; | |||
108 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) | 108 | #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) |
109 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 109 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
110 | 110 | ||
111 | #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - MEMORY_START)) | 111 | /* |
112 | * On Book-E parts we need __va to parse the device tree and we can't | ||
113 | * determine MEMORY_START until then. However we can determine PHYSICAL_START | ||
114 | * from information at hand (program counter, TLB lookup). | ||
115 | * | ||
116 | * On non-Book-E PPC64 PAGE_OFFSET and MEMORY_START are constants so use | ||
117 | * the other definitions for __va & __pa. | ||
118 | */ | ||
119 | #ifdef CONFIG_BOOKE | ||
120 | #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) - PHYSICAL_START + KERNELBASE)) | ||
121 | #define __pa(x) ((unsigned long)(x) + PHYSICAL_START - KERNELBASE) | ||
122 | #else | ||
123 | #define __va(x) ((void *)(unsigned long)((phys_addr_t)(x) + PAGE_OFFSET - MEMORY_START)) | ||
112 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START) | 124 | #define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START) |
125 | #endif | ||
113 | 126 | ||
114 | /* | 127 | /* |
115 | * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI, | 128 | * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI, |