diff options
Diffstat (limited to 'include/asm-m68k/page.h')
-rw-r--r-- | include/asm-m68k/page.h | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h index 7650b99dcae6..9e6d0d6debdb 100644 --- a/include/asm-m68k/page.h +++ b/include/asm-m68k/page.h | |||
@@ -121,7 +121,6 @@ extern unsigned long m68k_memoffset; | |||
121 | #ifndef CONFIG_SUN3 | 121 | #ifndef CONFIG_SUN3 |
122 | 122 | ||
123 | #define WANT_PAGE_VIRTUAL | 123 | #define WANT_PAGE_VIRTUAL |
124 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
125 | 124 | ||
126 | static inline unsigned long ___pa(void *vaddr) | 125 | static inline unsigned long ___pa(void *vaddr) |
127 | { | 126 | { |
@@ -133,7 +132,7 @@ static inline unsigned long ___pa(void *vaddr) | |||
133 | : "0" (vaddr), "i" (m68k_fixup_memoffset)); | 132 | : "0" (vaddr), "i" (m68k_fixup_memoffset)); |
134 | return paddr; | 133 | return paddr; |
135 | } | 134 | } |
136 | #define __pa(vaddr) ___pa((void *)(vaddr)) | 135 | #define __pa(vaddr) ___pa((void *)(vaddr)) |
137 | static inline void *__va(unsigned long paddr) | 136 | static inline void *__va(unsigned long paddr) |
138 | { | 137 | { |
139 | void *vaddr; | 138 | void *vaddr; |
@@ -145,11 +144,6 @@ static inline void *__va(unsigned long paddr) | |||
145 | return vaddr; | 144 | return vaddr; |
146 | } | 145 | } |
147 | 146 | ||
148 | #else | ||
149 | #define __pa(vaddr) virt_to_phys((void *)(vaddr)) | ||
150 | #define __va(paddr) phys_to_virt((unsigned long)(paddr)) | ||
151 | #endif | ||
152 | |||
153 | #else /* !CONFIG_SUN3 */ | 147 | #else /* !CONFIG_SUN3 */ |
154 | /* This #define is a horrible hack to suppress lots of warnings. --m */ | 148 | /* This #define is a horrible hack to suppress lots of warnings. --m */ |
155 | #define __pa(x) ___pa((unsigned long)(x)) | 149 | #define __pa(x) ___pa((unsigned long)(x)) |
@@ -184,11 +178,47 @@ static inline void *__va(unsigned long x) | |||
184 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) | 178 | #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) |
185 | #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) | 179 | #define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) |
186 | 180 | ||
187 | #define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT)) | 181 | extern int m68k_virt_to_node_shift; |
188 | #define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) | 182 | |
183 | #ifdef CONFIG_SINGLE_MEMORY_CHUNK | ||
184 | #define __virt_to_node(addr) (&pg_data_map[0]) | ||
185 | #else | ||
186 | extern struct pglist_data *pg_data_table[]; | ||
187 | |||
188 | static inline __attribute_const__ int __virt_to_node_shift(void) | ||
189 | { | ||
190 | int shift; | ||
191 | |||
192 | asm ( | ||
193 | "1: moveq #0,%0\n" | ||
194 | m68k_fixup(%c1, 1b) | ||
195 | : "=d" (shift) | ||
196 | : "i" (m68k_fixup_vnode_shift)); | ||
197 | return shift; | ||
198 | } | ||
199 | |||
200 | #define __virt_to_node(addr) (pg_data_table[(unsigned long)(addr) >> __virt_to_node_shift()]) | ||
201 | #endif | ||
189 | 202 | ||
190 | #define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) | 203 | #define virt_to_page(addr) ({ \ |
191 | #define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) | 204 | pfn_to_page(virt_to_pfn(addr)); \ |
205 | }) | ||
206 | #define page_to_virt(page) ({ \ | ||
207 | pfn_to_virt(page_to_pfn(page)); \ | ||
208 | }) | ||
209 | |||
210 | #define pfn_to_page(pfn) ({ \ | ||
211 | unsigned long __pfn = (pfn); \ | ||
212 | struct pglist_data *pgdat; \ | ||
213 | pgdat = __virt_to_node((unsigned long)pfn_to_virt(__pfn)); \ | ||
214 | pgdat->node_mem_map + (__pfn - pgdat->node_start_pfn); \ | ||
215 | }) | ||
216 | #define page_to_pfn(_page) ({ \ | ||
217 | struct page *__p = (_page); \ | ||
218 | struct pglist_data *pgdat; \ | ||
219 | pgdat = &pg_data_map[page_to_nid(__p)]; \ | ||
220 | ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \ | ||
221 | }) | ||
192 | 222 | ||
193 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory) | 223 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory) |
194 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) | 224 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) |