blk: rq_data_dir() should not return a boolean
[cris-mirror.git] / arch / arm / include / asm / xen / page.h
blob127956353b0060fc1a4e6d7edacdcc0a7219e201
1 #ifndef _ASM_ARM_XEN_PAGE_H
2 #define _ASM_ARM_XEN_PAGE_H
4 #include <asm/page.h>
5 #include <asm/pgtable.h>
7 #include <linux/pfn.h>
8 #include <linux/types.h>
9 #include <linux/dma-mapping.h>
11 #include <xen/xen.h>
12 #include <xen/interface/grant_table.h>
14 #define phys_to_machine_mapping_valid(pfn) (1)
16 #define pte_mfn pte_pfn
17 #define mfn_pte pfn_pte
19 /* Xen machine address */
20 typedef struct xmaddr {
21 phys_addr_t maddr;
22 } xmaddr_t;
24 /* Xen pseudo-physical address */
25 typedef struct xpaddr {
26 phys_addr_t paddr;
27 } xpaddr_t;
29 #define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
30 #define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
32 #define INVALID_P2M_ENTRY (~0UL)
34 unsigned long __pfn_to_mfn(unsigned long pfn);
35 extern struct rb_root phys_to_mach;
37 /* Pseudo-physical <-> Guest conversion */
38 static inline unsigned long pfn_to_gfn(unsigned long pfn)
40 return pfn;
43 static inline unsigned long gfn_to_pfn(unsigned long gfn)
45 return gfn;
48 /* Pseudo-physical <-> BUS conversion */
49 static inline unsigned long pfn_to_bfn(unsigned long pfn)
51 unsigned long mfn;
53 if (phys_to_mach.rb_node != NULL) {
54 mfn = __pfn_to_mfn(pfn);
55 if (mfn != INVALID_P2M_ENTRY)
56 return mfn;
59 return pfn;
62 static inline unsigned long bfn_to_pfn(unsigned long bfn)
64 return bfn;
67 #define bfn_to_local_pfn(bfn) bfn_to_pfn(bfn)
69 /* VIRT <-> GUEST conversion */
70 #define virt_to_gfn(v) (pfn_to_gfn(virt_to_pfn(v)))
71 #define gfn_to_virt(m) (__va(gfn_to_pfn(m) << PAGE_SHIFT))
73 /* Only used in PV code. But ARM guests are always HVM. */
74 static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr)
76 BUG();
79 /* TODO: this shouldn't be here but it is because the frontend drivers
80 * are using it (its rolled in headers) even though we won't hit the code path.
81 * So for right now just punt with this.
83 static inline pte_t *lookup_address(unsigned long address, unsigned int *level)
85 BUG();
86 return NULL;
89 extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
90 struct gnttab_map_grant_ref *kmap_ops,
91 struct page **pages, unsigned int count);
93 extern int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
94 struct gnttab_unmap_grant_ref *kunmap_ops,
95 struct page **pages, unsigned int count);
97 bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn);
98 bool __set_phys_to_machine_multi(unsigned long pfn, unsigned long mfn,
99 unsigned long nr_pages);
101 static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
103 return __set_phys_to_machine(pfn, mfn);
106 #define xen_remap(cookie, size) ioremap_cache((cookie), (size))
107 #define xen_unmap(cookie) iounmap((cookie))
109 bool xen_arch_need_swiotlb(struct device *dev,
110 unsigned long pfn,
111 unsigned long bfn);
112 unsigned long xen_get_swiotlb_free_pages(unsigned int order);
114 #endif /* _ASM_ARM_XEN_PAGE_H */