diff options
Diffstat (limited to 'drivers/net/qlge/qlge_mpi.c')
-rw-r--r-- | drivers/net/qlge/qlge_mpi.c | 76 |
1 files changed, 76 insertions, 0 deletions
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 | ||
33 | int 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 | |||
33 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data) | 52 | int 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 | ||
750 | int 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. */ | ||
786 | int 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. |