From e99ccb488181d012248c6be30b2093e950319fc5 Mon Sep 17 00:00:00 2001
From: Kumar Gala <galak@kernel.crashing.org>
Date: Thu, 27 Mar 2008 11:46:38 -0500
Subject: [PATCH] Introduce phys_size_t and move phys_addr_t into asm/types.h

Also add CONFIG_PHYS_64BIT on powerpc to deal with 32-bit ppc's
that have larger physical addresses like 44x, 85xx, and 86xx.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 include/asm-arm/io.h           | 2 --
 include/asm-arm/types.h        | 3 +++
 include/asm-avr32/io.h         | 2 --
 include/asm-avr32/types.h      | 3 +++
 include/asm-blackfin/io.h      | 2 --
 include/asm-blackfin/types.h   | 3 +++
 include/asm-i386/io.h          | 2 --
 include/asm-i386/types.h       | 3 +++
 include/asm-m68k/io.h          | 2 --
 include/asm-m68k/types.h       | 3 +++
 include/asm-microblaze/io.h    | 2 --
 include/asm-microblaze/types.h | 3 +++
 include/asm-mips/io.h          | 2 --
 include/asm-mips/types.h       | 8 ++++++++
 include/asm-nios/io.h          | 2 --
 include/asm-nios/types.h       | 3 +++
 include/asm-nios2/io.h         | 2 --
 include/asm-ppc/io.h           | 2 --
 include/asm-ppc/types.h        | 8 ++++++++
 include/asm-sh/io.h            | 2 --
 include/asm-sh/types.h         | 3 +++
 21 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index 029b7f9eeb4..c33b9e8d342 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -38,8 +38,6 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-arm/types.h b/include/asm-arm/types.h
index e56f19d29be..71dc049da62 100644
--- a/include/asm-arm/types.h
+++ b/include/asm-arm/types.h
@@ -45,6 +45,9 @@ typedef unsigned long long u64;
 
 typedef u32 dma_addr_t;
 
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
 #endif /* __KERNEL__ */
 
 #endif
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index ba14674cf73..d030c262a58 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -101,8 +101,6 @@ static inline void sync(void)
  * This implementation works for memory below 512MiB (flash, etc.) as
  * well as above 3.5GiB (internal peripherals.)
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(1 << 7)
 #define MAP_WRBACK	(MAP_WRCOMBINE | (1 << 9))
diff --git a/include/asm-avr32/types.h b/include/asm-avr32/types.h
index 2dbea4bad35..c303e3c8912 100644
--- a/include/asm-avr32/types.h
+++ b/include/asm-avr32/types.h
@@ -71,6 +71,9 @@ typedef unsigned long long u64;
 
 typedef u32 dma_addr_t;
 
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
 #ifdef CONFIG_LBD
 typedef u64 sector_t;
 #define HAVE_SECTOR_T
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
index 2149685c179..da58914987c 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -45,8 +45,6 @@ extern void cf_outb(unsigned char val, volatile unsigned char *addr);
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-blackfin/types.h b/include/asm-blackfin/types.h
index 9fd8e033604..2160ba0d029 100644
--- a/include/asm-blackfin/types.h
+++ b/include/asm-blackfin/types.h
@@ -78,6 +78,9 @@ typedef unsigned long long u64;
 
 typedef u32 dma_addr_t;
 
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
 #endif
 
 #endif
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index db4f4428178..2c57140fb39 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -210,8 +210,6 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-i386/types.h b/include/asm-i386/types.h
index bdbde4172ae..9a40e383eb3 100644
--- a/include/asm-i386/types.h
+++ b/include/asm-i386/types.h
@@ -45,6 +45,9 @@ typedef unsigned long long u64;
 
 typedef u32 dma_addr_t;
 
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
 #endif /* __KERNEL__ */
 
 #endif
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 33c454a4373..1fccc129232 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -232,8 +232,6 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-m68k/types.h b/include/asm-m68k/types.h
index e944d3fd192..44b4ca5bd5a 100644
--- a/include/asm-m68k/types.h
+++ b/include/asm-m68k/types.h
@@ -44,6 +44,9 @@ typedef unsigned long long u64;
 /* DMA addresses are 32-bits wide */
 typedef u32 dma_addr_t;
 
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
 #endif /* __KERNEL__ */
 #endif /* __ASSEMBLY__ */
 
