scsi: lpfc: Rework sli4 doorbell infrastructure
authorJames Smart <jsmart2021@gmail.com>
Thu, 22 Feb 2018 16:18:41 +0000 (08:18 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 23 Feb 2018 01:39:28 +0000 (20:39 -0500)
Up until now, all SLI-4 devices had the same doorbells at the same
bar locations. With newer hardware, there are now independent EQ and
CQ doorbells and the bar locations differ.

Prepare the code for new hardware by separating the eq/cq doorbell into
separate components. The components can be set based on if_type.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_debugfs.c
drivers/scsi/lpfc/lpfc_debugfs.h
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_sli4.h

index 17ea3bb..308303d 100644 (file)
@@ -3944,10 +3944,15 @@ lpfc_idiag_drbacc_read_reg(struct lpfc_hba *phba, char *pbuffer,
                return 0;
 
        switch (drbregid) {
-       case LPFC_DRB_EQCQ:
-               len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len,
-                               "EQCQ-DRB-REG: 0x%08x\n",
-                               readl(phba->sli4_hba.EQCQDBregaddr));
+       case LPFC_DRB_EQ:
+               len += snprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE-len,
+                               "EQ-DRB-REG: 0x%08x\n",
+                               readl(phba->sli4_hba.EQDBregaddr));
+               break;
+       case LPFC_DRB_CQ:
+               len += snprintf(pbuffer + len, LPFC_DRB_ACC_BUF_SIZE - len,
+                               "CQ-DRB-REG: 0x%08x\n",
+                               readl(phba->sli4_hba.CQDBregaddr));
                break;
        case LPFC_DRB_MQ:
                len += snprintf(pbuffer+len, LPFC_DRB_ACC_BUF_SIZE-len,
@@ -4086,8 +4091,11 @@ lpfc_idiag_drbacc_write(struct file *file, const char __user *buf,
            idiag.cmd.opcode == LPFC_IDIAG_CMD_DRBACC_ST ||
            idiag.cmd.opcode == LPFC_IDIAG_CMD_DRBACC_CL) {
                switch (drb_reg_id) {
-               case LPFC_DRB_EQCQ:
-                       drb_reg = phba->sli4_hba.EQCQDBregaddr;
+               case LPFC_DRB_EQ:
+                       drb_reg = phba->sli4_hba.EQDBregaddr;
+                       break;
+               case LPFC_DRB_CQ:
+                       drb_reg = phba->sli4_hba.CQDBregaddr;
                        break;
                case LPFC_DRB_MQ:
                        drb_reg = phba->sli4_hba.MQDBregaddr;
index c4edd87..12fbf49 100644 (file)
 #define LPFC_DRB_ACC_WR_CMD_ARG 2
 #define LPFC_DRB_ACC_BUF_SIZE 256
 
-#define LPFC_DRB_EQCQ 1
-#define LPFC_DRB_MQ   2
-#define LPFC_DRB_WQ   3
-#define LPFC_DRB_RQ   4
+#define LPFC_DRB_EQ   1
+#define LPFC_DRB_CQ   2
+#define LPFC_DRB_MQ   3
+#define LPFC_DRB_WQ   4
+#define LPFC_DRB_RQ   5
 
-#define LPFC_DRB_MAX  4
+#define LPFC_DRB_MAX  5
 
 #define IDIAG_DRBACC_REGID_INDX 0
 #define IDIAG_DRBACC_VALUE_INDX 1
index e24dca2..b2cf8eb 100644 (file)
@@ -7430,8 +7430,9 @@ lpfc_sli4_bar0_register_memmap(struct lpfc_hba *phba, uint32_t if_type)
                phba->sli4_hba.WQDBregaddr =
                        phba->sli4_hba.conf_regs_memmap_p +
                                                LPFC_ULP0_WQ_DOORBELL;
-               phba->sli4_hba.EQCQDBregaddr =
+               phba->sli4_hba.CQDBregaddr =
                        phba->sli4_hba.conf_regs_memmap_p + LPFC_EQCQ_DOORBELL;
+               phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr;
                phba->sli4_hba.MQDBregaddr =
                        phba->sli4_hba.conf_regs_memmap_p + LPFC_MQ_DOORBELL;
                phba->sli4_hba.BMBXregaddr =
@@ -7488,8 +7489,10 @@ lpfc_sli4_bar2_register_memmap(struct lpfc_hba *phba, uint32_t vf)
        phba->sli4_hba.WQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p +
                                vf * LPFC_VFR_PAGE_SIZE +
                                        LPFC_ULP0_WQ_DOORBELL);
-       phba->sli4_hba.EQCQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p +
-                               vf * LPFC_VFR_PAGE_SIZE + LPFC_EQCQ_DOORBELL);
+       phba->sli4_hba.CQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p +
+                               vf * LPFC_VFR_PAGE_SIZE +
+                                       LPFC_EQCQ_DOORBELL);
+       phba->sli4_hba.EQDBregaddr = phba->sli4_hba.CQDBregaddr;
        phba->sli4_hba.MQDBregaddr = (phba->sli4_hba.drbl_regs_memmap_p +
                                vf * LPFC_VFR_PAGE_SIZE + LPFC_MQ_DOORBELL);
        phba->sli4_hba.BMBXregaddr = (phba->sli4_hba.drbl_regs_memmap_p +
index f91caae..f4db7d4 100644 (file)
@@ -310,7 +310,7 @@ lpfc_sli4_eq_clr_intr(struct lpfc_queue *q)
        bf_set(lpfc_eqcq_doorbell_eqid_hi, &doorbell,
                (q->queue_id >> LPFC_EQID_HI_FIELD_SHIFT));
        bf_set(lpfc_eqcq_doorbell_eqid_lo, &doorbell, q->queue_id);
-       writel(doorbell.word0, q->phba->sli4_hba.EQCQDBregaddr);
+       writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr);
 }
 
 /**
@@ -360,10 +360,10 @@ lpfc_sli4_eq_release(struct lpfc_queue *q, bool arm)
        bf_set(lpfc_eqcq_doorbell_eqid_hi, &doorbell,
                        (q->queue_id >> LPFC_EQID_HI_FIELD_SHIFT));
        bf_set(lpfc_eqcq_doorbell_eqid_lo, &doorbell, q->queue_id);
-       writel(doorbell.word0, q->phba->sli4_hba.EQCQDBregaddr);
+       writel(doorbell.word0, q->phba->sli4_hba.EQDBregaddr);
        /* PCI read to flush PCI pipeline on re-arming for INTx mode */
        if ((q->phba->intr_type == INTx) && (arm == LPFC_QUEUE_REARM))
