aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorHiral Patel <hiral.patel@qlogic.com>2014-04-11 16:54:19 -0400
committerChristoph Hellwig <hch@lst.de>2014-05-19 07:31:01 -0400
commit4babb90e5744a56c01ce886cbed9a968a6258ba7 (patch)
tree34fcbe1b97fd1fbd66eafb4c9daef2cfa65c59e6 /drivers/scsi/qla2xxx
parent7095388f7eb2ff9fcd2ca17248a73de555f4d09b (diff)
qla2xxx: Track the process when the ROM_LOCK failure happens
Signed-off-by: Hiral Patel <hiral.patel@qlogic.com> Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c20
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.h3
2 files changed, 14 insertions, 9 deletions
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 3c5819ae451b..61774bc2bb62 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -860,13 +860,14 @@ qla82xx_rom_lock(struct qla_hw_data *ha)
860 } 860 }
861 timeout++; 861 timeout++;
862 } 862 }
863 qla82xx_wr_32(ha, QLA82XX_ROM_LOCK_ID, ROM_LOCK_DRIVER); 863 qla82xx_wr_32(ha, QLA82XX_ROM_LOCK_ID, ha->portnum);
864 return 0; 864 return 0;
865} 865}
866 866
867static void 867static void
868qla82xx_rom_unlock(struct qla_hw_data *ha) 868qla82xx_rom_unlock(struct qla_hw_data *ha)
869{ 869{
870 qla82xx_wr_32(ha, QLA82XX_ROM_LOCK_ID, 0xffffffff);
870 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK)); 871 qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK));
871} 872}
872 873
@@ -950,6 +951,7 @@ static int
950qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp) 951qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
951{ 952{
952 int ret, loops = 0; 953 int ret, loops = 0;
954 uint32_t lock_owner = 0;
953 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); 955 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
954 956
955 while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) { 957 while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) {
@@ -958,8 +960,10 @@ qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
958 loops++; 960 loops++;
959 } 961 }
960 if (loops >= 50000) { 962 if (loops >= 50000) {
963 lock_owner = qla82xx_rd_32(ha, QLA82XX_ROM_LOCK_ID);
961 ql_log(ql_log_fatal, vha, 0x00b9, 964 ql_log(ql_log_fatal, vha, 0x00b9,
962 "Failed to acquire SEM2 lock.\n"); 965 "Failed to acquire SEM2 lock, Lock Owner %u.\n",
966 lock_owner);
963 return -1; 967 return -1;
964 } 968 }
965 ret = qla82xx_do_rom_fast_read(ha, addr, valp); 969 ret = qla82xx_do_rom_fast_read(ha, addr, valp);
@@ -1057,6 +1061,7 @@ static int
1057ql82xx_rom_lock_d(struct qla_hw_data *ha) 1061ql82xx_rom_lock_d(struct qla_hw_data *ha)
1058{ 1062{
1059 int loops = 0; 1063 int loops = 0;
1064 uint32_t lock_owner = 0;
1060 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); 1065 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
1061 1066
1062 while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) { 1067 while ((qla82xx_rom_lock(ha) != 0) && (loops < 50000)) {
@@ -1065,8 +1070,9 @@ ql82xx_rom_lock_d(struct qla_hw_data *ha)
1065 loops++; 1070 loops++;
1066 } 1071 }
1067 if (loops >= 50000) { 1072 if (loops >= 50000) {
1073 lock_owner = qla82xx_rd_32(ha, QLA82XX_ROM_LOCK_ID);
1068 ql_log(ql_log_warn, vha, 0xb010, 1074 ql_log(ql_log_warn, vha, 0xb010,
1069 "ROM lock failed.\n"); 1075 "ROM lock failed, Lock Owner %u.\n", lock_owner);
1070 return -1; 1076 return -1;
1071 } 1077 }
1072 return 0; 1078 return 0;
@@ -2811,12 +2817,14 @@ static void
2811qla82xx_rom_lock_recovery(struct qla_hw_data *ha) 2817qla82xx_rom_lock_recovery(struct qla_hw_data *ha)
2812{ 2818{
2813 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev); 2819 scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
2820 uint32_t lock_owner = 0;
2814 2821
2815 if (qla82xx_rom_lock(ha)) 2822 if (qla82xx_rom_lock(ha)) {
2823 lock_owner = qla82xx_rd_32(ha, QLA82XX_ROM_LOCK_ID);
2816 /* Someone else is holding the lock. */ 2824 /* Someone else is holding the lock. */
2817 ql_log(ql_log_info, vha, 0xb022, 2825 ql_log(ql_log_info, vha, 0xb022,
2818 "Resetting rom_lock.\n"); 2826 "Resetting rom_lock, Lock Owner %u.\n", lock_owner);
2819 2827 }
2820 /* 2828 /*
2821 * Either we got the lock, or someone 2829 * Either we got the lock, or someone
2822 * else died while holding it. 2830 * else died while holding it.
diff --git a/drivers/scsi/qla2xxx/qla_nx.h b/drivers/scsi/qla2xxx/qla_nx.h
index d57f6fef53bb..d978a5d2e11b 100644
--- a/drivers/scsi/qla2xxx/qla_nx.h
+++ b/drivers/scsi/qla2xxx/qla_nx.h
@@ -333,9 +333,6 @@
333#define QLA82XX_ROMUSB_ROM_INSTR_OPCODE (ROMUSB_ROM + 0x0004) 333#define QLA82XX_ROMUSB_ROM_INSTR_OPCODE (ROMUSB_ROM + 0x0004)
334#define QLA82XX_ROMUSB_GLB_CAS_RST (ROMUSB_GLB + 0x0038) 334#define QLA82XX_ROMUSB_GLB_CAS_RST (ROMUSB_GLB + 0x0038)
335 335
336/* Lock IDs for ROM lock */
337#define ROM_LOCK_DRIVER 0x0d417340
338
339#define QLA82XX_PCI_CRB_WINDOWSIZE 0x00100000 /* all are 1MB windows */ 336#define QLA82XX_PCI_CRB_WINDOWSIZE 0x00100000 /* all are 1MB windows */
340#define QLA82XX_PCI_CRB_WINDOW(A) \ 337#define QLA82XX_PCI_CRB_WINDOW(A) \
341 (QLA82XX_PCI_CRBSPACE + (A)*QLA82XX_PCI_CRB_WINDOWSIZE) 338 (QLA82XX_PCI_CRBSPACE + (A)*QLA82XX_PCI_CRB_WINDOWSIZE)