diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 13:36:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 13:36:08 -0500 |
commit | d04baa157d1b35cbd27c87b4a13111d9675b61f3 (patch) | |
tree | c46966fbea1c34bed2bd38629ce948d5a088281c /drivers/scsi/lpfc/lpfc_init.c | |
parent | 88266917b518e2ca954d85983470592aaaf82993 (diff) | |
parent | 5c41dc3a79150e93e5d050871a10b761be8281a1 (diff) |
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
SCSI updates for post 3.2 merge window
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (67 commits)
[SCSI] lpfc 8.3.28: Update driver version to 8.3.28
[SCSI] lpfc 8.3.28: Add Loopback support for SLI4 adapters
[SCSI] lpfc 8.3.28: Critical Miscellaneous fixes
[SCSI] Lpfc 8.3.28: FC and SCSI Discovery Fixes
[SCSI] lpfc 8.3.28: Add support for ABTS failure handling
[SCSI] lpfc 8.3.28: SLI fixes and added SLI4 support
[SCSI] lpfc 8.3.28: Miscellaneous fixes in sysfs and mgmt interfaces
[SCSI] mpt2sas: Removed redundant calling of _scsih_probe_devices() from _scsih_probe
[SCSI] mac_scsi: Remove obsolete IRQ_FLG_* users
[SCSI] qla4xxx: Update driver version to 5.02.00-k10
[SCSI] qla4xxx: check for FW alive before calling chip_reset
[SCSI] qla4xxx: Fix qla4xxx_dump_buffer to dump buffer correctly
[SCSI] qla4xxx: Fix the IDC locking mechanism
[SCSI] qla4xxx: Wait for disable_acb before doing set_acb
[SCSI] qla4xxx: Don't recover adapter if device state is FAILED
[SCSI] qla4xxx: fix call trace on rmmod with ql4xdontresethba=1
[SCSI] qla4xxx: Fix CPU lockups when ql4xdontresethba set
[SCSI] qla4xxx: Perform context resets in case of context failures.
[SCSI] iscsi class: export pid of process that created
[SCSI] mpt2sas: Remove unused duplicate diag_buffer_enable param
...
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 338 |
1 files changed, 228 insertions, 110 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 55bc4fc7376f..dfea2dada02c 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -62,7 +62,6 @@ static int lpfc_post_rcv_buf(struct lpfc_hba *); | |||
62 | static int lpfc_sli4_queue_verify(struct lpfc_hba *); | 62 | static int lpfc_sli4_queue_verify(struct lpfc_hba *); |
63 | static int lpfc_create_bootstrap_mbox(struct lpfc_hba *); | 63 | static int lpfc_create_bootstrap_mbox(struct lpfc_hba *); |
64 | static int lpfc_setup_endian_order(struct lpfc_hba *); | 64 | static int lpfc_setup_endian_order(struct lpfc_hba *); |
65 | static int lpfc_sli4_read_config(struct lpfc_hba *); | ||
66 | static void lpfc_destroy_bootstrap_mbox(struct lpfc_hba *); | 65 | static void lpfc_destroy_bootstrap_mbox(struct lpfc_hba *); |
67 | static void lpfc_free_sgl_list(struct lpfc_hba *); | 66 | static void lpfc_free_sgl_list(struct lpfc_hba *); |
68 | static int lpfc_init_sgl_list(struct lpfc_hba *); | 67 | static int lpfc_init_sgl_list(struct lpfc_hba *); |
@@ -475,27 +474,6 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
475 | /* Get the default values for Model Name and Description */ | 474 | /* Get the default values for Model Name and Description */ |
476 | lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); | 475 | lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); |
477 | 476 | ||
478 | if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_16G) | ||
479 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) | ||
480 | && !(phba->lmt & LMT_1Gb)) | ||
481 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) | ||
482 | && !(phba->lmt & LMT_2Gb)) | ||
483 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) | ||
484 | && !(phba->lmt & LMT_4Gb)) | ||
485 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) | ||
486 | && !(phba->lmt & LMT_8Gb)) | ||
487 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) | ||
488 | && !(phba->lmt & LMT_10Gb)) | ||
489 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) | ||
490 | && !(phba->lmt & LMT_16Gb))) { | ||
491 | /* Reset link speed to auto */ | ||
492 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | ||
493 | "1302 Invalid speed for this board: " | ||
494 | "Reset link speed to auto: x%x\n", | ||
495 | phba->cfg_link_speed); | ||
496 | phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; | ||
497 | } | ||
498 | |||
499 | phba->link_state = LPFC_LINK_DOWN; | 477 | phba->link_state = LPFC_LINK_DOWN; |
500 | 478 | ||
501 | /* Only process IOCBs on ELS ring till hba_state is READY */ | 479 | /* Only process IOCBs on ELS ring till hba_state is READY */ |
@@ -585,28 +563,10 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
585 | return -EIO; | 563 | return -EIO; |
586 | } | 564 | } |
587 | } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { | 565 | } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { |
588 | lpfc_init_link(phba, pmb, phba->cfg_topology, | 566 | mempool_free(pmb, phba->mbox_mem_pool); |
589 | phba->cfg_link_speed); | 567 | rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); |
590 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 568 | if (rc) |
591 | lpfc_set_loopback_flag(phba); | 569 | return rc; |
592 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); | ||
593 | if (rc != MBX_SUCCESS) { | ||
594 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
595 | "0454 Adapter failed to init, mbxCmd x%x " | ||
596 | "INIT_LINK, mbxStatus x%x\n", | ||
597 | mb->mbxCommand, mb->mbxStatus); | ||
598 | |||
599 | /* Clear all interrupt enable conditions */ | ||
600 | writel(0, phba->HCregaddr); | ||
601 | readl(phba->HCregaddr); /* flush */ | ||
602 | /* Clear all pending interrupts */ | ||
603 | writel(0xffffffff, phba->HAregaddr); | ||
604 | readl(phba->HAregaddr); /* flush */ | ||
605 | phba->link_state = LPFC_HBA_ERROR; | ||
606 | if (rc != MBX_BUSY) | ||
607 | mempool_free(pmb, phba->mbox_mem_pool); | ||
608 | return -EIO; | ||
609 | } | ||
610 | } | 570 | } |
611 | /* MBOX buffer will be freed in mbox compl */ | 571 | /* MBOX buffer will be freed in mbox compl */ |
612 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 572 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
@@ -668,6 +628,28 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
668 | int | 628 | int |
669 | lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) | 629 | lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) |
670 | { | 630 | { |
631 | return lpfc_hba_init_link_fc_topology(phba, phba->cfg_topology, flag); | ||
632 | } | ||
633 | |||
634 | /** | ||
635 | * lpfc_hba_init_link_fc_topology - Initialize FC link with desired topology | ||
636 | * @phba: pointer to lpfc hba data structure. | ||
637 | * @fc_topology: desired fc topology. | ||
638 | * @flag: mailbox command issue mode - either MBX_POLL or MBX_NOWAIT | ||
639 | * | ||
640 | * This routine will issue the INIT_LINK mailbox command call. | ||
641 | * It is available to other drivers through the lpfc_hba data | ||
642 | * structure for use as a delayed link up mechanism with the | ||
643 | * module parameter lpfc_suppress_link_up. | ||
644 | * | ||
645 | * Return code | ||
646 | * 0 - success | ||
647 | * Any other value - error | ||
648 | **/ | ||
649 | int | ||
650 | lpfc_hba_init_link_fc_topology(struct lpfc_hba *phba, uint32_t fc_topology, | ||
651 | uint32_t flag) | ||
652 | { | ||
671 | struct lpfc_vport *vport = phba->pport; | 653 | struct lpfc_vport *vport = phba->pport; |
672 | LPFC_MBOXQ_t *pmb; | 654 | LPFC_MBOXQ_t *pmb; |
673 | MAILBOX_t *mb; | 655 | MAILBOX_t *mb; |
@@ -681,9 +663,30 @@ lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) | |||
681 | mb = &pmb->u.mb; | 663 | mb = &pmb->u.mb; |
682 | pmb->vport = vport; | 664 | pmb->vport = vport; |
683 | 665 | ||
684 | lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed); | 666 | if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_MAX) || |
667 | ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) && | ||
668 | !(phba->lmt & LMT_1Gb)) || | ||
669 | ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) && | ||
670 | !(phba->lmt & LMT_2Gb)) || | ||
671 | ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) && | ||
672 | !(phba->lmt & LMT_4Gb)) || | ||
673 | ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) && | ||
674 | !(phba->lmt & LMT_8Gb)) || | ||
675 | ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) && | ||
676 | !(phba->lmt & LMT_10Gb)) || | ||
677 | ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) && | ||
678 | !(phba->lmt & LMT_16Gb))) { | ||
679 | /* Reset link speed to auto */ | ||
680 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | ||
681 | "1302 Invalid speed for this board:%d " | ||
682 | "Reset link speed to auto.\n", | ||
683 | phba->cfg_link_speed); | ||
684 | phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; | ||
685 | } | ||
686 | lpfc_init_link(phba, pmb, fc_topology, phba->cfg_link_speed); | ||
685 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 687 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
686 | lpfc_set_loopback_flag(phba); | 688 | if (phba->sli_rev < LPFC_SLI_REV4) |
689 | lpfc_set_loopback_flag(phba); | ||
687 | rc = lpfc_sli_issue_mbox(phba, pmb, flag); | 690 | rc = lpfc_sli_issue_mbox(phba, pmb, flag); |
688 | if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) { | 691 | if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) { |
689 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 692 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
@@ -1437,7 +1440,10 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) | |||
1437 | uint32_t event_data; | 1440 | uint32_t event_data; |
1438 | struct Scsi_Host *shost; | 1441 | struct Scsi_Host *shost; |
1439 | uint32_t if_type; | 1442 | uint32_t if_type; |
1440 | struct lpfc_register portstat_reg; | 1443 | struct lpfc_register portstat_reg = {0}; |
1444 | uint32_t reg_err1, reg_err2; | ||
1445 | uint32_t uerrlo_reg, uemasklo_reg; | ||
1446 | uint32_t pci_rd_rc1, pci_rd_rc2; | ||
1441 | int rc; | 1447 | int rc; |
1442 | 1448 | ||
1443 | /* If the pci channel is offline, ignore possible errors, since | 1449 | /* If the pci channel is offline, ignore possible errors, since |
@@ -1449,38 +1455,52 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) | |||
1449 | if (!phba->cfg_enable_hba_reset) | 1455 | if (!phba->cfg_enable_hba_reset) |
1450 | return; | 1456 | return; |
1451 | 1457 | ||
1452 | /* Send an internal error event to mgmt application */ | ||
1453 | lpfc_board_errevt_to_mgmt(phba); | ||
1454 | |||
1455 | /* For now, the actual action for SLI4 device handling is not | ||
1456 | * specified yet, just treated it as adaptor hardware failure | ||
1457 | */ | ||
1458 | event_data = FC_REG_DUMP_EVENT; | ||
1459 | shost = lpfc_shost_from_vport(vport); | ||
1460 | fc_host_post_vendor_event(shost, fc_get_event_number(), | ||
1461 | sizeof(event_data), (char *) &event_data, | ||
1462 | SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX); | ||
1463 | |||
1464 | if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); | 1458 | if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); |
1465 | switch (if_type) { | 1459 | switch (if_type) { |
1466 | case LPFC_SLI_INTF_IF_TYPE_0: | 1460 | case LPFC_SLI_INTF_IF_TYPE_0: |
1461 | pci_rd_rc1 = lpfc_readl( | ||
1462 | phba->sli4_hba.u.if_type0.UERRLOregaddr, | ||
1463 | &uerrlo_reg); | ||
1464 | pci_rd_rc2 = lpfc_readl( | ||
1465 | phba->sli4_hba.u.if_type0.UEMASKLOregaddr, | ||
1466 | &uemasklo_reg); | ||
1467 | /* consider PCI bus read error as pci_channel_offline */ | ||
1468 | if (pci_rd_rc1 == -EIO && pci_rd_rc2 == -EIO) | ||
1469 | return; | ||
1467 | lpfc_sli4_offline_eratt(phba); | 1470 | lpfc_sli4_offline_eratt(phba); |
1468 | break; | 1471 | break; |
1469 | case LPFC_SLI_INTF_IF_TYPE_2: | 1472 | case LPFC_SLI_INTF_IF_TYPE_2: |
1470 | portstat_reg.word0 = | 1473 | pci_rd_rc1 = lpfc_readl( |
1471 | readl(phba->sli4_hba.u.if_type2.STATUSregaddr); | 1474 | phba->sli4_hba.u.if_type2.STATUSregaddr, |
1472 | 1475 | &portstat_reg.word0); | |
1476 | /* consider PCI bus read error as pci_channel_offline */ | ||
1477 | if (pci_rd_rc1 == -EIO) | ||
1478 | return; | ||
1479 | reg_err1 = readl(phba->sli4_hba.u.if_type2.ERR1regaddr); | ||
1480 | reg_err2 = readl(phba->sli4_hba.u.if_type2.ERR2regaddr); | ||
1473 | if (bf_get(lpfc_sliport_status_oti, &portstat_reg)) { | 1481 | if (bf_get(lpfc_sliport_status_oti, &portstat_reg)) { |
1474 | /* TODO: Register for Overtemp async events. */ | 1482 | /* TODO: Register for Overtemp async events. */ |
1475 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1483 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1476 | "2889 Port Overtemperature event, " | 1484 | "2889 Port Overtemperature event, " |
1477 | "taking port\n"); | 1485 | "taking port offline\n"); |
1478 | spin_lock_irq(&phba->hbalock); | 1486 | spin_lock_irq(&phba->hbalock); |
1479 | phba->over_temp_state = HBA_OVER_TEMP; | 1487 | phba->over_temp_state = HBA_OVER_TEMP; |
1480 | spin_unlock_irq(&phba->hbalock); | 1488 | spin_unlock_irq(&phba->hbalock); |
1481 | lpfc_sli4_offline_eratt(phba); | 1489 | lpfc_sli4_offline_eratt(phba); |
1482 | return; | 1490 | break; |
1483 | } | 1491 | } |
1492 | if (reg_err1 == SLIPORT_ERR1_REG_ERR_CODE_2 && | ||
1493 | reg_err2 == SLIPORT_ERR2_REG_FW_RESTART) | ||
1494 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
1495 | "3143 Port Down: Firmware Restarted\n"); | ||
1496 | else if (reg_err1 == SLIPORT_ERR1_REG_ERR_CODE_2 && | ||
1497 | reg_err2 == SLIPORT_ERR2_REG_FORCED_DUMP) | ||
1498 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
1499 | "3144 Port Down: Debug Dump\n"); | ||
1500 | else if (reg_err1 == SLIPORT_ERR1_REG_ERR_CODE_2 && | ||
1501 | reg_err2 == SLIPORT_ERR2_REG_FUNC_PROVISON) | ||
1502 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
1503 | "3145 Port Down: Provisioning\n"); | ||
1484 | /* | 1504 | /* |
1485 | * On error status condition, driver need to wait for port | 1505 | * On error status condition, driver need to wait for port |
1486 | * ready before performing reset. | 1506 | * ready before performing reset. |
@@ -1489,14 +1509,19 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) | |||
1489 | if (!rc) { | 1509 | if (!rc) { |
1490 | /* need reset: attempt for port recovery */ | 1510 | /* need reset: attempt for port recovery */ |
1491 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 1511 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
1492 | "2887 Port Error: Attempting " | 1512 | "2887 Reset Needed: Attempting Port " |
1493 | "Port Recovery\n"); | 1513 | "Recovery...\n"); |
1494 | lpfc_offline_prep(phba); | 1514 | lpfc_offline_prep(phba); |
1495 | lpfc_offline(phba); | 1515 | lpfc_offline(phba); |
1496 | lpfc_sli_brdrestart(phba); | 1516 | lpfc_sli_brdrestart(phba); |
1497 | if (lpfc_online(phba) == 0) { | 1517 | if (lpfc_online(phba) == 0) { |
1498 | lpfc_unblock_mgmt_io(phba); | 1518 | lpfc_unblock_mgmt_io(phba); |
1499 | return; | 1519 | /* don't report event on forced debug dump */ |
1520 | if (reg_err1 == SLIPORT_ERR1_REG_ERR_CODE_2 && | ||
1521 | reg_err2 == SLIPORT_ERR2_REG_FORCED_DUMP) | ||
1522 | return; | ||
1523 | else | ||
1524 | break; | ||
1500 | } | 1525 | } |
1501 | /* fall through for not able to recover */ | 1526 | /* fall through for not able to recover */ |
1502 | } | 1527 | } |
@@ -1506,6 +1531,16 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) | |||
1506 | default: | 1531 | default: |
1507 | break; | 1532 | break; |
1508 | } | 1533 | } |
1534 | lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, | ||
1535 | "3123 Report dump event to upper layer\n"); | ||
1536 | /* Send an internal error event to mgmt application */ | ||
1537 | lpfc_board_errevt_to_mgmt(phba); | ||
1538 | |||
1539 | event_data = FC_REG_DUMP_EVENT; | ||
1540 | shost = lpfc_shost_from_vport(vport); | ||
1541 | fc_host_post_vendor_event(shost, fc_get_event_number(), | ||
1542 | sizeof(event_data), (char *) &event_data, | ||
1543 | SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX); | ||
1509 | } | 1544 | } |
1510 | 1545 | ||
1511 | /** | 1546 | /** |
@@ -2674,6 +2709,32 @@ lpfc_offline(struct lpfc_hba *phba) | |||
2674 | } | 2709 | } |
2675 | 2710 | ||
2676 | /** | 2711 | /** |
2712 | * lpfc_scsi_buf_update - Update the scsi_buffers that are already allocated. | ||
2713 | * @phba: pointer to lpfc hba data structure. | ||
2714 | * | ||
2715 | * This routine goes through all the scsi buffers in the system and updates the | ||
2716 | * Physical XRIs assigned to the SCSI buffer because these may change after any | ||
2717 | * firmware reset | ||
2718 | * | ||
2719 | * Return codes | ||
2720 | * 0 - successful (for now, it always returns 0) | ||
2721 | **/ | ||
2722 | int | ||
2723 | lpfc_scsi_buf_update(struct lpfc_hba *phba) | ||
2724 | { | ||
2725 | struct lpfc_scsi_buf *sb, *sb_next; | ||
2726 | |||
2727 | spin_lock_irq(&phba->hbalock); | ||
2728 | spin_lock(&phba->scsi_buf_list_lock); | ||
2729 | list_for_each_entry_safe(sb, sb_next, &phba->lpfc_scsi_buf_list, list) | ||
2730 | sb->cur_iocbq.sli4_xritag = | ||
2731 | phba->sli4_hba.xri_ids[sb->cur_iocbq.sli4_lxritag]; | ||
2732 | spin_unlock(&phba->scsi_buf_list_lock); | ||
2733 | spin_unlock_irq(&phba->hbalock); | ||
2734 | return 0; | ||
2735 | } | ||
2736 | |||
2737 | /** | ||
2677 | * lpfc_scsi_free - Free all the SCSI buffers and IOCBs from driver lists | 2738 | * lpfc_scsi_free - Free all the SCSI buffers and IOCBs from driver lists |
2678 | * @phba: pointer to lpfc hba data structure. | 2739 | * @phba: pointer to lpfc hba data structure. |
2679 | * | 2740 | * |
@@ -5040,15 +5101,8 @@ lpfc_sli4_init_rpi_hdrs(struct lpfc_hba *phba) | |||
5040 | struct lpfc_rpi_hdr *rpi_hdr; | 5101 | struct lpfc_rpi_hdr *rpi_hdr; |
5041 | 5102 | ||
5042 | INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); | 5103 | INIT_LIST_HEAD(&phba->sli4_hba.lpfc_rpi_hdr_list); |
5043 | /* | 5104 | if (!phba->sli4_hba.rpi_hdrs_in_use) |
5044 | * If the SLI4 port supports extents, posting the rpi header isn't | ||
5045 | * required. Set the expected maximum count and let the actual value | ||
5046 | * get set when extents are fully allocated. | ||
5047 | */ | ||
5048 | if (!phba->sli4_hba.rpi_hdrs_in_use) { | ||
5049 | phba->sli4_hba.next_rpi = phba->sli4_hba.max_cfg_param.max_rpi; | ||
5050 | return rc; | 5105 | return rc; |
5051 | } | ||
5052 | if (phba->sli4_hba.extents_in_use) | 5106 | if (phba->sli4_hba.extents_in_use) |
5053 | return -EIO; | 5107 | return -EIO; |
5054 | 5108 | ||
@@ -5942,7 +5996,7 @@ lpfc_destroy_bootstrap_mbox(struct lpfc_hba *phba) | |||
5942 | * -ENOMEM - No available memory | 5996 | * -ENOMEM - No available memory |
5943 | * -EIO - The mailbox failed to complete successfully. | 5997 | * -EIO - The mailbox failed to complete successfully. |
5944 | **/ | 5998 | **/ |
5945 | static int | 5999 | int |
5946 | lpfc_sli4_read_config(struct lpfc_hba *phba) | 6000 | lpfc_sli4_read_config(struct lpfc_hba *phba) |
5947 | { | 6001 | { |
5948 | LPFC_MBOXQ_t *pmb; | 6002 | LPFC_MBOXQ_t *pmb; |
@@ -5974,6 +6028,20 @@ lpfc_sli4_read_config(struct lpfc_hba *phba) | |||
5974 | rc = -EIO; | 6028 | rc = -EIO; |
5975 | } else { | 6029 | } else { |
5976 | rd_config = &pmb->u.mqe.un.rd_config; | 6030 | rd_config = &pmb->u.mqe.un.rd_config; |
6031 | if (bf_get(lpfc_mbx_rd_conf_lnk_ldv, rd_config)) { | ||
6032 | phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; | ||
6033 | phba->sli4_hba.lnk_info.lnk_tp = | ||
6034 | bf_get(lpfc_mbx_rd_conf_lnk_type, rd_config); | ||
6035 | phba->sli4_hba.lnk_info.lnk_no = | ||
6036 | bf_get(lpfc_mbx_rd_conf_lnk_numb, rd_config); | ||
6037 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
6038 | "3081 lnk_type:%d, lnk_numb:%d\n", | ||
6039 | phba->sli4_hba.lnk_info.lnk_tp, | ||
6040 | phba->sli4_hba.lnk_info.lnk_no); | ||
6041 | } else | ||
6042 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
6043 | "3082 Mailbox (x%x) returned ldv:x0\n", | ||
6044 | bf_get(lpfc_mqe_command, &pmb->u.mqe)); | ||
5977 | phba->sli4_hba.extents_in_use = | 6045 | phba->sli4_hba.extents_in_use = |
5978 | bf_get(lpfc_mbx_rd_conf_extnts_inuse, rd_config); | 6046 | bf_get(lpfc_mbx_rd_conf_extnts_inuse, rd_config); |
5979 | phba->sli4_hba.max_cfg_param.max_xri = | 6047 | phba->sli4_hba.max_cfg_param.max_xri = |
@@ -6462,6 +6530,7 @@ out_free_fcp_wq: | |||
6462 | phba->sli4_hba.fcp_wq[fcp_wqidx] = NULL; | 6530 | phba->sli4_hba.fcp_wq[fcp_wqidx] = NULL; |
6463 | } | 6531 | } |
6464 | kfree(phba->sli4_hba.fcp_wq); | 6532 | kfree(phba->sli4_hba.fcp_wq); |
6533 | phba->sli4_hba.fcp_wq = NULL; | ||
6465 | out_free_els_wq: | 6534 | out_free_els_wq: |
6466 | lpfc_sli4_queue_free(phba->sli4_hba.els_wq); | 6535 | lpfc_sli4_queue_free(phba->sli4_hba.els_wq); |
6467 | phba->sli4_hba.els_wq = NULL; | 6536 | phba->sli4_hba.els_wq = NULL; |
@@ -6474,6 +6543,7 @@ out_free_fcp_cq: | |||
6474 | phba->sli4_hba.fcp_cq[fcp_cqidx] = NULL; | 6543 | phba->sli4_hba.fcp_cq[fcp_cqidx] = NULL; |
6475 | } | 6544 | } |
6476 | kfree(phba->sli4_hba.fcp_cq); | 6545 | kfree(phba->sli4_hba.fcp_cq); |
6546 | phba->sli4_hba.fcp_cq = NULL; | ||
6477 | out_free_els_cq: | 6547 | out_free_els_cq: |
6478 | lpfc_sli4_queue_free(phba->sli4_hba.els_cq); | 6548 | lpfc_sli4_queue_free(phba->sli4_hba.els_cq); |
6479 | phba->sli4_hba.els_cq = NULL; | 6549 | phba->sli4_hba.els_cq = NULL; |
@@ -6486,6 +6556,7 @@ out_free_fp_eq: | |||
6486 | phba->sli4_hba.fp_eq[fcp_eqidx] = NULL; | 6556 | phba->sli4_hba.fp_eq[fcp_eqidx] = NULL; |
6487 | } | 6557 | } |
6488 | kfree(phba->sli4_hba.fp_eq); | 6558 | kfree(phba->sli4_hba.fp_eq); |
6559 | phba->sli4_hba.fp_eq = NULL; | ||
6489 | out_free_sp_eq: | 6560 | out_free_sp_eq: |
6490 | lpfc_sli4_queue_free(phba->sli4_hba.sp_eq); | 6561 | lpfc_sli4_queue_free(phba->sli4_hba.sp_eq); |
6491 | phba->sli4_hba.sp_eq = NULL; | 6562 | phba->sli4_hba.sp_eq = NULL; |
@@ -6519,8 +6590,10 @@ lpfc_sli4_queue_destroy(struct lpfc_hba *phba) | |||
6519 | phba->sli4_hba.els_wq = NULL; | 6590 | phba->sli4_hba.els_wq = NULL; |
6520 | 6591 | ||
6521 | /* Release FCP work queue */ | 6592 | /* Release FCP work queue */ |
6522 | for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_wq_count; fcp_qidx++) | 6593 | if (phba->sli4_hba.fcp_wq != NULL) |
6523 | lpfc_sli4_queue_free(phba->sli4_hba.fcp_wq[fcp_qidx]); | 6594 | for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_wq_count; |
6595 | fcp_qidx++) | ||
6596 | lpfc_sli4_queue_free(phba->sli4_hba.fcp_wq[fcp_qidx]); | ||
6524 | kfree(phba->sli4_hba.fcp_wq); | 6597 | kfree(phba->sli4_hba.fcp_wq); |
6525 | phba->sli4_hba.fcp_wq = NULL; | 6598 | phba->sli4_hba.fcp_wq = NULL; |
6526 | 6599 | ||
@@ -6540,15 +6613,18 @@ lpfc_sli4_queue_destroy(struct lpfc_hba *phba) | |||
6540 | 6613 | ||
6541 | /* Release FCP response complete queue */ | 6614 | /* Release FCP response complete queue */ |
6542 | fcp_qidx = 0; | 6615 | fcp_qidx = 0; |
6543 | do | 6616 | if (phba->sli4_hba.fcp_cq != NULL) |
6544 | lpfc_sli4_queue_free(phba->sli4_hba.fcp_cq[fcp_qidx]); | 6617 | do |
6545 | while (++fcp_qidx < phba->cfg_fcp_eq_count); | 6618 | lpfc_sli4_queue_free(phba->sli4_hba.fcp_cq[fcp_qidx]); |
6619 | while (++fcp_qidx < phba->cfg_fcp_eq_count); | ||
6546 | kfree(phba->sli4_hba.fcp_cq); | 6620 | kfree(phba->sli4_hba.fcp_cq); |
6547 | phba->sli4_hba.fcp_cq = NULL; | 6621 | phba->sli4_hba.fcp_cq = NULL; |
6548 | 6622 | ||
6549 | /* Release fast-path event queue */ | 6623 | /* Release fast-path event queue */ |
6550 | for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_eq_count; fcp_qidx++) | 6624 | if (phba->sli4_hba.fp_eq != NULL) |
6551 | lpfc_sli4_queue_free(phba->sli4_hba.fp_eq[fcp_qidx]); | 6625 | for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_eq_count; |
6626 | fcp_qidx++) | ||
6627 | lpfc_sli4_queue_free(phba->sli4_hba.fp_eq[fcp_qidx]); | ||
6552 | kfree(phba->sli4_hba.fp_eq); | 6628 | kfree(phba->sli4_hba.fp_eq); |
6553 | phba->sli4_hba.fp_eq = NULL; | 6629 | phba->sli4_hba.fp_eq = NULL; |
6554 | 6630 | ||
@@ -6601,11 +6677,18 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6601 | phba->sli4_hba.sp_eq->queue_id); | 6677 | phba->sli4_hba.sp_eq->queue_id); |
6602 | 6678 | ||
6603 | /* Set up fast-path event queue */ | 6679 | /* Set up fast-path event queue */ |
6680 | if (phba->cfg_fcp_eq_count && !phba->sli4_hba.fp_eq) { | ||
6681 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
6682 | "3147 Fast-path EQs not allocated\n"); | ||
6683 | rc = -ENOMEM; | ||
6684 | goto out_destroy_sp_eq; | ||
6685 | } | ||
6604 | for (fcp_eqidx = 0; fcp_eqidx < phba->cfg_fcp_eq_count; fcp_eqidx++) { | 6686 | for (fcp_eqidx = 0; fcp_eqidx < phba->cfg_fcp_eq_count; fcp_eqidx++) { |
6605 | if (!phba->sli4_hba.fp_eq[fcp_eqidx]) { | 6687 | if (!phba->sli4_hba.fp_eq[fcp_eqidx]) { |
6606 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6688 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6607 | "0522 Fast-path EQ (%d) not " | 6689 | "0522 Fast-path EQ (%d) not " |
6608 | "allocated\n", fcp_eqidx); | 6690 | "allocated\n", fcp_eqidx); |
6691 | rc = -ENOMEM; | ||
6609 | goto out_destroy_fp_eq; | 6692 | goto out_destroy_fp_eq; |
6610 | } | 6693 | } |
6611 | rc = lpfc_eq_create(phba, phba->sli4_hba.fp_eq[fcp_eqidx], | 6694 | rc = lpfc_eq_create(phba, phba->sli4_hba.fp_eq[fcp_eqidx], |
@@ -6630,6 +6713,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6630 | if (!phba->sli4_hba.mbx_cq) { | 6713 | if (!phba->sli4_hba.mbx_cq) { |
6631 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6714 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6632 | "0528 Mailbox CQ not allocated\n"); | 6715 | "0528 Mailbox CQ not allocated\n"); |
6716 | rc = -ENOMEM; | ||
6633 | goto out_destroy_fp_eq; | 6717 | goto out_destroy_fp_eq; |
6634 | } | 6718 | } |
6635 | rc = lpfc_cq_create(phba, phba->sli4_hba.mbx_cq, phba->sli4_hba.sp_eq, | 6719 | rc = lpfc_cq_create(phba, phba->sli4_hba.mbx_cq, phba->sli4_hba.sp_eq, |
@@ -6649,6 +6733,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6649 | if (!phba->sli4_hba.els_cq) { | 6733 | if (!phba->sli4_hba.els_cq) { |
6650 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6734 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6651 | "0530 ELS CQ not allocated\n"); | 6735 | "0530 ELS CQ not allocated\n"); |
6736 | rc = -ENOMEM; | ||
6652 | goto out_destroy_mbx_cq; | 6737 | goto out_destroy_mbx_cq; |
6653 | } | 6738 | } |
6654 | rc = lpfc_cq_create(phba, phba->sli4_hba.els_cq, phba->sli4_hba.sp_eq, | 6739 | rc = lpfc_cq_create(phba, phba->sli4_hba.els_cq, phba->sli4_hba.sp_eq, |
@@ -6665,12 +6750,20 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6665 | phba->sli4_hba.sp_eq->queue_id); | 6750 | phba->sli4_hba.sp_eq->queue_id); |
6666 | 6751 | ||
6667 | /* Set up fast-path FCP Response Complete Queue */ | 6752 | /* Set up fast-path FCP Response Complete Queue */ |
6753 | if (!phba->sli4_hba.fcp_cq) { | ||
6754 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
6755 | "3148 Fast-path FCP CQ array not " | ||
6756 | "allocated\n"); | ||
6757 | rc = -ENOMEM; | ||
6758 | goto out_destroy_els_cq; | ||
6759 | } | ||
6668 | fcp_cqidx = 0; | 6760 | fcp_cqidx = 0; |
6669 | do { | 6761 | do { |
6670 | if (!phba->sli4_hba.fcp_cq[fcp_cqidx]) { | 6762 | if (!phba->sli4_hba.fcp_cq[fcp_cqidx]) { |
6671 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6763 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6672 | "0526 Fast-path FCP CQ (%d) not " | 6764 | "0526 Fast-path FCP CQ (%d) not " |
6673 | "allocated\n", fcp_cqidx); | 6765 | "allocated\n", fcp_cqidx); |
6766 | rc = -ENOMEM; | ||
6674 | goto out_destroy_fcp_cq; | 6767 | goto out_destroy_fcp_cq; |
6675 | } | 6768 | } |
6676 | if (phba->cfg_fcp_eq_count) | 6769 | if (phba->cfg_fcp_eq_count) |
@@ -6709,6 +6802,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6709 | if (!phba->sli4_hba.mbx_wq) { | 6802 | if (!phba->sli4_hba.mbx_wq) { |
6710 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6803 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6711 | "0538 Slow-path MQ not allocated\n"); | 6804 | "0538 Slow-path MQ not allocated\n"); |
6805 | rc = -ENOMEM; | ||
6712 | goto out_destroy_fcp_cq; | 6806 | goto out_destroy_fcp_cq; |
6713 | } | 6807 | } |
6714 | rc = lpfc_mq_create(phba, phba->sli4_hba.mbx_wq, | 6808 | rc = lpfc_mq_create(phba, phba->sli4_hba.mbx_wq, |
@@ -6728,6 +6822,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6728 | if (!phba->sli4_hba.els_wq) { | 6822 | if (!phba->sli4_hba.els_wq) { |
6729 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6823 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6730 | "0536 Slow-path ELS WQ not allocated\n"); | 6824 | "0536 Slow-path ELS WQ not allocated\n"); |
6825 | rc = -ENOMEM; | ||
6731 | goto out_destroy_mbx_wq; | 6826 | goto out_destroy_mbx_wq; |
6732 | } | 6827 | } |
6733 | rc = lpfc_wq_create(phba, phba->sli4_hba.els_wq, | 6828 | rc = lpfc_wq_create(phba, phba->sli4_hba.els_wq, |
@@ -6744,11 +6839,19 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6744 | phba->sli4_hba.els_cq->queue_id); | 6839 | phba->sli4_hba.els_cq->queue_id); |
6745 | 6840 | ||
6746 | /* Set up fast-path FCP Work Queue */ | 6841 | /* Set up fast-path FCP Work Queue */ |
6842 | if (!phba->sli4_hba.fcp_wq) { | ||
6843 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
6844 | "3149 Fast-path FCP WQ array not " | ||
6845 | "allocated\n"); | ||
6846 | rc = -ENOMEM; | ||
6847 | goto out_destroy_els_wq; | ||
6848 | } | ||
6747 | for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_wq_count; fcp_wqidx++) { | 6849 | for (fcp_wqidx = 0; fcp_wqidx < phba->cfg_fcp_wq_count; fcp_wqidx++) { |
6748 | if (!phba->sli4_hba.fcp_wq[fcp_wqidx]) { | 6850 | if (!phba->sli4_hba.fcp_wq[fcp_wqidx]) { |
6749 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6851 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6750 | "0534 Fast-path FCP WQ (%d) not " | 6852 | "0534 Fast-path FCP WQ (%d) not " |
6751 | "allocated\n", fcp_wqidx); | 6853 | "allocated\n", fcp_wqidx); |
6854 | rc = -ENOMEM; | ||
6752 | goto out_destroy_fcp_wq; | 6855 | goto out_destroy_fcp_wq; |
6753 | } | 6856 | } |
6754 | rc = lpfc_wq_create(phba, phba->sli4_hba.fcp_wq[fcp_wqidx], | 6857 | rc = lpfc_wq_create(phba, phba->sli4_hba.fcp_wq[fcp_wqidx], |
@@ -6779,6 +6882,7 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6779 | if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { | 6882 | if (!phba->sli4_hba.hdr_rq || !phba->sli4_hba.dat_rq) { |
6780 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 6883 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
6781 | "0540 Receive Queue not allocated\n"); | 6884 | "0540 Receive Queue not allocated\n"); |
6885 | rc = -ENOMEM; | ||
6782 | goto out_destroy_fcp_wq; | 6886 | goto out_destroy_fcp_wq; |
6783 | } | 6887 | } |
6784 | 6888 | ||
@@ -6805,18 +6909,21 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) | |||
6805 | out_destroy_fcp_wq: | 6909 | out_destroy_fcp_wq: |
6806 | for (--fcp_wqidx; fcp_wqidx >= 0; fcp_wqidx--) | 6910 | for (--fcp_wqidx; fcp_wqidx >= 0; fcp_wqidx--) |
6807 | lpfc_wq_destroy(phba, phba->sli4_hba.fcp_wq[fcp_wqidx]); | 6911 | lpfc_wq_destroy(phba, phba->sli4_hba.fcp_wq[fcp_wqidx]); |
6912 | out_destroy_els_wq: | ||
6808 | lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); | 6913 | lpfc_wq_destroy(phba, phba->sli4_hba.els_wq); |
6809 | out_destroy_mbx_wq: | 6914 | out_destroy_mbx_wq: |
6810 | lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); | 6915 | lpfc_mq_destroy(phba, phba->sli4_hba.mbx_wq); |
6811 | out_destroy_fcp_cq: | 6916 | out_destroy_fcp_cq: |
6812 | for (--fcp_cqidx; fcp_cqidx >= 0; fcp_cqidx--) | 6917 | for (--fcp_cqidx; fcp_cqidx >= 0; fcp_cqidx--) |
6813 | lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[fcp_cqidx]); | 6918 | lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[fcp_cqidx]); |
6919 | out_destroy_els_cq: | ||
6814 | lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); | 6920 | lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); |
6815 | out_destroy_mbx_cq: | 6921 | out_destroy_mbx_cq: |
6816 | lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); | 6922 | lpfc_cq_destroy(phba, phba->sli4_hba.mbx_cq); |
6817 | out_destroy_fp_eq: | 6923 | out_destroy_fp_eq: |
6818 | for (--fcp_eqidx; fcp_eqidx >= 0; fcp_eqidx--) | 6924 | for (--fcp_eqidx; fcp_eqidx >= 0; fcp_eqidx--) |
6819 | lpfc_eq_destroy(phba, phba->sli4_hba.fp_eq[fcp_eqidx]); | 6925 | lpfc_eq_destroy(phba, phba->sli4_hba.fp_eq[fcp_eqidx]); |
6926 | out_destroy_sp_eq: | ||
6820 | lpfc_eq_destroy(phba, phba->sli4_hba.sp_eq); | 6927 | lpfc_eq_destroy(phba, phba->sli4_hba.sp_eq); |
6821 | out_error: | 6928 | out_error: |
6822 | return rc; | 6929 | return rc; |
@@ -6853,13 +6960,18 @@ lpfc_sli4_queue_unset(struct lpfc_hba *phba) | |||
6853 | /* Unset ELS complete queue */ | 6960 | /* Unset ELS complete queue */ |
6854 | lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); | 6961 | lpfc_cq_destroy(phba, phba->sli4_hba.els_cq); |
6855 | /* Unset FCP response complete queue */ | 6962 | /* Unset FCP response complete queue */ |
6856 | fcp_qidx = 0; | 6963 | if (phba->sli4_hba.fcp_cq) { |
6857 | do { | 6964 | fcp_qidx = 0; |
6858 | lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[fcp_qidx]); | 6965 | do { |
6859 | } while (++fcp_qidx < phba->cfg_fcp_eq_count); | 6966 | lpfc_cq_destroy(phba, phba->sli4_hba.fcp_cq[fcp_qidx]); |
6967 | } while (++fcp_qidx < phba->cfg_fcp_eq_count); | ||
6968 | } | ||
6860 | /* Unset fast-path event queue */ | 6969 | /* Unset fast-path event queue */ |
6861 | for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_eq_count; fcp_qidx++) | 6970 | if (phba->sli4_hba.fp_eq) { |
6862 | lpfc_eq_destroy(phba, phba->sli4_hba.fp_eq[fcp_qidx]); | 6971 | for (fcp_qidx = 0; fcp_qidx < phba->cfg_fcp_eq_count; |
6972 | fcp_qidx++) | ||
6973 | lpfc_eq_destroy(phba, phba->sli4_hba.fp_eq[fcp_qidx]); | ||
6974 | } | ||
6863 | /* Unset slow-path event queue */ | 6975 | /* Unset slow-path event queue */ |
6864 | lpfc_eq_destroy(phba, phba->sli4_hba.sp_eq); | 6976 | lpfc_eq_destroy(phba, phba->sli4_hba.sp_eq); |
6865 | } | 6977 | } |
@@ -7398,22 +7510,25 @@ out: | |||
7398 | static void | 7510 | static void |
7399 | lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) | 7511 | lpfc_sli4_pci_mem_unset(struct lpfc_hba *phba) |
7400 | { | 7512 | { |
7401 | struct pci_dev *pdev; | 7513 | uint32_t if_type; |
7402 | 7514 | if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); | |
7403 | /* Obtain PCI device reference */ | ||
7404 | if (!phba->pcidev) | ||
7405 | return; | ||
7406 | else | ||
7407 | pdev = phba->pcidev; | ||
7408 | |||
7409 | /* Free coherent DMA memory allocated */ | ||
7410 | |||
7411 | /* Unmap I/O memory space */ | ||
7412 | iounmap(phba->sli4_hba.drbl_regs_memmap_p); | ||
7413 | iounmap(phba->sli4_hba.ctrl_regs_memmap_p); | ||
7414 | iounmap(phba->sli4_hba.conf_regs_memmap_p); | ||
7415 | 7515 | ||
7416 | return; | 7516 | switch (if_type) { |
7517 | case LPFC_SLI_INTF_IF_TYPE_0: | ||
7518 | iounmap(phba->sli4_hba.drbl_regs_memmap_p); | ||
7519 | iounmap(phba->sli4_hba.ctrl_regs_memmap_p); | ||
7520 | iounmap(phba->sli4_hba.conf_regs_memmap_p); | ||
7521 | break; | ||
7522 | case LPFC_SLI_INTF_IF_TYPE_2: | ||
7523 | iounmap(phba->sli4_hba.conf_regs_memmap_p); | ||
7524 | break; | ||
7525 | case LPFC_SLI_INTF_IF_TYPE_1: | ||
7526 | default: | ||
7527 | dev_printk(KERN_ERR, &phba->pcidev->dev, | ||
7528 | "FATAL - unsupported SLI4 interface type - %d\n", | ||
7529 | if_type); | ||
7530 | break; | ||
7531 | } | ||
7417 | } | 7532 | } |
7418 | 7533 | ||
7419 | /** | 7534 | /** |
@@ -9198,12 +9313,15 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
9198 | /* Perform post initialization setup */ | 9313 | /* Perform post initialization setup */ |
9199 | lpfc_post_init_setup(phba); | 9314 | lpfc_post_init_setup(phba); |
9200 | 9315 | ||
9201 | /* check for firmware upgrade or downgrade */ | 9316 | /* check for firmware upgrade or downgrade (if_type 2 only) */ |
9202 | snprintf(file_name, 16, "%s.grp", phba->ModelName); | 9317 | if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) == |
9203 | error = request_firmware(&fw, file_name, &phba->pcidev->dev); | 9318 | LPFC_SLI_INTF_IF_TYPE_2) { |
9204 | if (!error) { | 9319 | snprintf(file_name, 16, "%s.grp", phba->ModelName); |
9205 | lpfc_write_firmware(phba, fw); | 9320 | error = request_firmware(&fw, file_name, &phba->pcidev->dev); |
9206 | release_firmware(fw); | 9321 | if (!error) { |
9322 | lpfc_write_firmware(phba, fw); | ||
9323 | release_firmware(fw); | ||
9324 | } | ||
9207 | } | 9325 | } |
9208 | 9326 | ||
9209 | /* Check if there are static vports to be created. */ | 9327 | /* Check if there are static vports to be created. */ |