diff options
author | Harish Zunjarrao <harish.zunjarrao@qlogic.com> | 2011-08-01 06:26:16 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-27 10:36:33 -0400 |
commit | 7c07d139cfec3172e813b468a8a173ad73bb5da9 (patch) | |
tree | b7c83b48845668b75d0efd4d7f4e3eb6fe8570e8 /drivers/scsi/qla4xxx/ql4_mbx.c | |
parent | 8b0402e1383cd51121f05a1d249cde0212c28c99 (diff) |
[SCSI] qla4xxx: Add read/update NVRAM support for 40xx adapters using BSG
Signed-off-by: Harish Zunjarrao <harish.zunjarrao@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_mbx.c')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_mbx.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index aec72309f60f..011c822f5ff6 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -1690,3 +1690,55 @@ int qla4xxx_get_ip_state(struct scsi_qla_host *ha, uint32_t acb_idx, | |||
1690 | memcpy(sts, mbox_sts, sizeof(mbox_sts)); | 1690 | memcpy(sts, mbox_sts, sizeof(mbox_sts)); |
1691 | return status; | 1691 | return status; |
1692 | } | 1692 | } |
1693 | |||
1694 | int qla4xxx_get_nvram(struct scsi_qla_host *ha, dma_addr_t nvram_dma, | ||
1695 | uint32_t offset, uint32_t size) | ||
1696 | { | ||
1697 | int status = QLA_SUCCESS; | ||
1698 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | ||
1699 | uint32_t mbox_sts[MBOX_REG_COUNT]; | ||
1700 | |||
1701 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
1702 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | ||
1703 | |||
1704 | mbox_cmd[0] = MBOX_CMD_GET_NVRAM; | ||
1705 | mbox_cmd[1] = LSDW(nvram_dma); | ||
1706 | mbox_cmd[2] = MSDW(nvram_dma); | ||
1707 | mbox_cmd[3] = offset; | ||
1708 | mbox_cmd[4] = size; | ||
1709 | |||
1710 | status = qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], | ||
1711 | &mbox_sts[0]); | ||
1712 | if (status != QLA_SUCCESS) { | ||
1713 | DEBUG2(ql4_printk(KERN_ERR, ha, "scsi%ld: %s: failed " | ||
1714 | "status %04X\n", ha->host_no, __func__, | ||
1715 | mbox_sts[0])); | ||
1716 | } | ||
1717 | return status; | ||
1718 | } | ||
1719 | |||
1720 | int qla4xxx_set_nvram(struct scsi_qla_host *ha, dma_addr_t nvram_dma, | ||
1721 | uint32_t offset, uint32_t size) | ||
1722 | { | ||
1723 | int status = QLA_SUCCESS; | ||
1724 | uint32_t mbox_cmd[MBOX_REG_COUNT]; | ||
1725 | uint32_t mbox_sts[MBOX_REG_COUNT]; | ||
1726 | |||
1727 | memset(&mbox_cmd, 0, sizeof(mbox_cmd)); | ||
1728 | memset(&mbox_sts, 0, sizeof(mbox_sts)); | ||
1729 | |||
1730 | mbox_cmd[0] = MBOX_CMD_SET_NVRAM; | ||
1731 | mbox_cmd[1] = LSDW(nvram_dma); | ||
1732 | mbox_cmd[2] = MSDW(nvram_dma); | ||
1733 | mbox_cmd[3] = offset; | ||
1734 | mbox_cmd[4] = size; | ||
1735 | |||
1736 | status = qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], | ||
1737 | &mbox_sts[0]); | ||
1738 | if (status != QLA_SUCCESS) { | ||
1739 | DEBUG2(ql4_printk(KERN_ERR, ha, "scsi%ld: %s: failed " | ||
1740 | "status %04X\n", ha->host_no, __func__, | ||
1741 | mbox_sts[0])); | ||
1742 | } | ||
1743 | return status; | ||
1744 | } | ||