summaryrefslogtreecommitdiff
path: root/drivers/net/qlcnic/qlcnic_init.c
diff options
context:
space:
mode:
authorSucheta Chakraborty <sucheta.chakraborty@qlogic.com>2010-08-19 09:08:32 +0400
committerDavid S. Miller <davem@davemloft.net>2010-08-20 03:52:42 +0400
commit091754a1652fad24664f1357ee7616e66953dd30 (patch)
treed5ae44dbb7164a678c76c57c9530ca8681de45b8 /drivers/net/qlcnic/qlcnic_init.c
parentd4066833bb1b35fefb1dd45eb2b10659d46bf151 (diff)
downloadlinux-091754a1652fad24664f1357ee7616e66953dd30.tar.xz
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: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_init.c')
-rw-r--r--drivers/net/qlcnic/qlcnic_init.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index e7a399f90326..a174521daa63 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -928,15 +928,25 @@ qlcnic_get_bios_version(struct qlcnic_adapter *adapter)
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
qlcnic_need_fw_reset(struct qlcnic_adapter *adapter)
{
u32 val, version, major, minor, build;
- if (adapter->need_fw_reset)
+ if (qlcnic_check_fw_status(adapter)) {
+ qlcnic_rom_lock_recovery(adapter);
return 1;
+ }
- if (qlcnic_check_fw_status(adapter))
+ if (adapter->need_fw_reset)
return 1;
/* check if we have got newer or different file firmware */