diff options
author | Emil Tantilov <emil.s.tantilov@intel.com> | 2011-04-07 21:23:59 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2011-05-14 20:57:01 -0400 |
commit | 51275d37a85bc82bda7e5b179ee520e85e66e782 (patch) | |
tree | 6afdbc235bc8314473de415c2a56760b69f3e769 | |
parent | a1cbb15c13971bd5d41626e9e5ced9f9de132c47 (diff) |
ixgbe: force unlock on timeout
The semaphore can be in locked state upon driver load, particularly
on 82598 if a machine is rebooted due to panic and the semaphore was
acquired just prior to the panic.
This patch unlocks the semaphore if it times out.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ixgbe/ixgbe_common.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c index c4730cd39b22..b894b42a741c 100644 --- a/drivers/net/ixgbe/ixgbe_common.c +++ b/drivers/net/ixgbe/ixgbe_common.c | |||
@@ -1189,6 +1189,28 @@ static s32 ixgbe_get_eeprom_semaphore(struct ixgbe_hw *hw) | |||
1189 | udelay(50); | 1189 | udelay(50); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | if (i == timeout) { | ||
1193 | hw_dbg(hw, "Driver can't access the Eeprom - SMBI Semaphore " | ||
1194 | "not granted.\n"); | ||
1195 | /* | ||
1196 | * this release is particularly important because our attempts | ||
1197 | * above to get the semaphore may have succeeded, and if there | ||
1198 | * was a timeout, we should unconditionally clear the semaphore | ||
1199 | * bits to free the driver to make progress | ||
1200 | */ | ||
1201 | ixgbe_release_eeprom_semaphore(hw); | ||
1202 | |||
1203 | udelay(50); | ||
1204 | /* | ||
1205 | * one last try | ||
1206 | * If the SMBI bit is 0 when we read it, then the bit will be | ||
1207 | * set and we have the semaphore | ||
1208 | */ | ||
1209 | swsm = IXGBE_READ_REG(hw, IXGBE_SWSM); | ||
1210 | if (!(swsm & IXGBE_SWSM_SMBI)) | ||
1211 | status = 0; | ||
1212 | } | ||
1213 | |||
1192 | /* Now get the semaphore between SW/FW through the SWESMBI bit */ | 1214 | /* Now get the semaphore between SW/FW through the SWESMBI bit */ |
1193 | if (status == 0) { | 1215 | if (status == 0) { |
1194 | for (i = 0; i < timeout; i++) { | 1216 | for (i = 0; i < timeout; i++) { |