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.c113
1 files changed, 87 insertions, 26 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 6d0b36aa338..0b5f76caa6e 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4283,36 +4283,37 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
4283 goto out_free_bsmbx; 4283 goto out_free_bsmbx;
4284 } 4284 }
4285 4285
4286 /* Get the Supported Pages. It is always available. */ 4286 /* Get the Supported Pages if PORT_CAPABILITIES is supported by port. */
4287 lpfc_supported_pages(mboxq); 4287 lpfc_supported_pages(mboxq);
4288 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 4288 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
4289 if (unlikely(rc)) { 4289 if (!rc) {
4290 rc = -EIO; 4290 mqe = &mboxq->u.mqe;
4291 mempool_free(mboxq, phba->mbox_mem_pool); 4291 memcpy(&pn_page[0], ((uint8_t *)&mqe->un.supp_pages.word3),
4292 goto out_free_bsmbx; 4292 LPFC_MAX_SUPPORTED_PAGES);
4293 } 4293 for (i = 0; i < LPFC_MAX_SUPPORTED_PAGES; i++) {
4294 4294 switch (pn_page[i]) {
4295 mqe = &mboxq->u.mqe; 4295 case LPFC_SLI4_PARAMETERS:
4296 memcpy(&pn_page[0], ((uint8_t *)&mqe->un.supp_pages.word3), 4296 phba->sli4_hba.pc_sli4_params.supported = 1;
4297 LPFC_MAX_SUPPORTED_PAGES); 4297 break;
4298 for (i = 0; i < LPFC_MAX_SUPPORTED_PAGES; i++) { 4298 default:
4299 switch (pn_page[i]) { 4299 break;
4300 case LPFC_SLI4_PARAMETERS: 4300 }
4301 phba->sli4_hba.pc_sli4_params.supported = 1; 4301 }
4302 break; 4302 /* Read the port's SLI4 Parameters capabilities if supported. */
4303 default: 4303 if (phba->sli4_hba.pc_sli4_params.supported)
4304 break; 4304 rc = lpfc_pc_sli4_params_get(phba, mboxq);
4305 if (rc) {
4306 mempool_free(mboxq, phba->mbox_mem_pool);
4307 rc = -EIO;
4308 goto out_free_bsmbx;
4305 } 4309 }
4306 } 4310 }
4307 4311 /*
4308 /* Read the port's SLI4 Parameters capabilities if supported. */ 4312 * Get sli4 parameters that override parameters from Port capabilities.
4309 if (phba->sli4_hba.pc_sli4_params.supported) 4313 * If this call fails it is not a critical error so continue loading.
4310 rc = lpfc_pc_sli4_params_get(phba, mboxq); 4314 */
4315 lpfc_get_sli4_parameters(phba, mboxq);
4311 mempool_free(mboxq, phba->mbox_mem_pool); 4316 mempool_free(mboxq, phba->mbox_mem_pool);
4312 if (rc) {
4313 rc = -EIO;
4314 goto out_free_bsmbx;
4315 }
4316 /* Create all the SLI4 queues */ 4317 /* Create all the SLI4 queues */
4317 rc = lpfc_sli4_queue_create(phba); 4318 rc = lpfc_sli4_queue_create(phba);
4318 if (rc) 4319 if (rc)
@@ -7810,7 +7811,7 @@ lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
7810 mqe = &mboxq->u.mqe; 7811 mqe = &mboxq->u.mqe;
7811 7812
7812 /* Read the port's SLI4 Parameters port capabilities */ 7813 /* Read the port's SLI4 Parameters port capabilities */
7813 lpfc_sli4_params(mboxq); 7814 lpfc_pc_sli4_params(mboxq);
7814 if (!phba->sli4_hba.intr_enable) 7815 if (!phba->sli4_hba.intr_enable)
7815 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); 7816 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
7816 else { 7817 else {
@@ -7854,6 +7855,66 @@ lpfc_pc_sli4_params_get(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
7854} 7855}
7855 7856
7856/** 7857/**
7858 * lpfc_get_sli4_parameters - Get the SLI4 Config PARAMETERS.
7859 * @phba: Pointer to HBA context object.
7860 * @mboxq: Pointer to the mailboxq memory for the mailbox command response.
7861 *
7862 * This function is called in the SLI4 code path to read the port's
7863 * sli4 capabilities.
7864 *
7865 * This function may be be called from any context that can block-wait
7866 * for the completion. The expectation is that this routine is called
7867 * typically from probe_one or from the online routine.
7868 **/
7869int
7870lpfc_get_sli4_parameters(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
7871{
7872 int rc;
7873 struct lpfc_mqe *mqe = &mboxq->u.mqe;
7874 struct lpfc_pc_sli4_params *sli4_params;
7875 int length;
7876 struct lpfc_sli4_parameters *mbx_sli4_parameters;
7877
7878 /* Read the port's SLI4 Config Parameters */
7879 length = (sizeof(struct lpfc_mbx_get_sli4_parameters) -
7880 sizeof(struct lpfc_sli4_cfg_mhdr));
7881 lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_COMMON,
7882 LPFC_MBOX_OPCODE_GET_SLI4_PARAMETERS,
7883 length, LPFC_SLI4_MBX_EMBED);
7884 if (!phba->sli4_hba.intr_enable)
7885 rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
7886 else
7887 rc = lpfc_sli_issue_mbox_wait(phba, mboxq,
7888 lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG));
7889 if (unlikely(rc))
7890 return rc;
7891 sli4_params = &phba->sli4_hba.pc_sli4_params;
7892 mbx_sli4_parameters = &mqe->un.get_sli4_parameters.sli4_parameters;
7893 sli4_params->if_type = bf_get(cfg_if_type, mbx_sli4_parameters);
7894 sli4_params->sli_rev = bf_get(cfg_sli_rev, mbx_sli4_parameters);
7895 sli4_params->sli_family = bf_get(cfg_sli_family, mbx_sli4_parameters);
7896 sli4_params->featurelevel_1 = bf_get(cfg_sli_hint_1,
7897 mbx_sli4_parameters);
7898 sli4_params->featurelevel_2 = bf_get(cfg_sli_hint_2,
7899 mbx_sli4_parameters);
7900 if (bf_get(cfg_phwq, mbx_sli4_parameters))
7901 phba->sli3_options |= LPFC_SLI4_PHWQ_ENABLED;
7902 else
7903 phba->sli3_options &= ~LPFC_SLI4_PHWQ_ENABLED;
7904 sli4_params->sge_supp_len = mbx_sli4_parameters->sge_supp_len;
7905 sli4_params->loopbk_scope = bf_get(loopbk_scope, mbx_sli4_parameters);
7906 sli4_params->cqv = bf_get(cfg_cqv, mbx_sli4_parameters);
7907 sli4_params->mqv = bf_get(cfg_mqv, mbx_sli4_parameters);
7908 sli4_params->wqv = bf_get(cfg_wqv, mbx_sli4_parameters);
7909 sli4_params->rqv = bf_get(cfg_rqv, mbx_sli4_parameters);
7910 sli4_params->sgl_pages_max = bf_get(cfg_sgl_page_cnt,
7911 mbx_sli4_parameters);
7912 sli4_params->sgl_pp_align = bf_get(cfg_sgl_pp_align,
7913 mbx_sli4_parameters);
7914 return 0;
7915}
7916
7917/**
7857 * lpfc_pci_probe_one_s3 - PCI probe func to reg SLI-3 device to PCI subsystem. 7918 * lpfc_pci_probe_one_s3 - PCI probe func to reg SLI-3 device to PCI subsystem.
7858 * @pdev: pointer to PCI device 7919 * @pdev: pointer to PCI device
7859 * @pid: pointer to PCI device identifier 7920 * @pid: pointer to PCI device identifier