aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx/ql4_mbx.c
diff options
context:
space:
mode:
authorAdheer Chandravanshi <adheer.chandravanshi@qlogic.com>2013-09-17 07:54:47 -0400
committerJames Bottomley <JBottomley@Parallels.com>2013-10-25 04:58:01 -0400
commitb1d0b63f99300c0bd8b3fa9c8058fcd9529e294f (patch)
treef370d12d1f75bc2dbd06b835753aa47c894cadb3 /drivers/scsi/qla4xxx/ql4_mbx.c
parent946ac571584d95e4f6ba0978bb84b4920ecba40b (diff)
[SCSI] qla4xxx: Use offset based on adapter type to set CHAP entry in flash
To write a CHAP entry in adapter's flash calculate the offset based on the type of adapter. Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com> Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> 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.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 5eef7d1aaa86..121be4298d4c 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1537,6 +1537,7 @@ static int qla4xxx_set_chap(struct scsi_qla_host *ha, char *username,
1537 int rval = QLA_ERROR; 1537 int rval = QLA_ERROR;
1538 uint32_t offset = 0; 1538 uint32_t offset = 0;
1539 struct ql4_chap_table *chap_table; 1539 struct ql4_chap_table *chap_table;
1540 uint32_t chap_size = 0;
1540 dma_addr_t chap_dma; 1541 dma_addr_t chap_dma;
1541 1542
1542 chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma); 1543 chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
@@ -1554,7 +1555,20 @@ static int qla4xxx_set_chap(struct scsi_qla_host *ha, char *username,
1554 strncpy(chap_table->secret, password, MAX_CHAP_SECRET_LEN); 1555 strncpy(chap_table->secret, password, MAX_CHAP_SECRET_LEN);
1555 strncpy(chap_table->name, username, MAX_CHAP_NAME_LEN); 1556 strncpy(chap_table->name, username, MAX_CHAP_NAME_LEN);
1556 chap_table->cookie = __constant_cpu_to_le16(CHAP_VALID_COOKIE); 1557 chap_table->cookie = __constant_cpu_to_le16(CHAP_VALID_COOKIE);
1557 offset = FLASH_CHAP_OFFSET | (idx * sizeof(struct ql4_chap_table)); 1558
1559 if (is_qla40XX(ha)) {
1560 chap_size = MAX_CHAP_ENTRIES_40XX * sizeof(*chap_table);
1561 offset = FLASH_CHAP_OFFSET;
1562 } else { /* Single region contains CHAP info for both ports which is
1563 * divided into half for each port.
1564 */
1565 chap_size = ha->hw.flt_chap_size / 2;
1566 offset = FLASH_RAW_ACCESS_ADDR + (ha->hw.flt_region_chap << 2);
1567 if (ha->port_num == 1)
1568 offset += chap_size;
1569 }
1570
1571 offset += (idx * sizeof(struct ql4_chap_table));
1558 rval = qla4xxx_set_flash(ha, chap_dma, offset, 1572 rval = qla4xxx_set_flash(ha, chap_dma, offset,
1559 sizeof(struct ql4_chap_table), 1573 sizeof(struct ql4_chap_table),
1560 FLASH_OPT_RMW_COMMIT); 1574 FLASH_OPT_RMW_COMMIT);