aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m68k/virtconvert.h
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2007-05-31 03:40:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-31 10:58:14 -0400
commit12d810c1b8c2b913d48e629e2b5c01d105029839 (patch)
treeb39162d3168f6173af3d0e5790e16eb45a70dfaf /include/asm-m68k/virtconvert.h
parent00c541eae7a477e3d1adb1ebf27cccc0bdb5f824 (diff)
m68k: discontinuous memory support
Fix support for discontinuous memory Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-m68k/virtconvert.h')
-rw-r--r--include/asm-m68k/virtconvert.h49
1 files changed, 14 insertions, 35 deletions
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
index 83a87c9b1a16..dea32fbc7e51 100644
--- a/include/asm-m68k/virtconvert.h
+++ b/include/asm-m68k/virtconvert.h
@@ -8,56 +8,35 @@
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9 9
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/mmzone.h>
11#include <asm/setup.h> 12#include <asm/setup.h>
12#include <asm/page.h> 13#include <asm/page.h>
13 14
14#ifdef CONFIG_AMIGA
15#include <asm/amigahw.h>
16#endif
17
18/* 15/*
19 * Change virtual addresses to physical addresses and vv. 16 * Change virtual addresses to physical addresses and vv.
20 */ 17 */
21#ifndef CONFIG_SUN3
22extern unsigned long mm_vtop(unsigned long addr) __attribute_const__;
23extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
24#else
25static inline unsigned long mm_vtop(unsigned long vaddr)
26{
27 return __pa(vaddr);
28}
29
30static inline unsigned long mm_ptov(unsigned long paddr)
31{
32 return (unsigned long)__va(paddr);
33}
34#endif
35
36#ifdef CONFIG_SINGLE_MEMORY_CHUNK
37static inline unsigned long virt_to_phys(void *vaddr)
38{
39 return (unsigned long)vaddr - PAGE_OFFSET + m68k_memory[0].addr;
40}
41
42static inline void * phys_to_virt(unsigned long paddr)
43{
44 return (void *)(paddr - m68k_memory[0].addr + PAGE_OFFSET);
45}
46#else
47static inline unsigned long virt_to_phys(void *address) 18static inline unsigned long virt_to_phys(void *address)
48{ 19{
49 return mm_vtop((unsigned long)address); 20 return __pa(address);
50} 21}
51 22
52static inline void *phys_to_virt(unsigned long address) 23static inline void *phys_to_virt(unsigned long address)
53{ 24{
54 return (void *) mm_ptov(address); 25 return __va(address);
55} 26}
56#endif
57 27
58/* Permanent address of a page. */ 28/* Permanent address of a page. */
59#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) 29#ifdef CONFIG_SINGLE_MEMORY_CHUNK
60#define page_to_phys(page) virt_to_phys((void *)__page_address(page)) 30#define page_to_phys(page) \
31 __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
32#else
33#define page_to_phys(_page) ({ \
34 struct page *__page = _page; \
35 struct pglist_data *pgdat; \
36 pgdat = pg_data_table[page_to_nid(__page)]; \
37 page_to_pfn(__page) << PAGE_SHIFT; \
38})
39#endif
61 40
62/* 41/*
63 * IO bus memory addresses are 1:1 with the physical address, 42 * IO bus memory addresses are 1:1 with the physical address,