forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/scsi/lpfc/lpfc_mbox.c
....@@ -94,7 +94,7 @@
9494 memset(mp->virt, 0, LPFC_BPL_SIZE);
9595 INIT_LIST_HEAD(&mp->list);
9696 /* save address for completion */
97
- pmb->context1 = (uint8_t *)mp;
97
+ pmb->ctx_buf = (uint8_t *)mp;
9898 mb->un.varWords[3] = putPaddrLow(mp->phys);
9999 mb->un.varWords[4] = putPaddrHigh(mp->phys);
100100 mb->un.varDmp.sli4_length = sizeof(struct static_vport_info);
....@@ -139,7 +139,7 @@
139139 void *ctx;
140140
141141 mb = &pmb->u.mb;
142
- ctx = pmb->context2;
142
+ ctx = pmb->ctx_buf;
143143
144144 /* Setup to dump VPD region */
145145 memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
....@@ -151,7 +151,7 @@
151151 mb->un.varDmp.word_cnt = (DMP_RSP_SIZE / sizeof (uint32_t));
152152 mb->un.varDmp.co = 0;
153153 mb->un.varDmp.resp_offset = 0;
154
- pmb->context2 = ctx;
154
+ pmb->ctx_buf = ctx;
155155 mb->mbxOwner = OWN_HOST;
156156 return;
157157 }
....@@ -172,7 +172,7 @@
172172
173173 mb = &pmb->u.mb;
174174 /* Save context so that we can restore after memset */
175
- ctx = pmb->context2;
175
+ ctx = pmb->ctx_buf;
176176
177177 /* Setup to dump VPD region */
178178 memset(pmb, 0, sizeof(LPFC_MBOXQ_t));
....@@ -186,7 +186,7 @@
186186 mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE;
187187 mb->un.varDmp.co = 0;
188188 mb->un.varDmp.resp_offset = 0;
189
- pmb->context2 = ctx;
189
+ pmb->ctx_buf = ctx;
190190 return;
191191 }
192192
....@@ -304,7 +304,7 @@
304304 /* Save address for later completion and set the owner to host so that
305305 * the FW knows this mailbox is available for processing.
306306 */
307
- pmb->context1 = (uint8_t *)mp;
307
+ pmb->ctx_buf = (uint8_t *)mp;
308308 mb->mbxOwner = OWN_HOST;
309309 return (0);
310310 }
....@@ -515,6 +515,7 @@
515515
516516 if ((phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC ||
517517 phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC) &&
518
+ !(phba->sli4_hba.pc_sli4_params.pls) &&
518519 mb->un.varInitLnk.link_flags & FLAGS_TOPOLOGY_MODE_LOOP) {
519520 mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT;
520521 phba->cfg_topology = FLAGS_TOPOLOGY_MODE_PT_PT;
....@@ -631,7 +632,7 @@
631632 mb->un.varRdSparm.vpi = phba->vpi_ids[vpi];
632633
633634 /* save address for completion */
634
- pmb->context1 = mp;
635
+ pmb->ctx_buf = mp;
635636
636637 return (0);
637638 }
....@@ -783,7 +784,7 @@
783784 memcpy(sparam, param, sizeof (struct serv_parm));
784785
785786 /* save address for completion */
786
- pmb->context1 = (uint8_t *) mp;
787
+ pmb->ctx_buf = (uint8_t *)mp;
787788
788789 mb->mbxCommand = MBX_REG_LOGIN64;
789790 mb->un.varRegLogin.un.sp64.tus.f.bdeSize = sizeof (struct serv_parm);
....@@ -858,7 +859,7 @@
858859 mbox->u.mb.un.varUnregLogin.rsvd1 = 0x4000;
859860 mbox->vport = vport;
860861 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
861
- mbox->context1 = NULL;
862
+ mbox->ctx_ndlp = NULL;
862863 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
863864 if (rc == MBX_NOT_FINISHED)
864865 mempool_free(mbox, phba->mbox_mem_pool);
....@@ -867,9 +868,7 @@
867868
868869 /**
869870 * lpfc_reg_vpi - Prepare a mailbox command for registering vport identifier
870
- * @phba: pointer to lpfc hba data structure.
871
- * @vpi: virtual N_Port identifier.
872
- * @sid: Fibre Channel S_ID (N_Port_ID assigned to a virtual N_Port).
871
+ * @vport: pointer to a vport object.
873872 * @pmb: pointer to the driver internal queue element for mailbox command.
874873 *
875874 * The registration vport identifier mailbox command is used to activate a
....@@ -1198,7 +1197,7 @@
11981197 /**
11991198 * lpfc_config_ring - Prepare a mailbox command for configuring an IOCB ring
12001199 * @phba: pointer to lpfc hba data structure.
1201
- * @ring:
1200
+ * @ring: ring number/index
12021201 * @pmb: pointer to the driver internal queue element for mailbox command.
12031202 *
12041203 * The configure ring mailbox command is used to configure an IOCB ring. This
....@@ -1298,8 +1297,6 @@
12981297 if (phba->sli_rev == LPFC_SLI_REV3 && phba->vpd.sli3Feat.cerbm) {
12991298 if (phba->cfg_enable_bg)
13001299 mb->un.varCfgPort.cbg = 1; /* configure BlockGuard */
1301
- if (phba->cfg_enable_dss)
1302
- mb->un.varCfgPort.cdss = 1; /* Configure Security */
13031300 mb->un.varCfgPort.cerbm = 1; /* Request HBQs */
13041301 mb->un.varCfgPort.ccrp = 1; /* Command Ring Polling */
13051302 mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count();
....@@ -1379,7 +1376,8 @@
13791376 */
13801377
13811378 if (phba->cfg_hostmem_hgp && phba->sli_rev != 3) {
1382
- phba->host_gp = &phba->mbox->us.s2.host[0];
1379
+ phba->host_gp = (struct lpfc_hgp __iomem *)
1380
+ &phba->mbox->us.s2.host[0];
13831381 phba->hbq_put = NULL;
13841382 offset = (uint8_t *)&phba->mbox->us.s2.host -
13851383 (uint8_t *)phba->slim2p.virt;
....@@ -1613,7 +1611,7 @@
16131611 /**
16141612 * lpfc_mbox_tmo_val - Retrieve mailbox command timeout value
16151613 * @phba: pointer to lpfc hba data structure.
1616
- * @cmd: mailbox command code.
1614
+ * @mboxq: pointer to the driver internal queue element for mailbox command.
16171615 *
16181616 * This routine retrieves the proper timeout value according to the mailbox
16191617 * command code.
....@@ -1700,6 +1698,7 @@
17001698 * lpfc_sli4_mbx_sge_get - Get a sge entry from non-embedded mailbox command
17011699 * @mbox: pointer to lpfc mbox command.
17021700 * @sgentry: sge entry index.
1701
+ * @sge: pointer to lpfc mailbox sge to load into.
17031702 *
17041703 * This routine gets an entry from the non-embedded mailbox command at the sge
17051704 * index location.
....@@ -1767,6 +1766,7 @@
17671766 * @subsystem: The sli4 config sub mailbox subsystem.
17681767 * @opcode: The sli4 config sub mailbox command opcode.
17691768 * @length: Length of the sli4 config mailbox command (including sub-header).
1769
+ * @emb: True if embedded mbox command should be setup.
17701770 *
17711771 * This routine sets up the header fields of SLI4 specific mailbox command
17721772 * for sending IOCTL command.
....@@ -1827,9 +1827,9 @@
18271827 * page, this is used as a priori size of SLI4_PAGE_SIZE for
18281828 * the later DMA memory free.
18291829 */
1830
- viraddr = dma_zalloc_coherent(&phba->pcidev->dev,
1831
- SLI4_PAGE_SIZE, &phyaddr,
1832
- GFP_KERNEL);
1830
+ viraddr = dma_alloc_coherent(&phba->pcidev->dev,
1831
+ SLI4_PAGE_SIZE, &phyaddr,
1832
+ GFP_KERNEL);
18331833 /* In case of malloc fails, proceed with whatever we have */
18341834 if (!viraddr)
18351835 break;
....@@ -2012,6 +2012,7 @@
20122012 /**
20132013 * lpfc_sli4_mbx_read_fcf_rec - Allocate and construct read fcf mbox cmd
20142014 * @phba: pointer to lpfc hba data structure.
2015
+ * @mboxq: pointer to lpfc mbox command.
20152016 * @fcf_index: index to fcf table.
20162017 *
20172018 * This routine routine allocates and constructs non-embedded mailbox command
....@@ -2068,6 +2069,7 @@
20682069
20692070 /**
20702071 * lpfc_request_features: Configure SLI4 REQUEST_FEATURES mailbox
2072
+ * @phba: pointer to lpfc hba data structure.
20712073 * @mboxq: pointer to lpfc mbox command.
20722074 *
20732075 * This routine sets up the mailbox for an SLI4 REQUEST_FEATURES
....@@ -2095,8 +2097,8 @@
20952097 if (phba->nvmet_support) {
20962098 bf_set(lpfc_mbx_rq_ftr_rq_mrqp, &mboxq->u.mqe.un.req_ftrs, 1);
20972099 /* iaab/iaar NOT set for now */
2098
- bf_set(lpfc_mbx_rq_ftr_rq_iaab, &mboxq->u.mqe.un.req_ftrs, 0);
2099
- bf_set(lpfc_mbx_rq_ftr_rq_iaar, &mboxq->u.mqe.un.req_ftrs, 0);
2100
+ bf_set(lpfc_mbx_rq_ftr_rq_iaab, &mboxq->u.mqe.un.req_ftrs, 0);
2101
+ bf_set(lpfc_mbx_rq_ftr_rq_iaar, &mboxq->u.mqe.un.req_ftrs, 0);
21002102 }
21012103 return;
21022104 }
....@@ -2288,7 +2290,7 @@
22882290 INIT_LIST_HEAD(&mp->list);
22892291
22902292 /* save address for completion */
2291
- mbox->context1 = (uint8_t *) mp;
2293
+ mbox->ctx_buf = (uint8_t *)mp;
22922294
22932295 mb->mbxCommand = MBX_DUMP_MEMORY;
22942296 mb->un.varDmp.type = DMP_NV_PARAMS;
....@@ -2305,7 +2307,7 @@
23052307 MAILBOX_t *mb;
23062308 int rc = FAILURE;
23072309 struct lpfc_rdp_context *rdp_context =
2308
- (struct lpfc_rdp_context *)(mboxq->context2);
2310
+ (struct lpfc_rdp_context *)(mboxq->ctx_ndlp);
23092311
23102312 mb = &mboxq->u.mb;
23112313 if (mb->mbxStatus)
....@@ -2323,9 +2325,9 @@
23232325 static void
23242326 lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
23252327 {
2326
- struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) mbox->context1;
2328
+ struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)mbox->ctx_buf;
23272329 struct lpfc_rdp_context *rdp_context =
2328
- (struct lpfc_rdp_context *)(mbox->context2);
2330
+ (struct lpfc_rdp_context *)(mbox->ctx_ndlp);
23292331
23302332 if (bf_get(lpfc_mqe_status, &mbox->u.mqe))
23312333 goto error_mbuf_free;
....@@ -2341,7 +2343,7 @@
23412343 lpfc_read_lnk_stat(phba, mbox);
23422344 mbox->vport = rdp_context->ndlp->vport;
23432345 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat;
2344
- mbox->context2 = (struct lpfc_rdp_context *) rdp_context;
2346
+ mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context;
23452347 if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == MBX_NOT_FINISHED)
23462348 goto error_cmd_free;
23472349
....@@ -2359,9 +2361,9 @@
23592361 lpfc_mbx_cmpl_rdp_page_a0(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
23602362 {
23612363 int rc;
2362
- struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (mbox->context1);
2364
+ struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(mbox->ctx_buf);
23632365 struct lpfc_rdp_context *rdp_context =
2364
- (struct lpfc_rdp_context *)(mbox->context2);
2366
+ (struct lpfc_rdp_context *)(mbox->ctx_ndlp);
23652367
23662368 if (bf_get(lpfc_mqe_status, &mbox->u.mqe))
23672369 goto error;
....@@ -2375,7 +2377,7 @@
23752377 INIT_LIST_HEAD(&mp->list);
23762378
23772379 /* save address for completion */
2378
- mbox->context1 = mp;
2380
+ mbox->ctx_buf = mp;
23792381 mbox->vport = rdp_context->ndlp->vport;
23802382
23812383 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_DUMP_MEMORY);
....@@ -2391,7 +2393,7 @@
23912393 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys);
23922394
23932395 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a2;
2394
- mbox->context2 = (struct lpfc_rdp_context *) rdp_context;
2396
+ mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context;
23952397 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
23962398 if (rc == MBX_NOT_FINISHED)
23972399 goto error;
....@@ -2436,7 +2438,7 @@
24362438
24372439 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_DUMP_MEMORY);
24382440 /* save address for completion */
2439
- mbox->context1 = mp;
2441
+ mbox->ctx_buf = mp;
24402442
24412443 bf_set(lpfc_mbx_memory_dump_type3_type,
24422444 &mbox->u.mqe.un.mem_dump_type3, DMP_LMSD);