docbook: fix fusion source files
[linux-2.6/zen-sources.git] / include / asm-m68k / virtconvert.h
blobdea32fbc7e51c1c5bc995a1aa69ab57f6b1cf6f5
1 #ifndef __VIRT_CONVERT__
2 #define __VIRT_CONVERT__
4 /*
5 * Macros used for converting between virtual and physical mappings.
6 */
8 #ifdef __KERNEL__
10 #include <linux/compiler.h>
11 #include <linux/mmzone.h>
12 #include <asm/setup.h>
13 #include <asm/page.h>
16 * Change virtual addresses to physical addresses and vv.
18 static inline unsigned long virt_to_phys(void *address)
20 return __pa(address);
23 static inline void *phys_to_virt(unsigned long address)
25 return __va(address);
28 /* Permanent address of a page. */
29 #ifdef CONFIG_SINGLE_MEMORY_CHUNK
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; \
39 #endif
42 * IO bus memory addresses are 1:1 with the physical address,
43 * except on the PCI bus of the Hades.
45 #ifdef CONFIG_HADES
46 #define virt_to_bus(a) (virt_to_phys(a) + (MACH_IS_HADES ? 0x80000000 : 0))
47 #define bus_to_virt(a) (phys_to_virt((a) - (MACH_IS_HADES ? 0x80000000 : 0)))
48 #else
49 #define virt_to_bus virt_to_phys
50 #define bus_to_virt phys_to_virt
51 #endif
53 #endif
54 #endif