1 #ifndef __XEN_PDX_H__ 2 #define __XEN_PDX_H__ 3 4 #ifdef CONFIG_HAS_PDX 5 6 extern unsigned long max_pdx; 7 extern unsigned long pfn_pdx_bottom_mask, ma_va_bottom_mask; 8 extern unsigned int pfn_pdx_hole_shift; 9 extern unsigned long pfn_hole_mask; 10 extern unsigned long pfn_top_mask, ma_top_mask; 11 12 #define PDX_GROUP_COUNT ((1 << PDX_GROUP_SHIFT) / \ 13 (sizeof(*frame_table) & -sizeof(*frame_table))) 14 extern unsigned long pdx_group_valid[]; 15 16 extern uint64_t pdx_init_mask(u64 base_addr); 17 extern u64 pdx_region_mask(u64 base, u64 len); 18 19 extern void set_pdx_range(unsigned long smfn, unsigned long emfn); 20 21 #define page_to_pdx(pg) ((pg) - frame_table) 22 #define pdx_to_page(pdx) (frame_table + (pdx)) 23 24 bool __mfn_valid(unsigned long mfn); 25 pfn_to_pdx(unsigned long pfn)26static inline unsigned long pfn_to_pdx(unsigned long pfn) 27 { 28 return (pfn & pfn_pdx_bottom_mask) | 29 ((pfn & pfn_top_mask) >> pfn_pdx_hole_shift); 30 } 31 pdx_to_pfn(unsigned long pdx)32static inline unsigned long pdx_to_pfn(unsigned long pdx) 33 { 34 return (pdx & pfn_pdx_bottom_mask) | 35 ((pdx << pfn_pdx_hole_shift) & pfn_top_mask); 36 } 37 38 #define mfn_to_pdx(mfn) pfn_to_pdx(mfn_x(mfn)) 39 #define pdx_to_mfn(pdx) _mfn(pdx_to_pfn(pdx)) 40 41 extern void pfn_pdx_hole_setup(unsigned long); 42 43 #endif /* HAS_PDX */ 44 #endif /* __XEN_PDX_H__ */ 45 46 /* 47 * Local variables: 48 * mode: C 49 * c-file-style: "BSD" 50 * c-basic-offset: 4 51 * indent-tabs-mode: nil 52 * End: 53 */ 54