diff options
Diffstat (limited to 'linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h')
-rw-r--r-- | linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h index 0104de8082..77544b3ca2 100644 --- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h +++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/maddr.h @@ -9,6 +9,10 @@ #define FOREIGN_FRAME_BIT (1UL<<63) #define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT) +/* Definitions for machine and pseudophysical addresses. */ +typedef unsigned long paddr_t; +typedef unsigned long maddr_t; + #ifdef CONFIG_XEN extern unsigned long *phys_to_machine_mapping; @@ -99,20 +103,6 @@ static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn) phys_to_machine_mapping[pfn] = mfn; } -#else /* !CONFIG_XEN */ - -#define pfn_to_mfn(pfn) (pfn) -#define mfn_to_pfn(mfn) (mfn) -#define mfn_to_local_pfn(mfn) (mfn) -#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn)) -#define phys_to_machine_mapping_valid(pfn) (1) - -#endif /* !CONFIG_XEN */ - -/* Definitions for machine and pseudophysical addresses. */ -typedef unsigned long paddr_t; -typedef unsigned long maddr_t; - static inline maddr_t phys_to_machine(paddr_t phys) { maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT); @@ -127,6 +117,27 @@ static inline paddr_t machine_to_phys(maddr_t machine) return phys; } +static inline paddr_t pte_machine_to_phys(maddr_t machine) +{ + paddr_t phys; + phys = mfn_to_pfn((machine & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT); + phys = (phys << PAGE_SHIFT) | (machine & ~PHYSICAL_PAGE_MASK); + return phys; +} + +#else /* !CONFIG_XEN */ + +#define pfn_to_mfn(pfn) (pfn) +#define mfn_to_pfn(mfn) (mfn) +#define mfn_to_local_pfn(mfn) (mfn) +#define set_phys_to_machine(pfn, mfn) BUG_ON((pfn) != (mfn)) +#define phys_to_machine_mapping_valid(pfn) (1) +#define phys_to_machine(phys) ((maddr_t)(phys)) +#define machine_to_phys(mach) ((paddr_t)(mach)) +#define pte_machine_to_phys(mach) ((paddr_t)(mach)) + +#endif /* !CONFIG_XEN */ + /* VIRT <-> MACHINE conversion */ #define virt_to_machine(v) (phys_to_machine(__pa(v))) #define virt_to_mfn(v) (pfn_to_mfn(__pa(v) >> PAGE_SHIFT)) |