[RFC/PATCH 4/12] powerpc: Remove #ifdef ISERIES from memset/memcpy routines in io.h
Michael Ellerman
michael at ellerman.id.au
Tue Jan 17 14:22:19 EST 2006
Make the memcpy/memset routines compilable on a combined kernel.
arch/powerpc/platforms/iseries/pci.c | 25 +++++++++++------------
include/asm-powerpc/io.h | 33 +++++++++++++++++++++++++------
include/asm-powerpc/iseries/iseries_io.h | 12 ++++++-----
3 files changed, 46 insertions(+), 24 deletions(-)
Index: linux/include/asm-powerpc/io.h
===================================================================
--- linux.orig/include/asm-powerpc/io.h
+++ linux/include/asm-powerpc/io.h
@@ -45,9 +45,6 @@ extern unsigned long io_page_mask;
& io_page_mask)
#ifdef CONFIG_PPC_ISERIES
-#define memset_io(a,b,c) iSeries_memset_io((a),(b),(c))
-#define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c))
-#define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c))
#define inb(addr) readb(((void __iomem *)(long)(addr)))
#define inw(addr) readw(((void __iomem *)(long)(addr)))
@@ -63,9 +60,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 memset_io(a,b,c) eeh_memset_io((a),(b),(c))
-#define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c))
-#define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c))
#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)
@@ -465,6 +459,33 @@ static inline void writeq(u16 val, volat
eeh_writeq(val, addr);
}
+static inline void memset_io(volatile void __iomem *dest, int c,
+ unsigned long count)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_memset_io(dest, c, count);
+ else
+ eeh_memset_io(dest, c, count);
+}
+
+static inline void memcpy_fromio(void *dest, const volatile void __iomem *src,
+ unsigned long count)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_memcpy_fromio(dest, src, count);
+ else
+ eeh_memcpy_fromio(dest, src, count);
+}
+
+static inline void memcpy_toio(volatile void __iomem *dest, const void *src,
+ unsigned long count)
+{
+ if (firmware_has_feature(FW_FEATURE_ISERIES))
+ iSeries_memcpy_toio(dest, src, count);
+ else
+ eeh_memcpy_toio(dest, src, count);
+}
+
/**
* check_signature - find BIOS signatures
* @io_addr: mmio address to check
Index: linux/arch/powerpc/platforms/iseries/pci.c
===================================================================
--- linux.orig/arch/powerpc/platforms/iseries/pci.c
+++ linux/arch/powerpc/platforms/iseries/pci.c
@@ -468,38 +468,37 @@ static int scan_bridge_slot(HvBusNumber
* I/0 Memory copy MUST use mmio commands on iSeries
* To do; For performance, include the hv call directly
*/
-void iSeries_memset_io(volatile void __iomem *dest, char c, size_t Count)
+void iSeries_memset_io(volatile void __iomem *dest, int c, unsigned long count)
{
u8 ByteValue = c;
- long NumberOfBytes = Count;
- while (NumberOfBytes > 0) {
+ while (count > 0) {
iSeries_Write_Byte(ByteValue, dest++);
- -- NumberOfBytes;
+ count--;
}
}
EXPORT_SYMBOL(iSeries_memset_io);
-void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t count)
+void iSeries_memcpy_toio(volatile void __iomem *dest, const void *source,
+ unsigned long count)
{
- char *src = source;
- long NumberOfBytes = count;
+ const char *src = source;
- while (NumberOfBytes > 0) {
+ while (count > 0) {
iSeries_Write_Byte(*src++, dest++);
- -- NumberOfBytes;
+ count--;
}
}
EXPORT_SYMBOL(iSeries_memcpy_toio);
-void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src, size_t count)
+void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src,
+ unsigned long count)
{
char *dst = dest;
- long NumberOfBytes = count;
- while (NumberOfBytes > 0) {
+ while (count > 0) {
*dst++ = iSeries_Read_Byte(src++);
- -- NumberOfBytes;
+ count--;
}
}
EXPORT_SYMBOL(iSeries_memcpy_fromio);
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
@@ -39,11 +39,13 @@ extern void iSeries_Write_Byte(u8 IoDat
extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress);
extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress);
-extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n);
-extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source,
- size_t n);
-extern void iSeries_memcpy_fromio(void *dest,
- const volatile void __iomem *source, size_t n);
+
+extern void iSeries_memset_io(volatile void __iomem *dest, int c,
+ unsigned long count);
+extern void iSeries_memcpy_toio(volatile void __iomem *dest, const void *source,
+ unsigned long count);
+extern void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src,
+ unsigned long count);
#else
static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress)
{
More information about the Linuxppc64-dev
mailing list