aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2008-08-24 21:49:55 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-10-13 09:28:53 -0400
commit34b02dcdcf1865405f4762b991965c0c3b8a3ae0 (patch)
tree00829334c2813d30e574a5f1290fbf7dd210d1cb /drivers/scsi
parent90160e010b6f3a91a9bb044bbe6723731e6f366c (diff)
[SCSI] lpfc 8.2.8 : Update driver for new SLI-3 features
Update driver for new SLI-3 features: - interrupt enhancements - lose adapter doorbell writes - inlining support for FCP_Ixx cmds Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/lpfc/lpfc.h22
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c52
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c4
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h63
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c28
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c75
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c163
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c122
9 files changed, 314 insertions, 219 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index e0e018d12653..327eeb051087 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -407,10 +407,11 @@ struct lpfc_hba {
407 struct lpfc_sli sli; 407 struct lpfc_sli sli;
408 uint32_t sli_rev; /* SLI2 or SLI3 */ 408 uint32_t sli_rev; /* SLI2 or SLI3 */
409 uint32_t sli3_options; /* Mask of enabled SLI3 options */ 409 uint32_t sli3_options; /* Mask of enabled SLI3 options */
410#define LPFC_SLI3_ENABLED 0x01 410#define LPFC_SLI3_HBQ_ENABLED 0x01
411#define LPFC_SLI3_HBQ_ENABLED 0x02 411#define LPFC_SLI3_NPIV_ENABLED 0x02
412#define LPFC_SLI3_NPIV_ENABLED 0x04 412#define LPFC_SLI3_VPORT_TEARDOWN 0x04
413#define LPFC_SLI3_VPORT_TEARDOWN 0x08 413#define LPFC_SLI3_CRP_ENABLED 0x08
414#define LPFC_SLI3_INB_ENABLED 0x10
414 uint32_t iocb_cmd_size; 415 uint32_t iocb_cmd_size;
415 uint32_t iocb_rsp_size; 416 uint32_t iocb_rsp_size;
416 417
@@ -422,10 +423,16 @@ struct lpfc_hba {
422#define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */ 423#define LS_NPIV_FAB_SUPPORTED 0x2 /* Fabric supports NPIV */
423#define LS_IGNORE_ERATT 0x4 /* intr handler should ignore ERATT */ 424#define LS_IGNORE_ERATT 0x4 /* intr handler should ignore ERATT */
424 425
425 struct lpfc_sli2_slim *slim2p; 426 struct lpfc_dmabuf slim2p;
426 struct lpfc_dmabuf hbqslimp; 427
428 MAILBOX_t *mbox;
429 uint32_t *inb_ha_copy;
430 uint32_t *inb_counter;
431 uint32_t inb_last_counter;
432 struct _PCB *pcb;
433 struct _IOCB *IOCBs;
427 434
428 dma_addr_t slim2p_mapping; 435 struct lpfc_dmabuf hbqslimp;
429 436
430 uint16_t pci_cfg_value; 437 uint16_t pci_cfg_value;
431 438
@@ -514,6 +521,7 @@ struct lpfc_hba {
514 void __iomem *HCregaddr; /* virtual address for host ctl reg */ 521 void __iomem *HCregaddr; /* virtual address for host ctl reg */
515 522
516 struct lpfc_hgp __iomem *host_gp; /* Host side get/put pointers */ 523 struct lpfc_hgp __iomem *host_gp; /* Host side get/put pointers */
524 struct lpfc_pgp *port_gp;
517 uint32_t __iomem *hbq_put; /* Address in SLIM to HBQ put ptrs */ 525 uint32_t __iomem *hbq_put; /* Address in SLIM to HBQ put ptrs */
518 uint32_t *hbq_get; /* Host mem address of HBQ get ptrs */ 526 uint32_t *hbq_get; /* Host mem address of HBQ get ptrs */
519 527
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index 7fc74cf5823b..0f387862cf77 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -212,7 +212,7 @@ lpfc_alloc_ct_rsp(struct lpfc_hba *phba, int cmdcode, struct ulp_bde64 *bpl,
212 else 212 else
213 list_add_tail(&mp->list, &mlist->list); 213 list_add_tail(&mp->list, &mlist->list);
214 214
215 bpl->tus.f.bdeFlags = BUFF_USE_RCV; 215 bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64I;
216 /* build buffer ptr list for IOCB */ 216 /* build buffer ptr list for IOCB */
217 bpl->addrLow = le32_to_cpu(putPaddrLow(mp->phys) ); 217 bpl->addrLow = le32_to_cpu(putPaddrLow(mp->phys) );
218 bpl->addrHigh = le32_to_cpu(putPaddrHigh(mp->phys) ); 218 bpl->addrHigh = le32_to_cpu(putPaddrHigh(mp->phys) );
@@ -283,7 +283,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,
283 icmd->un.genreq64.bdl.ulpIoTag32 = 0; 283 icmd->un.genreq64.bdl.ulpIoTag32 = 0;
284 icmd->un.genreq64.bdl.addrHigh = putPaddrHigh(bmp->phys); 284 icmd->un.genreq64.bdl.addrHigh = putPaddrHigh(bmp->phys);
285 icmd->un.genreq64.bdl.addrLow = putPaddrLow(bmp->phys); 285 icmd->un.genreq64.bdl.addrLow = putPaddrLow(bmp->phys);
286 icmd->un.genreq64.bdl.bdeFlags = BUFF_TYPE_BDL; 286 icmd->un.genreq64.bdl.bdeFlags = BUFF_TYPE_BLP_64;
287 icmd->un.genreq64.bdl.bdeSize = (num_entry * sizeof (struct ulp_bde64)); 287 icmd->un.genreq64.bdl.bdeSize = (num_entry * sizeof (struct ulp_bde64));
288 288
289 if (usr_flg) 289 if (usr_flg)
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 2588eadffbb9..2f6d34924b7d 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -454,7 +454,7 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size)
454 spin_lock_irq(&phba->hbalock); 454 spin_lock_irq(&phba->hbalock);
455 455
456 len += snprintf(buf+len, size-len, "SLIM Mailbox\n"); 456 len += snprintf(buf+len, size-len, "SLIM Mailbox\n");
457 ptr = (uint32_t *)phba->slim2p; 457 ptr = (uint32_t *)phba->slim2p.virt;
458 i = sizeof(MAILBOX_t); 458 i = sizeof(MAILBOX_t);
459 while (i > 0) { 459 while (i > 0) {
460 len += snprintf(buf+len, size-len, 460 len += snprintf(buf+len, size-len,
@@ -467,7 +467,7 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size)
467 } 467 }
468 468
469 len += snprintf(buf+len, size-len, "SLIM PCB\n"); 469 len += snprintf(buf+len, size-len, "SLIM PCB\n");
470 ptr = (uint32_t *)&phba->slim2p->pcb; 470 ptr = (uint32_t *)phba->pcb;
471 i = sizeof(PCB_t); 471 i = sizeof(PCB_t);
472 while (i > 0) { 472 while (i > 0) {
473 len += snprintf(buf+len, size-len, 473 len += snprintf(buf+len, size-len,
@@ -479,44 +479,16 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size)
479 off += (8 * sizeof(uint32_t)); 479 off += (8 * sizeof(uint32_t));
480 } 480 }
481 481
482 pgpp = (struct lpfc_pgp *)&phba->slim2p->mbx.us.s3_pgp.port; 482 for (i = 0; i < 4; i++) {
483 pring = &psli->ring[0]; 483 pgpp = &phba->port_gp[i];
484 len += snprintf(buf+len, size-len, 484 pring = &psli->ring[i];
485 "Ring 0: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) " 485 len += snprintf(buf+len, size-len,
486 "RSP PutInx:%d Max:%d\n", 486 "Ring %d: CMD GetInx:%d (Max:%d Next:%d "
487 pgpp->cmdGetInx, pring->numCiocb, 487 "Local:%d flg:x%x) RSP PutInx:%d Max:%d\n",
488 pring->next_cmdidx, pring->local_getidx, pring->flag, 488 i, pgpp->cmdGetInx, pring->numCiocb,
489 pgpp->rspPutInx, pring->numRiocb); 489 pring->next_cmdidx, pring->local_getidx,
490 pgpp++; 490 pring->flag, pgpp->rspPutInx, pring->numRiocb);
491 491 }
492 pring = &psli->ring[1];
493 len += snprintf(buf+len, size-len,
494 "Ring 1: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) "
495 "RSP PutInx:%d Max:%d\n",
496 pgpp->cmdGetInx, pring->numCiocb,
497 pring->next_cmdidx, pring->local_getidx, pring->flag,
498 pgpp->rspPutInx, pring->numRiocb);
499 pgpp++;
500
501 pring = &psli->ring[2];
502 len += snprintf(buf+len, size-len,
503 "Ring 2: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) "
504 "RSP PutInx:%d Max:%d\n",
505 pgpp->cmdGetInx, pring->numCiocb,
506 pring->next_cmdidx, pring->local_getidx, pring->flag,
507 pgpp->rspPutInx, pring->numRiocb);
508 pgpp++;
509
510 pring = &psli->ring[3];
511 len += snprintf(buf+len, size-len,
512 "Ring 3: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x) "
513 "RSP PutInx:%d Max:%d\n",
514 pgpp->cmdGetInx, pring->numCiocb,
515 pring->next_cmdidx, pring->local_getidx, pring->flag,
516 pgpp->rspPutInx, pring->numRiocb);
517
518
519 ptr = (uint32_t *)&phba->slim2p->mbx.us.s3_pgp.hbq_get;
520 word0 = readl(phba->HAregaddr); 492 word0 = readl(phba->HAregaddr);
521 word1 = readl(phba->CAregaddr); 493 word1 = readl(phba->CAregaddr);
522 word2 = readl(phba->HSregaddr); 494 word2 = readl(phba->HSregaddr);
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 2e24b4fe2be5..89bd9ab46de7 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -200,7 +200,7 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
200 200
201 icmd->un.elsreq64.bdl.addrHigh = putPaddrHigh(pbuflist->phys); 201 icmd->un.elsreq64.bdl.addrHigh = putPaddrHigh(pbuflist->phys);
202 icmd->un.elsreq64.bdl.addrLow = putPaddrLow(pbuflist->phys); 202 icmd->un.elsreq64.bdl.addrLow = putPaddrLow(pbuflist->phys);
203 icmd->un.elsreq64.bdl.bdeFlags = BUFF_TYPE_BDL; 203 icmd->un.elsreq64.bdl.bdeFlags = BUFF_TYPE_BLP_64;
204 icmd->un.elsreq64.remoteID = did; /* DID */ 204 icmd->un.elsreq64.remoteID = did; /* DID */
205 if (expectRsp) { 205 if (expectRsp) {
206 icmd->un.elsreq64.bdl.bdeSize = (2 * sizeof(struct ulp_bde64)); 206 icmd->un.elsreq64.bdl.bdeSize = (2 * sizeof(struct ulp_bde64));
@@ -235,7 +235,7 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
235 bpl->addrLow = le32_to_cpu(putPaddrLow(prsp->phys)); 235 bpl->addrLow = le32_to_cpu(putPaddrLow(prsp->phys));
236 bpl->addrHigh = le32_to_cpu(putPaddrHigh(prsp->phys)); 236 bpl->addrHigh = le32_to_cpu(putPaddrHigh(prsp->phys));
237 bpl->tus.f.bdeSize = FCELSSIZE; 237 bpl->tus.f.bdeSize = FCELSSIZE;
238 bpl->tus.f.bdeFlags = BUFF_USE_RCV; 238 bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
239 bpl->tus.w = le32_to_cpu(bpl->tus.w); 239 bpl->tus.w = le32_to_cpu(bpl->tus.w);
240 } 240 }
241 241
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 7773b949aa7c..a986332fecf6 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -1474,24 +1474,18 @@ struct ulp_bde64 { /* SLI-2 */
1474 uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED 1474 uint32_t bdeFlags:8; /* BDE Flags 0 IS A SUPPORTED
1475 VALUE !! */ 1475 VALUE !! */
1476#endif 1476#endif
1477 1477#define BUFF_TYPE_BDE_64 0x00 /* BDE (Host_resident) */
1478#define BUFF_USE_RSVD 0x01 /* bdeFlags */ 1478#define BUFF_TYPE_BDE_IMMED 0x01 /* Immediate Data BDE */
1479#define BUFF_USE_INTRPT 0x02 /* Not Implemented with LP6000 */ 1479#define BUFF_TYPE_BDE_64P 0x02 /* BDE (Port-resident) */
1480#define BUFF_USE_CMND 0x04 /* Optional, 1=cmd/rsp 0=data buffer */ 1480#define BUFF_TYPE_BDE_64I 0x08 /* Input BDE (Host-resident) */
1481#define BUFF_USE_RCV 0x08 /* "" "", 1=rcv buffer, 0=xmit 1481#define BUFF_TYPE_BDE_64IP 0x0A /* Input BDE (Port-resident) */
1482 buffer */ 1482#define BUFF_TYPE_BLP_64 0x40 /* BLP (Host-resident) */
1483#define BUFF_TYPE_32BIT 0x10 /* "" "", 1=32 bit addr 0=64 bit 1483#define BUFF_TYPE_BLP_64P 0x42 /* BLP (Port-resident) */
1484 addr */
1485#define BUFF_TYPE_SPECIAL 0x20 /* Not Implemented with LP6000 */
1486#define BUFF_TYPE_BDL 0x40 /* Optional, may be set in BDL */
1487#define BUFF_TYPE_INVALID 0x80 /* "" "" */
1488 } f; 1484 } f;
1489 } tus; 1485 } tus;
1490 uint32_t addrLow; 1486 uint32_t addrLow;
1491 uint32_t addrHigh; 1487 uint32_t addrHigh;
1492}; 1488};
1493#define BDE64_SIZE_WORD 0
1494#define BPL64_SIZE_WORD 0x40
1495 1489
1496typedef struct ULP_BDL { /* SLI-2 */ 1490typedef struct ULP_BDL { /* SLI-2 */
1497#ifdef __BIG_ENDIAN_BITFIELD 1491#ifdef __BIG_ENDIAN_BITFIELD
@@ -2715,11 +2709,19 @@ struct sli3_pgp {
2715 uint32_t hbq_get[16]; 2709 uint32_t hbq_get[16];
2716}; 2710};
2717 2711
2718typedef union { 2712struct sli3_inb_pgp {
2719 struct sli2_desc s2; 2713 uint32_t ha_copy;
2720 struct sli3_desc s3; 2714 uint32_t counter;
2721 struct sli3_pgp s3_pgp; 2715 struct lpfc_pgp port[MAX_RINGS];
2722} SLI_VAR; 2716 uint32_t hbq_get[16];
2717};
2718
2719union sli_var {
2720 struct sli2_desc s2;
2721 struct sli3_desc s3;
2722 struct sli3_pgp s3_pgp;
2723 struct sli3_inb_pgp s3_inb_pgp;
2724};
2723 2725
2724typedef struct { 2726typedef struct {
2725#ifdef __BIG_ENDIAN_BITFIELD 2727#ifdef __BIG_ENDIAN_BITFIELD
@@ -2737,7 +2739,7 @@ typedef struct {
2737#endif 2739#endif
2738 2740
2739 MAILVARIANTS un; 2741 MAILVARIANTS un;
2740 SLI_VAR us; 2742 union sli_var us;
2741} MAILBOX_t; 2743} MAILBOX_t;
2742 2744
2743/* 2745/*
@@ -3105,6 +3107,27 @@ struct que_xri64cx_ext_fields {
3105 struct lpfc_hbq_entry buff[5]; 3107 struct lpfc_hbq_entry buff[5];
3106}; 3108};
3107 3109
3110#define LPFC_EXT_DATA_BDE_COUNT 3
3111struct fcp_irw_ext {
3112 uint32_t io_tag64_low;
3113 uint32_t io_tag64_high;
3114#ifdef __BIG_ENDIAN_BITFIELD
3115 uint8_t reserved1;
3116 uint8_t reserved2;
3117 uint8_t reserved3;
3118 uint8_t ebde_count;
3119#else /* __LITTLE_ENDIAN */
3120 uint8_t ebde_count;
3121 uint8_t reserved3;
3122 uint8_t reserved2;
3123 uint8_t reserved1;
3124#endif
3125 uint32_t reserved4;
3126 struct ulp_bde64 rbde; /* response bde */
3127 struct ulp_bde64 dbde[LPFC_EXT_DATA_BDE_COUNT]; /* data BDE or BPL */
3128 uint8_t icd[32]; /* immediate command data (32 bytes) */
3129};
3130
3108typedef struct _IOCB { /* IOCB structure */ 3131typedef struct _IOCB { /* IOCB structure */
3109 union { 3132 union {
3110 GENERIC_RSP grsp; /* Generic response */ 3133 GENERIC_RSP grsp; /* Generic response */
@@ -3190,7 +3213,7 @@ typedef struct _IOCB { /* IOCB structure */
3190 3213
3191 /* words 8-31 used for que_xri_cx iocb */ 3214 /* words 8-31 used for que_xri_cx iocb */
3192 struct que_xri64cx_ext_fields que_xri64cx_ext_words; 3215 struct que_xri64cx_ext_fields que_xri64cx_ext_words;
3193 3216 struct fcp_irw_ext fcp_ext;
3194 uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */ 3217 uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */
3195 } unsli3; 3218 } unsli3;
3196 3219
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 93fd09daca87..6a7a039e8904 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -2312,12 +2312,18 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
2312 } 2312 }
2313 2313
2314 /* Allocate memory for SLI-2 structures */ 2314 /* Allocate memory for SLI-2 structures */
2315 phba->slim2p = dma_alloc_coherent(&phba->pcidev->dev, SLI2_SLIM_SIZE, 2315 phba->slim2p.virt = dma_alloc_coherent(&phba->pcidev->dev,
2316 &phba->slim2p_mapping, GFP_KERNEL); 2316 SLI2_SLIM_SIZE,
2317 if (!phba->slim2p) 2317 &phba->slim2p.phys,
2318 GFP_KERNEL);
2319 if (!phba->slim2p.virt)
2318 goto out_iounmap; 2320 goto out_iounmap;
2319 2321
2320 memset(phba->slim2p, 0, SLI2_SLIM_SIZE); 2322 memset(phba->slim2p.virt, 0, SLI2_SLIM_SIZE);
2323 phba->mbox = phba->slim2p.virt;
2324 phba->pcb = (phba->slim2p.virt + sizeof(MAILBOX_t));
2325 phba->IOCBs = (phba->slim2p.virt + sizeof(MAILBOX_t) +
2326 sizeof(struct _PCB));
2321 2327
2322 phba->hbqslimp.virt = dma_alloc_coherent(&phba->pcidev->dev, 2328 phba->hbqslimp.virt = dma_alloc_coherent(&phba->pcidev->dev,
2323 lpfc_sli_hbq_size(), 2329 lpfc_sli_hbq_size(),
@@ -2513,11 +2519,11 @@ out_free_iocbq:
2513 } 2519 }
2514 lpfc_mem_free(phba); 2520 lpfc_mem_free(phba);
2515out_free_hbqslimp: 2521out_free_hbqslimp:
2516 dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(), phba->hbqslimp.virt, 2522 dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(),
2517 phba->hbqslimp.phys); 2523 phba->hbqslimp.virt, phba->hbqslimp.phys);
2518out_free_slim: 2524out_free_slim:
2519 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, phba->slim2p, 2525 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE,
2520 phba->slim2p_mapping); 2526 phba->slim2p.virt, phba->slim2p.phys);
2521out_iounmap: 2527out_iounmap:
2522 iounmap(phba->ctrl_regs_memmap_p); 2528 iounmap(phba->ctrl_regs_memmap_p);
2523out_iounmap_slim: 2529out_iounmap_slim:
@@ -2599,12 +2605,12 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
2599 lpfc_scsi_free(phba); 2605 lpfc_scsi_free(phba);
2600 lpfc_mem_free(phba); 2606 lpfc_mem_free(phba);
2601 2607
2602 dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(), phba->hbqslimp.virt, 2608 dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(),
2603 phba->hbqslimp.phys); 2609 phba->hbqslimp.virt, phba->hbqslimp.phys);
2604 2610
2605 /* Free resources associated with SLI2 interface */ 2611 /* Free resources associated with SLI2 interface */
2606 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, 2612 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE,
2607 phba->slim2p, phba->slim2p_mapping); 2613 phba->slim2p.virt, phba->slim2p.phys);
2608 2614
2609 /* unmap adapter SLIM and Control Registers */ 2615 /* unmap adapter SLIM and Control Registers */
2610 iounmap(phba->ctrl_regs_memmap_p); 2616 iounmap(phba->ctrl_regs_memmap_p);
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/**
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index a22bdf9548a6..c1bb90cf0d06 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -198,7 +198,9 @@ lpfc_new_scsi_buf(struct lpfc_vport *vport)
198 struct lpfc_scsi_buf *psb; 198 struct lpfc_scsi_buf *psb;
199 struct ulp_bde64 *bpl; 199 struct ulp_bde64 *bpl;
200 IOCB_t *iocb; 200 IOCB_t *iocb;
201 dma_addr_t pdma_phys; 201 dma_addr_t pdma_phys_fcp_cmd;
202 dma_addr_t pdma_phys_fcp_rsp;
203 dma_addr_t pdma_phys_bpl;
202 uint16_t iotag; 204 uint16_t iotag;
203 205
204 psb = kzalloc(sizeof(struct lpfc_scsi_buf), GFP_KERNEL); 206 psb = kzalloc(sizeof(struct lpfc_scsi_buf), GFP_KERNEL);
@@ -238,40 +240,60 @@ lpfc_new_scsi_buf(struct lpfc_vport *vport)
238 240
239 /* Initialize local short-hand pointers. */ 241 /* Initialize local short-hand pointers. */
240 bpl = psb->fcp_bpl; 242 bpl = psb->fcp_bpl;
241 pdma_phys = psb->dma_handle; 243 pdma_phys_fcp_cmd = psb->dma_handle;
244 pdma_phys_fcp_rsp = psb->dma_handle + sizeof(struct fcp_cmnd);
245 pdma_phys_bpl = psb->dma_handle + sizeof(struct fcp_cmnd) +
246 sizeof(struct fcp_rsp);
242 247
243 /* 248 /*
244 * The first two bdes are the FCP_CMD and FCP_RSP. The balance are sg 249 * The first two bdes are the FCP_CMD and FCP_RSP. The balance are sg
245 * list bdes. Initialize the first two and leave the rest for 250 * list bdes. Initialize the first two and leave the rest for
246 * queuecommand. 251 * queuecommand.
247 */ 252 */
248 bpl->addrHigh = le32_to_cpu(putPaddrHigh(pdma_phys)); 253 bpl[0].addrHigh = le32_to_cpu(putPaddrHigh(pdma_phys_fcp_cmd));
249 bpl->addrLow = le32_to_cpu(putPaddrLow(pdma_phys)); 254 bpl[0].addrLow = le32_to_cpu(putPaddrLow(pdma_phys_fcp_cmd));
250 bpl->tus.f.bdeSize = sizeof (struct fcp_cmnd); 255 bpl[0].tus.f.bdeSize = sizeof(struct fcp_cmnd);
251 bpl->tus.f.bdeFlags = BUFF_USE_CMND; 256 bpl[0].tus.f.bdeFlags = BUFF_TYPE_BDE_64;
252 bpl->tus.w = le32_to_cpu(bpl->tus.w); 257 bpl[0].tus.w = le32_to_cpu(bpl->tus.w);
253 bpl++;
254 258
255 /* Setup the physical region for the FCP RSP */ 259 /* Setup the physical region for the FCP RSP */
256 pdma_phys += sizeof (struct fcp_cmnd); 260 bpl[1].addrHigh = le32_to_cpu(putPaddrHigh(pdma_phys_fcp_rsp));
257 bpl->addrHigh = le32_to_cpu(putPaddrHigh(pdma_phys)); 261 bpl[1].addrLow = le32_to_cpu(putPaddrLow(pdma_phys_fcp_rsp));
258 bpl->addrLow = le32_to_cpu(putPaddrLow(pdma_phys)); 262 bpl[1].tus.f.bdeSize = sizeof(struct fcp_rsp);
259 bpl->tus.f.bdeSize = sizeof (struct fcp_rsp); 263 bpl[1].tus.f.bdeFlags = BUFF_TYPE_BDE_64;
260 bpl->tus.f.bdeFlags = (BUFF_USE_CMND | BUFF_USE_RCV); 264 bpl[1].tus.w = le32_to_cpu(bpl->tus.w);
261 bpl->tus.w = le32_to_cpu(bpl->tus.w);
262 265
263 /* 266 /*
264 * Since the IOCB for the FCP I/O is built into this lpfc_scsi_buf, 267 * Since the IOCB for the FCP I/O is built into this lpfc_scsi_buf,
265 * initialize it with all known data now. 268 * initialize it with all known data now.
266 */ 269 */
267 pdma_phys += (sizeof (struct fcp_rsp));
268 iocb = &psb->cur_iocbq.iocb; 270 iocb = &psb->cur_iocbq.iocb;
269 iocb->un.fcpi64.bdl.ulpIoTag32 = 0; 271 iocb->un.fcpi64.bdl.ulpIoTag32 = 0;
270 iocb->un.fcpi64.bdl.addrHigh = putPaddrHigh(pdma_phys); 272 if (phba->sli_rev == 3) {
271 iocb->un.fcpi64.bdl.addrLow = putPaddrLow(pdma_phys); 273 /* fill in immediate fcp command BDE */
272 iocb->un.fcpi64.bdl.bdeSize = (2 * sizeof (struct ulp_bde64)); 274 iocb->un.fcpi64.bdl.bdeFlags = BUFF_TYPE_BDE_IMMED;
273 iocb->un.fcpi64.bdl.bdeFlags = BUFF_TYPE_BDL; 275 iocb->un.fcpi64.bdl.bdeSize = sizeof(struct fcp_cmnd);
274 iocb->ulpBdeCount = 1; 276 iocb->un.fcpi64.bdl.addrLow = offsetof(IOCB_t,
277 unsli3.fcp_ext.icd);
278 iocb->un.fcpi64.bdl.addrHigh = 0;
279 iocb->ulpBdeCount = 0;
280 iocb->ulpLe = 0;
281 /* fill in responce BDE */
282 iocb->unsli3.fcp_ext.rbde.tus.f.bdeFlags = BUFF_TYPE_BDE_64;
283 iocb->unsli3.fcp_ext.rbde.tus.f.bdeSize =
284 sizeof(struct fcp_rsp);
285 iocb->unsli3.fcp_ext.rbde.addrLow =
286 putPaddrLow(pdma_phys_fcp_rsp);
287 iocb->unsli3.fcp_ext.rbde.addrHigh =
288 putPaddrHigh(pdma_phys_fcp_rsp);
289 } else {
290 iocb->un.fcpi64.bdl.bdeFlags = BUFF_TYPE_BLP_64;
291 iocb->un.fcpi64.bdl.bdeSize = (2 * sizeof(struct ulp_bde64));
292 iocb->un.fcpi64.bdl.addrLow = putPaddrLow(pdma_phys_bpl);
293 iocb->un.fcpi64.bdl.addrHigh = putPaddrHigh(pdma_phys_bpl);
294 iocb->ulpBdeCount = 1;
295 iocb->ulpLe = 1;
296 }
275 iocb->ulpClass = CLASS3; 297 iocb->ulpClass = CLASS3;
276 298
277 return psb; 299 return psb;
@@ -313,8 +335,9 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
313 struct fcp_cmnd *fcp_cmnd = lpfc_cmd->fcp_cmnd; 335 struct fcp_cmnd *fcp_cmnd = lpfc_cmd->fcp_cmnd;
314 struct ulp_bde64 *bpl = lpfc_cmd->fcp_bpl; 336 struct ulp_bde64 *bpl = lpfc_cmd->fcp_bpl;
315 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb; 337 IOCB_t *iocb_cmd = &lpfc_cmd->cur_iocbq.iocb;
338 struct ulp_bde64 *data_bde = iocb_cmd->unsli3.fcp_ext.dbde;
316 dma_addr_t physaddr; 339 dma_addr_t physaddr;
317 uint32_t i, num_bde = 0; 340 uint32_t num_bde = 0;
318 int nseg, datadir = scsi_cmnd->sc_data_direction; 341 int nseg, datadir = scsi_cmnd->sc_data_direction;
319 342
320 /* 343 /*
@@ -352,33 +375,64 @@ lpfc_scsi_prep_dma_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
352 * during probe that limits the number of sg elements in any 375 * during probe that limits the number of sg elements in any
353 * single scsi command. Just run through the seg_cnt and format 376 * single scsi command. Just run through the seg_cnt and format
354 * the bde's. 377 * the bde's.
378 * When using SLI-3 the driver will try to fit all the BDEs into
379 * the IOCB. If it can't then the BDEs get added to a BPL as it
380 * does for SLI-2 mode.
355 */ 381 */
356 scsi_for_each_sg(scsi_cmnd, sgel, nseg, i) { 382 scsi_for_each_sg(scsi_cmnd, sgel, nseg, num_bde) {
357 physaddr = sg_dma_address(sgel); 383 physaddr = sg_dma_address(sgel);
358 bpl->addrLow = le32_to_cpu(putPaddrLow(physaddr)); 384 if (phba->sli_rev == 3 &&
359 bpl->addrHigh = le32_to_cpu(putPaddrHigh(physaddr)); 385 nseg <= LPFC_EXT_DATA_BDE_COUNT) {
360 bpl->tus.f.bdeSize = sg_dma_len(sgel); 386 data_bde->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
361 if (datadir == DMA_TO_DEVICE) 387 data_bde->tus.f.bdeSize = sg_dma_len(sgel);
362 bpl->tus.f.bdeFlags = 0; 388 data_bde->addrLow = putPaddrLow(physaddr);
363 else 389 data_bde->addrHigh = putPaddrHigh(physaddr);
364 bpl->tus.f.bdeFlags = BUFF_USE_RCV; 390 data_bde++;
365 bpl->tus.w = le32_to_cpu(bpl->tus.w); 391 } else {
366 bpl++; 392 bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64;
367 num_bde++; 393 bpl->tus.f.bdeSize = sg_dma_len(sgel);
394 bpl->tus.w = le32_to_cpu(bpl->tus.w);
395 bpl->addrLow =
396 le32_to_cpu(putPaddrLow(physaddr));
397 bpl->addrHigh =
398 le32_to_cpu(putPaddrHigh(physaddr));
399 bpl++;
400 }
368 } 401 }
369 } 402 }
370 403
371 /* 404 /*
372 * Finish initializing those IOCB fields that are dependent on the 405 * Finish initializing those IOCB fields that are dependent on the
373 * scsi_cmnd request_buffer. Note that the bdeSize is explicitly 406 * scsi_cmnd request_buffer. Note that for SLI-2 the bdeSize is
374 * reinitialized since all iocb memory resources are used many times 407 * explicitly reinitialized and for SLI-3 the extended bde count is
375 * for transmit, receive, and continuation bpl's. 408 * explicitly reinitialized since all iocb memory resources are reused.
376 */ 409 */
377 iocb_cmd->un.fcpi64.bdl.bdeSize = (2 * sizeof (struct ulp_bde64)); 410 if (phba->sli_rev == 3) {
378 iocb_cmd->un.fcpi64.bdl.bdeSize += 411 if (num_bde > LPFC_EXT_DATA_BDE_COUNT) {
379 (num_bde * sizeof (struct ulp_bde64)); 412 /*
380 iocb_cmd->ulpBdeCount = 1; 413 * The extended IOCB format can only fit 3 BDE or a BPL.
381 iocb_cmd->ulpLe = 1; 414 * This I/O has more than 3 BDE so the 1st data bde will
415 * be a BPL that is filled in here.
416 */
417 physaddr = lpfc_cmd->dma_handle;
418 data_bde->tus.f.bdeFlags = BUFF_TYPE_BLP_64;
419 data_bde->tus.f.bdeSize = (num_bde *
420 sizeof(struct ulp_bde64));
421 physaddr += (sizeof(struct fcp_cmnd) +
422 sizeof(struct fcp_rsp) +
423 (2 * sizeof(struct ulp_bde64)));
424 data_bde->addrHigh = putPaddrHigh(physaddr);
425 data_bde->addrLow = putPaddrLow(physaddr);
426 /* ebde count includes the responce bde and data bpl */
427 iocb_cmd->unsli3.fcp_ext.ebde_count = 2;
428 } else {
429 /* ebde count includes the responce bde and data bdes */
430 iocb_cmd->unsli3.fcp_ext.ebde_count = (num_bde + 1);
431 }
432 } else {
433 iocb_cmd->un.fcpi64.bdl.bdeSize =
434 ((num_bde + 2) * sizeof(struct ulp_bde64));
435 }
382 fcp_cmnd->fcpDl = cpu_to_be32(scsi_bufflen(scsi_cmnd)); 436 fcp_cmnd->fcpDl = cpu_to_be32(scsi_bufflen(scsi_cmnd));
383 return 0; 437 return 0;
384} 438}
@@ -692,6 +746,24 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
692 lpfc_release_scsi_buf(phba, lpfc_cmd); 746 lpfc_release_scsi_buf(phba, lpfc_cmd);
693} 747}
694 748
749/**
750 * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB.
751 * @data: A pointer to the immediate command data portion of the IOCB.
752 * @fcp_cmnd: The FCP Command that is provided by the SCSI layer.
753 *
754 * The routine copies the entire FCP command from @fcp_cmnd to @data while
755 * byte swapping the data to big endian format for transmission on the wire.
756 **/
757static void
758lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd)
759{
760 int i, j;
761 for (i = 0, j = 0; i < sizeof(struct fcp_cmnd);
762 i += sizeof(uint32_t), j++) {
763 ((uint32_t *)data)[j] = cpu_to_be32(((uint32_t *)fcp_cmnd)[j]);
764 }
765}
766
695static void 767static void
696lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, 768lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
697 struct lpfc_nodelist *pnode) 769 struct lpfc_nodelist *pnode)
@@ -758,7 +830,8 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
758 fcp_cmnd->fcpCntl3 = 0; 830 fcp_cmnd->fcpCntl3 = 0;
759 phba->fc4ControlRequests++; 831 phba->fc4ControlRequests++;
760 } 832 }
761 833 if (phba->sli_rev == 3)
834 lpfc_fcpcmd_to_iocb(iocb_cmd->unsli3.fcp_ext.icd, fcp_cmnd);
762 /* 835 /*
763 * Finish initializing those IOCB fields that are independent 836 * Finish initializing those IOCB fields that are independent
764 * of the scsi_cmnd request_buffer 837 * of the scsi_cmnd request_buffer
@@ -798,11 +871,13 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport,
798 piocb = &piocbq->iocb; 871 piocb = &piocbq->iocb;
799 872
800 fcp_cmnd = lpfc_cmd->fcp_cmnd; 873 fcp_cmnd = lpfc_cmd->fcp_cmnd;
801 int_to_scsilun(lun, &lpfc_cmd->fcp_cmnd->fcp_lun); 874 /* Clear out any old data in the FCP command area */
875 memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd));
876 int_to_scsilun(lun, &fcp_cmnd->fcp_lun);
802 fcp_cmnd->fcpCntl2 = task_mgmt_cmd; 877 fcp_cmnd->fcpCntl2 = task_mgmt_cmd;
803 878 if (vport->phba->sli_rev == 3)
879 lpfc_fcpcmd_to_iocb(piocb->unsli3.fcp_ext.icd, fcp_cmnd);
804 piocb->ulpCommand = CMD_FCP_ICMND64_CR; 880 piocb->ulpCommand = CMD_FCP_ICMND64_CR;
805
806 piocb->ulpContext = ndlp->nlp_rpi; 881 piocb->ulpContext = ndlp->nlp_rpi;
807 if (ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) { 882 if (ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) {
808 piocb->ulpFCP2Rcvy = 1; 883 piocb->ulpFCP2Rcvy = 1;
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 3cf488496d86..77afa2ba6a2b 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -406,11 +406,8 @@ lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
406static IOCB_t * 406static IOCB_t *
407lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 407lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
408{ 408{
409 struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? 409 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
410 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
411 &phba->slim2p->mbx.us.s2.port[pring->ringno];
412 uint32_t max_cmd_idx = pring->numCiocb; 410 uint32_t max_cmd_idx = pring->numCiocb;
413
414 if ((pring->next_cmdidx == pring->cmdidx) && 411 if ((pring->next_cmdidx == pring->cmdidx) &&
415 (++pring->next_cmdidx >= max_cmd_idx)) 412 (++pring->next_cmdidx >= max_cmd_idx))
416 pring->next_cmdidx = 0; 413 pring->next_cmdidx = 0;
@@ -625,9 +622,11 @@ lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
625 /* 622 /*
626 * Tell the HBA that there is work to do in this ring. 623 * Tell the HBA that there is work to do in this ring.
627 */ 624 */
628 wmb(); 625 if (!(phba->sli3_options & LPFC_SLI3_CRP_ENABLED)) {
629 writel(CA_R0ATT << (ringno * 4), phba->CAregaddr); 626 wmb();
630 readl(phba->CAregaddr); /* flush */ 627 writel(CA_R0ATT << (ringno * 4), phba->CAregaddr);
628 readl(phba->CAregaddr); /* flush */
629 }
631} 630}
632 631
633/** 632/**
@@ -1654,9 +1653,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1654static void 1653static void
1655lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) 1654lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
1656{ 1655{
1657 struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? 1656 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
1658 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
1659 &phba->slim2p->mbx.us.s2.port[pring->ringno];
1660 /* 1657 /*
1661 * Ring <ringno> handler: portRspPut <portRspPut> is bigger then 1658 * Ring <ringno> handler: portRspPut <portRspPut> is bigger then
1662 * rsp ring <portRspMax> 1659 * rsp ring <portRspMax>
@@ -1704,7 +1701,7 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
1704 IOCB_t *entry = NULL; 1701 IOCB_t *entry = NULL;
1705 struct lpfc_iocbq *cmdiocbq = NULL; 1702 struct lpfc_iocbq *cmdiocbq = NULL;
1706 struct lpfc_iocbq rspiocbq; 1703 struct lpfc_iocbq rspiocbq;
1707 struct lpfc_pgp *pgp; 1704 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
1708 uint32_t status; 1705 uint32_t status;
1709 uint32_t portRspPut, portRspMax; 1706 uint32_t portRspPut, portRspMax;
1710 int type; 1707 int type;
@@ -1714,11 +1711,6 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
1714 1711
1715 pring->stats.iocb_event++; 1712 pring->stats.iocb_event++;
1716 1713
1717 pgp = (phba->sli_rev == 3) ?
1718 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
1719 &phba->slim2p->mbx.us.s2.port[pring->ringno];
1720
1721
1722 /* 1714 /*
1723 * The next available response entry should never exceed the maximum 1715 * The next available response entry should never exceed the maximum
1724 * entries. If it does, treat it as an adapter hardware error. 1716 * entries. If it does, treat it as an adapter hardware error.
@@ -1870,9 +1862,7 @@ static int
1870lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, 1862lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
1871 struct lpfc_sli_ring *pring, uint32_t mask) 1863 struct lpfc_sli_ring *pring, uint32_t mask)
1872{ 1864{
1873 struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? 1865 struct lpfc_pgp *pgp = &phba->port_gp[pring->ringno];
1874 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
1875 &phba->slim2p->mbx.us.s2.port[pring->ringno];
1876 IOCB_t *irsp = NULL; 1866 IOCB_t *irsp = NULL;
1877 IOCB_t *entry = NULL; 1867 IOCB_t *entry = NULL;
1878 struct lpfc_iocbq *cmdiocbq = NULL; 1868 struct lpfc_iocbq *cmdiocbq = NULL;
@@ -2064,9 +2054,7 @@ int
2064lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, 2054lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
2065 struct lpfc_sli_ring *pring, uint32_t mask) 2055 struct lpfc_sli_ring *pring, uint32_t mask)
2066{ 2056{
2067 struct lpfc_pgp *pgp = (phba->sli_rev == 3) ? 2057 struct lpfc_pgp *pgp;
2068 &phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
2069 &phba->slim2p->mbx.us.s2.port[pring->ringno];
2070 IOCB_t *entry; 2058 IOCB_t *entry;
2071 IOCB_t *irsp = NULL; 2059 IOCB_t *irsp = NULL;
2072 struct lpfc_iocbq *rspiocbp = NULL; 2060 struct lpfc_iocbq *rspiocbp = NULL;
@@ -2080,6 +2068,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
2080 int rc = 1; 2068 int rc = 1;
2081 unsigned long iflag; 2069 unsigned long iflag;
2082 2070
2071 pgp = &phba->port_gp[pring->ringno];
2083 spin_lock_irqsave(&phba->hbalock, iflag); 2072 spin_lock_irqsave(&phba->hbalock, iflag);
2084 pring->stats.iocb_event++; 2073 pring->stats.iocb_event++;
2085 2074
@@ -2990,13 +2979,15 @@ lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode)
2990 if (rc == -ERESTART) { 2979 if (rc == -ERESTART) {
2991 phba->link_state = LPFC_LINK_UNKNOWN; 2980 phba->link_state = LPFC_LINK_UNKNOWN;
2992 continue; 2981 continue;
2993 } else if (rc) { 2982 } else if (rc)
2994 break; 2983 break;
2995 }
2996
2997 phba->link_state = LPFC_INIT_MBX_CMDS; 2984 phba->link_state = LPFC_INIT_MBX_CMDS;
2998 lpfc_config_port(phba, pmb); 2985 lpfc_config_port(phba, pmb);
2999 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); 2986 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
2987 phba->sli3_options &= ~(LPFC_SLI3_NPIV_ENABLED |
2988 LPFC_SLI3_HBQ_ENABLED |
2989 LPFC_SLI3_CRP_ENABLED |
2990 LPFC_SLI3_INB_ENABLED);
3000 if (rc != MBX_SUCCESS) { 2991 if (rc != MBX_SUCCESS) {
3001 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 2992 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
3002 "0442 Adapter failed to init, mbxCmd x%x " 2993 "0442 Adapter failed to init, mbxCmd x%x "
@@ -3006,25 +2997,44 @@ lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode)
3006 phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE; 2997 phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE;
3007 spin_unlock_irq(&phba->hbalock); 2998 spin_unlock_irq(&phba->hbalock);
3008 rc = -ENXIO; 2999 rc = -ENXIO;
3009 } else { 3000 } else
3010 done = 1; 3001 done = 1;
3011 phba->max_vpi = (phba->max_vpi &&
3012 pmb->mb.un.varCfgPort.gmv) != 0
3013 ? pmb->mb.un.varCfgPort.max_vpi
3014 : 0;
3015 }
3016 } 3002 }
3017
3018 if (!done) { 3003 if (!done) {
3019 rc = -EINVAL; 3004 rc = -EINVAL;
3020 goto do_prep_failed; 3005 goto do_prep_failed;
3021 } 3006 }
3022 3007 if (pmb->mb.un.varCfgPort.sli_mode == 3) {
3023 if ((pmb->mb.un.varCfgPort.sli_mode == 3) && 3008 if (!pmb->mb.un.varCfgPort.cMA) {
3024 (!pmb->mb.un.varCfgPort.cMA)) { 3009 rc = -ENXIO;
3025 rc = -ENXIO; 3010 goto do_prep_failed;
3011 }
3012 if (phba->max_vpi && pmb->mb.un.varCfgPort.gmv) {
3013 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED;
3014 phba->max_vpi = pmb->mb.un.varCfgPort.max_vpi;
3015 } else
3016 phba->max_vpi = 0;
3017 if (pmb->mb.un.varCfgPort.gerbm)
3018 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED;
3019 if (pmb->mb.un.varCfgPort.gcrp)
3020 phba->sli3_options |= LPFC_SLI3_CRP_ENABLED;
3021 if (pmb->mb.un.varCfgPort.ginb) {
3022 phba->sli3_options |= LPFC_SLI3_INB_ENABLED;
3023 phba->port_gp = phba->mbox->us.s3_inb_pgp.port;
3024 phba->inb_ha_copy = &phba->mbox->us.s3_inb_pgp.ha_copy;
3025 phba->inb_counter = &phba->mbox->us.s3_inb_pgp.counter;
3026 phba->inb_last_counter =
3027 phba->mbox->us.s3_inb_pgp.counter;
3028 } else {
3029 phba->port_gp = phba->mbox->us.s3_pgp.port;
3030 phba->inb_ha_copy = NULL;
3031 phba->inb_counter = NULL;
3032 }
3033 } else {
3034 phba->port_gp = phba->mbox->us.s2.port;
3035 phba->inb_ha_copy = NULL;
3036 phba->inb_counter = NULL;
3026 } 3037 }
3027
3028do_prep_failed: 3038do_prep_failed:
3029 mempool_free(pmb, phba->mbox_mem_pool); 3039 mempool_free(pmb, phba->mbox_mem_pool);
3030 return rc; 3040 return rc;
@@ -3085,9 +3095,6 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
3085 if (phba->sli_rev == 3) { 3095 if (phba->sli_rev == 3) {
3086 phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE; 3096 phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE;
3087 phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE; 3097 phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE;
3088 phba->sli3_options |= LPFC_SLI3_ENABLED;
3089 phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED;
3090
3091 } else { 3098 } else {
3092 phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE; 3099 phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE;
3093 phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE; 3100 phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE;
@@ -3255,7 +3262,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
3255 int i; 3262 int i;
3256 unsigned long timeout; 3263 unsigned long timeout;
3257 unsigned long drvr_flag = 0; 3264 unsigned long drvr_flag = 0;
3258 volatile uint32_t word0, ldata; 3265 uint32_t word0, ldata;
3259 void __iomem *to_slim; 3266 void __iomem *to_slim;
3260 int processing_queue = 0; 3267 int processing_queue = 0;
3261 3268
@@ -3415,12 +3422,11 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
3415 3422
3416 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3423 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
3417 /* First copy command data to host SLIM area */ 3424 /* First copy command data to host SLIM area */
3418 lpfc_sli_pcimem_bcopy(mb, &phba->slim2p->mbx, MAILBOX_CMD_SIZE); 3425 lpfc_sli_pcimem_bcopy(mb, phba->mbox, MAILBOX_CMD_SIZE);
3419 } else { 3426 } else {
3420 if (mb->mbxCommand == MBX_CONFIG_PORT) { 3427 if (mb->mbxCommand == MBX_CONFIG_PORT) {
3421 /* copy command data into host mbox for cmpl */ 3428 /* copy command data into host mbox for cmpl */
3422 lpfc_sli_pcimem_bcopy(mb, &phba->slim2p->mbx, 3429 lpfc_sli_pcimem_bcopy(mb, phba->mbox, MAILBOX_CMD_SIZE);
3423 MAILBOX_CMD_SIZE);
3424 } 3430 }
3425 3431
3426 /* First copy mbox command data to HBA SLIM, skip past first 3432 /* First copy mbox command data to HBA SLIM, skip past first
@@ -3430,7 +3436,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
3430 MAILBOX_CMD_SIZE - sizeof (uint32_t)); 3436 MAILBOX_CMD_SIZE - sizeof (uint32_t));
3431 3437
3432 /* Next copy over first word, with mbxOwner set */ 3438 /* Next copy over first word, with mbxOwner set */
3433 ldata = *((volatile uint32_t *)mb); 3439 ldata = *((uint32_t *)mb);
3434 to_slim = phba->MBslimaddr; 3440 to_slim = phba->MBslimaddr;
3435 writel(ldata, to_slim); 3441 writel(ldata, to_slim);
3436 readl(to_slim); /* flush */ 3442 readl(to_slim); /* flush */
@@ -3462,7 +3468,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
3462 3468
3463 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3469 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
3464 /* First read mbox status word */ 3470 /* First read mbox status word */
3465 word0 = *((volatile uint32_t *)&phba->slim2p->mbx); 3471 word0 = *((uint32_t *)phba->mbox);
3466 word0 = le32_to_cpu(word0); 3472 word0 = le32_to_cpu(word0);
3467 } else { 3473 } else {
3468 /* First read mbox status word */ 3474 /* First read mbox status word */
@@ -3501,12 +3507,11 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
3501 3507
3502 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3508 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
3503 /* First copy command data */ 3509 /* First copy command data */
3504 word0 = *((volatile uint32_t *) 3510 word0 = *((uint32_t *)phba->mbox);
3505 &phba->slim2p->mbx);
3506 word0 = le32_to_cpu(word0); 3511 word0 = le32_to_cpu(word0);
3507 if (mb->mbxCommand == MBX_CONFIG_PORT) { 3512 if (mb->mbxCommand == MBX_CONFIG_PORT) {
3508 MAILBOX_t *slimmb; 3513 MAILBOX_t *slimmb;
3509 volatile uint32_t slimword0; 3514 uint32_t slimword0;
3510 /* Check real SLIM for any errors */ 3515 /* Check real SLIM for any errors */
3511 slimword0 = readl(phba->MBslimaddr); 3516 slimword0 = readl(phba->MBslimaddr);
3512 slimmb = (MAILBOX_t *) & slimword0; 3517 slimmb = (MAILBOX_t *) & slimword0;
@@ -3527,8 +3532,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
3527 3532
3528 if (psli->sli_flag & LPFC_SLI2_ACTIVE) { 3533 if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
3529 /* copy results back to user */ 3534 /* copy results back to user */
3530 lpfc_sli_pcimem_bcopy(&phba->slim2p->mbx, mb, 3535 lpfc_sli_pcimem_bcopy(phba->mbox, mb, MAILBOX_CMD_SIZE);
3531 MAILBOX_CMD_SIZE);
3532 } else { 3536 } else {
3533 /* First copy command data */ 3537 /* First copy command data */
3534 lpfc_memcpy_from_slim(mb, phba->MBslimaddr, 3538 lpfc_memcpy_from_slim(mb, phba->MBslimaddr,
@@ -5095,7 +5099,16 @@ lpfc_intr_handler(int irq, void *dev_id)
5095 * preserve status) and Link Attention 5099 * preserve status) and Link Attention
5096 */ 5100 */
5097 spin_lock(&phba->hbalock); 5101 spin_lock(&phba->hbalock);
5098 ha_copy = readl(phba->HAregaddr); 5102 if (phba->sli3_options & LPFC_SLI3_INB_ENABLED &&
5103 (phba->inb_last_counter != *phba->inb_counter)) {
5104 phba->inb_last_counter = *phba->inb_counter;
5105 ha_copy = le32_to_cpu(*phba->inb_ha_copy);
5106 } else
5107 ha_copy = readl(phba->HAregaddr);
5108 if (unlikely(!ha_copy)) {
5109 spin_unlock(&phba->hbalock);
5110 return IRQ_NONE;
5111 }
5099 /* If somebody is waiting to handle an eratt don't process it 5112 /* If somebody is waiting to handle an eratt don't process it
5100 * here. The brdkill function will do this. 5113 * here. The brdkill function will do this.
5101 */ 5114 */
@@ -5105,9 +5118,6 @@ lpfc_intr_handler(int irq, void *dev_id)
5105 readl(phba->HAregaddr); /* flush */ 5118 readl(phba->HAregaddr); /* flush */
5106 spin_unlock(&phba->hbalock); 5119 spin_unlock(&phba->hbalock);
5107 5120
5108 if (unlikely(!ha_copy))
5109 return IRQ_NONE;
5110
5111 work_ha_copy = ha_copy & phba->work_ha_mask; 5121 work_ha_copy = ha_copy & phba->work_ha_mask;
5112 5122
5113 if (unlikely(work_ha_copy)) { 5123 if (unlikely(work_ha_copy)) {
@@ -5194,7 +5204,7 @@ lpfc_intr_handler(int irq, void *dev_id)
5194 (phba->sli.mbox_active)) { 5204 (phba->sli.mbox_active)) {
5195 pmb = phba->sli.mbox_active; 5205 pmb = phba->sli.mbox_active;
5196 pmbox = &pmb->mb; 5206 pmbox = &pmb->mb;
5197 mbox = &phba->slim2p->mbx; 5207 mbox = phba->mbox;
5198 vport = pmb->vport; 5208 vport = pmb->vport;
5199 5209
5200 /* First check out the status word */ 5210 /* First check out the status word */