aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_mbox.c
diff options
context:
space:
mode:
authorJames Smart <James.Smart@Emulex.Com>2008-08-24 21:49:00 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-10-13 09:28:53 -0400
commite59058c44025d71c9b7f260076a932935d3bba95 (patch)
tree36cd4b31ac3b130849c5ad4d2c0cef035a7389dd /drivers/scsi/lpfc/lpfc_mbox.c
parent4a27446f3e39b06c28d1c8e31d33a5340826ed5c (diff)
[SCSI] lpfc 8.2.8 : Add kernel-doc function headers
Signed-off-by: James Smart <james.smart@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_mbox.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c468
1 files changed, 402 insertions, 66 deletions
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 7a9be4c5b7cb..7413bfdf89a4 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -37,10 +37,20 @@
37#include "lpfc_crtn.h" 37#include "lpfc_crtn.h"
38#include "lpfc_compat.h" 38#include "lpfc_compat.h"
39 39
40/**********************************************/ 40/**
41 41 * lpfc_dump_mem: Prepare a mailbox command for retrieving HBA's VPD memory.
42/* mailbox command */ 42 * @phba: pointer to lpfc hba data structure.
43/**********************************************/ 43 * @pmb: pointer to the driver internal queue element for mailbox command.
44 * @offset: offset for dumping VPD memory mailbox command.
45 *
46 * The dump mailbox command provides a method for the device driver to obtain
47 * various types of information from the HBA device.
48 *
49 * This routine prepares the mailbox command for dumping HBA Vital Product
50 * Data (VPD) memory. This mailbox command is to be used for retrieving a
51 * portion (DMP_RSP_SIZE bytes) of a HBA's VPD from the HBA at an address
52 * offset specified by the offset parameter.
53 **/
44void 54void
45lpfc_dump_mem(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, uint16_t offset) 55lpfc_dump_mem(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, uint16_t offset)
46{ 56{
@@ -65,10 +75,17 @@ lpfc_dump_mem(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, uint16_t offset)
65 return; 75 return;
66} 76}
67 77
68/**********************************************/ 78/**
69/* lpfc_read_nv Issue a READ NVPARAM */ 79 * lpfc_read_nv: Prepare a mailbox command for reading HBA's NVRAM param.
70/* mailbox command */ 80 * @phba: pointer to lpfc hba data structure.
71/**********************************************/ 81 * @pmb: pointer to the driver internal queue element for mailbox command.
82 *
83 * The read NVRAM mailbox command returns the HBA's non-volatile parameters
84 * that are used as defaults when the Fibre Channel link is brought on-line.
85 *
86 * This routine prepares the mailbox command for reading information stored
87 * in the HBA's NVRAM. Specifically, the HBA's WWNN and WWPN.
88 **/
72void 89void
73lpfc_read_nv(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 90lpfc_read_nv(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
74{ 91{
@@ -81,10 +98,19 @@ lpfc_read_nv(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
81 return; 98 return;
82} 99}
83 100
84/**********************************************/ 101/**
85/* lpfc_config_async Issue a */ 102 * lpfc_config_async: Prepare a mailbox command for enabling HBA async event.
86/* MBX_ASYNC_EVT_ENABLE mailbox command */ 103 * @phba: pointer to lpfc hba data structure.
87/**********************************************/ 104 * @pmb: pointer to the driver internal queue element for mailbox command.
105 * @ring: ring number for the asynchronous event to be configured.
106 *
107 * The asynchronous event enable mailbox command is used to enable the
108 * asynchronous event posting via the ASYNC_STATUS_CN IOCB response and
109 * specifies the default ring to which events are posted.
110 *
111 * This routine prepares the mailbox command for enabling HBA asynchronous
112 * event support on a IOCB ring.
113 **/
88void 114void
89lpfc_config_async(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, 115lpfc_config_async(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb,
90 uint32_t ring) 116 uint32_t ring)
@@ -99,10 +125,19 @@ lpfc_config_async(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb,
99 return; 125 return;
100} 126}
101 127
102/**********************************************/ 128/**
103/* lpfc_heart_beat Issue a HEART_BEAT */ 129 * lpfc_heart_beat: Prepare a mailbox command for heart beat.
104/* mailbox command */ 130 * @phba: pointer to lpfc hba data structure.
105/**********************************************/ 131 * @pmb: pointer to the driver internal queue element for mailbox command.
132 *
133 * The heart beat mailbox command is used to detect an unresponsive HBA, which
134 * is defined as any device where no error attention is sent and both mailbox
135 * and rings are not processed.
136 *
137 * This routine prepares the mailbox command for issuing a heart beat in the
138 * form of mailbox command to the HBA. The timely completion of the heart
139 * beat mailbox command indicates the health of the HBA.
140 **/
106void 141void
107lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 142lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
108{ 143{
@@ -115,10 +150,26 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
115 return; 150 return;
116} 151}
117 152
118/**********************************************/ 153/**
119/* lpfc_read_la Issue a READ LA */ 154 * lpfc_read_la: Prepare a mailbox command for reading HBA link attention.
120/* mailbox command */ 155 * @phba: pointer to lpfc hba data structure.
121/**********************************************/ 156 * @pmb: pointer to the driver internal queue element for mailbox command.
157 * @mp: DMA buffer memory for reading the link attention information into.
158 *
159 * The read link attention mailbox command is issued to read the Link Event
160 * Attention information indicated by the HBA port when the Link Event bit
161 * of the Host Attention (HSTATT) register is set to 1. A Link Event
162 * Attention occurs based on an exception detected at the Fibre Channel link
163 * interface.
164 *
165 * This routine prepares the mailbox command for reading HBA link attention
166 * information. A DMA memory has been set aside and address passed to the
167 * HBA through @mp for the HBA to DMA link attention information into the
168 * memory as part of the execution of the mailbox command.
169 *
170 * Return codes
171 * 0 - Success (currently always return 0)
172 **/
122int 173int
123lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp) 174lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp)
124{ 175{
@@ -143,10 +194,21 @@ lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp)
143 return (0); 194 return (0);
144} 195}
145 196
146/**********************************************/ 197/**
147/* lpfc_clear_la Issue a CLEAR LA */ 198 * lpfc_clear_la: Prepare a mailbox command for clearing HBA link attention.
148/* mailbox command */ 199 * @phba: pointer to lpfc hba data structure.
149/**********************************************/ 200 * @pmb: pointer to the driver internal queue element for mailbox command.
201 *
202 * The clear link attention mailbox command is issued to clear the link event
203 * attention condition indicated by the Link Event bit of the Host Attention
204 * (HSTATT) register. The link event attention condition is cleared only if
205 * the event tag specified matches that of the current link event counter.
206 * The current event tag is read using the read link attention event mailbox
207 * command.
208 *
209 * This routine prepares the mailbox command for clearing HBA link attention
210 * information.
211 **/
150void 212void
151lpfc_clear_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 213lpfc_clear_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
152{ 214{
@@ -161,10 +223,20 @@ lpfc_clear_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
161 return; 223 return;
162} 224}
163 225
164/**************************************************/ 226/**
165/* lpfc_config_link Issue a CONFIG LINK */ 227 * lpfc_config_link: Prepare a mailbox command for configuring link on a HBA.
166/* mailbox command */ 228 * @phba: pointer to lpfc hba data structure.
167/**************************************************/ 229 * @pmb: pointer to the driver internal queue element for mailbox command.
230 *
231 * The configure link mailbox command is used before the initialize link
232 * mailbox command to override default value and to configure link-oriented
233 * parameters such as DID address and various timers. Typically, this
234 * command would be used after an F_Port login to set the returned DID address
235 * and the fabric timeout values. This command is not valid before a configure
236 * port command has configured the HBA port.
237 *
238 * This routine prepares the mailbox command for configuring link on a HBA.
239 **/
168void 240void
169lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 241lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
170{ 242{
@@ -199,10 +271,20 @@ lpfc_config_link(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
199 return; 271 return;
200} 272}
201 273
202/**********************************************/ 274/**
203/* lpfc_init_link Issue an INIT LINK */ 275 * lpfc_init_link: Prepare a mailbox command for initialize link on a HBA.
204/* mailbox command */ 276 * @phba: pointer to lpfc hba data structure.
205/**********************************************/ 277 * @pmb: pointer to the driver internal queue element for mailbox command.
278 * @topology: the link topology for the link to be initialized to.
279 * @linkspeed: the link speed for the link to be initialized to.
280 *
281 * The initialize link mailbox command is used to initialize the Fibre
282 * Channel link. This command must follow a configure port command that
283 * establishes the mode of operation.
284 *
285 * This routine prepares the mailbox command for initializing link on a HBA
286 * with the specified link topology and speed.
287 **/
206void 288void
207lpfc_init_link(struct lpfc_hba * phba, 289lpfc_init_link(struct lpfc_hba * phba,
208 LPFC_MBOXQ_t * pmb, uint32_t topology, uint32_t linkspeed) 290 LPFC_MBOXQ_t * pmb, uint32_t topology, uint32_t linkspeed)
@@ -269,10 +351,27 @@ lpfc_init_link(struct lpfc_hba * phba,
269 return; 351 return;
270} 352}
271 353
272/**********************************************/ 354/**
273/* lpfc_read_sparam Issue a READ SPARAM */ 355 * lpfc_read_sparam: Prepare a mailbox command for reading HBA parameters.
274/* mailbox command */ 356 * @phba: pointer to lpfc hba data structure.
275/**********************************************/ 357 * @pmb: pointer to the driver internal queue element for mailbox command.
358 * @vpi: virtual N_Port identifier.
359 *
360 * The read service parameter mailbox command is used to read the HBA port
361 * service parameters. The service parameters are read into the buffer
362 * specified directly by a BDE in the mailbox command. These service
363 * parameters may then be used to build the payload of an N_Port/F_POrt
364 * login request and reply (LOGI/ACC).
365 *
366 * This routine prepares the mailbox command for reading HBA port service
367 * parameters. The DMA memory is allocated in this function and the addresses
368 * are populated into the mailbox command for the HBA to DMA the service
369 * parameters into.
370 *
371 * Return codes
372 * 0 - Success
373 * 1 - DMA memory allocation failed
374 **/
276int 375int
277lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi) 376lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi)
278{ 377{
@@ -312,10 +411,21 @@ lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi)
312 return (0); 411 return (0);
313} 412}
314 413
315/********************************************/ 414/**
316/* lpfc_unreg_did Issue a UNREG_DID */ 415 * lpfc_unreg_did: Prepare a mailbox command for unregistering DID.
317/* mailbox command */ 416 * @phba: pointer to lpfc hba data structure.
318/********************************************/ 417 * @vpi: virtual N_Port identifier.
418 * @did: remote port identifier.
419 * @pmb: pointer to the driver internal queue element for mailbox command.
420 *
421 * The unregister DID mailbox command is used to unregister an N_Port/F_Port
422 * login for an unknown RPI by specifying the DID of a remote port. This
423 * command frees an RPI context in the HBA port. This has the effect of
424 * performing an implicit N_Port/F_Port logout.
425 *
426 * This routine prepares the mailbox command for unregistering a remote
427 * N_Port/F_Port (DID) login.
428 **/
319void 429void
320lpfc_unreg_did(struct lpfc_hba * phba, uint16_t vpi, uint32_t did, 430lpfc_unreg_did(struct lpfc_hba * phba, uint16_t vpi, uint32_t did,
321 LPFC_MBOXQ_t * pmb) 431 LPFC_MBOXQ_t * pmb)
@@ -333,10 +443,19 @@ lpfc_unreg_did(struct lpfc_hba * phba, uint16_t vpi, uint32_t did,
333 return; 443 return;
334} 444}
335 445
336/**********************************************/ 446/**
337/* lpfc_read_nv Issue a READ CONFIG */ 447 * lpfc_read_config: Prepare a mailbox command for reading HBA configuration.
338/* mailbox command */ 448 * @phba: pointer to lpfc hba data structure.
339/**********************************************/ 449 * @pmb: pointer to the driver internal queue element for mailbox command.
450 *
451 * The read configuration mailbox command is used to read the HBA port
452 * configuration parameters. This mailbox command provides a method for
453 * seeing any parameters that may have changed via various configuration
454 * mailbox commands.
455 *
456 * This routine prepares the mailbox command for reading out HBA configuration
457 * parameters.
458 **/
340void 459void
341lpfc_read_config(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 460lpfc_read_config(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
342{ 461{
@@ -350,10 +469,18 @@ lpfc_read_config(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
350 return; 469 return;
351} 470}
352 471
353/*************************************************/ 472/**
354/* lpfc_read_lnk_stat Issue a READ LINK STATUS */ 473 * lpfc_read_lnk_stat: Prepare a mailbox command for reading HBA link stats.
355/* mailbox command */ 474 * @phba: pointer to lpfc hba data structure.
356/*************************************************/ 475 * @pmb: pointer to the driver internal queue element for mailbox command.
476 *
477 * The read link status mailbox command is used to read the link status from
478 * the HBA. Link status includes all link-related error counters. These
479 * counters are maintained by the HBA and originated in the link hardware
480 * unit. Note that all of these counters wrap.
481 *
482 * This routine prepares the mailbox command for reading out HBA link status.
483 **/
357void 484void
358lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 485lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
359{ 486{
@@ -367,10 +494,30 @@ lpfc_read_lnk_stat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
367 return; 494 return;
368} 495}
369 496
370/********************************************/ 497/**
371/* lpfc_reg_login Issue a REG_LOGIN */ 498 * lpfc_reg_login: Prepare a mailbox command for registering remote login.
372/* mailbox command */ 499 * @phba: pointer to lpfc hba data structure.
373/********************************************/ 500 * @vpi: virtual N_Port identifier.
501 * @did: remote port identifier.
502 * @param: pointer to memory holding the server parameters.
503 * @pmb: pointer to the driver internal queue element for mailbox command.
504 * @flag: action flag to be passed back for the complete function.
505 *
506 * The registration login mailbox command is used to register an N_Port or
507 * F_Port login. This registration allows the HBA to cache the remote N_Port
508 * service parameters internally and thereby make the appropriate FC-2
509 * decisions. The remote port service parameters are handed off by the driver
510 * to the HBA using a descriptor entry that directly identifies a buffer in
511 * host memory. In exchange, the HBA returns an RPI identifier.
512 *
513 * This routine prepares the mailbox command for registering remote port login.
514 * The function allocates DMA buffer for passing the service parameters to the
515 * HBA with the mailbox command.
516 *
517 * Return codes
518 * 0 - Success
519 * 1 - DMA memory allocation failed
520 **/
374int 521int
375lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did, 522lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
376 uint8_t *param, LPFC_MBOXQ_t *pmb, uint32_t flag) 523 uint8_t *param, LPFC_MBOXQ_t *pmb, uint32_t flag)
@@ -418,10 +565,20 @@ lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
418 return (0); 565 return (0);
419} 566}
420 567
421/**********************************************/ 568/**
422/* lpfc_unreg_login Issue a UNREG_LOGIN */ 569 * lpfc_unreg_login: Prepare a mailbox command for unregistering remote login.
423/* mailbox command */ 570 * @phba: pointer to lpfc hba data structure.
424/**********************************************/ 571 * @vpi: virtual N_Port identifier.
572 * @rpi: remote port identifier
573 * @pmb: pointer to the driver internal queue element for mailbox command.
574 *
575 * The unregistration login mailbox command is used to unregister an N_Port
576 * or F_Port login. This command frees an RPI context in the HBA. It has the
577 * effect of performing an implicit N_Port/F_Port logout.
578 *
579 * This routine prepares the mailbox command for unregistering remote port
580 * login.
581 **/
425void 582void
426lpfc_unreg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t rpi, 583lpfc_unreg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t rpi,
427 LPFC_MBOXQ_t * pmb) 584 LPFC_MBOXQ_t * pmb)
@@ -440,10 +597,21 @@ lpfc_unreg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t rpi,
440 return; 597 return;
441} 598}
442 599
443/**************************************************/ 600/**
444/* lpfc_reg_vpi Issue a REG_VPI */ 601 * lpfc_reg_vpi: Prepare a mailbox command for registering vport identifier.
445/* mailbox command */ 602 * @phba: pointer to lpfc hba data structure.
446/**************************************************/ 603 * @vpi: virtual N_Port identifier.
604 * @sid: Fibre Channel S_ID (N_Port_ID assigned to a virtual N_Port).
605 * @pmb: pointer to the driver internal queue element for mailbox command.
606 *
607 * The registration vport identifier mailbox command is used to activate a
608 * virtual N_Port after it has acquired an N_Port_ID. The HBA validates the
609 * N_Port_ID against the information in the selected virtual N_Port context
610 * block and marks it active to allow normal processing of IOCB commands and
611 * received unsolicited exchanges.
612 *
613 * This routine prepares the mailbox command for registering a virtual N_Port.
614 **/
447void 615void
448lpfc_reg_vpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t sid, 616lpfc_reg_vpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t sid,
449 LPFC_MBOXQ_t *pmb) 617 LPFC_MBOXQ_t *pmb)
@@ -461,10 +629,22 @@ lpfc_reg_vpi(struct lpfc_hba *phba, uint16_t vpi, uint32_t sid,
461 629
462} 630}
463 631
464/**************************************************/ 632/**
465/* lpfc_unreg_vpi Issue a UNREG_VNPI */ 633 * lpfc_unreg_vpi: Prepare a mailbox command for unregistering vport id.
466/* mailbox command */ 634 * @phba: pointer to lpfc hba data structure.
467/**************************************************/ 635 * @vpi: virtual N_Port identifier.
636 * @pmb: pointer to the driver internal queue element for mailbox command.
637 *
638 * The unregistration vport identifier mailbox command is used to inactivate
639 * a virtual N_Port. The driver must have logged out and unregistered all
640 * remote N_Ports to abort any activity on the virtual N_Port. The HBA will
641 * unregisters any default RPIs associated with the specified vpi, aborting
642 * any active exchanges. The HBA will post the mailbox response after making
643 * the virtual N_Port inactive.
644 *
645 * This routine prepares the mailbox command for unregistering a virtual
646 * N_Port.
647 **/
468void 648void
469lpfc_unreg_vpi(struct lpfc_hba *phba, uint16_t vpi, LPFC_MBOXQ_t *pmb) 649lpfc_unreg_vpi(struct lpfc_hba *phba, uint16_t vpi, LPFC_MBOXQ_t *pmb)
470{ 650{
@@ -479,6 +659,13 @@ lpfc_unreg_vpi(struct lpfc_hba *phba, uint16_t vpi, LPFC_MBOXQ_t *pmb)
479 659
480} 660}
481 661
662/**
663 * lpfc_config_pcb_setup: Set up IOCB rings in the Port Control Block (PCB)
664 * @phba: pointer to lpfc hba data structure.
665 *
666 * This routine sets up and initializes the IOCB rings in the Port Control
667 * Block (PCB).
668 **/
482static void 669static void
483lpfc_config_pcb_setup(struct lpfc_hba * phba) 670lpfc_config_pcb_setup(struct lpfc_hba * phba)
484{ 671{
@@ -536,6 +723,20 @@ lpfc_config_pcb_setup(struct lpfc_hba * phba)
536 } 723 }
537} 724}
538 725
726/**
727 * lpfc_read_rev: Prepare a mailbox command for reading HBA revision.
728 * @phba: pointer to lpfc hba data structure.
729 * @pmb: pointer to the driver internal queue element for mailbox command.
730 *
731 * The read revision mailbox command is used to read the revision levels of
732 * the HBA components. These components include hardware units, resident
733 * firmware, and available firmware. HBAs that supports SLI-3 mode of
734 * operation provide different response information depending on the version
735 * requested by the driver.
736 *
737 * This routine prepares the mailbox command for reading HBA revision
738 * information.
739 **/
539void 740void
540lpfc_read_rev(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 741lpfc_read_rev(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
541{ 742{
@@ -548,6 +749,16 @@ lpfc_read_rev(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
548 return; 749 return;
549} 750}
550 751
752/**
753 * lpfc_build_hbq_profile2: Set up the HBQ Selection Profile 2.
754 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
755 * @hbq_desc: pointer to the HBQ selection profile descriptor.
756 *
757 * The Host Buffer Queue (HBQ) Selection Profile 2 specifies that the HBA
758 * tests the incoming frames' R_CTL/TYPE fields with works 10:15 and performs
759 * the Sequence Length Test using the fields in the Selection Profile 2
760 * extension in words 20:31.
761 **/
551static void 762static void
552lpfc_build_hbq_profile2(struct config_hbq_var *hbqmb, 763lpfc_build_hbq_profile2(struct config_hbq_var *hbqmb,
553 struct lpfc_hbq_init *hbq_desc) 764 struct lpfc_hbq_init *hbq_desc)
@@ -557,6 +768,16 @@ lpfc_build_hbq_profile2(struct config_hbq_var *hbqmb,
557 hbqmb->profiles.profile2.seqlenoff = hbq_desc->seqlenoff; 768 hbqmb->profiles.profile2.seqlenoff = hbq_desc->seqlenoff;
558} 769}
559 770
771/**
772 * lpfc_build_hbq_profile3: Set up the HBQ Selection Profile 3.
773 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
774 * @hbq_desc: pointer to the HBQ selection profile descriptor.
775 *
776 * The Host Buffer Queue (HBQ) Selection Profile 3 specifies that the HBA
777 * tests the incoming frame's R_CTL/TYPE fields with words 10:15 and performs
778 * the Sequence Length Test and Byte Field Test using the fields in the
779 * Selection Profile 3 extension in words 20:31.
780 **/
560static void 781static void
561lpfc_build_hbq_profile3(struct config_hbq_var *hbqmb, 782lpfc_build_hbq_profile3(struct config_hbq_var *hbqmb,
562 struct lpfc_hbq_init *hbq_desc) 783 struct lpfc_hbq_init *hbq_desc)
@@ -569,6 +790,17 @@ lpfc_build_hbq_profile3(struct config_hbq_var *hbqmb,
569 sizeof(hbqmb->profiles.profile3.cmdmatch)); 790 sizeof(hbqmb->profiles.profile3.cmdmatch));
570} 791}
571 792
793/**
794 * lpfc_build_hbq_profile5: Set up the HBQ Selection Profile 5.
795 * @hbqmb: pointer to the HBQ configuration data structure in mailbox command.
796 * @hbq_desc: pointer to the HBQ selection profile descriptor.
797 *
798 * The Host Buffer Queue (HBQ) Selection Profile 5 specifies a header HBQ. The
799 * HBA tests the initial frame of an incoming sequence using the frame's
800 * R_CTL/TYPE fields with words 10:15 and performs the Sequence Length Test
801 * and Byte Field Test using the fields in the Selection Profile 5 extension
802 * words 20:31.
803 **/
572static void 804static void
573lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb, 805lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb,
574 struct lpfc_hbq_init *hbq_desc) 806 struct lpfc_hbq_init *hbq_desc)
@@ -581,6 +813,20 @@ lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb,
581 sizeof(hbqmb->profiles.profile5.cmdmatch)); 813 sizeof(hbqmb->profiles.profile5.cmdmatch));
582} 814}
583 815
816/**
817 * lpfc_config_hbq: Prepare a mailbox command for configuring an HBQ.
818 * @phba: pointer to lpfc hba data structure.
819 * @id: HBQ identifier.
820 * @hbq_desc: pointer to the HBA descriptor data structure.
821 * @hbq_entry_index: index of the HBQ entry data structures.
822 * @pmb: pointer to the driver internal queue element for mailbox command.
823 *
824 * The configure HBQ (Host Buffer Queue) mailbox command is used to configure
825 * an HBQ. The configuration binds events that require buffers to a particular
826 * ring and HBQ based on a selection profile.
827 *
828 * This routine prepares the mailbox command for configuring an HBQ.
829 **/
584void 830void
585lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id, 831lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id,
586 struct lpfc_hbq_init *hbq_desc, 832 struct lpfc_hbq_init *hbq_desc,
@@ -641,8 +887,23 @@ lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id,
641 return; 887 return;
642} 888}
643 889
644 890/**
645 891 * lpfc_config_ring: Prepare a mailbox command for configuring an IOCB ring.
892 * @phba: pointer to lpfc hba data structure.
893 * @ring:
894 * @pmb: pointer to the driver internal queue element for mailbox command.
895 *
896 * The configure ring mailbox command is used to configure an IOCB ring. This
897 * configuration binds from one to six of HBA RC_CTL/TYPE mask entries to the
898 * ring. This is used to map incoming sequences to a particular ring whose
899 * RC_CTL/TYPE mask entry matches that of the sequence. The driver should not
900 * attempt to configure a ring whose number is greater than the number
901 * specified in the Port Control Block (PCB). It is an error to issue the
902 * configure ring command more than once with the same ring number. The HBA
903 * returns an error if the driver attempts this.
904 *
905 * This routine prepares the mailbox command for configuring IOCB ring.
906 **/
646void 907void
647lpfc_config_ring(struct lpfc_hba * phba, int ring, LPFC_MBOXQ_t * pmb) 908lpfc_config_ring(struct lpfc_hba * phba, int ring, LPFC_MBOXQ_t * pmb)
648{ 909{
@@ -684,6 +945,20 @@ lpfc_config_ring(struct lpfc_hba * phba, int ring, LPFC_MBOXQ_t * pmb)
684 return; 945 return;
685} 946}
686 947
948/**
949 * lpfc_config_port: Prepare a mailbox command for configuring port.
950 * @phba: pointer to lpfc hba data structure.
951 * @pmb: pointer to the driver internal queue element for mailbox command.
952 *
953 * The configure port mailbox command is used to identify the Port Control
954 * Block (PCB) in the driver memory. After this command is issued, the
955 * driver must not access the mailbox in the HBA without first resetting
956 * the HBA. The HBA may copy the PCB information to internal storage for
957 * subsequent use; the driver can not change the PCB information unless it
958 * resets the HBA.
959 *
960 * This routine prepares the mailbox command for configuring port.
961 **/
687void 962void
688lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) 963lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
689{ 964{
@@ -839,6 +1114,21 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
839 sizeof(PCB_t)); 1114 sizeof(PCB_t));
840} 1115}
841 1116
1117/**
1118 * lpfc_kill_board: Prepare a mailbox command for killing board.
1119 * @phba: pointer to lpfc hba data structure.
1120 * @pmb: pointer to the driver internal queue element for mailbox command.
1121 *
1122 * The kill board mailbox command is used to tell firmware to perform a
1123 * graceful shutdown of a channel on a specified board to prepare for reset.
1124 * When the kill board mailbox command is received, the ER3 bit is set to 1
1125 * in the Host Status register and the ER Attention bit is set to 1 in the
1126 * Host Attention register of the HBA function that received the kill board
1127 * command.
1128 *
1129 * This routine prepares the mailbox command for killing the board in
1130 * preparation for a graceful shutdown.
1131 **/
842void 1132void
843lpfc_kill_board(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) 1133lpfc_kill_board(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
844{ 1134{
@@ -850,6 +1140,16 @@ lpfc_kill_board(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
850 return; 1140 return;
851} 1141}
852 1142
1143/**
1144 * lpfc_mbox_put: Put a mailbox cmd into the tail of driver's mailbox queue.
1145 * @phba: pointer to lpfc hba data structure.
1146 * @mbq: pointer to the driver internal queue element for mailbox command.
1147 *
1148 * Driver maintains a internal mailbox command queue implemented as a linked
1149 * list. When a mailbox command is issued, it shall be put into the mailbox
1150 * command queue such that they shall be processed orderly as HBA can process
1151 * one mailbox command at a time.
1152 **/
853void 1153void
854lpfc_mbox_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq) 1154lpfc_mbox_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq)
855{ 1155{
@@ -864,6 +1164,20 @@ lpfc_mbox_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq)
864 return; 1164 return;
865} 1165}
866 1166
1167/**
1168 * lpfc_mbox_get: Remove a mailbox cmd from the head of driver's mailbox queue.
1169 * @phba: pointer to lpfc hba data structure.
1170 *
1171 * Driver maintains a internal mailbox command queue implemented as a linked
1172 * list. When a mailbox command is issued, it shall be put into the mailbox
1173 * command queue such that they shall be processed orderly as HBA can process
1174 * one mailbox command at a time. After HBA finished processing a mailbox
1175 * command, the driver will remove a pending mailbox command from the head of
1176 * the mailbox command queue and send to the HBA for processing.
1177 *
1178 * Return codes
1179 * pointer to the driver internal queue element for mailbox command.
1180 **/
867LPFC_MBOXQ_t * 1181LPFC_MBOXQ_t *
868lpfc_mbox_get(struct lpfc_hba * phba) 1182lpfc_mbox_get(struct lpfc_hba * phba)
869{ 1183{
@@ -877,6 +1191,17 @@ lpfc_mbox_get(struct lpfc_hba * phba)
877 return mbq; 1191 return mbq;
878} 1192}
879 1193
1194/**
1195 * lpfc_mbox_cmpl_put: Put mailbox command into mailbox command complete list.
1196 * @phba: pointer to lpfc hba data structure.
1197 * @mbq: pointer to the driver internal queue element for mailbox command.
1198 *
1199 * This routine put the completed mailbox command into the mailbox command
1200 * complete list. This routine is called from driver interrupt handler
1201 * context.The mailbox complete list is used by the driver worker thread
1202 * to process mailbox complete callback functions outside the driver interrupt
1203 * handler.
1204 **/
880void 1205void
881lpfc_mbox_cmpl_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq) 1206lpfc_mbox_cmpl_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq)
882{ 1207{
@@ -887,6 +1212,17 @@ lpfc_mbox_cmpl_put(struct lpfc_hba * phba, LPFC_MBOXQ_t * mbq)
887 return; 1212 return;
888} 1213}
889 1214
1215/**
1216 * lpfc_mbox_tmo_val: Retrieve mailbox command timeout value.
1217 * @phba: pointer to lpfc hba data structure.
1218 * @cmd: mailbox command code.
1219 *
1220 * This routine retrieves the proper timeout value according to the mailbox
1221 * command code.
1222 *
1223 * Return codes
1224 * Timeout value to be used for the given mailbox command
1225 **/
890int 1226int
891lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd) 1227lpfc_mbox_tmo_val(struct lpfc_hba *phba, int cmd)
892{ 1228{