Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / include / asm-powerpc / eeh.h
index 6a78439..868c713 100644 (file)
@@ -21,6 +21,7 @@
 #define _PPC64_EEH_H
 #ifdef __KERNEL__
 
+#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/string.h>
@@ -205,7 +206,6 @@ static inline void eeh_memset_io(volatile void __iomem *addr, int c,
        lc |= lc << 8;
        lc |= lc << 16;
 
-       __asm__ __volatile__ ("sync" : : : "memory");
        while(n && !EEH_CHECK_ALIGN(p, 4)) {
                *((volatile u8 *)p) = c;
                p++;
@@ -230,7 +230,6 @@ static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *sr
        void *destsave = dest;
        unsigned long nsave = n;
 
-       __asm__ __volatile__ ("sync" : : : "memory");
        while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
                *((u8 *)dest) = *((volatile u8 *)vsrc);
                __asm__ __volatile__ ("eieio" : : : "memory");
@@ -268,7 +267,6 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
 {
        void *vdest = (void __force *) dest;
 
-       __asm__ __volatile__ ("sync" : : : "memory");
        while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) {
                *((volatile u8 *)vdest) = *((u8 *)src);
                src++;
@@ -295,6 +293,8 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
 static inline u8 eeh_inb(unsigned long port)
 {
        u8 val;
+       if (!_IO_IS_VALID(port))
+               return ~0;
        val = in_8((u8 __iomem *)(port+pci_io_base));
        if (EEH_POSSIBLE_ERROR(val, u8))
                return eeh_check_failure((void __iomem *)(port), val);
@@ -303,12 +303,15 @@ static inline u8 eeh_inb(unsigned long port)
 
 static inline void eeh_outb(u8 val, unsigned long port)
 {
-       out_8((u8 __iomem *)(port+pci_io_base), val);
+       if (_IO_IS_VALID(port))
+               out_8((u8 __iomem *)(port+pci_io_base), val);
 }
 
 static inline u16 eeh_inw(unsigned long port)
 {
        u16 val;
+       if (!_IO_IS_VALID(port))
+               return ~0;
        val = in_le16((u16 __iomem *)(port+pci_io_base));
        if (EEH_POSSIBLE_ERROR(val, u16))
                return eeh_check_failure((void __iomem *)(port), val);
@@ -317,12 +320,15 @@ static inline u16 eeh_inw(unsigned long port)
 
 static inline void eeh_outw(u16 val, unsigned long port)
 {
-       out_le16((u16 __iomem *)(port+pci_io_base), val);
+       if (_IO_IS_VALID(port))
+               out_le16((u16 __iomem *)(port+pci_io_base), val);
 }
 
 static inline u32 eeh_inl(unsigned long port)
 {
        u32 val;
+       if (!_IO_IS_VALID(port))
+               return ~0;
        val = in_le32((u32 __iomem *)(port+pci_io_base));
        if (EEH_POSSIBLE_ERROR(val, u32))
                return eeh_check_failure((void __iomem *)(port), val);
@@ -331,7 +337,8 @@ static inline u32 eeh_inl(unsigned long port)
 
 static inline void eeh_outl(u32 val, unsigned long port)
 {
-       out_le32((u32 __iomem *)(port+pci_io_base), val);
+       if (_IO_IS_VALID(port))
+               out_le32((u32 __iomem *)(port+pci_io_base), val);
 }
 
 /* in-string eeh macros */