aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorShyam Sundar <shyam.sundar@qlogic.com>2010-10-07 01:50:29 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-10-25 15:52:44 -0400
commit2657c800dbb24761097ef341dfa43672c08a7a9e (patch)
tree5c08d28f6d906671f07bff59b42588165ff93445 /drivers
parent91a772a4b1840fea39f0377c2cbca4cfc5be05f9 (diff)
[SCSI] qla4xxx: use CRB Register for Request Queue in-pointer
Switching from doorbell mechanism to CRB register based Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Signed-off-by: Shyam Sundar <shyam.sundar@qlogic.com> Signed-off-by: Ravi Anand <ravi.anand@qlogic.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/qla4xxx/ql4_fw.h1
-rw-r--r--drivers/scsi/qla4xxx/ql4_iocb.c10
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c9
-rw-r--r--drivers/scsi/qla4xxx/ql4_nx.h2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c24
5 files changed, 16 insertions, 30 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index d65dac4fe4db..5e757d7fff7d 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -448,6 +448,7 @@ struct addr_ctrl_blk {
448#define FWOPT_SESSION_MODE 0x0040 448#define FWOPT_SESSION_MODE 0x0040
449#define FWOPT_INITIATOR_MODE 0x0020 449#define FWOPT_INITIATOR_MODE 0x0020
450#define FWOPT_TARGET_MODE 0x0010 450#define FWOPT_TARGET_MODE 0x0010
451#define FWOPT_ENABLE_CRBDB 0x8000
451 452
452 uint16_t exec_throttle; /* 04-05 */ 453 uint16_t exec_throttle; /* 04-05 */
453 uint8_t zio_count; /* 06 */ 454 uint8_t zio_count; /* 06 */
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index 4ef9ba112ee8..5ae49fd87846 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,
202void qla4_8xxx_queue_iocb(struct scsi_qla_host *ha) 202void qla4_8xxx_queue_iocb(struct scsi_qla_host *ha)
203{ 203{
204 uint32_t dbval = 0; 204 uint32_t dbval = 0;
205 unsigned long wtime;
206 205
207 dbval = 0x14 | (ha->func_num << 5); 206 dbval = 0x14 | (ha->func_num << 5);
208 dbval = dbval | (0 << 8) | (ha->request_in << 16); 207 dbval = dbval | (0 << 8) | (ha->request_in << 16);
209 writel(dbval, (unsigned long __iomem *)ha->nx_db_wr_ptr);
210 wmb();
211 208
212 wtime = jiffies + (2 * HZ); 209 qla4_8xxx_wr_32(ha, ha->nx_db_wr_ptr, ha->request_in);
213 while (readl((void __iomem *)ha->nx_db_rd_ptr) != dbval &&
214 !time_after_eq(jiffies, wtime)) {
215 writel(dbval, (unsigned long __iomem *)ha->nx_db_wr_ptr);
216 wmb();
217 }
218} 210}
219 211
220/** 212/**
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 494a28f0dc1d..2d2f9c879bfd 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,
299{ 299{
300 memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT); 300 memset(mbox_cmd, 0, sizeof(mbox_cmd[0]) * MBOX_REG_COUNT);
301 memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT); 301 memset(mbox_sts, 0, sizeof(mbox_sts[0]) * MBOX_REG_COUNT);
302
303 if (is_qla8022(ha))
304 qla4_8xxx_wr_32(ha, ha->nx_db_wr_ptr, 0);
305
302 mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE; 306 mbox_cmd[0] = MBOX_CMD_INITIALIZE_FIRMWARE;
303 mbox_cmd[1] = 0; 307 mbox_cmd[1] = 0;
304 mbox_cmd[2] = LSDW(init_fw_cb_dma); 308 mbox_cmd[2] = LSDW(init_fw_cb_dma);
@@ -472,6 +476,11 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
472 init_fw_cb->fw_options |= 476 init_fw_cb->fw_options |=
473 __constant_cpu_to_le16(FWOPT_SESSION_MODE | 477 __constant_cpu_to_le16(FWOPT_SESSION_MODE |
474 FWOPT_INITIATOR_MODE); 478 FWOPT_INITIATOR_MODE);
479
480 if (is_qla8022(ha))
481 init_fw_cb->fw_options |=
482 __constant_cpu_to_le16(FWOPT_ENABLE_CRBDB);
483
475 init_fw_cb->fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE); 484 init_fw_cb->fw_options &= __constant_cpu_to_le16(~FWOPT_TARGET_MODE);
476 485
477 if (qla4xxx_set_ifcb(ha, &mbox_cmd[0], &mbox_sts[0], init_fw_cb_dma) 486 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 931ad3f1e918..95f3060ad027 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.h
+++ b/drivers/scsi/qla4xxx/ql4_nx.h
@@ -535,6 +535,8 @@
535#define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8)) 535#define QLA82XX_PEG_HALT_STATUS1 (QLA82XX_CAM_RAM(0xa8))
536#define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac)) 536#define QLA82XX_PEG_HALT_STATUS2 (QLA82XX_CAM_RAM(0xac))
537#define QLA82XX_PEG_ALIVE_COUNTER (QLA82XX_CAM_RAM(0xb0)) 537#define QLA82XX_PEG_ALIVE_COUNTER (QLA82XX_CAM_RAM(0xb0))
538#define QLA82XX_CAM_RAM_DB1 (QLA82XX_CAM_RAM(0x1b0))
539#define QLA82XX_CAM_RAM_DB2 (QLA82XX_CAM_RAM(0x1b4))
538 540
539#define HALT_STATUS_UNRECOVERABLE 0x80000000 541#define HALT_STATUS_UNRECOVERABLE 0x80000000
540#define HALT_STATUS_RECOVERABLE 0x40000000 542#define HALT_STATUS_RECOVERABLE 0x40000000
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 57890b6288b9..779745f4e59c 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)
571 if (ha->nx_pcibase) 571 if (ha->nx_pcibase)
572 iounmap( 572 iounmap(
573 (struct device_reg_82xx __iomem *)ha->nx_pcibase); 573 (struct device_reg_82xx __iomem *)ha->nx_pcibase);
574
575 if (ha->nx_db_wr_ptr)
576 iounmap(
577 (struct device_reg_82xx __iomem *)ha->nx_db_wr_ptr);
578 } else if (ha->reg) 574 } else if (ha->reg)
579 iounmap(ha->reg); 575 iounmap(ha->reg);
580 pci_release_regions(ha->pdev); 576 pci_release_regions(ha->pdev);
@@ -1476,24 +1472,10 @@ int qla4_8xxx_iospace_config(struct scsi_qla_host *ha)
1476 db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */ 1472 db_base = pci_resource_start(pdev, 4); /* doorbell is on bar 4 */
1477 db_len = pci_resource_len(pdev, 4); 1473 db_len = pci_resource_len(pdev, 4);
1478 1474
1479 /* mapping of doorbell write pointer */ 1475 ha->nx_db_wr_ptr = (ha->pdev->devfn == 4 ? QLA82XX_CAM_RAM_DB1 :
1480 ha->nx_db_wr_ptr = (unsigned long)ioremap(db_base + 1476 QLA82XX_CAM_RAM_DB2);
1481 (ha->pdev->devfn << 12), 4);
1482 if (!ha->nx_db_wr_ptr) {
1483 printk(KERN_ERR
1484 "cannot remap MMIO doorbell-write (%s), aborting\n",
1485 pci_name(pdev));
1486 goto iospace_error_exit;
1487 }
1488 /* mapping of doorbell read pointer */
1489 ha->nx_db_rd_ptr = (uint8_t *) ha->nx_pcibase + (512 * 1024) +
1490 (ha->pdev->devfn * 8);
1491 if (!ha->nx_db_rd_ptr)
1492 printk(KERN_ERR
1493 "cannot remap MMIO doorbell-read (%s), aborting\n",
1494 pci_name(pdev));
1495 return 0;
1496 1477
1478 return 0;
1497iospace_error_exit: 1479iospace_error_exit:
1498 return -ENOMEM; 1480 return -ENOMEM;
1499} 1481}