[RFC/PATCH 2/12] powerpc: Remove #ifdef ISERIES from __raw_* accessors in io.h

Michael Ellerman michael at ellerman.id.au
Tue Jan 17 14:22:09 EST 2006


Convert the __raw_* accesors to be compilable on a combined kernel.

 include/asm-powerpc/io.h                 |  110 ++++++++++++++++++-------------
 include/asm-powerpc/iseries/iseries_io.h |    2 
 2 files changed, 66 insertions(+), 46 deletions(-)

Index: linux/include/asm-powerpc/io.h
===================================================================
--- linux.orig/include/asm-powerpc/io.h
+++ linux/include/asm-powerpc/io.h
@@ -14,13 +14,13 @@
 #else
 
 #include <linux/compiler.h>
+#include <asm/bug.h>
 #include <asm/page.h>
 #include <asm/byteorder.h>
-#ifdef CONFIG_PPC_ISERIES 
 #include <asm/iseries/iseries_io.h>
-#endif  
 #include <asm/synch.h>
 #include <asm/delay.h>
+#include <asm/firmware.h>
 
 #include <asm-generic/iomap.h>
 
@@ -45,15 +45,6 @@ extern unsigned long io_page_mask;
 			    & io_page_mask)
 
 #ifdef CONFIG_PPC_ISERIES
-/* __raw_* accessors aren't supported on iSeries */
-#define __raw_readb(addr)	{ BUG(); 0; }
-#define __raw_readw(addr)       { BUG(); 0; }
-#define __raw_readl(addr)       { BUG(); 0; }
-#define __raw_readq(addr)       { BUG(); 0; }
-#define __raw_writeb(v, addr)   { BUG(); 0; }
-#define __raw_writew(v, addr)   { BUG(); 0; }
-#define __raw_writel(v, addr)   { BUG(); 0; }
-#define __raw_writeq(v, addr)   { BUG(); 0; }
 #define readb(addr)		iSeries_Read_Byte(addr)
 #define readw(addr)		iSeries_Read_Word(addr)
 #define readl(addr)		iSeries_Read_Long(addr)
@@ -78,39 +69,6 @@ extern unsigned long io_page_mask;
 #define insw_ns(port, buf, ns)	_insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns))
 #define insl_ns(port, buf, nl)	_insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl))
 #else
-
-static inline unsigned char __raw_readb(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned char __force *)addr;
-}
-static inline unsigned short __raw_readw(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned short __force *)addr;
-}
-static inline unsigned int __raw_readl(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned int __force *)addr;
-}
-static inline unsigned long __raw_readq(const volatile void __iomem *addr)
-{
-	return *(volatile unsigned long __force *)addr;
-}
-static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
-{
-	*(volatile unsigned char __force *)addr = v;
-}
-static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
-{
-	*(volatile unsigned short __force *)addr = v;
-}
-static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
-{
-	*(volatile unsigned int __force *)addr = v;
-}
-static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
-{
-	*(volatile unsigned long __force *)addr = v;
-}
 #define readb(addr)		eeh_readb(addr)
 #define readw(addr)		eeh_readw(addr)
 #define readl(addr)		eeh_readl(addr)
@@ -146,6 +104,70 @@ static inline void __raw_writeq(unsigned
 
 #endif
 
+static inline unsigned char __raw_readb(const volatile void __iomem *addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		BUG();	/* raw accessors aren't supported on iSeries */
+
+	return *(volatile unsigned char __force *)addr;
+}
+
+static inline unsigned short __raw_readw(const volatile void __iomem *addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		BUG();	/* raw accessors aren't supported on iSeries */
+
+	return *(volatile unsigned short __force *)addr;
+}
+
+static inline unsigned int __raw_readl(const volatile void __iomem *addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		BUG();	/* raw accessors aren't supported on iSeries */
+
+	return *(volatile unsigned int __force *)addr;
+}
+
+static inline unsigned long __raw_readq(const volatile void __iomem *addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		BUG();	/* raw accessors aren't supported on iSeries */
+
+	return *(volatile unsigned long __force *)addr;
+}
+
+static inline void __raw_writeb(unsigned char v, volatile void __iomem *addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		BUG();	/* raw accessors aren't supported on iSeries */
+
+	*(volatile unsigned char __force *)addr = v;
+}
+
+static inline void __raw_writew(unsigned short v, volatile void __iomem *addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		BUG();	/* raw accessors aren't supported on iSeries */
+
+	*(volatile unsigned short __force *)addr = v;
+}
+
+static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		BUG();	/* raw accessors aren't supported on iSeries */
+
+	*(volatile unsigned int __force *)addr = v;
+}
+
+static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		BUG();	/* raw accessors aren't supported on iSeries */
+
+	*(volatile unsigned long __force *)addr = v;
+}
+
 #define readb_relaxed(addr) readb(addr)
 #define readw_relaxed(addr) readw(addr)
 #define readl_relaxed(addr) readl(addr)
Index: linux/include/asm-powerpc/iseries/iseries_io.h
===================================================================
--- linux.orig/include/asm-powerpc/iseries/iseries_io.h
+++ linux/include/asm-powerpc/iseries/iseries_io.h
@@ -3,7 +3,6 @@
 
 #include <linux/config.h>
 
-#ifdef CONFIG_PPC_ISERIES
 #include <linux/types.h>
 /*
  * Created by Allan Trautman on Thu Dec 28 2000.
@@ -57,5 +56,4 @@ static inline void iSeries_Write_Byte(u8
 }
 #endif	/* CONFIG_PCI */
 
-#endif /* CONFIG_PPC_ISERIES */
 #endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */



More information about the Linuxppc64-dev mailing list