aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/qlge')
-rw-r--r--drivers/net/qlge/qlge.h3
-rw-r--r--drivers/net/qlge/qlge_dbg.c35
-rw-r--r--drivers/net/qlge/qlge_mpi.c76
3 files changed, 114 insertions, 0 deletions
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index bbdd388aa9b7..05feb03e9da6 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -2225,6 +2225,9 @@ int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data);
2225int ql_write_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 data); 2225int ql_write_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 data);
2226int ql_unpause_mpi_risc(struct ql_adapter *qdev); 2226int ql_unpause_mpi_risc(struct ql_adapter *qdev);
2227int ql_pause_mpi_risc(struct ql_adapter *qdev); 2227int ql_pause_mpi_risc(struct ql_adapter *qdev);
2228int ql_hard_reset_mpi_risc(struct ql_adapter *qdev);
2229int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf,
2230 u32 ram_addr, int word_count);
2228int ql_core_dump(struct ql_adapter *qdev, 2231int ql_core_dump(struct ql_adapter *qdev,
2229 struct ql_mpi_coredump *mpi_coredump); 2232 struct ql_mpi_coredump *mpi_coredump);
2230int ql_mb_about_fw(struct ql_adapter *qdev); 2233int ql_mb_about_fw(struct ql_adapter *qdev);
diff --git a/drivers/net/qlge/qlge_dbg.c b/drivers/net/qlge/qlge_dbg.c
index 913ca1e10e3e..833cfd7a22c1 100644
--- a/drivers/net/qlge/qlge_dbg.c
+++ b/drivers/net/qlge/qlge_dbg.c
@@ -647,6 +647,41 @@ int ql_core_dump(struct ql_adapter *qdev, struct ql_mpi_coredump *mpi_coredump)
647 "Failed RISC unpause. Status = 0x%.08x\n", status); 647 "Failed RISC unpause. Status = 0x%.08x\n", status);
648 goto err; 648 goto err;
649 } 649 }
650
651 /* Reset the RISC so we can dump RAM */
652 status = ql_hard_reset_mpi_risc(qdev);
653 if (status) {
654 QPRINTK(qdev, DRV, ERR,
655 "Failed RISC reset. Status = 0x%.08x\n", status);
656 goto err;
657 }
658
659 ql_build_coredump_seg_header(&mpi_coredump->code_ram_seg_hdr,
660 WCS_RAM_SEG_NUM,
661 sizeof(struct mpi_coredump_segment_header)
662 + sizeof(mpi_coredump->code_ram),
663 "WCS RAM");
664 status = ql_dump_risc_ram_area(qdev, &mpi_coredump->code_ram[0],
665 CODE_RAM_ADDR, CODE_RAM_CNT);
666 if (status) {
667 QPRINTK(qdev, DRV, ERR,
668 "Failed Dump of CODE RAM. Status = 0x%.08x\n", status);
669 goto err;
670 }
671
672 /* Insert the segment header */
673 ql_build_coredump_seg_header(&mpi_coredump->memc_ram_seg_hdr,
674 MEMC_RAM_SEG_NUM,
675 sizeof(struct mpi_coredump_segment_header)
676 + sizeof(mpi_coredump->memc_ram),
677 "MEMC RAM");
678 status = ql_dump_risc_ram_area(qdev, &mpi_coredump->memc_ram[0],
679 MEMC_RAM_ADDR, MEMC_RAM_CNT);
680 if (status) {
681 QPRINTK(qdev, DRV, ERR,
682 "Failed Dump of MEMC RAM. Status = 0x%.08x\n", status);
683 goto err;
684 }
650err: 685err:
651 ql_sem_unlock(qdev, SEM_PROC_REG_MASK); /* does flush too */ 686 ql_sem_unlock(qdev, SEM_PROC_REG_MASK); /* does flush too */
652 return status; 687 return status;
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c
index 242b1ea955e4..3304eb7df581 100644
--- a/drivers/net/qlge/qlge_mpi.c
+++ b/drivers/net/qlge/qlge_mpi.c
@@ -30,6 +30,25 @@ int ql_pause_mpi_risc(struct ql_adapter *qdev)
30 return (count == 0) ? -ETIMEDOUT : 0; 30 return (count == 0) ? -ETIMEDOUT : 0;
31} 31}
32 32
33int ql_hard_reset_mpi_risc(struct ql_adapter *qdev)
34{
35 u32 tmp;
36 int count = UDELAY_COUNT;
37
38 /* Reset the RISC */
39 ql_write32(qdev, CSR, CSR_CMD_SET_RST);
40 do {
41 tmp = ql_read32(qdev, CSR);
42 if (tmp & CSR_RR) {
43 ql_write32(qdev, CSR, CSR_CMD_CLR_RST);
44 break;
45 }
46 mdelay(UDELAY_DELAY);
47 count--;
48 } while (count);
49 return (count == 0) ? -ETIMEDOUT : 0;
50}
51
33int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data) 52int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data)
34{ 53{
35 int status; 54 int status;
@@ -728,6 +747,63 @@ int ql_mb_set_port_cfg(struct ql_adapter *qdev)
728 return status; 747 return status;
729} 748}
730 749
750int ql_mb_dump_ram(struct ql_adapter *qdev, u64 req_dma, u32 addr,
751 u32 size)
752{
753 int status = 0;
754 struct mbox_params mbc;
755 struct mbox_params *mbcp = &mbc;
756
757 memset(mbcp, 0, sizeof(struct mbox_params));
758
759 mbcp->in_count = 9;
760 mbcp->out_count = 1;
761
762 mbcp->mbox_in[0] = MB_CMD_DUMP_RISC_RAM;
763 mbcp->mbox_in[1] = LSW(addr);
764 mbcp->mbox_in[2] = MSW(req_dma);
765 mbcp->mbox_in[3] = LSW(req_dma);
766 mbcp->mbox_in[4] = MSW(size);
767 mbcp->mbox_in[5] = LSW(size);
768 mbcp->mbox_in[6] = MSW(MSD(req_dma));
769 mbcp->mbox_in[7] = LSW(MSD(req_dma));
770 mbcp->mbox_in[8] = MSW(addr);
771
772
773 status = ql_mailbox_command(qdev, mbcp);
774 if (status)
775 return status;
776
777 if (mbcp->mbox_out[0] != MB_CMD_STS_GOOD) {
778 QPRINTK(qdev, DRV, ERR,
779 "Failed to dump risc RAM.\n");
780 status = -EIO;
781 }
782 return status;
783}
784
785/* Issue a mailbox command to dump RISC RAM. */
786int ql_dump_risc_ram_area(struct ql_adapter *qdev, void *buf,
787 u32 ram_addr, int word_count)
788{
789 int status;
790 char *my_buf;
791 dma_addr_t buf_dma;
792
793 my_buf = pci_alloc_consistent(qdev->pdev, word_count * sizeof(u32),
794 &buf_dma);
795 if (!my_buf)
796 return -EIO;
797
798 status = ql_mb_dump_ram(qdev, buf_dma, ram_addr, word_count);
799 if (!status)
800 memcpy(buf, my_buf, word_count * sizeof(u32));
801
802 pci_free_consistent(qdev->pdev, word_count * sizeof(u32), my_buf,
803 buf_dma);
804 return status;
805}
806
731/* Get link settings and maximum frame size settings 807/* Get link settings and maximum frame size settings
732 * for the current port. 808 * for the current port.
733 * Most likely will block. 809 * Most likely will block.