direct-io.hg

view linux-2.6-xen-sparse/include/asm-ia64/maddr.h @ 13454:8bf7cd060df8

[IA64] Fix warning when building with CONFIG_FLATMEM unset

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild2.aw
date Thu Jan 04 15:28:16 2007 -0700 (2007-01-04)
parents 2ae4e4e89d6d
children e5cfd902d7e4
line source
1 #ifndef _ASM_IA64_MADDR_H
2 #define _ASM_IA64_MADDR_H
4 #include <linux/kernel.h>
5 #include <asm/hypervisor.h>
6 #include <xen/features.h>
7 #include <xen/interface/xen.h>
9 #ifdef CONFIG_XEN
11 #define INVALID_P2M_ENTRY (~0UL)
13 #ifdef CONFIG_XEN_IA64_EXPOSE_P2M
14 extern int p2m_initialized;
15 extern unsigned long p2m_min_low_pfn;
16 extern unsigned long p2m_max_low_pfn;
17 extern unsigned long p2m_convert_min_pfn;
18 extern unsigned long p2m_convert_max_pfn;
19 extern volatile const pte_t* p2m_pte;
20 unsigned long p2m_phystomach(unsigned long gpfn);
21 #else
22 #define p2m_initialized (0)
23 #define p2m_phystomach(gpfn) INVALID_MFN
24 #endif
26 /* XXX xen page size != page size */
27 static inline unsigned long
28 pfn_to_mfn_for_dma(unsigned long pfn)
29 {
30 unsigned long mfn;
31 if (p2m_initialized)
32 return p2m_phystomach(pfn);
33 mfn = HYPERVISOR_phystomach(pfn);
34 BUG_ON(mfn == 0); // XXX
35 BUG_ON(mfn == INVALID_P2M_ENTRY); // XXX
36 BUG_ON(mfn == INVALID_MFN);
37 return mfn;
38 }
40 static inline unsigned long
41 phys_to_machine_for_dma(unsigned long phys)
42 {
43 unsigned long machine =
44 pfn_to_mfn_for_dma(phys >> PAGE_SHIFT) << PAGE_SHIFT;
45 machine |= (phys & ~PAGE_MASK);
46 return machine;
47 }
49 static inline unsigned long
50 mfn_to_pfn_for_dma(unsigned long mfn)
51 {
52 unsigned long pfn;
53 pfn = HYPERVISOR_machtophys(mfn);
54 BUG_ON(pfn == 0);
55 //BUG_ON(pfn == INVALID_M2P_ENTRY);
56 return pfn;
57 }
59 static inline unsigned long
60 machine_to_phys_for_dma(unsigned long machine)
61 {
62 unsigned long phys =
63 mfn_to_pfn_for_dma(machine >> PAGE_SHIFT) << PAGE_SHIFT;
64 phys |= (machine & ~PAGE_MASK);
65 return phys;
66 }
68 static inline unsigned long
69 mfn_to_local_pfn(unsigned long mfn)
70 {
71 unsigned long pfn = mfn_to_pfn_for_dma(mfn);
72 if (!pfn_valid(pfn))
73 return INVALID_P2M_ENTRY;
74 return pfn;
75 }
77 #else /* !CONFIG_XEN */
79 #define pfn_to_mfn_for_dma(pfn) (pfn)
80 #define mfn_to_pfn_for_dma(mfn) (mfn)
81 #define phys_to_machine_for_dma(phys) (phys)
82 #define machine_to_phys_for_dma(machine) (machine)
83 #define mfn_to_local_pfn(mfn) (mfn)
85 #endif /* !CONFIG_XEN */
87 /* XXX to compile set_phys_to_machine(vaddr, FOREIGN_FRAME(m)) */
88 #define FOREIGN_FRAME(m) (INVALID_P2M_ENTRY)
90 #define mfn_to_pfn(mfn) (mfn)
91 #define pfn_to_mfn(pfn) (pfn)
93 #define mfn_to_virt(mfn) (__va((mfn) << PAGE_SHIFT))
94 #define virt_to_mfn(virt) (__pa(virt) >> PAGE_SHIFT)
95 #define virt_to_machine(virt) __pa(virt) // for tpmfront.c
97 #define set_phys_to_machine(pfn, mfn) do { } while (0)
99 typedef unsigned long maddr_t; // to compile netback, netfront
101 #endif /* _ASM_IA64_MADDR_H */