-               readl(q->phba->sli4_hba.EQCQDBregaddr);
+               readl(q->phba->sli4_hba.EQDBregaddr);
        return released;
 }
 
@@ -453,7 +453,7 @@ lpfc_sli4_cq_release(struct lpfc_queue *q, bool arm)
        bf_set(lpfc_eqcq_doorbell_cqid_hi, &doorbell,
                        (q->queue_id >> LPFC_CQID_HI_FIELD_SHIFT));
        bf_set(lpfc_eqcq_doorbell_cqid_lo, &doorbell, q->queue_id);
-       writel(doorbell.word0, q->phba->sli4_hba.EQCQDBregaddr);
+       writel(doorbell.word0, q->phba->sli4_hba.CQDBregaddr);
        return released;
 }
 
index 0c0cbe2..e2f06c9 100644 (file)
@@ -569,7 +569,8 @@ struct lpfc_sli4_hba {
        /* IF type 0, BAR 0 and if type 2, BAR 0 doorbell register memory map */
        void __iomem *RQDBregaddr;      /* RQ_DOORBELL register */
        void __iomem *WQDBregaddr;      /* WQ_DOORBELL register */
-       void __iomem *EQCQDBregaddr;    /* EQCQ_DOORBELL register */
+       void __iomem *CQDBregaddr;      /* CQ_DOORBELL register */
+       void __iomem *EQDBregaddr;      /* EQ_DOORBELL register */
        void __iomem *MQDBregaddr;      /* MQ_DOORBELL register */
        void __iomem *BMBXregaddr;      /* BootStrap MBX register */