]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blame - arch/m68k/include/asm/virtconvert.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-kernels.git] / arch / m68k / include / asm / virtconvert.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
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
1da177e4 11#include <linux/compiler.h>
12d810c1 12#include <linux/mmzone.h>
1da177e4
LT
13#include <asm/setup.h>
14#include <asm/page.h>
15
1da177e4
LT
16/*
17 * Change virtual addresses to physical addresses and vv.
18 */
1da177e4
LT
19static inline unsigned long virt_to_phys(void *address)
20{
12d810c1 21 return __pa(address);
1da177e4
LT
22}
23
24static inline void *phys_to_virt(unsigned long address)
25{
12d810c1 26 return __va(address);
1da177e4 27}
1da177e4
LT
28
29/* Permanent address of a page. */
817f72d6 30#if defined(CONFIG_MMU) && defined(CONFIG_SINGLE_MEMORY_CHUNK)
12d810c1
RZ
31#define page_to_phys(page) \
32 __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
33#else
f54bcdc2 34#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
12d810c1 35#endif
1da177e4
LT
36
37/*
38 * IO bus memory addresses are 1:1 with the physical address,
1da177e4 39 */
1da177e4
LT
40#define virt_to_bus virt_to_phys
41#define bus_to_virt phys_to_virt
1da177e4
LT
42
43#endif
44#endif