xref: /linux/arch/m68k/include/asm/virtconvert.h (revision a2cce7a9f1b8cc3d4edce106fb971529f1d4d9ce)
1 #ifndef __VIRT_CONVERT__
2 #define __VIRT_CONVERT__
3 
4 /*
5  * Macros used for converting between virtual and physical mappings.
6  */
7 
8 #ifdef __KERNEL__
9 
10 #include <linux/compiler.h>
11 #include <linux/mmzone.h>
12 #include <asm/setup.h>
13 #include <asm/page.h>
14 
15 /*
16  * Change virtual addresses to physical addresses and vv.
17  */
18 static inline unsigned long virt_to_phys(void *address)
19 {
20 	return __pa(address);
21 }
22 
23 static inline void *phys_to_virt(unsigned long address)
24 {
25 	return __va(address);
26 }
27 
28 /* Permanent address of a page. */
29 #if defined(CONFIG_MMU) && defined(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)	(page_to_pfn(page) << PAGE_SHIFT)
34 #endif
35 
36 /*
37  * IO bus memory addresses are 1:1 with the physical address,
38  */
39 #define virt_to_bus virt_to_phys
40 #define bus_to_virt phys_to_virt
41 
42 #endif
43 #endif
44