These are pretty much the same as the asm-generic version,
but use phys_addr_t.

Signed-off-by: Andrew Jones <[email protected]>
---
 lib/arm/asm/io.h   | 13 +++++++++++++
 lib/arm/asm/page.h | 34 +++++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/lib/arm/asm/io.h b/lib/arm/asm/io.h
index 1d0abb7d9f405..bbcbcd0542490 100644
--- a/lib/arm/asm/io.h
+++ b/lib/arm/asm/io.h
@@ -2,6 +2,7 @@
 #define _ASMARM_IO_H_
 #include "libcflat.h"
 #include "asm/barrier.h"
+#include "asm/page.h"
 
 #define __iomem
 #define __force
@@ -76,6 +77,18 @@ static inline void __raw_writel(u32 val, volatile void 
__iomem *addr)
                     : "r" (val));
 }
 
+#define virt_to_phys virt_to_phys
+static inline phys_addr_t virt_to_phys(const volatile void *x)
+{
+       return __virt_to_phys((unsigned long)(x));
+}
+
+#define phys_to_virt phys_to_virt
+static inline void *phys_to_virt(phys_addr_t x)
+{
+       return (void *)__phys_to_virt(x);
+}
+
 #include "asm-generic/io.h"
 
 #endif /* _ASMARM_IO_H_ */
diff --git a/lib/arm/asm/page.h b/lib/arm/asm/page.h
index 91a4bc3b7f86e..606d76f5775cf 100644
--- a/lib/arm/asm/page.h
+++ b/lib/arm/asm/page.h
@@ -1 +1,33 @@
-#include "asm-generic/page.h"
+#ifndef _ASMARM_PAGE_H_
+#define _ASMARM_PAGE_H_
+/*
+ * Copyright (C) 2014, Red Hat Inc, Andrew Jones <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.
+ */
+
+#define PAGE_SHIFT             12
+#ifndef __ASSEMBLY__
+#define PAGE_SIZE              (1UL << PAGE_SHIFT)
+#else
+#define PAGE_SIZE              (1 << PAGE_SHIFT)
+#endif
+#define PAGE_MASK              (~(PAGE_SIZE-1))
+#define PAGE_ALIGN(addr)       (((addr) + (PAGE_SIZE-1)) & PAGE_MASK)
+
+#ifndef __ASSEMBLY__
+#include <asm/setup.h>
+
+#ifndef __virt_to_phys
+#define __phys_to_virt(x)      ((unsigned long) (x))
+#define __virt_to_phys(x)      (x)
+#endif
+
+#define __va(x)                        ((void 
*)__phys_to_virt((phys_addr_t)(x)))
+#define __pa(x)                        __virt_to_phys((unsigned long)(x))
+
+#define virt_to_pfn(kaddr)      (__pa(kaddr) >> PAGE_SHIFT)
+#define pfn_to_virt(pfn)        __va((pfn) << PAGE_SHIFT)
+#endif
+
+#endif
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to