[RFC/PATCH 5/12] powerpc: Remove #ifdef ISERIES from inb/outb etc. in io.h

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


Make inb/outb etc. compilable on a combined kernel.

 include/asm-powerpc/io.h |   60 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 12 deletions(-)

Index: linux/include/asm-powerpc/io.h
===================================================================
--- linux.orig/include/asm-powerpc/io.h
+++ linux/include/asm-powerpc/io.h
@@ -46,12 +46,6 @@ extern unsigned long io_page_mask;
 
 #ifdef CONFIG_PPC_ISERIES
 
-#define inb(addr)		readb(((void __iomem *)(long)(addr)))
-#define inw(addr)		readw(((void __iomem *)(long)(addr)))
-#define inl(addr)		readl(((void __iomem *)(long)(addr)))
-#define outb(data,addr)		writeb(data,((void __iomem *)(long)(addr)))
-#define outw(data,addr)		writew(data,((void __iomem *)(long)(addr)))
-#define outl(data,addr)		writel(data,((void __iomem *)(long)(addr)))
 /*
  * The *_ns versions below don't do byte-swapping.
  * Neither do the standard versions now, these are just here
@@ -60,12 +54,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
-#define inb(port)		eeh_inb((unsigned long)port)
-#define outb(val, port)		eeh_outb(val, (unsigned long)port)
-#define inw(port)		eeh_inw((unsigned long)port)
-#define outw(val, port)		eeh_outw(val, (unsigned long)port)
-#define inl(port)		eeh_inl((unsigned long)port)
-#define outl(val, port)		eeh_outl(val, (unsigned long)port)
 
 /*
  * The insw/outsw/insl/outsl macros don't do byte-swapping.
@@ -486,6 +474,54 @@ static inline void memcpy_toio(volatile 
 		eeh_memcpy_toio(dest, src, count);
 }
 
+static inline u8 inb(unsigned long addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return readb((void __iomem *)addr);
+	else
+		return eeh_inb(addr);
+}
+
+static inline u16 inw(unsigned long addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return readw((void __iomem *)addr);
+	else
+		return eeh_inw(addr);
+}
+
+static inline u32 inl(unsigned long addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return readl((void __iomem *)addr);
+	else
+		return eeh_inl(addr);
+}
+
+static inline void outb(u8 val, unsigned long addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return writeb(val, (void __iomem *)addr);
+	else
+		return eeh_outb(val, addr);
+}
+
+static inline void outw(u16 val, unsigned long addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return writew(val, (void __iomem *)addr);
+	else
+		return eeh_outw(val, addr);
+}
+
+static inline void outl(u32 val, unsigned long addr)
+{
+	if (firmware_has_feature(FW_FEATURE_ISERIES))
+		return writel(val, (void __iomem *)addr);
+	else
+		return eeh_outl(val, addr);
+}
+
 /**
  *	check_signature		-	find BIOS signatures
  *	@io_addr: mmio address to check



More information about the Linuxppc64-dev mailing list