From 6434080b127088606e03d2ecfe5ffdd797e38d63 Mon Sep 17 00:00:00 2001 From: Shyam Sundar Date: Wed, 6 Oct 2010 22:49:40 -0700 Subject: [SCSI] qla4xxx: Add support for 8130/8131 AENs. AEN 8130 Corresponds to an event representing the insertion (detection) of a transceiver. It also reports the type of the SFP+. AEN 8131 corresponds to the removal of a transceiver. Signed-off-by: Vikas Chaudhary Signed-off-by: Shyam Sundar Signed-off-by: Ravi Anand Reviewed-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/qla4xxx/ql4_fw.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/scsi/qla4xxx/ql4_fw.h') diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h index 0336c6db8cb..d65dac4fe4d 100644 --- a/drivers/scsi/qla4xxx/ql4_fw.h +++ b/drivers/scsi/qla4xxx/ql4_fw.h @@ -416,6 +416,8 @@ struct qla_flt_region { #define MBOX_ASTS_IPV6_ND_PREFIX_IGNORED 0x802C #define MBOX_ASTS_IPV6_LCL_PREFIX_IGNORED 0x802D #define MBOX_ASTS_ICMPV6_ERROR_MSG_RCVD 0x802E +#define MBOX_ASTS_TXSCVR_INSERTED 0x8130 +#define MBOX_ASTS_TXSCVR_REMOVED 0x8131 #define ISNS_EVENT_DATA_RECEIVED 0x0000 #define ISNS_EVENT_CONNECTION_OPENED 0x0001 -- cgit v1.2.3-70-g09d2 From 2657c800dbb24761097ef341dfa43672c08a7a9e Mon Sep 17 00:00:00 2001 From: Shyam Sundar Date: Wed, 6 Oct 2010 22:50:29 -0700 Subject: [SCSI] qla4xxx: use CRB Register for Request Queue in-pointer Switching from doorbell mechanism to CRB register based Signed-off-by: Vikas Chaudhary Signed-off-by: Shyam Sundar Signed-off-by: Ravi Anand Reviewed-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/qla4xxx/ql4_fw.h | 1 + drivers/scsi/qla4xxx/ql4_iocb.c | 10 +--------- drivers/scsi/qla4xxx/ql4_mbx.c | 9 +++++++++ drivers/scsi/qla4xxx/ql4_nx.h | 2 ++ drivers/scsi/qla4xxx/ql4_os.c | 24 +++--------------------- 5 files changed, 16 insertions(+), 30 deletions(-) (limited to 'drivers/scsi/qla4xxx/ql4_fw.h') diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h index d65dac4fe4d..5e757d7fff7 100644 --- a/drivers/scsi/qla4xxx/ql4_fw.h +++ b/drivers/scsi/qla4xxx/ql4_fw.h @@ -448,6 +448,7 @@ struct addr_ctrl_blk { #define FWOPT_SESSION_MODE 0x0040 #define FWOPT_INITIATOR_MODE 0x0020 #define FWOPT_TARGET_MODE 0x0010 +#define FWOPT_ENABLE_CRBDB 0x8000 uint16_t exec_throttle; /* 04-05 */ uint8_t zio_count; /* 06 */ diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c index 4ef9ba112ee..5ae49fd8784 100644 --- a/drivers/scsi/qla4xxx/ql4_iocb.c +++ b/drivers/scsi/qla4xxx/ql4_iocb.c @@ -202,19 +202,11 @@ static void qla4xxx_build_scsi_iocbs(struct srb *srb, void qla4_8xxx_queue_iocb(struct scsi_qla_host *ha) { uint32_t dbval = 0; - unsigned long wtime; dbval = 0x14 | (ha->func_num << 5); dbval = dbval | (0 << 8) | (ha->request_in << 16); - writel(dbval, (unsigned long __iomem *)ha->nx_db_wr_ptr); - wmb(); - wtime = jiffies + (2 * HZ); - while (readl((void __iomem *)ha->nx_db_rd_ptr) != dbval && - !time_after_eq(jiffies, wtime)) { - writel(dbval, (unsigned long __iomem *)ha->nx_db_wr_ptr); - wmb(); - } + qla4_8xxx_wr_32(ha, ha->nx_db_wr_ptr, ha->request_in); } /** diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index 494a28f0dc1..2d2f9c879bf 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c @@ -299,6 +299,10 @@ qla4xxx_set_ifcb(struct scsi_qla_host *ha, uint32_t *mbox_cmd, { memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT); memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT); + + if (is_qla8022(ha)) + qla4_8xxx_wr_32(ha, ha->nx_db_wr_ptr, 0); + mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE; mbox_cmd[1] = 0; mbox_cmd[2] = LSDW(init_fw_cb_dma); @@ -472,6 +476,11 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha) init_fw_cb->fw_options |= __constant_cpu_to_le16(FWOPT_SESSION_MODE | FWOPT_INITIATOR_MODE); + + if (is_qla8022(ha)) + init_fw_cb->fw_options |= + __constant_cpu_to_le16(FWOPT_ENABLE_CRBDB); + init_fw_cb->fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE); if (qla4xxx_set_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) diff --git a/drivers/scsi/qla4xxx/ql4_nx.h b/drivers/scsi/qla4xxx/ql4_nx.h index 931ad3f1e91..95f3060ad02 100644 --- a/drivers/scsi/qla4xxx/ql4_nx.h +++ b/drivers/scsi/qla4xxx/ql4_nx.h @@ -535,6 +535,8 @@ #define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8)) #define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac)) #define QLA82XX_PEG_ALIVE_COUNTER (QLA82XX_CAM_RAM(0xb0)) +#define QLA82XX_CAM_RAM_DB1 (QLA82XX_CAM_RAM(0x1b0)) +#define QLA82XX_CAM_RAM_DB2 (QLA82XX_CAM_RAM(0x1b4)) #define HALT_STATUS_UNRECOVERABLE 0x80000000 #define HALT_STATUS_RECOVERABLE 0x40000000 diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 57890b6288b..779745f4e59 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -571,10 +571,6 @@ static void qla4xxx_mem_free(struct scsi_qla_host *ha) if (ha->nx_pcibase) iounmap( (struct device_reg_82xx __iomem *)ha->nx_pcibase); - - if (ha->nx_db_wr_ptr) - iounmap( - (struct device_reg_82xx __iomem *)ha->nx_db_wr_ptr); } else if (ha->reg) iounmap(ha->reg); pci_release_regions(ha->pdev); @@ -1476,24 +1472,10 @@ int qla4_8xxx_iospace_config(struct scsi_qla_host *ha) db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */ db_len = pci_resource_len(pdev, 4); - /* mapping of doorbell write pointer */ - ha->nx_db_wr_ptr = (unsigned long)ioremap(db_base + - (ha->pdev->devfn << 12), 4); - if (!ha->nx_db_wr_ptr) { - printk(KERN_ERR - "cannot remap MMIO doorbell-write (%s), aborting\n", - pci_name(pdev)); - goto iospace_error_exit; - } - /* mapping of doorbell read pointer */ - ha->nx_db_rd_ptr = (uint8_t *) ha->nx_pcibase + (512 * 1024) + - (ha->pdev->devfn * 8); - if (!ha->nx_db_rd_ptr) - printk(KERN_ERR - "cannot remap MMIO doorbell-read (%s), aborting\n", - pci_name(pdev)); - return 0; + ha->nx_db_wr_ptr = (ha->pdev->devfn == 4 ? QLA82XX_CAM_RAM_DB1 : + QLA82XX_CAM_RAM_DB2); + return 0; iospace_error_exit: return -ENOMEM; } -- cgit v1.2.3-70-g09d2