Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266684
b: refs/heads/master
c: a90b412
h: refs/heads/master
v: v3
  • Loading branch information
Bruce Allan authored and Jeff Kirsher committed Oct 16, 2011
1 parent 0005aa2 commit 3e47356
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 96cd8951684adaa5fd72952adef532d0b42f70e1
refs/heads/master: a90b412cb8c7ccc1689f9ea130883d00a1f0a5bb
1 change: 1 addition & 0 deletions trunk/drivers/net/ethernet/intel/e1000e/e1000.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ struct e1000_info {
enum e1000_state_t {
__E1000_TESTING,
__E1000_RESETTING,
__E1000_ACCESS_SHARED_RESOURCE,
__E1000_DOWN
};

Expand Down
21 changes: 13 additions & 8 deletions trunk/drivers/net/ethernet/intel/e1000e/ich8lan.c
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,6 @@ static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
mutex_unlock(&nvm_mutex);
}

static DEFINE_MUTEX(swflag_mutex);

/**
* e1000_acquire_swflag_ich8lan - Acquire software control flag
* @hw: pointer to the HW structure
Expand All @@ -866,7 +864,12 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
u32 extcnf_ctrl, timeout = PHY_CFG_TIMEOUT;
s32 ret_val = 0;

mutex_lock(&swflag_mutex);
if (test_and_set_bit(__E1000_ACCESS_SHARED_RESOURCE,
&hw->adapter->state)) {
WARN(1, "e1000e: %s: contention for Phy access\n",
hw->adapter->netdev->name);
return -E1000_ERR_PHY;
}

while (timeout) {
extcnf_ctrl = er32(EXTCNF_CTRL);
Expand All @@ -878,7 +881,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
}

if (!timeout) {
e_dbg("SW/FW/HW has locked the resource for too long.\n");
e_dbg("SW has already locked the resource.\n");
ret_val = -E1000_ERR_CONFIG;
goto out;
}
Expand All @@ -898,7 +901,9 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
}

if (!timeout) {
e_dbg("Failed to acquire the semaphore.\n");
e_dbg("Failed to acquire the semaphore, FW or HW has it: "
"FWSM=0x%8.8x EXTCNF_CTRL=0x%8.8x)\n",
er32(FWSM), extcnf_ctrl);
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
ew32(EXTCNF_CTRL, extcnf_ctrl);
ret_val = -E1000_ERR_CONFIG;
Expand All @@ -907,7 +912,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)

out:
if (ret_val)
mutex_unlock(&swflag_mutex);
clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state);

return ret_val;
}
Expand All @@ -932,7 +937,7 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
e_dbg("Semaphore unexpectedly released by sw/fw/hw\n");
}

mutex_unlock(&swflag_mutex);
clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state);
}

/**
Expand Down Expand Up @@ -3139,7 +3144,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
msleep(20);

if (!ret_val)
mutex_unlock(&swflag_mutex);
clear_bit(__E1000_ACCESS_SHARED_RESOURCE, &hw->adapter->state);

if (ctrl & E1000_CTRL_PHY_RST) {
ret_val = hw->phy.ops.get_cfg_done(hw);
Expand Down

0 comments on commit 3e47356

Please sign in to comment.