| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
#ifndef __VIRT_CONVERT__ |
| 3 |
#define __VIRT_CONVERT__ |
| 4 |
|
| 5 |
/* |
| 6 |
* Macros used for converting between virtual and physical mappings. |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifdef __KERNEL__ |
| 10 |
|
| 11 |
#include <linux/compiler.h> |
| 12 |
#include <linux/mmzone.h> |
| 13 |
#include <asm/setup.h> |
| 14 |
#include <asm/page.h> |
| 15 |
|
| 16 |
/* |
| 17 |
* Change virtual addresses to physical addresses and vv. |
| 18 |
*/ |
| 19 |
#define virt_to_phys virt_to_phys |
| 20 |
static inline unsigned long virt_to_phys(void *address) |
| 21 |
{ |
| 22 |
return __pa(address); |
| 23 |
} |
| 24 |
|
| 25 |
#define phys_to_virt phys_to_virt |
| 26 |
static inline void *phys_to_virt(unsigned long address) |
| 27 |
{ |
| 28 |
return __va(address); |
| 29 |
} |
| 30 |
|
| 31 |
/* |
| 32 |
* IO bus memory addresses are 1:1 with the physical address, |
| 33 |
* deprecated globally but still used on two machines. |
| 34 |
*/ |
| 35 |
#if defined(CONFIG_AMIGA) || defined(CONFIG_VME) |
| 36 |
#define virt_to_bus virt_to_phys |
| 37 |
#endif |
| 38 |
|
| 39 |
#endif |
| 40 |
#endif |