|
@@ -380,6 +380,9 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static DEFINE_MUTEX(nvm_mutex);
|
|
|
|
+static pid_t nvm_owner = -1;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* e1000_acquire_swflag_ich8lan - Acquire software control flag
|
|
* e1000_acquire_swflag_ich8lan - Acquire software control flag
|
|
* @hw: pointer to the HW structure
|
|
* @hw: pointer to the HW structure
|
|
@@ -393,6 +396,15 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
|
|
u32 extcnf_ctrl;
|
|
u32 extcnf_ctrl;
|
|
u32 timeout = PHY_CFG_TIMEOUT;
|
|
u32 timeout = PHY_CFG_TIMEOUT;
|
|
|
|
|
|
|
|
+ WARN_ON(preempt_count());
|
|
|
|
+
|
|
|
|
+ if (!mutex_trylock(&nvm_mutex)) {
|
|
|
|
+ WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n",
|
|
|
|
+ nvm_owner);
|
|
|
|
+ mutex_lock(&nvm_mutex);
|
|
|
|
+ }
|
|
|
|
+ nvm_owner = current->pid;
|
|
|
|
+
|
|
while (timeout) {
|
|
while (timeout) {
|
|
extcnf_ctrl = er32(EXTCNF_CTRL);
|
|
extcnf_ctrl = er32(EXTCNF_CTRL);
|
|
extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
|
|
extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
|
|
@@ -407,6 +419,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
|
|
|
|
|
|
if (!timeout) {
|
|
if (!timeout) {
|
|
hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
|
|
hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
|
|
|
|
+ nvm_owner = -1;
|
|
|
|
+ mutex_unlock(&nvm_mutex);
|
|
return -E1000_ERR_CONFIG;
|
|
return -E1000_ERR_CONFIG;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -428,6 +442,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
|
|
extcnf_ctrl = er32(EXTCNF_CTRL);
|
|
extcnf_ctrl = er32(EXTCNF_CTRL);
|
|
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
|
|
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
|
|
ew32(EXTCNF_CTRL, extcnf_ctrl);
|
|
ew32(EXTCNF_CTRL, extcnf_ctrl);
|
|
|
|
+
|
|
|
|
+ nvm_owner = -1;
|
|
|
|
+ mutex_unlock(&nvm_mutex);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|