aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-io.h
diff options
context:
space:
mode:
authorZhu, Yi <yi.zhu@intel.com>2008-12-05 10:58:41 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-12-12 13:48:22 -0500
commita8ec42c1431e8a43f910fb27af4882416cf5d6b1 (patch)
tree581d9ccaac55655f138f7aaa23701220377f6b0f /drivers/net/wireless/iwlwifi/iwl-io.h
parent73d7b5acc461bdc99e0135779d15e1874c6e00a6 (diff)
iwlwifi: use rmb/wmb to protect indirect mmio operation
This patch protects iwlwifi indirect mmio operations with rmb() and wmb(). It makes sure CPU reordering won't affect our indirect mmio access. Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-io.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h
index c56dc215fef7..10ca032f905e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-io.h
@@ -299,6 +299,7 @@ static inline int __iwl_poll_direct_bit(const char *f, u32 l,
299static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) 299static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg)
300{ 300{
301 _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); 301 _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
302 rmb();
302 return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); 303 return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
303} 304}
304#ifdef CONFIG_IWLWIFI_DEBUG 305#ifdef CONFIG_IWLWIFI_DEBUG
@@ -321,6 +322,7 @@ static inline void _iwl_write_prph(struct iwl_priv *priv,
321{ 322{
322 _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, 323 _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
323 ((addr & 0x0000FFFF) | (3 << 24))); 324 ((addr & 0x0000FFFF) | (3 << 24)));
325 wmb();
324 _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); 326 _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
325} 327}
326#ifdef CONFIG_IWLWIFI_DEBUG 328#ifdef CONFIG_IWLWIFI_DEBUG
@@ -383,12 +385,14 @@ static inline void iwl_clear_bits_prph(struct iwl_priv
383static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) 385static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr)
384{ 386{
385 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); 387 iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
388 rmb();
386 return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); 389 return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
387} 390}
388 391
389static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) 392static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val)
390{ 393{
391 iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 394 iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
395 wmb();
392 iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); 396 iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
393} 397}
394 398
@@ -396,6 +400,7 @@ static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr,
396 u32 len, u32 *values) 400 u32 len, u32 *values)
397{ 401{
398 iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 402 iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
403 wmb();
399 for (; 0 < len; len -= sizeof(u32), values++) 404 for (; 0 < len; len -= sizeof(u32), values++)
400 iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); 405 iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
401} 406}