Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sli4.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015, Emulex
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
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.
14  *
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.
18  *
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.
30  *
31  */
32 
33 /**
34  * @file
35  * Define common SLI-4 structures and function prototypes
36  */
37 
38 #ifndef _SLI4_H
39 #define _SLI4_H
40 
41 #include "ocs_os.h"
42 
43 #define SLI_PAGE_SIZE (4096)
44 #define SLI_SUB_PAGE_MASK (SLI_PAGE_SIZE - 1)
45 #define SLI_PAGE_SHIFT 12
46 #define SLI_ROUND_PAGE(b) (((b) + SLI_SUB_PAGE_MASK) & ~SLI_SUB_PAGE_MASK)
47 #define SLI_PAGE_COUNT(b) (((b) + SLI_SUB_PAGE_MASK) >> SLI_PAGE_SHIFT)
48 
49 /*************************************************************************
50  * Common SLI-4 register offsets and field definitions
51  */
52 
53 /********* Memory BAR register ************/
54 #define PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET 0xfc
55 
56 /* Host Interrupt Enable, if set interrupts are enabled although "PCI Interrupt
57  * Disable" may still globally block interrupts in addition to individual
58  * interrupt masks; a mechanism for the device driver to block all interrupts
59  * atomically without having to arbitrate for the PCI Interrupt Disable bit
60  * with the OS.
61  */
62 #define MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK (1 << 29) /* bit 29 */
63 
64 /*************************************************************************
65  * Common PCI configuration space register definitions
66  */
67 
68 #define SLI4_PCI_CLASS_REVISION 0x0008 /** register offset */
69 #define SLI4_PCI_REV_ID_SHIFT 0
70 #define SLI4_PCI_REV_ID_MASK 0xff
71 #define SLI4_PCI_CLASS_SHIFT 8
72 #define SLI4_PCI_CLASS_MASK 0xfff
73 
74 #define SLI4_PCI_SOFT_RESET_CSR 0x005c /** register offset */
75 #define SLI4_PCI_SOFT_RESET_MASK 0x0080
76 
77 
78 /**
79  * @brief SLI_INTF - SLI Interface Definition Register
80  */
81 #define SLI4_INTF_REG 0x0058 /** register offset */
82 #define SLI4_INTF_VALID_SHIFT 29
83 #define SLI4_INTF_VALID_MASK 0x7
84 #define SLI4_INTF_VALID 0x6
85 #define SLI4_INTF_IF_TYPE_SHIFT 12
86 #define SLI4_INTF_IF_TYPE_MASK 0xf
87 #define SLI4_INTF_SLI_FAMILY_SHIFT 8
88 #define SLI4_INTF_SLI_FAMILY_MASK 0xf
89 #define SLI4_INTF_SLI_REVISION_SHIFT 4
90 #define SLI4_INTF_SLI_REVISION_MASK 0xf
91 
92 #define SLI4_IF_TYPE_BE3_SKH_PF 0
93 #define SLI4_IF_TYPE_BE3_SKH_VF 1
94 #define SLI4_IF_TYPE_LANCER_FC_ETH 2
95 #define SLI4_IF_TYPE_LANCER_RDMA 3
96 #define SLI4_MAX_IF_TYPES 4
97 
98 /**
99  * @brief ASIC_ID - SLI ASIC Type and Revision Register
100  */
101 #define SLI4_ASIC_ID_REG 0x009c /** register offset */
102 #define SLI4_ASIC_REV_SHIFT 0
103 #define SLI4_ASIC_REV_MASK 0xf
104 #define SLI4_ASIC_VER_SHIFT 4
105 #define SLI4_ASIC_VER_MASK 0xf
106 #define SLI4_ASIC_GEN_SHIFT 8
107 #define SLI4_ASIC_GEN_MASK 0xff
108 #define SLI4_ASIC_GEN_BE2 0x00
109 #define SLI4_ASIC_GEN_BE3 0x03
110 #define SLI4_ASIC_GEN_SKYHAWK 0x04
111 
112 /**
113  * @brief BMBX - Bootstrap Mailbox Register
114  */
115 #define SLI4_BMBX_REG 0x0160 /** register offset */
116 #define SLI4_BMBX_MASK_HI 0x3
117 #define SLI4_BMBX_MASK_LO 0xf
118 #define SLI4_BMBX_RDY BIT(0)
119 #define SLI4_BMBX_HI BIT(1)
120 
121 #define SLI4_BMBX_WRITE_HI(r) \
122  ((ocs_addr32_hi(r) & ~SLI4_BMBX_MASK_HI) | SLI4_BMBX_HI)
123 
124 #define SLI4_BMBX_WRITE_LO(r) \
125  (((ocs_addr32_hi(r) & SLI4_BMBX_MASK_HI) << 30) | \
126  (((r) & ~SLI4_BMBX_MASK_LO) >> 2))
127 
128 #define SLI4_BMBX_SIZE 256
129 
130 /**
131  * @brief EQCQ_DOORBELL - EQ and CQ Doorbell Register
132  */
133 #define SLI4_EQCQ_DOORBELL_REG 0x120
134 #define SLI4_EQCQ_DOORBELL_CI BIT(9)
135 #define SLI4_EQCQ_DOORBELL_QT BIT(10)
136 #define SLI4_EQCQ_DOORBELL_ARM BIT(29)
137 #define SLI4_EQCQ_DOORBELL_SE BIT(31)
138 #define SLI4_EQCQ_NUM_SHIFT 16
139 #define SLI4_EQCQ_NUM_MASK 0x01ff
140 #define SLI4_EQCQ_EQ_ID_MASK 0x3fff
141 #define SLI4_EQCQ_CQ_ID_MASK 0x7fff
142 #define SLI4_EQCQ_EQ_ID_MASK_LO 0x01ff
143 #define SLI4_EQCQ_CQ_ID_MASK_LO 0x03ff
144 #define SLI4_EQCQ_EQCQ_ID_MASK_HI 0xf800
145 
146 /**
147  * @brief SLIPORT_CONTROL - SLI Port Control Register
148  */
149 #define SLI4_SLIPORT_CONTROL_REG 0x0408
150 #define SLI4_SLIPORT_CONTROL_END BIT(30)
151 #define SLI4_SLIPORT_CONTROL_LITTLE_ENDIAN (0)
152 #define SLI4_SLIPORT_CONTROL_BIG_ENDIAN BIT(30)
153 #define SLI4_SLIPORT_CONTROL_IP BIT(27)
154 #define SLI4_SLIPORT_CONTROL_IDIS BIT(22)
155 
156 /**
157  * @brief SLI4_SLIPORT_ERROR1 - SLI Port Error register
158  */
159 #define SLI4_SLIPORT_ERROR1 0x040c
160 
161 /**
162  * @brief SLI4_SLIPORT_ERROR2 - SLI Port Error register
163  */
164 #define SLI4_SLIPORT_ERROR2 0x0410
165 
166 
167 #define SLI4_IF6_DPP_DOORBELL_REG_SET 2
168 
169 
170 static inline uint32_t sli_eq_doorbell(uint16_t n_popped, uint16_t id,
171  uint8_t arm)
172 {
173  uint32_t reg = 0;
174 
175 #if BYTE_ORDER == LITTLE_ENDIAN
176  struct {
177  uint32_t eq_id_lo:9,
178  ci:1, /* clear interrupt */
179  qt:1, /* queue type */
180  eq_id_hi:5,
181  number_popped:13,
182  arm:1,
183  :1,
184  se:1;
185  } * eq_doorbell = (void *)&reg;
186 #else
187 #error big endian version not defined
188 #endif
189 
190  eq_doorbell->eq_id_lo = id & SLI4_EQCQ_EQ_ID_MASK_LO;
191  eq_doorbell->qt = 1; /* EQ is type 1 (section 2.2.3.3 SLI Arch) */
192  eq_doorbell->eq_id_hi = (id >> 9) & 0x1f;
193  eq_doorbell->number_popped = n_popped;
194  eq_doorbell->arm = arm;
195  eq_doorbell->ci = TRUE;
196 
197  return reg;
198 }
199 
200 static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id,
201  uint8_t arm)
202 {
203  uint32_t reg = 0;
204 
205 #if BYTE_ORDER == LITTLE_ENDIAN
206  struct {
207  uint32_t cq_id_lo:10,
208  qt:1, /* queue type */
209  cq_id_hi:5,
210  number_popped:13,
211  arm:1,
212  :1,
213  se:1;
214  } * cq_doorbell = (void *)&reg;
215 #else
216 #error big endian version not defined
217 #endif
218 
219  cq_doorbell->cq_id_lo = id & SLI4_EQCQ_CQ_ID_MASK_LO;
220  cq_doorbell->qt = 0; /* CQ is type 0 (section 2.2.3.3 SLI Arch) */
221  cq_doorbell->cq_id_hi = (id >> 10) & 0x1f;
222  cq_doorbell->number_popped = n_popped;
223  cq_doorbell->arm = arm;
224 
225  return reg;
226 }
227 
228 /* Offline/Online Chip/FW or UE assert FW/Chip
229  */
230 #define SLI4_ONLINE0_REG 0xB0
231 #define SLI4_ONLINE1_REG 0xB4
232 
233 /* User error registers
234  */
235 #define SLI4_UERR_STATUS_LOW_REG 0xA0
236 #define SLI4_UERR_STATUS_HIGH_REG 0xA4
237 #define SLI4_UERR_MASK_LOW_REG 0xA8
238 #define SLI4_UERR_MASK_HIGH_REG 0xAC
239 
240 /**
241  * @brief MQ_DOORBELL - MQ Doorbell Register
242  */
243 #define SLI4_MQ_DOORBELL_REG 0x0140 /** register offset */
244 #define SLI4_MQ_DOORBELL_NUM_SHIFT 16
245 #define SLI4_MQ_DOORBELL_NUM_MASK 0x3fff
246 #define SLI4_MQ_DOORBELL_ID_MASK 0xffff
247 #define SLI4_MQ_DOORBELL(n, i) \
248  ((((n) & SLI4_MQ_DOORBELL_NUM_MASK) << SLI4_MQ_DOORBELL_NUM_SHIFT) | \
249  ((i) & SLI4_MQ_DOORBELL_ID_MASK))
250 
251 /**
252  * @brief RQ_DOORBELL - RQ Doorbell Register
253  */
254 #define SLI4_RQ_DOORBELL_REG 0x0a0 /** register offset */
255 #define SLI4_RQ_DOORBELL_NUM_SHIFT 16
256 #define SLI4_RQ_DOORBELL_NUM_MASK 0x3fff
257 #define SLI4_RQ_DOORBELL_ID_MASK 0xffff
258 #define SLI4_RQ_DOORBELL(n, i) \
259  ((((n) & SLI4_RQ_DOORBELL_NUM_MASK) << SLI4_RQ_DOORBELL_NUM_SHIFT) | \
260  ((i) & SLI4_RQ_DOORBELL_ID_MASK))
261 
262 /**
263  * @brief WQ_DOORBELL - WQ Doorbell Register
264  */
265 #define SLI4_IO_WQ_DOORBELL_REG 0x040 /** register offset */
266 #define SLI4_WQ_DOORBELL_IDX_SHIFT 16
267 #define SLI4_WQ_DOORBELL_IDX_MASK 0x00ff
268 #define SLI4_WQ_DOORBELL_NUM_SHIFT 24
269 #define SLI4_WQ_DOORBELL_NUM_MASK 0x00ff
270 #define SLI4_WQ_DOORBELL_ID_MASK 0xffff
271 #define SLI4_WQ_DOORBELL(n, x, i) \
272  ((((n) & SLI4_WQ_DOORBELL_NUM_MASK) << SLI4_WQ_DOORBELL_NUM_SHIFT) | \
273  (((x) & SLI4_WQ_DOORBELL_IDX_MASK) << SLI4_WQ_DOORBELL_IDX_SHIFT) | \
274  ((i) & SLI4_WQ_DOORBELL_ID_MASK))
275 
276 /**
277  * @brief SLIPORT_SEMAPHORE - SLI Port Host and Port Status Register
278  */
279 
280 /* Always check ARM FW POST status through CSR BAR(2), i.e. MPU_EP_SEMAPHORE
281  * register at Offset 0xAC. This works for all chips; BE3, Skyhawk and other
282  * relevant ASICs. MPU_SCRATCHPAD0_DB is no longer used by ARM FW to
283  * advertise the POST status.
284  */
285 /* register offset Interface Type 0 + 1 */
286 #define SLI4_PORT_SEMAPHORE_REG_01 0xAC
287 /** register offset Interface Type 2 + 3 */
288 #define SLI4_PORT_SEMAPHORE_REG_23 0x0400
289 
290 #define SLI4_PORT_SEMAPHORE_PORT_MASK 0x0000ffff
291 #define SLI4_PORT_SEMAPHORE_PORT(r) \
292  ((r) & SLI4_PORT_SEMAPHORE_PORT_MASK)
293 
294 #define SLI4_PORT_SEMAPHORE_HOST_MASK 0x00ff0000
295 #define SLI4_PORT_SEMAPHORE_HOST_SHIFT 16
296 #define SLI4_PORT_SEMAPHORE_HOST(r) \
297  (((r) & SLI4_PORT_SEMAPHORE_HOST_MASK) >> \
298  SLI4_PORT_SEMAPHORE_HOST_SHIFT)
299 
300 /* Scratch area 2 & 1 */
301 #define SLI4_PORT_SEMAPHORE_SCR2 BIT(26)
302 #define SLI4_PORT_SEMAPHORE_SCR1 BIT(27)
303 
304 /* IP Conflict */
305 #define SLI4_PORT_SEMAPHORE_IPC BIT(28)
306 
307 /* No IP address */
308 #define SLI4_PORT_SEMAPHORE_NIP BIT(29)
309 
310 /* Secondary firmware image used */
311 #define SLI4_PORT_SEMAPHORE_SFI BIT(30)
312 
313 /** POST fatal error */
314 #define SLI4_PORT_SEMAPHORE_PERR BIT(31)
315 
316 #define SLI4_PORT_SEMAPHORE_STATUS_POST_READY 0xc000
317 #define SLI4_PORT_SEMAPHORE_STATUS_UNRECOV_ERR 0xf000
318 #define SLI4_PORT_SEMAPHORE_STATUS_ERR_MASK 0xf000
319 
320 #define SLI4_PORT_SEMAPHORE_IN_ERR(r) \
321  (SLI4_PORT_SEMAPHORE_STATUS_UNRECOV_ERR == ((r) & \
322  SLI4_PORT_SEMAPHORE_STATUS_ERR_MASK))
323 
324 /**
325  * @brief SLIPORT_STATUS - SLI Port Status Register
326  */
327 
328 /* Register offset Interface Type 2 + 3 */
329 #define SLI4_PORT_STATUS_REG_23 0x0404
330 #define SLI4_PORT_STATUS_RDY BIT(23) /* ready */
331 #define SLI4_PORT_STATUS_RN BIT(24) /* reset needed */
332 #define SLI4_PORT_STATUS_OTI BIT(29) /* over temp indicator */
333 #define SLI4_PORT_STATUS_END BIT(30) /* endianness */
334 #define SLI4_PORT_STATUS_ERR BIT(31) /* SLI port error */
335 #define SLI4_PORT_STATUS_READY(r) ((r) & SLI4_PORT_STATUS_RDY)
336 #define SLI4_PORT_STATUS_ERROR(r) ((r) & SLI4_PORT_STATUS_ERR)
337 
338 
339 /*************************************************************************
340  * SLI-4 mailbox command formats and definitions
341  */
342 
343 #define SLI4_MBOX_STATUS_SUCCESS 0x0000
344 #define SLI4_MBOX_STATUS_FAILURE 0x0001
345 
346 /**
347  * @brief Buffer Descriptor Entry (BDE)
348  */
349 typedef struct sli4_bde_s {
350 #if BYTE_ORDER == LITTLE_ENDIAN
351  uint32_t buffer_length:24,
352  bde_type:8;
353  union {
354  struct {
357  } data;
358  struct {
359  uint32_t offset;
360  uint32_t rsvd2;
361  } imm;
362  struct {
365  } blp;
366  } u;
367 #else
368 #error big endian version not defined
369 #endif
370 } sli4_bde_t;
371 
372 #define SLI4_BDE_TYPE_BDE_64 0x00 /** Generic 64-bit data */
373 #define SLI4_BDE_TYPE_BDE_IMM 0x01 /** Immediate data */
374 #define SLI4_BDE_TYPE_BLP 0x40 /** Buffer List Pointer */
375 
376 /**
377  * @brief Scatter-Gather Entry (SGE)
378  */
379 typedef struct sli4_sge_s {
380 #if BYTE_ORDER == LITTLE_ENDIAN
383  uint32_t data_offset:27,
384  sge_type:4,
385  last:1;
386  uint32_t buffer_length;
387 #else
388 #error big endian version not defined
389 #endif
390 } sli4_sge_t;
391 
392 typedef struct sli4_chain_sge_s {
393 #if BYTE_ORDER == LITTLE_ENDIAN
394  uint32_t rsvd0;
395  uint32_t cra;
396  uint32_t :27,
397  sge_type:4,
398  last:1;
399 
400  uint32_t rsvd1;
401 #else
402 #error big endian version not defined
403 #endif
405 
406 #define SLI4_ISCSI_SGL_CRA_32(__idx__, __frag__, __off__) \
407  (0x20000000 | ((__idx__) << 9) | ((__frag__) << 4) | (__off__))
408 
409 #define SLI4_ISCSI_SGL_CRA_256(__idx__, __frag__, __off__) \
410  (0x20000000 | ((__idx__) << 12) | ((__frag__) << 4) | (__off__))
411 
412 /**
413  * @brief T10 DIF Seed Scatter-Gather Entry (SGE)
414  */
415 typedef struct sli4_diseed_sge_s {
416 #if BYTE_ORDER == LITTLE_ENDIAN
417  uint32_t ref_tag_cmp;
418  uint32_t ref_tag_repl;
419  uint32_t :21,
420  crc:1,
421  atrt:1,
422  at:1,
423  :3,
424  sge_type:4,
425  last:1;
426  uint32_t app_tag_cmp:16,
427  dif_blk_size:3,
428  auto_incr_ref_tag:1, /* AI */
429  check_app_tag:1, /* ME */
430  check_ref_tag:1, /* RE */
431  check_crc:1, /* CE */
432  new_ref_tag:1, /* NR */
433  dif_op_rx:4,
434  dif_op_tx:4;
435 #else
436 #error big endian version not defined
437 #endif
439 
440 /**
441  * @brief T10 DIF Scatter-Gather Entry (SGE)
442  */
443 typedef struct sli4_dif_sge_s {
444 #if BYTE_ORDER == LITTLE_ENDIAN
447  uint32_t :27,
448  sge_type:4,
449  last:1;
450  uint32_t :32;
451 #else
452 #error big endian version not defined
453 #endif
455 
456 #define SLI4_SGE_MAX_RESERVED 3
457 
458 #define SLI4_SGE_DIF_OP_IN_NODIF_OUT_CRC 0x00
459 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_NODIF 0x01
460 #define SLI4_SGE_DIF_OP_IN_NODIF_OUT_CHKSUM 0x02
461 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_NODIF 0x03
462 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_CRC 0x04
463 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_CHKSUM 0x05
464 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_CHKSUM 0x06
465 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_CRC 0x07
466 
467 #define SLI4_SGE_TYPE_DATA 0x00
468 #define SLI4_SGE_TYPE_CHAIN 0x03
469 #define SLI4_SGE_TYPE_DIF 0x04 /** Data Integrity Field */
470 #define SLI4_SGE_TYPE_DISEED 0x08 /** DIF Seed */
471 #define SLI4_SGE_TYPE_SKIP 0x0c /** SKIP */
472 
473 /**
474  * @brief FW_INITIALIZE - initialize a SLI port
475  *
476  * @note this command uses a different format than all others
477  */
478 
479 extern const uint8_t sli4_fw_initialize[8];
480 
481 /**
482  * @brief FW_DEINITIALIZE - deinitialize a SLI port
483  *
484  * @note this command uses a different format than all others
485  */
486 
487 extern const uint8_t sli4_fw_deinitialize[8];
488 
489 
490 /*************************************************************************
491  * SLI-4 common configuration command formats and definitions
492  */
493 
494 #define SLI4_CFG_STATUS_SUCCESS 0x00
495 #define SLI4_CFG_STATUS_FAILED 0x01
496 #define SLI4_CFG_STATUS_ILLEGAL_REQUEST 0x02
497 #define SLI4_CFG_STATUS_ILLEGAL_FIELD 0x03
498 
499 #define SLI4_MGMT_STATUS_FLASHROM_READ_FAILED 0xcb
500 
501 #define SLI4_CFG_ADD_STATUS_NO_STATUS 0x00
502 #define SLI4_CFG_ADD_STATUS_INVALID_OPCODE 0x1e
503 
504 /**
505  * Subsystem values
506  */
507 #define SLI4_SUBSYSTEM_COMMON 0x01
508 #define SLI4_SUBSYSTEM_COMMON_ISCSI 0x02
509 #define SLI4_SUBSYSTEM_ISCSI_INI 0x06
510 #define SLI4_SUBSYSTEM_ISCSI_TGT 0x07
511 
512 /**
513  * Common opcode (OPC) values
514  */
515 #define SLI4_OPC_COMMON_GET_CNTL_ATTRIBUTES 0x20
516 #define SLI4_OPC_COMMON_GET_FW_VERSION 0x23
517 #define SLI4_OPC_COMMON_QUERY_FW_CONFIG 0x3a
518 #define SLI4_OPC_COMMON_FUNCTION_RESET 0x3d
519 #define SLI4_OPC_COMMON_SET_PHYSICAL_LINK_CONFIG 0x3e
520 #define SLI4_OPC_COMMON_CREATE_CQ 0x0c
521 #define SLI4_OPC_COMMON_DESTROY_CQ 0x36
522 #define SLI4_OPC_COMMON_CREATE_EQ 0x0d
523 #define SLI4_OPC_COMMON_DESTROY_EQ 0x37
524 #define SLI4_OPC_COMMON_MODIFY_EQ_DELAY 0x29
525 #define SLI4_OPC_COMMON_CREATE_MQ_EXT 0x5a
526 #define SLI4_OPC_COMMON_DESTROY_MQ 0x35
527 #define SLI4_OPC_COMMON_TCP_UPLOAD 0x38
528 #define SLI4_OPC_COMMON_NOP 0x21
529 #define SLI4_OPC_COMMON_WRITE_FLASHROM 0x07
530 #define SLI4_OPC_COMMON_MANAGE_FAT 0x44
531 #define SLI4_OPC_COMMON_READ_TRANSCEIVER_DATA 0x49
532 #define SLI4_OPC_COMMON_GET_BE_CONFIGURATION_AND_RESOURCES 0x51
533 #define SLI4_OPC_COMMON_SET_BE_CONFIGURATION_AND_RESOURCES 0x52
534 #define SLI4_OPC_COMMON_GET_VPD_DATA 0x5b
535 #define SLI4_OPC_COMMON_GET_CNTL_ADDL_ATTRIBUTES 0x79
536 #define SLI4_OPC_COMMON_GET_EXT_FAT_CAPABILITIES 0x7d
537 #define SLI4_OPC_COMMON_SET_EXT_FAT_CAPABILITIES 0x7e
538 #define SLI4_OPC_COMMON_EXT_FAT_CONFIGURE_SNAPSHOT 0x7f
539 #define SLI4_OPC_COMMON_EXT_FAT_RETRIEVE_SNAPSHOT 0x80
540 #define SLI4_OPC_COMMON_EXT_FAT_READ_STRING_TABLE 0x82
541 #define SLI4_OPC_COMMON_GET_FUNCTION_CONFIG 0xa0
542 #define SLI4_OPC_COMMON_GET_PROFILE_CONFIG 0xa4
543 #define SLI4_OPC_COMMON_SET_PROFILE_CONFIG 0xa5
544 #define SLI4_OPC_COMMON_GET_PROFILE_LIST 0xa6
545 #define SLI4_OPC_COMMON_GET_ACTIVE_PROFILE 0xa7
546 #define SLI4_OPC_COMMON_SET_ACTIVE_PROFILE 0xa8
547 #define SLI4_OPC_COMMON_READ_OBJECT 0xab
548 #define SLI4_OPC_COMMON_WRITE_OBJECT 0xac
549 #define SLI4_OPC_COMMON_DELETE_OBJECT 0xae
550 #define SLI4_OPC_COMMON_READ_OBJECT_LIST 0xad
551 #define SLI4_OPC_COMMON_GET_SLI4_PARAMETERS 0xb5
552 #define SLI4_OPC_COMMON_SET_FEATURES 0xbf
553 #define SLI4_OPC_COMMON_GET_RECONFIG_LINK_INFO 0xc9
554 #define SLI4_OPC_COMMON_SET_RECONFIG_LINK_ID 0xca
555 /**
556  * Common opcode (OPC) values
557  */
558 #define SLI4_OPC_COMMON_ISCSI_SET_TCP_PARAMETERS 0x48
559 #define SLI4_OPC_COMMON_ISCSI_GET_CONNECTION_INFO 0x4a
560 
561 /**
562  * @brief mailbox queue Element header
563  */
564 typedef struct sli4_mqe_hdr_s {
565 #if BYTE_ORDER == LITTLE_ENDIAN
566  uint32_t embedded:1, /* DWORD 0 */
567  rsvd0:2,
568  sge_count:5,
569  rsvd1:16,
570  special:8;
571  uint32_t payload_length; /* DWORD 1 */
572  uint32_t tag[2]; /* DWORDS 2 to 3 */
573  uint32_t rsvd2[1]; /* DWORDS 4 */
574 #else
575 #error big endian version not defined
576 #endif
578 
579 /**
580  * @brief Generic Command Request header
581  */
582 typedef struct sli4_req_hdr_s {
583 #if BYTE_ORDER == LITTLE_ENDIAN
584  uint32_t opcode:8,
585  subsystem:8,
586  port_number:8,
587  domain:8;
588  uint32_t timeout;
589  uint32_t request_length;
590  uint32_t version:8,
591  :24;
592 #else
593 #error big endian version not defined
594 #endif
596 
597 /**
598  * @brief Generic Command Response header
599  */
600 typedef struct sli4_res_hdr_s {
601 #if BYTE_ORDER == LITTLE_ENDIAN
602  uint32_t opcode:8,
603  subsystem:8,
604  :8,
605  domain:8;
606  uint32_t status:8,
607  additional_status:8,
608  :16;
609  uint32_t response_length;
611 #else
612 #error big endian version not defined
613 #endif
615 
616 /**
617  * @brief COMMON_FUNCTION_RESET
618  *
619  * Resets the Port, returning it to power-on state. This configuration
620  * command does not have a payload and should set/expect the lengths to
621  * be zero.
622  */
623 typedef struct sli4_req_common_function_reset_s {
626 
627 
628 typedef struct sli4_res_common_function_reset_s {
631 
632 /**
633  * @brief COMMON_GET_CNTL_ATTRIBUTES
634  *
635  * This command queries the controller information from the Flash ROM.
636  */
637 typedef struct sli4_req_common_get_cntl_attributes_s {
640 
641 
642 typedef struct sli4_res_common_get_cntl_attributes_s {
644  uint8_t version_str[32];
645  uint8_t manufacturer_name[32];
646  uint32_t supported_modes;
649  uint8_t rsvd0[2];
652  uint8_t ncsi_version_string[12];
654  uint8_t controller_model_number[32];
655  uint8_t controller_description[64];
656  uint8_t controller_serial_number[32];
657  uint8_t ip_version_string[32];
658  uint8_t firmware_version_string[32];
659  uint8_t bios_version_string[32];
660  uint8_t redboot_version_string[32];
661  uint8_t driver_version_string[32];
662  uint8_t fw_on_flash_version_string[32];
664  uint16_t max_cdblength;
665  uint8_t asic_revision;
666  uint8_t generational_guid[16];
667  uint8_t hba_port_count;
671  uint8_t cache_valid;
672  uint8_t hba_status;
674  uint8_t phy_port;
676  uint32_t hba_mtu[8];
677  uint8_t iSCSI_features;
679  uint8_t future_u8[2];
680  uint32_t future_u32[3];
681  uint16_t pci_vendor_id;
682  uint16_t pci_device_id;
685  uint8_t pci_bus_number;
688  uint8_t interface_type;
690  uint8_t netfilters;
691  uint8_t rsvd1[3];
692  uint32_t future2_u32[4];
694 
695 /**
696  * @brief COMMON_GET_CNTL_ATTRIBUTES
697  *
698  * This command queries the controller information from the Flash ROM.
699  */
700 typedef struct sli4_req_common_get_cntl_addl_attributes_s {
703 
704 
705 typedef struct sli4_res_common_get_cntl_addl_attributes_s {
707  uint16_t ipl_file_number;
709  uint8_t rsvd0;
711  uint8_t rsvd1[3];
713  uint32_t rsvd2[4];
714  char fcoe_universal_bios_version[32];
715  char fcoe_x86_bios_version[32];
716  char fcoe_efi_bios_version[32];
717  char fcoe_fcode_version[32];
718  char uefi_bios_version[32];
719  char uefi_nic_version[32];
720  char uefi_fcode_version[32];
721  char uefi_iscsi_version[32];
722  char iscsi_x86_bios_version[32];
723  char pxe_x86_bios_version[32];
724  uint8_t fcoe_default_wwpn[8];
725  uint8_t ext_phy_version[32];
726  uint8_t fc_universal_bios_version[32];
727  uint8_t fc_x86_bios_version[32];
728  uint8_t fc_efi_bios_version[32];
729  uint8_t fc_fcode_version[32];
730  uint8_t ext_phy_crc_label[8];
731  uint8_t ipl_file_name[16];
732  uint8_t rsvd3[72];
734 
735 /**
736  * @brief COMMON_GET_FW_VERSION
737  *
738  * This command retrieves the firmware running and flash versions.
739  */
740 typedef struct sli4_req_common_get_fw_version_s {
743 
744 typedef struct sli4_res_common_get_fw_version_s {
746  uint8_t fw_ver[32];
747  uint8_t flash_fw_ver[32];
749 
750 /**
751  * @brief COMMON_QUERY_FW_CONFIG
752  *
753  * This command retrieves firmware configuration parameters and adapter
754  * resources available to the driver.
755  */
756 typedef struct sli4_req_common_query_fw_config_s {
759 
760 
761 #define SLI4_FUNCTION_MODE_ISCSI_INI_MODE 0x10
762 #define SLI4_FUNCTION_MODE_ISCSI_TGT_MODE 0x20
763 #define SLI4_FUNCTION_MODE_DUA_MODE 0x800
764 
765 #define SLI4_ULP_MODE_ISCSI_INI 0x10
766 #define SLI4_ULP_MODE_ISCSI_TGT 0x20
767 
768 typedef struct sli4_res_common_query_fw_config_s {
770  uint32_t config_number;
771  uint32_t asic_rev;
772  uint32_t physical_port;
773  uint32_t function_mode;
774  uint32_t ulp0_mode;
776  uint32_t ulp0_nic_wq_total; /* Dword 10 */
786  uint32_t ulp0_iscsi_icd_total; /* Dword 20 */
787  uint32_t ulp1_mode;
796  uint32_t ulp1_lro_rqid_base; /* Dword 30 */
801  uint32_t ulp0_cq_base;
802  uint32_t ulp0_cq_total;
803  uint32_t ulp0_eq_base;
804  uint32_t ulp0_eq_total;
806  uint32_t ulp0_iscsi_chain_icd_total; /* Dword 40 */
810 
811 /**
812  * @brief COMMON_MODIFY_EQ_DELAY
813  *
814  * Modify the delay multiplier for EQs
815  */
816 typedef struct sli4_req_common_modify_eq_delay_s {
818 #if BYTE_ORDER == LITTLE_ENDIAN
819  uint32_t num_eq;
820  struct {
821  uint32_t eq_id;
822  uint32_t phase;
824  } eq_delay_record[8];
825 #else
826 #error big endian version not defined
827 #endif
829 
830 /**
831  * @brief COMMON_CREATE_CQ_V0
832  *
833  * Create a Completion Queue
834  */
835 typedef struct sli4_req_common_create_cq_v0_s {
837 #if BYTE_ORDER == LITTLE_ENDIAN
838  uint32_t num_pages:16,
839  :16;
840 
841  uint32_t :12,
842  clswm:2,
843  nodelay:1,
844  :12,
845  cqecnt:2,
846  valid:1,
847  :1,
848  evt:1;
849 
850  uint32_t :22,
851  eq_id:8,
852  :1,
853  arm:1;
854 
855  uint32_t rsvd[2];
856  struct {
857  uint32_t low;
858  uint32_t high;
859  } page_physical_address[4];
860 #else
861 #error big endian version not defined
862 #endif
864 
865 /**
866  * @brief COMMON_CREATE_CQ_V2
867  *
868  * Create a Completion Queue
869  */
870 typedef struct sli4_req_common_create_cq_v2_s {
872 #if BYTE_ORDER == LITTLE_ENDIAN
873  uint32_t num_pages:16,
874  page_size:8,
875  :8;
876 
877  uint32_t :12,
878  clswm:2,
879  nodelay:1,
880  autovalid:1,
881  :11,
882  cqecnt:2,
883  valid:1,
884  :1,
885  evt:1;
886 
887  uint32_t eq_id:16,
888  :15,
889  arm:1;
890 
891  uint32_t cqe_count:16,
892  :16;
893 
894  uint32_t rsvd[1];
895  struct {
896  uint32_t low;
897  uint32_t high;
898  } page_physical_address[4];
899 #else
900 #error big endian version not defined
901 #endif
903 
904 /**
905  * CQE Count
906  */
907 #define SLI4_CQ_CNT_256 0
908 #define SLI4_CQ_CNT_512 1
909 #define SLI4_CQ_CNT_1024 2
910 
911 /**
912  * @brief Generic Common Create EQ/CQ/MQ/WQ/RQ Queue completion
913  */
914 typedef struct sli4_res_common_create_queue_s {
916 #if BYTE_ORDER == LITTLE_ENDIAN
917  uint32_t q_id:16,
918  :16;
919  uint32_t db_offset;
920  uint32_t db_rs:16,
921  db_fmt:16;
922 #else
923 #error big endian version not defined
924 #endif
926 
927 /**
928  * @brief Common Destroy CQ
929  */
930 typedef struct sli4_req_common_destroy_cq_s {
932 #if BYTE_ORDER == LITTLE_ENDIAN
933  uint32_t cq_id:16,
934  :16;
935 #else
936 #error big endian version not defined
937 #endif
939 
940 /**
941  * @brief COMMON_CREATE_EQ
942  *
943  * Create an Event Queue
944  */
945 typedef struct sli4_req_common_create_eq_s {
947 #if BYTE_ORDER == LITTLE_ENDIAN
948  uint32_t num_pages:16,
949  :16;
950 
951  uint32_t :29,
952  valid:1,
953  :1,
954  eqesz:1;
955 
956  uint32_t :26,
957  count:3,
958  :2,
959  arm:1;
960 
961  uint32_t :13,
962  delay_multiplier:10,
963  :9;
964 
965  uint32_t rsvd;
966 
967  struct {
968  uint32_t low;
969  uint32_t high;
970  } page_address[8];
971 #else
972 #error big endian version not defined
973 #endif
975 
976 #define SLI4_EQ_CNT_256 0
977 #define SLI4_EQ_CNT_512 1
978 #define SLI4_EQ_CNT_1024 2
979 #define SLI4_EQ_CNT_2048 3
980 #define SLI4_EQ_CNT_4096 4
981 
982 #define SLI4_EQE_SIZE_4 0
983 #define SLI4_EQE_SIZE_16 1
984 
985 /**
986  * @brief Common Destroy EQ
987  */
988 typedef struct sli4_req_common_destroy_eq_s {
990 #if BYTE_ORDER == LITTLE_ENDIAN
991  uint32_t eq_id:16,
992  :16;
993 #else
994 #error big endian version not defined
995 #endif
997 
998 /**
999  * @brief COMMON_CREATE_MQ_EXT
1000  *
1001  * Create a Mailbox Queue, accomodate v0 and v1 forms
1002  */
1003 typedef struct sli4_req_common_create_mq_ext_s {
1005 #if BYTE_ORDER == LITTLE_ENDIAN
1006  uint32_t num_pages:16,
1007  cq_id_v1:16;
1008 
1010 
1011  uint32_t async_cq_id_v1:16,
1012  ring_size:4,
1013  :2,
1014  cq_id_v0:10;
1015 
1016  uint32_t :31,
1017  val:1;
1018 
1019  uint32_t acqv:1,
1020  async_cq_id_v0:10,
1021  :21;
1022 
1023  uint32_t rsvd9;
1024  struct {
1025  uint32_t low;
1026  uint32_t high;
1027  } page_physical_address[8];
1028 #else
1029 #error big endian version not defined
1030 #endif
1032 
1033 #define SLI4_MQE_SIZE_16 0x05
1034 #define SLI4_MQE_SIZE_32 0x06
1035 #define SLI4_MQE_SIZE_64 0x07
1036 #define SLI4_MQE_SIZE_128 0x08
1037 
1038 #define SLI4_ASYNC_EVT_LINK_STATE BIT(1)
1039 #define SLI4_ASYNC_EVT_FCOE_FIP BIT(2)
1040 #define SLI4_ASYNC_EVT_DCBX BIT(3)
1041 #define SLI4_ASYNC_EVT_ISCSI BIT(4)
1042 #define SLI4_ASYNC_EVT_GRP5 BIT(5)
1043 #define SLI4_ASYNC_EVT_FC BIT(16)
1044 #define SLI4_ASYNC_EVT_SLI_PORT BIT(17)
1045 #define SLI4_ASYNC_EVT_VF BIT(18)
1046 #define SLI4_ASYNC_EVT_MR BIT(19)
1047 
1048 #define SLI4_ASYNC_EVT_ALL \
1049  SLI4_ASYNC_EVT_LINK_STATE | \
1050  SLI4_ASYNC_EVT_FCOE_FIP | \
1051  SLI4_ASYNC_EVT_DCBX | \
1052  SLI4_ASYNC_EVT_ISCSI | \
1053  SLI4_ASYNC_EVT_GRP5 | \
1054  SLI4_ASYNC_EVT_FC | \
1055  SLI4_ASYNC_EVT_SLI_PORT | \
1056  SLI4_ASYNC_EVT_VF | \
1057  SLI4_ASYNC_EVT_MR
1058 
1059 #define SLI4_ASYNC_EVT_ISCSI_EVENTS \
1060  SLI4_ASYNC_EVT_LINK_STATE | \
1061  SLI4_ASYNC_EVT_FCOE_FIP | \
1062  SLI4_ASYNC_EVT_GRP5 | \
1063  SLI4_ASYNC_EVT_ISCSI
1064 
1065 /**
1066  * @brief Common Destroy MQ
1067  */
1068 typedef struct sli4_req_common_destroy_mq_s {
1070 #if BYTE_ORDER == LITTLE_ENDIAN
1071  uint32_t mq_id:16,
1072  :16;
1073 #else
1074 #error big endian version not defined
1075 #endif
1077 
1078 /**
1079  * @brief Common TCP_UPLOAD
1080  */
1081 typedef struct sli4_req_common_tcp_upload_s {
1083 #if BYTE_ORDER == LITTLE_ENDIAN
1084  uint32_t wq_id:16,
1085  upload_type:16;
1086 
1087  uint32_t reset_seq;
1088 #else
1089 #error big endian version not defined
1090 #endif
1092 
1093 /**
1094  * @brief COMMON_NOP
1095  *
1096  * Command does nothing other than return the payload in the completion
1097  */
1098 typedef struct sli4_req_common_nop_s {
1100 #if BYTE_ORDER == LITTLE_ENDIAN
1101  uint32_t context[2];
1102 #else
1103 #error big endian version not defined
1104 #endif
1106 
1107 typedef struct sli4_res_common_nop_s {
1109 #if BYTE_ORDER == LITTLE_ENDIAN
1110  uint32_t context[2];
1111 #else
1112 #error big endian version not defined
1113 #endif
1115 
1116 /**
1117  * @brief COMMON_READ_TRANSCEIVER_DATA
1118  *
1119  */
1120 #define SFP_PAGE_DATA_BYTES 256
1121 
1122 typedef struct sli4_req_common_read_transceiver_data_s {
1124 #if BYTE_ORDER == LITTLE_ENDIAN
1125  uint32_t page_num;
1126  uint32_t port;
1127 #else
1128 #error big endian version not defined
1129 #endif
1131 
1132 typedef struct sli4_res_common_read_transceiver_data_s {
1134 #if BYTE_ORDER == LITTLE_ENDIAN
1135  uint32_t page_num;
1136  uint32_t port;
1137  uint8_t page_data[SFP_PAGE_DATA_BYTES];
1138 #else
1139 #error big endian version not defined
1140 #endif
1142 
1143 /**
1144  * @brief COMMON_GET_BE_CONFIGURATION_AND_RESOURCES (v1)
1145  *
1146  * Note: Coded for iSCSI descriptor only
1147  */
1148 typedef struct sli4_req_common_get_be_configuration_and_resources_s {
1150 #if BYTE_ORDER == LITTLE_ENDIAN
1151  uint32_t rsvd;
1152 #else
1153 #error big endian version not defined
1154 #endif
1156 
1157 /**
1158  * @brief COMMON_SET_BE_CONFIGURATION_AND_RESOURCES (v1)
1159  *
1160  * Note: Coded for iSCSI descriptor only
1161  */
1162 typedef struct sli4_req_common_set_be_configuration_and_resources_s {
1164 #if BYTE_ORDER == LITTLE_ENDIAN
1166 
1167  uint32_t resource_type:8,
1168  :24;
1169 
1170  uint32_t pf_num:8,
1171  vf_domain:8,
1172  :16;
1173 
1174  uint32_t valid_fields;
1175 
1176  uint32_t session_count:16,
1177  icd_count:16;
1178 
1179  uint32_t cq_count:16,
1180  iscsi_mac_address_0:8,
1181  iscsi_mac_address_1:8;
1182 
1183  uint32_t iscsi_mac_address_2:8,
1184  iscsi_mac_address_3:8,
1185  iscsi_mac_address_4:8,
1186  iscsi_mac_address_5:8;
1187 
1188  uint32_t mcc_queue_count:8,
1189  bw_percent:8,
1190  vlan_id:16;
1191 #else
1192 #error big endian version not defined
1193 #endif
1195 
1196 /**
1197  * @brief COMMON_WRITE_FLASHROM
1198  */
1199 typedef struct sli4_req_common_write_flashrom_s {
1201 #if BYTE_ORDER == LITTLE_ENDIAN
1205  uint32_t offset;
1206  uint8_t data_buffer[4];
1207 #else
1208 #error big endian version not defined
1209 #endif
1211 
1212 #define SLI4_MGMT_FLASHROM_OPCODE_FLASH 0x01
1213 #define SLI4_MGMT_FLASHROM_OPCODE_SAVE 0x02
1214 #define SLI4_MGMT_FLASHROM_OPCODE_CLEAR 0x03
1215 #define SLI4_MGMT_FLASHROM_OPCODE_REPORT 0x04
1216 #define SLI4_MGMT_FLASHROM_OPCODE_IMAGE_INFO 0x05
1217 #define SLI4_MGMT_FLASHROM_OPCODE_IMAGE_CRC 0x06
1218 #define SLI4_MGMT_FLASHROM_OPCODE_OFFSET_BASED_FLASH 0x07
1219 #define SLI4_MGMT_FLASHROM_OPCODE_OFFSET_BASED_SAVE 0x08
1220 #define SLI4_MGMT_PHY_FLASHROM_OPCODE_FLASH 0x09
1221 #define SLI4_MGMT_PHY_FLASHROM_OPCODE_SAVE 0x0a
1222 
1223 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ISCSI 0x00
1224 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_REDBOOT 0x01
1225 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_BIOS 0x02
1226 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_PXE_BIOS 0x03
1227 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_CODE_CONTROL 0x04
1228 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_IPSEC_CFG 0x05
1229 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_INIT_DATA 0x06
1230 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ROM_OFFSET 0x07
1231 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_BIOS 0x08
1232 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ISCSI_BAK 0x09
1233 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_ACT 0x0a
1234 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_BAK 0x0b
1235 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_CODE_CTRL_P 0x0c
1236 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_NCSI 0x0d
1237 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_NIC 0x0e
1238 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_DCBX 0x0f
1239 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_PXE_BIOS_CFG 0x10
1240 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ALL_CFG_DATA 0x11
1241 
1242 /**
1243  * @brief COMMON_MANAGE_FAT
1244  */
1245 typedef struct sli4_req_common_manage_fat_s {
1247 #if BYTE_ORDER == LITTLE_ENDIAN
1248  uint32_t fat_operation;
1252  uint32_t data_buffer; // response only
1253 #else
1254 #error big endian version not defined
1255 #endif
1257 
1258 /**
1259  * @brief COMMON_GET_EXT_FAT_CAPABILITIES
1260  */
1261 typedef struct sli4_req_common_get_ext_fat_capabilities_s {
1263 #if BYTE_ORDER == LITTLE_ENDIAN
1264  uint32_t parameter_type;
1265 #else
1266 #error big endian version not defined
1267 #endif
1269 
1270 /**
1271  * @brief COMMON_SET_EXT_FAT_CAPABILITIES
1272  */
1273 typedef struct sli4_req_common_set_ext_fat_capabilities_s {
1275 #if BYTE_ORDER == LITTLE_ENDIAN
1277  uint32_t log_entry_size;
1278 
1279  uint32_t logging_type:8,
1280  maximum_logging_functions:8,
1281  maximum_logging_ports:8,
1282  :8;
1283 
1284  uint32_t supported_modes;
1285  uint32_t number_modules;
1286  uint32_t debug_module[14];
1287 #else
1288 #error big endian version not defined
1289 #endif
1291 
1292 /**
1293  * @brief COMMON_EXT_FAT_CONFIGURE_SNAPSHOT
1294  */
1295 typedef struct sli4_req_common_ext_fat_configure_snapshot_s {
1297 #if BYTE_ORDER == LITTLE_ENDIAN
1299 #else
1300 #error big endian version not defined
1301 #endif
1303 
1304 /**
1305  * @brief COMMON_EXT_FAT_RETRIEVE_SNAPSHOT
1306  */
1307 typedef struct sli4_req_common_ext_fat_retrieve_snapshot_s {
1309 #if BYTE_ORDER == LITTLE_ENDIAN
1310  uint32_t snapshot_mode;
1311  uint32_t start_index;
1313 #else
1314 #error big endian version not defined
1315 #endif
1317 
1318 typedef struct sli4_res_common_ext_fat_retrieve_snapshot_s {
1320 #if BYTE_ORDER == LITTLE_ENDIAN
1322 
1323  uint32_t version:8,
1324  physical_port:8,
1325  function_id:16;
1326 
1327  uint32_t trace_level;
1328  uint32_t module_mask[2];
1330  uint32_t timestamp;
1331  uint8_t string_data[16];
1332  uint32_t data[6];
1333 #else
1334 #error big endian version not defined
1335 #endif
1337 
1338 /**
1339  * @brief COMMON_EXT_FAT_READ_STRING_TABLE
1340  */
1341 typedef struct sli4_req_common_ext_fat_read_string_table_s {
1343 #if BYTE_ORDER == LITTLE_ENDIAN
1344  uint32_t byte_offset;
1345  uint32_t number_bytes;
1346 #else
1347 #error big endian version not defined
1348 #endif
1350 
1351 typedef struct sli4_res_common_ext_fat_read_string_table_s {
1353 #if BYTE_ORDER == LITTLE_ENDIAN
1355 
1357 
1358  uint32_t table_data0:8,
1359  :24;
1360 
1361  uint8_t table_data[0];
1362 #else
1363 #error big endian version not defined
1364 #endif
1366 
1367 /**
1368  * @brief COMMON_GET_VPD_DATA
1369  */
1370 typedef struct sli4_req_common_get_vpd_data_s {
1372 #if BYTE_ORDER == LITTLE_ENDIAN
1373  uint16_t function_num;
1374  uint8_t function_type;
1375  uint8_t vf;
1376  uint32_t rsvd;
1377 #else
1378 #error big endian version not defined
1379 #endif
1381 
1382 /**
1383  * @brief Resource descriptor
1384  */
1385 
1386 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_PCIE 0x50
1387 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_NIC 0x51
1388 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_ISCSI 0x52
1389 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_FCFCOE 0x53
1390 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_RDMA 0x54
1391 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_PORT 0x55
1392 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_ISAP 0x56
1393 
1394 #define SLI4_PORT_TYPE_NIC_TOE 0x01
1395 #define SLI4_PORT_TYPE_ISCSI 0x02
1396 #define SLI4_PORT_TYPE_FCOE 0x04
1397 #define SLI4_PORT_TYPE_NIC_TOE_RDMA 0x08
1398 #define SLI4_PORT_TYPE_FC 0x10
1399 #define SLI4_PORT_TYPE_DEFAULT 0xff
1400 
1401 typedef struct sli4_resource_descriptor_v1_s {
1402  uint32_t descriptor_type:8,
1403  descriptor_length:8,
1404  :16;
1405  uint32_t type_specific[0];
1407 
1408 typedef struct sli4_pcie_resource_descriptor_v1_s {
1409  uint32_t descriptor_type:8,
1410  descriptor_length:8,
1411  :14,
1412  imm:1,
1413  nosv:1;
1414  uint32_t :16,
1415  pf_number:10,
1416  :6;
1417  uint32_t rsvd1;
1418  uint32_t sriov_state:8,
1419  pf_state:8,
1420  pf_type:8,
1421  :8;
1422  uint32_t number_of_vfs:16,
1423  :16;
1424  uint32_t mission_roles:8,
1425  :19,
1426  pchg:1,
1427  schg:1,
1428  xchg:1,
1429  xrom:2;
1430  uint32_t rsvd2[16];
1432 
1433 typedef struct sli4_isap_resource_descriptor_v1_s {
1434  uint32_t descriptor_type:8,
1435  descriptor_length:8,
1436  :16;
1437  uint32_t iscsi_tgt:1,
1438  iscsi_ini:1,
1439  iscsi_dif:1,
1440  :29;
1441  uint32_t rsvd1[3];
1442  uint32_t fcoe_tgt:1,
1443  fcoe_ini:1,
1444  fcoe_dif:1,
1445  :29;
1446  uint32_t rsvd2[7];
1447  uint32_t mc_type0:8,
1448  mc_type1:8,
1449  mc_type2:8,
1450  mc_type3:8;
1451  uint32_t rsvd3[3];
1453 
1454 /**
1455  * @brief COMMON_GET_FUNCTION_CONFIG
1456  */
1457 typedef struct sli4_req_common_get_function_config_s {
1460 
1461 typedef struct sli4_res_common_get_function_config_s {
1463 #if BYTE_ORDER == LITTLE_ENDIAN
1464  uint32_t desc_count;
1465  uint32_t desc[54];
1466 #else
1467 #error big endian version not defined
1468 #endif
1470 
1471 /**
1472  * @brief COMMON_GET_PROFILE_CONFIG
1473  */
1474 typedef struct sli4_req_common_get_profile_config_s {
1476  uint32_t profile_id:8,
1477  typ:2,
1478  :22;
1480 
1481 typedef struct sli4_res_common_get_profile_config_s {
1483 #if BYTE_ORDER == LITTLE_ENDIAN
1484  uint32_t desc_count;
1485  uint32_t desc[0];
1486 #else
1487 #error big endian version not defined
1488 #endif
1490 
1491 /**
1492  * @brief COMMON_SET_PROFILE_CONFIG
1493  */
1494 typedef struct sli4_req_common_set_profile_config_s {
1496  uint32_t profile_id:8,
1497  :23,
1498  isap:1;
1499  uint32_t desc_count;
1500  uint32_t desc[0];
1502 
1503 typedef struct sli4_res_common_set_profile_config_s {
1505 #if BYTE_ORDER == LITTLE_ENDIAN
1506 #else
1507 #error big endian version not defined
1508 #endif
1510 
1511 
1512 
1513 /**
1514  * @brief Profile Descriptor for profile functions
1515  */
1516 typedef struct sli4_profile_descriptor_s {
1517 #if BYTE_ORDER == LITTLE_ENDIAN
1518  uint32_t profile_id:8,
1519  :8,
1520  profile_index:8,
1521  :8;
1522  uint32_t profile_description[128];
1523 #else
1524 #error big endian version not defined
1525 #endif
1527 
1528 /* We don't know in advance how many descriptors there are. We have
1529  to pick a number that we think will be big enough and ask for that
1530  many. */
1531 
1532 #define MAX_PRODUCT_DESCRIPTORS 40
1533 
1534 /**
1535  * @brief COMMON_GET_PROFILE_LIST
1536  */
1537 typedef struct sli4_req_common_get_profile_list_s {
1539 #if BYTE_ORDER == LITTLE_ENDIAN
1540  uint32_t start_profile_index:8,
1541  :24;
1542 #else
1543 #error big endian version not defined
1544 #endif
1546 
1547 typedef struct sli4_res_common_get_profile_list_s {
1549 #if BYTE_ORDER == LITTLE_ENDIAN
1552 #else
1553 #error big endian version not defined
1554 #endif
1556 
1557 /**
1558  * @brief COMMON_GET_ACTIVE_PROFILE
1559  */
1560 typedef struct sli4_req_common_get_active_profile_s {
1563 
1564 typedef struct sli4_res_common_get_active_profile_s {
1566 #if BYTE_ORDER == LITTLE_ENDIAN
1567  uint32_t active_profile_id:8,
1568  :8,
1569  next_profile_id:8,
1570  :8;
1571 #else
1572 #error big endian version not defined
1573 #endif
1575 
1576 /**
1577  * @brief COMMON_SET_ACTIVE_PROFILE
1578  */
1579 typedef struct sli4_req_common_set_active_profile_s {
1581 #if BYTE_ORDER == LITTLE_ENDIAN
1582  uint32_t active_profile_id:8,
1583  :23,
1584  fd:1;
1585 #else
1586 #error big endian version not defined
1587 #endif
1589 
1590 /**
1591  * @brief Link Config Descriptor for link config functions
1592  */
1593 typedef struct sli4_link_config_descriptor_s {
1594 #if BYTE_ORDER == LITTLE_ENDIAN
1595  uint32_t link_config_id:8,
1596  :24;
1597  uint32_t config_description[8];
1598 #else
1599 #error big endian version not defined
1600 #endif
1602 
1603 #define MAX_LINK_CONFIG_DESCRIPTORS 10
1604 
1605 /**
1606  * @brief COMMON_GET_RECONFIG_LINK_INFO
1607  */
1608 typedef struct sli4_req_common_get_reconfig_link_info_s {
1610 #if BYTE_ORDER == LITTLE_ENDIAN
1611 #else
1612 #error big endian version not defined
1613 #endif
1615 
1616 typedef struct sli4_res_common_get_reconfig_link_info_s {
1618 #if BYTE_ORDER == LITTLE_ENDIAN
1619  uint32_t active_link_config_id:8,
1620  :8,
1621  next_link_config_id:8,
1622  :8;
1623  uint32_t link_configuration_descriptor_count;
1625 #else
1626 #error big endian version not defined
1627 #endif
1629 
1630 /**
1631  * @brief COMMON_SET_RECONFIG_LINK_ID
1632  */
1633 typedef struct sli4_req_common_set_reconfig_link_id_s {
1635 #if BYTE_ORDER == LITTLE_ENDIAN
1636  uint32_t next_link_config_id:8,
1637  :23,
1638  fd:1;
1639 #else
1640 #error big endian version not defined
1641 #endif
1643 
1644 typedef struct sli4_res_common_set_reconfig_link_id_s {
1646 #if BYTE_ORDER == LITTLE_ENDIAN
1647 #else
1648 #error big endian version not defined
1649 #endif
1651 
1652 typedef struct sli4_res_common_set_active_profile_s {
1655 
1656 /**
1657  * @brief COMMON_READ_OBJECT
1658  */
1659 typedef struct sli4_req_common_read_object_s {
1661 #if BYTE_ORDER == LITTLE_ENDIAN
1662  uint32_t desired_read_length:24,
1663  :8;
1664 
1665  uint32_t read_offset;
1666  uint8_t object_name[104];
1668  sli4_bde_t host_buffer_descriptor[0];
1669 #else
1670 #error big endian version not defined
1671 #endif
1673 
1674 /**
1675  * @brief COMMON_WRITE_OBJECT
1676  */
1677 typedef struct sli4_req_common_write_object_s {
1679 #if BYTE_ORDER == LITTLE_ENDIAN
1680  uint32_t desired_write_length:24,
1681  :8;
1682 
1683  uint32_t write_offset;
1684  uint8_t object_name[104];
1686  sli4_bde_t host_buffer_descriptor[0];
1687 #else
1688 #error big endian version not defined
1689 #endif
1691 
1692 /**
1693  * @brief COMMON_DELETE_OBJECT
1694  */
1695 typedef struct sli4_req_common_delete_object_s {
1697 #if BYTE_ORDER == LITTLE_ENDIAN
1698  uint32_t rsvd4;
1699  uint32_t rsvd5;
1700  uint8_t object_name[104];
1701 #else
1702 #error big endian version not defined
1703 #endif
1705 
1706 /**
1707  * @brief COMMON_READ_OBJECT_LIST
1708  */
1709 typedef struct sli4_req_common_read_object_list_s {
1711 #if BYTE_ORDER == LITTLE_ENDIAN
1712  uint32_t descriptor_count:16,
1713  descriptor_offset:16;
1714 
1715  uint32_t rsvd5;
1716  uint8_t object_name[104];
1718  sli4_bde_t host_buffer_descriptor[0];
1719 #else
1720 #error big endian version not defined
1721 #endif
1723 
1724 /**
1725  * @brief COMMON_SET_SET_FEATURES
1726  */
1727 #define SLI4_SET_FEATURES_DIF_SEED 0x01
1728 #define SLI4_SET_FEATURES_XRI_TIMER 0x03
1729 #define SLI4_SET_FEATURES_MAX_PCIE_SPEED 0x04
1730 #define SLI4_SET_FEATURES_FCTL_CHECK 0x05
1731 #define SLI4_SET_FEATURES_FEC 0x06
1732 #define SLI4_SET_FEATURES_PCIE_RECV_DETECT 0x07
1733 #define SLI4_SET_FEATURES_DIF_MEMORY_MODE 0x08
1734 typedef struct sli4_req_common_set_features_s {
1736 #if BYTE_ORDER == LITTLE_ENDIAN
1737  uint32_t feature;
1738  uint32_t param_len;
1739  uint32_t params[8];
1740 #else
1741 #error big endian version not defined
1742 #endif
1744 
1745 typedef struct sli4_req_common_set_features_t10_pi_mem_model_s {
1746 #if BYTE_ORDER == LITTLE_ENDIAN
1747  uint32_t tmm:1,
1748  :31;
1749 #else
1750 #error big endian version not defined
1751 #endif
1753 
1754 /**
1755  * @brief Event Queue Entry
1756  */
1757 typedef struct sli4_eqe_s {
1758 #if BYTE_ORDER == LITTLE_ENDIAN
1759  uint32_t vld:1, /** valid */
1760  major_code:3,
1761  minor_code:12,
1762  resource_id:16;
1763 #else
1764 #error big endian version not defined
1765 #endif
1766 } sli4_eqe_t;
1767 
1768 /**
1769  * @brief Mailbox Completion Queue Entry
1770  *
1771  * A CQE generated on the completion of a MQE from a MQ
1772  */
1773 typedef struct sli4_mcqe_s {
1774 #if BYTE_ORDER == LITTLE_ENDIAN
1775  uint32_t completion_status:16, /** values are protocol specific */
1776  extended_status:16;
1777 
1778  uint32_t mqe_tag_low;
1779  uint32_t mqe_tag_high;
1780 
1781  uint32_t :27,
1782  con:1, /** consumed - command now being executed */
1783  cmp:1, /** completed - command still executing if clear */
1784  :1,
1785  ae:1, /** async event - this is an ACQE */
1786  val:1; /** valid - contents of CQE are valid */
1787 #else
1788 #error big endian version not defined
1789 #endif
1790 } sli4_mcqe_t;
1791 
1792 
1793 /**
1794  * @brief Asynchronous Completion Queue Entry
1795  *
1796  * A CQE generated asynchronously in response to link or other internal events.
1797  */
1798 typedef struct sli4_acqe_s {
1799 #if BYTE_ORDER == LITTLE_ENDIAN
1800  uint32_t event_data[3];
1801 
1802  uint32_t :8,
1803  event_code:8,
1804  event_type:8, /** values are protocol specific */
1805  :6,
1806  ae:1, /** async event - this is an ACQE */
1807  val:1; /** valid - contents of CQE are valid */
1808 #else
1809 #error big endian version not defined
1810 #endif
1811 } sli4_acqe_t;
1812 
1813 #define SLI4_ACQE_EVENT_CODE_LINK_STATE 0x01
1814 #define SLI4_ACQE_EVENT_CODE_FCOE_FIP 0x02
1815 #define SLI4_ACQE_EVENT_CODE_ISCSI 0x04
1816 #define SLI4_ACQE_EVENT_CODE_GRP_5 0x05
1817 
1818 /**
1819  * @brief Register name enums
1820  */
1821 typedef enum {
1839  SLI4_REG_MAX /* must be last */
1840 } sli4_regname_e;
1841 
1842 #define SLI4_PHSDEV_CONTROL_REG_23 0x0414 /** register offset Interface Type 2 + 3 */
1843 #define SLI4_PHYDEV_CONTROL_DRST BIT(0) /** physical device reset */
1844 #define SLI4_PHYDEV_CONTROL_FRST BIT(1) /** firmware reset */
1845 #define SLI4_PHYDEV_CONTROL_DD BIT(2) /** diagnostic dump */
1846 #define SLI4_PHYDEV_CONTROL_FRL_MASK 0x000000f0
1847 #define SLI4_PHYDEV_CONTROL_FRL_SHIFT 4
1848 #define SLI4_PHYDEV_CONTROL_FRL(r) (((r) & SLI4_PHYDEV_CONTROL_FRL_MASK) >> \
1849  SLI4_PHYDEV_CONTROL_FRL_SHIFT_SHIFT)
1850 
1851 
1852 typedef struct sli4_reg_s {
1853  uint32_t rset;
1854  uint32_t off;
1855 } sli4_reg_t;
1856 
1857 typedef enum {
1863  SLI_QTYPE_MAX, /* must be last */
1864 } sli4_qtype_e;
1865 
1866 #define SLI_USER_MQ_COUNT 1 /** User specified max mail queues */
1867 #define SLI_USER_EQ_COUNT 1 /** User specified max mail queues */
1868 
1869 typedef enum {
1880  SLI_CQENTRY_MAX /* must be last */
1881 } sli4_qentry_e;
1882 
1883 typedef enum {
1919  SLI_STATUS_DISPATCH_ERROR, /* driver error code */
1920  SLI_STATUS_MAX /* Must be last */
1921 } sli4_status_t;
1922 
1923 /**
1924  * @brief This structure contains the fields in a DPDU completion.
1925  */
1926 typedef struct {
1927  uint32_t addr_high;
1928  uint32_t addr_low;
1929  uint32_t data_length;
1930  uint16_t cid;
1931  uint16_t rq_index;
1932  uint8_t final;
1933  uint8_t code;
1935 
1936 /**
1937  * @brief This structure contains the fields in a I_SOL completion.
1938  */
1939 typedef struct {
1940  uint32_t residual_cnt;
1941  uint32_t exp_cmdsn;
1942  uint16_t cid;
1943  uint8_t hw_status;
1944  uint8_t status;
1945  uint8_t response;
1946  uint8_t flags;
1947  uint8_t wqe_index;
1948  uint8_t cmd_window;
1949  uint8_t code;
1951 
1952 /**
1953  * @brief This structure contains the fields in a T_SOL completion.
1954  */
1955 typedef struct {
1956  uint8_t hw_status;
1957  uint16_t cid;
1958  uint8_t wqe_index;
1959  uint8_t code;
1961 
1962 /**
1963  * @brief This structure contains the fields in a DMSG completion.
1964  */
1965 typedef struct {
1966  uint16_t cid;
1967  uint8_t wqe_index;
1968  uint8_t code;
1970 
1971 /**
1972  * @brief This structure contains the fields in a T_DATA_DIGEST completion.
1973  */
1974 typedef struct {
1975  uint32_t buffer_offset;
1976  uint32_t exp_statsn;
1977  uint16_t cid;
1978  uint16_t datasn;
1979  uint8_t fin;
1981  uint16_t icd_index;
1983 
1984 /**
1985  * @brief This structure contains the fields in a CNXINV completion.
1986  */
1987 typedef struct {
1988  uint32_t addr_high;
1989  uint32_t addr_low;
1991  uint16_t cid;
1992  uint16_t rq_index;
1993  uint8_t code;
1995 
1996 /**
1997  * @brief This structure contains the fields in a CMNDINV completion.
1998  */
1999 typedef struct {
2000  uint16_t cid;
2001  uint16_t icd_index;
2002  uint8_t code;
2004 
2005 /**
2006  * @brief This structure contains the fields in a T_DATA_DIGEST completion.
2007  */
2008 typedef struct {
2009  uint8_t dif_error;
2010  uint16_t icd_index;
2011  uint16_t cid;
2013 
2014 /**
2015  * @brief This structure contains the type and associated fields for a CQE completion.
2016  */
2017 typedef struct {
2018  sli4_qentry_e ctype; /* completion type */
2019  union {
2028  } msg;
2030 
2031 /**
2032  * @brief This structure is used to track the WQEs for iSCSI.
2033  */
2034 typedef struct sli4_wqe_context_s {
2036  uint8_t *qe;
2037  uint16_t wrb_index;
2038  uint8_t wait_tcp_ack;
2039  uint8_t tcp_ack_status; /* status to send when TCP ACK is recvd */
2040  void *io; /* ocs_hal_io_t */
2042 
2043 /**
2044  * @brief This structure is used to track the SLI4 queues.
2045  */
2046 typedef struct sli4_queue_s {
2047  /* Common to all queue types */
2048  ocs_dma_t dma;
2049  ocs_lock_t lock;
2050  uint32_t index; /** current host entry index */
2051  uint16_t size; /** entry size */
2052  uint16_t length; /** number of entries */
2053  uint16_t n_posted; /** number entries posted */
2054  uint16_t id; /** Port assigned xQ_ID */
2055  uint16_t ulp; /** ULP assigned to this queue */
2056  uint16_t cxn_cnt; /** Number of connections using this CQ */
2057  uint32_t doorbell_offset;/** The offset for the doorbell */
2058  uint16_t doorbell_rset; /** register set for the doorbell */
2059  uint8_t type; /** queue type ie EQ, CQ, ... */
2060  uint8_t version; /** Command version used to create */
2061  char name[8]; /** used for dumping */
2062  uint32_t db_ring_cnt; /** total count of the number of times DB is rung */
2063  uint32_t proc_limit; /** limit number of CQE processed per iteration */
2064  uint32_t posted_limit; /** number of CQE/EQE to process before ringing doorbell */
2065  void *host_arg; /** Pointer to a associated host structure */
2066 
2067  /* Type specific gunk */
2068  union {
2069  uint32_t r_idx; /** "read" index (MQ only) */
2070  struct {
2071  uint32_t is_mq:1,/** CQ contains MQ/Async completions */
2072  is_hdr:1,/** is a RQ for packet headers */
2073  rq_batch:1,/** RQ index incremented by 8 */
2074  is_ini_cq:1;/** is an initiator CQ */
2075  } flag;
2076 
2077  /* Fields used for iSCSI WQs */
2078  struct {
2079  sli4_wqe_context_t *wqe_context; /* Memory malloc'd */
2080  uint32_t wqe_free_cnt;
2081  ocs_list_t wqe_free;
2082  ocs_list_t wqe_busy;
2084  } wq;
2085  } u;
2086 } sli4_queue_t;
2087 
2088 #define SLI4_QUEUE_DEFAULT_CQ UINT16_MAX /** Use the default CQ */
2089 
2090 #define SLI4_QUEUE_RQ_BATCH 8
2091 
2092 typedef enum {
2095  SLI4_CB_MAX /* must be last */
2096 } sli4_callback_e;
2097 
2098 typedef enum {
2103 
2104 typedef struct sli4_link_event_s {
2105  sli4_link_status_e status; /** link up/down */
2106  uint32_t speed; /** Mbps */
2108 
2109 
2110 typedef enum {
2119 
2120 typedef struct sli4_new_tcp_cnx_event_s {
2121  uint32_t cid;
2123 
2124 typedef struct sli4_stateless_op_cmpl_event_s {
2125  uint8_t status;
2127  uint32_t iface;
2129 
2130 typedef struct sli4_dhcp_op_cmpl_event_s {
2131  uint8_t status;
2133  uint32_t iface;
2135 
2136 typedef struct sli4_icmpv6_error_event_s {
2137  uint32_t iface;
2138  uint8_t error_code;
2140 
2141 typedef struct sli4_port_mtu_chg_event_s {
2142  uint32_t new_mtu;
2144 
2145 typedef struct sli4_iscsi_async_event_s {
2147  union {
2153  } params;
2155 
2156 typedef enum {
2160  SLI4_PORT_TYPE_MAX /* must be last */
2162 
2163 typedef enum {
2169 
2170 typedef enum {
2180 } sli4_asic_rev_e;
2181 
2182 /*
2183  * The SLI4 function to retrieve the fields from the command. The format is
2184  * different from BE3 versus Skyhawk.
2185  */
2186 struct sli4_s;
2187 typedef int32_t get_sli4_parameters_t(struct sli4_s *sli4);
2188 
2189 /*
2190  * Dynamically determine the chip capabilities and appropriately set the SLI
2191  * port mode of operation
2192  * 1. BE3 Mode for BE3 ASIC or use BE3 WQE/CQE structure for Skyhawk chip.
2193  * 2. Skyhawk Mode; use new Skyhawk WQE/CQE structures
2194  *
2195  * Driver for Skyhawk ASIC can function using BE3 WQE, CQE or new Skyhawk
2196  * WQE, CQE structures. Definitions to assist and tag desireable operational
2197  * mode of SLI4 Port.
2198  */
2199 struct sli_wqe_handlers;
2200 
2201 typedef struct sli4_s {
2202  ocs_os_handle_t os;
2204  uint32_t physical_port;
2205  uint32_t iface_default;
2206  uint32_t if_type; /** SLI Interface type */
2207 
2208  uint8_t is_skyhawk;
2209  uint8_t pf_num; /* SLI physical function number */
2210  uint8_t mac_addr[6];
2211  uint32_t sfp_a0[64];
2212  uint32_t sfp_a2[64];
2213 
2214  uint32_t icd_base;
2215  uint32_t icd_count;
2216  uint32_t icd_chain_base;
2225  uint32_t sli_rev; /** SLI revision number */
2226  uint32_t sli_family;
2227 
2228  struct {
2235  uint8_t is_ulp_iscsi[2];
2236  } features;
2237 
2238  struct {
2239  uint16_t max_qcount[SLI_QTYPE_MAX];
2240  uint32_t max_qentries[SLI_QTYPE_MAX];
2242  uint8_t post_sgl_ver;
2243  uint8_t fw_version[32];
2244  uint8_t fw_on_flash_version[32];
2245  char ipl_name[16];
2246  char modeldesc[64];
2247  uint32_t max_ios;
2250  } config;
2251 
2252  /*
2253  * Callback functions
2254  */
2255  int32_t (*link)(void *, void *);
2256  void *link_arg;
2257 
2258  int32_t (*iscsi_async)(void *, void *);
2260 
2261  ocs_dma_t cntl_attr;
2262  ocs_dma_t bmbx;
2263  struct {
2264  ocs_dma_t data;
2265  uint32_t length;
2266  } vpd;
2267  uint32_t num_sgl_pages;
2268  ocs_dma_t *sgl_pages;
2270  struct sli_wqe_handlers *wqe_handlers;
2272 
2275 } sli4_t;
2276 
2277 /**
2278  * Get / set parameter functions
2279  */
2280 
2281 static inline uint32_t
2283 {
2284  if (qtype >= SLI_QTYPE_MAX) {
2285  return 0;
2286  }
2287  return sli4->config.max_qcount[qtype];
2288 }
2289 
2290 static inline uint32_t
2292 {
2293 
2294  return sli4->config.max_qentries[qtype];
2295 }
2296 
2297 static inline uint32_t
2299 {
2300  return sli4->config.sge_supported_length;
2301 }
2302 
2303 static inline uint32_t
2305 {
2306  return sli4->features.t10_dif_capable;
2307 }
2308 
2309 static inline uint32_t
2311 {
2313 }
2314 
2315 static inline uint32_t
2317 {
2319 }
2320 
2321 static inline uint32_t
2323 {
2324  return sli4->features.sgl_chaining_capable;
2325 }
2326 
2327 static inline uint32_t
2329 {
2330  return sli4->features.dual_ulp_capable;
2331 }
2332 
2333 static inline uint32_t
2334 sli_is_ulp_enabled(sli4_t *sli4, uint16_t ulp)
2335 {
2336  return sli4->features.is_ulp_iscsi[ulp];
2337 }
2338 
2339 
2340 static inline void
2341 sli_chain_sge_build(sli4_t *sli4, sli4_chain_sge_t *sge, uint32_t icd_index, uint32_t frag_num, uint32_t offset)
2342 {
2343  ocs_memset(sge, 0, sizeof(*sge));
2345  sge->rsvd0 = sli4->chain_sge_init_0;
2346  sge->cra = (sli4->chain_sge_init_1 |
2347  ((icd_index & sli4->sgl_idx_field_mask) << sli4->sgl_idx_field_offset) |
2348  ((frag_num & sli4->frg_num_field_mask) << sli4->frg_num_field_offset) |
2349  offset);
2350 
2351  /* Per pending spec change, need to right shift by 3 bits */
2352  sge->cra = sge->cra >> 3;
2353 }
2354 
2355 static inline uint32_t
2357 {
2358  return sli4->sli_rev;
2359 }
2360 
2361 static inline uint32_t
2363 {
2364  return sli4->sli_family;
2365 }
2366 
2367 static inline uint32_t
2369 {
2370  return sli4->if_type;
2371 }
2372 
2373 static inline void *
2375 {
2376  return sli4->vpd.data.virt;
2377 }
2378 
2379 static inline uint32_t
2381 {
2382  return sli4->vpd.length;
2383 }
2384 
2385 static inline char *
2387 {
2388  return sli4->config.ipl_name;
2389 }
2390 
2391 static inline uint32_t
2392 sli_convert_mask_to_count(uint32_t method, uint32_t mask)
2393 {
2394  uint32_t count = 0;
2395 
2396  if (method) {
2397  count = 1 << ocs_lg2(mask);
2398  count *= 16;
2399  } else {
2400  count = mask;
2401  }
2402 
2403  return count;
2404 }
2405 
2406 /**
2407  * @brief Common Create Queue function prototype
2408  */
2409 typedef int32_t (*sli4_create_q_fn_t)(sli4_t *, void *, size_t, uint64_t,
2410  ocs_dma_t *, uint16_t, uint16_t);
2411 
2412 /**
2413  * @brief Common Destroy Queue function prototype
2414  */
2415 typedef int32_t (*sli4_destroy_q_fn_t)(sli4_t *, void *, size_t, uint64_t,
2416  uint16_t);
2417 
2418 
2419 /****************************************************************************
2420  * Function prototypes
2421  */
2422 extern int32_t sli_cmd_mailbox_queue_entry(sli4_t *, void *, size_t, uint64_t,
2423  uint32_t, ocs_dma_t *);
2424 
2425 extern int32_t sli_cmd_common_tcp_upload(sli4_t *sli4, void *buf, size_t size,
2426  uint64_t tag, uint16_t wq_id,
2427  uint8_t graceful);
2428 
2429 extern int32_t sli_cmd_common_nop(sli4_t *, void *, size_t, uint64_t, uint64_t);
2430 
2432  void *buf, size_t size, uint64_t tag, uint8_t *mac_addr);
2433 
2434 extern int32_t sli_cmd_common_get_profile_list(sli4_t *sli4, void *buf,
2435  size_t size, uint64_t tag,
2436  uint32_t start_profile_index, ocs_dma_t *dma);
2437 
2438 extern int32_t sli_cmd_common_get_active_profile(sli4_t *sli4, void *buf,
2439  size_t size, uint64_t tag);
2440 
2441 extern int32_t sli_cmd_common_set_active_profile(sli4_t *sli4, void *buf,
2442  size_t size, uint64_t tag,
2443  uint32_t fd,
2444  uint32_t active_profile_id);
2445 
2446 extern int32_t sli_cmd_common_get_reconfig_link_info(sli4_t *sli4, void *buf,
2447  size_t size, uint64_t tag, ocs_dma_t *dma);
2448 
2449 extern int32_t sli_cmd_common_set_reconfig_link_id(sli4_t *sli4, void *buf,
2450  size_t size, uint64_t tag, ocs_dma_t *dma,
2451  uint32_t fd, uint32_t active_link_config_id);
2452 
2453 extern int32_t sli_cmd_common_get_function_config(sli4_t *sli4, void *buf,
2454  size_t size, uint64_t tag);
2455 
2456 extern int32_t sli_cmd_common_get_profile_config(sli4_t *sli4, void *buf,
2457  size_t size, uint64_t tag, ocs_dma_t *dma);
2458 
2459 extern int32_t sli_cmd_common_set_profile_config(sli4_t *sli4, void *buf,
2460  size_t size, uint64_t tag, ocs_dma_t *dma,
2461  uint8_t profile_id, uint32_t descriptor_count,
2462  uint8_t isap);
2463 
2464 extern int32_t sli_cmd_common_set_features(sli4_t *, void *, size_t, uint32_t, uint32_t, void*);
2465 
2466 extern int32_t sli_cqe_mq(void *);
2467 
2468 extern int32_t sli_cqe_async(sli4_t *, void *);
2469 
2470 extern int32_t sli_setup(sli4_t *, ocs_os_handle_t, sli4_port_type_e);
2471 
2472 extern int32_t sli_raise_ue(sli4_t*);
2473 
2474 extern int32_t sli_init(sli4_t *);
2475 
2476 extern int32_t sli_reset(sli4_t *);
2477 
2478 extern int32_t sli_fw_reset(sli4_t *);
2479 
2480 extern int32_t sli_teardown(sli4_t *);
2481 
2482 extern int32_t sli_callback(sli4_t *, sli4_callback_e, void *, void *);
2483 
2484 extern int32_t sli_bmbx_command(sli4_t *);
2485 
2486 extern int32_t __sli_queue_init(sli4_t *, sli4_queue_t *, uint32_t, uint32_t,
2487  size_t, uint32_t, uint32_t);
2488 
2489 extern int32_t __sli_create_queue(sli4_t *, sli4_queue_t *);
2490 
2491 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);
2492 
2493 extern int32_t sli_queue_alloc(sli4_t *, uint32_t, sli4_queue_t *, uint32_t,
2494  sli4_queue_t *, uint16_t);
2495 
2496 extern int32_t sli_queue_free(sli4_t *, sli4_queue_t *);
2497 
2498 extern int32_t sli_queue_reset(sli4_t *, sli4_queue_t *);
2499 
2500 extern int32_t sli_queue_is_empty(sli4_t *, sli4_queue_t *);
2501 
2502 extern int32_t sli_queue_arm(sli4_t *, sli4_queue_t *, uint8_t);
2503 
2504 extern int32_t _sli_queue_write(sli4_t *, sli4_queue_t *, uint8_t *);
2505 extern int32_t sli_queue_write(sli4_t *, sli4_queue_t *, uint8_t *);
2506 
2507 extern int32_t sli_queue_read(sli4_t *, sli4_queue_t *, uint8_t *);
2508 
2509 extern int32_t sli_queue_index(sli4_t *, sli4_queue_t *);
2510 
2511 extern int32_t sli_queue_poke(sli4_t *, sli4_queue_t *, uint32_t, uint8_t *);
2512 extern int32_t _sli_queue_poke(sli4_t *, sli4_queue_t *, uint32_t, uint8_t *);
2513 
2514 extern int32_t sli_queue_peek(sli4_t *, sli4_queue_t *, uint32_t , uint8_t *);
2515 extern int32_t _sli_queue_peek(sli4_t *, sli4_queue_t *, uint32_t , uint8_t *);
2516 
2517 extern int32_t sli_queue_iscsi_wq_write(sli4_t *sli4, sli4_queue_t *q,
2518  uint8_t *entry, void *io);
2519 
2520 extern int32_t sli_queue_iscsi_wqe_invalidate(sli4_t *sli4, sli4_queue_t *q,
2521  void *io);
2522 
2523 extern void* sli_queue_iscsi_wqe_complete(sli4_t *sli4, sli4_queue_t *q,
2524  uint8_t wqe_index);
2525 
2526 extern int32_t sli_queue_iscsi_tcp_ack(sli4_t *sli4, sli4_queue_t *q,
2527  uint8_t wqe_index);
2528 
2529 extern void* sli_queue_iscsi_icd_lookup(sli4_t *sli4, sli4_queue_t *q,
2530  uint16_t icd_index);
2531 
2532 extern void* sli_queue_iscsi_icd_invalid(sli4_t *sli4, sli4_queue_t *q,
2533  uint16_t icd_index,
2534  uint8_t *wait_for_tcp_ack,
2535  uint8_t tcp_ack_status);
2536 
2537 extern uint32_t sli_queue_iscsi_free_cnt(sli4_t *sli4, sli4_queue_t *q);
2538 
2539 extern void sli_queue_iscsi_cleanup(void *hal, sli4_t *sli4, sli4_queue_t *q);
2540 
2541 extern int32_t sli_eq_parse(sli4_t *, uint8_t *, uint16_t *);
2542 
2543 extern int32_t sli_cq_parse(sli4_t *, sli4_queue_t *, uint8_t *,
2545 
2546 extern void sli_interrupt_set(sli4_t *, uint8_t);
2547 
2548 extern uint32_t sli_reg_read(sli4_t *, sli4_regname_e);
2549 
2550 extern void sli_reg_write(sli4_t *, sli4_regname_e, uint32_t);
2551 
2552 extern int32_t sli_fw_error_status(sli4_t *);
2553 
2554 #endif /* !_SLI4_H */
2555 
2556 /* vim: set noexpandtab textwidth=120: */
2557 
This structure contains the type and associated fields for a CQE completion.
Definition: sli4.h:2017
uint8_t is_skyhawk
Definition: sli4.h:2208
Mailbox Completion Queue Entry.
Definition: sli4.h:1773
ocs_list_t wqe_busy
Definition: sli4.h:2082
sli4_req_hdr_t hdr
Definition: sli4.h:871
uint32_t cra
Definition: sli4.h:395
ocs_os_handle_t os
Definition: sli4.h:2202
uint32_t buffer_length
Definition: sli4.h:386
char ipl_name[16]
Definition: sli4.h:2245
COMMON_DELETE_OBJECT.
Definition: sli4.h:1695
uint8_t t10_dif_separate_capable
Definition: sli4.h:2232
uint32_t physical_port
Definition: sli4.h:2204
sli4_port_type_e port_type
Definition: sli4.h:2203
uint32_t ref_tag_cmp
Definition: sli4.h:417
uint16_t frg_num_field_mask
Definition: sli4.h:2220
void * sli_queue_iscsi_icd_lookup(sli4_t *sli4, sli4_queue_t *q, uint16_t icd_index)
Returns the IO tied to a specific ICD index.
Definition: sli4.c:3604
Generic Common Create EQ/CQ/MQ/WQ/RQ Queue completion.
Definition: sli4.h:914
This structure contains the fields in a T_DATA_DIGEST completion.
Definition: sli4.h:2008
int32_t sli_raise_ue(sli4_t *sli4)
Definition: sli4.c:360
uint32_t length
Definition: sli4.h:2265
ocs_list_t ocs_list_link_t
Definition: ocs_list.h:84
sli4_qtype_e
Definition: sli4.h:1857
static uint32_t sli_eq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
Definition: sli4.h:170
int32_t sli_fw_error_status(sli4_t *sli4)
Read the SLIPORT_SEMAPHORE and SLIPORT_STATUS registers to check if the port status indicates that a ...
Definition: sli4.c:4070
uint16_t frg_num_field_offset
Definition: sli4.h:2219
int32_t sli_queue_poke(sli4_t *sli4, sli4_queue_t *q, uint32_t index, uint8_t *entry)
Definition: sli4.c:3929
int32_t get_sli4_parameters_t(struct sli4_s *sli4)
Definition: sli4.h:2187
COMMON_EXT_FAT_READ_STRING_TABLE.
Definition: sli4.h:1341
uint32_t icd_chain_count
Definition: sli4.h:2217
static void sli_chain_sge_build(sli4_t *sli4, sli4_chain_sge_t *sge, uint32_t icd_index, uint32_t frag_num, uint32_t offset)
Definition: sli4.h:2341
uint32_t num_sgl_pages
Definition: sli4.h:2267
int32_t sli_cmd_common_tcp_upload(sli4_t *sli4, void *buf, size_t size, uint64_t tag, uint16_t wq_id, uint8_t graceful)
Write a COMMON_TCP_UPLOAD command.
Definition: sli4.c:1196
int32_t sli_cmd_mailbox_queue_entry(sli4_t *sli4, void *buf, size_t size, uint64_t tag, uint32_t length, ocs_dma_t *dma)
Write a MQE header in the provided buffer.
Definition: sli4.c:508
uint16_t size
Definition: sli4.h:2051
mailbox queue Element header
Definition: sli4.h:564
uint32_t sli_family
Definition: sli4.h:2226
uint32_t wqe_free_cnt
Definition: sli4.h:2080
sli4_req_hdr_t hdr
Definition: sli4.h:836
COMMON_CREATE_MQ_EXT.
Definition: sli4.h:1003
uint32_t mqe_tag_high
Definition: sli4.h:1779
uint32_t max_qentries[SLI_QTYPE_MAX]
Definition: sli4.h:2240
sli4_wqe_context_t * wqe_context
Definition: sli4.h:2079
sli4_icmpv6_error_event_t icmp_err
Definition: sli4.h:2151
uint8_t * qe
Definition: sli4.h:2036
This structure contains the fields in a DMSG completion.
Definition: sli4.h:1965
uint32_t chain_sge_init_0
Definition: sli4.h:2223
static uint32_t sli_is_dif_separate_capable(sli4_t *sli4)
Definition: sli4.h:2316
int32_t sli_eq_modify_delay(sli4_t *sli4, sli4_queue_t *eq, uint32_t num_eq, uint32_t shift, uint32_t delay_mult)
Modify the delay timer for all the EQs.
Definition: sli4.c:3098
int32_t sli_queue_peek(sli4_t *sli4, sli4_queue_t *q, uint32_t index, uint8_t *entry)
Definition: sli4.c:3960
Event Queue Entry.
Definition: sli4.h:1757
Common TCP_UPLOAD.
Definition: sli4.h:1081
sli4_qentry_e
Definition: sli4.h:1869
get_sli4_parameters_t * get_sli4_parameters
Definition: sli4.h:2271
COMMON_QUERY_FW_CONFIG.
Definition: sli4.h:756
int32_t sli_cmd_common_set_features(sli4_t *sli4, void *buf, size_t size, uint32_t feature, uint32_t param_len, void *parameter)
Write a COMMON_SET_FEATURES command.
Definition: sli4.c:1778
static uint32_t sli_is_sgl_chaining_capable(sli4_t *sli4)
Definition: sli4.h:2322
int32_t sli_fw_reset(sli4_t *sli4)
Definition: sli4.c:2822
void * last_wqe_posted
Definition: sli4.h:2083
uint8_t dual_ulp_capable
Definition: sli4.h:2234
uint32_t rsvd0
Definition: sli4.h:394
int32_t sli_setup(sli4_t *sli4, ocs_os_handle_t os, sli4_port_type_e port_type)
Setup the SLI context.
Definition: sli4.c:2531
COMMON_GET_BE_CONFIGURATION_AND_RESOURCES (v1)
Definition: sli4.h:1148
int32_t sli_cmd_common_get_profile_config(sli4_t *sli4, void *buf, size_t size, uint64_t tag, ocs_dma_t *dma)
Write a COMMON_COMMON_GET_PROFILE_CONFIG command.
Definition: sli4.c:1454
sli4_iscsi_async_event_e
Definition: sli4.h:2110
COMMON_NOP.
Definition: sli4.h:1098
uint8_t tcp_offload_nrs
Definition: sli4.h:2229
int32_t sli_queue_iscsi_wqe_invalidate(sli4_t *sli4, sli4_queue_t *q, void *io)
uint32_t uint32_t rsvd9
Definition: sli4.h:1019
int32_t sli_cmd_common_get_active_profile(sli4_t *sli4, void *buf, size_t size, uint64_t tag)
Write a COMMON_COMMON_GET_ACTIVE_PROFILE command.
Definition: sli4.c:1603
int32_t sli_queue_write(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry)
Write an entry to the queue object.
Definition: sli4.c:3469
uint32_t rset
Definition: sli4.h:1853
sli4_new_tcp_cnx_event_t new_tcp
Definition: sli4.h:2148
uint32_t posted_limit
Definition: sli4.h:2064
COMMON_MANAGE_FAT.
Definition: sli4.h:1245
uint32_t rsvd2
Definition: sli4.h:360
Common Destroy CQ.
Definition: sli4.h:930
uint32_t partial_data_length
Definition: sli4.h:1990
uint8_t tcp_ack_status
Definition: sli4.h:2039
ocs_dma_t data
Definition: sli4.h:2264
T10 DIF Seed Scatter-Gather Entry (SGE)
Definition: sli4.h:415
int32_t sli_cmd_common_set_profile_config(sli4_t *sli4, void *buf, size_t size, uint64_t tag, ocs_dma_t *dma, uint8_t profile_id, uint32_t descriptor_count, uint8_t isap)
Write a COMMON_COMMON_SET_PROFILE_CONFIG command.
Definition: sli4.c:1504
sli4_qentry_e ctype
Definition: sli4.h:2018
uint32_t index
Definition: sli4.h:2050
static uint32_t sli_convert_mask_to_count(uint32_t method, uint32_t mask)
Definition: sli4.h:2392
static uint32_t sli_is_dif_inline_capable(sli4_t *sli4)
Definition: sli4.h:2310
static uint32_t sli_is_ulp_enabled(sli4_t *sli4, uint16_t ulp)
Definition: sli4.h:2334
int32_t sli_queue_is_empty(sli4_t *sli4, sli4_queue_t *q)
Check if the given queue is empty.
Definition: sli4.c:3327
COMMON_GET_CNTL_ATTRIBUTES.
Definition: sli4.h:637
uint32_t actual_response_length
Definition: sli4.h:610
uint32_t uint32_t write_offset
Definition: sli4.h:1680
sli4_qentry_fields_tx_dif_error_t tx_dif_err
Definition: sli4.h:2027
uint32_t uint32_t read_offset
Definition: sli4.h:1662
uint32_t max_ios
Definition: sli4.h:2247
int32_t __sli_queue_init(sli4_t *sli4, sli4_queue_t *q, uint32_t qtype, uint32_t version, size_t size, uint32_t n_entries, uint32_t align)
Initialize a queue object.
Definition: sli4.c:2953
const char * name
Definition: ocs_ddump.h:54
struct sli4_t::@37 features
sli4_req_hdr_t hdr
Definition: sli4.h:931
uint32_t sge_supported_length
Definition: sli4.h:2248
sli4_iscsi_async_event_e event
Definition: sli4.h:2146
int32_t sli_cqe_mq(void *buf)
Check mailbox/queue completion entry.
Definition: sli4.c:1820
sli4_req_hdr_t hdr
Definition: sli4.h:989
Common Destroy MQ.
Definition: sli4.h:1068
int32_t sli_cmd_common_get_reconfig_link_info(sli4_t *sli4, void *buf, size_t size, uint64_t tag, ocs_dma_t *dma)
Write a COMMON_COMMON_GET_RECONFIG_LINK_INFO command.
Definition: sli4.c:1683
int32_t sli_queue_read(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry)
Read an entry from the queue object.
Definition: sli4.c:3825
sli4_qentry_fields_tsol_t tsol
Definition: sli4.h:2022
static uint32_t sli_get_max_sge(sli4_t *sli4)
Definition: sli4.h:2298
T10 DIF Scatter-Gather Entry (SGE)
Definition: sli4.h:443
int32_t sli_teardown(sli4_t *sli4)
Tear down a SLI context.
Definition: sli4.c:2865
uint32_t icd_count
Definition: sli4.h:2215
#define SLI4_EQCQ_CQ_ID_MASK_LO
Definition: sli4.h:143
sli4_req_hdr_t hdr
Definition: sli4.h:1069
#define SLI4_EQCQ_EQ_ID_MASK_LO
Definition: sli4.h:142
COMMON_GET_EXT_FAT_CAPABILITIES.
Definition: sli4.h:1261
ocs_dma_t * sgl_pages
Definition: sli4.h:2268
sli4_asic_type_e
Definition: sli4.h:2163
uint32_t ref_tag_repl
Definition: sli4.h:418
uint32_t sli_rev
Definition: sli4.h:2225
COMMON_READ_OBJECT.
Definition: sli4.h:1659
static uint32_t sli_get_max_queue(sli4_t *sli4, sli4_qtype_e qtype)
Definition: sli4.h:2282
uint32_t bmbx_timeout_msecs
Definition: sli4.h:2249
COMMON_MODIFY_EQ_DELAY.
Definition: sli4.h:816
uint32_t sli_reg_read(sli4_t *sli, sli4_regname_e reg)
Read the given SLI register.
Definition: sli4.c:210
uint16_t ulp
Definition: sli4.h:2055
int32_t(* sli4_create_q_fn_t)(sli4_t *, void *, size_t, uint64_t, ocs_dma_t *, uint16_t, uint16_t)
Common Create Queue function prototype.
Definition: sli4.h:2409
Common Destroy EQ.
Definition: sli4.h:988
uint32_t doorbell_offset
Definition: sli4.h:2057
int32_t sli_cqe_async(sli4_t *sli4, void *buf)
Check asynchronous event completion entry.
Definition: sli4.c:1866
sli4_regname_e
Register name enums.
Definition: sli4.h:1821
Definition: sli4.h:2201
static uint32_t sli_is_dual_ulp_capable(sli4_t *sli4)
Definition: sli4.h:2328
sli4_req_hdr_t hdr
Definition: sli4.h:1660
ocs_lock_t lock
Definition: sli4.h:2049
static uint32_t sli_get_max_qentries(sli4_t *sli4, sli4_qtype_e qtype)
Definition: sli4.h:2291
void * cqe_template
Definition: sli4.h:2269
uint32_t host_buffer_descriptor_count
Definition: sli4.h:1685
sli4_qentry_fields_dpdu_t dpdu
Definition: sli4.h:2020
COMMON_GET_FW_VERSION.
Definition: sli4.h:740
int32_t sli_cmd_common_nop(sli4_t *sli4, void *buf, size_t size, uint64_t tag, uint64_t context)
Write a COMMON_NOP command.
Definition: sli4.c:1236
Buffer Descriptor Entry (BDE)
Definition: sli4.h:349
sli4_req_hdr_t hdr
Definition: sli4.h:1246
COMMON_FUNCTION_RESET.
Definition: sli4.h:623
uint8_t post_sgl_ver
Definition: sli4.h:2242
uint16_t sgl_idx_field_mask
Definition: sli4.h:2222
uint32_t proc_limit
Definition: sli4.h:2063
uint32_t rsvd1
Definition: sli4.h:400
COMMON_GET_CNTL_ATTRIBUTES.
Definition: sli4.h:700
void * sli_queue_iscsi_icd_invalid(sli4_t *sli4, sli4_queue_t *q, uint16_t icd_index, uint8_t *wait_for_tcp_ack, uint8_t tcp_ack_status)
Processes a target command invalidation IO completion. Moves the WRB to the free list.
Definition: sli4.c:3651
COMMON_SET_PROFILE_CONFIG.
Definition: sli4.h:1494
void * link_arg
Definition: sli4.h:2256
void * host_arg
Definition: sli4.h:2065
sli4_req_hdr_t hdr
Definition: sli4.h:946
const uint8_t sli4_fw_initialize[]
FW_INITIALIZE - initialize a SLI port.
Definition: sli4.c:62
int32_t sli_eq_parse(sli4_t *sli4, uint8_t *buf, uint16_t *cq_id)
Parse an EQ entry to retrieve the CQ_ID for this event.
Definition: sli4.c:3982
sli4_dhcp_op_cmpl_event_t dhcp_cmpl
Definition: sli4.h:2150
static uint32_t sli_get_sli_rev(sli4_t *sli4)
Definition: sli4.h:2356
Asynchronous Completion Queue Entry.
Definition: sli4.h:1798
struct sli4_t::@39 vpd
uint8_t type
Definition: sli4.h:2059
int32_t sli_queue_free(sli4_t *sli4, sli4_queue_t *q)
Free a queue.
Definition: sli4.c:3218
uint16_t sgl_idx_field_offset
Definition: sli4.h:2221
int32_t sli_queue_iscsi_wq_write(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry, void *io)
COMMON_GET_VPD_DATA.
Definition: sli4.h:1370
int32_t sli_cmd_common_get_function_config(sli4_t *sli4, void *buf, size_t size, uint64_t tag)
Write a COMMON_COMMON_GET_FUNCTION_CONFIG command.
Definition: sli4.c:1416
int32_t _sli_queue_peek(sli4_t *sli4, sli4_queue_t *q, uint32_t index, uint8_t *entry)
Definition: sli4.c:3941
sli4_asic_type_e asic_type
Definition: sli4.h:2273
uint32_t uint32_t rsvd1
Definition: sli4.h:1414
uint32_t mqe_tag_low
Definition: sli4.h:1778
ocs_list_t wqe_free
Definition: sli4.h:2081
sli4_qentry_fields_isol_t isol
Definition: sli4.h:2021
COMMON_GET_FUNCTION_CONFIG.
Definition: sli4.h:1457
sli4_qentry_fields_tcmdinv_t tcmdinv
Definition: sli4.h:2026
uint16_t wrb_index
Definition: sli4.h:2037
This structure is used to track the WQEs for iSCSI.
Definition: sli4.h:2034
#define SFP_PAGE_DATA_BYTES
COMMON_READ_TRANSCEIVER_DATA.
Definition: sli4.h:1120
uint32_t sge_type
Definition: sli4.h:396
uint32_t buffer_address_low
Definition: sli4.h:446
uint16_t length
Definition: sli4.h:2052
COMMON_GET_PROFILE_CONFIG.
Definition: sli4.h:1474
This structure contains the fields in a T_DATA_DIGEST completion.
Definition: sli4.h:1974
uint32_t if_type
Definition: sli4.h:2206
uint16_t id
Definition: sli4.h:2054
This structure contains the fields in a CNXINV completion.
Definition: sli4.h:1987
static uint32_t sli_get_sli_family(sli4_t *sli4)
Definition: sli4.h:2362
COMMON_WRITE_FLASHROM.
Definition: sli4.h:1199
sli4_qentry_fields_cnxinv_t cnxinv
Definition: sli4.h:2025
sli4_port_mtu_chg_event_t mtu_chg
Definition: sli4.h:2152
static uint32_t sli_get_vpd_len(sli4_t *sli4)
Definition: sli4.h:2380
COMMON_READ_OBJECT_LIST.
Definition: sli4.h:1709
int32_t sli_queue_arm(sli4_t *sli4, sli4_queue_t *q, uint8_t arm)
Arm or dis-arm a queue.
Definition: sli4.c:3356
uint16_t n_posted
Definition: sli4.h:2053
sli4_qentry_fields_data_digest_t data_digest
Definition: sli4.h:2024
struct sli4_t::@38 config
int32_t sli_reset(sli4_t *sli4)
Definition: sli4.c:2809
sli4_callback_e
Definition: sli4.h:2092
uint16_t doorbell_rset
Definition: sli4.h:2058
static uint32_t sli_is_dif_capable(sli4_t *sli4)
Definition: sli4.h:2304
sli4_res_hdr_t hdr
Definition: sli4.h:1108
COMMON_GET_PROFILE_LIST.
Definition: sli4.h:1537
COMMON_GET_ACTIVE_PROFILE.
Definition: sli4.h:1560
This structure is used to track the SLI4 queues.
Definition: sli4.h:2046
uint32_t sgl_segment_address_low
Definition: sli4.h:363
uint32_t r_idx
Definition: sli4.h:2069
#define MAX_PRODUCT_DESCRIPTORS
Definition: sli4.h:1532
COMMON_EXT_FAT_CONFIGURE_SNAPSHOT.
Definition: sli4.h:1295
ocs_dma_t cntl_attr
Definition: sli4.h:2261
int32_t sli_cmd_common_set_active_profile(sli4_t *sli4, void *buf, size_t size, uint64_t tag, uint32_t fd, uint32_t active_profile_id)
Write a COMMON_COMMON_SET_ACTIVE_PROFILE command.
Definition: sli4.c:1642
void sli_reg_write(sli4_t *sli, sli4_regname_e reg, uint32_t val)
Write the value to the given SLI register.
Definition: sli4.c:234
uint8_t t10_dif_capable
Definition: sli4.h:2230
uint32_t buffer_address_low
Definition: sli4.h:382
sli4_res_hdr_t hdr
Definition: sli4.h:915
int32_t sli_cq_parse(sli4_t *sli4, sli4_queue_t *cq, uint8_t *cqe, sli4_qentry_fields_t *fields)
Parse a CQ entry to retrieve event type and associated queue.
Definition: sli4.c:4009
int32_t __sli_create_queue(sli4_t *sli4, sli4_queue_t *q)
Issue command to create queue.
Definition: sli4.c:3009
uint32_t offset
Definition: sli4.h:359
uint8_t additional_status
Definition: sli4.h:2132
sli4_status_t
Definition: sli4.h:1883
void sli_queue_iscsi_cleanup(void *hal, sli4_t *sli4, sli4_queue_t *q)
Moves any WQE entries from the busy back to the free list when a connection is uploaded.
Definition: sli4.c:3718
uint8_t version
Definition: sli4.h:2060
int32_t sli_queue_iscsi_tcp_ack(sli4_t *sli4, sli4_queue_t *q, uint8_t wqe_index)
Processes a TCP ACK completion.
Definition: sli4.c:3532
#define SLI4_SGE_TYPE_CHAIN
Definition: sli4.h:468
static char * sli_get_ipl_name(sli4_t *sli4)
Definition: sli4.h:2386
int32_t _sli_queue_poke(sli4_t *sli4, sli4_queue_t *q, uint32_t index, uint8_t *entry)
Definition: sli4.c:3908
ocs_dma_t bmbx
Definition: sli4.h:2262
COMMON_SET_EXT_FAT_CAPABILITIES.
Definition: sli4.h:1273
COMMON_CREATE_CQ_V2.
Definition: sli4.h:870
sli4_qentry_fields_dmsg_t dmsg
Definition: sli4.h:2023
uint32_t buffer_address_high
Definition: sli4.h:356
uint8_t pf_num
Definition: sli4.h:2209
#define MAX_LINK_CONFIG_DESCRIPTORS
Definition: sli4.h:1603
int32_t sli_queue_reset(sli4_t *sli4, sli4_queue_t *q)
Zero all queue entries and reset the indexes.
Definition: sli4.c:3294
This structure contains the fields in a DPDU completion.
Definition: sli4.h:1926
COMMON_WRITE_OBJECT.
Definition: sli4.h:1677
uint32_t buffer_address_high
Definition: sli4.h:381
int32_t sli_queue_alloc(sli4_t *sli4, uint32_t qtype, sli4_queue_t *q, uint32_t n_entries, sli4_queue_t *assoc, uint16_t ulp)
Allocate a queue.
Definition: sli4.c:3135
uint32_t buffer_address_high
Definition: sli4.h:445
COMMON_CREATE_CQ_V0.
Definition: sli4.h:835
int32_t sli_bmbx_command(sli4_t *sli4)
Submit a command to the bootstrap mailbox and check the status.
Definition: sli4.c:405
Profile Descriptor for profile functions.
Definition: sli4.h:1516
uint32_t timeout
Definition: sli4.h:588
int32_t(* sli4_destroy_q_fn_t)(sli4_t *, void *, size_t, uint64_t, uint16_t)
Common Destroy Queue function prototype.
Definition: sli4.h:2415
uint32_t icd_chain_base
Definition: sli4.h:2216
int32_t sli_cmd_common_set_be_configuration_and_resources(sli4_t *sli4, void *buf, size_t size, uint64_t tag, uint8_t *mac_addr)
Write a COMMON_COMMON_SET_BE_CONFIGURATION_AND_RESOURCES command.
Definition: sli4.c:1362
uint32_t sli_queue_iscsi_free_cnt(sli4_t *sli4, sli4_queue_t *q)
Return the number of free WRB entries.
Definition: sli4.c:3702
int32_t sli_cmd_common_get_profile_list(sli4_t *sli4, void *buf, size_t size, uint64_t tag, uint32_t start_profile_index, ocs_dma_t *dma)
Write a COMMON_COMMON_GET_PROFILE_LIST command.
Definition: sli4.c:1555
sli4_stateless_op_cmpl_event_t stateless_cmpl
Definition: sli4.h:2149
int32_t sli_callback(sli4_t *sli4, sli4_callback_e which, void *func, void *arg)
Register a callback for the given event.
Definition: sli4.c:2905
uint16_t cxn_cnt
Definition: sli4.h:2056
uint16_t num_sges_per_icd
Definition: sli4.h:2241
Scatter-Gather Entry (SGE)
Definition: sli4.h:379
uint32_t off
Definition: sli4.h:1854
uint32_t icd_base
Definition: sli4.h:2214
uint16_t max_qcount[SLI_QTYPE_MAX]
Definition: sli4.h:2239
void * iscsi_async_arg
Definition: sli4.h:2259
static uint32_t sli_get_if_type(sli4_t *sli4)
Definition: sli4.h:2368
uint32_t db_ring_cnt
Definition: sli4.h:2062
sli4_link_status_e
Definition: sli4.h:2098
uint32_t request_length
Definition: sli4.h:589
uint32_t flash_rom_access_operation_type
Definition: sli4.h:1203
Generic Command Request header.
Definition: sli4.h:582
void sli_interrupt_set(sli4_t *sli, uint8_t enable)
Definition: sli4.c:4037
uint32_t payload_length
Definition: sli4.h:571
uint32_t uint32_t rsvd
Definition: sli4.h:961
uint32_t icd_num_per_page
Definition: sli4.h:2218
struct sli_wqe_handlers * wqe_handlers
Definition: sli4.h:2270
Generic Command Response header.
Definition: sli4.h:600
uint32_t chain_sge_init_1
Definition: sli4.h:2224
COMMON_SET_ACTIVE_PROFILE.
Definition: sli4.h:1579
void * sli_queue_iscsi_wqe_complete(sli4_t *sli4, sli4_queue_t *q, uint8_t wqe_index)
Processes a solicited IO completion. Moves the WRB to the free list.
Definition: sli4.c:3489
sli4_req_hdr_t hdr
Definition: sli4.h:1099
const uint8_t sli4_fw_deinitialize[]
FW_DEINITIALIZE - deinitialize a SLI port.
Definition: sli4.c:67
uint8_t sgl_chaining_capable
Definition: sli4.h:2233
int32_t sli_cmd_common_set_reconfig_link_id(sli4_t *sli4, void *buf, size_t size, uint64_t tag, ocs_dma_t *dma, uint32_t fd, uint32_t active_link_config_id)
Write a COMMON_COMMON_SET_RECONFIG_LINK_ID command.
Definition: sli4.c:1729
COMMON_CREATE_EQ.
Definition: sli4.h:945
sli4_asic_rev_e
Definition: sli4.h:2170
uint8_t is_ulp_iscsi[2]
Definition: sli4.h:2235
uint8_t wait_tcp_ack
Definition: sli4.h:2038
int32_t sli_queue_index(sli4_t *sli4, sli4_queue_t *q)
Definition: sli4.c:3897
int32_t _sli_queue_write(sli4_t *sli4, sli4_queue_t *q, uint8_t *entry)
Write an entry to the queue object.
Definition: sli4.c:3397
uint8_t t10_dif_inline_capable
Definition: sli4.h:2231
static void * sli_get_vpd(sli4_t *sli4)
Definition: sli4.h:2374
uint32_t sgl_segment_address_high
Definition: sli4.h:364
sli4_req_hdr_t hdr
Definition: sli4.h:1082
int32_t sli_init(sli4_t *sli4)
Definition: sli4.c:2803
COMMON_EXT_FAT_RETRIEVE_SNAPSHOT.
Definition: sli4.h:1307
sli4_asic_rev_e asic_rev
Definition: sli4.h:2274
This structure contains the fields in a I_SOL completion.
Definition: sli4.h:1939
static uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
Definition: sli4.h:200
sli4_port_type_e
Definition: sli4.h:2156
ocs_list_link_t link
Definition: sli4.h:2035
This structure contains the fields in a T_SOL completion.
Definition: sli4.h:1955
ocs_dma_t dma
Definition: sli4.h:2048
This structure contains the fields in a CMNDINV completion.
Definition: sli4.h:1999
uint32_t iface_default
Definition: sli4.h:2205
uint32_t buffer_address_low
Definition: sli4.h:355
uint32_t host_buffer_descriptor_count
Definition: sli4.h:1667
COMMON_SET_BE_CONFIGURATION_AND_RESOURCES (v1)
Definition: sli4.h:1162