Linux v2.6.15-rc6
[pohmelfs.git] / include / asm-frv / virtconvert.h
bloba29a0aec291ff3ecef9fae50c7b0b64be048ac93
1 /* virtconvert.h: virtual/physical/page address convertion
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
11 #ifndef _ASM_VIRTCONVERT_H
12 #define _ASM_VIRTCONVERT_H
15 * Macros used for converting between virtual and physical mappings.
18 #ifdef __KERNEL__
20 #include <linux/config.h>
21 #include <asm/setup.h>
23 #ifdef CONFIG_MMU
25 #define phys_to_virt(vaddr) ((void *) ((unsigned long)(vaddr) + PAGE_OFFSET))
26 #define virt_to_phys(vaddr) ((unsigned long) (vaddr) - PAGE_OFFSET)
28 #else
30 #define phys_to_virt(vaddr) ((void *) (vaddr))
31 #define virt_to_phys(vaddr) ((unsigned long) (vaddr))
33 #endif
35 #define virt_to_bus virt_to_phys
36 #define bus_to_virt phys_to_virt
38 #define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
39 #define page_to_phys(page) virt_to_phys((void *)__page_address(page))
41 #endif
42 #endif