diff options
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_hw4.h | 161 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 17 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 180 | ||||
| -rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 14 |
4 files changed, 366 insertions, 6 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index ca7d137cd45f..1a417135b734 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h | |||
| @@ -785,6 +785,8 @@ union lpfc_sli4_cfg_shdr { | |||
| 785 | #define LPFC_Q_CREATE_VERSION_2 2 | 785 | #define LPFC_Q_CREATE_VERSION_2 2 |
| 786 | #define LPFC_Q_CREATE_VERSION_1 1 | 786 | #define LPFC_Q_CREATE_VERSION_1 1 |
| 787 | #define LPFC_Q_CREATE_VERSION_0 0 | 787 | #define LPFC_Q_CREATE_VERSION_0 0 |
| 788 | #define LPFC_OPCODE_VERSION_0 0 | ||
| 789 | #define LPFC_OPCODE_VERSION_1 1 | ||
| 788 | } request; | 790 | } request; |
| 789 | struct { | 791 | struct { |
| 790 | uint32_t word6; | 792 | uint32_t word6; |
| @@ -848,6 +850,7 @@ struct mbox_header { | |||
| 848 | #define LPFC_MBOX_OPCODE_EQ_DESTROY 0x37 | 850 | #define LPFC_MBOX_OPCODE_EQ_DESTROY 0x37 |
| 849 | #define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A | 851 | #define LPFC_MBOX_OPCODE_QUERY_FW_CFG 0x3A |
| 850 | #define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D | 852 | #define LPFC_MBOX_OPCODE_FUNCTION_RESET 0x3D |
| 853 | #define LPFC_MBOX_OPCODE_GET_PORT_NAME 0x4D | ||
| 851 | #define LPFC_MBOX_OPCODE_MQ_CREATE_EXT 0x5A | 854 | #define LPFC_MBOX_OPCODE_MQ_CREATE_EXT 0x5A |
| 852 | #define LPFC_MBOX_OPCODE_GET_RSRC_EXTENT_INFO 0x9A | 855 | #define LPFC_MBOX_OPCODE_GET_RSRC_EXTENT_INFO 0x9A |
| 853 | #define LPFC_MBOX_OPCODE_GET_ALLOC_RSRC_EXTENT 0x9B | 856 | #define LPFC_MBOX_OPCODE_GET_ALLOC_RSRC_EXTENT 0x9B |
| @@ -2030,6 +2033,15 @@ struct lpfc_mbx_read_config { | |||
| 2030 | #define lpfc_mbx_rd_conf_extnts_inuse_MASK 0x00000001 | 2033 | #define lpfc_mbx_rd_conf_extnts_inuse_MASK 0x00000001 |
| 2031 | #define lpfc_mbx_rd_conf_extnts_inuse_WORD word1 | 2034 | #define lpfc_mbx_rd_conf_extnts_inuse_WORD word1 |
| 2032 | uint32_t word2; | 2035 | uint32_t word2; |
| 2036 | #define lpfc_mbx_rd_conf_lnk_numb_SHIFT 0 | ||
| 2037 | #define lpfc_mbx_rd_conf_lnk_numb_MASK 0x0000003F | ||
| 2038 | #define lpfc_mbx_rd_conf_lnk_numb_WORD word2 | ||
| 2039 | #define lpfc_mbx_rd_conf_lnk_type_SHIFT 6 | ||
| 2040 | #define lpfc_mbx_rd_conf_lnk_type_MASK 0x00000003 | ||
| 2041 | #define lpfc_mbx_rd_conf_lnk_type_WORD word2 | ||
| 2042 | #define lpfc_mbx_rd_conf_lnk_ldv_SHIFT 8 | ||
| 2043 | #define lpfc_mbx_rd_conf_lnk_ldv_MASK 0x00000001 | ||
| 2044 | #define lpfc_mbx_rd_conf_lnk_ldv_WORD word2 | ||
| 2033 | #define lpfc_mbx_rd_conf_topology_SHIFT 24 | 2045 | #define lpfc_mbx_rd_conf_topology_SHIFT 24 |
| 2034 | #define lpfc_mbx_rd_conf_topology_MASK 0x000000FF | 2046 | #define lpfc_mbx_rd_conf_topology_MASK 0x000000FF |
| 2035 | #define lpfc_mbx_rd_conf_topology_WORD word2 | 2047 | #define lpfc_mbx_rd_conf_topology_WORD word2 |
| @@ -2563,8 +2575,152 @@ struct lpfc_mbx_get_prof_cfg { | |||
| 2563 | } u; | 2575 | } u; |
| 2564 | }; | 2576 | }; |
| 2565 | 2577 | ||
| 2578 | struct lpfc_controller_attribute { | ||
| 2579 | uint32_t version_string[8]; | ||
| 2580 | uint32_t manufacturer_name[8]; | ||
| 2581 | uint32_t supported_modes; | ||
| 2582 | uint32_t word17; | ||
| 2583 | #define lpfc_cntl_attr_eprom_ver_lo_SHIFT 0 | ||
| 2584 | #define lpfc_cntl_attr_eprom_ver_lo_MASK 0x000000ff | ||
| 2585 | #define lpfc_cntl_attr_eprom_ver_lo_WORD word17 | ||
| 2586 | #define lpfc_cntl_attr_eprom_ver_hi_SHIFT 8 | ||
| 2587 | #define lpfc_cntl_attr_eprom_ver_hi_MASK 0x000000ff | ||
| 2588 | #define lpfc_cntl_attr_eprom_ver_hi_WORD word17 | ||
| 2589 | uint32_t mbx_da_struct_ver; | ||
| 2590 | uint32_t ep_fw_da_struct_ver; | ||
| 2591 | uint32_t ncsi_ver_str[3]; | ||
| 2592 | uint32_t dflt_ext_timeout; | ||
| 2593 | uint32_t model_number[8]; | ||
| 2594 | uint32_t description[16]; | ||
| 2595 | uint32_t serial_number[8]; | ||
| 2596 | uint32_t ip_ver_str[8]; | ||
| 2597 | uint32_t fw_ver_str[8]; | ||
| 2598 | uint32_t bios_ver_str[8]; | ||
| 2599 | uint32_t redboot_ver_str[8]; | ||
| 2600 | uint32_t driver_ver_str[8]; | ||
| 2601 | uint32_t flash_fw_ver_str[8]; | ||
| 2602 | uint32_t functionality; | ||
| 2603 | uint32_t word105; | ||
| 2604 | #define lpfc_cntl_attr_max_cbd_len_SHIFT 0 | ||
| 2605 | #define lpfc_cntl_attr_max_cbd_len_MASK 0x0000ffff | ||
| 2606 | #define lpfc_cntl_attr_max_cbd_len_WORD word105 | ||
| 2607 | #define lpfc_cntl_attr_asic_rev_SHIFT 16 | ||
| 2608 | #define lpfc_cntl_attr_asic_rev_MASK 0x000000ff | ||
| 2609 | #define lpfc_cntl_attr_asic_rev_WORD word105 | ||
| 2610 | #define lpfc_cntl_attr_gen_guid0_SHIFT 24 | ||
| 2611 | #define lpfc_cntl_attr_gen_guid0_MASK 0x000000ff | ||
| 2612 | #define lpfc_cntl_attr_gen_guid0_WORD word105 | ||
| 2613 | uint32_t gen_guid1_12[3]; | ||
| 2614 | uint32_t word109; | ||
| 2615 | #define lpfc_cntl_attr_gen_guid13_14_SHIFT 0 | ||
| 2616 | #define lpfc_cntl_attr_gen_guid13_14_MASK 0x0000ffff | ||
| 2617 | #define lpfc_cntl_attr_gen_guid13_14_WORD word109 | ||
| 2618 | #define lpfc_cntl_attr_gen_guid15_SHIFT 16 | ||
| 2619 | #define lpfc_cntl_attr_gen_guid15_MASK 0x000000ff | ||
| 2620 | #define lpfc_cntl_attr_gen_guid15_WORD word109 | ||
| 2621 | #define lpfc_cntl_attr_hba_port_cnt_SHIFT 24 | ||
| 2622 | #define lpfc_cntl_attr_hba_port_cnt_MASK 0x000000ff | ||
| 2623 | #define lpfc_cntl_attr_hba_port_cnt_WORD word109 | ||
| 2624 | uint32_t word110; | ||
| 2625 | #define lpfc_cntl_attr_dflt_lnk_tmo_SHIFT 0 | ||
| 2626 | #define lpfc_cntl_attr_dflt_lnk_tmo_MASK 0x0000ffff | ||
| 2627 | #define lpfc_cntl_attr_dflt_lnk_tmo_WORD word110 | ||
| 2628 | #define lpfc_cntl_attr_multi_func_dev_SHIFT 24 | ||
| 2629 | #define lpfc_cntl_attr_multi_func_dev_MASK 0x000000ff | ||
| 2630 | #define lpfc_cntl_attr_multi_func_dev_WORD word110 | ||
| 2631 | uint32_t word111; | ||
| 2632 | #define lpfc_cntl_attr_cache_valid_SHIFT 0 | ||
| 2633 | #define lpfc_cntl_attr_cache_valid_MASK 0x000000ff | ||
| 2634 | #define lpfc_cntl_attr_cache_valid_WORD word111 | ||
| 2635 | #define lpfc_cntl_attr_hba_status_SHIFT 8 | ||
| 2636 | #define lpfc_cntl_attr_hba_status_MASK 0x000000ff | ||
| 2637 | #define lpfc_cntl_attr_hba_status_WORD word111 | ||
| 2638 | #define lpfc_cntl_attr_max_domain_SHIFT 16 | ||
| 2639 | #define lpfc_cntl_attr_max_domain_MASK 0x000000ff | ||
| 2640 | #define lpfc_cntl_attr_max_domain_WORD word111 | ||
| 2641 | #define lpfc_cntl_attr_lnk_numb_SHIFT 24 | ||
| 2642 | #define lpfc_cntl_attr_lnk_numb_MASK 0x0000003f | ||
| 2643 | #define lpfc_cntl_attr_lnk_numb_WORD word111 | ||
| 2644 | #define lpfc_cntl_attr_lnk_type_SHIFT 30 | ||
| 2645 | #define lpfc_cntl_attr_lnk_type_MASK 0x00000003 | ||
| 2646 | #define lpfc_cntl_attr_lnk_type_WORD word111 | ||
| 2647 | uint32_t fw_post_status; | ||
| 2648 | uint32_t hba_mtu[8]; | ||
| 2649 | uint32_t word121; | ||
| 2650 | uint32_t reserved1[3]; | ||
| 2651 | uint32_t word125; | ||
| 2652 | #define lpfc_cntl_attr_pci_vendor_id_SHIFT 0 | ||
| 2653 | #define lpfc_cntl_attr_pci_vendor_id_MASK 0x0000ffff | ||
| 2654 | #define lpfc_cntl_attr_pci_vendor_id_WORD word125 | ||
| 2655 | #define lpfc_cntl_attr_pci_device_id_SHIFT 16 | ||
| 2656 | #define lpfc_cntl_attr_pci_device_id_MASK 0x0000ffff | ||
| 2657 | #define lpfc_cntl_attr_pci_device_id_WORD word125 | ||
| 2658 | uint32_t word126; | ||
| 2659 | #define lpfc_cntl_attr_pci_subvdr_id_SHIFT 0 | ||
| 2660 | #define lpfc_cntl_attr_pci_subvdr_id_MASK 0x0000ffff | ||
| 2661 | #define lpfc_cntl_attr_pci_subvdr_id_WORD word126 | ||
| 2662 | #define lpfc_cntl_attr_pci_subsys_id_SHIFT 16 | ||
| 2663 | #define lpfc_cntl_attr_pci_subsys_id_MASK 0x0000ffff | ||
| 2664 | #define lpfc_cntl_attr_pci_subsys_id_WORD word126 | ||
| 2665 | uint32_t word127; | ||
| 2666 | #define lpfc_cntl_attr_pci_bus_num_SHIFT 0 | ||
| 2667 | #define lpfc_cntl_attr_pci_bus_num_MASK 0x000000ff | ||
| 2668 | #define lpfc_cntl_attr_pci_bus_num_WORD word127 | ||
| 2669 | #define lpfc_cntl_attr_pci_dev_num_SHIFT 8 | ||
| 2670 | #define lpfc_cntl_attr_pci_dev_num_MASK 0x000000ff | ||
| 2671 | #define lpfc_cntl_attr_pci_dev_num_WORD word127 | ||
| 2672 | #define lpfc_cntl_attr_pci_fnc_num_SHIFT 16 | ||
| 2673 | #define lpfc_cntl_attr_pci_fnc_num_MASK 0x000000ff | ||
| 2674 | #define lpfc_cntl_attr_pci_fnc_num_WORD word127 | ||
| 2675 | #define lpfc_cntl_attr_inf_type_SHIFT 24 | ||
| 2676 | #define lpfc_cntl_attr_inf_type_MASK 0x000000ff | ||
| 2677 | #define lpfc_cntl_attr_inf_type_WORD word127 | ||
| 2678 | uint32_t unique_id[2]; | ||
| 2679 | uint32_t word130; | ||
| 2680 | #define lpfc_cntl_attr_num_netfil_SHIFT 0 | ||
| 2681 | #define lpfc_cntl_attr_num_netfil_MASK 0x000000ff | ||
| 2682 | #define lpfc_cntl_attr_num_netfil_WORD word130 | ||
| 2683 | uint32_t reserved2[4]; | ||
| 2684 | }; | ||
| 2685 | |||
| 2686 | struct lpfc_mbx_get_cntl_attributes { | ||
| 2687 | union lpfc_sli4_cfg_shdr cfg_shdr; | ||
| 2688 | struct lpfc_controller_attribute cntl_attr; | ||
| 2689 | }; | ||
| 2690 | |||
| 2691 | struct lpfc_mbx_get_port_name { | ||
| 2692 | struct mbox_header header; | ||
| 2693 | union { | ||
| 2694 | struct { | ||
| 2695 | uint32_t word4; | ||
| 2696 | #define lpfc_mbx_get_port_name_lnk_type_SHIFT 0 | ||
| 2697 | #define lpfc_mbx_get_port_name_lnk_type_MASK 0x00000003 | ||
| 2698 | #define lpfc_mbx_get_port_name_lnk_type_WORD word4 | ||
| 2699 | } request; | ||
| 2700 | struct { | ||
| 2701 | uint32_t word4; | ||
| 2702 | #define lpfc_mbx_get_port_name_name0_SHIFT 0 | ||
| 2703 | #define lpfc_mbx_get_port_name_name0_MASK 0x000000FF | ||
| 2704 | #define lpfc_mbx_get_port_name_name0_WORD word4 | ||
| 2705 | #define lpfc_mbx_get_port_name_name1_SHIFT 8 | ||
| 2706 | #define lpfc_mbx_get_port_name_name1_MASK 0x000000FF | ||
| 2707 | #define lpfc_mbx_get_port_name_name1_WORD word4 | ||
| 2708 | #define lpfc_mbx_get_port_name_name2_SHIFT 16 | ||
| 2709 | #define lpfc_mbx_get_port_name_name2_MASK 0x000000FF | ||
| 2710 | #define lpfc_mbx_get_port_name_name2_WORD word4 | ||
| 2711 | #define lpfc_mbx_get_port_name_name3_SHIFT 24 | ||
| 2712 | #define lpfc_mbx_get_port_name_name3_MASK 0x000000FF | ||
| 2713 | #define lpfc_mbx_get_port_name_name3_WORD word4 | ||
| 2714 | #define LPFC_LINK_NUMBER_0 0 | ||
| 2715 | #define LPFC_LINK_NUMBER_1 1 | ||
| 2716 | #define LPFC_LINK_NUMBER_2 2 | ||
| 2717 | #define LPFC_LINK_NUMBER_3 3 | ||
| 2718 | } response; | ||
| 2719 | } u; | ||
| 2720 | }; | ||
| 2721 | |||
| 2566 | /* Mailbox Completion Queue Error Messages */ | 2722 | /* Mailbox Completion Queue Error Messages */ |
| 2567 | #define MB_CQE_STATUS_SUCCESS 0x0 | 2723 | #define MB_CQE_STATUS_SUCCESS 0x0 |
| 2568 | #define MB_CQE_STATUS_INSUFFICIENT_PRIVILEGES 0x1 | 2724 | #define MB_CQE_STATUS_INSUFFICIENT_PRIVILEGES 0x1 |
| 2569 | #define MB_CQE_STATUS_INVALID_PARAMETER 0x2 | 2725 | #define MB_CQE_STATUS_INVALID_PARAMETER 0x2 |
| 2570 | #define MB_CQE_STATUS_INSUFFICIENT_RESOURCES 0x3 | 2726 | #define MB_CQE_STATUS_INSUFFICIENT_RESOURCES 0x3 |
| @@ -2648,8 +2804,9 @@ struct lpfc_mqe { | |||
| 2648 | struct lpfc_mbx_run_link_diag_test link_diag_test; | 2804 | struct lpfc_mbx_run_link_diag_test link_diag_test; |
| 2649 | struct lpfc_mbx_get_func_cfg get_func_cfg; | 2805 | struct lpfc_mbx_get_func_cfg get_func_cfg; |
| 2650 | struct lpfc_mbx_get_prof_cfg get_prof_cfg; | 2806 | struct lpfc_mbx_get_prof_cfg get_prof_cfg; |
| 2651 | struct lpfc_mbx_nop nop; | ||
| 2652 | struct lpfc_mbx_wr_object wr_object; | 2807 | struct lpfc_mbx_wr_object wr_object; |
| 2808 | struct lpfc_mbx_get_port_name get_port_name; | ||
| 2809 | struct lpfc_mbx_nop nop; | ||
| 2653 | } un; | 2810 | } un; |
| 2654 | }; | 2811 | }; |
| 2655 | 2812 | ||
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 3bdec4b2faae..99bc2bb1987f 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
| @@ -1733,11 +1733,20 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len) | |||
| 1733 | j = 0; | 1733 | j = 0; |
| 1734 | Length -= (3+i); | 1734 | Length -= (3+i); |
| 1735 | while(i--) { | 1735 | while(i--) { |
| 1736 | phba->Port[j++] = vpd[index++]; | 1736 | if ((phba->sli_rev == LPFC_SLI_REV4) && |
| 1737 | if (j == 19) | 1737 | (phba->sli4_hba.pport_name_sta == |
| 1738 | break; | 1738 | LPFC_SLI4_PPNAME_GET)) { |
| 1739 | j++; | ||
| 1740 | index++; | ||
| 1741 | } else | ||
| 1742 | phba->Port[j++] = vpd[index++]; | ||
| 1743 | if (j == 19) | ||
| 1744 | break; | ||
| 1739 | } | 1745 | } |
| 1740 | phba->Port[j] = 0; | 1746 | if ((phba->sli_rev != LPFC_SLI_REV4) || |
| 1747 | (phba->sli4_hba.pport_name_sta == | ||
| 1748 | LPFC_SLI4_PPNAME_NON)) | ||
| 1749 | phba->Port[j] = 0; | ||
| 1741 | continue; | 1750 | continue; |
| 1742 | } | 1751 | } |
| 1743 | else { | 1752 | else { |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index c48cd0be1a59..b9edfebf5091 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
| @@ -4692,6 +4692,175 @@ lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, | |||
| 4692 | } | 4692 | } |
| 4693 | 4693 | ||
| 4694 | /** | 4694 | /** |
| 4695 | * lpfc_sli4_retrieve_pport_name - Retrieve SLI4 device physical port name | ||
| 4696 | * @phba: pointer to lpfc hba data structure. | ||
| 4697 | * | ||
| 4698 | * This routine retrieves SLI4 device physical port name this PCI function | ||
| 4699 | * is attached to. | ||
| 4700 | * | ||
| 4701 | * Return codes | ||
| 4702 | * 0 - sucessful | ||
| 4703 | * otherwise - failed to retrieve physical port name | ||
| 4704 | **/ | ||
| 4705 | static int | ||
| 4706 | lpfc_sli4_retrieve_pport_name(struct lpfc_hba *phba) | ||
| 4707 | { | ||
| 4708 | LPFC_MBOXQ_t *mboxq; | ||
| 4709 | struct lpfc_mbx_read_config *rd_config; | ||
| 4710 | struct lpfc_mbx_get_cntl_attributes *mbx_cntl_attr; | ||
| 4711 | struct lpfc_controller_attribute *cntl_attr; | ||
| 4712 | struct lpfc_mbx_get_port_name *get_port_name; | ||
| 4713 | void *virtaddr = NULL; | ||
| 4714 | uint32_t alloclen, reqlen; | ||
| 4715 | uint32_t shdr_status, shdr_add_status; | ||
| 4716 | union lpfc_sli4_cfg_shdr *shdr; | ||
| 4717 | char cport_name = 0; | ||
| 4718 | int rc; | ||
| 4719 | |||
| 4720 | /* We assume nothing at this point */ | ||
| 4721 | phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_INVAL; | ||
| 4722 | phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_NON; | ||
| 4723 | |||
| 4724 | mboxq = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
| 4725 | if (!mboxq) | ||
| 4726 | return -ENOMEM; | ||
| 4727 | |||
| 4728 | /* obtain link type and link number via READ_CONFIG */ | ||
| 4729 | lpfc_read_config(phba, mboxq); | ||
| 4730 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | ||
| 4731 | if (rc == MBX_SUCCESS) { | ||
| 4732 | rd_config = &mboxq->u.mqe.un.rd_config; | ||
| 4733 | if (bf_get(lpfc_mbx_rd_conf_lnk_ldv, rd_config)) { | ||
| 4734 | phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; | ||
| 4735 | phba->sli4_hba.lnk_info.lnk_tp = | ||
| 4736 | bf_get(lpfc_mbx_rd_conf_lnk_type, rd_config); | ||
| 4737 | phba->sli4_hba.lnk_info.lnk_no = | ||
| 4738 | bf_get(lpfc_mbx_rd_conf_lnk_numb, rd_config); | ||
| 4739 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
| 4740 | "3081 lnk_type:%d, lnk_numb:%d\n", | ||
| 4741 | phba->sli4_hba.lnk_info.lnk_tp, | ||
| 4742 | phba->sli4_hba.lnk_info.lnk_no); | ||
| 4743 | goto retrieve_ppname; | ||
| 4744 | } else | ||
| 4745 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
| 4746 | "3082 Mailbox (x%x) returned ldv:x0\n", | ||
| 4747 | bf_get(lpfc_mqe_command, | ||
| 4748 | &mboxq->u.mqe)); | ||
| 4749 | } else | ||
| 4750 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
| 4751 | "3083 Mailbox (x%x) failed, status:x%x\n", | ||
| 4752 | bf_get(lpfc_mqe_command, &mboxq->u.mqe), | ||
| 4753 | bf_get(lpfc_mqe_status, &mboxq->u.mqe)); | ||
| 4754 | |||
| 4755 | /* obtain link type and link number via COMMON_GET_CNTL_ATTRIBUTES */ | ||
| 4756 | reqlen = sizeof(struct lpfc_mbx_get_cntl_attributes); | ||
| 4757 | alloclen = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, | ||
| 4758 | LPFC_MBOX_OPCODE_GET_CNTL_ATTRIBUTES, reqlen, | ||
| 4759 | LPFC_SLI4_MBX_NEMBED); | ||
| 4760 | if (alloclen < reqlen) { | ||
| 4761 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
| 4762 | "3084 Allocated DMA memory size (%d) is " | ||
| 4763 | "less than the requested DMA memory size " | ||
| 4764 | "(%d)\n", alloclen, reqlen); | ||
| 4765 | rc = -ENOMEM; | ||
| 4766 | goto out_free_mboxq; | ||
| 4767 | } | ||
| 4768 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | ||
| 4769 | virtaddr = mboxq->sge_array->addr[0]; | ||
| 4770 | mbx_cntl_attr = (struct lpfc_mbx_get_cntl_attributes *)virtaddr; | ||
| 4771 | shdr = &mbx_cntl_attr->cfg_shdr; | ||
| 4772 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); | ||
| 4773 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); | ||
| 4774 | if (shdr_status || shdr_add_status || rc) { | ||
| 4775 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
| 4776 | "3085 Mailbox x%x (x%x/x%x) failed, " | ||
| 4777 | "rc:x%x, status:x%x, add_status:x%x\n", | ||
| 4778 | bf_get(lpfc_mqe_command, &mboxq->u.mqe), | ||
| 4779 | lpfc_sli_config_mbox_subsys_get(phba, mboxq), | ||
| 4780 | lpfc_sli_config_mbox_opcode_get(phba, mboxq), | ||
| 4781 | rc, shdr_status, shdr_add_status); | ||
| 4782 | rc = -ENXIO; | ||
| 4783 | goto out_free_mboxq; | ||
| 4784 | } | ||
| 4785 | cntl_attr = &mbx_cntl_attr->cntl_attr; | ||
| 4786 | phba->sli4_hba.lnk_info.lnk_dv = LPFC_LNK_DAT_VAL; | ||
| 4787 | phba->sli4_hba.lnk_info.lnk_tp = | ||
| 4788 | bf_get(lpfc_cntl_attr_lnk_type, cntl_attr); | ||
| 4789 | phba->sli4_hba.lnk_info.lnk_no = | ||
| 4790 | bf_get(lpfc_cntl_attr_lnk_numb, cntl_attr); | ||
| 4791 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
| 4792 | "3086 lnk_type:%d, lnk_numb:%d\n", | ||
| 4793 | phba->sli4_hba.lnk_info.lnk_tp, | ||
| 4794 | phba->sli4_hba.lnk_info.lnk_no); | ||
| 4795 | |||
| 4796 | retrieve_ppname: | ||
| 4797 | lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON, | ||
| 4798 | LPFC_MBOX_OPCODE_GET_PORT_NAME, | ||
| 4799 | sizeof(struct lpfc_mbx_get_port_name) - | ||
| 4800 | sizeof(struct lpfc_sli4_cfg_mhdr), | ||
| 4801 | LPFC_SLI4_MBX_EMBED); | ||
| 4802 | get_port_name = &mboxq->u.mqe.un.get_port_name; | ||
| 4803 | shdr = (union lpfc_sli4_cfg_shdr *)&get_port_name->header.cfg_shdr; | ||
| 4804 | bf_set(lpfc_mbox_hdr_version, &shdr->request, LPFC_OPCODE_VERSION_1); | ||
| 4805 | bf_set(lpfc_mbx_get_port_name_lnk_type, &get_port_name->u.request, | ||
| 4806 | phba->sli4_hba.lnk_info.lnk_tp); | ||
| 4807 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | ||
| 4808 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); | ||
| 4809 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); | ||
| 4810 | if (shdr_status || shdr_add_status || rc) { | ||
| 4811 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, | ||
| 4812 | "3087 Mailbox x%x (x%x/x%x) failed: " | ||
| 4813 | "rc:x%x, status:x%x, add_status:x%x\n", | ||
| 4814 | bf_get(lpfc_mqe_command, &mboxq->u.mqe), | ||
| 4815 | lpfc_sli_config_mbox_subsys_get(phba, mboxq), | ||
| 4816 | lpfc_sli_config_mbox_opcode_get(phba, mboxq), | ||
| 4817 | rc, shdr_status, shdr_add_status); | ||
| 4818 | rc = -ENXIO; | ||
| 4819 | goto out_free_mboxq; | ||
| 4820 | } | ||
| 4821 | switch (phba->sli4_hba.lnk_info.lnk_no) { | ||
| 4822 | case LPFC_LINK_NUMBER_0: | ||
| 4823 | cport_name = bf_get(lpfc_mbx_get_port_name_name0, | ||
| 4824 | &get_port_name->u.response); | ||
| 4825 | phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; | ||
| 4826 | break; | ||
| 4827 | case LPFC_LINK_NUMBER_1: | ||
| 4828 | cport_name = bf_get(lpfc_mbx_get_port_name_name1, | ||
| 4829 | &get_port_name->u.response); | ||
| 4830 | phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; | ||
| 4831 | break; | ||
| 4832 | case LPFC_LINK_NUMBER_2: | ||
| 4833 | cport_name = bf_get(lpfc_mbx_get_port_name_name2, | ||
| 4834 | &get_port_name->u.response); | ||
| 4835 | phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; | ||
| 4836 | break; | ||
| 4837 | case LPFC_LINK_NUMBER_3: | ||
| 4838 | cport_name = bf_get(lpfc_mbx_get_port_name_name3, | ||
| 4839 | &get_port_name->u.response); | ||
| 4840 | phba->sli4_hba.pport_name_sta = LPFC_SLI4_PPNAME_GET; | ||
| 4841 | break; | ||
| 4842 | default: | ||
| 4843 | break; | ||
| 4844 | } | ||
| 4845 | |||
| 4846 | if (phba->sli4_hba.pport_name_sta == LPFC_SLI4_PPNAME_GET) { | ||
| 4847 | phba->Port[0] = cport_name; | ||
| 4848 | phba->Port[1] = '\0'; | ||
| 4849 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
| 4850 | "3091 SLI get port name: %s\n", phba->Port); | ||
| 4851 | } | ||
| 4852 | |||
| 4853 | out_free_mboxq: | ||
| 4854 | if (rc != MBX_TIMEOUT) { | ||
| 4855 | if (bf_get(lpfc_mqe_command, &mboxq->u.mqe) == MBX_SLI4_CONFIG) | ||
| 4856 | lpfc_sli4_mbox_cmd_free(phba, mboxq); | ||
| 4857 | else | ||
| 4858 | mempool_free(mboxq, phba->mbox_mem_pool); | ||
| 4859 | } | ||
| 4860 | return rc; | ||
| 4861 | } | ||
| 4862 | |||
| 4863 | /** | ||
| 4695 | * lpfc_sli4_arm_cqeq_intr - Arm sli-4 device completion and event queues | 4864 | * lpfc_sli4_arm_cqeq_intr - Arm sli-4 device completion and event queues |
| 4696 | * @phba: pointer to lpfc hba data structure. | 4865 | * @phba: pointer to lpfc hba data structure. |
| 4697 | * | 4866 | * |
| @@ -5754,6 +5923,17 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
| 5754 | kfree(vpd); | 5923 | kfree(vpd); |
| 5755 | goto out_free_mbox; | 5924 | goto out_free_mbox; |
| 5756 | } | 5925 | } |
| 5926 | |||
| 5927 | /* | ||
| 5928 | * Retrieve sli4 device physical port name, failure of doing it | ||
| 5929 | * is considered as non-fatal. | ||
| 5930 | */ | ||
| 5931 | rc = lpfc_sli4_retrieve_pport_name(phba); | ||
| 5932 | if (!rc) | ||
| 5933 | lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI, | ||
| 5934 | "3080 Successful retrieving SLI4 device " | ||
| 5935 | "physical port name: %s.\n", phba->Port); | ||
| 5936 | |||
| 5757 | /* | 5937 | /* |
| 5758 | * Evaluate the read rev and vpd data. Populate the driver | 5938 | * Evaluate the read rev and vpd data. Populate the driver |
| 5759 | * state with the results. If this routine fails, the failure | 5939 | * state with the results. If this routine fails, the failure |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 78c6038c5abc..d5cffd8af340 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
| @@ -389,6 +389,16 @@ struct lpfc_iov { | |||
| 389 | uint32_t vf_number; | 389 | uint32_t vf_number; |
| 390 | }; | 390 | }; |
| 391 | 391 | ||
| 392 | struct lpfc_sli4_lnk_info { | ||
| 393 | uint8_t lnk_dv; | ||
| 394 | #define LPFC_LNK_DAT_INVAL 0 | ||
| 395 | #define LPFC_LNK_DAT_VAL 1 | ||
| 396 | uint8_t lnk_tp; | ||
| 397 | #define LPFC_LNK_GE 0x0 /* FCoE */ | ||
| 398 | #define LPFC_LNK_FC 0x1 /* FC */ | ||
| 399 | uint8_t lnk_no; | ||
| 400 | }; | ||
| 401 | |||
| 392 | /* SLI4 HBA data structure entries */ | 402 | /* SLI4 HBA data structure entries */ |
| 393 | struct lpfc_sli4_hba { | 403 | struct lpfc_sli4_hba { |
| 394 | void __iomem *conf_regs_memmap_p; /* Kernel memory mapped address for | 404 | void __iomem *conf_regs_memmap_p; /* Kernel memory mapped address for |
| @@ -504,6 +514,10 @@ struct lpfc_sli4_hba { | |||
| 504 | struct list_head sp_els_xri_aborted_work_queue; | 514 | struct list_head sp_els_xri_aborted_work_queue; |
| 505 | struct list_head sp_unsol_work_queue; | 515 | struct list_head sp_unsol_work_queue; |
| 506 | struct lpfc_sli4_link link_state; | 516 | struct lpfc_sli4_link link_state; |
| 517 | struct lpfc_sli4_lnk_info lnk_info; | ||
| 518 | uint32_t pport_name_sta; | ||
| 519 | #define LPFC_SLI4_PPNAME_NON 0 | ||
| 520 | #define LPFC_SLI4_PPNAME_GET 1 | ||
| 507 | struct lpfc_iov iov; | 521 | struct lpfc_iov iov; |
| 508 | spinlock_t abts_scsi_buf_list_lock; /* list of aborted SCSI IOs */ | 522 | spinlock_t abts_scsi_buf_list_lock; /* list of aborted SCSI IOs */ |
| 509 | spinlock_t abts_sgl_list_lock; /* list of aborted els IOs */ | 523 | spinlock_t abts_sgl_list_lock; /* list of aborted els IOs */ |