diff --git a/include/asm-microblaze/io.h b/include/asm-microblaze/io.h
index 90d18428ad1..aa37a60ce75 100644
--- a/include/asm-microblaze/io.h
+++ b/include/asm-microblaze/io.h
@@ -134,8 +134,6 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-microblaze/types.h b/include/asm-microblaze/types.h
index 3895dc43650..77094f62d63 100644
--- a/include/asm-microblaze/types.h
+++ b/include/asm-microblaze/types.h
@@ -52,6 +52,9 @@ typedef unsigned long long u64;
 /* Dma addresses are 32-bits wide.  */
 
 typedef u32 dma_addr_t;
+
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_TYPES_H */
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index e27d1f159d7..7137072ce45 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -470,8 +470,6 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-mips/types.h b/include/asm-mips/types.h
index f49a2176af0..d4bb85999bb 100644
--- a/include/asm-mips/types.h
+++ b/include/asm-mips/types.h
@@ -78,8 +78,16 @@ typedef unsigned long long u64;
 #if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \
     || defined(CONFIG_64BIT)
 typedef u64 dma_addr_t;
+
+typedef u64 phys_addr_t;
+typedef u64 phys_size_t;
+
 #else
 typedef u32 dma_addr_t;
+
+typedef u32 phys_addr_t;
+typedef u32 phys_size_t;
+
 #endif
 typedef u64 dma64_addr_t;
 
diff --git a/include/asm-nios/io.h b/include/asm-nios/io.h
index 6fc339fb019..12a0bd9152c 100644
--- a/include/asm-nios/io.h
+++ b/include/asm-nios/io.h
@@ -114,8 +114,6 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-nios/types.h b/include/asm-nios/types.h
index 24c98a89e4a..636e12fd38e 100644
--- a/include/asm-nios/types.h
+++ b/include/asm-nios/types.h
@@ -52,6 +52,9 @@ typedef unsigned long long u64;
 /* Dma addresses are 32-bits wide.  */
 
 typedef u32 dma_addr_t;
+
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
 #endif /* __KERNEL__ */
 
 #endif /* _NIOS_TYPES_H */
diff --git a/include/asm-nios2/io.h b/include/asm-nios2/io.h
index a52b95cf235..2f1ec26bd16 100644
--- a/include/asm-nios2/io.h
+++ b/include/asm-nios2/io.h
@@ -34,8 +34,6 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 91c9c1e4c69..00b7ec57e40 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -243,8 +243,6 @@ extern inline void out_be32(volatile unsigned __iomem *addr, int val)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE	(0)
 #define MAP_WRCOMBINE	(0)
 #define MAP_WRBACK	(0)
diff --git a/include/asm-ppc/types.h b/include/asm-ppc/types.h
index 7adf1450f25..864391f03bd 100644
--- a/include/asm-ppc/types.h
+++ b/include/asm-ppc/types.h
@@ -44,6 +44,14 @@ typedef unsigned long long u64;
 /* DMA addresses are 32-bits wide */
 typedef u32 dma_addr_t;
 
+#ifdef CONFIG_PHYS_64BIT
+typedef unsigned long long phys_addr_t;
+typedef unsigned long long phys_size_t;
+#else
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* __ASSEMBLY__ */
 
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index 51fd10b566a..740029300c2 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -233,8 +233,6 @@ static inline void sync(void)
  * that can be used to access the memory range with the caching
  * properties specified by "flags".
  */
-typedef unsigned long phys_addr_t;
-
 #define MAP_NOCACHE     (0)
 #define MAP_WRCOMBINE   (0)
 #define MAP_WRBACK      (0)
diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h
index 7ba69d9707e..aed4a6eb57c 100644
--- a/include/asm-sh/types.h
+++ b/include/asm-sh/types.h
@@ -52,6 +52,9 @@ typedef unsigned long long u64;
 
 typedef u32 dma_addr_t;
 
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __KERNEL__ */
-- 
GitLab