Revert r2852 as it uses the incorrect method to access IO memory and breaks on many...
authormentor <mentor@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Thu, 15 Nov 2007 16:32:01 +0000 (16:32 +0000)
committermentor <mentor@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Thu, 15 Nov 2007 16:32:01 +0000 (16:32 +0000)
git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@2854 0192ed92-7a03-0410-a25b-9323aeb14dbd

ath_hal/ah_os.h

index 0a06000a841384e1eeef3b677094c9450f1e73b8..6cefadc6a215259a782e4d9c4be26565eeea4864 100644 (file)
@@ -172,25 +172,44 @@ extern    u_int32_t __ahdecl ath_hal_getuptime(struct ath_hal *);
  * never byte-swapped by PCI chipsets or bridges, but always 
  * written directly (i.e. the format defined by the manufacturer).
  */
-#if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
+# if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
 #define _OS_REG_WRITE(_ah, _reg, _val) do {                    \
        (0x4000 <= (_reg) && (_reg) < 0x5000) ?                 \
-        writel((_val), (_ah)->ah_sh + (_reg)) :                \
-        ({__raw_writel((_val), (_ah)->ah_sh + (_reg));         \
-          mb(); });                                            \
-} while (0)
+        iowrite32((_val), (_ah)->ah_sh + (_reg)) :             \
+        iowrite32be((_val), (_ah)->ah_sh + (_reg));            \
+       } while (0)
+#define _OS_REG_READ(_ah, _reg)                                        \
+       ((0x4000 <= (_reg) && (_reg) < 0x5000) ?                \
+        ioread32((_ah)->ah_sh + (_reg)) :                      \
+        ioread32be((_ah)->ah_sh + (_reg)));
+# else /* AH_LITTLE_ENDIAN */
+#define _OS_REG_WRITE(_ah, _reg, _val) do {                    \
+       iowrite32(_val, (_ah)->ah_sh + (_reg));                 \
+       } while (0)
+#define _OS_REG_READ(_ah, _reg)                                        \
+       ioread32((_ah)->ah_sh + (_reg))
+       
+# endif /* AH_BYTE_ORDER */
+#else
+# if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
+#define _OS_REG_WRITE(_ah, _reg, _val) do {                    \
+        writel((0x4000 <= (_reg) && (_reg) < 0x5000) ?         \
+               (_val) : cpu_to_le32(_val),                     \
+               (_ah)->ah_sh + (_reg));                         \
+       } while (0)
 #define _OS_REG_READ(_ah, _reg)                                        \
        ((0x4000 <= (_reg) && (_reg) < 0x5000) ?                \
         readl((_ah)->ah_sh + (_reg)) :                         \
-        ({unsigned long __v = __raw_readl((_ah)->ah_sh +       \
-         (_reg)); mb(); __v; }))
-#else /* AH_LITTLE_ENDIAN */
+        cpu_to_le32(readl((_ah)->ah_sh + (_reg))))
+# else /* AH_LITTLE_ENDIAN */
 #define _OS_REG_WRITE(_ah, _reg, _val) do {                    \
        writel(_val, (_ah)->ah_sh + (_reg));                    \
-} while (0)
+       } while (0)
 #define _OS_REG_READ(_ah, _reg)                                        \
        readl((_ah)->ah_sh + (_reg))
-#endif /* AH_BYTE_ORDER */
+# endif /* AH_BYTE_ORDER */
+#endif /* KERNEL_VERSON(2,6,12) */
 
 /* 
 The functions in this section are not intended to be invoked by MadWifi driver