aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-01-30 07:32:43 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:32:43 -0500
commit98fd5aee348f0420afd1c636790d50aaaec6ceec (patch)
treec2e0e421ce7cfb809b643a6934e19f82e2c1ceae /include
parent6724a1d2fc6b40d55f232b8dacc12a915878bdc7 (diff)
x86: page.h: move pa and va related things
# HG changeset patch # User Jeremy Fitzhardinge <jeremy@xensource.com> # Date 1199319656 28800 # Node ID d617b72a0cc9d14bde2087d065c36d4ed3265761 # Parent 3bd7db6e85e66e7f3362874802df26a82fcb2d92 x86: page.h: move pa and va related things Move and unify the virtual<->physical address space conversion functions. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/asm-x86/page.h24
-rw-r--r--include/asm-x86/page_32.h13
-rw-r--r--include/asm-x86/page_64.h13
3 files changed, 25 insertions, 25 deletions
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index ef393c3df902..9830eeb57173 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -80,6 +80,9 @@
80void clear_page(void *page); 80void clear_page(void *page);
81void copy_page(void *to, void *from); 81void copy_page(void *to, void *from);
82 82
83extern unsigned long __phys_addr(unsigned long);
84#define __phys_reloc_hide(x) (x)
85
83/* 86/*
84 * These are used to make use of C type-checking.. 87 * These are used to make use of C type-checking..
85 */ 88 */
@@ -174,6 +177,13 @@ static inline pte_t native_make_pte(unsigned long val)
174#endif 177#endif
175 178
176#ifndef __ASSEMBLY__ 179#ifndef __ASSEMBLY__
180#define __phys_addr(x) ((x)-PAGE_OFFSET)
181#define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
182
183#ifdef CONFIG_FLATMEM
184#define pfn_valid(pfn) ((pfn) < max_mapnr)
185#endif /* CONFIG_FLATMEM */
186
177#ifdef CONFIG_X86_USE_3DNOW 187#ifdef CONFIG_X86_USE_3DNOW
178#include <asm/mmx.h> 188#include <asm/mmx.h>
179 189
@@ -299,6 +309,20 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
299 309
300#endif /* CONFIG_PARAVIRT */ 310#endif /* CONFIG_PARAVIRT */
301 311
312#define __pa(x) __phys_addr((unsigned long)(x))
313/* __pa_symbol should be used for C visible symbols.
314 This seems to be the official gcc blessed way to do such arithmetic. */
315#define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x)))
316
317#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
318
319#define __boot_va(x) __va(x)
320#define __boot_pa(x) __pa(x)
321
322#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
323#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
324#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
325
302#endif /* __ASSEMBLY__ */ 326#endif /* __ASSEMBLY__ */
303 327
304 328
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h
index 2d60661ab340..a27424a2ee0d 100644
--- a/include/asm-x86/page_32.h
+++ b/include/asm-x86/page_32.h
@@ -29,18 +29,7 @@ extern int page_is_ram(unsigned long pagenr);
29 29
30#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) 30#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
31#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) 31#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
32#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 32
33/* __pa_symbol should be used for C visible symbols.
34 This seems to be the official gcc blessed way to do such arithmetic. */
35#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
36#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
37#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
38#ifdef CONFIG_FLATMEM
39#define pfn_valid(pfn) ((pfn) < max_mapnr)
40#endif /* CONFIG_FLATMEM */
41#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
42
43#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
44 33
45#include <asm-generic/memory_model.h> 34#include <asm-generic/memory_model.h>
46#include <asm-generic/page.h> 35#include <asm-generic/page.h>
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h
index f8a07bf54c3c..7094684270a6 100644
--- a/include/asm-x86/page_64.h
+++ b/include/asm-x86/page_64.h
@@ -16,21 +16,8 @@ extern unsigned long phys_base;
16 16
17#include <asm/bug.h> 17#include <asm/bug.h>
18 18
19extern unsigned long __phys_addr(unsigned long);
20
21#endif /* __ASSEMBLY__ */ 19#endif /* __ASSEMBLY__ */
22 20
23#define __pa(x) __phys_addr((unsigned long)(x))
24#define __pa_symbol(x) __phys_addr((unsigned long)(x))
25
26#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
27#define __boot_va(x) __va(x)
28#define __boot_pa(x) __pa(x)
29
30#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
31#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
32#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
33
34#define __HAVE_ARCH_GATE_AREA 1 21#define __HAVE_ARCH_GATE_AREA 1
35#define vmemmap ((struct page *)VMEMMAP_START) 22#define vmemmap ((struct page *)VMEMMAP_START)
36 23