diff options
author | Sucheta Chakraborty <sucheta.chakraborty@qlogic.com> | 2010-08-19 01:08:32 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-19 19:52:42 -0400 |
commit | 091754a1652fad24664f1357ee7616e66953dd30 (patch) | |
tree | d5ae44dbb7164a678c76c57c9530ca8681de45b8 | |
parent | d4066833bb1b35fefb1dd45eb2b10659d46bf151 (diff) |
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>
-rw-r--r-- | drivers/net/qlcnic/qlcnic_hw.c | 4 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_init.c | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c index 9d40ce05cb17..5e6f4864df94 100644 --- a/drivers/net/qlcnic/qlcnic_hw.c +++ b/drivers/net/qlcnic/qlcnic_hw.c | |||
@@ -297,8 +297,8 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) | |||
297 | break; | 297 | break; |
298 | if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) { | 298 | if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) { |
299 | dev_err(&adapter->pdev->dev, | 299 | dev_err(&adapter->pdev->dev, |
300 | "Failed to acquire sem=%d lock;reg_id=%d\n", | 300 | "Failed to acquire sem=%d lock; holdby=%d\n", |
301 | sem, id_reg); | 301 | sem, id_reg ? QLCRD32(adapter, id_reg) : -1); |
302 | return -EIO; | 302 | return -EIO; |
303 | } | 303 | } |
304 | msleep(1); | 304 | msleep(1); |
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) | |||
928 | return (bios_ver << 16) + ((bios_ver >> 8) & 0xff00) + (bios_ver >> 24); | 928 | return (bios_ver << 16) + ((bios_ver >> 8) & 0xff00) + (bios_ver >> 24); |
929 | } | 929 | } |
930 | 930 | ||
931 | static void qlcnic_rom_lock_recovery(struct qlcnic_adapter *adapter) | ||
932 | { | ||
933 | if (qlcnic_pcie_sem_lock(adapter, 2, QLCNIC_ROM_LOCK_ID)) | ||
934 | dev_info(&adapter->pdev->dev, "Resetting rom_lock\n"); | ||
935 | |||
936 | qlcnic_pcie_sem_unlock(adapter, 2); | ||
937 | } | ||
938 | |||
931 | int | 939 | int |
932 | qlcnic_need_fw_reset(struct qlcnic_adapter *adapter) | 940 | qlcnic_need_fw_reset(struct qlcnic_adapter *adapter) |
933 | { | 941 | { |
934 | u32 val, version, major, minor, build; | 942 | u32 val, version, major, minor, build; |
935 | 943 | ||
936 | if (adapter->need_fw_reset) | 944 | if (qlcnic_check_fw_status(adapter)) { |
945 | qlcnic_rom_lock_recovery(adapter); | ||
937 | return 1; | 946 | return 1; |
947 | } | ||
938 | 948 | ||
939 | if (qlcnic_check_fw_status(adapter)) | 949 | if (adapter->need_fw_reset) |
940 | return 1; | 950 | return 1; |
941 | 951 | ||
942 | /* check if we have got newer or different file firmware */ | 952 | /* check if we have got newer or different file firmware */ |