2 * Copyright (c) 2017 Broadcom. All rights reserved.
3 * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
36 * Define common SLI-4 structures and function prototypes.
44 #define SLI_PAGE_SIZE (4096)
45 #define SLI_SUB_PAGE_MASK (SLI_PAGE_SIZE - 1)
46 #define SLI_PAGE_SHIFT 12
47 #define SLI_ROUND_PAGE(b) (((b) + SLI_SUB_PAGE_MASK) & ~SLI_SUB_PAGE_MASK)
49 #define SLI4_BMBX_TIMEOUT_MSEC 30000
50 #define SLI4_FW_READY_TIMEOUT_MSEC 30000
52 static inline uint32_t
53 sli_page_count(size_t bytes, uint32_t page_size)
55 uint32_t mask = page_size - 1;
78 return (bytes + mask) >> shift;
81 /*************************************************************************
82 * Common PCI configuration space register definitions
85 #define SLI4_PCI_CLASS_REVISION 0x0008 /** register offset */
86 #define SLI4_PCI_REV_ID_SHIFT 0
87 #define SLI4_PCI_REV_ID_MASK 0xff
88 #define SLI4_PCI_CLASS_SHIFT 8
89 #define SLI4_PCI_CLASS_MASK 0xfff
91 #define SLI4_PCI_SOFT_RESET_CSR 0x005c /** register offset */
92 #define SLI4_PCI_SOFT_RESET_MASK 0x0080
94 /*************************************************************************
95 * Common SLI-4 register offsets and field definitions
99 * @brief SLI_INTF - SLI Interface Definition Register
101 #define SLI4_INTF_REG 0x0058 /** register offset */
102 #define SLI4_INTF_VALID_SHIFT 29
103 #define SLI4_INTF_VALID_MASK 0x7
104 #define SLI4_INTF_VALID 0x6
105 #define SLI4_INTF_IF_TYPE_SHIFT 12
106 #define SLI4_INTF_IF_TYPE_MASK 0xf
107 #define SLI4_INTF_SLI_FAMILY_SHIFT 8
108 #define SLI4_INTF_SLI_FAMILY_MASK 0xf
109 #define SLI4_INTF_SLI_REVISION_SHIFT 4
110 #define SLI4_INTF_SLI_REVISION_MASK 0xf
111 #define SLI4_FAMILY_CHECK_ASIC_TYPE 0xf
113 #define SLI4_IF_TYPE_BE3_SKH_PF 0
114 #define SLI4_IF_TYPE_BE3_SKH_VF 1
115 #define SLI4_IF_TYPE_LANCER_FC_ETH 2
116 #define SLI4_IF_TYPE_LANCER_RDMA 3
117 #define SLI4_MAX_IF_TYPES 4
120 * @brief ASIC_ID - SLI ASIC Type and Revision Register
122 #define SLI4_ASIC_ID_REG 0x009c /* register offset */
123 #define SLI4_ASIC_REV_SHIFT 0
124 #define SLI4_ASIC_REV_MASK 0xf
125 #define SLI4_ASIC_VER_SHIFT 4
126 #define SLI4_ASIC_VER_MASK 0xf
127 #define SLI4_ASIC_GEN_SHIFT 8
128 #define SLI4_ASIC_GEN_MASK 0xff
129 #define SLI4_ASIC_GEN_BE2 0x00
130 #define SLI4_ASIC_GEN_BE3 0x03
131 #define SLI4_ASIC_GEN_SKYHAWK 0x04
132 #define SLI4_ASIC_GEN_CORSAIR 0x05
133 #define SLI4_ASIC_GEN_LANCER 0x0b
136 * @brief BMBX - Bootstrap Mailbox Register
138 #define SLI4_BMBX_REG 0x0160 /* register offset */
139 #define SLI4_BMBX_MASK_HI 0x3
140 #define SLI4_BMBX_MASK_LO 0xf
141 #define SLI4_BMBX_RDY BIT(0)
142 #define SLI4_BMBX_HI BIT(1)
143 #define SLI4_BMBX_WRITE_HI(r) ((ocs_addr32_hi(r) & ~SLI4_BMBX_MASK_HI) | \
145 #define SLI4_BMBX_WRITE_LO(r) (((ocs_addr32_hi(r) & SLI4_BMBX_MASK_HI) << 30) | \
146 (((r) & ~SLI4_BMBX_MASK_LO) >> 2))
148 #define SLI4_BMBX_SIZE 256
151 * @brief EQCQ_DOORBELL - EQ and CQ Doorbell Register
153 #define SLI4_EQCQ_DOORBELL_REG 0x120
154 #define SLI4_EQCQ_DOORBELL_CI BIT(9)
155 #define SLI4_EQCQ_DOORBELL_QT BIT(10)
156 #define SLI4_EQCQ_DOORBELL_ARM BIT(29)
157 #define SLI4_EQCQ_DOORBELL_SE BIT(31)
158 #define SLI4_EQCQ_NUM_SHIFT 16
159 #define SLI4_EQCQ_NUM_MASK 0x01ff
160 #define SLI4_EQCQ_EQ_ID_MASK 0x3fff
161 #define SLI4_EQCQ_CQ_ID_MASK 0x7fff
162 #define SLI4_EQCQ_EQ_ID_MASK_LO 0x01ff
163 #define SLI4_EQCQ_CQ_ID_MASK_LO 0x03ff
164 #define SLI4_EQCQ_EQCQ_ID_MASK_HI 0xf800
167 * @brief SLIPORT_CONTROL - SLI Port Control Register
169 #define SLI4_SLIPORT_CONTROL_REG 0x0408
170 #define SLI4_SLIPORT_CONTROL_END BIT(30)
171 #define SLI4_SLIPORT_CONTROL_LITTLE_ENDIAN (0)
172 #define SLI4_SLIPORT_CONTROL_BIG_ENDIAN BIT(30)
173 #define SLI4_SLIPORT_CONTROL_IP BIT(27)
174 #define SLI4_SLIPORT_CONTROL_IDIS BIT(22)
175 #define SLI4_SLIPORT_CONTROL_FDD BIT(31)
178 * @brief SLI4_SLIPORT_ERROR1 - SLI Port Error Register
180 #define SLI4_SLIPORT_ERROR1 0x040c
183 * @brief SLI4_SLIPORT_ERROR2 - SLI Port Error Register
185 #define SLI4_SLIPORT_ERROR2 0x0410
188 * @brief User error registers
190 #define SLI4_UERR_STATUS_LOW_REG 0xA0
191 #define SLI4_UERR_STATUS_HIGH_REG 0xA4
192 #define SLI4_UERR_MASK_LOW_REG 0xA8
193 #define SLI4_UERR_MASK_HIGH_REG 0xAC
196 * @brief Registers for generating software UE (BE3)
198 #define SLI4_SW_UE_CSR1 0x138
199 #define SLI4_SW_UE_CSR2 0x1FFFC
202 * @brief Registers for generating software UE (Skyhawk)
204 #define SLI4_SW_UE_REG 0x5C /* register offset */
206 static inline uint32_t sli_eq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
209 #if BYTE_ORDER == LITTLE_ENDIAN
212 ci:1, /* clear interrupt */
213 qt:1, /* queue type */
219 } * eq_doorbell = (void *)®
221 #error big endian version not defined
224 eq_doorbell->eq_id_lo = id & SLI4_EQCQ_EQ_ID_MASK_LO;
225 eq_doorbell->qt = 1; /* EQ is type 1 (section 2.2.3.3 SLI Arch) */
226 eq_doorbell->eq_id_hi = (id >> 9) & 0x1f;
227 eq_doorbell->number_popped = n_popped;
228 eq_doorbell->arm = arm;
229 eq_doorbell->ci = TRUE;
234 static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
237 #if BYTE_ORDER == LITTLE_ENDIAN
239 uint32_t cq_id_lo:10,
240 qt:1, /* queue type */
246 } * cq_doorbell = (void *)®
248 #error big endian version not defined
251 cq_doorbell->cq_id_lo = id & SLI4_EQCQ_CQ_ID_MASK_LO;
252 cq_doorbell->qt = 0; /* CQ is type 0 (section 2.2.3.3 SLI Arch) */
253 cq_doorbell->cq_id_hi = (id >> 10) & 0x1f;
254 cq_doorbell->number_popped = n_popped;
255 cq_doorbell->arm = arm;
261 * @brief MQ_DOORBELL - MQ Doorbell Register
263 #define SLI4_MQ_DOORBELL_REG 0x0140 /* register offset */
264 #define SLI4_MQ_DOORBELL_NUM_SHIFT 16
265 #define SLI4_MQ_DOORBELL_NUM_MASK 0x3fff
266 #define SLI4_MQ_DOORBELL_ID_MASK 0xffff
267 #define SLI4_MQ_DOORBELL(n, i) ((((n) & SLI4_MQ_DOORBELL_NUM_MASK) << SLI4_MQ_DOORBELL_NUM_SHIFT) | \
268 ((i) & SLI4_MQ_DOORBELL_ID_MASK))
271 * @brief RQ_DOORBELL - RQ Doorbell Register
273 #define SLI4_RQ_DOORBELL_REG 0x0a0 /* register offset */
274 #define SLI4_RQ_DOORBELL_NUM_SHIFT 16
275 #define SLI4_RQ_DOORBELL_NUM_MASK 0x3fff
276 #define SLI4_RQ_DOORBELL_ID_MASK 0xffff
277 #define SLI4_RQ_DOORBELL(n, i) ((((n) & SLI4_RQ_DOORBELL_NUM_MASK) << SLI4_RQ_DOORBELL_NUM_SHIFT) | \
278 ((i) & SLI4_RQ_DOORBELL_ID_MASK))
281 * @brief WQ_DOORBELL - WQ Doorbell Register
283 #define SLI4_IO_WQ_DOORBELL_REG 0x040 /* register offset */
284 #define SLI4_WQ_DOORBELL_IDX_SHIFT 16
285 #define SLI4_WQ_DOORBELL_IDX_MASK 0x00ff
286 #define SLI4_WQ_DOORBELL_NUM_SHIFT 24
287 #define SLI4_WQ_DOORBELL_NUM_MASK 0x00ff
288 #define SLI4_WQ_DOORBELL_ID_MASK 0xffff
289 #define SLI4_WQ_DOORBELL(n, x, i) ((((n) & SLI4_WQ_DOORBELL_NUM_MASK) << SLI4_WQ_DOORBELL_NUM_SHIFT) | \
290 (((x) & SLI4_WQ_DOORBELL_IDX_MASK) << SLI4_WQ_DOORBELL_IDX_SHIFT) | \
291 ((i) & SLI4_WQ_DOORBELL_ID_MASK))
294 * @brief SLIPORT_SEMAPHORE - SLI Port Host and Port Status Register
296 #define SLI4_PORT_SEMAPHORE_REG_0 0x00ac /** register offset Interface Type 0 + 1 */
297 #define SLI4_PORT_SEMAPHORE_REG_1 0x0180 /** register offset Interface Type 0 + 1 */
298 #define SLI4_PORT_SEMAPHORE_REG_23 0x0400 /** register offset Interface Type 2 + 3 */
299 #define SLI4_PORT_SEMAPHORE_PORT_MASK 0x0000ffff
300 #define SLI4_PORT_SEMAPHORE_PORT(r) ((r) & SLI4_PORT_SEMAPHORE_PORT_MASK)
301 #define SLI4_PORT_SEMAPHORE_HOST_MASK 0x00ff0000
302 #define SLI4_PORT_SEMAPHORE_HOST_SHIFT 16
303 #define SLI4_PORT_SEMAPHORE_HOST(r) (((r) & SLI4_PORT_SEMAPHORE_HOST_MASK) >> \
304 SLI4_PORT_SEMAPHORE_HOST_SHIFT)
305 #define SLI4_PORT_SEMAPHORE_SCR2 BIT(26) /** scratch area 2 */
306 #define SLI4_PORT_SEMAPHORE_SCR1 BIT(27) /** scratch area 1 */
307 #define SLI4_PORT_SEMAPHORE_IPC BIT(28) /** IP conflict */
308 #define SLI4_PORT_SEMAPHORE_NIP BIT(29) /** no IP address */
309 #define SLI4_PORT_SEMAPHORE_SFI BIT(30) /** secondary firmware image used */
310 #define SLI4_PORT_SEMAPHORE_PERR BIT(31) /** POST fatal error */
312 #define SLI4_PORT_SEMAPHORE_STATUS_POST_READY 0xc000
313 #define SLI4_PORT_SEMAPHORE_STATUS_UNRECOV_ERR 0xf000
314 #define SLI4_PORT_SEMAPHORE_STATUS_ERR_MASK 0xf000
315 #define SLI4_PORT_SEMAPHORE_IN_ERR(r) (SLI4_PORT_SEMAPHORE_STATUS_UNRECOV_ERR == ((r) & \
316 SLI4_PORT_SEMAPHORE_STATUS_ERR_MASK))
319 * @brief SLIPORT_STATUS - SLI Port Status Register
322 #define SLI4_PORT_STATUS_REG_23 0x0404 /** register offset Interface Type 2 + 3 */
323 #define SLI4_PORT_STATUS_FDP BIT(21) /** function specific dump present */
324 #define SLI4_PORT_STATUS_RDY BIT(23) /** ready */
325 #define SLI4_PORT_STATUS_RN BIT(24) /** reset needed */
326 #define SLI4_PORT_STATUS_DIP BIT(25) /** dump present */
327 #define SLI4_PORT_STATUS_OTI BIT(29) /** over temp indicator */
328 #define SLI4_PORT_STATUS_END BIT(30) /** endianness */
329 #define SLI4_PORT_STATUS_ERR BIT(31) /** SLI port error */
330 #define SLI4_PORT_STATUS_READY(r) ((r) & SLI4_PORT_STATUS_RDY)
331 #define SLI4_PORT_STATUS_ERROR(r) ((r) & SLI4_PORT_STATUS_ERR)
332 #define SLI4_PORT_STATUS_DUMP_PRESENT(r) ((r) & SLI4_PORT_STATUS_DIP)
333 #define SLI4_PORT_STATUS_FDP_PRESENT(r) ((r) & SLI4_PORT_STATUS_FDP)
335 #define SLI4_PHSDEV_CONTROL_REG_23 0x0414 /** register offset Interface Type 2 + 3 */
336 #define SLI4_PHYDEV_CONTROL_DRST BIT(0) /** physical device reset */
337 #define SLI4_PHYDEV_CONTROL_FRST BIT(1) /** firmware reset */
338 #define SLI4_PHYDEV_CONTROL_DD BIT(2) /** diagnostic dump */
339 #define SLI4_PHYDEV_CONTROL_FRL_MASK 0x000000f0
340 #define SLI4_PHYDEV_CONTROL_FRL_SHIFT 4
341 #define SLI4_PHYDEV_CONTROL_FRL(r) (((r) & SLI4_PHYDEV_CONTROL_FRL_MASK) >> \
342 SLI4_PHYDEV_CONTROL_FRL_SHIFT_SHIFT)
344 /*************************************************************************
345 * SLI-4 mailbox command formats and definitions
348 typedef struct sli4_mbox_command_header_s {
349 #if BYTE_ORDER == LITTLE_ENDIAN
352 status:16; /** Port writes to indicate success / fail */
354 #error big endian version not defined
356 } sli4_mbox_command_header_t;
358 #define SLI4_MBOX_COMMAND_CONFIG_LINK 0x07
359 #define SLI4_MBOX_COMMAND_DUMP 0x17
360 #define SLI4_MBOX_COMMAND_DOWN_LINK 0x06
361 #define SLI4_MBOX_COMMAND_INIT_LINK 0x05
362 #define SLI4_MBOX_COMMAND_INIT_VFI 0xa3
363 #define SLI4_MBOX_COMMAND_INIT_VPI 0xa4
364 #define SLI4_MBOX_COMMAND_POST_XRI 0xa7
365 #define SLI4_MBOX_COMMAND_RELEASE_XRI 0xac
366 #define SLI4_MBOX_COMMAND_READ_CONFIG 0x0b
367 #define SLI4_MBOX_COMMAND_READ_STATUS 0x0e
368 #define SLI4_MBOX_COMMAND_READ_NVPARMS 0x02
369 #define SLI4_MBOX_COMMAND_READ_REV 0x11
370 #define SLI4_MBOX_COMMAND_READ_LNK_STAT 0x12
371 #define SLI4_MBOX_COMMAND_READ_SPARM64 0x8d
372 #define SLI4_MBOX_COMMAND_READ_TOPOLOGY 0x95
373 #define SLI4_MBOX_COMMAND_REG_FCFI 0xa0
374 #define SLI4_MBOX_COMMAND_REG_FCFI_MRQ 0xaf
375 #define SLI4_MBOX_COMMAND_REG_RPI 0x93
376 #define SLI4_MBOX_COMMAND_REG_RX_RQ 0xa6
377 #define SLI4_MBOX_COMMAND_REG_VFI 0x9f
378 #define SLI4_MBOX_COMMAND_REG_VPI 0x96
379 #define SLI4_MBOX_COMMAND_REQUEST_FEATURES 0x9d
380 #define SLI4_MBOX_COMMAND_SLI_CONFIG 0x9b
381 #define SLI4_MBOX_COMMAND_UNREG_FCFI 0xa2
382 #define SLI4_MBOX_COMMAND_UNREG_RPI 0x14
383 #define SLI4_MBOX_COMMAND_UNREG_VFI 0xa1
384 #define SLI4_MBOX_COMMAND_UNREG_VPI 0x97
385 #define SLI4_MBOX_COMMAND_WRITE_NVPARMS 0x03
386 #define SLI4_MBOX_COMMAND_CONFIG_AUTO_XFER_RDY 0xAD
387 #define SLI4_MBOX_COMMAND_CONFIG_AUTO_XFER_RDY_HP 0xAE
389 #define SLI4_MBOX_STATUS_SUCCESS 0x0000
390 #define SLI4_MBOX_STATUS_FAILURE 0x0001
391 #define SLI4_MBOX_STATUS_RPI_NOT_REG 0x1400
394 * @brief Buffer Descriptor Entry (BDE)
396 typedef struct sli4_bde_s {
397 #if BYTE_ORDER == LITTLE_ENDIAN
398 uint32_t buffer_length:24,
402 uint32_t buffer_address_low;
403 uint32_t buffer_address_high;
410 uint32_t sgl_segment_address_low;
411 uint32_t sgl_segment_address_high;
415 #error big endian version not defined
419 #define SLI4_BDE_TYPE_BDE_64 0x00 /** Generic 64-bit data */
420 #define SLI4_BDE_TYPE_BDE_IMM 0x01 /** Immediate data */
421 #define SLI4_BDE_TYPE_BLP 0x40 /** Buffer List Pointer */
424 * @brief Scatter-Gather Entry (SGE)
426 typedef struct sli4_sge_s {
427 #if BYTE_ORDER == LITTLE_ENDIAN
428 uint32_t buffer_address_high;
429 uint32_t buffer_address_low;
430 uint32_t data_offset:27,
433 uint32_t buffer_length;
435 #error big endian version not defined
440 * @brief T10 DIF Scatter-Gather Entry (SGE)
442 typedef struct sli4_dif_sge_s {
443 #if BYTE_ORDER == LITTLE_ENDIAN
444 uint32_t buffer_address_high;
445 uint32_t buffer_address_low;
451 #error big endian version not defined
456 * @brief T10 DIF Seed Scatter-Gather Entry (SGE)
458 typedef struct sli4_diseed_sge_s {
459 #if BYTE_ORDER == LITTLE_ENDIAN
460 uint32_t ref_tag_cmp;
461 uint32_t ref_tag_repl;
462 uint32_t app_tag_repl:16,
475 uint32_t app_tag_cmp:16,
485 #error big endian version not defined
490 * @brief List Segment Pointer Scatter-Gather Entry (SGE)
492 typedef struct sli4_lsp_sge_s {
493 #if BYTE_ORDER == LITTLE_ENDIAN
494 uint32_t buffer_address_high;
495 uint32_t buffer_address_low;
499 uint32_t segment_length:24,
502 #error big endian version not defined
506 #define SLI4_SGE_MAX_RESERVED 3
508 #define SLI4_SGE_DIF_OP_IN_NODIF_OUT_CRC 0x00
509 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_NODIF 0x01
510 #define SLI4_SGE_DIF_OP_IN_NODIF_OUT_CHKSUM 0x02
511 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_NODIF 0x03
512 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_CRC 0x04
513 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_CHKSUM 0x05
514 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_CHKSUM 0x06
515 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_CRC 0x07
516 #define SLI4_SGE_DIF_OP_IN_RAW_OUT_RAW 0x08
518 #define SLI4_SGE_TYPE_DATA 0x00
519 #define SLI4_SGE_TYPE_CHAIN 0x03 /** Skyhawk only */
520 #define SLI4_SGE_TYPE_DIF 0x04 /** Data Integrity Field */
521 #define SLI4_SGE_TYPE_LSP 0x05 /** List Segment Pointer */
522 #define SLI4_SGE_TYPE_PEDIF 0x06 /** Post Encryption Engine DIF */
523 #define SLI4_SGE_TYPE_PESEED 0x07 /** Post Encryption Engine DIF Seed */
524 #define SLI4_SGE_TYPE_DISEED 0x08 /** DIF Seed */
525 #define SLI4_SGE_TYPE_ENC 0x09 /** Encryption */
526 #define SLI4_SGE_TYPE_ATM 0x0a /** DIF Application Tag Mask */
527 #define SLI4_SGE_TYPE_SKIP 0x0c /** SKIP */
529 #define OCS_MAX_SGE_SIZE 0x80000000 /* Maximum data allowed in a SGE */
534 typedef struct sli4_cmd_config_link_s {
535 sli4_mbox_command_header_t hdr;
536 #if BYTE_ORDER == LITTLE_ENDIAN
537 uint32_t maxbbc:8, /** Max buffer-to-buffer credit */
550 bbscn:4, /** buffer-to-buffer state change number */
551 cscn:1, /** configure BBSCN */
554 #error big endian version not defined
556 } sli4_cmd_config_link_t;
561 #define SLI4_WKI_TAG_SAT_TEM 0x1040
562 typedef struct sli4_cmd_dump4_s {
563 sli4_mbox_command_header_t hdr;
564 #if BYTE_ORDER == LITTLE_ENDIAN
567 uint32_t wki_selection:16,
570 uint32_t returned_byte_cnt;
571 uint32_t resp_data[59];
573 #error big endian version not defined
578 * @brief FW_INITIALIZE - initialize a SLI port
580 * @note This command uses a different format than all others.
583 extern const uint8_t sli4_fw_initialize[8];
586 * @brief FW_DEINITIALIZE - deinitialize a SLI port
588 * @note This command uses a different format than all others.
591 extern const uint8_t sli4_fw_deinitialize[8];
594 * @brief INIT_LINK - initialize the link for a FC/FCoE port
596 typedef struct sli4_cmd_init_link_flags_s {
599 #define FC_TOPOLOGY_FCAL 0
600 #define FC_TOPOLOGY_P2P 1
604 gen_loop_validity_check:1,
606 enable_topology_failover:1,
609 select_hightest_al_pa:1,
610 :16; /* pad to 32 bits */
611 } sli4_cmd_init_link_flags_t;
613 #define SLI4_INIT_LINK_F_LOOP_BACK BIT(0)
614 #define SLI4_INIT_LINK_F_UNFAIR BIT(6)
615 #define SLI4_INIT_LINK_F_NO_LIRP BIT(7)
616 #define SLI4_INIT_LINK_F_LOOP_VALID_CHK BIT(8)
617 #define SLI4_INIT_LINK_F_NO_LISA BIT(9)
618 #define SLI4_INIT_LINK_F_FAIL_OVER BIT(10)
619 #define SLI4_INIT_LINK_F_NO_AUTOSPEED BIT(11)
620 #define SLI4_INIT_LINK_F_PICK_HI_ALPA BIT(15)
622 #define SLI4_INIT_LINK_F_P2P_ONLY 1
623 #define SLI4_INIT_LINK_F_FCAL_ONLY 2
625 #define SLI4_INIT_LINK_F_FCAL_FAIL_OVER 0
626 #define SLI4_INIT_LINK_F_P2P_FAIL_OVER 1
628 typedef struct sli4_cmd_init_link_s {
629 sli4_mbox_command_header_t hdr;
630 #if BYTE_ORDER == LITTLE_ENDIAN
631 uint32_t selective_reset_al_pa:8,
633 sli4_cmd_init_link_flags_t link_flags;
634 uint32_t link_speed_selection_code;
635 #define FC_LINK_SPEED_1G 1
636 #define FC_LINK_SPEED_2G 2
637 #define FC_LINK_SPEED_AUTO_1_2 3
638 #define FC_LINK_SPEED_4G 4
639 #define FC_LINK_SPEED_AUTO_4_1 5
640 #define FC_LINK_SPEED_AUTO_4_2 6
641 #define FC_LINK_SPEED_AUTO_4_2_1 7
642 #define FC_LINK_SPEED_8G 8
643 #define FC_LINK_SPEED_AUTO_8_1 9
644 #define FC_LINK_SPEED_AUTO_8_2 10
645 #define FC_LINK_SPEED_AUTO_8_2_1 11
646 #define FC_LINK_SPEED_AUTO_8_4 12
647 #define FC_LINK_SPEED_AUTO_8_4_1 13
648 #define FC_LINK_SPEED_AUTO_8_4_2 14
649 #define FC_LINK_SPEED_10G 16
650 #define FC_LINK_SPEED_16G 17
651 #define FC_LINK_SPEED_AUTO_16_8_4 18
652 #define FC_LINK_SPEED_AUTO_16_8 19
653 #define FC_LINK_SPEED_32G 20
654 #define FC_LINK_SPEED_AUTO_32_16_8 21
655 #define FC_LINK_SPEED_AUTO_32_16 22
657 #error big endian version not defined
659 } sli4_cmd_init_link_t;
662 * @brief INIT_VFI - initialize the VFI resource
664 typedef struct sli4_cmd_init_vfi_s {
665 sli4_mbox_command_header_t hdr;
666 #if BYTE_ORDER == LITTLE_ENDIAN
681 #error big endian version not defined
683 } sli4_cmd_init_vfi_t;
686 * @brief INIT_VPI - initialize the VPI resource
688 typedef struct sli4_cmd_init_vpi_s {
689 sli4_mbox_command_header_t hdr;
690 #if BYTE_ORDER == LITTLE_ENDIAN
694 #error big endian version not defined
696 } sli4_cmd_init_vpi_t;
699 * @brief POST_XRI - post XRI resources to the SLI Port
701 typedef struct sli4_cmd_post_xri_s {
702 sli4_mbox_command_header_t hdr;
703 #if BYTE_ORDER == LITTLE_ENDIAN
704 uint32_t xri_base:16,
711 #error big endian version not defined
713 } sli4_cmd_post_xri_t;
716 * @brief RELEASE_XRI - Release XRI resources from the SLI Port
718 typedef struct sli4_cmd_release_xri_s {
719 sli4_mbox_command_header_t hdr;
720 #if BYTE_ORDER == LITTLE_ENDIAN
721 uint32_t released_xri_count:5,
726 uint32_t xri_tag0:16,
730 #error big endian version not defined
732 } sli4_cmd_release_xri_t;
735 * @brief READ_CONFIG - read SLI port configuration parameters
737 typedef struct sli4_cmd_read_config_s {
738 sli4_mbox_command_header_t hdr;
739 } sli4_cmd_read_config_t;
741 typedef struct sli4_res_read_config_s {
742 sli4_mbox_command_header_t hdr;
743 #if BYTE_ORDER == LITTLE_ENDIAN
745 ext:1; /** Resource Extents */
756 uint32_t lmt:16, /** Link Module Type */
760 uint32_t xri_base:16,
762 uint32_t rpi_base:16,
764 uint32_t vpi_base:16,
766 uint32_t vfi_base:16,
770 uint32_t rq_count:16,
772 uint32_t wq_count:16,
776 #error big endian version not defined
778 } sli4_res_read_config_t;
780 #define SLI4_READ_CFG_TOPO_FCOE 0x0 /** FCoE topology */
781 #define SLI4_READ_CFG_TOPO_FC 0x1 /** FC topology unknown */
782 #define SLI4_READ_CFG_TOPO_FC_DA 0x2 /** FC Direct Attach (non FC-AL) topology */
783 #define SLI4_READ_CFG_TOPO_FC_AL 0x3 /** FC-AL topology */
786 * @brief READ_NVPARMS - read SLI port configuration parameters
788 typedef struct sli4_cmd_read_nvparms_s {
789 sli4_mbox_command_header_t hdr;
790 #if BYTE_ORDER == LITTLE_ENDIAN
797 uint32_t hard_alpa:8,
800 #error big endian version not defined
802 } sli4_cmd_read_nvparms_t;
805 * @brief WRITE_NVPARMS - write SLI port configuration parameters
807 typedef struct sli4_cmd_write_nvparms_s {
808 sli4_mbox_command_header_t hdr;
809 #if BYTE_ORDER == LITTLE_ENDIAN
816 uint32_t hard_alpa:8,
819 #error big endian version not defined
821 } sli4_cmd_write_nvparms_t;
824 * @brief READ_REV - read the Port revision levels
826 typedef struct sli4_cmd_read_rev_s {
827 sli4_mbox_command_header_t hdr;
828 #if BYTE_ORDER == LITTLE_ENDIAN
836 uint32_t first_hw_revision;
837 uint32_t second_hw_revision;
839 uint32_t third_hw_revision;
840 uint32_t fc_ph_low:8,
843 feature_level_high:8;
845 uint32_t first_fw_id;
846 char first_fw_name[16];
847 uint32_t second_fw_id;
848 char second_fw_name[16];
850 uint32_t available_length:24,
852 uint32_t physical_address_low;
853 uint32_t physical_address_high;
854 uint32_t returned_vpd_length;
855 uint32_t actual_vpd_length;
857 #error big endian version not defined
859 } sli4_cmd_read_rev_t;
862 * @brief READ_SPARM64 - read the Port service parameters
864 typedef struct sli4_cmd_read_sparm64_s {
865 sli4_mbox_command_header_t hdr;
866 #if BYTE_ORDER == LITTLE_ENDIAN
872 uint32_t port_name_start:16,
874 uint32_t node_name_start:16,
877 #error big endian version not defined
879 } sli4_cmd_read_sparm64_t;
881 #define SLI4_READ_SPARM64_VPI_DEFAULT 0
882 #define SLI4_READ_SPARM64_VPI_SPECIAL UINT16_MAX
884 #define SLI4_READ_SPARM64_WWPN_OFFSET (4 * sizeof(uint32_t))
885 #define SLI4_READ_SPARM64_WWNN_OFFSET (SLI4_READ_SPARM64_WWPN_OFFSET + sizeof(uint64_t))
887 typedef struct sli4_port_state_s {
888 #if BYTE_ORDER == LITTLE_ENDIAN
889 uint32_t nx_port_recv_state:2,
890 nx_port_trans_state:2,
891 nx_port_state_machine:4,
897 #error big endian version not defined
902 * @brief READ_TOPOLOGY - read the link event information
904 typedef struct sli4_cmd_read_topology_s {
905 sli4_mbox_command_header_t hdr;
906 #if BYTE_ORDER == LITTLE_ENDIAN
908 uint32_t attention_type:8,
916 sli4_bde_t bde_loop_map;
917 sli4_port_state_t link_down;
918 sli4_port_state_t link_current;
928 uint32_t acquired_al_pa:8,
932 uint32_t initial_n_port_id:24,
935 #error big endian version not defined
937 } sli4_cmd_read_topology_t;
939 #define SLI4_MIN_LOOP_MAP_BYTES 128
941 #define SLI4_READ_TOPOLOGY_LINK_UP 0x1
942 #define SLI4_READ_TOPOLOGY_LINK_DOWN 0x2
943 #define SLI4_READ_TOPOLOGY_LINK_NO_ALPA 0x3
945 #define SLI4_READ_TOPOLOGY_UNKNOWN 0x0
946 #define SLI4_READ_TOPOLOGY_NPORT 0x1
947 #define SLI4_READ_TOPOLOGY_FC_AL 0x2
949 #define SLI4_READ_TOPOLOGY_SPEED_NONE 0x00
950 #define SLI4_READ_TOPOLOGY_SPEED_1G 0x04
951 #define SLI4_READ_TOPOLOGY_SPEED_2G 0x08
952 #define SLI4_READ_TOPOLOGY_SPEED_4G 0x10
953 #define SLI4_READ_TOPOLOGY_SPEED_8G 0x20
954 #define SLI4_READ_TOPOLOGY_SPEED_10G 0x40
955 #define SLI4_READ_TOPOLOGY_SPEED_16G 0x80
956 #define SLI4_READ_TOPOLOGY_SPEED_32G 0x90
959 * @brief REG_FCFI - activate a FC Forwarder
961 #define SLI4_CMD_REG_FCFI_NUM_RQ_CFG 4
962 typedef struct sli4_cmd_reg_fcfi_s {
963 sli4_mbox_command_header_t hdr;
964 #if BYTE_ORDER == LITTLE_ENDIAN
965 uint32_t fcf_index:16,
972 uint32_t r_ctl_mask:8,
976 } rq_cfg[SLI4_CMD_REG_FCFI_NUM_RQ_CFG];
977 uint32_t vlan_tag:12,
981 #error big endian version not defined
983 } sli4_cmd_reg_fcfi_t;
985 #define SLI4_CMD_REG_FCFI_MRQ_NUM_RQ_CFG 4
986 #define SLI4_CMD_REG_FCFI_MRQ_MAX_NUM_RQ 32
987 #define SLI4_CMD_REG_FCFI_SET_FCFI_MODE 0
988 #define SLI4_CMD_REG_FCFI_SET_MRQ_MODE 1
990 typedef struct sli4_cmd_reg_fcfi_mrq_s {
991 sli4_mbox_command_header_t hdr;
992 #if BYTE_ORDER == LITTLE_ENDIAN
993 uint32_t fcf_index:16,
1003 uint32_t r_ctl_mask:8,
1007 } rq_cfg[SLI4_CMD_REG_FCFI_MRQ_NUM_RQ_CFG];
1009 uint32_t vlan_tag:12,
1014 uint32_t num_mrq_pairs:8,
1015 mrq_filter_bitmask:4,
1016 rq_selection_policy:4,
1019 } sli4_cmd_reg_fcfi_mrq_t;
1022 * @brief REG_RPI - register a Remote Port Indicator
1024 typedef struct sli4_cmd_reg_rpi_s {
1025 sli4_mbox_command_header_t hdr;
1026 #if BYTE_ORDER == LITTLE_ENDIAN
1029 uint32_t remote_n_port_id:24,
1041 #error big endian version not defined
1043 } sli4_cmd_reg_rpi_t;
1044 #define SLI4_REG_RPI_BUF_LEN 0x70
1047 * @brief REG_VFI - register a Virtual Fabric Indicator
1049 typedef struct sli4_cmd_reg_vfi_s {
1050 sli4_mbox_command_header_t hdr;
1051 #if BYTE_ORDER == LITTLE_ENDIAN
1058 vpi:16; /* vp=TRUE */
1059 uint8_t wwpn[8]; /* vp=TRUE */
1060 sli4_bde_t sparm; /* either FLOGI or PLOGI */
1063 uint32_t local_n_port_id:24, /* vp=TRUE */
1066 #error big endian version not defined
1068 } sli4_cmd_reg_vfi_t;
1071 * @brief REG_VPI - register a Virtual Port Indicator
1073 typedef struct sli4_cmd_reg_vpi_s {
1074 sli4_mbox_command_header_t hdr;
1075 #if BYTE_ORDER == LITTLE_ENDIAN
1077 uint32_t local_n_port_id:24,
1085 #error big endian version not defined
1087 } sli4_cmd_reg_vpi_t;
1090 * @brief REQUEST_FEATURES - request / query SLI features
1093 #if BYTE_ORDER == LITTLE_ENDIAN
1095 uint32_t iaab:1, /** inhibit auto-ABTS originator */
1096 npiv:1, /** NPIV support */
1097 dif:1, /** DIF/DIX support */
1098 vf:1, /** virtual fabric support */
1099 fcpi:1, /** FCP initiator support */
1100 fcpt:1, /** FCP target support */
1101 fcpc:1, /** combined FCP initiator/target */
1103 rqd:1, /** recovery qualified delay */
1104 iaar:1, /** inhibit auto-ABTS responder */
1105 hlm:1, /** High Login Mode */
1106 perfh:1, /** performance hints */
1107 rxseq:1, /** RX Sequence Coalescing */
1108 rxri:1, /** Release XRI variant of Coalescing */
1109 dcl2:1, /** Disable Class 2 */
1110 rsco:1, /** Receive Sequence Coalescing Optimizations */
1111 mrqp:1, /** Multi RQ Pair Mode Support */
1116 #error big endian version not defined
1120 typedef struct sli4_cmd_request_features_s {
1121 sli4_mbox_command_header_t hdr;
1122 #if BYTE_ORDER == LITTLE_ENDIAN
1126 #error big endian version not defined
1128 sli4_features_t command;
1129 sli4_features_t response;
1130 } sli4_cmd_request_features_t;
1133 * @brief SLI_CONFIG - submit a configuration command to Port
1135 * Command is either embedded as part of the payload (embed) or located
1136 * in a separate memory buffer (mem)
1139 typedef struct sli4_sli_config_pmd_s {
1140 uint32_t address_low;
1141 uint32_t address_high;
1144 } sli4_sli_config_pmd_t;
1146 typedef struct sli4_cmd_sli_config_s {
1147 sli4_mbox_command_header_t hdr;
1148 #if BYTE_ORDER == LITTLE_ENDIAN
1153 uint32_t payload_length;
1158 uint8_t embed[58 * sizeof(uint32_t)];
1159 sli4_sli_config_pmd_t mem;
1162 #error big endian version not defined
1164 } sli4_cmd_sli_config_t;
1167 * @brief READ_STATUS - read tx/rx status of a particular port
1171 typedef struct sli4_cmd_read_status_s {
1172 sli4_mbox_command_header_t hdr;
1173 #if BYTE_ORDER == LITTLE_ENDIAN
1177 uint32_t transmit_kbyte_count;
1178 uint32_t receive_kbyte_count;
1179 uint32_t transmit_frame_count;
1180 uint32_t receive_frame_count;
1181 uint32_t transmit_sequence_count;
1182 uint32_t receive_sequence_count;
1183 uint32_t total_exchanges_originator;
1184 uint32_t total_exchanges_responder;
1185 uint32_t receive_p_bsy_count;
1186 uint32_t receive_f_bsy_count;
1187 uint32_t dropped_frames_due_to_no_rq_buffer_count;
1188 uint32_t empty_rq_timeout_count;
1189 uint32_t dropped_frames_due_to_no_xri_count;
1190 uint32_t empty_xri_pool_count;
1193 #error big endian version not defined
1195 } sli4_cmd_read_status_t;
1198 * @brief READ_LNK_STAT - read link status of a particular port
1202 typedef struct sli4_cmd_read_link_stats_s {
1203 sli4_mbox_command_header_t hdr;
1204 #if BYTE_ORDER == LITTLE_ENDIAN
1230 uint32_t link_failure_error_count;
1231 uint32_t loss_of_sync_error_count;
1232 uint32_t loss_of_signal_error_count;
1233 uint32_t primitive_sequence_error_count;
1234 uint32_t invalid_transmission_word_error_count;
1235 uint32_t crc_error_count;
1236 uint32_t primitive_sequence_event_timeout_count;
1237 uint32_t elastic_buffer_overrun_error_count;
1238 uint32_t arbitration_fc_al_timout_count;
1239 uint32_t advertised_receive_bufftor_to_buffer_credit;
1240 uint32_t current_receive_buffer_to_buffer_credit;
1241 uint32_t advertised_transmit_buffer_to_buffer_credit;
1242 uint32_t current_transmit_buffer_to_buffer_credit;
1243 uint32_t received_eofa_count;
1244 uint32_t received_eofdti_count;
1245 uint32_t received_eofni_count;
1246 uint32_t received_soff_count;
1247 uint32_t received_dropped_no_aer_count;
1248 uint32_t received_dropped_no_available_rpi_resources_count;
1249 uint32_t received_dropped_no_available_xri_resources_count;
1252 #error big endian version not defined
1254 } sli4_cmd_read_link_stats_t;
1257 * @brief Format a WQE with WQ_ID Association performance hint
1260 * PHWQ works by over-writing part of Word 10 in the WQE with the WQ ID.
1262 * @param entry Pointer to the WQE.
1263 * @param q_id Queue ID.
1268 sli_set_wq_id_association(void *entry, uint16_t q_id)
1270 uint32_t *wqe = entry;
1273 * Set Word 10, bit 0 to zero
1274 * Set Word 10, bits 15:1 to the WQ ID
1276 #if BYTE_ORDER == LITTLE_ENDIAN
1278 wqe[10] |= q_id << 1;
1280 #error big endian version not defined
1285 * @brief UNREG_FCFI - unregister a FCFI
1287 typedef struct sli4_cmd_unreg_fcfi_s {
1288 sli4_mbox_command_header_t hdr;
1290 #if BYTE_ORDER == LITTLE_ENDIAN
1294 #error big endian version not defined
1296 } sli4_cmd_unreg_fcfi_t;
1299 * @brief UNREG_RPI - unregister one or more RPI
1301 typedef struct sli4_cmd_unreg_rpi_s {
1302 sli4_mbox_command_header_t hdr;
1303 #if BYTE_ORDER == LITTLE_ENDIAN
1308 uint32_t destination_n_port_id:24,
1311 #error big endian version not defined
1313 } sli4_cmd_unreg_rpi_t;
1315 #define SLI4_UNREG_RPI_II_RPI 0x0
1316 #define SLI4_UNREG_RPI_II_VPI 0x1
1317 #define SLI4_UNREG_RPI_II_VFI 0x2
1318 #define SLI4_UNREG_RPI_II_FCFI 0x3
1321 * @brief UNREG_VFI - unregister one or more VFI
1323 typedef struct sli4_cmd_unreg_vfi_s {
1324 sli4_mbox_command_header_t hdr;
1325 #if BYTE_ORDER == LITTLE_ENDIAN
1331 #error big endian version not defined
1333 } sli4_cmd_unreg_vfi_t;
1335 #define SLI4_UNREG_VFI_II_VFI 0x0
1336 #define SLI4_UNREG_VFI_II_FCFI 0x3
1339 SLI4_UNREG_TYPE_PORT,
1340 SLI4_UNREG_TYPE_DOMAIN,
1341 SLI4_UNREG_TYPE_FCF,
1346 * @brief UNREG_VPI - unregister one or more VPI
1348 typedef struct sli4_cmd_unreg_vpi_s {
1349 sli4_mbox_command_header_t hdr;
1350 #if BYTE_ORDER == LITTLE_ENDIAN
1356 #error big endian version not defined
1358 } sli4_cmd_unreg_vpi_t;
1360 #define SLI4_UNREG_VPI_II_VPI 0x0
1361 #define SLI4_UNREG_VPI_II_VFI 0x2
1362 #define SLI4_UNREG_VPI_II_FCFI 0x3
1365 * @brief AUTO_XFER_RDY - Configure the auto-generate XFER-RDY feature.
1367 typedef struct sli4_cmd_config_auto_xfer_rdy_s {
1368 sli4_mbox_command_header_t hdr;
1369 #if BYTE_ORDER == LITTLE_ENDIAN
1371 uint32_t max_burst_len;
1373 #error big endian version not defined
1375 } sli4_cmd_config_auto_xfer_rdy_t;
1377 typedef struct sli4_cmd_config_auto_xfer_rdy_hp_s {
1378 sli4_mbox_command_header_t hdr;
1379 #if BYTE_ORDER == LITTLE_ENDIAN
1381 uint32_t max_burst_len;
1384 uint32_t block_size:16,
1387 #error big endian version not defined
1389 } sli4_cmd_config_auto_xfer_rdy_hp_t;
1391 /*************************************************************************
1392 * SLI-4 common configuration command formats and definitions
1395 #define SLI4_CFG_STATUS_SUCCESS 0x00
1396 #define SLI4_CFG_STATUS_FAILED 0x01
1397 #define SLI4_CFG_STATUS_ILLEGAL_REQUEST 0x02
1398 #define SLI4_CFG_STATUS_ILLEGAL_FIELD 0x03
1400 #define SLI4_MGMT_STATUS_FLASHROM_READ_FAILED 0xcb
1402 #define SLI4_CFG_ADD_STATUS_NO_STATUS 0x00
1403 #define SLI4_CFG_ADD_STATUS_INVALID_OPCODE 0x1e
1408 #define SLI4_SUBSYSTEM_COMMON 0x01
1409 #define SLI4_SUBSYSTEM_LOWLEVEL 0x0B
1410 #define SLI4_SUBSYSTEM_FCFCOE 0x0c
1411 #define SLI4_SUBSYSTEM_DMTF 0x11
1413 #define SLI4_OPC_LOWLEVEL_SET_WATCHDOG 0X36
1416 * Common opcode (OPC) values.
1418 #define SLI4_OPC_COMMON_FUNCTION_RESET 0x3d
1419 #define SLI4_OPC_COMMON_CREATE_CQ 0x0c
1420 #define SLI4_OPC_COMMON_CREATE_CQ_SET 0x1d
1421 #define SLI4_OPC_COMMON_DESTROY_CQ 0x36
1422 #define SLI4_OPC_COMMON_MODIFY_EQ_DELAY 0x29
1423 #define SLI4_OPC_COMMON_CREATE_EQ 0x0d
1424 #define SLI4_OPC_COMMON_DESTROY_EQ 0x37
1425 #define SLI4_OPC_COMMON_CREATE_MQ_EXT 0x5a
1426 #define SLI4_OPC_COMMON_DESTROY_MQ 0x35
1427 #define SLI4_OPC_COMMON_GET_CNTL_ATTRIBUTES 0x20
1428 #define SLI4_OPC_COMMON_NOP 0x21
1429 #define SLI4_OPC_COMMON_GET_RESOURCE_EXTENT_INFO 0x9a
1430 #define SLI4_OPC_COMMON_GET_SLI4_PARAMETERS 0xb5
1431 #define SLI4_OPC_COMMON_QUERY_FW_CONFIG 0x3a
1432 #define SLI4_OPC_COMMON_GET_PORT_NAME 0x4d
1434 #define SLI4_OPC_COMMON_WRITE_FLASHROM 0x07
1435 #define SLI4_OPC_COMMON_MANAGE_FAT 0x44
1436 #define SLI4_OPC_COMMON_READ_TRANSCEIVER_DATA 0x49
1437 #define SLI4_OPC_COMMON_GET_CNTL_ADDL_ATTRIBUTES 0x79
1438 #define SLI4_OPC_COMMON_GET_EXT_FAT_CAPABILITIES 0x7d
1439 #define SLI4_OPC_COMMON_SET_EXT_FAT_CAPABILITIES 0x7e
1440 #define SLI4_OPC_COMMON_EXT_FAT_CONFIGURE_SNAPSHOT 0x7f
1441 #define SLI4_OPC_COMMON_EXT_FAT_RETRIEVE_SNAPSHOT 0x80
1442 #define SLI4_OPC_COMMON_EXT_FAT_READ_STRING_TABLE 0x82
1443 #define SLI4_OPC_COMMON_GET_FUNCTION_CONFIG 0xa0
1444 #define SLI4_OPC_COMMON_GET_PROFILE_CONFIG 0xa4
1445 #define SLI4_OPC_COMMON_SET_PROFILE_CONFIG 0xa5
1446 #define SLI4_OPC_COMMON_GET_PROFILE_LIST 0xa6
1447 #define SLI4_OPC_COMMON_GET_ACTIVE_PROFILE 0xa7
1448 #define SLI4_OPC_COMMON_SET_ACTIVE_PROFILE 0xa8
1449 #define SLI4_OPC_COMMON_READ_OBJECT 0xab
1450 #define SLI4_OPC_COMMON_WRITE_OBJECT 0xac
1451 #define SLI4_OPC_COMMON_DELETE_OBJECT 0xae
1452 #define SLI4_OPC_COMMON_READ_OBJECT_LIST 0xad
1453 #define SLI4_OPC_COMMON_SET_DUMP_LOCATION 0xb8
1454 #define SLI4_OPC_COMMON_SET_FEATURES 0xbf
1455 #define SLI4_OPC_COMMON_GET_RECONFIG_LINK_INFO 0xc9
1456 #define SLI4_OPC_COMMON_SET_RECONFIG_LINK_ID 0xca
1459 * DMTF opcode (OPC) values.
1461 #define SLI4_OPC_DMTF_EXEC_CLP_CMD 0x01
1464 * @brief Generic Command Request header
1466 typedef struct sli4_req_hdr_s {
1467 #if BYTE_ORDER == LITTLE_ENDIAN
1472 uint32_t request_length;
1476 #error big endian version not defined
1481 * @brief Generic Command Response header
1483 typedef struct sli4_res_hdr_s {
1484 #if BYTE_ORDER == LITTLE_ENDIAN
1489 additional_status:8,
1491 uint32_t response_length;
1492 uint32_t actual_response_length;
1494 #error big endian version not defined
1499 * @brief COMMON_FUNCTION_RESET
1501 * Resets the Port, returning it to a power-on state. This configuration
1502 * command does not have a payload and should set/expect the lengths to
1505 typedef struct sli4_req_common_function_reset_s {
1507 } sli4_req_common_function_reset_t;
1509 typedef struct sli4_res_common_function_reset_s {
1511 } sli4_res_common_function_reset_t;
1514 * @brief COMMON_CREATE_CQ_V0
1516 * Create a Completion Queue.
1518 typedef struct sli4_req_common_create_cq_v0_s {
1520 #if BYTE_ORDER == LITTLE_ENDIAN
1521 uint32_t num_pages:16,
1539 } page_physical_address[0];
1541 #error big endian version not defined
1543 } sli4_req_common_create_cq_v0_t;
1546 * @brief COMMON_CREATE_CQ_V2
1548 * Create a Completion Queue.
1550 typedef struct sli4_req_common_create_cq_v2_s {
1552 #if BYTE_ORDER == LITTLE_ENDIAN
1553 uint32_t num_pages:16,
1568 uint32_t cqe_count:16,
1574 } page_physical_address[0];
1576 #error big endian version not defined
1578 } sli4_req_common_create_cq_v2_t;
1581 * @brief COMMON_CREATE_CQ_SET_V0
1583 * Create a set of Completion Queues.
1585 typedef struct sli4_req_common_create_cq_set_v0_s {
1587 #if BYTE_ORDER == LITTLE_ENDIAN
1588 uint32_t num_pages:16,
1600 uint32_t num_cq_req:16,
1607 } page_physical_address[0];
1609 #error big endian version not defined
1611 } sli4_req_common_create_cq_set_v0_t;
1616 #define SLI4_CQ_CNT_256 0
1617 #define SLI4_CQ_CNT_512 1
1618 #define SLI4_CQ_CNT_1024 2
1619 #define SLI4_CQ_CNT_LARGE 3
1621 #define SLI4_CQE_BYTES (4 * sizeof(uint32_t))
1623 #define SLI4_COMMON_CREATE_CQ_V2_MAX_PAGES 8
1626 * @brief Generic Common Create EQ/CQ/MQ/WQ/RQ Queue completion
1628 typedef struct sli4_res_common_create_queue_s {
1630 #if BYTE_ORDER == LITTLE_ENDIAN
1638 #error big endian version not defined
1640 } sli4_res_common_create_queue_t;
1642 typedef struct sli4_res_common_create_queue_set_s {
1644 #if BYTE_ORDER == LITTLE_ENDIAN
1648 #error big endian version not defined
1650 } sli4_res_common_create_queue_set_t;
1653 * @brief Common Destroy CQ
1655 typedef struct sli4_req_common_destroy_cq_s {
1657 #if BYTE_ORDER == LITTLE_ENDIAN
1661 #error big endian version not defined
1663 } sli4_req_common_destroy_cq_t;
1666 * @brief COMMON_MODIFY_EQ_DELAY
1668 * Modify the delay multiplier for EQs
1670 typedef struct sli4_req_common_modify_eq_delay_s {
1672 #if BYTE_ORDER == LITTLE_ENDIAN
1677 uint32_t delay_multiplier;
1678 } eq_delay_record[8];
1680 #error big endian version not defined
1682 } sli4_req_common_modify_eq_delay_t;
1685 * @brief COMMON_CREATE_EQ
1687 * Create an Event Queue.
1689 typedef struct sli4_req_common_create_eq_s {
1691 #if BYTE_ORDER == LITTLE_ENDIAN
1692 uint32_t num_pages:16,
1703 delay_multiplier:10,
1711 #error big endian version not defined
1713 } sli4_req_common_create_eq_t;
1715 #define SLI4_EQ_CNT_256 0
1716 #define SLI4_EQ_CNT_512 1
1717 #define SLI4_EQ_CNT_1024 2
1718 #define SLI4_EQ_CNT_2048 3
1719 #define SLI4_EQ_CNT_4096 4
1721 #define SLI4_EQE_SIZE_4 0
1722 #define SLI4_EQE_SIZE_16 1
1725 * @brief Common Destroy EQ
1727 typedef struct sli4_req_common_destroy_eq_s {
1729 #if BYTE_ORDER == LITTLE_ENDIAN
1733 #error big endian version not defined
1735 } sli4_req_common_destroy_eq_t;
1738 * @brief COMMON_CREATE_MQ_EXT
1740 * Create a Mailbox Queue; accommodate v0 and v1 forms.
1742 typedef struct sli4_req_common_create_mq_ext_s {
1744 #if BYTE_ORDER == LITTLE_ENDIAN
1745 uint32_t num_pages:16,
1747 uint32_t async_event_bitmap;
1748 uint32_t async_cq_id_v1:16,
1761 } page_physical_address[8];
1763 #error big endian version not defined
1765 } sli4_req_common_create_mq_ext_t;
1767 #define SLI4_MQE_SIZE_16 0x05
1768 #define SLI4_MQE_SIZE_32 0x06
1769 #define SLI4_MQE_SIZE_64 0x07
1770 #define SLI4_MQE_SIZE_128 0x08
1772 #define SLI4_ASYNC_EVT_LINK_STATE BIT(1)
1773 #define SLI4_ASYNC_EVT_FCOE_FIP BIT(2)
1774 #define SLI4_ASYNC_EVT_DCBX BIT(3)
1775 #define SLI4_ASYNC_EVT_ISCSI BIT(4)
1776 #define SLI4_ASYNC_EVT_GRP5 BIT(5)
1777 #define SLI4_ASYNC_EVT_FC BIT(16)
1778 #define SLI4_ASYNC_EVT_SLI_PORT BIT(17)
1779 #define SLI4_ASYNC_EVT_VF BIT(18)
1780 #define SLI4_ASYNC_EVT_MR BIT(19)
1782 #define SLI4_ASYNC_EVT_ALL \
1783 SLI4_ASYNC_EVT_LINK_STATE | \
1784 SLI4_ASYNC_EVT_FCOE_FIP | \
1785 SLI4_ASYNC_EVT_DCBX | \
1786 SLI4_ASYNC_EVT_ISCSI | \
1787 SLI4_ASYNC_EVT_GRP5 | \
1788 SLI4_ASYNC_EVT_FC | \
1789 SLI4_ASYNC_EVT_SLI_PORT | \
1790 SLI4_ASYNC_EVT_VF |\
1793 #define SLI4_ASYNC_EVT_FC_FCOE \
1794 SLI4_ASYNC_EVT_LINK_STATE | \
1795 SLI4_ASYNC_EVT_FCOE_FIP | \
1796 SLI4_ASYNC_EVT_GRP5 | \
1797 SLI4_ASYNC_EVT_FC | \
1798 SLI4_ASYNC_EVT_SLI_PORT
1801 * @brief Common Destroy MQ
1803 typedef struct sli4_req_common_destroy_mq_s {
1805 #if BYTE_ORDER == LITTLE_ENDIAN
1809 #error big endian version not defined
1811 } sli4_req_common_destroy_mq_t;
1814 * @brief COMMON_GET_CNTL_ATTRIBUTES
1816 * Query for information about the SLI Port
1818 typedef struct sli4_res_common_get_cntl_attributes_s {
1820 #if BYTE_ORDER == LITTLE_ENDIAN
1821 uint8_t version_string[32];
1822 uint8_t manufacturer_name[32];
1823 uint32_t supported_modes;
1824 uint32_t eprom_version_lo:8,
1827 uint32_t mbx_data_structure_version;
1828 uint32_t ep_firmware_data_structure_version;
1829 uint8_t ncsi_version_string[12];
1830 uint32_t default_extended_timeout;
1831 uint8_t model_number[32];
1832 uint8_t description[64];
1833 uint8_t serial_number[32];
1834 uint8_t ip_version_string[32];
1835 uint8_t fw_version_string[32];
1836 uint8_t bios_version_string[32];
1837 uint8_t redboot_version_string[32];
1838 uint8_t driver_version_string[32];
1839 uint8_t fw_on_flash_version_string[32];
1840 uint32_t functionalities_supported;
1841 uint32_t max_cdb_length:16,
1843 generational_guid0:8;
1844 uint32_t generational_guid1_12[3];
1845 uint32_t generational_guid13:24,
1847 uint32_t default_link_down_timeout:16,
1848 iscsi_version_min_max:8,
1849 multifunctional_device:8;
1850 uint32_t cache_valid:8,
1852 max_domains_supported:8,
1855 uint32_t firmware_post_status;
1857 uint32_t iscsi_features:8,
1859 uint32_t pci_vendor_id:16,
1861 uint32_t pci_sub_vendor_id:16,
1862 pci_sub_system_id:16;
1863 uint32_t pci_bus_number:8,
1864 pci_device_number:8,
1865 pci_function_number:8,
1867 uint64_t unique_identifier;
1868 uint32_t number_of_netfilters:8,
1871 #error big endian version not defined
1873 } sli4_res_common_get_cntl_attributes_t;
1876 * @brief COMMON_GET_CNTL_ATTRIBUTES
1878 * This command queries the controller information from the Flash ROM.
1880 typedef struct sli4_req_common_get_cntl_addl_attributes_s {
1882 } sli4_req_common_get_cntl_addl_attributes_t;
1884 typedef struct sli4_res_common_get_cntl_addl_attributes_s {
1886 uint16_t ipl_file_number;
1887 uint8_t ipl_file_version;
1889 uint8_t on_die_temperature;
1891 uint32_t driver_advanced_features_supported;
1893 char fcoe_universal_bios_version[32];
1894 char fcoe_x86_bios_version[32];
1895 char fcoe_efi_bios_version[32];
1896 char fcoe_fcode_version[32];
1897 char uefi_bios_version[32];
1898 char uefi_nic_version[32];
1899 char uefi_fcode_version[32];
1900 char uefi_iscsi_version[32];
1901 char iscsi_x86_bios_version[32];
1902 char pxe_x86_bios_version[32];
1903 uint8_t fcoe_default_wwpn[8];
1904 uint8_t ext_phy_version[32];
1905 uint8_t fc_universal_bios_version[32];
1906 uint8_t fc_x86_bios_version[32];
1907 uint8_t fc_efi_bios_version[32];
1908 uint8_t fc_fcode_version[32];
1909 uint8_t ext_phy_crc_label[8];
1910 uint8_t ipl_file_name[16];
1912 } sli4_res_common_get_cntl_addl_attributes_t;
1917 * This command does not do anything; it only returns the payload in the completion.
1919 typedef struct sli4_req_common_nop_s {
1921 #if BYTE_ORDER == LITTLE_ENDIAN
1922 uint32_t context[2];
1924 #error big endian version not defined
1926 } sli4_req_common_nop_t;
1928 typedef struct sli4_res_common_nop_s {
1930 #if BYTE_ORDER == LITTLE_ENDIAN
1931 uint32_t context[2];
1933 #error big endian version not defined
1935 } sli4_res_common_nop_t;
1938 * @brief COMMON_GET_RESOURCE_EXTENT_INFO
1940 typedef struct sli4_req_common_get_resource_extent_info_s {
1942 #if BYTE_ORDER == LITTLE_ENDIAN
1943 uint32_t resource_type:16,
1946 #error big endian version not defined
1948 } sli4_req_common_get_resource_extent_info_t;
1950 #define SLI4_RSC_TYPE_ISCSI_INI_XRI 0x0c
1951 #define SLI4_RSC_TYPE_FCOE_VFI 0x20
1952 #define SLI4_RSC_TYPE_FCOE_VPI 0x21
1953 #define SLI4_RSC_TYPE_FCOE_RPI 0x22
1954 #define SLI4_RSC_TYPE_FCOE_XRI 0x23
1956 typedef struct sli4_res_common_get_resource_extent_info_s {
1958 #if BYTE_ORDER == LITTLE_ENDIAN
1959 uint32_t resource_extent_count:16,
1960 resource_extent_size:16;
1962 #error big endian version not defined
1964 } sli4_res_common_get_resource_extent_info_t;
1966 #define SLI4_128BYTE_WQE_SUPPORT 0x02
1968 * @brief COMMON_GET_SLI4_PARAMETERS
1970 typedef struct sli4_res_common_get_sli4_parameters_s {
1972 #if BYTE_ORDER == LITTLE_ENDIAN
1973 uint32_t protocol_type:8,
1983 uint32_t eq_page_cnt:4,
1990 uint32_t eqe_count_mask:16,
1992 uint32_t cq_page_cnt:4,
2000 uint32_t cqe_count_mask:16,
2002 uint32_t mq_page_cnt:4,
2008 uint32_t mqe_count_mask:16,
2010 uint32_t wq_page_cnt:4,
2018 uint32_t wqe_count_mask:16,
2020 uint32_t rq_page_cnt:4,
2028 uint32_t rqe_count_mask:16,
2046 phwq:1, /** Performance Hint WQ_ID Association */
2060 uint32_t sge_supported_length;
2061 uint32_t sgl_page_cnt:4,
2066 uint32_t min_rq_buffer_size:16,
2068 uint32_t max_rq_buffer_size;
2069 uint32_t physical_xri_max:16,
2070 physical_rpi_max:16;
2071 uint32_t physical_vpi_max:16,
2072 physical_vfi_max:16;
2074 uint32_t frag_num_field_offset:16, /* dword 20 */
2075 frag_num_field_size:16;
2076 uint32_t sgl_index_field_offset:16, /* dword 21 */
2077 sgl_index_field_size:16;
2078 uint32_t chain_sge_initial_value_lo; /* dword 22 */
2079 uint32_t chain_sge_initial_value_hi; /* dword 23 */
2081 #error big endian version not defined
2083 } sli4_res_common_get_sli4_parameters_t;
2086 * @brief COMMON_QUERY_FW_CONFIG
2088 * This command retrieves firmware configuration parameters and adapter
2089 * resources available to the driver.
2091 typedef struct sli4_req_common_query_fw_config_s {
2093 } sli4_req_common_query_fw_config_t;
2095 #define SLI4_FUNCTION_MODE_FCOE_INI_MODE 0x40
2096 #define SLI4_FUNCTION_MODE_FCOE_TGT_MODE 0x80
2097 #define SLI4_FUNCTION_MODE_DUA_MODE 0x800
2099 #define SLI4_ULP_MODE_FCOE_INI 0x40
2100 #define SLI4_ULP_MODE_FCOE_TGT 0x80
2102 typedef struct sli4_res_common_query_fw_config_s {
2104 uint32_t config_number;
2106 uint32_t physical_port;
2107 uint32_t function_mode;
2109 uint32_t ulp0_nic_wqid_base;
2110 uint32_t ulp0_nic_wq_total; /* Dword 10 */
2111 uint32_t ulp0_toe_wqid_base;
2112 uint32_t ulp0_toe_wq_total;
2113 uint32_t ulp0_toe_rqid_base;
2114 uint32_t ulp0_toe_rq_total;
2115 uint32_t ulp0_toe_defrqid_base;
2116 uint32_t ulp0_toe_defrq_total;
2117 uint32_t ulp0_lro_rqid_base;
2118 uint32_t ulp0_lro_rq_total;
2119 uint32_t ulp0_iscsi_icd_base;
2120 uint32_t ulp0_iscsi_icd_total; /* Dword 20 */
2122 uint32_t ulp1_nic_wqid_base;
2123 uint32_t ulp1_nic_wq_total;
2124 uint32_t ulp1_toe_wqid_base;
2125 uint32_t ulp1_toe_wq_total;
2126 uint32_t ulp1_toe_rqid_base;
2127 uint32_t ulp1_toe_rq_total;
2128 uint32_t ulp1_toe_defrqid_base;
2129 uint32_t ulp1_toe_defrq_total;
2130 uint32_t ulp1_lro_rqid_base; /* Dword 30 */
2131 uint32_t ulp1_lro_rq_total;
2132 uint32_t ulp1_iscsi_icd_base;
2133 uint32_t ulp1_iscsi_icd_total;
2134 uint32_t function_capabilities;
2135 uint32_t ulp0_cq_base;
2136 uint32_t ulp0_cq_total;
2137 uint32_t ulp0_eq_base;
2138 uint32_t ulp0_eq_total;
2139 uint32_t ulp0_iscsi_chain_icd_base;
2140 uint32_t ulp0_iscsi_chain_icd_total; /* Dword 40 */
2141 uint32_t ulp1_iscsi_chain_icd_base;
2142 uint32_t ulp1_iscsi_chain_icd_total;
2143 } sli4_res_common_query_fw_config_t;
2146 * @brief COMMON_GET_PORT_NAME
2148 typedef struct sli4_req_common_get_port_name_s {
2150 #if BYTE_ORDER == LITTLE_ENDIAN
2151 uint32_t pt:2, /* only COMMON_GET_PORT_NAME_V1 */
2154 #error big endian version not defined
2156 } sli4_req_common_get_port_name_t;
2158 typedef struct sli4_res_common_get_port_name_s {
2161 } sli4_res_common_get_port_name_t;
2164 * @brief COMMON_WRITE_FLASHROM
2166 typedef struct sli4_req_common_write_flashrom_s {
2168 #if BYTE_ORDER == LITTLE_ENDIAN
2169 uint32_t flash_rom_access_opcode;
2170 uint32_t flash_rom_access_operation_type;
2171 uint32_t data_buffer_size;
2173 uint8_t data_buffer[4];
2175 #error big endian version not defined
2177 } sli4_req_common_write_flashrom_t;
2179 #define SLI4_MGMT_FLASHROM_OPCODE_FLASH 0x01
2180 #define SLI4_MGMT_FLASHROM_OPCODE_SAVE 0x02
2181 #define SLI4_MGMT_FLASHROM_OPCODE_CLEAR 0x03
2182 #define SLI4_MGMT_FLASHROM_OPCODE_REPORT 0x04
2183 #define SLI4_MGMT_FLASHROM_OPCODE_IMAGE_INFO 0x05
2184 #define SLI4_MGMT_FLASHROM_OPCODE_IMAGE_CRC 0x06
2185 #define SLI4_MGMT_FLASHROM_OPCODE_OFFSET_BASED_FLASH 0x07
2186 #define SLI4_MGMT_FLASHROM_OPCODE_OFFSET_BASED_SAVE 0x08
2187 #define SLI4_MGMT_PHY_FLASHROM_OPCODE_FLASH 0x09
2188 #define SLI4_MGMT_PHY_FLASHROM_OPCODE_SAVE 0x0a
2190 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ISCSI 0x00
2191 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_REDBOOT 0x01
2192 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_BIOS 0x02
2193 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_PXE_BIOS 0x03
2194 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_CODE_CONTROL 0x04
2195 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_IPSEC_CFG 0x05
2196 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_INIT_DATA 0x06
2197 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ROM_OFFSET 0x07
2198 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_BIOS 0x08
2199 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ISCSI_BAK 0x09
2200 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_ACT 0x0a
2201 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_BAK 0x0b
2202 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_CODE_CTRL_P 0x0c
2203 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_NCSI 0x0d
2204 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_NIC 0x0e
2205 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_DCBX 0x0f
2206 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_PXE_BIOS_CFG 0x10
2207 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ALL_CFG_DATA 0x11
2210 * @brief COMMON_MANAGE_FAT
2212 typedef struct sli4_req_common_manage_fat_s {
2214 #if BYTE_ORDER == LITTLE_ENDIAN
2215 uint32_t fat_operation;
2216 uint32_t read_log_offset;
2217 uint32_t read_log_length;
2218 uint32_t data_buffer_size;
2219 uint32_t data_buffer; /* response only */
2221 #error big endian version not defined
2223 } sli4_req_common_manage_fat_t;
2226 * @brief COMMON_GET_EXT_FAT_CAPABILITIES
2228 typedef struct sli4_req_common_get_ext_fat_capabilities_s {
2230 #if BYTE_ORDER == LITTLE_ENDIAN
2231 uint32_t parameter_type;
2233 #error big endian version not defined
2235 } sli4_req_common_get_ext_fat_capabilities_t;
2238 * @brief COMMON_SET_EXT_FAT_CAPABILITIES
2240 typedef struct sli4_req_common_set_ext_fat_capabilities_s {
2242 #if BYTE_ORDER == LITTLE_ENDIAN
2243 uint32_t maximum_log_entries;
2244 uint32_t log_entry_size;
2245 uint32_t logging_type:8,
2246 maximum_logging_functions:8,
2247 maximum_logging_ports:8,
2249 uint32_t supported_modes;
2250 uint32_t number_modules;
2251 uint32_t debug_module[14];
2253 #error big endian version not defined
2255 } sli4_req_common_set_ext_fat_capabilities_t;
2258 * @brief COMMON_EXT_FAT_CONFIGURE_SNAPSHOT
2260 typedef struct sli4_req_common_ext_fat_configure_snapshot_s {
2262 #if BYTE_ORDER == LITTLE_ENDIAN
2263 uint32_t total_log_entries;
2265 #error big endian version not defined
2267 } sli4_req_common_ext_fat_configure_snapshot_t;
2270 * @brief COMMON_EXT_FAT_RETRIEVE_SNAPSHOT
2272 typedef struct sli4_req_common_ext_fat_retrieve_snapshot_s {
2274 #if BYTE_ORDER == LITTLE_ENDIAN
2275 uint32_t snapshot_mode;
2276 uint32_t start_index;
2277 uint32_t number_log_entries;
2279 #error big endian version not defined
2281 } sli4_req_common_ext_fat_retrieve_snapshot_t;
2283 typedef struct sli4_res_common_ext_fat_retrieve_snapshot_s {
2285 #if BYTE_ORDER == LITTLE_ENDIAN
2286 uint32_t number_log_entries;
2290 uint32_t trace_level;
2291 uint32_t module_mask[2];
2292 uint32_t trace_table_index;
2294 uint8_t string_data[16];
2297 #error big endian version not defined
2299 } sli4_res_common_ext_fat_retrieve_snapshot_t;
2302 * @brief COMMON_EXT_FAT_READ_STRING_TABLE
2304 typedef struct sli4_req_common_ext_fat_read_string_table_s {
2306 #if BYTE_ORDER == LITTLE_ENDIAN
2307 uint32_t byte_offset;
2308 uint32_t number_bytes;
2310 #error big endian version not defined
2312 } sli4_req_common_ext_fat_read_string_table_t;
2314 typedef struct sli4_res_common_ext_fat_read_string_table_s {
2316 #if BYTE_ORDER == LITTLE_ENDIAN
2317 uint32_t number_returned_bytes;
2318 uint32_t number_remaining_bytes;
2319 uint32_t table_data0:8,
2321 uint8_t table_data[0];
2323 #error big endian version not defined
2325 } sli4_res_common_ext_fat_read_string_table_t;
2328 * @brief COMMON_READ_TRANSCEIVER_DATA
2330 * This command reads SFF transceiver data(Format is defined
2331 * by the SFF-8472 specification).
2333 typedef struct sli4_req_common_read_transceiver_data_s {
2335 #if BYTE_ORDER == LITTLE_ENDIAN
2336 uint32_t page_number;
2339 #error big endian version not defined
2341 } sli4_req_common_read_transceiver_data_t;
2343 typedef struct sli4_res_common_read_transceiver_data_s {
2345 #if BYTE_ORDER == LITTLE_ENDIAN
2346 uint32_t page_number;
2348 uint32_t page_data[32];
2349 uint32_t page_data_2[32];
2351 #error big endian version not defined
2353 } sli4_res_common_read_transceiver_data_t;
2356 * @brief COMMON_READ_OBJECT
2358 typedef struct sli4_req_common_read_object_s {
2360 #if BYTE_ORDER == LITTLE_ENDIAN
2361 uint32_t desired_read_length:24,
2363 uint32_t read_offset;
2364 uint8_t object_name[104];
2365 uint32_t host_buffer_descriptor_count;
2366 sli4_bde_t host_buffer_descriptor[0];
2368 #error big endian version not defined
2370 } sli4_req_common_read_object_t;
2372 typedef struct sli4_res_common_read_object_s {
2374 #if BYTE_ORDER == LITTLE_ENDIAN
2375 uint32_t actual_read_length;
2379 #error big endian version not defined
2381 } sli4_res_common_read_object_t;
2384 * @brief COMMON_WRITE_OBJECT
2386 typedef struct sli4_req_common_write_object_s {
2388 #if BYTE_ORDER == LITTLE_ENDIAN
2389 uint32_t desired_write_length:24,
2393 uint32_t write_offset;
2394 uint8_t object_name[104];
2395 uint32_t host_buffer_descriptor_count;
2396 sli4_bde_t host_buffer_descriptor[0];
2398 #error big endian version not defined
2400 } sli4_req_common_write_object_t;
2402 typedef struct sli4_res_common_write_object_s {
2404 #if BYTE_ORDER == LITTLE_ENDIAN
2405 uint32_t actual_write_length;
2406 uint32_t change_status:8,
2409 #error big endian version not defined
2411 } sli4_res_common_write_object_t;
2414 * @brief COMMON_DELETE_OBJECT
2416 typedef struct sli4_req_common_delete_object_s {
2418 #if BYTE_ORDER == LITTLE_ENDIAN
2421 uint8_t object_name[104];
2423 #error big endian version not defined
2425 } sli4_req_common_delete_object_t;
2428 * @brief COMMON_READ_OBJECT_LIST
2430 typedef struct sli4_req_common_read_object_list_s {
2432 #if BYTE_ORDER == LITTLE_ENDIAN
2433 uint32_t desired_read_length:24,
2435 uint32_t read_offset;
2436 uint8_t object_name[104];
2437 uint32_t host_buffer_descriptor_count;
2438 sli4_bde_t host_buffer_descriptor[0];
2440 #error big endian version not defined
2442 } sli4_req_common_read_object_list_t;
2445 * @brief COMMON_SET_DUMP_LOCATION
2447 typedef struct sli4_req_common_set_dump_location_s {
2449 #if BYTE_ORDER == LITTLE_ENDIAN
2450 uint32_t buffer_length:24,
2455 uint32_t buf_addr_low;
2456 uint32_t buf_addr_high;
2458 #error big endian version not defined
2460 } sli4_req_common_set_dump_location_t;
2462 typedef struct sli4_res_common_set_dump_location_s {
2464 #if BYTE_ORDER == LITTLE_ENDIAN
2465 uint32_t buffer_length:24,
2468 #error big endian version not defined
2470 }sli4_res_common_set_dump_location_t;
2473 * @brief COMMON_SET_SET_FEATURES
2475 #define SLI4_SET_FEATURES_DIF_SEED 0x01
2476 #define SLI4_SET_FEATURES_XRI_TIMER 0x03
2477 #define SLI4_SET_FEATURES_MAX_PCIE_SPEED 0x04
2478 #define SLI4_SET_FEATURES_FCTL_CHECK 0x05
2479 #define SLI4_SET_FEATURES_FEC 0x06
2480 #define SLI4_SET_FEATURES_PCIE_RECV_DETECT 0x07
2481 #define SLI4_SET_FEATURES_DIF_MEMORY_MODE 0x08
2482 #define SLI4_SET_FEATURES_DISABLE_SLI_PORT_PAUSE_STATE 0x09
2483 #define SLI4_SET_FEATURES_ENABLE_PCIE_OPTIONS 0x0A
2484 #define SLI4_SET_FEATURES_SET_CONFIG_AUTO_XFER_RDY_T10PI 0x0C
2485 #define SLI4_SET_FEATURES_ENABLE_MULTI_RECEIVE_QUEUE 0x0D
2486 #define SLI4_SET_FEATURES_SET_FTD_XFER_HINT 0x0F
2487 #define SLI4_SET_FEATURES_SLI_PORT_HEALTH_CHECK 0x11
2489 typedef struct sli4_req_common_set_features_s {
2491 #if BYTE_ORDER == LITTLE_ENDIAN
2496 #error big endian version not defined
2498 } sli4_req_common_set_features_t;
2500 typedef struct sli4_req_common_set_features_dif_seed_s {
2501 #if BYTE_ORDER == LITTLE_ENDIAN
2505 #error big endian version not defined
2507 } sli4_req_common_set_features_dif_seed_t;
2509 typedef struct sli4_req_common_set_features_t10_pi_mem_model_s {
2510 #if BYTE_ORDER == LITTLE_ENDIAN
2514 #error big endian version not defined
2516 } sli4_req_common_set_features_t10_pi_mem_model_t;
2518 typedef struct sli4_req_common_set_features_multirq_s {
2519 #if BYTE_ORDER == LITTLE_ENDIAN
2520 uint32_t isr:1, /*<< Include Sequence Reporting */
2521 agxfe:1, /*<< Auto Generate XFER-RDY Feature Enabled */
2527 #error big endian version not defined
2529 } sli4_req_common_set_features_multirq_t;
2531 typedef struct sli4_req_common_set_features_xfer_rdy_t10pi_s {
2532 #if BYTE_ORDER == LITTLE_ENDIAN
2540 uint32_t app_tag:16,
2543 #error big endian version not defined
2545 } sli4_req_common_set_features_xfer_rdy_t10pi_t;
2547 typedef struct sli4_req_common_set_features_health_check_s {
2548 #if BYTE_ORDER == LITTLE_ENDIAN
2553 #error big endian version not defined
2555 } sli4_req_common_set_features_health_check_t;
2557 typedef struct sli4_req_common_set_features_set_fdt_xfer_hint_s {
2558 #if BYTE_ORDER == LITTLE_ENDIAN
2559 uint32_t fdt_xfer_hint;
2561 #error big endian version not defined
2563 } sli4_req_common_set_features_set_fdt_xfer_hint_t;
2566 * @brief DMTF_EXEC_CLP_CMD
2568 typedef struct sli4_req_dmtf_exec_clp_cmd_s {
2570 #if BYTE_ORDER == LITTLE_ENDIAN
2571 uint32_t cmd_buf_length;
2572 uint32_t resp_buf_length;
2573 uint32_t cmd_buf_addr_low;
2574 uint32_t cmd_buf_addr_high;
2575 uint32_t resp_buf_addr_low;
2576 uint32_t resp_buf_addr_high;
2578 #error big endian version not defined
2580 } sli4_req_dmtf_exec_clp_cmd_t;
2582 typedef struct sli4_res_dmtf_exec_clp_cmd_s {
2584 #if BYTE_ORDER == LITTLE_ENDIAN
2586 uint32_t resp_length;
2591 uint32_t clp_status;
2592 uint32_t clp_detailed_status;
2594 #error big endian version not defined
2596 } sli4_res_dmtf_exec_clp_cmd_t;
2599 * @brief Resource descriptor
2602 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_PCIE 0x50
2603 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_NIC 0x51
2604 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_ISCSI 0x52
2605 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_FCFCOE 0x53
2606 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_RDMA 0x54
2607 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_PORT 0x55
2608 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_ISAP 0x56
2610 #define SLI4_PROTOCOL_NIC_TOE 0x01
2611 #define SLI4_PROTOCOL_ISCSI 0x02
2612 #define SLI4_PROTOCOL_FCOE 0x04
2613 #define SLI4_PROTOCOL_NIC_TOE_RDMA 0x08
2614 #define SLI4_PROTOCOL_FC 0x10
2615 #define SLI4_PROTOCOL_DEFAULT 0xff
2617 typedef struct sli4_resource_descriptor_v1_s {
2618 uint32_t descriptor_type:8,
2619 descriptor_length:8,
2621 uint32_t type_specific[0];
2622 } sli4_resource_descriptor_v1_t;
2624 typedef struct sli4_pcie_resource_descriptor_v1_s {
2625 uint32_t descriptor_type:8,
2626 descriptor_length:8,
2634 uint32_t sriov_state:8,
2638 uint32_t number_of_vfs:16,
2640 uint32_t mission_roles:8,
2647 } sli4_pcie_resource_descriptor_v1_t;
2649 typedef struct sli4_isap_resource_descriptor_v1_s {
2650 uint32_t descriptor_type:8,
2651 descriptor_length:8,
2653 uint32_t iscsi_tgt:1,
2658 uint32_t fcoe_tgt:1,
2663 uint32_t mc_type0:8,
2668 } sli4_isap_resouce_descriptor_v1_t;
2671 * @brief COMMON_GET_FUNCTION_CONFIG
2673 typedef struct sli4_req_common_get_function_config_s {
2675 } sli4_req_common_get_function_config_t;
2677 typedef struct sli4_res_common_get_function_config_s {
2679 #if BYTE_ORDER == LITTLE_ENDIAN
2680 uint32_t desc_count;
2683 #error big endian version not defined
2685 } sli4_res_common_get_function_config_t;
2688 * @brief COMMON_GET_PROFILE_CONFIG
2690 typedef struct sli4_req_common_get_profile_config_s {
2692 uint32_t profile_id:8,
2695 } sli4_req_common_get_profile_config_t;
2697 typedef struct sli4_res_common_get_profile_config_s {
2699 #if BYTE_ORDER == LITTLE_ENDIAN
2700 uint32_t desc_count;
2703 #error big endian version not defined
2705 } sli4_res_common_get_profile_config_t;
2708 * @brief COMMON_SET_PROFILE_CONFIG
2710 typedef struct sli4_req_common_set_profile_config_s {
2712 uint32_t profile_id:8,
2715 uint32_t desc_count;
2717 } sli4_req_common_set_profile_config_t;
2719 typedef struct sli4_res_common_set_profile_config_s {
2721 #if BYTE_ORDER == LITTLE_ENDIAN
2723 #error big endian version not defined
2725 } sli4_res_common_set_profile_config_t;
2728 * @brief Profile Descriptor for profile functions
2730 typedef struct sli4_profile_descriptor_s {
2731 #if BYTE_ORDER == LITTLE_ENDIAN
2732 uint32_t profile_id:8,
2736 uint32_t profile_description[128];
2738 #error big endian version not defined
2740 } sli4_profile_descriptor_t;
2742 /* We don't know in advance how many descriptors there are. We have
2743 to pick a number that we think will be big enough and ask for that
2746 #define MAX_PRODUCT_DESCRIPTORS 40
2749 * @brief COMMON_GET_PROFILE_LIST
2751 typedef struct sli4_req_common_get_profile_list_s {
2753 #if BYTE_ORDER == LITTLE_ENDIAN
2754 uint32_t start_profile_index:8,
2757 #error big endian version not defined
2759 } sli4_req_common_get_profile_list_t;
2761 typedef struct sli4_res_common_get_profile_list_s {
2763 #if BYTE_ORDER == LITTLE_ENDIAN
2764 uint32_t profile_descriptor_count;
2765 sli4_profile_descriptor_t profile_descriptor[MAX_PRODUCT_DESCRIPTORS];
2767 #error big endian version not defined
2769 } sli4_res_common_get_profile_list_t;
2772 * @brief COMMON_GET_ACTIVE_PROFILE
2774 typedef struct sli4_req_common_get_active_profile_s {
2776 } sli4_req_common_get_active_profile_t;
2778 typedef struct sli4_res_common_get_active_profile_s {
2780 #if BYTE_ORDER == LITTLE_ENDIAN
2781 uint32_t active_profile_id:8,
2786 #error big endian version not defined
2788 } sli4_res_common_get_active_profile_t;
2791 * @brief COMMON_SET_ACTIVE_PROFILE
2793 typedef struct sli4_req_common_set_active_profile_s {
2795 #if BYTE_ORDER == LITTLE_ENDIAN
2796 uint32_t active_profile_id:8,
2800 #error big endian version not defined
2802 } sli4_req_common_set_active_profile_t;
2804 typedef struct sli4_res_common_set_active_profile_s {
2806 } sli4_res_common_set_active_profile_t;
2809 * @brief Link Config Descriptor for link config functions
2811 typedef struct sli4_link_config_descriptor_s {
2812 #if BYTE_ORDER == LITTLE_ENDIAN
2813 uint32_t link_config_id:8,
2815 uint32_t config_description[8];
2817 #error big endian version not defined
2819 } sli4_link_config_descriptor_t;
2821 #define MAX_LINK_CONFIG_DESCRIPTORS 10
2824 * @brief COMMON_GET_RECONFIG_LINK_INFO
2826 typedef struct sli4_req_common_get_reconfig_link_info_s {
2828 #if BYTE_ORDER == LITTLE_ENDIAN
2830 #error big endian version not defined
2832 } sli4_req_common_get_reconfig_link_info_t;
2834 typedef struct sli4_res_common_get_reconfig_link_info_s {
2836 #if BYTE_ORDER == LITTLE_ENDIAN
2837 uint32_t active_link_config_id:8,
2839 next_link_config_id:8,
2841 uint32_t link_configuration_descriptor_count;
2842 sli4_link_config_descriptor_t desc[MAX_LINK_CONFIG_DESCRIPTORS];
2844 #error big endian version not defined
2846 } sli4_res_common_get_reconfig_link_info_t;
2849 * @brief COMMON_SET_RECONFIG_LINK_ID
2851 typedef struct sli4_req_common_set_reconfig_link_id_s {
2853 #if BYTE_ORDER == LITTLE_ENDIAN
2854 uint32_t next_link_config_id:8,
2858 #error big endian version not defined
2860 } sli4_req_common_set_reconfig_link_id_t;
2862 typedef struct sli4_res_common_set_reconfig_link_id_s {
2864 #if BYTE_ORDER == LITTLE_ENDIAN
2866 #error big endian version not defined
2868 } sli4_res_common_set_reconfig_link_id_t;
2870 typedef struct sli4_req_lowlevel_set_watchdog_s {
2872 #if BYTE_ORDER == LITTLE_ENDIAN
2873 uint32_t watchdog_timeout:16,
2876 #error big endian version not defined
2879 } sli4_req_lowlevel_set_watchdog_t;
2881 typedef struct sli4_res_lowlevel_set_watchdog_s {
2883 #if BYTE_ORDER == LITTLE_ENDIAN
2886 #error big endian version not defined
2888 } sli4_res_lowlevel_set_watchdog_t;
2891 * @brief Event Queue Entry
2893 typedef struct sli4_eqe_s {
2894 #if BYTE_ORDER == LITTLE_ENDIAN
2895 uint32_t vld:1, /** valid */
2900 #error big endian version not defined
2904 #define SLI4_MAJOR_CODE_STANDARD 0
2905 #define SLI4_MAJOR_CODE_SENTINEL 1
2908 * @brief Mailbox Completion Queue Entry
2910 * A CQE generated on the completion of a MQE from a MQ.
2912 typedef struct sli4_mcqe_s {
2913 #if BYTE_ORDER == LITTLE_ENDIAN
2914 uint32_t completion_status:16, /** values are protocol specific */
2916 uint32_t mqe_tag_low;
2917 uint32_t mqe_tag_high;
2919 con:1, /** consumed - command now being executed */
2920 cmp:1, /** completed - command still executing if clear */
2922 ae:1, /** async event - this is an ACQE */
2923 val:1; /** valid - contents of CQE are valid */
2925 #error big endian version not defined
2930 * @brief Asynchronous Completion Queue Entry
2932 * A CQE generated asynchronously in response to the link or other internal events.
2934 typedef struct sli4_acqe_s {
2935 #if BYTE_ORDER == LITTLE_ENDIAN
2936 uint32_t event_data[3];
2939 event_type:8, /** values are protocol specific */
2941 ae:1, /** async event - this is an ACQE */
2942 val:1; /** valid - contents of CQE are valid */
2944 #error big endian version not defined
2948 #define SLI4_ACQE_EVENT_CODE_LINK_STATE 0x01
2949 #define SLI4_ACQE_EVENT_CODE_FCOE_FIP 0x02
2950 #define SLI4_ACQE_EVENT_CODE_DCBX 0x03
2951 #define SLI4_ACQE_EVENT_CODE_ISCSI 0x04
2952 #define SLI4_ACQE_EVENT_CODE_GRP_5 0x05
2953 #define SLI4_ACQE_EVENT_CODE_FC_LINK_EVENT 0x10
2954 #define SLI4_ACQE_EVENT_CODE_SLI_PORT_EVENT 0x11
2955 #define SLI4_ACQE_EVENT_CODE_VF_EVENT 0x12
2956 #define SLI4_ACQE_EVENT_CODE_MR_EVENT 0x13
2959 * @brief Register name enums
2963 SLI4_REG_EQCQ_DOORBELL,
2964 SLI4_REG_FCOE_RQ_DOORBELL,
2965 SLI4_REG_IO_WQ_DOORBELL,
2966 SLI4_REG_MQ_DOORBELL,
2967 SLI4_REG_PHYSDEV_CONTROL,
2968 SLI4_REG_SLIPORT_CONTROL,
2969 SLI4_REG_SLIPORT_ERROR1,
2970 SLI4_REG_SLIPORT_ERROR2,
2971 SLI4_REG_SLIPORT_SEMAPHORE,
2972 SLI4_REG_SLIPORT_STATUS,
2973 SLI4_REG_UERR_MASK_HI,
2974 SLI4_REG_UERR_MASK_LO,
2975 SLI4_REG_UERR_STATUS_HI,
2976 SLI4_REG_UERR_STATUS_LO,
2977 SLI4_REG_SW_UE_CSR1,
2978 SLI4_REG_SW_UE_CSR2,
2979 SLI4_REG_MAX /* must be last */
2982 typedef struct sli4_reg_s {
2993 SLI_QTYPE_MAX, /* must be last */
2996 #define SLI_USER_MQ_COUNT 1 /** User specified max mail queues */
2997 #define SLI_MAX_CQ_SET_COUNT 16
2998 #define SLI_MAX_RQ_SET_COUNT 16
3005 SLI_QENTRY_WQ_RELEASE,
3006 SLI_QENTRY_OPT_WRITE_CMD,
3007 SLI_QENTRY_OPT_WRITE_DATA,
3009 SLI_QENTRY_MAX /* must be last */
3012 typedef struct sli4_queue_s {
3013 /* Common to all queue types */
3016 uint32_t index; /** current host entry index */
3017 uint16_t size; /** entry size */
3018 uint16_t length; /** number of entries */
3019 uint16_t n_posted; /** number entries posted */
3020 uint16_t id; /** Port assigned xQ_ID */
3021 uint16_t ulp; /** ULP assigned to this queue */
3022 uint32_t doorbell_offset;/** The offset for the doorbell */
3023 uint16_t doorbell_rset; /** register set for the doorbell */
3024 uint8_t type; /** queue type ie EQ, CQ, ... */
3025 uint32_t proc_limit; /** limit number of CQE processed per iteration */
3026 uint32_t posted_limit; /** number of CQE/EQE to process before ringing doorbell */
3027 uint32_t max_num_processed;
3028 time_t max_process_time;
3030 /* Type specific gunk */
3032 uint32_t r_idx; /** "read" index (MQ only) */
3034 uint32_t is_mq:1,/** CQ contains MQ/Async completions */
3035 is_hdr:1,/** is a RQ for packet headers */
3036 rq_batch:1;/** RQ index incremented by 8 */
3042 sli_queue_lock(sli4_queue_t *q)
3048 sli_queue_unlock(sli4_queue_t *q)
3050 ocs_unlock(&q->lock);
3053 #define SLI4_QUEUE_DEFAULT_CQ UINT16_MAX /** Use the default CQ */
3055 #define SLI4_QUEUE_RQ_BATCH 8
3060 SLI4_CB_MAX /* must be last */
3065 SLI_LINK_STATUS_DOWN,
3066 SLI_LINK_STATUS_NO_ALPA,
3067 SLI_LINK_STATUS_MAX,
3068 } sli4_link_status_e;
3071 SLI_LINK_TOPO_NPORT = 1, /** fabric or point-to-point */
3073 SLI_LINK_TOPO_LOOPBACK_INTERNAL,
3074 SLI_LINK_TOPO_LOOPBACK_EXTERNAL,
3077 } sli4_link_topology_e;
3079 /* TODO do we need both sli4_port_type_e & sli4_link_medium_e */
3081 SLI_LINK_MEDIUM_ETHERNET,
3083 SLI_LINK_MEDIUM_MAX,
3084 } sli4_link_medium_e;
3086 typedef struct sli4_link_event_s {
3087 sli4_link_status_e status; /* link up/down */
3088 sli4_link_topology_e topology;
3089 sli4_link_medium_e medium; /* Ethernet / FC */
3090 uint32_t speed; /* Mbps */
3093 } sli4_link_event_t;
3096 * @brief Fields retrieved from skyhawk that used used to build chained SGL
3098 typedef struct sli4_sgl_chaining_params_s {
3099 uint8_t chaining_capable;
3100 uint16_t frag_num_field_offset;
3101 uint16_t sgl_index_field_offset;
3102 uint64_t frag_num_field_mask;
3103 uint64_t sgl_index_field_mask;
3104 uint32_t chain_sge_initial_value_lo;
3105 uint32_t chain_sge_initial_value_hi;
3106 } sli4_sgl_chaining_params_t;
3108 typedef struct sli4_fip_event_s {
3110 uint32_t index; /* FCF index or UINT32_MAX if invalid */
3119 SLI_RSRC_MAX /* must be last */
3125 SLI4_PORT_TYPE_MAX /* must be last */
3129 SLI4_ASIC_TYPE_BE3 = 1,
3130 SLI4_ASIC_TYPE_SKYHAWK,
3131 SLI4_ASIC_TYPE_LANCER,
3132 SLI4_ASIC_TYPE_CORSAIR,
3133 SLI4_ASIC_TYPE_LANCERG6,
3137 SLI4_ASIC_REV_FPGA = 1,
3148 typedef struct sli4_s {
3150 sli4_port_type_e port_type;
3152 uint32_t sli_rev; /* SLI revision number */
3153 uint32_t sli_family;
3154 uint32_t if_type; /* SLI Interface type */
3156 sli4_asic_type_e asic_type; /*<< ASIC type */
3157 sli4_asic_rev_e asic_rev; /*<< ASIC revision */
3158 uint32_t physical_port;
3163 uint16_t max_qcount[SLI_QTYPE_MAX];
3164 uint32_t max_qentries[SLI_QTYPE_MAX];
3165 uint16_t count_mask[SLI_QTYPE_MAX];
3166 uint16_t count_method[SLI_QTYPE_MAX];
3167 uint32_t qpage_count[SLI_QTYPE_MAX];
3168 uint16_t link_module_type;
3170 uint16_t rq_min_buf_size;
3171 uint32_t rq_max_buf_size;
3176 uint8_t fw_name[2][16];
3179 uint8_t port_number;
3181 char bios_version_string[32];
3182 uint8_t dual_ulp_capable;
3183 uint8_t is_ulp_fc[2];
3185 * Tracks the port resources using extents metaphor. For
3186 * devices that don't implement extents (i.e.
3187 * has_extents == FALSE), the code models each resource as
3188 * a single large extent.
3191 uint32_t number; /* number of extents */
3192 uint32_t size; /* number of elements in each extent */
3193 uint32_t n_alloc;/* number of elements allocated */
3195 ocs_bitmap_t *use_map;/* bitmap showing resources in use */
3196 uint32_t map_size;/* number of bits in bitmap */
3197 } extent[SLI_RSRC_MAX];
3198 sli4_features_t features;
3199 uint32_t has_extents:1,
3204 perf_wq_id_association:1,
3205 cq_create_version:2,
3206 mq_create_version:2,
3208 sgl_pre_registered:1,
3209 sgl_pre_registration_required:1,
3210 t10_dif_inline_capable:1,
3211 t10_dif_separate_capable:1;
3212 uint32_t sge_supported_length;
3213 uint32_t sgl_page_sizes;
3214 uint32_t max_sgl_pages;
3215 sli4_sgl_chaining_params_t sgl_chaining_params;
3220 * Callback functions
3222 int32_t (*link)(void *, void *);
3224 int32_t (*fip)(void *, void *);
3228 #if defined(OCS_INCLUDE_DEBUG)
3229 /* Save pointer to physical memory descriptor for non-embedded SLI_CONFIG
3230 * commands for BMBX dumping purposes */
3231 ocs_dma_t *bmbx_non_emb_pmd;
3241 * Get / set parameter functions
3243 static inline uint32_t
3244 sli_get_max_rsrc(sli4_t *sli4, sli4_resource_e rsrc)
3246 if (rsrc >= SLI_RSRC_MAX) {
3250 return sli4->config.extent[rsrc].size;
3253 static inline uint32_t
3254 sli_get_max_queue(sli4_t *sli4, sli4_qtype_e qtype)
3256 if (qtype >= SLI_QTYPE_MAX) {
3259 return sli4->config.max_qcount[qtype];
3262 static inline uint32_t
3263 sli_get_max_qentries(sli4_t *sli4, sli4_qtype_e qtype)
3266 return sli4->config.max_qentries[qtype];
3269 static inline uint32_t
3270 sli_get_max_sge(sli4_t *sli4)
3272 return sli4->config.sge_supported_length;
3275 static inline uint32_t
3276 sli_get_max_sgl(sli4_t *sli4)
3279 if (sli4->config.sgl_page_sizes != 1) {
3280 ocs_log_test(sli4->os, "unsupported SGL page sizes %#x\n",
3281 sli4->config.sgl_page_sizes);
3285 return ((sli4->config.max_sgl_pages * SLI_PAGE_SIZE) / sizeof(sli4_sge_t));
3288 static inline sli4_link_medium_e
3289 sli_get_medium(sli4_t *sli4)
3291 switch (sli4->config.topology) {
3292 case SLI4_READ_CFG_TOPO_FCOE:
3293 return SLI_LINK_MEDIUM_ETHERNET;
3294 case SLI4_READ_CFG_TOPO_FC:
3295 case SLI4_READ_CFG_TOPO_FC_DA:
3296 case SLI4_READ_CFG_TOPO_FC_AL:
3297 return SLI_LINK_MEDIUM_FC;
3299 return SLI_LINK_MEDIUM_MAX;
3304 sli_skh_chain_sge_build(sli4_t *sli4, sli4_sge_t *sge, uint32_t xri_index, uint32_t frag_num, uint32_t offset)
3306 sli4_sgl_chaining_params_t *cparms = &sli4->config.sgl_chaining_params;
3308 ocs_memset(sge, 0, sizeof(*sge));
3309 sge->sge_type = SLI4_SGE_TYPE_CHAIN;
3310 sge->buffer_address_high = (uint32_t)cparms->chain_sge_initial_value_hi;
3311 sge->buffer_address_low =
3312 (uint32_t)((cparms->chain_sge_initial_value_lo |
3313 (((uintptr_t)(xri_index & cparms->sgl_index_field_mask)) <<
3314 cparms->sgl_index_field_offset) |
3315 (((uintptr_t)(frag_num & cparms->frag_num_field_mask)) <<
3316 cparms->frag_num_field_offset) |
3320 static inline uint32_t
3321 sli_get_sli_rev(sli4_t *sli4)
3323 return sli4->sli_rev;
3326 static inline uint32_t
3327 sli_get_sli_family(sli4_t *sli4)
3329 return sli4->sli_family;
3332 static inline uint32_t
3333 sli_get_if_type(sli4_t *sli4)
3335 return sli4->if_type;
3338 static inline void *
3339 sli_get_wwn_port(sli4_t *sli4)
3341 return sli4->config.wwpn;
3344 static inline void *
3345 sli_get_wwn_node(sli4_t *sli4)
3347 return sli4->config.wwnn;
3350 static inline void *
3351 sli_get_vpd(sli4_t *sli4)
3353 return sli4->vpd.data.virt;
3356 static inline uint32_t
3357 sli_get_vpd_len(sli4_t *sli4)
3359 return sli4->vpd.length;
3362 static inline uint32_t
3363 sli_get_fw_revision(sli4_t *sli4, uint32_t which)
3365 return sli4->config.fw_rev[which];
3368 static inline void *
3369 sli_get_fw_name(sli4_t *sli4, uint32_t which)
3371 return sli4->config.fw_name[which];
3374 static inline char *
3375 sli_get_ipl_name(sli4_t *sli4)
3377 return sli4->config.ipl_name;
3380 static inline uint32_t
3381 sli_get_hw_revision(sli4_t *sli4, uint32_t which)
3383 return sli4->config.hw_rev[which];
3386 static inline uint32_t
3387 sli_get_auto_xfer_rdy_capable(sli4_t *sli4)
3389 return sli4->config.auto_xfer_rdy;
3392 static inline uint32_t
3393 sli_get_dif_capable(sli4_t *sli4)
3395 return sli4->config.features.flag.dif;
3398 static inline uint32_t
3399 sli_is_dif_inline_capable(sli4_t *sli4)
3401 return sli_get_dif_capable(sli4) && sli4->config.t10_dif_inline_capable;
3404 static inline uint32_t
3405 sli_is_dif_separate_capable(sli4_t *sli4)
3407 return sli_get_dif_capable(sli4) && sli4->config.t10_dif_separate_capable;
3410 static inline uint32_t
3411 sli_get_is_dual_ulp_capable(sli4_t *sli4)
3413 return sli4->config.dual_ulp_capable;
3416 static inline uint32_t
3417 sli_get_is_sgl_chaining_capable(sli4_t *sli4)
3419 return sli4->config.sgl_chaining_params.chaining_capable;
3422 static inline uint32_t
3423 sli_get_is_ulp_enabled(sli4_t *sli4, uint16_t ulp)
3425 return sli4->config.is_ulp_fc[ulp];
3428 static inline uint32_t
3429 sli_get_hlm_capable(sli4_t *sli4)
3431 return sli4->config.features.flag.hlm;
3434 static inline int32_t
3435 sli_set_hlm(sli4_t *sli4, uint32_t value)
3437 if (value && !sli4->config.features.flag.hlm) {
3438 ocs_log_test(sli4->os, "HLM not supported\n");
3442 sli4->config.high_login_mode = value != 0 ? TRUE : FALSE;
3447 static inline uint32_t
3448 sli_get_hlm(sli4_t *sli4)
3450 return sli4->config.high_login_mode;
3453 static inline uint32_t
3454 sli_get_sgl_preregister_required(sli4_t *sli4)
3456 return sli4->config.sgl_pre_registration_required;
3459 static inline uint32_t
3460 sli_get_sgl_preregister(sli4_t *sli4)
3462 return sli4->config.sgl_pre_registered;
3465 static inline int32_t
3466 sli_set_sgl_preregister(sli4_t *sli4, uint32_t value)
3468 if ((value == 0) && sli4->config.sgl_pre_registration_required) {
3469 ocs_log_test(sli4->os, "SGL pre-registration required\n");
3473 sli4->config.sgl_pre_registered = value != 0 ? TRUE : FALSE;
3478 static inline sli4_asic_type_e
3479 sli_get_asic_type(sli4_t *sli4)
3481 return sli4->asic_type;
3484 static inline sli4_asic_rev_e
3485 sli_get_asic_rev(sli4_t *sli4)
3487 return sli4->asic_rev;
3490 static inline int32_t
3491 sli_set_topology(sli4_t *sli4, uint32_t value)
3496 case SLI4_READ_CFG_TOPO_FCOE:
3497 case SLI4_READ_CFG_TOPO_FC:
3498 case SLI4_READ_CFG_TOPO_FC_DA:
3499 case SLI4_READ_CFG_TOPO_FC_AL:
3500 sli4->config.topology = value;
3503 ocs_log_test(sli4->os, "unsupported topology %#x\n", value);
3510 static inline uint16_t
3511 sli_get_link_module_type(sli4_t *sli4)
3513 return sli4->config.link_module_type;
3516 static inline char *
3517 sli_get_portnum(sli4_t *sli4)
3519 return sli4->config.port_name;
3522 static inline char *
3523 sli_get_bios_version_string(sli4_t *sli4)
3525 return sli4->config.bios_version_string;
3528 static inline uint32_t
3529 sli_convert_mask_to_count(uint32_t method, uint32_t mask)
3534 count = 1 << ocs_lg2(mask);
3544 * @brief Common Create Queue function prototype
3546 typedef int32_t (*sli4_create_q_fn_t)(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, uint16_t);
3549 * @brief Common Destroy Queue function prototype
3551 typedef int32_t (*sli4_destroy_q_fn_t)(sli4_t *, void *, size_t, uint16_t);
3553 /****************************************************************************
3554 * Function prototypes
3556 extern int32_t sli_cmd_config_auto_xfer_rdy(sli4_t *, void *, size_t, uint32_t);
3557 extern int32_t sli_cmd_config_auto_xfer_rdy_hp(sli4_t *, void *, size_t, uint32_t, uint32_t, uint32_t);
3558 extern int32_t sli_cmd_config_link(sli4_t *, void *, size_t);
3559 extern int32_t sli_cmd_down_link(sli4_t *, void *, size_t);
3560 extern int32_t sli_cmd_dump_type4(sli4_t *, void *, size_t, uint16_t);
3561 extern int32_t sli_cmd_common_read_transceiver_data(sli4_t *, void *, size_t, uint32_t, ocs_dma_t *);
3562 extern int32_t sli_cmd_read_link_stats(sli4_t *, void *, size_t,uint8_t, uint8_t, uint8_t);
3563 extern int32_t sli_cmd_read_status(sli4_t *sli4, void *buf, size_t size, uint8_t clear_counters);
3564 extern int32_t sli_cmd_init_link(sli4_t *, void *, size_t, uint32_t, uint8_t);
3565 extern int32_t sli_cmd_init_vfi(sli4_t *, void *, size_t, uint16_t, uint16_t, uint16_t);
3566 extern int32_t sli_cmd_init_vpi(sli4_t *, void *, size_t, uint16_t, uint16_t);
3567 extern int32_t sli_cmd_post_xri(sli4_t *, void *, size_t, uint16_t, uint16_t);
3568 extern int32_t sli_cmd_release_xri(sli4_t *, void *, size_t, uint8_t);
3569 extern int32_t sli_cmd_read_sparm64(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t);
3570 extern int32_t sli_cmd_read_topology(sli4_t *, void *, size_t, ocs_dma_t *);
3571 extern int32_t sli_cmd_read_nvparms(sli4_t *, void *, size_t);
3572 extern int32_t sli_cmd_write_nvparms(sli4_t *, void *, size_t, uint8_t *, uint8_t *, uint8_t, uint32_t);
3576 uint8_t r_ctl_match;
3579 } sli4_cmd_rq_cfg_t;
3580 extern int32_t sli_cmd_reg_fcfi(sli4_t *, void *, size_t, uint16_t,
3581 sli4_cmd_rq_cfg_t rq_cfg[SLI4_CMD_REG_FCFI_NUM_RQ_CFG], uint16_t);
3582 extern int32_t sli_cmd_reg_fcfi_mrq(sli4_t *, void *, size_t, uint8_t, uint16_t, uint16_t, uint8_t, uint8_t , uint16_t, sli4_cmd_rq_cfg_t *);
3584 extern int32_t sli_cmd_reg_rpi(sli4_t *, void *, size_t, uint32_t, uint16_t, uint16_t, ocs_dma_t *, uint8_t, uint8_t);
3585 extern int32_t sli_cmd_reg_vfi(sli4_t *, void *, size_t, ocs_domain_t *);
3586 extern int32_t sli_cmd_reg_vpi(sli4_t *, void *, size_t, ocs_sli_port_t *, uint8_t);
3587 extern int32_t sli_cmd_sli_config(sli4_t *, void *, size_t, uint32_t, ocs_dma_t *);
3588 extern int32_t sli_cmd_unreg_fcfi(sli4_t *, void *, size_t, uint16_t);
3589 extern int32_t sli_cmd_unreg_rpi(sli4_t *, void *, size_t, uint16_t, sli4_resource_e, uint32_t);
3590 extern int32_t sli_cmd_unreg_vfi(sli4_t *, void *, size_t, ocs_domain_t *, uint32_t);
3591 extern int32_t sli_cmd_unreg_vpi(sli4_t *, void *, size_t, uint16_t, uint32_t);
3592 extern int32_t sli_cmd_common_nop(sli4_t *, void *, size_t, uint64_t);
3593 extern int32_t sli_cmd_common_get_resource_extent_info(sli4_t *, void *, size_t, uint16_t);
3594 extern int32_t sli_cmd_common_get_sli4_parameters(sli4_t *, void *, size_t);
3595 extern int32_t sli_cmd_common_write_object(sli4_t *, void *, size_t,
3596 uint16_t, uint16_t, uint32_t, uint32_t, char *, ocs_dma_t *);
3597 extern int32_t sli_cmd_common_delete_object(sli4_t *, void *, size_t, char *);
3598 extern int32_t sli_cmd_common_read_object(sli4_t *, void *, size_t, uint32_t,
3599 uint32_t, char *, ocs_dma_t *);
3600 extern int32_t sli_cmd_dmtf_exec_clp_cmd(sli4_t *sli4, void *buf, size_t size,
3603 extern int32_t sli_cmd_common_set_dump_location(sli4_t *sli4, void *buf, size_t size,
3604 uint8_t query, uint8_t is_buffer_list,
3605 ocs_dma_t *buffer, uint8_t fdb);
3606 extern int32_t sli_cmd_common_set_features(sli4_t *, void *, size_t, uint32_t, uint32_t, void*);
3607 extern int32_t sli_cmd_common_get_profile_list(sli4_t *sli4, void *buf,
3608 size_t size, uint32_t start_profile_index, ocs_dma_t *dma);
3609 extern int32_t sli_cmd_common_get_active_profile(sli4_t *sli4, void *buf,
3611 extern int32_t sli_cmd_common_set_active_profile(sli4_t *sli4, void *buf,
3614 uint32_t active_profile_id);
3615 extern int32_t sli_cmd_common_get_reconfig_link_info(sli4_t *sli4, void *buf,
3616 size_t size, ocs_dma_t *dma);
3617 extern int32_t sli_cmd_common_set_reconfig_link_id(sli4_t *sli4, void *buf,
3618 size_t size, ocs_dma_t *dma,
3619 uint32_t fd, uint32_t active_link_config_id);
3620 extern int32_t sli_cmd_common_get_function_config(sli4_t *sli4, void *buf,
3622 extern int32_t sli_cmd_common_get_profile_config(sli4_t *sli4, void *buf,
3623 size_t size, ocs_dma_t *dma);
3624 extern int32_t sli_cmd_common_set_profile_config(sli4_t *sli4, void *buf,
3625 size_t size, ocs_dma_t *dma,
3626 uint8_t profile_id, uint32_t descriptor_count,
3629 extern int32_t sli_cqe_mq(void *);
3630 extern int32_t sli_cqe_async(sli4_t *, void *);
3632 extern int32_t sli_setup(sli4_t *, ocs_os_handle_t, sli4_port_type_e);
3633 extern void sli_calc_max_qentries(sli4_t *sli4);
3634 extern int32_t sli_init(sli4_t *);
3635 extern int32_t sli_reset(sli4_t *);
3636 extern int32_t sli_fw_reset(sli4_t *);
3637 extern int32_t sli_teardown(sli4_t *);
3638 extern int32_t sli_callback(sli4_t *, sli4_callback_e, void *, void *);
3639 extern int32_t sli_bmbx_command(sli4_t *);
3640 extern int32_t __sli_queue_init(sli4_t *, sli4_queue_t *, uint32_t, size_t, uint32_t, uint32_t);
3641 extern int32_t __sli_create_queue(sli4_t *, sli4_queue_t *);
3642 extern int32_t sli_eq_modify_delay(sli4_t *sli4, sli4_queue_t *eq, uint32_t num_eq, uint32_t shift, uint32_t delay_mult);
3643 extern int32_t sli_queue_alloc(sli4_t *, uint32_t, sli4_queue_t *, uint32_t, sli4_queue_t *, uint16_t);
3644 extern int32_t sli_cq_alloc_set(sli4_t *, sli4_queue_t *qs[], uint32_t, uint32_t, sli4_queue_t *eqs[]);
3645 extern int32_t sli_get_queue_entry_size(sli4_t *, uint32_t);
3646 extern int32_t sli_queue_free(sli4_t *, sli4_queue_t *, uint32_t, uint32_t);
3647 extern int32_t sli_queue_reset(sli4_t *, sli4_queue_t *);
3648 extern int32_t sli_queue_is_empty(sli4_t *, sli4_queue_t *);
3649 extern int32_t sli_queue_eq_arm(sli4_t *, sli4_queue_t *, uint8_t);
3650 extern int32_t sli_queue_arm(sli4_t *, sli4_queue_t *, uint8_t);
3651 extern int32_t _sli_queue_write(sli4_t *, sli4_queue_t *, uint8_t *);
3652 extern int32_t sli_queue_write(sli4_t *, sli4_queue_t *, uint8_t *);
3653 extern int32_t sli_queue_read(sli4_t *, sli4_queue_t *, uint8_t *);
3654 extern int32_t sli_queue_index(sli4_t *, sli4_queue_t *);
3655 extern int32_t _sli_queue_poke(sli4_t *, sli4_queue_t *, uint32_t, uint8_t *);
3656 extern int32_t sli_queue_poke(sli4_t *, sli4_queue_t *, uint32_t, uint8_t *);
3657 extern int32_t sli_resource_alloc(sli4_t *, sli4_resource_e, uint32_t *, uint32_t *);
3658 extern int32_t sli_resource_free(sli4_t *, sli4_resource_e, uint32_t);
3659 extern int32_t sli_resource_reset(sli4_t *, sli4_resource_e);
3660 extern int32_t sli_eq_parse(sli4_t *, uint8_t *, uint16_t *);
3661 extern int32_t sli_cq_parse(sli4_t *, sli4_queue_t *, uint8_t *, sli4_qentry_e *, uint16_t *);
3663 extern int32_t sli_raise_ue(sli4_t *, uint8_t);
3664 extern int32_t sli_dump_is_ready(sli4_t *);
3665 extern int32_t sli_dump_is_present(sli4_t *);
3666 extern int32_t sli_reset_required(sli4_t *);
3667 extern int32_t sli_fw_error_status(sli4_t *);
3668 extern int32_t sli_fw_ready(sli4_t *);
3669 extern uint32_t sli_reg_read(sli4_t *, sli4_regname_e);
3670 extern void sli_reg_write(sli4_t *, sli4_regname_e, uint32_t);
3671 extern int32_t sli_link_is_configurable(sli4_t *);
3673 #include "ocs_fcp.h"
3676 * @brief Maximum value for a FCFI
3678 * Note that although most commands provide a 16 bit field for the FCFI,
3679 * the FC/FCoE Asynchronous Recived CQE format only provides 6 bits for
3680 * the returned FCFI. Then effectively, the FCFI cannot be larger than
3683 #define SLI4_MAX_FCFI 64
3686 * @brief Maximum value for FCF index
3688 * The SLI-4 specification uses a 16 bit field in most places for the FCF
3689 * index, but practically, this value will be much smaller. Arbitrarily
3690 * limit the max FCF index to match the max FCFI value.
3692 #define SLI4_MAX_FCF_INDEX SLI4_MAX_FCFI
3694 /*************************************************************************
3695 * SLI-4 FC/FCoE mailbox command formats and definitions.
3699 * FC/FCoE opcode (OPC) values.
3701 #define SLI4_OPC_FCOE_WQ_CREATE 0x1
3702 #define SLI4_OPC_FCOE_WQ_DESTROY 0x2
3703 #define SLI4_OPC_FCOE_POST_SGL_PAGES 0x3
3704 #define SLI4_OPC_FCOE_RQ_CREATE 0x5
3705 #define SLI4_OPC_FCOE_RQ_DESTROY 0x6
3706 #define SLI4_OPC_FCOE_READ_FCF_TABLE 0x8
3707 #define SLI4_OPC_FCOE_POST_HDR_TEMPLATES 0xb
3708 #define SLI4_OPC_FCOE_REDISCOVER_FCF 0x10
3710 /* Use the default CQ associated with the WQ */
3711 #define SLI4_CQ_DEFAULT 0xffff
3713 typedef struct sli4_physical_page_descriptor_s {
3716 } sli4_physical_page_descriptor_t;
3719 * @brief FCOE_WQ_CREATE
3721 * Create a Work Queue for FC/FCoE use.
3723 #define SLI4_FCOE_WQ_CREATE_V0_MAX_PAGES 4
3725 typedef struct sli4_req_fcoe_wq_create_s {
3727 #if BYTE_ORDER == LITTLE_ENDIAN
3728 uint32_t num_pages:8,
3732 sli4_physical_page_descriptor_t page_physical_address[SLI4_FCOE_WQ_CREATE_V0_MAX_PAGES];
3738 #error big endian version not defined
3740 } sli4_req_fcoe_wq_create_t;
3743 * @brief FCOE_WQ_CREATE_V1
3745 * Create a version 1 Work Queue for FC/FCoE use.
3747 typedef struct sli4_req_fcoe_wq_create_v1_s {
3749 #if BYTE_ORDER == LITTLE_ENDIAN
3750 uint32_t num_pages:16,
3752 uint32_t page_size:8,
3757 sli4_physical_page_descriptor_t page_physical_address[8];
3759 #error big endian version not defined
3761 } sli4_req_fcoe_wq_create_v1_t;
3763 #define SLI4_FCOE_WQ_CREATE_V1_MAX_PAGES 8
3766 * @brief FCOE_WQ_DESTROY
3768 * Destroy an FC/FCoE Work Queue.
3770 typedef struct sli4_req_fcoe_wq_destroy_s {
3772 #if BYTE_ORDER == LITTLE_ENDIAN
3776 #error big endian version not defined
3778 } sli4_req_fcoe_wq_destroy_t;
3781 * @brief FCOE_POST_SGL_PAGES
3783 * Register the scatter gather list (SGL) memory and associate it with an XRI.
3785 typedef struct sli4_req_fcoe_post_sgl_pages_s {
3787 #if BYTE_ORDER == LITTLE_ENDIAN
3788 uint32_t xri_start:16,
3792 uint32_t page0_high;
3794 uint32_t page1_high;
3797 #error big endian version not defined
3799 } sli4_req_fcoe_post_sgl_pages_t;
3802 * @brief FCOE_RQ_CREATE
3804 * Create a Receive Queue for FC/FCoE use.
3806 typedef struct sli4_req_fcoe_rq_create_s {
3808 #if BYTE_ORDER == LITTLE_ENDIAN
3809 uint32_t num_pages:16,
3818 uint32_t buffer_size:16,
3821 sli4_physical_page_descriptor_t page_physical_address[8];
3823 #error big endian version not defined
3825 } sli4_req_fcoe_rq_create_t;
3827 #define SLI4_FCOE_RQ_CREATE_V0_MAX_PAGES 8
3828 #define SLI4_FCOE_RQ_CREATE_V0_MIN_BUF_SIZE 128
3829 #define SLI4_FCOE_RQ_CREATE_V0_MAX_BUF_SIZE 2048
3832 * @brief FCOE_RQ_CREATE_V1
3834 * Create a version 1 Receive Queue for FC/FCoE use.
3836 typedef struct sli4_req_fcoe_rq_create_v1_s {
3838 #if BYTE_ORDER == LITTLE_ENDIAN
3839 uint32_t num_pages:16,
3844 uint32_t page_size:8,
3851 uint32_t buffer_size;
3852 sli4_physical_page_descriptor_t page_physical_address[8];
3854 #error big endian version not defined
3856 } sli4_req_fcoe_rq_create_v1_t;
3859 * @brief FCOE_RQ_CREATE_V2
3861 * Create a version 2 Receive Queue for FC/FCoE use.
3863 typedef struct sli4_req_fcoe_rq_create_v2_s {
3865 #if BYTE_ORDER == LITTLE_ENDIAN
3866 uint32_t num_pages:16,
3872 uint32_t page_size:8,
3876 uint32_t hdr_buffer_size:16,
3877 payload_buffer_size:16;
3878 uint32_t base_cq_id:16,
3881 sli4_physical_page_descriptor_t page_physical_address[0];
3883 #error big endian version not defined
3885 } sli4_req_fcoe_rq_create_v2_t;
3887 #define SLI4_FCOE_RQ_CREATE_V1_MAX_PAGES 8
3888 #define SLI4_FCOE_RQ_CREATE_V1_MIN_BUF_SIZE 64
3889 #define SLI4_FCOE_RQ_CREATE_V1_MAX_BUF_SIZE 2048
3891 #define SLI4_FCOE_RQE_SIZE_8 0x2
3892 #define SLI4_FCOE_RQE_SIZE_16 0x3
3893 #define SLI4_FCOE_RQE_SIZE_32 0x4
3894 #define SLI4_FCOE_RQE_SIZE_64 0x5
3895 #define SLI4_FCOE_RQE_SIZE_128 0x6
3897 #define SLI4_FCOE_RQ_PAGE_SIZE_4096 0x1
3898 #define SLI4_FCOE_RQ_PAGE_SIZE_8192 0x2
3899 #define SLI4_FCOE_RQ_PAGE_SIZE_16384 0x4
3900 #define SLI4_FCOE_RQ_PAGE_SIZE_32768 0x8
3901 #define SLI4_FCOE_RQ_PAGE_SIZE_64536 0x10
3903 #define SLI4_FCOE_RQE_SIZE 8
3906 * @brief FCOE_RQ_DESTROY
3908 * Destroy an FC/FCoE Receive Queue.
3910 typedef struct sli4_req_fcoe_rq_destroy_s {
3912 #if BYTE_ORDER == LITTLE_ENDIAN
3916 #error big endian version not defined
3918 } sli4_req_fcoe_rq_destroy_t;
3921 * @brief FCOE_READ_FCF_TABLE
3923 * Retrieve a FCF database (also known as a table) entry created by the SLI Port
3924 * during FIP discovery.
3926 typedef struct sli4_req_fcoe_read_fcf_table_s {
3928 #if BYTE_ORDER == LITTLE_ENDIAN
3929 uint32_t fcf_index:16,
3932 #error big endian version not defined
3934 } sli4_req_fcoe_read_fcf_table_t;
3936 /* A FCF index of -1 on the request means return the first valid entry */
3937 #define SLI4_FCOE_FCF_TABLE_FIRST (UINT16_MAX)
3940 * @brief FCF table entry
3942 * This is the information returned by the FCOE_READ_FCF_TABLE command.
3944 typedef struct sli4_fcf_entry_s {
3945 #if BYTE_ORDER == LITTLE_ENDIAN
3946 uint32_t max_receive_size;
3947 uint32_t fip_keep_alive;
3948 uint32_t fip_priority;
3949 uint8_t fcf_mac_address[6];
3950 uint8_t fcf_available;
3951 uint8_t mac_address_provider;
3952 uint8_t fabric_name_id[8];
3958 uint32_t fcf_index:16,
3960 uint8_t vlan_bitmap[512];
3961 uint8_t switch_name[8];
3963 #error big endian version not defined
3968 * @brief FCOE_READ_FCF_TABLE response.
3970 typedef struct sli4_res_fcoe_read_fcf_table_s {
3972 #if BYTE_ORDER == LITTLE_ENDIAN
3974 uint32_t next_index:16,
3976 sli4_fcf_entry_t fcf_entry;
3978 #error big endian version not defined
3980 } sli4_res_fcoe_read_fcf_table_t;
3982 /* A next FCF index of -1 in the response means this is the last valid entry */
3983 #define SLI4_FCOE_FCF_TABLE_LAST (UINT16_MAX)
3986 * @brief FCOE_POST_HDR_TEMPLATES
3988 typedef struct sli4_req_fcoe_post_hdr_templates_s {
3990 #if BYTE_ORDER == LITTLE_ENDIAN
3991 uint32_t rpi_offset:16,
3993 sli4_physical_page_descriptor_t page_descriptor[0];
3995 #error big endian version not defined
3997 } sli4_req_fcoe_post_hdr_templates_t;
3999 #define SLI4_FCOE_HDR_TEMPLATE_SIZE 64
4002 * @brief FCOE_REDISCOVER_FCF
4004 typedef struct sli4_req_fcoe_rediscover_fcf_s {
4006 #if BYTE_ORDER == LITTLE_ENDIAN
4007 uint32_t fcf_count:16,
4010 uint16_t fcf_index[16];
4012 #error big endian version not defined
4014 } sli4_req_fcoe_rediscover_fcf_t;
4017 * Work Queue Entry (WQE) types.
4019 #define SLI4_WQE_ABORT 0x0f
4020 #define SLI4_WQE_ELS_REQUEST64 0x8a
4021 #define SLI4_WQE_FCP_IBIDIR64 0xac
4022 #define SLI4_WQE_FCP_IREAD64 0x9a
4023 #define SLI4_WQE_FCP_IWRITE64 0x98
4024 #define SLI4_WQE_FCP_ICMND64 0x9c
4025 #define SLI4_WQE_FCP_TRECEIVE64 0xa1
4026 #define SLI4_WQE_FCP_CONT_TRECEIVE64 0xe5
4027 #define SLI4_WQE_FCP_TRSP64 0xa3
4028 #define SLI4_WQE_FCP_TSEND64 0x9f
4029 #define SLI4_WQE_GEN_REQUEST64 0xc2
4030 #define SLI4_WQE_SEND_FRAME 0xe1
4031 #define SLI4_WQE_XMIT_BCAST64 0X84
4032 #define SLI4_WQE_XMIT_BLS_RSP 0x97
4033 #define SLI4_WQE_ELS_RSP64 0x95
4034 #define SLI4_WQE_XMIT_SEQUENCE64 0x82
4035 #define SLI4_WQE_REQUEUE_XRI 0x93
4038 * WQE command types.
4040 #define SLI4_CMD_FCP_IREAD64_WQE 0x00
4041 #define SLI4_CMD_FCP_ICMND64_WQE 0x00
4042 #define SLI4_CMD_FCP_IWRITE64_WQE 0x01
4043 #define SLI4_CMD_FCP_TRECEIVE64_WQE 0x02
4044 #define SLI4_CMD_FCP_TRSP64_WQE 0x03
4045 #define SLI4_CMD_FCP_TSEND64_WQE 0x07
4046 #define SLI4_CMD_GEN_REQUEST64_WQE 0x08
4047 #define SLI4_CMD_XMIT_BCAST64_WQE 0x08
4048 #define SLI4_CMD_XMIT_BLS_RSP64_WQE 0x08
4049 #define SLI4_CMD_ABORT_WQE 0x08
4050 #define SLI4_CMD_XMIT_SEQUENCE64_WQE 0x08
4051 #define SLI4_CMD_REQUEUE_XRI_WQE 0x0A
4052 #define SLI4_CMD_SEND_FRAME_WQE 0x0a
4054 #define SLI4_WQE_SIZE 0x05
4055 #define SLI4_WQE_EXT_SIZE 0x06
4057 #define SLI4_WQE_BYTES (16 * sizeof(uint32_t))
4058 #define SLI4_WQE_EXT_BYTES (32 * sizeof(uint32_t))
4060 /* Mask for ccp (CS_CTL) */
4061 #define SLI4_MASK_CCP 0xfe /* Upper 7 bits of CS_CTL is priority */
4064 * @brief Generic WQE
4066 typedef struct sli4_generic_wqe_s {
4067 #if BYTE_ORDER == LITTLE_ENDIAN
4068 uint32_t cmd_spec0_5[6];
4069 uint32_t xri_tag:16,
4081 uint32_t request_tag:16,
4083 uint32_t ebde_cnt:4,
4100 uint32_t cmd_type:4,
4106 #error big endian version not defined
4108 } sli4_generic_wqe_t;
4111 * @brief WQE used to abort exchanges.
4113 typedef struct sli4_abort_wqe_s {
4114 #if BYTE_ORDER == LITTLE_ENDIAN
4123 uint32_t ext_t_mask;
4125 uint32_t xri_tag:16,
4137 uint32_t request_tag:16,
4139 uint32_t ebde_cnt:4,
4156 uint32_t cmd_type:4,
4162 #error big endian version not defined
4166 #define SLI4_ABORT_CRITERIA_XRI_TAG 0x01
4167 #define SLI4_ABORT_CRITERIA_ABORT_TAG 0x02
4168 #define SLI4_ABORT_CRITERIA_REQUEST_TAG 0x03
4169 #define SLI4_ABORT_CRITERIA_EXT_ABORT_TAG 0x04
4174 SLI_ABORT_REQUEST_ID,
4175 SLI_ABORT_MAX, /* must be last */
4176 } sli4_abort_type_e;
4179 * @brief WQE used to create an ELS request.
4181 typedef struct sli4_els_request64_wqe_s {
4182 sli4_bde_t els_request_payload;
4183 #if BYTE_ORDER == LITTLE_ENDIAN
4184 uint32_t els_request_payload_length;
4188 uint32_t remote_id:24,
4190 uint32_t xri_tag:16,
4202 uint32_t request_tag:16,
4204 uint32_t ebde_cnt:4,
4221 uint32_t cmd_type:4,
4226 sli4_bde_t els_response_payload_bde;
4227 uint32_t max_response_payload_length;
4229 #error big endian version not defined
4231 } sli4_els_request64_wqe_t;
4233 #define SLI4_ELS_REQUEST64_CONTEXT_RPI 0x0
4234 #define SLI4_ELS_REQUEST64_CONTEXT_VPI 0x1
4235 #define SLI4_ELS_REQUEST64_CONTEXT_VFI 0x2
4236 #define SLI4_ELS_REQUEST64_CONTEXT_FCFI 0x3
4238 #define SLI4_ELS_REQUEST64_CLASS_2 0x1
4239 #define SLI4_ELS_REQUEST64_CLASS_3 0x2
4241 #define SLI4_ELS_REQUEST64_DIR_WRITE 0x0
4242 #define SLI4_ELS_REQUEST64_DIR_READ 0x1
4244 #define SLI4_ELS_REQUEST64_OTHER 0x0
4245 #define SLI4_ELS_REQUEST64_LOGO 0x1
4246 #define SLI4_ELS_REQUEST64_FDISC 0x2
4247 #define SLI4_ELS_REQUEST64_FLOGIN 0x3
4248 #define SLI4_ELS_REQUEST64_PLOGI 0x4
4250 #define SLI4_ELS_REQUEST64_CMD_GEN 0x08
4251 #define SLI4_ELS_REQUEST64_CMD_NON_FABRIC 0x0c
4252 #define SLI4_ELS_REQUEST64_CMD_FABRIC 0x0d
4255 * @brief WQE used to create an FCP initiator no data command.
4257 typedef struct sli4_fcp_icmnd64_wqe_s {
4259 #if BYTE_ORDER == LITTLE_ENDIAN
4260 uint32_t payload_offset_length:16,
4261 fcp_cmd_buffer_length:16;
4263 uint32_t remote_n_port_id:24,
4265 uint32_t xri_tag:16,
4279 uint32_t request_tag:16,
4281 uint32_t ebde_cnt:4,
4298 uint32_t cmd_type:4,
4308 #error big endian version not defined
4310 } sli4_fcp_icmnd64_wqe_t;
4313 * @brief WQE used to create an FCP initiator read.
4315 typedef struct sli4_fcp_iread64_wqe_s {
4317 #if BYTE_ORDER == LITTLE_ENDIAN
4318 uint32_t payload_offset_length:16,
4319 fcp_cmd_buffer_length:16;
4320 uint32_t total_transfer_length;
4321 uint32_t remote_n_port_id:24,
4323 uint32_t xri_tag:16,
4337 uint32_t request_tag:16,
4339 uint32_t ebde_cnt:4,
4356 uint32_t cmd_type:4,
4363 #error big endian version not defined
4365 sli4_bde_t first_data_bde; /* reserved if performance hints disabled */
4366 } sli4_fcp_iread64_wqe_t;
4369 * @brief WQE used to create an FCP initiator write.
4371 typedef struct sli4_fcp_iwrite64_wqe_s {
4373 #if BYTE_ORDER == LITTLE_ENDIAN
4374 uint32_t payload_offset_length:16,
4375 fcp_cmd_buffer_length:16;
4376 uint32_t total_transfer_length;
4377 uint32_t initial_transfer_length;
4378 uint32_t xri_tag:16,
4392 uint32_t request_tag:16,
4394 uint32_t ebde_cnt:4,
4411 uint32_t cmd_type:4,
4416 uint32_t remote_n_port_id:24,
4419 #error big endian version not defined
4421 sli4_bde_t first_data_bde;
4422 } sli4_fcp_iwrite64_wqe_t;
4424 typedef struct sli4_fcp_128byte_wqe_s {
4426 } sli4_fcp_128byte_wqe_t;
4429 * @brief WQE used to create an FCP target receive, and FCP target
4432 typedef struct sli4_fcp_treceive64_wqe_s {
4434 #if BYTE_ORDER == LITTLE_ENDIAN
4435 uint32_t payload_offset_length;
4436 uint32_t relative_offset;
4438 * DWord 5 can either be the task retry identifier (HLM=0) or
4439 * the remote N_Port ID (HLM=1), or if implementing the Skyhawk
4440 * T10-PI workaround, the secondary xri tag
4443 uint32_t sec_xri_tag:16,
4447 uint32_t xri_tag:16,
4461 uint32_t request_tag:16,
4463 uint32_t ebde_cnt:4,
4482 uint32_t cmd_type:4,
4487 uint32_t fcp_data_receive_length;
4490 #error big endian version not defined
4492 sli4_bde_t first_data_bde; /* For performance hints */
4494 } sli4_fcp_treceive64_wqe_t;
4497 * @brief WQE used to create an FCP target response.
4499 typedef struct sli4_fcp_trsp64_wqe_s {
4501 #if BYTE_ORDER == LITTLE_ENDIAN
4502 uint32_t fcp_response_length;
4505 * DWord 5 can either be the task retry identifier (HLM=0) or
4506 * the remote N_Port ID (HLM=1)
4509 uint32_t xri_tag:16,
4523 uint32_t request_tag:16,
4525 uint32_t ebde_cnt:4,
4544 uint32_t cmd_type:4,
4554 #error big endian version not defined
4556 } sli4_fcp_trsp64_wqe_t;
4559 * @brief WQE used to create an FCP target send (DATA IN).
4561 typedef struct sli4_fcp_tsend64_wqe_s {
4563 #if BYTE_ORDER == LITTLE_ENDIAN
4564 uint32_t payload_offset_length;
4565 uint32_t relative_offset;
4567 * DWord 5 can either be the task retry identifier (HLM=0) or
4568 * the remote N_Port ID (HLM=1)
4571 uint32_t xri_tag:16,
4585 uint32_t request_tag:16,
4587 uint32_t ebde_cnt:4,
4606 uint32_t cmd_type:4,
4611 uint32_t fcp_data_transmit_length;
4614 #error big endian version not defined
4616 sli4_bde_t first_data_bde; /* For performance hints */
4617 } sli4_fcp_tsend64_wqe_t;
4619 #define SLI4_IO_CONTINUATION BIT(0) /** The XRI associated with this IO is already active */
4620 #define SLI4_IO_AUTO_GOOD_RESPONSE BIT(1) /** Automatically generate a good RSP frame */
4621 #define SLI4_IO_NO_ABORT BIT(2)
4622 #define SLI4_IO_DNRX BIT(3) /** Set the DNRX bit because no auto xref rdy buffer is posted */
4624 /* WQE DIF field contents */
4625 #define SLI4_DIF_DISABLED 0
4626 #define SLI4_DIF_PASS_THROUGH 1
4627 #define SLI4_DIF_STRIP 2
4628 #define SLI4_DIF_INSERT 3
4631 * @brief WQE used to create a general request.
4633 typedef struct sli4_gen_request64_wqe_s {
4635 #if BYTE_ORDER == LITTLE_ENDIAN
4636 uint32_t request_payload_length;
4637 uint32_t relative_offset;
4642 uint32_t xri_tag:16,
4654 uint32_t request_tag:16,
4656 uint32_t ebde_cnt:4,
4673 uint32_t cmd_type:4,
4678 uint32_t remote_n_port_id:24,
4682 uint32_t max_response_payload_length;
4684 #error big endian version not defined
4686 } sli4_gen_request64_wqe_t;
4689 * @brief WQE used to create a send frame request.
4691 typedef struct sli4_send_frame_wqe_s {
4693 #if BYTE_ORDER == LITTLE_ENDIAN
4694 uint32_t frame_length;
4695 uint32_t fc_header_0_1[2];
4696 uint32_t xri_tag:16,
4708 uint32_t request_tag:16,
4711 uint32_t ebde_cnt:4,
4728 uint32_t cmd_type:4,
4733 uint32_t fc_header_2_5[4];
4735 #error big endian version not defined
4737 } sli4_send_frame_wqe_t;
4740 * @brief WQE used to create a transmit sequence.
4742 typedef struct sli4_xmit_sequence64_wqe_s {
4744 #if BYTE_ORDER == LITTLE_ENDIAN
4745 uint32_t remote_n_port_id:24,
4747 uint32_t relative_offset;
4757 uint32_t xri_tag:16,
4770 uint32_t request_tag:16,
4772 uint32_t ebde_cnt:4,
4789 uint32_t cmd_type:4,
4794 uint32_t sequence_payload_len;
4799 #error big endian version not defined
4801 } sli4_xmit_sequence64_wqe_t;
4804 * @brief WQE used unblock the specified XRI and to release it to the SLI Port's free pool.
4806 typedef struct sli4_requeue_xri_wqe_s {
4813 #if BYTE_ORDER == LITTLE_ENDIAN
4814 uint32_t xri_tag:16,
4826 uint32_t request_tag:16,
4828 uint32_t ebde_cnt:4,
4845 uint32_t cmd_type:4,
4855 #error big endian version not defined
4857 } sli4_requeue_xri_wqe_t;
4860 * @brief WQE used to send a single frame sequence to broadcast address
4862 typedef struct sli4_xmit_bcast64_wqe_s {
4863 sli4_bde_t sequence_payload;
4864 #if BYTE_ORDER == LITTLE_ENDIAN
4865 uint32_t sequence_payload_length;
4871 uint32_t xri_tag:16,
4883 uint32_t request_tag:16,
4885 uint32_t ebde_cnt:4,
4902 uint32_t cmd_type:4,
4912 #error big endian version not defined
4914 } sli4_xmit_bcast64_wqe_t;
4917 * @brief WQE used to create a BLS response.
4919 typedef struct sli4_xmit_bls_rsp_wqe_s {
4920 #if BYTE_ORDER == LITTLE_ENDIAN
4921 uint32_t payload_word0;
4924 uint32_t high_seq_cnt:16,
4927 uint32_t local_n_port_id:24,
4929 uint32_t remote_id:24,
4933 uint32_t xri_tag:16,
4945 uint32_t request_tag:16,
4947 uint32_t ebde_cnt:4,
4964 uint32_t cmd_type:4,
4969 uint32_t temporary_rpi:16,
4975 #error big endian version not defined
4977 } sli4_xmit_bls_rsp_wqe_t;
4985 typedef struct sli_bls_payload_s {
4986 sli_bls_type_e type;
4991 uint32_t seq_id_validity:8,
4996 uint16_t low_seq_cnt;
4997 uint16_t high_seq_cnt;
5000 uint32_t vendor_unique:8,
5001 reason_explanation:8,
5006 } sli_bls_payload_t;
5009 * @brief WQE used to create an ELS response.
5011 typedef struct sli4_xmit_els_rsp64_wqe_s {
5012 sli4_bde_t els_response_payload;
5013 #if BYTE_ORDER == LITTLE_ENDIAN
5014 uint32_t els_response_payload_length;
5018 uint32_t remote_id:24,
5020 uint32_t xri_tag:16,
5032 uint32_t request_tag:16,
5034 uint32_t ebde_cnt:4,
5051 uint32_t cmd_type:4,
5056 uint32_t temporary_rpi:16,
5062 #error big endian version not defined
5064 } sli4_xmit_els_rsp64_wqe_t;
5067 * @brief Asynchronouse Event: Link State ACQE.
5069 typedef struct sli4_link_state_s {
5070 #if BYTE_ORDER == LITTLE_ENDIAN
5071 uint32_t link_number:6,
5076 uint32_t port_fault:8,
5078 logical_link_speed:16;
5082 event_type:8, /** values are protocol specific */
5084 ae:1, /** async event - this is an ACQE */
5085 val:1; /** valid - contents of CQE are valid */
5087 #error big endian version not defined
5089 } sli4_link_state_t;
5091 #define SLI4_LINK_ATTN_TYPE_LINK_UP 0x01
5092 #define SLI4_LINK_ATTN_TYPE_LINK_DOWN 0x02
5093 #define SLI4_LINK_ATTN_TYPE_NO_HARD_ALPA 0x03
5095 #define SLI4_LINK_ATTN_P2P 0x01
5096 #define SLI4_LINK_ATTN_FC_AL 0x02
5097 #define SLI4_LINK_ATTN_INTERNAL_LOOPBACK 0x03
5098 #define SLI4_LINK_ATTN_SERDES_LOOPBACK 0x04
5100 #define SLI4_LINK_ATTN_1G 0x01
5101 #define SLI4_LINK_ATTN_2G 0x02
5102 #define SLI4_LINK_ATTN_4G 0x04
5103 #define SLI4_LINK_ATTN_8G 0x08
5104 #define SLI4_LINK_ATTN_10G 0x0a
5105 #define SLI4_LINK_ATTN_16G 0x10
5107 #define SLI4_LINK_TYPE_ETHERNET 0x0
5108 #define SLI4_LINK_TYPE_FC 0x1
5111 * @brief Asynchronouse Event: FC Link Attention Event.
5113 typedef struct sli4_link_attention_s {
5114 #if BYTE_ORDER == LITTLE_ENDIAN
5115 uint32_t link_number:8,
5119 uint32_t port_fault:8,
5120 shared_link_status:8,
5121 logical_link_speed:16;
5125 event_type:8, /** values are protocol specific */
5127 ae:1, /** async event - this is an ACQE */
5128 val:1; /** valid - contents of CQE are valid */
5130 #error big endian version not defined
5132 } sli4_link_attention_t;
5135 * @brief FC/FCoE event types.
5137 #define SLI4_LINK_STATE_PHYSICAL 0x00
5138 #define SLI4_LINK_STATE_LOGICAL 0x01
5140 #define SLI4_FCOE_FIP_FCF_DISCOVERED 0x01
5141 #define SLI4_FCOE_FIP_FCF_TABLE_FULL 0x02
5142 #define SLI4_FCOE_FIP_FCF_DEAD 0x03
5143 #define SLI4_FCOE_FIP_FCF_CLEAR_VLINK 0x04
5144 #define SLI4_FCOE_FIP_FCF_MODIFIED 0x05
5146 #define SLI4_GRP5_QOS_SPEED 0x01
5148 #define SLI4_FC_EVENT_LINK_ATTENTION 0x01
5149 #define SLI4_FC_EVENT_SHARED_LINK_ATTENTION 0x02
5151 #define SLI4_PORT_SPEED_NO_LINK 0x0
5152 #define SLI4_PORT_SPEED_10_MBPS 0x1
5153 #define SLI4_PORT_SPEED_100_MBPS 0x2
5154 #define SLI4_PORT_SPEED_1_GBPS 0x3
5155 #define SLI4_PORT_SPEED_10_GBPS 0x4
5157 #define SLI4_PORT_DUPLEX_NONE 0x0
5158 #define SLI4_PORT_DUPLEX_HWF 0x1
5159 #define SLI4_PORT_DUPLEX_FULL 0x2
5161 #define SLI4_PORT_LINK_STATUS_PHYSICAL_DOWN 0x0
5162 #define SLI4_PORT_LINK_STATUS_PHYSICAL_UP 0x1
5163 #define SLI4_PORT_LINK_STATUS_LOGICAL_DOWN 0x2
5164 #define SLI4_PORT_LINK_STATUS_LOGICAL_UP 0x3
5167 * @brief Asynchronouse Event: FCoE/FIP ACQE.
5169 typedef struct sli4_fcoe_fip_s {
5170 #if BYTE_ORDER == LITTLE_ENDIAN
5171 uint32_t event_information;
5172 uint32_t fcf_count:16,
5177 event_type:8, /** values are protocol specific */
5179 ae:1, /** async event - this is an ACQE */
5180 val:1; /** valid - contents of CQE are valid */
5182 #error big endian version not defined
5187 * @brief FC/FCoE WQ completion queue entry.
5189 typedef struct sli4_fc_wcqe_s {
5190 #if BYTE_ORDER == LITTLE_ENDIAN
5191 uint32_t hw_status:8,
5194 uint32_t wqe_specific_1;
5195 uint32_t wqe_specific_2;
5205 #error big endian version not defined
5210 * @brief FC/FCoE WQ consumed CQ queue entry.
5212 typedef struct sli4_fc_wqec_s {
5213 #if BYTE_ORDER == LITTLE_ENDIAN
5216 uint32_t wqe_index:16,
5223 #error big endian version not defined
5228 * @brief FC/FCoE Completion Status Codes.
5230 #define SLI4_FC_WCQE_STATUS_SUCCESS 0x00
5231 #define SLI4_FC_WCQE_STATUS_FCP_RSP_FAILURE 0x01
5232 #define SLI4_FC_WCQE_STATUS_REMOTE_STOP 0x02
5233 #define SLI4_FC_WCQE_STATUS_LOCAL_REJECT 0x03
5234 #define SLI4_FC_WCQE_STATUS_NPORT_RJT 0x04
5235 #define SLI4_FC_WCQE_STATUS_FABRIC_RJT 0x05
5236 #define SLI4_FC_WCQE_STATUS_NPORT_BSY 0x06
5237 #define SLI4_FC_WCQE_STATUS_FABRIC_BSY 0x07
5238 #define SLI4_FC_WCQE_STATUS_LS_RJT 0x09
5239 #define SLI4_FC_WCQE_STATUS_CMD_REJECT 0x0b
5240 #define SLI4_FC_WCQE_STATUS_FCP_TGT_LENCHECK 0x0c
5241 #define SLI4_FC_WCQE_STATUS_RQ_BUF_LEN_EXCEEDED 0x11
5242 #define SLI4_FC_WCQE_STATUS_RQ_INSUFF_BUF_NEEDED 0x12
5243 #define SLI4_FC_WCQE_STATUS_RQ_INSUFF_FRM_DISC 0x13
5244 #define SLI4_FC_WCQE_STATUS_RQ_DMA_FAILURE 0x14
5245 #define SLI4_FC_WCQE_STATUS_FCP_RSP_TRUNCATE 0x15
5246 #define SLI4_FC_WCQE_STATUS_DI_ERROR 0x16
5247 #define SLI4_FC_WCQE_STATUS_BA_RJT 0x17
5248 #define SLI4_FC_WCQE_STATUS_RQ_INSUFF_XRI_NEEDED 0x18
5249 #define SLI4_FC_WCQE_STATUS_RQ_INSUFF_XRI_DISC 0x19
5250 #define SLI4_FC_WCQE_STATUS_RX_ERROR_DETECT 0x1a
5251 #define SLI4_FC_WCQE_STATUS_RX_ABORT_REQUEST 0x1b
5253 /* driver generated status codes; better not overlap with chip's status codes! */
5254 #define SLI4_FC_WCQE_STATUS_TARGET_WQE_TIMEOUT 0xff
5255 #define SLI4_FC_WCQE_STATUS_SHUTDOWN 0xfe
5256 #define SLI4_FC_WCQE_STATUS_DISPATCH_ERROR 0xfd
5259 * @brief DI_ERROR Extended Status
5261 #define SLI4_FC_DI_ERROR_GE (1 << 0) /* Guard Error */
5262 #define SLI4_FC_DI_ERROR_AE (1 << 1) /* Application Tag Error */
5263 #define SLI4_FC_DI_ERROR_RE (1 << 2) /* Reference Tag Error */
5264 #define SLI4_FC_DI_ERROR_TDPV (1 << 3) /* Total Data Placed Valid */
5265 #define SLI4_FC_DI_ERROR_UDB (1 << 4) /* Uninitialized DIF Block */
5266 #define SLI4_FC_DI_ERROR_EDIR (1 << 5) /* Error direction */
5269 * @brief Local Reject Reason Codes.
5271 #define SLI4_FC_LOCAL_REJECT_MISSING_CONTINUE 0x01
5272 #define SLI4_FC_LOCAL_REJECT_SEQUENCE_TIMEOUT 0x02
5273 #define SLI4_FC_LOCAL_REJECT_INTERNAL_ERROR 0x03
5274 #define SLI4_FC_LOCAL_REJECT_INVALID_RPI 0x04
5275 #define SLI4_FC_LOCAL_REJECT_NO_XRI 0x05
5276 #define SLI4_FC_LOCAL_REJECT_ILLEGAL_COMMAND 0x06
5277 #define SLI4_FC_LOCAL_REJECT_XCHG_DROPPED 0x07
5278 #define SLI4_FC_LOCAL_REJECT_ILLEGAL_FIELD 0x08
5279 #define SLI4_FC_LOCAL_REJECT_NO_ABORT_MATCH 0x0c
5280 #define SLI4_FC_LOCAL_REJECT_TX_DMA_FAILED 0x0d
5281 #define SLI4_FC_LOCAL_REJECT_RX_DMA_FAILED 0x0e
5282 #define SLI4_FC_LOCAL_REJECT_ILLEGAL_FRAME 0x0f
5283 #define SLI4_FC_LOCAL_REJECT_NO_RESOURCES 0x11
5284 #define SLI4_FC_LOCAL_REJECT_FCP_CONF_FAILURE 0x12
5285 #define SLI4_FC_LOCAL_REJECT_ILLEGAL_LENGTH 0x13
5286 #define SLI4_FC_LOCAL_REJECT_UNSUPPORTED_FEATURE 0x14
5287 #define SLI4_FC_LOCAL_REJECT_ABORT_IN_PROGRESS 0x15
5288 #define SLI4_FC_LOCAL_REJECT_ABORT_REQUESTED 0x16
5289 #define SLI4_FC_LOCAL_REJECT_RCV_BUFFER_TIMEOUT 0x17
5290 #define SLI4_FC_LOCAL_REJECT_LOOP_OPEN_FAILURE 0x18
5291 #define SLI4_FC_LOCAL_REJECT_LINK_DOWN 0x1a
5292 #define SLI4_FC_LOCAL_REJECT_CORRUPTED_DATA 0x1b
5293 #define SLI4_FC_LOCAL_REJECT_CORRUPTED_RPI 0x1c
5294 #define SLI4_FC_LOCAL_REJECT_OUT_OF_ORDER_DATA 0x1d
5295 #define SLI4_FC_LOCAL_REJECT_OUT_OF_ORDER_ACK 0x1e
5296 #define SLI4_FC_LOCAL_REJECT_DUP_FRAME 0x1f
5297 #define SLI4_FC_LOCAL_REJECT_LINK_CONTROL_FRAME 0x20
5298 #define SLI4_FC_LOCAL_REJECT_BAD_HOST_ADDRESS 0x21
5299 #define SLI4_FC_LOCAL_REJECT_MISSING_HDR_BUFFER 0x23
5300 #define SLI4_FC_LOCAL_REJECT_MSEQ_CHAIN_CORRUPTED 0x24
5301 #define SLI4_FC_LOCAL_REJECT_ABORTMULT_REQUESTED 0x25
5302 #define SLI4_FC_LOCAL_REJECT_BUFFER_SHORTAGE 0x28
5303 #define SLI4_FC_LOCAL_REJECT_RCV_XRIBUF_WAITING 0x29
5304 #define SLI4_FC_LOCAL_REJECT_INVALID_VPI 0x2e
5305 #define SLI4_FC_LOCAL_REJECT_MISSING_XRIBUF 0x30
5306 #define SLI4_FC_LOCAL_REJECT_INVALID_RELOFFSET 0x40
5307 #define SLI4_FC_LOCAL_REJECT_MISSING_RELOFFSET 0x41
5308 #define SLI4_FC_LOCAL_REJECT_INSUFF_BUFFERSPACE 0x42
5309 #define SLI4_FC_LOCAL_REJECT_MISSING_SI 0x43
5310 #define SLI4_FC_LOCAL_REJECT_MISSING_ES 0x44
5311 #define SLI4_FC_LOCAL_REJECT_INCOMPLETE_XFER 0x45
5312 #define SLI4_FC_LOCAL_REJECT_SLER_FAILURE 0x46
5313 #define SLI4_FC_LOCAL_REJECT_SLER_CMD_RCV_FAILURE 0x47
5314 #define SLI4_FC_LOCAL_REJECT_SLER_REC_RJT_ERR 0x48
5315 #define SLI4_FC_LOCAL_REJECT_SLER_REC_SRR_RETRY_ERR 0x49
5316 #define SLI4_FC_LOCAL_REJECT_SLER_SRR_RJT_ERR 0x4a
5317 #define SLI4_FC_LOCAL_REJECT_SLER_RRQ_RJT_ERR 0x4c
5318 #define SLI4_FC_LOCAL_REJECT_SLER_RRQ_RETRY_ERR 0x4d
5319 #define SLI4_FC_LOCAL_REJECT_SLER_ABTS_ERR 0x4e
5321 typedef struct sli4_fc_async_rcqe_s {
5322 #if BYTE_ORDER == LITTLE_ENDIAN
5325 rq_element_index:12,
5330 payload_data_placement_length:16;
5331 uint32_t sof_byte:8,
5334 header_data_placement_length:6,
5338 #error big endian version not defined
5340 } sli4_fc_async_rcqe_t;
5342 typedef struct sli4_fc_async_rcqe_v1_s {
5343 #if BYTE_ORDER == LITTLE_ENDIAN
5346 rq_element_index:12,
5351 payload_data_placement_length:16;
5352 uint32_t sof_byte:8,
5355 header_data_placement_length:6,
5359 #error big endian version not defined
5361 } sli4_fc_async_rcqe_v1_t;
5363 #define SLI4_FC_ASYNC_RQ_SUCCESS 0x10
5364 #define SLI4_FC_ASYNC_RQ_BUF_LEN_EXCEEDED 0x11
5365 #define SLI4_FC_ASYNC_RQ_INSUFF_BUF_NEEDED 0x12
5366 #define SLI4_FC_ASYNC_RQ_INSUFF_BUF_FRM_DISC 0x13
5367 #define SLI4_FC_ASYNC_RQ_DMA_FAILURE 0x14
5369 typedef struct sli4_fc_coalescing_rcqe_s {
5370 #if BYTE_ORDER == LITTLE_ENDIAN
5373 rq_element_index:12,
5377 sequence_reporting_placement_length:16;
5383 #error big endian version not defined
5385 } sli4_fc_coalescing_rcqe_t;
5387 #define SLI4_FC_COALESCE_RQ_SUCCESS 0x10
5388 #define SLI4_FC_COALESCE_RQ_INSUFF_XRI_NEEDED 0x18
5390 typedef struct sli4_fc_optimized_write_cmd_cqe_s {
5391 #if BYTE_ORDER == LITTLE_ENDIAN
5394 rq_element_index:15,
5402 payload_data_placement_length:16;
5405 header_data_placement_length:6,
5409 #error big endian version not defined
5411 } sli4_fc_optimized_write_cmd_cqe_t;
5413 typedef struct sli4_fc_optimized_write_data_cqe_s {
5414 #if BYTE_ORDER == LITTLE_ENDIAN
5415 uint32_t hw_status:8,
5418 uint32_t total_data_placed;
5419 uint32_t extended_status;
5429 #error big endian version not defined
5431 } sli4_fc_optimized_write_data_cqe_t;
5433 typedef struct sli4_fc_xri_aborted_cqe_s {
5434 #if BYTE_ORDER == LITTLE_ENDIAN
5438 uint32_t extended_status;
5450 #error big endian version not defined
5452 } sli4_fc_xri_aborted_cqe_t;
5455 * Code definitions applicable to all FC/FCoE CQE types.
5457 #define SLI4_CQE_CODE_OFFSET 14
5459 #define SLI4_CQE_CODE_WORK_REQUEST_COMPLETION 0x01
5460 #define SLI4_CQE_CODE_RELEASE_WQE 0x02
5461 #define SLI4_CQE_CODE_RQ_ASYNC 0x04
5462 #define SLI4_CQE_CODE_XRI_ABORTED 0x05
5463 #define SLI4_CQE_CODE_RQ_COALESCING 0x06
5464 #define SLI4_CQE_CODE_RQ_CONSUMPTION 0x07
5465 #define SLI4_CQE_CODE_MEASUREMENT_REPORTING 0x08
5466 #define SLI4_CQE_CODE_RQ_ASYNC_V1 0x09
5467 #define SLI4_CQE_CODE_OPTIMIZED_WRITE_CMD 0x0B
5468 #define SLI4_CQE_CODE_OPTIMIZED_WRITE_DATA 0x0C
5470 extern int32_t sli_fc_process_link_state(sli4_t *, void *);
5471 extern int32_t sli_fc_process_link_attention(sli4_t *, void *);
5472 extern int32_t sli_fc_cqe_parse(sli4_t *, sli4_queue_t *, uint8_t *, sli4_qentry_e *, uint16_t *);
5473 extern uint32_t sli_fc_response_length(sli4_t *, uint8_t *);
5474 extern uint32_t sli_fc_io_length(sli4_t *, uint8_t *);
5475 extern int32_t sli_fc_els_did(sli4_t *, uint8_t *, uint32_t *);
5476 extern uint32_t sli_fc_ext_status(sli4_t *, uint8_t *);
5477 extern int32_t sli_fc_rqe_rqid_and_index(sli4_t *, uint8_t *, uint16_t *, uint32_t *);
5478 extern int32_t sli_fc_process_fcoe(sli4_t *, void *);
5479 extern int32_t sli_cmd_fcoe_wq_create(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, uint16_t);
5480 extern int32_t sli_cmd_fcoe_wq_create_v1(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, uint16_t);
5481 extern int32_t sli_cmd_fcoe_wq_destroy(sli4_t *, void *, size_t, uint16_t);
5482 extern int32_t sli_cmd_fcoe_post_sgl_pages(sli4_t *, void *, size_t, uint16_t, uint32_t, ocs_dma_t **, ocs_dma_t **,
5484 extern int32_t sli_cmd_fcoe_rq_create(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, uint16_t, uint16_t);
5485 extern int32_t sli_cmd_fcoe_rq_create_v1(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, uint16_t, uint16_t);
5486 extern int32_t sli_cmd_fcoe_rq_destroy(sli4_t *, void *, size_t, uint16_t);
5487 extern int32_t sli_cmd_fcoe_read_fcf_table(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t);
5488 extern int32_t sli_cmd_fcoe_post_hdr_templates(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, ocs_dma_t *);
5489 extern int32_t sli_cmd_fcoe_rediscover_fcf(sli4_t *, void *, size_t, uint16_t);
5490 extern int32_t sli_fc_rq_alloc(sli4_t *, sli4_queue_t *, uint32_t, uint32_t, sli4_queue_t *, uint16_t, uint8_t);
5491 extern int32_t sli_fc_rq_set_alloc(sli4_t *, uint32_t, sli4_queue_t *[], uint32_t, uint32_t, uint32_t, uint32_t, uint16_t);
5492 extern uint32_t sli_fc_get_rpi_requirements(sli4_t *, uint32_t);
5493 extern int32_t sli_abort_wqe(sli4_t *, void *, size_t, sli4_abort_type_e, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t);
5495 extern int32_t sli_els_request64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint8_t, uint32_t, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t, ocs_remote_node_t *);
5496 extern int32_t sli_fcp_iread64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint32_t, uint16_t, uint16_t, uint16_t, uint32_t, ocs_remote_node_t *, uint8_t, uint8_t, uint8_t);
5497 extern int32_t sli_fcp_iwrite64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, uint16_t, uint32_t, ocs_remote_node_t *, uint8_t, uint8_t, uint8_t);
5498 extern int32_t sli_fcp_icmnd64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, uint16_t, uint16_t, uint32_t, ocs_remote_node_t *, uint8_t);
5500 extern int32_t sli_fcp_treceive64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, ocs_remote_node_t *, uint32_t, uint8_t, uint8_t, uint8_t, uint32_t);
5501 extern int32_t sli_fcp_trsp64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, ocs_remote_node_t *, uint32_t, uint8_t, uint8_t, uint32_t);
5502 extern int32_t sli_fcp_tsend64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, ocs_remote_node_t *, uint32_t, uint8_t, uint8_t, uint8_t, uint32_t);
5503 extern int32_t sli_fcp_cont_treceive64_wqe(sli4_t *, void*, size_t, ocs_dma_t *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, ocs_remote_node_t *, uint32_t, uint8_t, uint8_t, uint8_t, uint32_t);
5504 extern int32_t sli_gen_request64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint32_t,uint8_t, uint16_t, uint16_t, uint16_t, ocs_remote_node_t *, uint8_t, uint8_t, uint8_t);
5505 extern int32_t sli_send_frame_wqe(sli4_t *sli4, void *buf, size_t size, uint8_t sof, uint8_t eof, uint32_t *hdr,
5506 ocs_dma_t *payload, uint32_t req_len, uint8_t timeout,
5507 uint16_t xri, uint16_t req_tag);
5508 extern int32_t sli_xmit_sequence64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t, ocs_remote_node_t *, uint8_t, uint8_t, uint8_t);
5509 extern int32_t sli_xmit_bcast64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint8_t, uint16_t, uint16_t, uint16_t, ocs_remote_node_t *, uint8_t, uint8_t, uint8_t);
5510 extern int32_t sli_xmit_bls_rsp64_wqe(sli4_t *, void *, size_t, sli_bls_payload_t *, uint16_t, uint16_t, uint16_t, ocs_remote_node_t *, uint32_t);
5511 extern int32_t sli_xmit_els_rsp64_wqe(sli4_t *, void *, size_t, ocs_dma_t *, uint32_t, uint16_t, uint16_t, uint16_t, uint16_t, ocs_remote_node_t *, uint32_t, uint32_t);
5512 extern int32_t sli_requeue_xri_wqe(sli4_t *, void *, size_t, uint16_t, uint16_t, uint16_t);
5513 extern void sli4_cmd_lowlevel_set_watchdog(sli4_t *sli4, void *buf, size_t size, uint16_t timeout);
5517 * @brief Retrieve the received header and payload length.
5519 * @param sli4 SLI context.
5520 * @param cqe Pointer to the CQ entry.
5521 * @param len_hdr Pointer where the header length is written.
5522 * @param len_data Pointer where the payload length is written.
5524 * @return Returns 0 on success, or a non-zero value on failure.
5526 static inline int32_t
5527 sli_fc_rqe_length(sli4_t *sli4, void *cqe, uint32_t *len_hdr, uint32_t *len_data)
5529 sli4_fc_async_rcqe_t *rcqe = cqe;
5531 *len_hdr = *len_data = 0;
5533 if (SLI4_FC_ASYNC_RQ_SUCCESS == rcqe->status) {
5534 *len_hdr = rcqe->header_data_placement_length;
5535 *len_data = rcqe->payload_data_placement_length;
5544 * @brief Retrieve the received FCFI.
5546 * @param sli4 SLI context.
5547 * @param cqe Pointer to the CQ entry.
5549 * @return Returns the FCFI in the CQE. or UINT8_MAX if invalid CQE code.
5551 static inline uint8_t
5552 sli_fc_rqe_fcfi(sli4_t *sli4, void *cqe)
5554 uint8_t code = ((uint8_t*)cqe)[SLI4_CQE_CODE_OFFSET];
5555 uint8_t fcfi = UINT8_MAX;
5558 case SLI4_CQE_CODE_RQ_ASYNC: {
5559 sli4_fc_async_rcqe_t *rcqe = cqe;
5563 case SLI4_CQE_CODE_RQ_ASYNC_V1: {
5564 sli4_fc_async_rcqe_v1_t *rcqev1 = cqe;
5565 fcfi = rcqev1->fcfi;
5568 case SLI4_CQE_CODE_OPTIMIZED_WRITE_CMD: {
5569 sli4_fc_optimized_write_cmd_cqe_t *opt_wr = cqe;
5570 fcfi = opt_wr->fcfi;
5578 extern const char *sli_fc_get_status_string(uint32_t status);
5580 #endif /* !_SLI4_H */