aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-io.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-io.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h
index 994f8bab0dab..d381b82a7598 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-io.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h
@@ -298,6 +298,7 @@ static inline int __iwl3945_poll_direct_bit(const char *f, u32 l,
298static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg) 298static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg)
299{ 299{
300 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); 300 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
301 rmb();
301 return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT); 302 return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
302} 303}
303#ifdef CONFIG_IWL3945_DEBUG 304#ifdef CONFIG_IWL3945_DEBUG
@@ -319,6 +320,7 @@ static inline void _iwl3945_write_prph(struct iwl3945_priv *priv,
319{ 320{
320 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR, 321 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
321 ((addr & 0x0000FFFF) | (3 << 24))); 322 ((addr & 0x0000FFFF) | (3 << 24)));
323 wmb();
322 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); 324 _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
323} 325}
324#ifdef CONFIG_IWL3945_DEBUG 326#ifdef CONFIG_IWL3945_DEBUG
@@ -380,12 +382,14 @@ static inline void iwl3945_clear_bits_prph(struct iwl3945_priv
380static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr) 382static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr)
381{ 383{
382 iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); 384 iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
385 rmb();
383 return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT); 386 return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
384} 387}
385 388
386static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val) 389static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val)
387{ 390{
388 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 391 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
392 wmb();
389 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); 393 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
390} 394}
391 395
@@ -393,6 +397,7 @@ static inline void iwl3945_write_targ_mem_buf(struct iwl3945_priv *priv, u32 add
393 u32 len, u32 *values) 397 u32 len, u32 *values)
394{ 398{
395 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); 399 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
400 wmb();
396 for (; 0 < len; len -= sizeof(u32), values++) 401 for (; 0 < len; len -= sizeof(u32), values++)
397 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); 402 iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
398} 403}
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}