aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c134
1 files changed, 82 insertions, 52 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index fc67cc65c63b..562d8cee874b 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -211,7 +211,7 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
211 goto out_free_mbox; 211 goto out_free_mbox;
212 212
213 do { 213 do {
214 lpfc_dump_mem(phba, pmb, offset); 214 lpfc_dump_mem(phba, pmb, offset, DMP_REGION_VPD);
215 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); 215 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
216 216
217 if (rc != MBX_SUCCESS) { 217 if (rc != MBX_SUCCESS) {
@@ -425,6 +425,9 @@ lpfc_config_port_post(struct lpfc_hba *phba)
425 return -EIO; 425 return -EIO;
426 } 426 }
427 427
428 /* Check if the port is disabled */
429 lpfc_sli_read_link_ste(phba);
430
428 /* Reset the DFT_HBA_Q_DEPTH to the max xri */ 431 /* Reset the DFT_HBA_Q_DEPTH to the max xri */
429 if (phba->cfg_hba_queue_depth > (mb->un.varRdConfig.max_xri+1)) 432 if (phba->cfg_hba_queue_depth > (mb->un.varRdConfig.max_xri+1))
430 phba->cfg_hba_queue_depth = 433 phba->cfg_hba_queue_depth =
@@ -524,27 +527,46 @@ lpfc_config_port_post(struct lpfc_hba *phba)
524 /* Set up error attention (ERATT) polling timer */ 527 /* Set up error attention (ERATT) polling timer */
525 mod_timer(&phba->eratt_poll, jiffies + HZ * LPFC_ERATT_POLL_INTERVAL); 528 mod_timer(&phba->eratt_poll, jiffies + HZ * LPFC_ERATT_POLL_INTERVAL);
526 529
527 lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed); 530 if (phba->hba_flag & LINK_DISABLED) {
528 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; 531 lpfc_printf_log(phba,
529 lpfc_set_loopback_flag(phba); 532 KERN_ERR, LOG_INIT,
530 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); 533 "2598 Adapter Link is disabled.\n");
531 if (rc != MBX_SUCCESS) { 534 lpfc_down_link(phba, pmb);
532 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 535 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
536 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
537 if ((rc != MBX_SUCCESS) && (rc != MBX_BUSY)) {
538 lpfc_printf_log(phba,
539 KERN_ERR, LOG_INIT,
540 "2599 Adapter failed to issue DOWN_LINK"
541 " mbox command rc 0x%x\n", rc);
542
543 mempool_free(pmb, phba->mbox_mem_pool);
544 return -EIO;
545 }
546 } else {
547 lpfc_init_link(phba, pmb, phba->cfg_topology,
548 phba->cfg_link_speed);
549 pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
550 lpfc_set_loopback_flag(phba);
551 rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
552 if (rc != MBX_SUCCESS) {
553 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
533 "0454 Adapter failed to init, mbxCmd x%x " 554 "0454 Adapter failed to init, mbxCmd x%x "
534 "INIT_LINK, mbxStatus x%x\n", 555 "INIT_LINK, mbxStatus x%x\n",
535 mb->mbxCommand, mb->mbxStatus); 556 mb->mbxCommand, mb->mbxStatus);
536 557
537 /* Clear all interrupt enable conditions */ 558 /* Clear all interrupt enable conditions */
538 writel(0, phba->HCregaddr); 559 writel(0, phba->HCregaddr);
539 readl(phba->HCregaddr); /* flush */ 560 readl(phba->HCregaddr); /* flush */
540 /* Clear all pending interrupts */ 561 /* Clear all pending interrupts */
541 writel(0xffffffff, phba->HAregaddr); 562 writel(0xffffffff, phba->HAregaddr);
542 readl(phba->HAregaddr); /* flush */ 563 readl(phba->HAregaddr); /* flush */
543 564
544 phba->link_state = LPFC_HBA_ERROR; 565 phba->link_state = LPFC_HBA_ERROR;
545 if (rc != MBX_BUSY) 566 if (rc != MBX_BUSY)
546 mempool_free(pmb, phba->mbox_mem_pool); 567 mempool_free(pmb, phba->mbox_mem_pool);
547 return -EIO; 568 return -EIO;
569 }
548 } 570 }
549 /* MBOX buffer will be freed in mbox compl */ 571 /* MBOX buffer will be freed in mbox compl */
550 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 572 pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
@@ -558,7 +580,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
558 KERN_ERR, 580 KERN_ERR,
559 LOG_INIT, 581 LOG_INIT,
560 "0456 Adapter failed to issue " 582 "0456 Adapter failed to issue "
561 "ASYNCEVT_ENABLE mbox status x%x \n.", 583 "ASYNCEVT_ENABLE mbox status x%x\n",
562 rc); 584 rc);
563 mempool_free(pmb, phba->mbox_mem_pool); 585 mempool_free(pmb, phba->mbox_mem_pool);
564 } 586 }
@@ -572,7 +594,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
572 594
573 if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) { 595 if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) {
574 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0435 Adapter failed " 596 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "0435 Adapter failed "
575 "to get Option ROM version status x%x\n.", rc); 597 "to get Option ROM version status x%x\n", rc);
576 mempool_free(pmb, phba->mbox_mem_pool); 598 mempool_free(pmb, phba->mbox_mem_pool);
577 } 599 }
578 600
@@ -2133,6 +2155,8 @@ lpfc_online(struct lpfc_hba *phba)
2133 vports[i]->fc_flag &= ~FC_OFFLINE_MODE; 2155 vports[i]->fc_flag &= ~FC_OFFLINE_MODE;
2134 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) 2156 if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)
2135 vports[i]->fc_flag |= FC_VPORT_NEEDS_REG_VPI; 2157 vports[i]->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
2158 if (phba->sli_rev == LPFC_SLI_REV4)
2159 vports[i]->fc_flag |= FC_VPORT_NEEDS_INIT_VPI;
2136 spin_unlock_irq(shost->host_lock); 2160 spin_unlock_irq(shost->host_lock);
2137 } 2161 }
2138 lpfc_destroy_vport_work_array(phba, vports); 2162 lpfc_destroy_vport_work_array(phba, vports);
@@ -2807,6 +2831,7 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
2807 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); 2831 att_type = lpfc_sli4_parse_latt_type(phba, acqe_link);
2808 if (att_type != AT_LINK_DOWN && att_type != AT_LINK_UP) 2832 if (att_type != AT_LINK_DOWN && att_type != AT_LINK_UP)
2809 return; 2833 return;
2834 phba->fcoe_eventtag = acqe_link->event_tag;
2810 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 2835 pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
2811 if (!pmb) { 2836 if (!pmb) {
2812 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 2837 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
@@ -2894,18 +2919,20 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
2894 uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe); 2919 uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe);
2895 int rc; 2920 int rc;
2896 2921
2922 phba->fcoe_eventtag = acqe_fcoe->event_tag;
2897 switch (event_type) { 2923 switch (event_type) {
2898 case LPFC_FCOE_EVENT_TYPE_NEW_FCF: 2924 case LPFC_FCOE_EVENT_TYPE_NEW_FCF:
2899 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2925 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2900 "2546 New FCF found index 0x%x tag 0x%x \n", 2926 "2546 New FCF found index 0x%x tag 0x%x\n",
2901 acqe_fcoe->fcf_index, 2927 acqe_fcoe->fcf_index,
2902 acqe_fcoe->event_tag); 2928 acqe_fcoe->event_tag);
2903 /* 2929 /*
2904 * If the current FCF is in discovered state, 2930 * If the current FCF is in discovered state, or
2905 * do nothing. 2931 * FCF discovery is in progress do nothing.
2906 */ 2932 */
2907 spin_lock_irq(&phba->hbalock); 2933 spin_lock_irq(&phba->hbalock);
2908 if (phba->fcf.fcf_flag & FCF_DISCOVERED) { 2934 if ((phba->fcf.fcf_flag & FCF_DISCOVERED) ||
2935 (phba->hba_flag & FCF_DISC_INPROGRESS)) {
2909 spin_unlock_irq(&phba->hbalock); 2936 spin_unlock_irq(&phba->hbalock);
2910 break; 2937 break;
2911 } 2938 }
@@ -2922,7 +2949,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
2922 2949
2923 case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL: 2950 case LPFC_FCOE_EVENT_TYPE_FCF_TABLE_FULL:
2924 lpfc_printf_log(phba, KERN_ERR, LOG_SLI, 2951 lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
2925 "2548 FCF Table full count 0x%x tag 0x%x \n", 2952 "2548 FCF Table full count 0x%x tag 0x%x\n",
2926 bf_get(lpfc_acqe_fcoe_fcf_count, acqe_fcoe), 2953 bf_get(lpfc_acqe_fcoe_fcf_count, acqe_fcoe),
2927 acqe_fcoe->event_tag); 2954 acqe_fcoe->event_tag);
2928 break; 2955 break;
@@ -2930,7 +2957,7 @@ lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba,
2930 case LPFC_FCOE_EVENT_TYPE_FCF_DEAD: 2957 case LPFC_FCOE_EVENT_TYPE_FCF_DEAD:
2931 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY, 2958 lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
2932 "2549 FCF disconnected fron network index 0x%x" 2959 "2549 FCF disconnected fron network index 0x%x"
2933 " tag 0x%x \n", acqe_fcoe->fcf_index, 2960 " tag 0x%x\n", acqe_fcoe->fcf_index,
2934 acqe_fcoe->event_tag); 2961 acqe_fcoe->event_tag);
2935 /* If the event is not for currently used fcf do nothing */ 2962 /* If the event is not for currently used fcf do nothing */
2936 if (phba->fcf.fcf_indx != acqe_fcoe->fcf_index) 2963 if (phba->fcf.fcf_indx != acqe_fcoe->fcf_index)
@@ -4130,8 +4157,7 @@ lpfc_hba_alloc(struct pci_dev *pdev)
4130 /* Allocate memory for HBA structure */ 4157 /* Allocate memory for HBA structure */
4131 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL); 4158 phba = kzalloc(sizeof(struct lpfc_hba), GFP_KERNEL);
4132 if (!phba) { 4159 if (!phba) {
4133 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 4160 dev_err(&pdev->dev, "failed to allocate hba struct\n");
4134 "1417 Failed to allocate hba struct.\n");
4135 return NULL; 4161 return NULL;
4136 } 4162 }
4137 4163
@@ -4145,6 +4171,9 @@ lpfc_hba_alloc(struct pci_dev *pdev)
4145 return NULL; 4171 return NULL;
4146 } 4172 }
4147 4173
4174 mutex_init(&phba->ct_event_mutex);
4175 INIT_LIST_HEAD(&phba->ct_ev_waiters);
4176
4148 return phba; 4177 return phba;
4149} 4178}
4150 4179
@@ -4489,23 +4518,6 @@ lpfc_sli4_post_status_check(struct lpfc_hba *phba)
4489 if (!phba->sli4_hba.STAregaddr) 4518 if (!phba->sli4_hba.STAregaddr)
4490 return -ENODEV; 4519 return -ENODEV;
4491 4520
4492 /* With uncoverable error, log the error message and return error */
4493 onlnreg0 = readl(phba->sli4_hba.ONLINE0regaddr);
4494 onlnreg1 = readl(phba->sli4_hba.ONLINE1regaddr);
4495 if ((onlnreg0 != LPFC_ONLINE_NERR) || (onlnreg1 != LPFC_ONLINE_NERR)) {
4496 uerrlo_reg.word0 = readl(phba->sli4_hba.UERRLOregaddr);
4497 uerrhi_reg.word0 = readl(phba->sli4_hba.UERRHIregaddr);
4498 if (uerrlo_reg.word0 || uerrhi_reg.word0) {
4499 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
4500 "1422 HBA Unrecoverable error: "
4501 "uerr_lo_reg=0x%x, uerr_hi_reg=0x%x, "
4502 "online0_reg=0x%x, online1_reg=0x%x\n",
4503 uerrlo_reg.word0, uerrhi_reg.word0,
4504 onlnreg0, onlnreg1);
4505 }
4506 return -ENODEV;
4507 }
4508
4509 /* Wait up to 30 seconds for the SLI Port POST done and ready */ 4521 /* Wait up to 30 seconds for the SLI Port POST done and ready */
4510 for (i = 0; i < 3000; i++) { 4522 for (i = 0; i < 3000; i++) {
4511 sta_reg.word0 = readl(phba->sli4_hba.STAregaddr); 4523 sta_reg.word0 = readl(phba->sli4_hba.STAregaddr);
@@ -4545,6 +4557,23 @@ lpfc_sli4_post_status_check(struct lpfc_hba *phba)
4545 bf_get(lpfc_scratchpad_featurelevel1, &scratchpad), 4557 bf_get(lpfc_scratchpad_featurelevel1, &scratchpad),
4546 bf_get(lpfc_scratchpad_featurelevel2, &scratchpad)); 4558 bf_get(lpfc_scratchpad_featurelevel2, &scratchpad));
4547 4559
4560 /* With uncoverable error, log the error message and return error */
4561 onlnreg0 = readl(phba->sli4_hba.ONLINE0regaddr);
4562 onlnreg1 = readl(phba->sli4_hba.ONLINE1regaddr);
4563 if ((onlnreg0 != LPFC_ONLINE_NERR) || (onlnreg1 != LPFC_ONLINE_NERR)) {
4564 uerrlo_reg.word0 = readl(phba->sli4_hba.UERRLOregaddr);
4565 uerrhi_reg.word0 = readl(phba->sli4_hba.UERRHIregaddr);
4566 if (uerrlo_reg.word0 || uerrhi_reg.word0) {
4567 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
4568 "1422 HBA Unrecoverable error: "
4569 "uerr_lo_reg=0x%x, uerr_hi_reg=0x%x, "
4570 "online0_reg=0x%x, online1_reg=0x%x\n",
4571 uerrlo_reg.word0, uerrhi_reg.word0,
4572 onlnreg0, onlnreg1);
4573 }
4574 return -ENODEV;
4575 }
4576
4548 return port_error; 4577 return port_error;
4549} 4578}
4550 4579
@@ -7347,6 +7376,9 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
7347 /* Perform post initialization setup */ 7376 /* Perform post initialization setup */
7348 lpfc_post_init_setup(phba); 7377 lpfc_post_init_setup(phba);
7349 7378
7379 /* Check if there are static vports to be created. */
7380 lpfc_create_static_vport(phba);
7381
7350 return 0; 7382 return 0;
7351 7383
7352out_disable_intr: 7384out_disable_intr:
@@ -7636,19 +7668,17 @@ static int __devinit
7636lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) 7668lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
7637{ 7669{
7638 int rc; 7670 int rc;
7639 uint16_t dev_id; 7671 struct lpfc_sli_intf intf;
7640 7672
7641 if (pci_read_config_word(pdev, PCI_DEVICE_ID, &dev_id)) 7673 if (pci_read_config_dword(pdev, LPFC_SLIREV_CONF_WORD, &intf.word0))
7642 return -ENODEV; 7674 return -ENODEV;
7643 7675
7644 switch (dev_id) { 7676 if ((bf_get(lpfc_sli_intf_valid, &intf) == LPFC_SLI_INTF_VALID) &&
7645 case PCI_DEVICE_ID_TIGERSHARK: 7677 (bf_get(lpfc_sli_intf_rev, &intf) == LPFC_SLIREV_CONF_SLI4))
7646 rc = lpfc_pci_probe_one_s4(pdev, pid); 7678 rc = lpfc_pci_probe_one_s4(pdev, pid);
7647 break; 7679 else
7648 default:
7649 rc = lpfc_pci_probe_one_s3(pdev, pid); 7680 rc = lpfc_pci_probe_one_s3(pdev, pid);
7650 break; 7681
7651 }
7652 return rc; 7682 return rc;
7653} 7683}
7654 7684