[U-Boot] [PATCH 2/3] Data types defined for 64 bit physical address
Aneesh Bansal
aneesh.bansal at freescale.com
Fri Jul 31 11:53:25 CEST 2015
Data types and I/O functions have been defined for
64 bit physical addresses in arm and powerpc
Signed-off-by: Aneesh Bansal <aneesh.bansal at freescale.com>
---
arch/arm/include/asm/io.h | 4 +++-
arch/arm/include/asm/types.h | 13 ++++++++-----
arch/powerpc/include/asm/io.h | 13 +++++++++++++
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index bfbe0a0..09d192d 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -59,7 +59,7 @@ static inline void unmap_physmem(void *vaddr, unsigned long flags)
static inline phys_addr_t virt_to_phys(void * vaddr)
{
- return (phys_addr_t)(vaddr);
+ return (phys_addr_t)((unsigned long)vaddr);
}
/*
@@ -183,9 +183,11 @@ static inline void __raw_readsl(unsigned long addr, void *data, int longlen)
#define in_le32(a) in_arch(l,le32,a)
#define in_le16(a) in_arch(w,le16,a)
+#define out_be64(a, v) out_arch(q, be64, a, v)
#define out_be32(a,v) out_arch(l,be32,a,v)
#define out_be16(a,v) out_arch(w,be16,a,v)
+#define in_be64(a) in_arch(q, be64, a)
#define in_be32(a) in_arch(l,be32,a)
#define in_be16(a) in_arch(w,be16,a)
diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
index ee77c41..d87f955 100644
--- a/arch/arm/include/asm/types.h
+++ b/arch/arm/include/asm/types.h
@@ -45,12 +45,15 @@ typedef unsigned long long u64;
#define BITS_PER_LONG 32
#endif /* CONFIG_ARM64 */
-/* Dma addresses are 32-bits wide. */
-
+#ifdef CONFIG_PHYS_64BIT
+typedef u64 dma_addr_t;
+typedef u64 phys_addr_t;
+typedef u64 phys_size_t;
+#else
typedef u32 dma_addr_t;
-
-typedef unsigned long phys_addr_t;
-typedef unsigned long phys_size_t;
+typedef u32 phys_addr_t;
+typedef u32 phys_size_t;
+#endif
#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index a5257e9..8c6f47e 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -246,6 +246,19 @@ extern inline void out_be32(volatile unsigned __iomem *addr, u32 val)
__asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
}
+extern inline u64 in_be64(const u64 *addr)
+{
+ return ((u64)in_be32((u32 *)addr) << 32) |
+ (in_be32((u32 *)addr + 1));
+}
+
+extern inline void out_be64(u64 *addr, u64 val)
+{
+ out_be32((u32 *)addr, (u32)(val >> 32));
+ out_be32((u32 *)addr + 1, (u32)val);
+}
+
+
/* Clear and set bits in one shot. These macros can be used to clear and
* set multiple bits in a register using a single call. These macros can
* also be used to set a multiple-bit bit pattern using a mask, by
--
1.8.1.4
More information about the U-Boot
mailing list