summaryrefslogtreecommitdiff
path: root/arch/sh/include/asm/page.h
diff options
context:
space:
mode:
authorMatt Fleming <matt@console-pimps.org>2010-04-24 14:12:12 +0400
committerMatt Fleming <matt@console-pimps.org>2010-04-25 23:44:22 +0400
commit7c4584d39a8a144c60adaf4cf998c3233b6683d9 (patch)
treecae1bdc6dd8e29633399a850e19c1b853dd0a43d /arch/sh/include/asm/page.h
parent4a6feab0ee5240c4bd5378d9f8a46b85718c68a7 (diff)
downloadlinux-7c4584d39a8a144c60adaf4cf998c3233b6683d9.tar.xz
sh: Assembly friendly __pa and __va definitions
This patch defines ___pa and ___va which return the physical and virtual address of an address, respectively. These macros are suitable for calling from assembly because they don't include the C casts required by __pa and __va. Signed-off-by: Matt Fleming <matt@console-pimps.org>
Diffstat (limited to 'arch/sh/include/asm/page.h')
-rw-r--r--arch/sh/include/asm/page.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index d71feb359304..0152c040f6c3 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -128,13 +128,18 @@ typedef struct page *pgtable_t;
* added or subtracted as required.
*/
#ifdef CONFIG_PMB
-#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START)
-#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START))
+#define ___pa(x) ((x)-PAGE_OFFSET+__MEMORY_START)
+#define ___va(x) ((x)+PAGE_OFFSET-__MEMORY_START)
#else
-#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
-#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
+#define ___pa(x) ((x)-PAGE_OFFSET)
+#define ___va(x) ((x)+PAGE_OFFSET)
#endif
+#ifndef __ASSEMBLY__
+#define __pa(x) ___pa((unsigned long)x)
+#define __va(x) (void *)___va((unsigned long)x)
+#endif /* !__ASSEMBLY__ */
+
#ifdef CONFIG_UNCACHED_MAPPING
#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + uncached_start)
#define CAC_ADDR(addr) ((addr) - uncached_start + PAGE_OFFSET)