aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_mbox.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mbox.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c75
1 files changed, 38 insertions, 37 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 7413bfdf89a4..ca358355ec9b 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -671,7 +671,7 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba)
671{ 671{
672 struct lpfc_sli *psli = &phba->sli; 672 struct lpfc_sli *psli = &phba->sli;
673 struct lpfc_sli_ring *pring; 673 struct lpfc_sli_ring *pring;
674 PCB_t *pcbp = &phba->slim2p->pcb; 674 PCB_t *pcbp = phba->pcb;
675 dma_addr_t pdma_addr; 675 dma_addr_t pdma_addr;
676 uint32_t offset; 676 uint32_t offset;
677 uint32_t iocbCnt = 0; 677 uint32_t iocbCnt = 0;
@@ -700,23 +700,23 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba)
700 continue; 700 continue;
701 } 701 }
702 /* Command ring setup for ring */ 702 /* Command ring setup for ring */
703 pring->cmdringaddr = (void *) &phba->slim2p->IOCBs[iocbCnt]; 703 pring->cmdringaddr = (void *)&phba->IOCBs[iocbCnt];
704 pcbp->rdsc[i].cmdEntries = pring->numCiocb; 704 pcbp->rdsc[i].cmdEntries = pring->numCiocb;
705 705
706 offset = (uint8_t *) &phba->slim2p->IOCBs[iocbCnt] - 706 offset = (uint8_t *) &phba->IOCBs[iocbCnt] -
707 (uint8_t *) phba->slim2p; 707 (uint8_t *) phba->slim2p.virt;
708 pdma_addr = phba->slim2p_mapping + offset; 708 pdma_addr = phba->slim2p.phys + offset;
709 pcbp->rdsc[i].cmdAddrHigh = putPaddrHigh(pdma_addr); 709 pcbp->rdsc[i].cmdAddrHigh = putPaddrHigh(pdma_addr);
710 pcbp->rdsc[i].cmdAddrLow = putPaddrLow(pdma_addr); 710 pcbp->rdsc[i].cmdAddrLow = putPaddrLow(pdma_addr);
711 iocbCnt += pring->numCiocb; 711 iocbCnt += pring->numCiocb;
712 712
713 /* Response ring setup for ring */ 713 /* Response ring setup for ring */
714 pring->rspringaddr = (void *) &phba->slim2p->IOCBs[iocbCnt]; 714 pring->rspringaddr = (void *) &phba->IOCBs[iocbCnt];
715 715
716 pcbp->rdsc[i].rspEntries = pring->numRiocb; 716 pcbp->rdsc[i].rspEntries = pring->numRiocb;
717 offset = (uint8_t *)&phba->slim2p->IOCBs[iocbCnt] - 717 offset = (uint8_t *)&phba->IOCBs[iocbCnt] -
718 (uint8_t *)phba->slim2p; 718 (uint8_t *)phba->slim2p.virt;
719 pdma_addr = phba->slim2p_mapping + offset; 719 pdma_addr = phba->slim2p.phys + offset;
720 pcbp->rdsc[i].rspAddrHigh = putPaddrHigh(pdma_addr); 720 pcbp->rdsc[i].rspAddrHigh = putPaddrHigh(pdma_addr);
721 pcbp->rdsc[i].rspAddrLow = putPaddrLow(pdma_addr); 721 pcbp->rdsc[i].rspAddrLow = putPaddrLow(pdma_addr);
722 iocbCnt += pring->numRiocb; 722 iocbCnt += pring->numRiocb;
@@ -977,8 +977,8 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
977 977
978 mb->un.varCfgPort.pcbLen = sizeof(PCB_t); 978 mb->un.varCfgPort.pcbLen = sizeof(PCB_t);
979 979
980 offset = (uint8_t *)&phba->slim2p->pcb - (uint8_t *)phba->slim2p; 980 offset = (uint8_t *)phba->pcb - (uint8_t *)phba->slim2p.virt;
981 pdma_addr = phba->slim2p_mapping + offset; 981 pdma_addr = phba->slim2p.phys + offset;
982 mb->un.varCfgPort.pcbLow = putPaddrLow(pdma_addr); 982 mb->un.varCfgPort.pcbLow = putPaddrLow(pdma_addr);
983 mb->un.varCfgPort.pcbHigh = putPaddrHigh(pdma_addr); 983 mb->un.varCfgPort.pcbHigh = putPaddrHigh(pdma_addr);
984 984
@@ -986,12 +986,13 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
986 986
987 if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) { 987 if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) {
988 mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ 988 mb->un.varCfgPort.cerbm = 1; /* Request HBQs */
989 mb->un.varCfgPort.ccrp = 1; /* Command Ring Polling */
990 mb->un.varCfgPort.cinb = 1; /* Interrupt Notification Block */
989 mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count(); 991 mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count();
990 if (phba->max_vpi && phba->cfg_enable_npiv && 992 if (phba->max_vpi && phba->cfg_enable_npiv &&
991 phba->vpd.sli3Feat.cmv) { 993 phba->vpd.sli3Feat.cmv) {
992 mb->un.varCfgPort.max_vpi = phba->max_vpi; 994 mb->un.varCfgPort.max_vpi = phba->max_vpi;
993 mb->un.varCfgPort.cmv = 1; 995 mb->un.varCfgPort.cmv = 1;
994 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED;
995 } else 996 } else
996 mb->un.varCfgPort.max_vpi = phba->max_vpi = 0; 997 mb->un.varCfgPort.max_vpi = phba->max_vpi = 0;
997 } else 998 } else
@@ -999,16 +1000,15 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
999 mb->un.varCfgPort.sli_mode = phba->sli_rev; 1000 mb->un.varCfgPort.sli_mode = phba->sli_rev;
1000 1001
1001 /* Now setup pcb */ 1002 /* Now setup pcb */
1002 phba->slim2p->pcb.type = TYPE_NATIVE_SLI2; 1003 phba->pcb->type = TYPE_NATIVE_SLI2;
1003 phba->slim2p->pcb.feature = FEATURE_INITIAL_SLI2; 1004 phba->pcb->feature = FEATURE_INITIAL_SLI2;
1004 1005
1005 /* Setup Mailbox pointers */ 1006 /* Setup Mailbox pointers */
1006 phba->slim2p->pcb.mailBoxSize = offsetof(MAILBOX_t, us) + 1007 phba->pcb->mailBoxSize = sizeof(MAILBOX_t);
1007 sizeof(struct sli2_desc); 1008 offset = (uint8_t *)phba->mbox - (uint8_t *)phba->slim2p.virt;
1008 offset = (uint8_t *)&phba->slim2p->mbx - (uint8_t *)phba->slim2p; 1009 pdma_addr = phba->slim2p.phys + offset;
1009 pdma_addr = phba->slim2p_mapping + offset; 1010 phba->pcb->mbAddrHigh = putPaddrHigh(pdma_addr);
1010 phba->slim2p->pcb.mbAddrHigh = putPaddrHigh(pdma_addr); 1011 phba->pcb->mbAddrLow = putPaddrLow(pdma_addr);
1011 phba->slim2p->pcb.mbAddrLow = putPaddrLow(pdma_addr);
1012 1012
1013 /* 1013 /*
1014 * Setup Host Group ring pointer. 1014 * Setup Host Group ring pointer.
@@ -1069,13 +1069,13 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1069 } 1069 }
1070 1070
1071 /* mask off BAR0's flag bits 0 - 3 */ 1071 /* mask off BAR0's flag bits 0 - 3 */
1072 phba->slim2p->pcb.hgpAddrLow = (bar_low & PCI_BASE_ADDRESS_MEM_MASK) + 1072 phba->pcb->hgpAddrLow = (bar_low & PCI_BASE_ADDRESS_MEM_MASK) +
1073 (void __iomem *) phba->host_gp - 1073 (void __iomem *)phba->host_gp -
1074 (void __iomem *)phba->MBslimaddr; 1074 (void __iomem *)phba->MBslimaddr;
1075 if (bar_low & PCI_BASE_ADDRESS_MEM_TYPE_64) 1075 if (bar_low & PCI_BASE_ADDRESS_MEM_TYPE_64)
1076 phba->slim2p->pcb.hgpAddrHigh = bar_high; 1076 phba->pcb->hgpAddrHigh = bar_high;
1077 else 1077 else
1078 phba->slim2p->pcb.hgpAddrHigh = 0; 1078 phba->pcb->hgpAddrHigh = 0;
1079 /* write HGP data to SLIM at the required longword offset */ 1079 /* write HGP data to SLIM at the required longword offset */
1080 memset(&hgp, 0, sizeof(struct lpfc_hgp)); 1080 memset(&hgp, 0, sizeof(struct lpfc_hgp));
1081 1081
@@ -1085,17 +1085,19 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1085 } 1085 }
1086 1086
1087 /* Setup Port Group ring pointer */ 1087 /* Setup Port Group ring pointer */
1088 if (phba->sli_rev == 3) 1088 if (phba->sli3_options & LPFC_SLI3_INB_ENABLED) {
1089 pgp_offset = (uint8_t *)&phba->slim2p->mbx.us.s3_pgp.port - 1089 pgp_offset = offsetof(struct lpfc_sli2_slim,
1090 (uint8_t *)phba->slim2p; 1090 mbx.us.s3_inb_pgp.port);
1091 else 1091 phba->hbq_get = phba->mbox->us.s3_inb_pgp.hbq_get;
1092 pgp_offset = (uint8_t *)&phba->slim2p->mbx.us.s2.port - 1092 } else if (phba->sli_rev == 3) {
1093 (uint8_t *)phba->slim2p; 1093 pgp_offset = offsetof(struct lpfc_sli2_slim,
1094 1094 mbx.us.s3_pgp.port);
1095 pdma_addr = phba->slim2p_mapping + pgp_offset; 1095 phba->hbq_get = phba->mbox->us.s3_pgp.hbq_get;
1096 phba->slim2p->pcb.pgpAddrHigh = putPaddrHigh(pdma_addr); 1096 } else
1097 phba->slim2p->pcb.pgpAddrLow = putPaddrLow(pdma_addr); 1097 pgp_offset = offsetof(struct lpfc_sli2_slim, mbx.us.s2.port);
1098 phba->hbq_get = &phba->slim2p->mbx.us.s3_pgp.hbq_get[0]; 1098 pdma_addr = phba->slim2p.phys + pgp_offset;
1099 phba->pcb->pgpAddrHigh = putPaddrHigh(pdma_addr);
1100 phba->pcb->pgpAddrLow = putPaddrLow(pdma_addr);
1099 1101
1100 /* Use callback routine to setp rings in the pcb */ 1102 /* Use callback routine to setp rings in the pcb */
1101 lpfc_config_pcb_setup(phba); 1103 lpfc_config_pcb_setup(phba);
@@ -1110,8 +1112,7 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
1110 } 1112 }
1111 1113
1112 /* Swap PCB if needed */ 1114 /* Swap PCB if needed */
1113 lpfc_sli_pcimem_bcopy(&phba->slim2p->pcb, &phba->slim2p->pcb, 1115 lpfc_sli_pcimem_bcopy(phba->pcb, phba->pcb, sizeof(PCB_t));
1114 sizeof(PCB_t));
1115} 1116}
1116 1117
1117/** 1118/**