1 #ifndef __VIRT_CONVERT__
2 #define __VIRT_CONVERT__
5 * Macros used for converting between virtual and physical mappings.
10 #include <linux/config.h>
11 #include <linux/compiler.h>
12 #include <asm/setup.h>
16 #include <asm/amigahw.h>
20 * Change virtual addresses to physical addresses and vv.
23 extern unsigned long mm_vtop(unsigned long addr
) __attribute_const__
;
24 extern unsigned long mm_ptov(unsigned long addr
) __attribute_const__
;
26 static inline unsigned long mm_vtop(unsigned long vaddr
)
31 static inline unsigned long mm_ptov(unsigned long paddr
)
33 return (unsigned long)__va(paddr
);
37 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
38 static inline unsigned long virt_to_phys(void *vaddr
)
40 return (unsigned long)vaddr
- PAGE_OFFSET
+ m68k_memory
[0].addr
;
43 static inline void * phys_to_virt(unsigned long paddr
)
45 return (void *)(paddr
- m68k_memory
[0].addr
+ PAGE_OFFSET
);
48 static inline unsigned long virt_to_phys(void *address
)
50 return mm_vtop((unsigned long)address
);
53 static inline void *phys_to_virt(unsigned long address
)
55 return (void *) mm_ptov(address
);
59 /* Permanent address of a page. */
60 #define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
61 #define page_to_phys(page) virt_to_phys((void *)__page_address(page))
64 * IO bus memory addresses are 1:1 with the physical address,
65 * except on the PCI bus of the Hades.
68 #define virt_to_bus(a) (virt_to_phys(a) + (MACH_IS_HADES ? 0x80000000 : 0))
69 #define bus_to_virt(a) (phys_to_virt((a) - (MACH_IS_HADES ? 0x80000000 : 0)))
71 #define virt_to_bus virt_to_phys
72 #define bus_to_virt phys_to_virt