aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_dbg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_dbg.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c96
1 files changed, 70 insertions, 26 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 510ba64bc286..1cf77772623b 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -9,7 +9,7 @@
9#include <linux/delay.h> 9#include <linux/delay.h>
10 10
11static inline void 11static inline void
12qla2xxx_prep_dump(scsi_qla_host_t *ha, struct qla2xxx_fw_dump *fw_dump) 12qla2xxx_prep_dump(struct qla_hw_data *ha, struct qla2xxx_fw_dump *fw_dump)
13{ 13{
14 fw_dump->fw_major_version = htonl(ha->fw_major_version); 14 fw_dump->fw_major_version = htonl(ha->fw_major_version);
15 fw_dump->fw_minor_version = htonl(ha->fw_minor_version); 15 fw_dump->fw_minor_version = htonl(ha->fw_minor_version);
@@ -23,22 +23,24 @@ qla2xxx_prep_dump(scsi_qla_host_t *ha, struct qla2xxx_fw_dump *fw_dump)
23} 23}
24 24
25static inline void * 25static inline void *
26qla2xxx_copy_queues(scsi_qla_host_t *ha, void *ptr) 26qla2xxx_copy_queues(struct qla_hw_data *ha, void *ptr)
27{ 27{
28 struct req_que *req = ha->req_q_map[0];
29 struct rsp_que *rsp = ha->rsp_q_map[0];
28 /* Request queue. */ 30 /* Request queue. */
29 memcpy(ptr, ha->request_ring, ha->request_q_length * 31 memcpy(ptr, req->ring, req->length *
30 sizeof(request_t)); 32 sizeof(request_t));
31 33
32 /* Response queue. */ 34 /* Response queue. */
33 ptr += ha->request_q_length * sizeof(request_t); 35 ptr += req->length * sizeof(request_t);
34 memcpy(ptr, ha->response_ring, ha->response_q_length * 36 memcpy(ptr, rsp->ring, rsp->length *
35 sizeof(response_t)); 37 sizeof(response_t));
36 38
37 return ptr + (ha->response_q_length * sizeof(response_t)); 39 return ptr + (rsp->length * sizeof(response_t));
38} 40}
39 41
40static int 42static int
41qla24xx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint32_t *ram, 43qla24xx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint32_t *ram,
42 uint32_t ram_dwords, void **nxt) 44 uint32_t ram_dwords, void **nxt)
43{ 45{
44 int rval; 46 int rval;
@@ -112,7 +114,7 @@ qla24xx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint32_t *ram,
112} 114}
113 115
114static int 116static int
115qla24xx_dump_memory(scsi_qla_host_t *ha, uint32_t *code_ram, 117qla24xx_dump_memory(struct qla_hw_data *ha, uint32_t *code_ram,
116 uint32_t cram_size, void **nxt) 118 uint32_t cram_size, void **nxt)
117{ 119{
118 int rval; 120 int rval;
@@ -163,7 +165,7 @@ qla24xx_pause_risc(struct device_reg_24xx __iomem *reg)
163} 165}
164 166
165static int 167static int
166qla24xx_soft_reset(scsi_qla_host_t *ha) 168qla24xx_soft_reset(struct qla_hw_data *ha)
167{ 169{
168 int rval = QLA_SUCCESS; 170 int rval = QLA_SUCCESS;
169 uint32_t cnt; 171 uint32_t cnt;
@@ -215,8 +217,8 @@ qla24xx_soft_reset(scsi_qla_host_t *ha)
215} 217}
216 218
217static int 219static int
218qla2xxx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint16_t *ram, 220qla2xxx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint16_t *ram,
219 uint32_t ram_words, void **nxt) 221 uint16_t ram_words, void **nxt)
220{ 222{
221 int rval; 223 int rval;
222 uint32_t cnt, stat, timer, words, idx; 224 uint32_t cnt, stat, timer, words, idx;
@@ -314,16 +316,17 @@ qla2xxx_read_window(struct device_reg_2xxx __iomem *reg, uint32_t count,
314 * @hardware_locked: Called with the hardware_lock 316 * @hardware_locked: Called with the hardware_lock
315 */ 317 */
316void 318void
317qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) 319qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
318{ 320{
319 int rval; 321 int rval;
320 uint32_t cnt; 322 uint32_t cnt;
321 323 struct qla_hw_data *ha = vha->hw;
322 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 324 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
323 uint16_t __iomem *dmp_reg; 325 uint16_t __iomem *dmp_reg;
324 unsigned long flags; 326 unsigned long flags;
325 struct qla2300_fw_dump *fw; 327 struct qla2300_fw_dump *fw;
326 void *nxt; 328 void *nxt;
329 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
327 330
328 flags = 0; 331 flags = 0;
329 332
@@ -468,7 +471,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
468 } else { 471 } else {
469 qla_printk(KERN_INFO, ha, 472 qla_printk(KERN_INFO, ha,
470 "Firmware dump saved to temp buffer (%ld/%p).\n", 473 "Firmware dump saved to temp buffer (%ld/%p).\n",
471 ha->host_no, ha->fw_dump); 474 base_vha->host_no, ha->fw_dump);
472 ha->fw_dumped = 1; 475 ha->fw_dumped = 1;
473 } 476 }
474 477
@@ -483,16 +486,18 @@ qla2300_fw_dump_failed:
483 * @hardware_locked: Called with the hardware_lock 486 * @hardware_locked: Called with the hardware_lock
484 */ 487 */
485void 488void
486qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked) 489qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
487{ 490{
488 int rval; 491 int rval;
489 uint32_t cnt, timer; 492 uint32_t cnt, timer;
490 uint16_t risc_address; 493 uint16_t risc_address;
491 uint16_t mb0, mb2; 494 uint16_t mb0, mb2;
495 struct qla_hw_data *ha = vha->hw;
492 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 496 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
493 uint16_t __iomem *dmp_reg; 497 uint16_t __iomem *dmp_reg;
494 unsigned long flags; 498 unsigned long flags;
495 struct qla2100_fw_dump *fw; 499 struct qla2100_fw_dump *fw;
500 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
496 501
497 risc_address = 0; 502 risc_address = 0;
498 mb0 = mb2 = 0; 503 mb0 = mb2 = 0;
@@ -673,7 +678,7 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
673 } else { 678 } else {
674 qla_printk(KERN_INFO, ha, 679 qla_printk(KERN_INFO, ha,
675 "Firmware dump saved to temp buffer (%ld/%p).\n", 680 "Firmware dump saved to temp buffer (%ld/%p).\n",
676 ha->host_no, ha->fw_dump); 681 base_vha->host_no, ha->fw_dump);
677 ha->fw_dumped = 1; 682 ha->fw_dumped = 1;
678 } 683 }
679 684
@@ -683,12 +688,12 @@ qla2100_fw_dump_failed:
683} 688}
684 689
685void 690void
686qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) 691qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
687{ 692{
688 int rval; 693 int rval;
689 uint32_t cnt; 694 uint32_t cnt;
690 uint32_t risc_address; 695 uint32_t risc_address;
691 696 struct qla_hw_data *ha = vha->hw;
692 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 697 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
693 uint32_t __iomem *dmp_reg; 698 uint32_t __iomem *dmp_reg;
694 uint32_t *iter_reg; 699 uint32_t *iter_reg;
@@ -697,6 +702,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
697 struct qla24xx_fw_dump *fw; 702 struct qla24xx_fw_dump *fw;
698 uint32_t ext_mem_cnt; 703 uint32_t ext_mem_cnt;
699 void *nxt; 704 void *nxt;
705 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
700 706
701 risc_address = ext_mem_cnt = 0; 707 risc_address = ext_mem_cnt = 0;
702 flags = 0; 708 flags = 0;
@@ -919,7 +925,7 @@ qla24xx_fw_dump_failed_0:
919 } else { 925 } else {
920 qla_printk(KERN_INFO, ha, 926 qla_printk(KERN_INFO, ha,
921 "Firmware dump saved to temp buffer (%ld/%p).\n", 927 "Firmware dump saved to temp buffer (%ld/%p).\n",
922 ha->host_no, ha->fw_dump); 928 base_vha->host_no, ha->fw_dump);
923 ha->fw_dumped = 1; 929 ha->fw_dumped = 1;
924 } 930 }
925 931
@@ -929,13 +935,14 @@ qla24xx_fw_dump_failed:
929} 935}
930 936
931void 937void
932qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) 938qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
933{ 939{
934 int rval; 940 int rval;
935 uint32_t cnt; 941 uint32_t cnt;
936 uint32_t risc_address; 942 uint32_t risc_address;
937 943 struct qla_hw_data *ha = vha->hw;
938 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 944 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
945 struct device_reg_25xxmq __iomem *reg25;
939 uint32_t __iomem *dmp_reg; 946 uint32_t __iomem *dmp_reg;
940 uint32_t *iter_reg; 947 uint32_t *iter_reg;
941 uint16_t __iomem *mbx_reg; 948 uint16_t __iomem *mbx_reg;
@@ -944,6 +951,11 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
944 uint32_t ext_mem_cnt; 951 uint32_t ext_mem_cnt;
945 void *nxt; 952 void *nxt;
946 struct qla2xxx_fce_chain *fcec; 953 struct qla2xxx_fce_chain *fcec;
954 struct qla2xxx_mq_chain *mq = NULL;
955 uint32_t qreg_size;
956 uint8_t req_cnt, rsp_cnt, que_cnt;
957 uint32_t que_idx;
958 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
947 959
948 risc_address = ext_mem_cnt = 0; 960 risc_address = ext_mem_cnt = 0;
949 flags = 0; 961 flags = 0;
@@ -988,6 +1000,29 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
988 fw->pcie_regs[1] = htonl(RD_REG_DWORD(dmp_reg++)); 1000 fw->pcie_regs[1] = htonl(RD_REG_DWORD(dmp_reg++));
989 fw->pcie_regs[2] = htonl(RD_REG_DWORD(dmp_reg)); 1001 fw->pcie_regs[2] = htonl(RD_REG_DWORD(dmp_reg));
990 fw->pcie_regs[3] = htonl(RD_REG_DWORD(&reg->iobase_window)); 1002 fw->pcie_regs[3] = htonl(RD_REG_DWORD(&reg->iobase_window));
1003
1004 /* Multi queue registers */
1005 if (ha->mqenable) {
1006 qreg_size = sizeof(struct qla2xxx_mq_chain);
1007 mq = kzalloc(qreg_size, GFP_KERNEL);
1008 if (!mq)
1009 goto qla25xx_fw_dump_failed_0;
1010 req_cnt = find_first_zero_bit(ha->req_qid_map, ha->max_queues);
1011 rsp_cnt = find_first_zero_bit(ha->rsp_qid_map, ha->max_queues);
1012 que_cnt = req_cnt > rsp_cnt ? req_cnt : rsp_cnt;
1013 mq->count = htonl(que_cnt);
1014 mq->chain_size = htonl(qreg_size);
1015 mq->type = __constant_htonl(DUMP_CHAIN_MQ);
1016 for (cnt = 0; cnt < que_cnt; cnt++) {
1017 reg25 = (struct device_reg_25xxmq *) ((void *)
1018 ha->mqiobase + cnt * QLA_QUE_PAGE);
1019 que_idx = cnt * 4;
1020 mq->qregs[que_idx] = htonl(reg25->req_q_in);
1021 mq->qregs[que_idx+1] = htonl(reg25->req_q_out);
1022 mq->qregs[que_idx+2] = htonl(reg25->rsp_q_in);
1023 mq->qregs[que_idx+3] = htonl(reg25->rsp_q_out);
1024 }
1025 }
991 WRT_REG_DWORD(&reg->iobase_window, 0x00); 1026 WRT_REG_DWORD(&reg->iobase_window, 0x00);
992 RD_REG_DWORD(&reg->iobase_window); 1027 RD_REG_DWORD(&reg->iobase_window);
993 1028
@@ -1225,7 +1260,14 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
1225 1260
1226 ha->fw_dump->version |= __constant_htonl(DUMP_CHAIN_VARIANT); 1261 ha->fw_dump->version |= __constant_htonl(DUMP_CHAIN_VARIANT);
1227 1262
1228 fcec = nxt + ntohl(ha->fw_dump->eft_size); 1263 if (ha->mqenable) {
1264 nxt = nxt + ntohl(ha->fw_dump->eft_size);
1265 memcpy(nxt, mq, qreg_size);
1266 kfree(mq);
1267 fcec = nxt + qreg_size;
1268 } else {
1269 fcec = nxt + ntohl(ha->fw_dump->eft_size);
1270 }
1229 fcec->type = __constant_htonl(DUMP_CHAIN_FCE | DUMP_CHAIN_LAST); 1271 fcec->type = __constant_htonl(DUMP_CHAIN_FCE | DUMP_CHAIN_LAST);
1230 fcec->chain_size = htonl(sizeof(struct qla2xxx_fce_chain) + 1272 fcec->chain_size = htonl(sizeof(struct qla2xxx_fce_chain) +
1231 fce_calc_size(ha->fce_bufs)); 1273 fce_calc_size(ha->fce_bufs));
@@ -1248,7 +1290,7 @@ qla25xx_fw_dump_failed_0:
1248 } else { 1290 } else {
1249 qla_printk(KERN_INFO, ha, 1291 qla_printk(KERN_INFO, ha,
1250 "Firmware dump saved to temp buffer (%ld/%p).\n", 1292 "Firmware dump saved to temp buffer (%ld/%p).\n",
1251 ha->host_no, ha->fw_dump); 1293 base_vha->host_no, ha->fw_dump);
1252 ha->fw_dumped = 1; 1294 ha->fw_dumped = 1;
1253 } 1295 }
1254 1296
@@ -1256,15 +1298,15 @@ qla25xx_fw_dump_failed:
1256 if (!hardware_locked) 1298 if (!hardware_locked)
1257 spin_unlock_irqrestore(&ha->hardware_lock, flags); 1299 spin_unlock_irqrestore(&ha->hardware_lock, flags);
1258} 1300}
1259
1260/****************************************************************************/ 1301/****************************************************************************/
1261/* Driver Debug Functions. */ 1302/* Driver Debug Functions. */
1262/****************************************************************************/ 1303/****************************************************************************/
1263 1304
1264void 1305void
1265qla2x00_dump_regs(scsi_qla_host_t *ha) 1306qla2x00_dump_regs(scsi_qla_host_t *vha)
1266{ 1307{
1267 int i; 1308 int i;
1309 struct qla_hw_data *ha = vha->hw;
1268 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; 1310 struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
1269 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; 1311 struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24;
1270 uint16_t __iomem *mbx_reg; 1312 uint16_t __iomem *mbx_reg;
@@ -1274,7 +1316,7 @@ qla2x00_dump_regs(scsi_qla_host_t *ha)
1274 1316
1275 printk("Mailbox registers:\n"); 1317 printk("Mailbox registers:\n");
1276 for (i = 0; i < 6; i++) 1318 for (i = 0; i < 6; i++)
1277 printk("scsi(%ld): mbox %d 0x%04x \n", ha->host_no, i, 1319 printk("scsi(%ld): mbox %d 0x%04x \n", vha->host_no, i,
1278 RD_REG_WORD(mbx_reg++)); 1320 RD_REG_WORD(mbx_reg++));
1279} 1321}
1280 1322
@@ -1302,3 +1344,5 @@ qla2x00_dump_buffer(uint8_t * b, uint32_t size)
1302 if (cnt % 16) 1344 if (cnt % 16)
1303 printk("\n"); 1345 printk("\n");
1304} 1346}
1347
1348