Commit 091754a1 authored by Sucheta Chakraborty's avatar Sucheta Chakraborty Committed by David S. Miller

qlcnic: rom lock recovery

Fw can get stuck while holding pci semaphore. Driver will not
be able to perform fw initialization, without this lock.
Release semaphore forcefully in that case.
Signed-off-by: default avatarSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d4066833
...@@ -297,8 +297,8 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) ...@@ -297,8 +297,8 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg)
break; break;
if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) { if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Failed to acquire sem=%d lock;reg_id=%d\n", "Failed to acquire sem=%d lock; holdby=%d\n",
sem, id_reg); sem, id_reg ? QLCRD32(adapter, id_reg) : -1);
return -EIO; return -EIO;
} }
msleep(1); msleep(1);
......
...@@ -928,15 +928,25 @@ qlcnic_get_bios_version(struct qlcnic_adapter *adapter) ...@@ -928,15 +928,25 @@ qlcnic_get_bios_version(struct qlcnic_adapter *adapter)
return (bios_ver << 16) + ((bios_ver >> 8) & 0xff00) + (bios_ver >> 24); return (bios_ver << 16) + ((bios_ver >> 8) & 0xff00) + (bios_ver >> 24);
} }
static void qlcnic_rom_lock_recovery(struct qlcnic_adapter *adapter)
{
if (qlcnic_pcie_sem_lock(adapter, 2, QLCNIC_ROM_LOCK_ID))
dev_info(&adapter->pdev->dev, "Resetting rom_lock\n");
qlcnic_pcie_sem_unlock(adapter, 2);
}
int int
qlcnic_need_fw_reset(struct qlcnic_adapter *adapter) qlcnic_need_fw_reset(struct qlcnic_adapter *adapter)
{ {
u32 val, version, major, minor, build; u32 val, version, major, minor, build;
if (adapter->need_fw_reset) if (qlcnic_check_fw_status(adapter)) {
qlcnic_rom_lock_recovery(adapter);
return 1; return 1;
}
if (qlcnic_check_fw_status(adapter)) if (adapter->need_fw_reset)
return 1; return 1;
/* check if we have got newer or different file firmware */ /* check if we have got newer or different file firmware */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment