aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2008-08-15 17:07:24 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-15 17:07:24 -0400
commit77b483f132ba25edf4ef455dd87a91ab7bbf4170 (patch)
tree8cb8f8444de1228cafed26784923e1045aba64c7 /drivers/net/tg3.c
parentc6153b5b77650879d78dec76414213c76dd8d574 (diff)
tg3: Add APE register access locking
If the driver resets the chip while the APE is performing a register access, that register access will never complete and the APE will hang indefinitely. To prevent this race condition, the driver must acquire an APE mutex before resetting the chip. The APE will not attempt a register access until it acquires this lock. Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index d2439b85a790..e3fd74b871a3 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -536,6 +536,7 @@ static int tg3_ape_lock(struct tg3 *tp, int locknum)
536 return 0; 536 return 0;
537 537
538 switch (locknum) { 538 switch (locknum) {
539 case TG3_APE_LOCK_GRC:
539 case TG3_APE_LOCK_MEM: 540 case TG3_APE_LOCK_MEM:
540 break; 541 break;
541 default: 542 default:
@@ -573,6 +574,7 @@ static void tg3_ape_unlock(struct tg3 *tp, int locknum)
573 return; 574 return;
574 575
575 switch (locknum) { 576 switch (locknum) {
577 case TG3_APE_LOCK_GRC:
576 case TG3_APE_LOCK_MEM: 578 case TG3_APE_LOCK_MEM:
577 break; 579 break;
578 default: 580 default:
@@ -5760,6 +5762,8 @@ static int tg3_chip_reset(struct tg3 *tp)
5760 5762
5761 tg3_mdio_stop(tp); 5763 tg3_mdio_stop(tp);
5762 5764
5765 tg3_ape_lock(tp, TG3_APE_LOCK_GRC);
5766
5763 /* No matching tg3_nvram_unlock() after this because 5767 /* No matching tg3_nvram_unlock() after this because
5764 * chip reset below will undo the nvram lock. 5768 * chip reset below will undo the nvram lock.
5765 */ 5769 */
@@ -5914,6 +5918,8 @@ static int tg3_chip_reset(struct tg3 *tp)
5914 5918
5915 tg3_mdio_start(tp); 5919 tg3_mdio_start(tp);
5916 5920
5921 tg3_ape_unlock(tp, TG3_APE_LOCK_GRC);
5922
5917 err = tg3_poll_fw(tp); 5923 err = tg3_poll_fw(tp);
5918 if (err) 5924 if (err)
5919 return err; 5925 return err;