diff options
author | adrian <adrian@FreeBSD.org> | 2012-04-19 03:26:21 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-04-19 03:26:21 +0000 |
commit | a1620c99050bae85bb7454bbd11131f9502802c6 (patch) | |
tree | f02242497240e491709337c0666dc44ebabfc20e /sys/dev | |
parent | 248502d7f08de3125e3e3cc808446294565ba5df (diff) | |
download | FreeBSD-src-a1620c99050bae85bb7454bbd11131f9502802c6.zip FreeBSD-src-a1620c99050bae85bb7454bbd11131f9502802c6.tar.gz |
Stop using the hardware register value byte order swapping for now,
at least until I can root cause what's going on.
The only platform I've seen this on is the AR9220 when attached to
the AR71xx CPUs. I get immediate PCIe bus errors and all subsequent
accesses cause further MIPS bus exceptions. I don't have any other
big-endian platforms to test this on.
If I get a chance (or two), I'll try to whack this on a bus analyser
and see exactly what happens.
I'd rather leave this on, especially for slower, embedded platforms.
But the #ifdef hell is something I'm trying to avoid.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ath/ah_osdep.c | 28 | ||||
-rw-r--r-- | sys/dev/ath/ah_osdep.h | 28 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5210/ar5210_reset.c | 8 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5211/ar5211_reset.c | 8 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5212/ar5212_reset.c | 7 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5312/ar5312_reset.c | 3 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416_reset.c | 7 |
7 files changed, 18 insertions, 71 deletions
diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c index 8e9adf7..5098632 100644 --- a/sys/dev/ath/ah_osdep.c +++ b/sys/dev/ath/ah_osdep.c @@ -267,12 +267,7 @@ ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) } if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); -#if _BYTE_ORDER == _BIG_ENDIAN - if (OS_REG_UNSWAPPED(reg)) - bus_space_write_4(tag, h, reg, val); - else -#endif - bus_space_write_stream_4(tag, h, reg, val); + bus_space_write_4(tag, h, reg, val); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); } @@ -286,12 +281,7 @@ ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); -#if _BYTE_ORDER == _BIG_ENDIAN - if (OS_REG_UNSWAPPED(reg)) - val = bus_space_read_4(tag, h, reg); - else -#endif - val = bus_space_read_stream_4(tag, h, reg); + val = bus_space_read_4(tag, h, reg); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); if (ath_hal_alq) { @@ -343,12 +333,7 @@ ath_hal_reg_write(struct ath_hal *ah, u_int32_t reg, u_int32_t val) if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); -#if _BYTE_ORDER == _BIG_ENDIAN - if (OS_REG_UNSWAPPED(reg)) - bus_space_write_4(tag, h, reg, val); - else -#endif - bus_space_write_stream_4(tag, h, reg, val); + bus_space_write_4(tag, h, reg, val); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); } @@ -362,12 +347,7 @@ ath_hal_reg_read(struct ath_hal *ah, u_int32_t reg) if (ah->ah_config.ah_serialise_reg_war) mtx_lock_spin(&ah_regser_mtx); -#if _BYTE_ORDER == _BIG_ENDIAN - if (OS_REG_UNSWAPPED(reg)) - val = bus_space_read_4(tag, h, reg); - else -#endif - val = bus_space_read_stream_4(tag, h, reg); + val = bus_space_read_4(tag, h, reg); if (ah->ah_config.ah_serialise_reg_war) mtx_unlock_spin(&ah_regser_mtx); return val; diff --git a/sys/dev/ath/ah_osdep.h b/sys/dev/ath/ah_osdep.h index 99b94c4..ce9ae29 100644 --- a/sys/dev/ath/ah_osdep.h +++ b/sys/dev/ath/ah_osdep.h @@ -97,39 +97,13 @@ struct ath_hal; extern void ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val); extern u_int32_t ath_hal_reg_read(struct ath_hal *ah, u_int reg); #else -/* - * The hardware registers are native little-endian byte order. - * Big-endian hosts are handled by enabling hardware byte-swap - * of register reads and writes at reset. But the PCI clock - * domain registers are not byte swapped! Thus, on big-endian - * platforms we have to explicitly byte-swap those registers. - * Most of this code is collapsed at compile time because the - * register values are constants. - */ -#if _BYTE_ORDER == _BIG_ENDIAN -#define OS_REG_WRITE(_ah, _reg, _val) do { \ - if (OS_REG_UNSWAPPED(_reg)) \ - bus_space_write_4((bus_space_tag_t)(_ah)->ah_st, \ - (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)); \ - else \ - bus_space_write_stream_4((bus_space_tag_t)(_ah)->ah_st, \ - (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)); \ -} while (0) -#define OS_REG_READ(_ah, _reg) \ - (OS_REG_UNSWAPPED(_reg) ? \ - bus_space_read_4((bus_space_tag_t)(_ah)->ah_st, \ - (bus_space_handle_t)(_ah)->ah_sh, (_reg)) : \ - bus_space_read_stream_4((bus_space_tag_t)(_ah)->ah_st, \ - (bus_space_handle_t)(_ah)->ah_sh, (_reg))) -#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ #define OS_REG_WRITE(_ah, _reg, _val) \ bus_space_write_4((bus_space_tag_t)(_ah)->ah_st, \ (bus_space_handle_t)(_ah)->ah_sh, (_reg), (_val)) #define OS_REG_READ(_ah, _reg) \ bus_space_read_4((bus_space_tag_t)(_ah)->ah_st, \ (bus_space_handle_t)(_ah)->ah_sh, (_reg)) -#endif /* _BYTE_ORDER */ -#endif /* AH_DEBUG || AH_REGFUNC || AH_DEBUG_ALQ */ +#endif #ifdef AH_DEBUG_ALQ extern void OS_MARK(struct ath_hal *, u_int id, u_int32_t value); diff --git a/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c b/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c index a798f84..7bec50e 100644 --- a/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c +++ b/sys/dev/ath/ath_hal/ar5210/ar5210_reset.c @@ -594,12 +594,10 @@ ar5210SetResetReg(struct ath_hal *ah, uint32_t resetMask, u_int delay) if ((resetMask & AR_RC_RMAC) == 0) { if (isBigEndian()) { /* - * Set CFG, little-endian for register - * and descriptor accesses. + * Set CFG, little-endian for descriptor accesses. */ - mask = INIT_CONFIG_STATUS | - AR_CFG_SWTD | AR_CFG_SWRD | AR_CFG_SWRG; - OS_REG_WRITE(ah, AR_CFG, LE_READ_4(&mask)); + mask = INIT_CONFIG_STATUS | AR_CFG_SWTD | AR_CFG_SWRD; + OS_REG_WRITE(ah, AR_CFG, mask); } else OS_REG_WRITE(ah, AR_CFG, INIT_CONFIG_STATUS); } diff --git a/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c b/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c index d250181..01e3967 100644 --- a/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c +++ b/sys/dev/ath/ath_hal/ar5211/ar5211_reset.c @@ -764,12 +764,10 @@ ar5211SetResetReg(struct ath_hal *ah, uint32_t resetMask) if ((resetMask & AR_RC_MAC) == 0) { if (isBigEndian()) { /* - * Set CFG, little-endian for register - * and descriptor accesses. + * Set CFG, little-endian for descriptor accesses. */ - mask = INIT_CONFIG_STATUS | - AR_CFG_SWTD | AR_CFG_SWRD | AR_CFG_SWRG; - OS_REG_WRITE(ah, AR_CFG, LE_READ_4(&mask)); + mask = INIT_CONFIG_STATUS | AR_CFG_SWTD | AR_CFG_SWRD; + OS_REG_WRITE(ah, AR_CFG, mask); } else OS_REG_WRITE(ah, AR_CFG, INIT_CONFIG_STATUS); } diff --git a/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c b/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c index 67076b8..412c64d 100644 --- a/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c +++ b/sys/dev/ath/ath_hal/ar5212/ar5212_reset.c @@ -1273,14 +1273,13 @@ ar5212SetResetReg(struct ath_hal *ah, uint32_t resetMask) if ((resetMask & AR_RC_MAC) == 0) { if (isBigEndian()) { /* - * Set CFG, little-endian for register - * and descriptor accesses. + * Set CFG, little-endian for descriptor accesses. */ - mask = INIT_CONFIG_STATUS | AR_CFG_SWRD | AR_CFG_SWRG; + mask = INIT_CONFIG_STATUS | AR_CFG_SWRD; #ifndef AH_NEED_DESC_SWAP mask |= AR_CFG_SWTD; #endif - OS_REG_WRITE(ah, AR_CFG, LE_READ_4(&mask)); + OS_REG_WRITE(ah, AR_CFG, mask); } else OS_REG_WRITE(ah, AR_CFG, INIT_CONFIG_STATUS); if (ar5212SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE)) diff --git a/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c b/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c index dda3faf..fdba35d 100644 --- a/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c +++ b/sys/dev/ath/ath_hal/ar5312/ar5312_reset.c @@ -740,8 +740,7 @@ ar5312SetResetReg(struct ath_hal *ah, uint32_t resetMask) if ((resetMask & AR_RC_MAC) == 0) { if (isBigEndian()) { /* - * Set CFG, little-endian for register - * and descriptor accesses. + * Set CFG, little-endian for descriptor accesses. */ #ifdef AH_NEED_DESC_SWAP mask = INIT_CONFIG_STATUS | AR_CFG_SWRD; diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c index f41bee8..1004f52 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c @@ -1387,16 +1387,15 @@ ar5416SetReset(struct ath_hal *ah, int type) if (type == HAL_RESET_COLD) { if (isBigEndian()) { /* - * Set CFG, little-endian for register - * and descriptor accesses. + * Set CFG, little-endian for descriptor accesses. */ - mask = INIT_CONFIG_STATUS | AR_CFG_SWRD | AR_CFG_SWRG; + mask = INIT_CONFIG_STATUS | AR_CFG_SWRD; #ifndef AH_NEED_DESC_SWAP mask |= AR_CFG_SWTD; #endif HALDEBUG(ah, HAL_DEBUG_RESET, "%s Applying descriptor swap\n", __func__); - OS_REG_WRITE(ah, AR_CFG, LE_READ_4(&mask)); + OS_REG_WRITE(ah, AR_CFG, mask); } else OS_REG_WRITE(ah, AR_CFG, INIT_CONFIG_STATUS); } |