aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_mbx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla4xxx/ql4_mbx.c')
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c52
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
1694int 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
1720int 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}