ia64/xen-unstable

view xen/include/asm-ia64/xenpage.h @ 7925:64699278c175

Fix pfn_valid call (by Kevin Tian)
author djm@kirby.fc.hp.com
date Thu Dec 01 11:21:48 2005 -0600 (2005-12-01)
parents 2c823d27cf33
children 0c94043f5c5b
line source
1 #ifndef _ASM_IA64_XENPAGE_H
2 #define _ASM_IA64_XENPAGE_H
4 #ifdef CONFIG_DISCONTIGMEM
5 #error "xenpage.h: page macros need to be defined for CONFIG_DISCONTIGMEM"
6 #endif
8 #undef pfn_valid
9 #undef page_to_pfn
10 #undef pfn_to_page
11 # define pfn_valid(_pfn) ((_pfn) < max_page)
12 # define page_to_pfn(_page) ((unsigned long) ((_page) - frame_table))
13 # define pfn_to_page(_pfn) (frame_table + (_pfn))
15 #undef page_to_phys
16 #undef virt_to_page
17 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
18 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
20 #define page_to_virt(_page) phys_to_virt(page_to_phys(_page))
21 #define phys_to_page(kaddr) pfn_to_page(((kaddr) >> PAGE_SHIFT))
23 #ifndef __ASSEMBLY__
24 typedef union xen_va {
25 struct {
26 unsigned long off : 60;
27 unsigned long reg : 4;
28 } f;
29 unsigned long l;
30 void *p;
31 } xen_va;
33 static inline int get_order_from_bytes(physaddr_t size)
34 {
35 int order;
36 size = (size-1) >> PAGE_SHIFT;
37 for ( order = 0; size; order++ )
38 size >>= 1;
39 return order;
40 }
42 static inline int get_order_from_pages(unsigned long nr_pages)
43 {
44 int order;
45 nr_pages--;
46 for ( order = 0; nr_pages; order++ )
47 nr_pages >>= 1;
48 return order;
49 }
51 #endif
53 #undef __pa
54 #undef __va
55 #define __pa(x) ({xen_va _v; _v.l = (long) (x); _v.f.reg = 0; _v.l;})
56 #define __va(x) ({xen_va _v; _v.l = (long) (x); _v.f.reg = -1; _v.p;})
58 #undef PAGE_OFFSET
59 #define PAGE_OFFSET __IA64_UL_CONST(0xf000000000000000)
61 #endif /* _ASM_IA64_XENPAGE_H */