• Home
  • Raw
  • Download

Lines Matching +full:sub +full:- +full:mailbox

4  * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
6 * Copyright (C) 2004-2016 Emulex. All rights reserved. *
9 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
17 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
47 * lpfc_dump_static_vport - Dump HBA's static vport information.
49 * @pmb: pointer to the driver internal queue element for mailbox command.
52 * The dump mailbox command provides a method for the device driver to obtain
55 * This routine prepares the mailbox command for dumping list of static
65 mb = &pmb->u.mb; in lpfc_dump_static_vport()
69 mb->mbxCommand = MBX_DUMP_MEMORY; in lpfc_dump_static_vport()
70 mb->un.varDmp.type = DMP_NV_PARAMS; in lpfc_dump_static_vport()
71 mb->un.varDmp.entry_index = offset; in lpfc_dump_static_vport()
72 mb->un.varDmp.region_id = DMP_REGION_VPORT; in lpfc_dump_static_vport()
73 mb->mbxOwner = OWN_HOST; in lpfc_dump_static_vport()
75 /* For SLI3 HBAs data is embedded in mailbox */ in lpfc_dump_static_vport()
76 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_dump_static_vport()
77 mb->un.varDmp.cv = 1; in lpfc_dump_static_vport()
78 mb->un.varDmp.word_cnt = DMP_RSP_SIZE/sizeof(uint32_t); in lpfc_dump_static_vport()
85 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_dump_static_vport()
87 if (!mp || !mp->virt) { in lpfc_dump_static_vport()
94 memset(mp->virt, 0, LPFC_BPL_SIZE); in lpfc_dump_static_vport()
95 INIT_LIST_HEAD(&mp->list); in lpfc_dump_static_vport()
97 pmb->ctx_buf = (uint8_t *)mp; in lpfc_dump_static_vport()
98 mb->un.varWords[3] = putPaddrLow(mp->phys); in lpfc_dump_static_vport()
99 mb->un.varWords[4] = putPaddrHigh(mp->phys); in lpfc_dump_static_vport()
100 mb->un.varDmp.sli4_length = sizeof(struct static_vport_info); in lpfc_dump_static_vport()
106 * lpfc_down_link - Bring down HBAs link.
108 * @pmb: pointer to the driver internal queue element for mailbox command.
110 * This routine prepares a mailbox command to bring down HBA link.
117 mb = &pmb->u.mb; in lpfc_down_link()
118 mb->mbxCommand = MBX_DOWN_LINK; in lpfc_down_link()
119 mb->mbxOwner = OWN_HOST; in lpfc_down_link()
123 * lpfc_dump_mem - Prepare a mailbox command for reading a region.
125 * @pmb: pointer to the driver internal queue element for mailbox command.
129 * The dump mailbox command provides a method for the device driver to obtain
132 * This routine prepares the mailbox command for dumping HBA's config region.
141 mb = &pmb->u.mb; in lpfc_dump_mem()
142 ctx = pmb->ctx_buf; in lpfc_dump_mem()
146 mb->mbxCommand = MBX_DUMP_MEMORY; in lpfc_dump_mem()
147 mb->un.varDmp.cv = 1; in lpfc_dump_mem()
148 mb->un.varDmp.type = DMP_NV_PARAMS; in lpfc_dump_mem()
149 mb->un.varDmp.entry_index = offset; in lpfc_dump_mem()
150 mb->un.varDmp.region_id = region_id; in lpfc_dump_mem()
151 mb->un.varDmp.word_cnt = (DMP_RSP_SIZE / sizeof (uint32_t)); in lpfc_dump_mem()
152 mb->un.varDmp.co = 0; in lpfc_dump_mem()
153 mb->un.varDmp.resp_offset = 0; in lpfc_dump_mem()
154 pmb->ctx_buf = ctx; in lpfc_dump_mem()
155 mb->mbxOwner = OWN_HOST; in lpfc_dump_mem()
160 * lpfc_dump_wakeup_param - Prepare mailbox command for retrieving wakeup params
162 * @pmb: pointer to the driver internal queue element for mailbox command.
164 * This function create a dump memory mailbox command to dump wake up
173 mb = &pmb->u.mb; in lpfc_dump_wakeup_param()
175 ctx = pmb->ctx_buf; in lpfc_dump_wakeup_param()
179 mb->mbxCommand = MBX_DUMP_MEMORY; in lpfc_dump_wakeup_param()
180 mb->mbxOwner = OWN_HOST; in lpfc_dump_wakeup_param()
181 mb->un.varDmp.cv = 1; in lpfc_dump_wakeup_param()
182 mb->un.varDmp.type = DMP_NV_PARAMS; in lpfc_dump_wakeup_param()
183 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_dump_wakeup_param()
184 mb->un.varDmp.entry_index = 0; in lpfc_dump_wakeup_param()
185 mb->un.varDmp.region_id = WAKE_UP_PARMS_REGION_ID; in lpfc_dump_wakeup_param()
186 mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE; in lpfc_dump_wakeup_param()
187 mb->un.varDmp.co = 0; in lpfc_dump_wakeup_param()
188 mb->un.varDmp.resp_offset = 0; in lpfc_dump_wakeup_param()
189 pmb->ctx_buf = ctx; in lpfc_dump_wakeup_param()
194 * lpfc_read_nv - Prepare a mailbox command for reading HBA's NVRAM param
196 * @pmb: pointer to the driver internal queue element for mailbox command.
198 * The read NVRAM mailbox command returns the HBA's non-volatile parameters
199 * that are used as defaults when the Fibre Channel link is brought on-line.
201 * This routine prepares the mailbox command for reading information stored
209 mb = &pmb->u.mb; in lpfc_read_nv()
211 mb->mbxCommand = MBX_READ_NV; in lpfc_read_nv()
212 mb->mbxOwner = OWN_HOST; in lpfc_read_nv()
217 * lpfc_config_async - Prepare a mailbox command for enabling HBA async event
219 * @pmb: pointer to the driver internal queue element for mailbox command.
222 * The asynchronous event enable mailbox command is used to enable the
226 * This routine prepares the mailbox command for enabling HBA asynchronous
235 mb = &pmb->u.mb; in lpfc_config_async()
237 mb->mbxCommand = MBX_ASYNCEVT_ENABLE; in lpfc_config_async()
238 mb->un.varCfgAsyncEvent.ring = ring; in lpfc_config_async()
239 mb->mbxOwner = OWN_HOST; in lpfc_config_async()
244 * lpfc_heart_beat - Prepare a mailbox command for heart beat
246 * @pmb: pointer to the driver internal queue element for mailbox command.
248 * The heart beat mailbox command is used to detect an unresponsive HBA, which
249 * is defined as any device where no error attention is sent and both mailbox
252 * This routine prepares the mailbox command for issuing a heart beat in the
253 * form of mailbox command to the HBA. The timely completion of the heart
254 * beat mailbox command indicates the health of the HBA.
261 mb = &pmb->u.mb; in lpfc_heart_beat()
263 mb->mbxCommand = MBX_HEARTBEAT; in lpfc_heart_beat()
264 mb->mbxOwner = OWN_HOST; in lpfc_heart_beat()
269 * lpfc_read_topology - Prepare a mailbox command for reading HBA topology
271 * @pmb: pointer to the driver internal queue element for mailbox command.
274 * The read topology mailbox command is issued to read the link topology
276 * Attention (HSTATT) register is set to 1 (For SLI-3) or when an FC Link
277 * Attention ACQE is received from the port (For SLI-4). A Link Event
281 * This routine prepares the mailbox command for reading HBA link topology
284 * memory as part of the execution of the mailbox command.
287 * 0 - Success (currently always return 0)
295 mb = &pmb->u.mb; in lpfc_read_topology()
298 INIT_LIST_HEAD(&mp->list); in lpfc_read_topology()
299 mb->mbxCommand = MBX_READ_TOPOLOGY; in lpfc_read_topology()
300 mb->un.varReadTop.lilpBde64.tus.f.bdeSize = LPFC_ALPA_MAP_SIZE; in lpfc_read_topology()
301 mb->un.varReadTop.lilpBde64.addrHigh = putPaddrHigh(mp->phys); in lpfc_read_topology()
302 mb->un.varReadTop.lilpBde64.addrLow = putPaddrLow(mp->phys); in lpfc_read_topology()
305 * the FW knows this mailbox is available for processing. in lpfc_read_topology()
307 pmb->ctx_buf = (uint8_t *)mp; in lpfc_read_topology()
308 mb->mbxOwner = OWN_HOST; in lpfc_read_topology()
313 * lpfc_clear_la - Prepare a mailbox command for clearing HBA link attention
315 * @pmb: pointer to the driver internal queue element for mailbox command.
317 * The clear link attention mailbox command is issued to clear the link event
321 * The current event tag is read using the read link attention event mailbox
324 * This routine prepares the mailbox command for clearing HBA link attention
332 mb = &pmb->u.mb; in lpfc_clear_la()
335 mb->un.varClearLA.eventTag = phba->fc_eventTag; in lpfc_clear_la()
336 mb->mbxCommand = MBX_CLEAR_LA; in lpfc_clear_la()
337 mb->mbxOwner = OWN_HOST; in lpfc_clear_la()
342 * lpfc_config_link - Prepare a mailbox command for configuring link on a HBA
344 * @pmb: pointer to the driver internal queue element for mailbox command.
346 * The configure link mailbox command is used before the initialize link
347 * mailbox command to override default value and to configure link-oriented
353 * This routine prepares the mailbox command for configuring link on a HBA.
358 struct lpfc_vport *vport = phba->pport; in lpfc_config_link()
359 MAILBOX_t *mb = &pmb->u.mb; in lpfc_config_link()
363 * SLI-2, Coalescing Response Feature. in lpfc_config_link()
365 if (phba->cfg_cr_delay && (phba->sli_rev < LPFC_SLI_REV4)) { in lpfc_config_link()
366 mb->un.varCfgLnk.cr = 1; in lpfc_config_link()
367 mb->un.varCfgLnk.ci = 1; in lpfc_config_link()
368 mb->un.varCfgLnk.cr_delay = phba->cfg_cr_delay; in lpfc_config_link()
369 mb->un.varCfgLnk.cr_count = phba->cfg_cr_count; in lpfc_config_link()
372 mb->un.varCfgLnk.myId = vport->fc_myDID; in lpfc_config_link()
373 mb->un.varCfgLnk.edtov = phba->fc_edtov; in lpfc_config_link()
374 mb->un.varCfgLnk.arbtov = phba->fc_arbtov; in lpfc_config_link()
375 mb->un.varCfgLnk.ratov = phba->fc_ratov; in lpfc_config_link()
376 mb->un.varCfgLnk.rttov = phba->fc_rttov; in lpfc_config_link()
377 mb->un.varCfgLnk.altov = phba->fc_altov; in lpfc_config_link()
378 mb->un.varCfgLnk.crtov = phba->fc_crtov; in lpfc_config_link()
379 mb->un.varCfgLnk.cscn = 0; in lpfc_config_link()
380 if (phba->bbcredit_support && phba->cfg_enable_bbcr) { in lpfc_config_link()
381 mb->un.varCfgLnk.cscn = 1; in lpfc_config_link()
382 mb->un.varCfgLnk.bbscn = bf_get(lpfc_bbscn_def, in lpfc_config_link()
383 &phba->sli4_hba.bbscn_params); in lpfc_config_link()
386 if (phba->cfg_ack0 && (phba->sli_rev < LPFC_SLI_REV4)) in lpfc_config_link()
387 mb->un.varCfgLnk.ack0_enable = 1; in lpfc_config_link()
389 mb->mbxCommand = MBX_CONFIG_LINK; in lpfc_config_link()
390 mb->mbxOwner = OWN_HOST; in lpfc_config_link()
395 * lpfc_config_msi - Prepare a mailbox command for configuring msi-x
397 * @pmb: pointer to the driver internal queue element for mailbox command.
399 * The configure MSI-X mailbox command is used to configure the HBA's SLI-3
400 * MSI-X multi-message interrupt vector association to interrupt attention
404 * 0 - Success
405 * -EINVAL - Failure
410 MAILBOX_t *mb = &pmb->u.mb; in lpfc_config_msi()
414 if (phba->cfg_use_msi != 2) { in lpfc_config_msi()
416 "0475 Not configured for supporting MSI-X " in lpfc_config_msi()
417 "cfg_use_msi: 0x%x\n", phba->cfg_use_msi); in lpfc_config_msi()
418 return -EINVAL; in lpfc_config_msi()
421 if (phba->sli_rev < 3) { in lpfc_config_msi()
423 "0476 HBA not supporting SLI-3 or later " in lpfc_config_msi()
424 "SLI Revision: 0x%x\n", phba->sli_rev); in lpfc_config_msi()
425 return -EINVAL; in lpfc_config_msi()
428 /* Clear mailbox command fields */ in lpfc_config_msi()
432 * SLI-3, Message Signaled Interrupt Fearure. in lpfc_config_msi()
435 /* Multi-message attention configuration */ in lpfc_config_msi()
440 mb->un.varCfgMSI.attentionConditions[0] = attentionConditions[0]; in lpfc_config_msi()
441 mb->un.varCfgMSI.attentionConditions[1] = attentionConditions[1]; in lpfc_config_msi()
448 mb->un.varCfgMSI.messageNumberByHA[HA_R0_POS] = 1; in lpfc_config_msi()
450 mb->un.varCfgMSI.messageNumberByHA[HA_R1_POS] = 1; in lpfc_config_msi()
453 mb->un.varCfgMSI.messageNumberByHA[HA_R0_POS^3] = 1; in lpfc_config_msi()
455 mb->un.varCfgMSI.messageNumberByHA[HA_R1_POS^3] = 1; in lpfc_config_msi()
457 /* Multi-message interrupt autoclear configuration*/ in lpfc_config_msi()
458 mb->un.varCfgMSI.autoClearHA[0] = attentionConditions[0]; in lpfc_config_msi()
459 mb->un.varCfgMSI.autoClearHA[1] = attentionConditions[1]; in lpfc_config_msi()
462 mb->un.varCfgMSI.autoClearHA[0] = 0; in lpfc_config_msi()
463 mb->un.varCfgMSI.autoClearHA[1] = 0; in lpfc_config_msi()
466 mb->mbxCommand = MBX_CONFIG_MSI; in lpfc_config_msi()
467 mb->mbxOwner = OWN_HOST; in lpfc_config_msi()
473 * lpfc_init_link - Prepare a mailbox command for initialize link on a HBA
475 * @pmb: pointer to the driver internal queue element for mailbox command.
479 * The initialize link mailbox command is used to initialize the Fibre
483 * This routine prepares the mailbox command for initializing link on a HBA
493 mb = &pmb->u.mb; in lpfc_init_link()
498 mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_LOOP; in lpfc_init_link()
499 mb->un.varInitLnk.link_flags |= FLAGS_TOPOLOGY_FAILOVER; in lpfc_init_link()
502 mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT; in lpfc_init_link()
505 mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_LOOP; in lpfc_init_link()
508 mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT; in lpfc_init_link()
509 mb->un.varInitLnk.link_flags |= FLAGS_TOPOLOGY_FAILOVER; in lpfc_init_link()
512 mb->un.varInitLnk.link_flags = FLAGS_LOCAL_LB; in lpfc_init_link()
516 if ((phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || in lpfc_init_link()
517 phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC) && in lpfc_init_link()
518 !(phba->sli4_hba.pc_sli4_params.pls) && in lpfc_init_link()
519 mb->un.varInitLnk.link_flags & FLAGS_TOPOLOGY_MODE_LOOP) { in lpfc_init_link()
520 mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT; in lpfc_init_link()
521 phba->cfg_topology = FLAGS_TOPOLOGY_MODE_PT_PT; in lpfc_init_link()
525 mb->un.varInitLnk.link_flags |= FLAGS_IMED_ABORT; in lpfc_init_link()
530 vpd = &phba->vpd; in lpfc_init_link()
531 if (vpd->rev.feaLevelHigh >= 0x02){ in lpfc_init_link()
534 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; in lpfc_init_link()
535 mb->un.varInitLnk.link_speed = LINK_SPEED_1G; in lpfc_init_link()
538 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; in lpfc_init_link()
539 mb->un.varInitLnk.link_speed = LINK_SPEED_2G; in lpfc_init_link()
542 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; in lpfc_init_link()
543 mb->un.varInitLnk.link_speed = LINK_SPEED_4G; in lpfc_init_link()
546 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; in lpfc_init_link()
547 mb->un.varInitLnk.link_speed = LINK_SPEED_8G; in lpfc_init_link()
550 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; in lpfc_init_link()
551 mb->un.varInitLnk.link_speed = LINK_SPEED_10G; in lpfc_init_link()
554 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; in lpfc_init_link()
555 mb->un.varInitLnk.link_speed = LINK_SPEED_16G; in lpfc_init_link()
558 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; in lpfc_init_link()
559 mb->un.varInitLnk.link_speed = LINK_SPEED_32G; in lpfc_init_link()
562 mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; in lpfc_init_link()
563 mb->un.varInitLnk.link_speed = LINK_SPEED_64G; in lpfc_init_link()
567 mb->un.varInitLnk.link_speed = LINK_SPEED_AUTO; in lpfc_init_link()
573 mb->un.varInitLnk.link_speed = LINK_SPEED_AUTO; in lpfc_init_link()
575 mb->mbxCommand = (volatile uint8_t)MBX_INIT_LINK; in lpfc_init_link()
576 mb->mbxOwner = OWN_HOST; in lpfc_init_link()
577 mb->un.varInitLnk.fabric_AL_PA = phba->fc_pref_ALPA; in lpfc_init_link()
582 * lpfc_read_sparam - Prepare a mailbox command for reading HBA parameters
584 * @pmb: pointer to the driver internal queue element for mailbox command.
587 * The read service parameter mailbox command is used to read the HBA port
589 * specified directly by a BDE in the mailbox command. These service
593 * This routine prepares the mailbox command for reading HBA port service
595 * are populated into the mailbox command for the HBA to DMA the service
599 * 0 - Success
600 * 1 - DMA memory allocation failed
608 mb = &pmb->u.mb; in lpfc_read_sparam()
611 mb->mbxOwner = OWN_HOST; in lpfc_read_sparam()
617 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_read_sparam()
618 if (!mp || !mp->virt) { in lpfc_read_sparam()
620 mb->mbxCommand = MBX_READ_SPARM64; in lpfc_read_sparam()
626 INIT_LIST_HEAD(&mp->list); in lpfc_read_sparam()
627 mb->mbxCommand = MBX_READ_SPARM64; in lpfc_read_sparam()
628 mb->un.varRdSparm.un.sp64.tus.f.bdeSize = sizeof (struct serv_parm); in lpfc_read_sparam()
629 mb->un.varRdSparm.un.sp64.addrHigh = putPaddrHigh(mp->phys); in lpfc_read_sparam()
630 mb->un.varRdSparm.un.sp64.addrLow = putPaddrLow(mp->phys); in lpfc_read_sparam()
631 if (phba->sli_rev >= LPFC_SLI_REV3) in lpfc_read_sparam()
632 mb->un.varRdSparm.vpi = phba->vpi_ids[vpi]; in lpfc_read_sparam()
635 pmb->ctx_buf = mp; in lpfc_read_sparam()
641 * lpfc_unreg_did - Prepare a mailbox command for unregistering DID
645 * @pmb: pointer to the driver internal queue element for mailbox command.
647 * The unregister DID mailbox command is used to unregister an N_Port/F_Port
652 * This routine prepares the mailbox command for unregistering a remote
661 mb = &pmb->u.mb; in lpfc_unreg_did()
664 mb->un.varUnregDID.did = did; in lpfc_unreg_did()
665 mb->un.varUnregDID.vpi = vpi; in lpfc_unreg_did()
667 (phba->sli_rev == LPFC_SLI_REV4)) in lpfc_unreg_did()
668 mb->un.varUnregDID.vpi = phba->vpi_ids[vpi]; in lpfc_unreg_did()
670 mb->mbxCommand = MBX_UNREG_D_ID; in lpfc_unreg_did()
671 mb->mbxOwner = OWN_HOST; in lpfc_unreg_did()
676 * lpfc_read_config - Prepare a mailbox command for reading HBA configuration
678 * @pmb: pointer to the driver internal queue element for mailbox command.
680 * The read configuration mailbox command is used to read the HBA port
681 * configuration parameters. This mailbox command provides a method for
683 * mailbox commands.
685 * This routine prepares the mailbox command for reading out HBA configuration
693 mb = &pmb->u.mb; in lpfc_read_config()
696 mb->mbxCommand = MBX_READ_CONFIG; in lpfc_read_config()
697 mb->mbxOwner = OWN_HOST; in lpfc_read_config()
702 * lpfc_read_lnk_stat - Prepare a mailbox command for reading HBA link stats
704 * @pmb: pointer to the driver internal queue element for mailbox command.
706 * The read link status mailbox command is used to read the link status from
707 * the HBA. Link status includes all link-related error counters. These
711 * This routine prepares the mailbox command for reading out HBA link status.
718 mb = &pmb->u.mb; in lpfc_read_lnk_stat()
721 mb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_read_lnk_stat()
722 mb->mbxOwner = OWN_HOST; in lpfc_read_lnk_stat()
727 * lpfc_reg_rpi - Prepare a mailbox command for registering remote login
732 * @pmb: pointer to the driver internal queue element for mailbox command.
735 * The registration login mailbox command is used to register an N_Port or
737 * service parameters internally and thereby make the appropriate FC-2
742 * This routine prepares the mailbox command for registering remote port login.
744 * HBA with the mailbox command.
747 * 0 - Success
748 * 1 - DMA memory allocation failed
754 MAILBOX_t *mb = &pmb->u.mb; in lpfc_reg_rpi()
760 mb->un.varRegLogin.rpi = 0; in lpfc_reg_rpi()
761 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_reg_rpi()
762 mb->un.varRegLogin.rpi = phba->sli4_hba.rpi_ids[rpi]; in lpfc_reg_rpi()
763 if (phba->sli_rev >= LPFC_SLI_REV3) in lpfc_reg_rpi()
764 mb->un.varRegLogin.vpi = phba->vpi_ids[vpi]; in lpfc_reg_rpi()
765 mb->un.varRegLogin.did = did; in lpfc_reg_rpi()
766 mb->mbxOwner = OWN_HOST; in lpfc_reg_rpi()
770 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_reg_rpi()
771 if (!mp || !mp->virt) { in lpfc_reg_rpi()
773 mb->mbxCommand = MBX_REG_LOGIN64; in lpfc_reg_rpi()
780 INIT_LIST_HEAD(&mp->list); in lpfc_reg_rpi()
781 sparam = mp->virt; in lpfc_reg_rpi()
787 pmb->ctx_buf = (uint8_t *)mp; in lpfc_reg_rpi()
789 mb->mbxCommand = MBX_REG_LOGIN64; in lpfc_reg_rpi()
790 mb->un.varRegLogin.un.sp64.tus.f.bdeSize = sizeof (struct serv_parm); in lpfc_reg_rpi()
791 mb->un.varRegLogin.un.sp64.addrHigh = putPaddrHigh(mp->phys); in lpfc_reg_rpi()
792 mb->un.varRegLogin.un.sp64.addrLow = putPaddrLow(mp->phys); in lpfc_reg_rpi()
798 * lpfc_unreg_login - Prepare a mailbox command for unregistering remote login
802 * @pmb: pointer to the driver internal queue element for mailbox command.
804 * The unregistration login mailbox command is used to unregister an N_Port
808 * This routine prepares the mailbox command for unregistering remote port
820 mb = &pmb->u.mb; in lpfc_unreg_login()
823 mb->un.varUnregLogin.rpi = rpi; in lpfc_unreg_login()
824 mb->un.varUnregLogin.rsvd1 = 0; in lpfc_unreg_login()
825 if (phba->sli_rev >= LPFC_SLI_REV3) in lpfc_unreg_login()
826 mb->un.varUnregLogin.vpi = phba->vpi_ids[vpi]; in lpfc_unreg_login()
828 mb->mbxCommand = MBX_UNREG_LOGIN; in lpfc_unreg_login()
829 mb->mbxOwner = OWN_HOST; in lpfc_unreg_login()
835 * lpfc_sli4_unreg_all_rpis - unregister all RPIs for a vport on SLI4 HBA.
838 * This routine sends mailbox command to unregister all active RPIs for
844 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_unreg_all_rpis()
848 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_sli4_unreg_all_rpis()
857 lpfc_unreg_login(phba, vport->vpi, phba->vpi_ids[vport->vpi], in lpfc_sli4_unreg_all_rpis()
859 mbox->u.mb.un.varUnregLogin.rsvd1 = 0x4000; in lpfc_sli4_unreg_all_rpis()
860 mbox->vport = vport; in lpfc_sli4_unreg_all_rpis()
861 mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; in lpfc_sli4_unreg_all_rpis()
862 mbox->ctx_ndlp = NULL; in lpfc_sli4_unreg_all_rpis()
865 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_unreg_all_rpis()
870 * lpfc_reg_vpi - Prepare a mailbox command for registering vport identifier
872 * @pmb: pointer to the driver internal queue element for mailbox command.
874 * The registration vport identifier mailbox command is used to activate a
880 * This routine prepares the mailbox command for registering a virtual N_Port.
885 MAILBOX_t *mb = &pmb->u.mb; in lpfc_reg_vpi()
886 struct lpfc_hba *phba = vport->phba; in lpfc_reg_vpi()
890 * Set the re-reg VPI bit for f/w to update the MAC address. in lpfc_reg_vpi()
892 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_reg_vpi()
893 !(vport->fc_flag & FC_VPORT_NEEDS_REG_VPI)) in lpfc_reg_vpi()
894 mb->un.varRegVpi.upd = 1; in lpfc_reg_vpi()
896 mb->un.varRegVpi.vpi = phba->vpi_ids[vport->vpi]; in lpfc_reg_vpi()
897 mb->un.varRegVpi.sid = vport->fc_myDID; in lpfc_reg_vpi()
898 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_reg_vpi()
899 mb->un.varRegVpi.vfi = phba->sli4_hba.vfi_ids[vport->vfi]; in lpfc_reg_vpi()
901 mb->un.varRegVpi.vfi = vport->vfi + vport->phba->vfi_base; in lpfc_reg_vpi()
902 memcpy(mb->un.varRegVpi.wwn, &vport->fc_portname, in lpfc_reg_vpi()
904 mb->un.varRegVpi.wwn[0] = cpu_to_le32(mb->un.varRegVpi.wwn[0]); in lpfc_reg_vpi()
905 mb->un.varRegVpi.wwn[1] = cpu_to_le32(mb->un.varRegVpi.wwn[1]); in lpfc_reg_vpi()
907 mb->mbxCommand = MBX_REG_VPI; in lpfc_reg_vpi()
908 mb->mbxOwner = OWN_HOST; in lpfc_reg_vpi()
914 * lpfc_unreg_vpi - Prepare a mailbox command for unregistering vport id
917 * @pmb: pointer to the driver internal queue element for mailbox command.
919 * The unregistration vport identifier mailbox command is used to inactivate
923 * any active exchanges. The HBA will post the mailbox response after making
926 * This routine prepares the mailbox command for unregistering a virtual
932 MAILBOX_t *mb = &pmb->u.mb; in lpfc_unreg_vpi()
935 if (phba->sli_rev == LPFC_SLI_REV3) in lpfc_unreg_vpi()
936 mb->un.varUnregVpi.vpi = phba->vpi_ids[vpi]; in lpfc_unreg_vpi()
937 else if (phba->sli_rev >= LPFC_SLI_REV4) in lpfc_unreg_vpi()
938 mb->un.varUnregVpi.sli4_vpi = phba->vpi_ids[vpi]; in lpfc_unreg_vpi()
940 mb->mbxCommand = MBX_UNREG_VPI; in lpfc_unreg_vpi()
941 mb->mbxOwner = OWN_HOST; in lpfc_unreg_vpi()
947 * lpfc_config_pcb_setup - Set up IOCB rings in the Port Control Block (PCB)
956 struct lpfc_sli *psli = &phba->sli; in lpfc_config_pcb_setup()
958 PCB_t *pcbp = phba->pcb; in lpfc_config_pcb_setup()
964 pcbp->maxRing = (psli->num_rings - 1); in lpfc_config_pcb_setup()
966 for (i = 0; i < psli->num_rings; i++) { in lpfc_config_pcb_setup()
967 pring = &psli->sli3_ring[i]; in lpfc_config_pcb_setup()
969 pring->sli.sli3.sizeCiocb = in lpfc_config_pcb_setup()
970 phba->sli_rev == 3 ? SLI3_IOCB_CMD_SIZE : in lpfc_config_pcb_setup()
972 pring->sli.sli3.sizeRiocb = in lpfc_config_pcb_setup()
973 phba->sli_rev == 3 ? SLI3_IOCB_RSP_SIZE : in lpfc_config_pcb_setup()
977 if ((pring->sli.sli3.numCiocb == 0) || in lpfc_config_pcb_setup()
978 (pring->sli.sli3.numRiocb == 0)) { in lpfc_config_pcb_setup()
979 pcbp->rdsc[i].cmdEntries = 0; in lpfc_config_pcb_setup()
980 pcbp->rdsc[i].rspEntries = 0; in lpfc_config_pcb_setup()
981 pcbp->rdsc[i].cmdAddrHigh = 0; in lpfc_config_pcb_setup()
982 pcbp->rdsc[i].rspAddrHigh = 0; in lpfc_config_pcb_setup()
983 pcbp->rdsc[i].cmdAddrLow = 0; in lpfc_config_pcb_setup()
984 pcbp->rdsc[i].rspAddrLow = 0; in lpfc_config_pcb_setup()
985 pring->sli.sli3.cmdringaddr = NULL; in lpfc_config_pcb_setup()
986 pring->sli.sli3.rspringaddr = NULL; in lpfc_config_pcb_setup()
990 pring->sli.sli3.cmdringaddr = (void *)&phba->IOCBs[iocbCnt]; in lpfc_config_pcb_setup()
991 pcbp->rdsc[i].cmdEntries = pring->sli.sli3.numCiocb; in lpfc_config_pcb_setup()
993 offset = (uint8_t *) &phba->IOCBs[iocbCnt] - in lpfc_config_pcb_setup()
994 (uint8_t *) phba->slim2p.virt; in lpfc_config_pcb_setup()
995 pdma_addr = phba->slim2p.phys + offset; in lpfc_config_pcb_setup()
996 pcbp->rdsc[i].cmdAddrHigh = putPaddrHigh(pdma_addr); in lpfc_config_pcb_setup()
997 pcbp->rdsc[i].cmdAddrLow = putPaddrLow(pdma_addr); in lpfc_config_pcb_setup()
998 iocbCnt += pring->sli.sli3.numCiocb; in lpfc_config_pcb_setup()
1001 pring->sli.sli3.rspringaddr = (void *) &phba->IOCBs[iocbCnt]; in lpfc_config_pcb_setup()
1003 pcbp->rdsc[i].rspEntries = pring->sli.sli3.numRiocb; in lpfc_config_pcb_setup()
1004 offset = (uint8_t *)&phba->IOCBs[iocbCnt] - in lpfc_config_pcb_setup()
1005 (uint8_t *)phba->slim2p.virt; in lpfc_config_pcb_setup()
1006 pdma_addr = phba->slim2p.phys + offset; in lpfc_config_pcb_setup()
1007 pcbp->rdsc[i].rspAddrHigh = putPaddrHigh(pdma_addr); in lpfc_config_pcb_setup()
1008 pcbp->rdsc[i].rspAddrLow = putPaddrLow(pdma_addr); in lpfc_config_pcb_setup()
1009 iocbCnt += pring->sli.sli3.numRiocb; in lpfc_config_pcb_setup()
1014 * lpfc_read_rev - Prepare a mailbox command for reading HBA revision
1016 * @pmb: pointer to the driver internal queue element for mailbox command.
1018 * The read revision mailbox command is used to read the revision levels of
1020 * firmware, and available firmware. HBAs that supports SLI-3 mode of
1024 * This routine prepares the mailbox command for reading HBA revision
1030 MAILBOX_t *mb = &pmb->u.mb; in lpfc_read_rev()
1032 mb->un.varRdRev.cv = 1; in lpfc_read_rev()
1033 mb->un.varRdRev.v3req = 1; /* Request SLI3 info */ in lpfc_read_rev()
1034 mb->mbxCommand = MBX_READ_REV; in lpfc_read_rev()
1035 mb->mbxOwner = OWN_HOST; in lpfc_read_rev()
1042 MAILBOX_t *mb = &pmb->u.mb; in lpfc_sli4_swap_str()
1045 switch (mb->mbxCommand) { in lpfc_sli4_swap_str()
1047 mqe = &pmb->u.mqe; in lpfc_sli4_swap_str()
1048 lpfc_sli_pcimem_bcopy(mqe->un.read_rev.fw_name, in lpfc_sli4_swap_str()
1049 mqe->un.read_rev.fw_name, 16); in lpfc_sli4_swap_str()
1050 lpfc_sli_pcimem_bcopy(mqe->un.read_rev.ulp_fw_name, in lpfc_sli4_swap_str()
1051 mqe->un.read_rev.ulp_fw_name, 16); in lpfc_sli4_swap_str()
1060 * lpfc_build_hbq_profile2 - Set up the HBQ Selection Profile 2
1061 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
1073 hbqmb->profiles.profile2.seqlenbcnt = hbq_desc->seqlenbcnt; in lpfc_build_hbq_profile2()
1074 hbqmb->profiles.profile2.maxlen = hbq_desc->maxlen; in lpfc_build_hbq_profile2()
1075 hbqmb->profiles.profile2.seqlenoff = hbq_desc->seqlenoff; in lpfc_build_hbq_profile2()
1079 * lpfc_build_hbq_profile3 - Set up the HBQ Selection Profile 3
1080 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
1092 hbqmb->profiles.profile3.seqlenbcnt = hbq_desc->seqlenbcnt; in lpfc_build_hbq_profile3()
1093 hbqmb->profiles.profile3.maxlen = hbq_desc->maxlen; in lpfc_build_hbq_profile3()
1094 hbqmb->profiles.profile3.cmdcodeoff = hbq_desc->cmdcodeoff; in lpfc_build_hbq_profile3()
1095 hbqmb->profiles.profile3.seqlenoff = hbq_desc->seqlenoff; in lpfc_build_hbq_profile3()
1096 memcpy(&hbqmb->profiles.profile3.cmdmatch, hbq_desc->cmdmatch, in lpfc_build_hbq_profile3()
1097 sizeof(hbqmb->profiles.profile3.cmdmatch)); in lpfc_build_hbq_profile3()
1101 * lpfc_build_hbq_profile5 - Set up the HBQ Selection Profile 5
1102 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
1115 hbqmb->profiles.profile5.seqlenbcnt = hbq_desc->seqlenbcnt; in lpfc_build_hbq_profile5()
1116 hbqmb->profiles.profile5.maxlen = hbq_desc->maxlen; in lpfc_build_hbq_profile5()
1117 hbqmb->profiles.profile5.cmdcodeoff = hbq_desc->cmdcodeoff; in lpfc_build_hbq_profile5()
1118 hbqmb->profiles.profile5.seqlenoff = hbq_desc->seqlenoff; in lpfc_build_hbq_profile5()
1119 memcpy(&hbqmb->profiles.profile5.cmdmatch, hbq_desc->cmdmatch, in lpfc_build_hbq_profile5()
1120 sizeof(hbqmb->profiles.profile5.cmdmatch)); in lpfc_build_hbq_profile5()
1124 * lpfc_config_hbq - Prepare a mailbox command for configuring an HBQ
1129 * @pmb: pointer to the driver internal queue element for mailbox command.
1131 * The configure HBQ (Host Buffer Queue) mailbox command is used to configure
1135 * This routine prepares the mailbox command for configuring an HBQ.
1143 MAILBOX_t *mb = &pmb->u.mb; in lpfc_config_hbq()
1144 struct config_hbq_var *hbqmb = &mb->un.varCfgHbq; in lpfc_config_hbq()
1147 hbqmb->hbqId = id; in lpfc_config_hbq()
1148 hbqmb->entry_count = hbq_desc->entry_count; /* # entries in HBQ */ in lpfc_config_hbq()
1149 hbqmb->recvNotify = hbq_desc->rn; /* Receive in lpfc_config_hbq()
1151 hbqmb->numMask = hbq_desc->mask_count; /* # R_CTL/TYPE masks in lpfc_config_hbq()
1152 * # in words 0-19 */ in lpfc_config_hbq()
1153 hbqmb->profile = hbq_desc->profile; /* Selection profile: in lpfc_config_hbq()
1156 hbqmb->ringMask = hbq_desc->ring_mask; /* Binds HBQ to a ring in lpfc_config_hbq()
1159 hbqmb->headerLen = hbq_desc->headerLen; /* 0 if not profile 4 in lpfc_config_hbq()
1161 hbqmb->logEntry = hbq_desc->logEntry; /* Set to 1 if this in lpfc_config_hbq()
1165 hbqmb->hbqaddrLow = putPaddrLow(phba->hbqslimp.phys) + in lpfc_config_hbq()
1167 hbqmb->hbqaddrHigh = putPaddrHigh(phba->hbqslimp.phys); in lpfc_config_hbq()
1169 mb->mbxCommand = MBX_CONFIG_HBQ; in lpfc_config_hbq()
1170 mb->mbxOwner = OWN_HOST; in lpfc_config_hbq()
1175 if (hbq_desc->profile == 2) in lpfc_config_hbq()
1177 else if (hbq_desc->profile == 3) in lpfc_config_hbq()
1179 else if (hbq_desc->profile == 5) in lpfc_config_hbq()
1183 if (!hbq_desc->mask_count) in lpfc_config_hbq()
1187 for (i = 0; i < hbq_desc->mask_count; i++) { in lpfc_config_hbq()
1188 hbqmb->hbqMasks[i].tmatch = hbq_desc->hbqMasks[i].tmatch; in lpfc_config_hbq()
1189 hbqmb->hbqMasks[i].tmask = hbq_desc->hbqMasks[i].tmask; in lpfc_config_hbq()
1190 hbqmb->hbqMasks[i].rctlmatch = hbq_desc->hbqMasks[i].rctlmatch; in lpfc_config_hbq()
1191 hbqmb->hbqMasks[i].rctlmask = hbq_desc->hbqMasks[i].rctlmask; in lpfc_config_hbq()
1198 * lpfc_config_ring - Prepare a mailbox command for configuring an IOCB ring
1201 * @pmb: pointer to the driver internal queue element for mailbox command.
1203 * The configure ring mailbox command is used to configure an IOCB ring. This
1212 * This routine prepares the mailbox command for configuring IOCB ring.
1218 MAILBOX_t *mb = &pmb->u.mb; in lpfc_config_ring()
1224 mb->un.varCfgRing.ring = ring; in lpfc_config_ring()
1225 mb->un.varCfgRing.maxOrigXchg = 0; in lpfc_config_ring()
1226 mb->un.varCfgRing.maxRespXchg = 0; in lpfc_config_ring()
1227 mb->un.varCfgRing.recvNotify = 1; in lpfc_config_ring()
1229 psli = &phba->sli; in lpfc_config_ring()
1230 pring = &psli->sli3_ring[ring]; in lpfc_config_ring()
1231 mb->un.varCfgRing.numMask = pring->num_mask; in lpfc_config_ring()
1232 mb->mbxCommand = MBX_CONFIG_RING; in lpfc_config_ring()
1233 mb->mbxOwner = OWN_HOST; in lpfc_config_ring()
1236 if (pring->prt[0].profile) { in lpfc_config_ring()
1237 mb->un.varCfgRing.profile = pring->prt[0].profile; in lpfc_config_ring()
1242 for (i = 0; i < pring->num_mask; i++) { in lpfc_config_ring()
1243 mb->un.varCfgRing.rrRegs[i].rval = pring->prt[i].rctl; in lpfc_config_ring()
1244 if (mb->un.varCfgRing.rrRegs[i].rval != FC_RCTL_ELS_REQ) in lpfc_config_ring()
1245 mb->un.varCfgRing.rrRegs[i].rmask = 0xff; in lpfc_config_ring()
1247 mb->un.varCfgRing.rrRegs[i].rmask = 0xfe; in lpfc_config_ring()
1248 mb->un.varCfgRing.rrRegs[i].tval = pring->prt[i].type; in lpfc_config_ring()
1249 mb->un.varCfgRing.rrRegs[i].tmask = 0xff; in lpfc_config_ring()
1256 * lpfc_config_port - Prepare a mailbox command for configuring port
1258 * @pmb: pointer to the driver internal queue element for mailbox command.
1260 * The configure port mailbox command is used to identify the Port Control
1262 * driver must not access the mailbox in the HBA without first resetting
1267 * This routine prepares the mailbox command for configuring port.
1272 MAILBOX_t __iomem *mb_slim = (MAILBOX_t __iomem *) phba->MBslimaddr; in lpfc_config_port()
1273 MAILBOX_t *mb = &pmb->u.mb; in lpfc_config_port()
1282 mb->mbxCommand = MBX_CONFIG_PORT; in lpfc_config_port()
1283 mb->mbxOwner = OWN_HOST; in lpfc_config_port()
1285 mb->un.varCfgPort.pcbLen = sizeof(PCB_t); in lpfc_config_port()
1287 offset = (uint8_t *)phba->pcb - (uint8_t *)phba->slim2p.virt; in lpfc_config_port()
1288 pdma_addr = phba->slim2p.phys + offset; in lpfc_config_port()
1289 mb->un.varCfgPort.pcbLow = putPaddrLow(pdma_addr); in lpfc_config_port()
1290 mb->un.varCfgPort.pcbHigh = putPaddrHigh(pdma_addr); in lpfc_config_port()
1293 mb->un.varCfgPort.hps = 1; in lpfc_config_port()
1297 if (phba->sli_rev == LPFC_SLI_REV3 && phba->vpd.sli3Feat.cerbm) { in lpfc_config_port()
1298 if (phba->cfg_enable_bg) in lpfc_config_port()
1299 mb->un.varCfgPort.cbg = 1; /* configure BlockGuard */ in lpfc_config_port()
1300 mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ in lpfc_config_port()
1301 mb->un.varCfgPort.ccrp = 1; /* Command Ring Polling */ in lpfc_config_port()
1302 mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count(); in lpfc_config_port()
1303 if (phba->max_vpi && phba->cfg_enable_npiv && in lpfc_config_port()
1304 phba->vpd.sli3Feat.cmv) { in lpfc_config_port()
1305 mb->un.varCfgPort.max_vpi = LPFC_MAX_VPI; in lpfc_config_port()
1306 mb->un.varCfgPort.cmv = 1; in lpfc_config_port()
1308 mb->un.varCfgPort.max_vpi = phba->max_vpi = 0; in lpfc_config_port()
1310 phba->sli_rev = LPFC_SLI_REV2; in lpfc_config_port()
1311 mb->un.varCfgPort.sli_mode = phba->sli_rev; in lpfc_config_port()
1314 if (phba->sli_rev == LPFC_SLI_REV3) in lpfc_config_port()
1315 mb->un.varCfgPort.casabt = 1; in lpfc_config_port()
1318 phba->pcb->type = TYPE_NATIVE_SLI2; in lpfc_config_port()
1319 phba->pcb->feature = FEATURE_INITIAL_SLI2; in lpfc_config_port()
1321 /* Setup Mailbox pointers */ in lpfc_config_port()
1322 phba->pcb->mailBoxSize = sizeof(MAILBOX_t) + MAILBOX_EXT_SIZE; in lpfc_config_port()
1323 offset = (uint8_t *)phba->mbox - (uint8_t *)phba->slim2p.virt; in lpfc_config_port()
1324 pdma_addr = phba->slim2p.phys + offset; in lpfc_config_port()
1325 phba->pcb->mbAddrHigh = putPaddrHigh(pdma_addr); in lpfc_config_port()
1326 phba->pcb->mbAddrLow = putPaddrLow(pdma_addr); in lpfc_config_port()
1347 pci_read_config_dword(phba->pcidev, PCI_BASE_ADDRESS_0, &bar_low); in lpfc_config_port()
1348 pci_read_config_dword(phba->pcidev, PCI_BASE_ADDRESS_1, &bar_high); in lpfc_config_port()
1351 * Set up HGP - Port Memory in lpfc_config_port()
1354 * following the "non-diagnostic" mode mailbox (32 words, 0x80 bytes) in lpfc_config_port()
1355 * area of SLIM. In SLI-2 mode, there's an additional 16 reserved in lpfc_config_port()
1357 * configured in SLI-3. in lpfc_config_port()
1359 * CR0Put - SLI2(no HBQs) = 0xc0, With HBQs = 0x80 in lpfc_config_port()
1368 * Reserved 0xa0-0xbf in lpfc_config_port()
1374 * HBQ(M-1)Put Pointer 0xc0+(M-1)*4 in lpfc_config_port()
1378 if (phba->cfg_hostmem_hgp && phba->sli_rev != 3) { in lpfc_config_port()
1379 phba->host_gp = (struct lpfc_hgp __iomem *) in lpfc_config_port()
1380 &phba->mbox->us.s2.host[0]; in lpfc_config_port()
1381 phba->hbq_put = NULL; in lpfc_config_port()
1382 offset = (uint8_t *)&phba->mbox->us.s2.host - in lpfc_config_port()
1383 (uint8_t *)phba->slim2p.virt; in lpfc_config_port()
1384 pdma_addr = phba->slim2p.phys + offset; in lpfc_config_port()
1385 phba->pcb->hgpAddrHigh = putPaddrHigh(pdma_addr); in lpfc_config_port()
1386 phba->pcb->hgpAddrLow = putPaddrLow(pdma_addr); in lpfc_config_port()
1389 mb->un.varCfgPort.hps = 1; in lpfc_config_port()
1391 if (phba->sli_rev == 3) { in lpfc_config_port()
1392 phba->host_gp = &mb_slim->us.s3.host[0]; in lpfc_config_port()
1393 phba->hbq_put = &mb_slim->us.s3.hbq_put[0]; in lpfc_config_port()
1395 phba->host_gp = &mb_slim->us.s2.host[0]; in lpfc_config_port()
1396 phba->hbq_put = NULL; in lpfc_config_port()
1399 /* mask off BAR0's flag bits 0 - 3 */ in lpfc_config_port()
1400 phba->pcb->hgpAddrLow = (bar_low & PCI_BASE_ADDRESS_MEM_MASK) + in lpfc_config_port()
1401 (void __iomem *)phba->host_gp - in lpfc_config_port()
1402 (void __iomem *)phba->MBslimaddr; in lpfc_config_port()
1404 phba->pcb->hgpAddrHigh = bar_high; in lpfc_config_port()
1406 phba->pcb->hgpAddrHigh = 0; in lpfc_config_port()
1410 for (i = 0; i < phba->sli.num_rings; i++) { in lpfc_config_port()
1411 lpfc_memcpy_to_slim(phba->host_gp + i, &hgp, in lpfc_config_port()
1412 sizeof(*phba->host_gp)); in lpfc_config_port()
1417 if (phba->sli_rev == 3) in lpfc_config_port()
1422 pdma_addr = phba->slim2p.phys + pgp_offset; in lpfc_config_port()
1423 phba->pcb->pgpAddrHigh = putPaddrHigh(pdma_addr); in lpfc_config_port()
1424 phba->pcb->pgpAddrLow = putPaddrLow(pdma_addr); in lpfc_config_port()
1430 if (lpfc_is_LC_HBA(phba->pcidev->device)) { in lpfc_config_port()
1435 memcpy(&mb->un.varCfgPort.hbainit, hbainit, 20); in lpfc_config_port()
1439 lpfc_sli_pcimem_bcopy(phba->pcb, phba->pcb, sizeof(PCB_t)); in lpfc_config_port()
1443 * lpfc_kill_board - Prepare a mailbox command for killing board
1445 * @pmb: pointer to the driver internal queue element for mailbox command.
1447 * The kill board mailbox command is used to tell firmware to perform a
1449 * When the kill board mailbox command is received, the ER3 bit is set to 1
1454 * This routine prepares the mailbox command for killing the board in
1460 MAILBOX_t *mb = &pmb->u.mb; in lpfc_kill_board()
1463 mb->mbxCommand = MBX_KILL_BOARD; in lpfc_kill_board()
1464 mb->mbxOwner = OWN_HOST; in lpfc_kill_board()
1469 * lpfc_mbox_put - Put a mailbox cmd into the tail of driver's mailbox queue
1471 * @mbq: pointer to the driver internal queue element for mailbox command.
1473 * Driver maintains a internal mailbox command queue implemented as a linked
1474 * list. When a mailbox command is issued, it shall be put into the mailbox
1476 * one mailbox command at a time.
1483 psli = &phba->sli; in lpfc_mbox_put()
1485 list_add_tail(&mbq->list, &psli->mboxq); in lpfc_mbox_put()
1487 psli->mboxq_cnt++; in lpfc_mbox_put()
1493 * lpfc_mbox_get - Remove a mailbox cmd from the head of driver's mailbox queue
1496 * Driver maintains a internal mailbox command queue implemented as a linked
1497 * list. When a mailbox command is issued, it shall be put into the mailbox
1499 * one mailbox command at a time. After HBA finished processing a mailbox
1500 * command, the driver will remove a pending mailbox command from the head of
1501 * the mailbox command queue and send to the HBA for processing.
1504 * pointer to the driver internal queue element for mailbox command.
1510 struct lpfc_sli *psli = &phba->sli; in lpfc_mbox_get()
1512 list_remove_head((&psli->mboxq), mbq, LPFC_MBOXQ_t, list); in lpfc_mbox_get()
1514 psli->mboxq_cnt--; in lpfc_mbox_get()
1520 * __lpfc_mbox_cmpl_put - Put mailbox cmd into mailbox cmd complete list
1522 * @mbq: pointer to the driver internal queue element for mailbox command.
1524 * This routine put the completed mailbox command into the mailbox command
1525 * complete list. This is the unlocked version of the routine. The mailbox
1526 * complete list is used by the driver worker thread to process mailbox
1532 list_add_tail(&mbq->list, &phba->sli.mboxq_cmpl); in __lpfc_mbox_cmpl_put()
1536 * lpfc_mbox_cmpl_put - Put mailbox command into mailbox command complete list
1538 * @mbq: pointer to the driver internal queue element for mailbox command.
1540 * This routine put the completed mailbox command into the mailbox command
1541 * complete list. This is the locked version of the routine. The mailbox
1542 * complete list is used by the driver worker thread to process mailbox
1551 spin_lock_irqsave(&phba->hbalock, iflag); in lpfc_mbox_cmpl_put()
1553 spin_unlock_irqrestore(&phba->hbalock, iflag); in lpfc_mbox_cmpl_put()
1558 * lpfc_mbox_cmd_check - Check the validality of a mailbox command
1560 * @mboxq: pointer to the driver internal queue element for mailbox command.
1562 * This routine is to check whether a mailbox command is valid to be issued.
1563 * This check will be performed by both the mailbox issue API when a client
1564 * is to issue a mailbox command to the mailbox transport.
1566 * Return 0 - pass the check, -ENODEV - fail the check
1571 /* Mailbox command that have a completion handler must also have a in lpfc_mbox_cmd_check()
1574 if (mboxq->mbox_cmpl && mboxq->mbox_cmpl != lpfc_sli_def_mbox_cmpl && in lpfc_mbox_cmd_check()
1575 mboxq->mbox_cmpl != lpfc_sli_wake_mbox_wait) { in lpfc_mbox_cmd_check()
1576 if (!mboxq->vport) { in lpfc_mbox_cmd_check()
1579 mboxq->u.mb.mbxCommand); in lpfc_mbox_cmd_check()
1581 return -ENODEV; in lpfc_mbox_cmd_check()
1588 * lpfc_mbox_dev_check - Check the device state for issuing a mailbox command
1592 * mailbox command. It is used by the mailbox transport API at the time the
1593 * to post a mailbox command to the device.
1595 * Return 0 - pass the check, -ENODEV - fail the check
1601 if (unlikely(pci_channel_offline(phba->pcidev))) in lpfc_mbox_dev_check()
1602 return -ENODEV; in lpfc_mbox_dev_check()
1605 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_mbox_dev_check()
1606 return -ENODEV; in lpfc_mbox_dev_check()
1612 * lpfc_mbox_tmo_val - Retrieve mailbox command timeout value
1614 * @mboxq: pointer to the driver internal queue element for mailbox command.
1616 * This routine retrieves the proper timeout value according to the mailbox
1620 * Timeout value to be used for the given mailbox command
1625 MAILBOX_t *mbox = &mboxq->u.mb; in lpfc_mbox_tmo_val()
1628 switch (mbox->mbxCommand) { in lpfc_mbox_tmo_val()
1675 * lpfc_sli4_mbx_sge_set - Set a sge entry in non-embedded mailbox command
1681 * This routine sets up an entry in the non-embedded mailbox command at the sge
1691 &mbox->u.mqe.un.nembed_cmd; in lpfc_sli4_mbx_sge_set()
1692 nembed_sge->sge[sgentry].pa_lo = putPaddrLow(phyaddr); in lpfc_sli4_mbx_sge_set()
1693 nembed_sge->sge[sgentry].pa_hi = putPaddrHigh(phyaddr); in lpfc_sli4_mbx_sge_set()
1694 nembed_sge->sge[sgentry].length = length; in lpfc_sli4_mbx_sge_set()
1698 * lpfc_sli4_mbx_sge_get - Get a sge entry from non-embedded mailbox command
1701 * @sge: pointer to lpfc mailbox sge to load into.
1703 * This routine gets an entry from the non-embedded mailbox command at the sge
1713 &mbox->u.mqe.un.nembed_cmd; in lpfc_sli4_mbx_sge_get()
1714 sge->pa_lo = nembed_sge->sge[sgentry].pa_lo; in lpfc_sli4_mbx_sge_get()
1715 sge->pa_hi = nembed_sge->sge[sgentry].pa_hi; in lpfc_sli4_mbx_sge_get()
1716 sge->length = nembed_sge->sge[sgentry].length; in lpfc_sli4_mbx_sge_get()
1720 * lpfc_sli4_mbox_cmd_free - Free a sli4 mailbox command
1724 * This routine frees SLI4 specific mailbox command for sending IOCTL command.
1734 sli4_cfg = &mbox->u.mqe.un.sli4_config; in lpfc_sli4_mbox_cmd_free()
1737 if (bf_get(lpfc_mbox_hdr_emb, &sli4_cfg->header.cfg_mhdr)) { in lpfc_sli4_mbox_cmd_free()
1738 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_mbox_cmd_free()
1742 /* For non-embedded mbox command, we need to free the pages first */ in lpfc_sli4_mbox_cmd_free()
1743 sgecount = bf_get(lpfc_mbox_hdr_sge_cnt, &sli4_cfg->header.cfg_mhdr); in lpfc_sli4_mbox_cmd_free()
1745 if (unlikely(!mbox->sge_array)) { in lpfc_sli4_mbox_cmd_free()
1746 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_mbox_cmd_free()
1749 /* Each non-embedded DMA memory was allocated in the length of a page */ in lpfc_sli4_mbox_cmd_free()
1753 dma_free_coherent(&phba->pcidev->dev, SLI4_PAGE_SIZE, in lpfc_sli4_mbox_cmd_free()
1754 mbox->sge_array->addr[sgentry], phyaddr); in lpfc_sli4_mbox_cmd_free()
1757 kfree(mbox->sge_array); in lpfc_sli4_mbox_cmd_free()
1758 /* Finally, free the mailbox command itself */ in lpfc_sli4_mbox_cmd_free()
1759 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_sli4_mbox_cmd_free()
1763 * lpfc_sli4_config - Initialize the SLI4 Config Mailbox command
1766 * @subsystem: The sli4 config sub mailbox subsystem.
1767 * @opcode: The sli4 config sub mailbox command opcode.
1768 * @length: Length of the sli4 config mailbox command (including sub-header).
1771 * This routine sets up the header fields of SLI4 specific mailbox command
1775 * for none embedded mailbox command).
1789 /* Set up SLI4 mailbox command header fields */ in lpfc_sli4_config()
1791 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_SLI4_CONFIG); in lpfc_sli4_config()
1794 sli4_config = &mbox->u.mqe.un.sli4_config; in lpfc_sli4_config()
1799 bf_set(lpfc_mbox_hdr_emb, &sli4_config->header.cfg_mhdr, 1); in lpfc_sli4_config()
1800 sli4_config->header.cfg_mhdr.payload_length = length; in lpfc_sli4_config()
1801 /* Set up sub-header fields following main header */ in lpfc_sli4_config()
1803 &sli4_config->header.cfg_shdr.request, opcode); in lpfc_sli4_config()
1805 &sli4_config->header.cfg_shdr.request, subsystem); in lpfc_sli4_config()
1806 sli4_config->header.cfg_shdr.request.request_length = in lpfc_sli4_config()
1807 length - LPFC_MBX_CMD_HDR_LENGTH; in lpfc_sli4_config()
1811 /* Setup for the non-embedded mbox command */ in lpfc_sli4_config()
1816 mbox->sge_array = kzalloc(sizeof(struct lpfc_mbx_nembed_sge_virt), in lpfc_sli4_config()
1818 if (!mbox->sge_array) { in lpfc_sli4_config()
1820 "2527 Failed to allocate non-embedded SGE " in lpfc_sli4_config()
1830 viraddr = dma_alloc_coherent(&phba->pcidev->dev, in lpfc_sli4_config()
1836 mbox->sge_array->addr[pagen] = viraddr; in lpfc_sli4_config()
1837 /* Keep the first page for later sub-header construction */ in lpfc_sli4_config()
1840 resid_len = length - alloc_len; in lpfc_sli4_config()
1852 /* Set up main header fields in mailbox command */ in lpfc_sli4_config()
1853 sli4_config->header.cfg_mhdr.payload_length = alloc_len; in lpfc_sli4_config()
1854 bf_set(lpfc_mbox_hdr_sge_cnt, &sli4_config->header.cfg_mhdr, pagen); in lpfc_sli4_config()
1856 /* Set up sub-header fields into the first page */ in lpfc_sli4_config()
1858 bf_set(lpfc_mbox_hdr_opcode, &cfg_shdr->request, opcode); in lpfc_sli4_config()
1859 bf_set(lpfc_mbox_hdr_subsystem, &cfg_shdr->request, subsystem); in lpfc_sli4_config()
1860 cfg_shdr->request.request_length = in lpfc_sli4_config()
1861 alloc_len - sizeof(union lpfc_sli4_cfg_shdr); in lpfc_sli4_config()
1863 /* The sub-header is in DMA memory, which needs endian converstion */ in lpfc_sli4_config()
1871 * lpfc_sli4_mbox_rsrc_extent - Initialize the opcode resource extent.
1879 * mailbox commands. It is called after lpfc_sli4_config. The caller must
1880 * pass an allocated mailbox and the attributes required to initialize the
1881 * mailbox correctly.
1895 /* Get the first SGE entry from the non-embedded DMA memory */ in lpfc_sli4_mbox_rsrc_extent()
1896 virtaddr = mbox->sge_array->addr[0]; in lpfc_sli4_mbox_rsrc_extent()
1908 &mbox->u.mqe.un.alloc_rsrc_extents.u.req, in lpfc_sli4_mbox_rsrc_extent()
1914 lpfc_sli_pcimem_bcopy(&n_rsrc_extnt->word4, in lpfc_sli4_mbox_rsrc_extent()
1915 &n_rsrc_extnt->word4, in lpfc_sli4_mbox_rsrc_extent()
1925 &mbox->u.mqe.un.alloc_rsrc_extents.u.req, in lpfc_sli4_mbox_rsrc_extent()
1947 * lpfc_sli_config_mbox_subsys_get - Get subsystem from a sli_config mbox cmd
1951 * This routine gets the subsystem from a SLI4 specific SLI_CONFIG mailbox
1952 * command. If the mailbox command is not MBX_SLI4_CONFIG (0x9B) or if the
1953 * sub-header is not present, subsystem LPFC_MBOX_SUBSYSTEM_NA (0x0) shall
1962 if (mbox->u.mb.mbxCommand != MBX_SLI4_CONFIG) in lpfc_sli_config_mbox_subsys_get()
1964 sli4_cfg = &mbox->u.mqe.un.sli4_config; in lpfc_sli_config_mbox_subsys_get()
1966 /* For embedded mbox command, get opcode from embedded sub-header*/ in lpfc_sli_config_mbox_subsys_get()
1967 if (bf_get(lpfc_mbox_hdr_emb, &sli4_cfg->header.cfg_mhdr)) { in lpfc_sli_config_mbox_subsys_get()
1968 cfg_shdr = &mbox->u.mqe.un.sli4_config.header.cfg_shdr; in lpfc_sli_config_mbox_subsys_get()
1969 return bf_get(lpfc_mbox_hdr_subsystem, &cfg_shdr->request); in lpfc_sli_config_mbox_subsys_get()
1972 /* For non-embedded mbox command, get opcode from first dma page */ in lpfc_sli_config_mbox_subsys_get()
1973 if (unlikely(!mbox->sge_array)) in lpfc_sli_config_mbox_subsys_get()
1975 cfg_shdr = (union lpfc_sli4_cfg_shdr *)mbox->sge_array->addr[0]; in lpfc_sli_config_mbox_subsys_get()
1976 return bf_get(lpfc_mbox_hdr_subsystem, &cfg_shdr->request); in lpfc_sli_config_mbox_subsys_get()
1980 * lpfc_sli_config_mbox_opcode_get - Get opcode from a sli_config mbox cmd
1984 * This routine gets the opcode from a SLI4 specific SLI_CONFIG mailbox
1985 * command. If the mailbox command is not MBX_SLI4_CONFIG (0x9B) or if
1986 * the sub-header is not present, opcode LPFC_MBOX_OPCODE_NA (0x0) be
1995 if (mbox->u.mb.mbxCommand != MBX_SLI4_CONFIG) in lpfc_sli_config_mbox_opcode_get()
1997 sli4_cfg = &mbox->u.mqe.un.sli4_config; in lpfc_sli_config_mbox_opcode_get()
1999 /* For embedded mbox command, get opcode from embedded sub-header*/ in lpfc_sli_config_mbox_opcode_get()
2000 if (bf_get(lpfc_mbox_hdr_emb, &sli4_cfg->header.cfg_mhdr)) { in lpfc_sli_config_mbox_opcode_get()
2001 cfg_shdr = &mbox->u.mqe.un.sli4_config.header.cfg_shdr; in lpfc_sli_config_mbox_opcode_get()
2002 return bf_get(lpfc_mbox_hdr_opcode, &cfg_shdr->request); in lpfc_sli_config_mbox_opcode_get()
2005 /* For non-embedded mbox command, get opcode from first dma page */ in lpfc_sli_config_mbox_opcode_get()
2006 if (unlikely(!mbox->sge_array)) in lpfc_sli_config_mbox_opcode_get()
2008 cfg_shdr = (union lpfc_sli4_cfg_shdr *)mbox->sge_array->addr[0]; in lpfc_sli_config_mbox_opcode_get()
2009 return bf_get(lpfc_mbox_hdr_opcode, &cfg_shdr->request); in lpfc_sli_config_mbox_opcode_get()
2013 * lpfc_sli4_mbx_read_fcf_rec - Allocate and construct read fcf mbox cmd
2018 * This routine routine allocates and constructs non-embedded mailbox command
2021 * Return: pointer to the mailbox command constructed if successful, otherwise
2036 return -ENOMEM; in lpfc_sli4_mbx_read_fcf_rec()
2041 /* Set up READ_FCF SLI4_CONFIG mailbox-ioctl command */ in lpfc_sli4_mbx_read_fcf_rec()
2051 return -ENOMEM; in lpfc_sli4_mbx_read_fcf_rec()
2054 /* Get the first SGE entry from the non-embedded DMA memory. This in lpfc_sli4_mbx_read_fcf_rec()
2058 virt_addr = mboxq->sge_array->addr[0]; in lpfc_sli4_mbx_read_fcf_rec()
2062 bf_set(lpfc_mbx_read_fcf_tbl_indx, &read_fcf->u.request, fcf_index); in lpfc_sli4_mbx_read_fcf_rec()
2071 * lpfc_request_features: Configure SLI4 REQUEST_FEATURES mailbox
2075 * This routine sets up the mailbox for an SLI4 REQUEST_FEATURES
2076 * mailbox command.
2081 /* Set up SLI4 mailbox command header fields */ in lpfc_request_features()
2083 bf_set(lpfc_mqe_command, &mboxq->u.mqe, MBX_SLI4_REQ_FTRS); in lpfc_request_features()
2086 bf_set(lpfc_mbx_rq_ftr_rq_fcpi, &mboxq->u.mqe.un.req_ftrs, 1); in lpfc_request_features()
2087 bf_set(lpfc_mbx_rq_ftr_rq_perfh, &mboxq->u.mqe.un.req_ftrs, 1); in lpfc_request_features()
2090 if (phba->cfg_enable_bg) in lpfc_request_features()
2091 bf_set(lpfc_mbx_rq_ftr_rq_dif, &mboxq->u.mqe.un.req_ftrs, 1); in lpfc_request_features()
2094 if (phba->max_vpi && phba->cfg_enable_npiv) in lpfc_request_features()
2095 bf_set(lpfc_mbx_rq_ftr_rq_npiv, &mboxq->u.mqe.un.req_ftrs, 1); in lpfc_request_features()
2097 if (phba->nvmet_support) { in lpfc_request_features()
2098 bf_set(lpfc_mbx_rq_ftr_rq_mrqp, &mboxq->u.mqe.un.req_ftrs, 1); in lpfc_request_features()
2100 bf_set(lpfc_mbx_rq_ftr_rq_iaab, &mboxq->u.mqe.un.req_ftrs, 0); in lpfc_request_features()
2101 bf_set(lpfc_mbx_rq_ftr_rq_iaar, &mboxq->u.mqe.un.req_ftrs, 0); in lpfc_request_features()
2107 * lpfc_init_vfi - Initialize the INIT_VFI mailbox command
2111 * This routine initializes @mbox to all zeros and then fills in the mailbox
2123 mbox->vport = vport; in lpfc_init_vfi()
2124 init_vfi = &mbox->u.mqe.un.init_vfi; in lpfc_init_vfi()
2125 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VFI); in lpfc_init_vfi()
2130 vport->phba->sli4_hba.vfi_ids[vport->vfi]); in lpfc_init_vfi()
2132 vport->phba->vpi_ids[vport->vpi]); in lpfc_init_vfi()
2134 vport->phba->fcf.fcfi); in lpfc_init_vfi()
2138 * lpfc_reg_vfi - Initialize the REG_VFI mailbox command
2143 * This routine initializes @mbox to all zeros and then fills in the mailbox
2152 struct lpfc_hba *phba = vport->phba; in lpfc_reg_vfi()
2156 reg_vfi = &mbox->u.mqe.un.reg_vfi; in lpfc_reg_vfi()
2157 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_REG_VFI); in lpfc_reg_vfi()
2160 phba->sli4_hba.vfi_ids[vport->vfi]); in lpfc_reg_vfi()
2161 bf_set(lpfc_reg_vfi_fcfi, reg_vfi, phba->fcf.fcfi); in lpfc_reg_vfi()
2162 bf_set(lpfc_reg_vfi_vpi, reg_vfi, phba->vpi_ids[vport->vpi]); in lpfc_reg_vfi()
2163 memcpy(reg_vfi->wwn, &vport->fc_portname, sizeof(struct lpfc_name)); in lpfc_reg_vfi()
2164 reg_vfi->wwn[0] = cpu_to_le32(reg_vfi->wwn[0]); in lpfc_reg_vfi()
2165 reg_vfi->wwn[1] = cpu_to_le32(reg_vfi->wwn[1]); in lpfc_reg_vfi()
2166 reg_vfi->e_d_tov = phba->fc_edtov; in lpfc_reg_vfi()
2167 reg_vfi->r_a_tov = phba->fc_ratov; in lpfc_reg_vfi()
2169 reg_vfi->bde.addrHigh = putPaddrHigh(phys); in lpfc_reg_vfi()
2170 reg_vfi->bde.addrLow = putPaddrLow(phys); in lpfc_reg_vfi()
2171 reg_vfi->bde.tus.f.bdeSize = sizeof(vport->fc_sparam); in lpfc_reg_vfi()
2172 reg_vfi->bde.tus.f.bdeFlags = BUFF_TYPE_BDE_64; in lpfc_reg_vfi()
2174 bf_set(lpfc_reg_vfi_nport_id, reg_vfi, vport->fc_myDID); in lpfc_reg_vfi()
2177 if ((phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) && in lpfc_reg_vfi()
2178 (vport->fc_flag & FC_VFI_REGISTERED) && in lpfc_reg_vfi()
2179 (!phba->fc_topology_changed)) in lpfc_reg_vfi()
2184 bbscn_fabric = (phba->fc_fabparam.cmn.bbRcvSizeMsb >> 4) & 0xF; in lpfc_reg_vfi()
2186 if (phba->bbcredit_support && phba->cfg_enable_bbcr && in lpfc_reg_vfi()
2189 &phba->sli4_hba.bbscn_params); in lpfc_reg_vfi()
2192 &phba->sli4_hba.bbscn_params); in lpfc_reg_vfi()
2207 vport->fc_myDID, in lpfc_reg_vfi()
2208 phba->fcf.fcfi, in lpfc_reg_vfi()
2209 phba->sli4_hba.vfi_ids[vport->vfi], in lpfc_reg_vfi()
2210 phba->vpi_ids[vport->vpi], in lpfc_reg_vfi()
2211 reg_vfi->wwn[0], reg_vfi->wwn[1], vport->fc_flag, in lpfc_reg_vfi()
2212 vport->port_state, phba->fc_topology_changed, in lpfc_reg_vfi()
2217 * lpfc_init_vpi - Initialize the INIT_VPI mailbox command
2222 * The INIT_VPI mailbox command supports virtual N_Ports. The driver uses the
2232 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VPI); in lpfc_init_vpi()
2233 bf_set(lpfc_init_vpi_vpi, &mbox->u.mqe.un.init_vpi, in lpfc_init_vpi()
2234 phba->vpi_ids[vpi]); in lpfc_init_vpi()
2235 bf_set(lpfc_init_vpi_vfi, &mbox->u.mqe.un.init_vpi, in lpfc_init_vpi()
2236 phba->sli4_hba.vfi_ids[phba->pport->vfi]); in lpfc_init_vpi()
2240 * lpfc_unreg_vfi - Initialize the UNREG_VFI mailbox command
2244 * The UNREG_VFI mailbox command causes the SLI Host to put a virtual fabric
2247 * fabric. The SLI Port posts the mailbox response after marking the virtual
2254 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_UNREG_VFI); in lpfc_unreg_vfi()
2255 bf_set(lpfc_unreg_vfi_vfi, &mbox->u.mqe.un.unreg_vfi, in lpfc_unreg_vfi()
2256 vport->phba->sli4_hba.vfi_ids[vport->vfi]); in lpfc_unreg_vfi()
2260 * lpfc_sli4_dump_cfg_rg23 - Dump sli4 port config region 23
2264 * This function create a SLI4 dump mailbox command to dump configure
2274 mb = &mbox->u.mb; in lpfc_sli4_dump_cfg_rg23()
2278 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_dump_cfg_rg23()
2280 if (!mp || !mp->virt) { in lpfc_sli4_dump_cfg_rg23()
2289 memset(mp->virt, 0, LPFC_BPL_SIZE); in lpfc_sli4_dump_cfg_rg23()
2290 INIT_LIST_HEAD(&mp->list); in lpfc_sli4_dump_cfg_rg23()
2293 mbox->ctx_buf = (uint8_t *)mp; in lpfc_sli4_dump_cfg_rg23()
2295 mb->mbxCommand = MBX_DUMP_MEMORY; in lpfc_sli4_dump_cfg_rg23()
2296 mb->un.varDmp.type = DMP_NV_PARAMS; in lpfc_sli4_dump_cfg_rg23()
2297 mb->un.varDmp.region_id = DMP_REGION_23; in lpfc_sli4_dump_cfg_rg23()
2298 mb->un.varDmp.sli4_length = DMP_RGN23_SIZE; in lpfc_sli4_dump_cfg_rg23()
2299 mb->un.varWords[3] = putPaddrLow(mp->phys); in lpfc_sli4_dump_cfg_rg23()
2300 mb->un.varWords[4] = putPaddrHigh(mp->phys); in lpfc_sli4_dump_cfg_rg23()
2310 (struct lpfc_rdp_context *)(mboxq->ctx_ndlp); in lpfc_mbx_cmpl_rdp_link_stat()
2312 mb = &mboxq->u.mb; in lpfc_mbx_cmpl_rdp_link_stat()
2313 if (mb->mbxStatus) in lpfc_mbx_cmpl_rdp_link_stat()
2316 memcpy(&rdp_context->link_stat, &mb->un.varRdLnk, sizeof(READ_LNK_VAR)); in lpfc_mbx_cmpl_rdp_link_stat()
2322 rdp_context->cmpl(phba, rdp_context, rc); in lpfc_mbx_cmpl_rdp_link_stat()
2328 struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)mbox->ctx_buf; in lpfc_mbx_cmpl_rdp_page_a2()
2330 (struct lpfc_rdp_context *)(mbox->ctx_ndlp); in lpfc_mbx_cmpl_rdp_page_a2()
2332 if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) in lpfc_mbx_cmpl_rdp_page_a2()
2335 lpfc_sli_bemem_bcopy(mp->virt, &rdp_context->page_a2, in lpfc_mbx_cmpl_rdp_page_a2()
2339 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mbx_cmpl_rdp_page_a2()
2344 mbox->vport = rdp_context->ndlp->vport; in lpfc_mbx_cmpl_rdp_page_a2()
2345 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat; in lpfc_mbx_cmpl_rdp_page_a2()
2346 mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; in lpfc_mbx_cmpl_rdp_page_a2()
2353 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mbx_cmpl_rdp_page_a2()
2357 rdp_context->cmpl(phba, rdp_context, FAILURE); in lpfc_mbx_cmpl_rdp_page_a2()
2364 struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(mbox->ctx_buf); in lpfc_mbx_cmpl_rdp_page_a0()
2366 (struct lpfc_rdp_context *)(mbox->ctx_ndlp); in lpfc_mbx_cmpl_rdp_page_a0()
2368 if (bf_get(lpfc_mqe_status, &mbox->u.mqe)) in lpfc_mbx_cmpl_rdp_page_a0()
2371 lpfc_sli_bemem_bcopy(mp->virt, &rdp_context->page_a0, in lpfc_mbx_cmpl_rdp_page_a0()
2376 memset(mp->virt, 0, DMP_SFF_PAGE_A2_SIZE); in lpfc_mbx_cmpl_rdp_page_a0()
2377 INIT_LIST_HEAD(&mp->list); in lpfc_mbx_cmpl_rdp_page_a0()
2380 mbox->ctx_buf = mp; in lpfc_mbx_cmpl_rdp_page_a0()
2381 mbox->vport = rdp_context->ndlp->vport; in lpfc_mbx_cmpl_rdp_page_a0()
2383 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_DUMP_MEMORY); in lpfc_mbx_cmpl_rdp_page_a0()
2385 &mbox->u.mqe.un.mem_dump_type3, DMP_LMSD); in lpfc_mbx_cmpl_rdp_page_a0()
2387 &mbox->u.mqe.un.mem_dump_type3, phba->sli4_hba.physical_port); in lpfc_mbx_cmpl_rdp_page_a0()
2389 &mbox->u.mqe.un.mem_dump_type3, DMP_PAGE_A2); in lpfc_mbx_cmpl_rdp_page_a0()
2391 &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A2_SIZE); in lpfc_mbx_cmpl_rdp_page_a0()
2392 mbox->u.mqe.un.mem_dump_type3.addr_lo = putPaddrLow(mp->phys); in lpfc_mbx_cmpl_rdp_page_a0()
2393 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); in lpfc_mbx_cmpl_rdp_page_a0()
2395 mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_page_a2; in lpfc_mbx_cmpl_rdp_page_a0()
2396 mbox->ctx_ndlp = (struct lpfc_rdp_context *)rdp_context; in lpfc_mbx_cmpl_rdp_page_a0()
2404 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_mbx_cmpl_rdp_page_a0()
2407 rdp_context->cmpl(phba, rdp_context, FAILURE); in lpfc_mbx_cmpl_rdp_page_a0()
2412 * lpfc_sli4_dump_sfp_pagea0 - Dump sli4 read SFP Diagnostic.
2416 * This function create a SLI4 dump mailbox command to dump configure
2428 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_sli4_dump_page_a0()
2429 if (!mp || !mp->virt) { in lpfc_sli4_dump_page_a0()
2436 memset(mp->virt, 0, LPFC_BPL_SIZE); in lpfc_sli4_dump_page_a0()
2437 INIT_LIST_HEAD(&mp->list); in lpfc_sli4_dump_page_a0()
2439 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_DUMP_MEMORY); in lpfc_sli4_dump_page_a0()
2441 mbox->ctx_buf = mp; in lpfc_sli4_dump_page_a0()
2444 &mbox->u.mqe.un.mem_dump_type3, DMP_LMSD); in lpfc_sli4_dump_page_a0()
2446 &mbox->u.mqe.un.mem_dump_type3, phba->sli4_hba.physical_port); in lpfc_sli4_dump_page_a0()
2448 &mbox->u.mqe.un.mem_dump_type3, DMP_PAGE_A0); in lpfc_sli4_dump_page_a0()
2450 &mbox->u.mqe.un.mem_dump_type3, DMP_SFF_PAGE_A0_SIZE); in lpfc_sli4_dump_page_a0()
2451 mbox->u.mqe.un.mem_dump_type3.addr_lo = putPaddrLow(mp->phys); in lpfc_sli4_dump_page_a0()
2452 mbox->u.mqe.un.mem_dump_type3.addr_hi = putPaddrHigh(mp->phys); in lpfc_sli4_dump_page_a0()
2458 * lpfc_reg_fcfi - Initialize the REG_FCFI mailbox command
2462 * The REG_FCFI mailbox command supports Fibre Channel Forwarders (FCFs). The
2464 * information via a READ_FCF mailbox command. This mailbox command also is used
2476 reg_fcfi = &mbox->u.mqe.un.reg_fcfi; in lpfc_reg_fcfi()
2477 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_REG_FCFI); in lpfc_reg_fcfi()
2478 if (phba->nvmet_support == 0) { in lpfc_reg_fcfi()
2480 phba->sli4_hba.hdr_rq->queue_id); in lpfc_reg_fcfi()
2481 /* Match everything - rq_id0 */ in lpfc_reg_fcfi()
2491 (~phba->fcf.addr_mode) & 0x3); in lpfc_reg_fcfi()
2494 if (phba->cfg_nvmet_mrq != 1) in lpfc_reg_fcfi()
2498 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id); in lpfc_reg_fcfi()
2499 /* Match type FCP - rq_id0 */ in lpfc_reg_fcfi()
2506 phba->sli4_hba.hdr_rq->queue_id); in lpfc_reg_fcfi()
2507 /* Match everything else - rq_id1 */ in lpfc_reg_fcfi()
2516 phba->fcf.current_rec.fcf_indx); in lpfc_reg_fcfi()
2517 if (phba->fcf.current_rec.vlan_id != LPFC_FCOE_NULL_VID) { in lpfc_reg_fcfi()
2520 phba->fcf.current_rec.vlan_id); in lpfc_reg_fcfi()
2525 * lpfc_reg_fcfi_mrq - Initialize the REG_FCFI_MRQ mailbox command
2530 * The REG_FCFI_MRQ mailbox command supports Fibre Channel Forwarders (FCFs).
2532 * information via a READ_FCF mailbox command. This mailbox command also is used
2544 if (phba->cfg_nvmet_mrq <= 1) in lpfc_reg_fcfi_mrq()
2548 reg_fcfi = &mbox->u.mqe.un.reg_fcfi_mrq; in lpfc_reg_fcfi_mrq()
2549 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_REG_FCFI_MRQ); in lpfc_reg_fcfi_mrq()
2552 phba->fcf.current_rec.fcf_indx); in lpfc_reg_fcfi_mrq()
2553 if (phba->fcf.current_rec.vlan_id != LPFC_FCOE_NULL_VID) { in lpfc_reg_fcfi_mrq()
2556 phba->fcf.current_rec.vlan_id); in lpfc_reg_fcfi_mrq()
2562 phba->sli4_hba.nvmet_mrq_hdr[0]->queue_id); in lpfc_reg_fcfi_mrq()
2563 /* Match NVME frames of type FCP (protocol NVME) - rq_id0 */ in lpfc_reg_fcfi_mrq()
2574 bf_set(lpfc_reg_fcfi_mrq_npairs, reg_fcfi, phba->cfg_nvmet_mrq); in lpfc_reg_fcfi_mrq()
2577 phba->sli4_hba.hdr_rq->queue_id); in lpfc_reg_fcfi_mrq()
2578 /* Match everything - rq_id1 */ in lpfc_reg_fcfi_mrq()
2589 * lpfc_unreg_fcfi - Initialize the UNREG_FCFI mailbox command
2593 * The UNREG_FCFI mailbox command supports Fibre Channel Forwarders (FCFs).
2600 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_UNREG_FCFI); in lpfc_unreg_fcfi()
2601 bf_set(lpfc_unreg_fcfi, &mbox->u.mqe.un.unreg_fcfi, fcfi); in lpfc_unreg_fcfi()
2605 * lpfc_resume_rpi - Initialize the RESUME_RPI mailbox command
2609 * The RESUME_RPI mailbox command is used to restart I/O to an RPI after a
2615 struct lpfc_hba *phba = ndlp->phba; in lpfc_resume_rpi()
2619 resume_rpi = &mbox->u.mqe.un.resume_rpi; in lpfc_resume_rpi()
2620 bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_RESUME_RPI); in lpfc_resume_rpi()
2622 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); in lpfc_resume_rpi()
2624 resume_rpi->event_tag = ndlp->phba->fc_eventTag; in lpfc_resume_rpi()