Don't rely on the compiler optimizing out iowrite32be and ioread32be

Use a separate set of _OS_REG_WRITE and _OS_REG_READ macros for
little-endian systems.


git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3402 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
proski 2008-03-22 06:13:08 +00:00
parent ce589c7ae3
commit 545cf26ad4
1 changed files with 15 additions and 4 deletions

View File

@ -194,10 +194,6 @@ extern u_int32_t __ahdecl ath_hal_getuptime(struct ath_hal *);
*/
#if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
#define is_reg_le(__reg) ((0x4000 <= (__reg) && (__reg) < 0x5000))
#else
#define is_reg_le(__reg) 1
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
is_reg_le(_reg) ? \
@ -219,6 +215,21 @@ extern u_int32_t __ahdecl ath_hal_getuptime(struct ath_hal *);
readl((_ah)->ah_sh + (_reg)) : \
cpu_to_le32(readl((_ah)->ah_sh + (_reg))))
#endif /* KERNEL_VERSION(2,6,12) */
#else /* AH_BYTE_ORDER != AH_BIG_ENDIAN */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
#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))
#else
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
writel((_val), (_ah)->ah_sh + (_reg)); \
} while (0)
#define _OS_REG_READ(_ah, _reg) \
readl((_ah)->ah_sh + (_reg))
#endif /* KERNEL_VERSION(2,6,12) */
#endif /* AH_BYTE_ORDER != AH_BIG_ENDIAN */
/*
* The functions in this section are not intended to be invoked by MadWifi