diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_dbg.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dbg.c | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 2d9b12ffe09c..74e54713aa7c 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
@@ -28,7 +28,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
28 | uint16_t __iomem *dmp_reg; | 28 | uint16_t __iomem *dmp_reg; |
29 | unsigned long flags; | 29 | unsigned long flags; |
30 | struct qla2300_fw_dump *fw; | 30 | struct qla2300_fw_dump *fw; |
31 | uint32_t dump_size, data_ram_cnt; | 31 | uint32_t data_ram_cnt; |
32 | 32 | ||
33 | risc_address = data_ram_cnt = 0; | 33 | risc_address = data_ram_cnt = 0; |
34 | mb0 = mb2 = 0; | 34 | mb0 = mb2 = 0; |
@@ -37,23 +37,16 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
37 | if (!hardware_locked) | 37 | if (!hardware_locked) |
38 | spin_lock_irqsave(&ha->hardware_lock, flags); | 38 | spin_lock_irqsave(&ha->hardware_lock, flags); |
39 | 39 | ||
40 | if (ha->fw_dump != NULL) { | 40 | if (!ha->fw_dump) { |
41 | qla_printk(KERN_WARNING, ha, | 41 | qla_printk(KERN_WARNING, ha, |
42 | "Firmware has been previously dumped (%p) -- ignoring " | 42 | "No buffer available for dump!!!\n"); |
43 | "request...\n", ha->fw_dump); | ||
44 | goto qla2300_fw_dump_failed; | 43 | goto qla2300_fw_dump_failed; |
45 | } | 44 | } |
46 | 45 | ||
47 | /* Allocate (large) dump buffer. */ | 46 | if (ha->fw_dumped) { |
48 | dump_size = sizeof(struct qla2300_fw_dump); | ||
49 | dump_size += (ha->fw_memory_size - 0x11000) * sizeof(uint16_t); | ||
50 | ha->fw_dump_order = get_order(dump_size); | ||
51 | ha->fw_dump = (struct qla2300_fw_dump *) __get_free_pages(GFP_ATOMIC, | ||
52 | ha->fw_dump_order); | ||
53 | if (ha->fw_dump == NULL) { | ||
54 | qla_printk(KERN_WARNING, ha, | 47 | qla_printk(KERN_WARNING, ha, |
55 | "Unable to allocated memory for firmware dump (%d/%d).\n", | 48 | "Firmware has been previously dumped (%p) -- ignoring " |
56 | ha->fw_dump_order, dump_size); | 49 | "request...\n", ha->fw_dump); |
57 | goto qla2300_fw_dump_failed; | 50 | goto qla2300_fw_dump_failed; |
58 | } | 51 | } |
59 | fw = ha->fw_dump; | 52 | fw = ha->fw_dump; |
@@ -358,17 +351,16 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
358 | } | 351 | } |
359 | } | 352 | } |
360 | 353 | ||
361 | |||
362 | if (rval != QLA_SUCCESS) { | 354 | if (rval != QLA_SUCCESS) { |
363 | qla_printk(KERN_WARNING, ha, | 355 | qla_printk(KERN_WARNING, ha, |
364 | "Failed to dump firmware (%x)!!!\n", rval); | 356 | "Failed to dump firmware (%x)!!!\n", rval); |
357 | ha->fw_dumped = 0; | ||
365 | 358 | ||
366 | free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order); | ||
367 | ha->fw_dump = NULL; | ||
368 | } else { | 359 | } else { |
369 | qla_printk(KERN_INFO, ha, | 360 | qla_printk(KERN_INFO, ha, |
370 | "Firmware dump saved to temp buffer (%ld/%p).\n", | 361 | "Firmware dump saved to temp buffer (%ld/%p).\n", |
371 | ha->host_no, ha->fw_dump); | 362 | ha->host_no, ha->fw_dump); |
363 | ha->fw_dumped = 1; | ||
372 | } | 364 | } |
373 | 365 | ||
374 | qla2300_fw_dump_failed: | 366 | qla2300_fw_dump_failed: |
@@ -587,21 +579,16 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
587 | if (!hardware_locked) | 579 | if (!hardware_locked) |
588 | spin_lock_irqsave(&ha->hardware_lock, flags); | 580 | spin_lock_irqsave(&ha->hardware_lock, flags); |
589 | 581 | ||
590 | if (ha->fw_dump != NULL) { | 582 | if (!ha->fw_dump) { |
591 | qla_printk(KERN_WARNING, ha, | 583 | qla_printk(KERN_WARNING, ha, |
592 | "Firmware has been previously dumped (%p) -- ignoring " | 584 | "No buffer available for dump!!!\n"); |
593 | "request...\n", ha->fw_dump); | ||
594 | goto qla2100_fw_dump_failed; | 585 | goto qla2100_fw_dump_failed; |
595 | } | 586 | } |
596 | 587 | ||
597 | /* Allocate (large) dump buffer. */ | 588 | if (ha->fw_dumped) { |
598 | ha->fw_dump_order = get_order(sizeof(struct qla2100_fw_dump)); | ||
599 | ha->fw_dump = (struct qla2100_fw_dump *) __get_free_pages(GFP_ATOMIC, | ||
600 | ha->fw_dump_order); | ||
601 | if (ha->fw_dump == NULL) { | ||
602 | qla_printk(KERN_WARNING, ha, | 589 | qla_printk(KERN_WARNING, ha, |
603 | "Unable to allocated memory for firmware dump (%d/%Zd).\n", | 590 | "Firmware has been previously dumped (%p) -- ignoring " |
604 | ha->fw_dump_order, sizeof(struct qla2100_fw_dump)); | 591 | "request...\n", ha->fw_dump); |
605 | goto qla2100_fw_dump_failed; | 592 | goto qla2100_fw_dump_failed; |
606 | } | 593 | } |
607 | fw = ha->fw_dump; | 594 | fw = ha->fw_dump; |
@@ -777,13 +764,13 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
777 | if (rval != QLA_SUCCESS) { | 764 | if (rval != QLA_SUCCESS) { |
778 | qla_printk(KERN_WARNING, ha, | 765 | qla_printk(KERN_WARNING, ha, |
779 | "Failed to dump firmware (%x)!!!\n", rval); | 766 | "Failed to dump firmware (%x)!!!\n", rval); |
767 | ha->fw_dumped = 0; | ||
780 | 768 | ||
781 | free_pages((unsigned long)ha->fw_dump, ha->fw_dump_order); | ||
782 | ha->fw_dump = NULL; | ||
783 | } else { | 769 | } else { |
784 | qla_printk(KERN_INFO, ha, | 770 | qla_printk(KERN_INFO, ha, |
785 | "Firmware dump saved to temp buffer (%ld/%p).\n", | 771 | "Firmware dump saved to temp buffer (%ld/%p).\n", |
786 | ha->host_no, ha->fw_dump); | 772 | ha->host_no, ha->fw_dump); |
773 | ha->fw_dumped = 1; | ||
787 | } | 774 | } |
788 | 775 | ||
789 | qla2100_fw_dump_failed: | 776 | qla2100_fw_dump_failed: |
@@ -988,7 +975,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
988 | if (!hardware_locked) | 975 | if (!hardware_locked) |
989 | spin_lock_irqsave(&ha->hardware_lock, flags); | 976 | spin_lock_irqsave(&ha->hardware_lock, flags); |
990 | 977 | ||
991 | if (!ha->fw_dump24) { | 978 | if (!ha->fw_dump) { |
992 | qla_printk(KERN_WARNING, ha, | 979 | qla_printk(KERN_WARNING, ha, |
993 | "No buffer available for dump!!!\n"); | 980 | "No buffer available for dump!!!\n"); |
994 | goto qla24xx_fw_dump_failed; | 981 | goto qla24xx_fw_dump_failed; |
@@ -997,10 +984,10 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
997 | if (ha->fw_dumped) { | 984 | if (ha->fw_dumped) { |
998 | qla_printk(KERN_WARNING, ha, | 985 | qla_printk(KERN_WARNING, ha, |
999 | "Firmware has been previously dumped (%p) -- ignoring " | 986 | "Firmware has been previously dumped (%p) -- ignoring " |
1000 | "request...\n", ha->fw_dump24); | 987 | "request...\n", ha->fw_dump); |
1001 | goto qla24xx_fw_dump_failed; | 988 | goto qla24xx_fw_dump_failed; |
1002 | } | 989 | } |
1003 | fw = (struct qla24xx_fw_dump *) ha->fw_dump24; | 990 | fw = ha->fw_dump; |
1004 | 991 | ||
1005 | rval = QLA_SUCCESS; | 992 | rval = QLA_SUCCESS; |
1006 | fw->host_status = RD_REG_DWORD(®->host_status); | 993 | fw->host_status = RD_REG_DWORD(®->host_status); |
@@ -1654,7 +1641,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
1654 | } else { | 1641 | } else { |
1655 | qla_printk(KERN_INFO, ha, | 1642 | qla_printk(KERN_INFO, ha, |
1656 | "Firmware dump saved to temp buffer (%ld/%p).\n", | 1643 | "Firmware dump saved to temp buffer (%ld/%p).\n", |
1657 | ha->host_no, ha->fw_dump24); | 1644 | ha->host_no, ha->fw_dump); |
1658 | ha->fw_dumped = 1; | 1645 | ha->fw_dumped = 1; |
1659 | } | 1646 | } |
1660 | 1647 | ||
@@ -1672,7 +1659,7 @@ qla24xx_ascii_fw_dump(scsi_qla_host_t *ha) | |||
1672 | uint32_t ext_mem_cnt; | 1659 | uint32_t ext_mem_cnt; |
1673 | 1660 | ||
1674 | uiter = ha->fw_dump_buffer; | 1661 | uiter = ha->fw_dump_buffer; |
1675 | fw = ha->fw_dump24; | 1662 | fw = ha->fw_dump; |
1676 | 1663 | ||
1677 | qla_uprintf(&uiter, "ISP FW Version %d.%02d.%02d Attributes %04x\n", | 1664 | qla_uprintf(&uiter, "ISP FW Version %d.%02d.%02d Attributes %04x\n", |
1678 | ha->fw_major_version, ha->fw_minor_version, | 1665 | ha->fw_major_version, ha->fw_minor_version, |
@@ -1995,7 +1982,6 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd) | |||
1995 | return; | 1982 | return; |
1996 | 1983 | ||
1997 | printk(" sp flags=0x%x\n", sp->flags); | 1984 | printk(" sp flags=0x%x\n", sp->flags); |
1998 | printk(" state=%d\n", sp->state); | ||
1999 | } | 1985 | } |
2000 | 1986 | ||
2001 | void | 1987 | void |