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-2018, 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 
48 #define SLI4_BMBX_TIMEOUT_MSEC 30000
49 #define SLI4_FW_READY_TIMEOUT_MSEC 30000
50 #define SLI4_FW_DUMP_TIMEOUT_MSEC 60000
51 
52 static inline uint32_t
53 sli_page_count(size_t bytes, uint32_t page_size)
54 {
55  uint32_t mask = page_size - 1;
56  uint32_t shift = 0;
57 
58  switch (page_size) {
59  case 4096:
60  shift = 12;
61  break;
62  case 8192:
63  shift = 13;
64  break;
65  case 16384:
66  shift = 14;
67  break;
68  case 32768:
69  shift = 15;
70  break;
71  case 65536:
72  shift = 16;
73  break;
74  default:
75  return 0;
76  }
77 
78  return (bytes + mask) >> shift;
79 }
80 
81 /*************************************************************************
82  * Common PCI configuration space register definitions
83  */
84 
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
90 
91 #define SLI4_PCI_SOFT_RESET_CSR 0x005c /** register offset */
92 #define SLI4_PCI_SOFT_RESET_MASK 0x0080
93 
94 /*************************************************************************
95  * Common SLI-4 register offsets and field definitions
96  */
97 
98 /**
99  * @brief SLI_INTF - SLI Interface Definition Register
100  */
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
112 
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_IF_TYPE_LANCER_G7 6
118 #define SLI4_MAX_IF_TYPES 7
119 
120 /**
121  * @brief ASIC_ID - SLI ASIC Type and Revision Register
122  */
123 #define SLI4_ASIC_ID_REG 0x009c /* register offset */
124 #define SLI4_ASIC_REV_SHIFT 0
125 #define SLI4_ASIC_REV_MASK 0xf
126 #define SLI4_ASIC_VER_SHIFT 4
127 #define SLI4_ASIC_VER_MASK 0xf
128 #define SLI4_ASIC_GEN_SHIFT 8
129 #define SLI4_ASIC_GEN_MASK 0xff
130 #define SLI4_ASIC_GEN_BE2 0x00
131 #define SLI4_ASIC_GEN_BE3 0x03
132 #define SLI4_ASIC_GEN_SKYHAWK 0x04
133 #define SLI4_ASIC_GEN_CORSAIR 0x05
134 #define SLI4_ASIC_GEN_LANCER 0x0b
135 
136 
137 /**
138  * @brief BMBX - Bootstrap Mailbox Register
139  */
140 #define SLI4_BMBX_REG 0x0160 /* register offset */
141 #define SLI4_BMBX_MASK_HI 0x3
142 #define SLI4_BMBX_MASK_LO 0xf
143 #define SLI4_BMBX_RDY BIT(0)
144 #define SLI4_BMBX_HI BIT(1)
145 #define SLI4_BMBX_WRITE_HI(r) ((ocs_addr32_hi(r) & ~SLI4_BMBX_MASK_HI) | \
146  SLI4_BMBX_HI)
147 #define SLI4_BMBX_WRITE_LO(r) (((ocs_addr32_hi(r) & SLI4_BMBX_MASK_HI) << 30) | \
148  (((r) & ~SLI4_BMBX_MASK_LO) >> 2))
149 
150 #define SLI4_BMBX_SIZE 256
151 
152 #define SLI4_PORT_MIGRATION_BIT 16
153 
154 /**
155  * @brief EQCQ_DOORBELL - EQ and CQ Doorbell Register
156  */
157 #define SLI4_EQCQ_DOORBELL_REG 0x120
158 #define SLI4_EQCQ_DOORBELL_CI BIT(9)
159 #define SLI4_EQCQ_DOORBELL_QT BIT(10)
160 #define SLI4_EQCQ_DOORBELL_ARM BIT(29)
161 #define SLI4_EQCQ_DOORBELL_SE BIT(31)
162 #define SLI4_EQCQ_NUM_SHIFT 16
163 #define SLI4_EQCQ_NUM_MASK 0x01ff
164 #define SLI4_EQCQ_EQ_ID_MASK 0x3fff
165 #define SLI4_EQCQ_CQ_ID_MASK 0x7fff
166 #define SLI4_EQCQ_EQ_ID_MASK_LO 0x01ff
167 #define SLI4_EQCQ_CQ_ID_MASK_LO 0x03ff
168 #define SLI4_EQCQ_EQCQ_ID_MASK_HI 0xf800
169 
170 #define SLI4_IF6_EQ_DOORBELL_REG 0x120
171 #define SLI4_IF6_CQ_DOORBELL_REG 0xC0
172 #define SLI4_IF6_DPP_DOORBELL_REG_SET 2
173 /**
174  * @brief SLIPORT_CONTROL - SLI Port Control Register
175  */
176 #define SLI4_SLIPORT_CONTROL_REG 0x0408
177 #define SLI4_SLIPORT_CONTROL_END BIT(30)
178 #define SLI4_SLIPORT_CONTROL_LITTLE_ENDIAN (0)
179 #define SLI4_SLIPORT_CONTROL_BIG_ENDIAN BIT(30)
180 #define SLI4_SLIPORT_CONTROL_IP BIT(27)
181 #define SLI4_SLIPORT_CONTROL_IDIS BIT(22)
182 #define SLI4_SLIPORT_CONTROL_FDD BIT(31)
183 
184 /**
185  * @brief SLI4_SLIPORT_ERROR1 - SLI Port Error Register
186  */
187 #define SLI4_SLIPORT_ERROR1 0x040c
188 #define SLI4_SLIPORT_ERROR1_RQ_EMPTY_TIMEOUT 0x52004a01
189 
190 /**
191  * @brief SLI4_SLIPORT_ERROR2 - SLI Port Error Register
192  */
193 #define SLI4_SLIPORT_ERROR2 0x0410
194 
195 /**
196  * @brief User error registers
197  */
198 #define SLI4_UERR_STATUS_LOW_REG 0xA0
199 #define SLI4_UERR_STATUS_HIGH_REG 0xA4
200 #define SLI4_UERR_MASK_LOW_REG 0xA8
201 #define SLI4_UERR_MASK_HIGH_REG 0xAC
202 
203 /**
204  * @brief Registers for generating software UE (BE3)
205  */
206 #define SLI4_SW_UE_CSR1 0x138
207 #define SLI4_SW_UE_CSR2 0x1FFFC
208 
209 /**
210  * @brief Registers for generating software UE (Skyhawk)
211  */
212 #define SLI4_SW_UE_REG 0x5C /* register offset */
213 
214 static inline uint32_t sli_eq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
215 {
216  uint32_t reg = 0;
217 #if BYTE_ORDER == LITTLE_ENDIAN
218  struct {
219  uint32_t eq_id_lo:9,
220  ci:1, /* clear interrupt */
221  qt:1, /* queue type */
222  eq_id_hi:5,
223  number_popped:13,
224  arm:1,
225  :1,
226  se:1;
227  } * eq_doorbell = (void *)&reg;
228 #else
229 #error big endian version not defined
230 #endif
231 
232  eq_doorbell->eq_id_lo = id & SLI4_EQCQ_EQ_ID_MASK_LO;
233  eq_doorbell->qt = 1; /* EQ is type 1 (section 2.2.3.3 SLI Arch) */
234  eq_doorbell->eq_id_hi = (id >> 9) & 0x1f;
235  eq_doorbell->number_popped = n_popped;
236  eq_doorbell->arm = arm;
237  eq_doorbell->ci = TRUE;
238 
239  return reg;
240 }
241 
242 static inline uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
243 {
244  uint32_t reg = 0;
245 #if BYTE_ORDER == LITTLE_ENDIAN
246  struct {
247  uint32_t cq_id_lo:10,
248  qt:1, /* queue type */
249  cq_id_hi:5,
250  number_popped:13,
251  arm:1,
252  :1,
253  se:1;
254  } * cq_doorbell = (void *)&reg;
255 #else
256 #error big endian version not defined
257 #endif
258 
259  cq_doorbell->cq_id_lo = id & SLI4_EQCQ_CQ_ID_MASK_LO;
260  cq_doorbell->qt = 0; /* CQ is type 0 (section 2.2.3.3 SLI Arch) */
261  cq_doorbell->cq_id_hi = (id >> 10) & 0x1f;
262  cq_doorbell->number_popped = n_popped;
263  cq_doorbell->arm = arm;
264 
265  return reg;
266 }
267 
268 static inline uint32_t sli_iftype6_eq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
269 {
270  uint32_t reg = 0;
271 #if BYTE_ORDER == LITTLE_ENDIAN
272  struct {
273  uint32_t eq_id:12,
274  :4, /* clear interrupt */
275  number_popped:13,
276  arm:1,
277  :1,
278  io:1;
279  } * eq_doorbell = (void *)&reg;
280 #else
281 #error big endian version not defined
282 #endif
283 
284  eq_doorbell->eq_id = id;
285  eq_doorbell->number_popped = n_popped;
286  eq_doorbell->arm = arm;
287 
288  return reg;
289 }
290 
291 static inline uint32_t sli_iftype6_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
292 {
293  uint32_t reg = 0;
294 #if BYTE_ORDER == LITTLE_ENDIAN
295  struct {
296  uint32_t cq_id:16,
297  number_popped:13,
298  arm:1,
299  :1,
300  se:1;
301  } * cq_doorbell = (void *)&reg;
302 #else
303 #error big endian version not defined
304 #endif
305 
306  cq_doorbell->cq_id = id;
307  cq_doorbell->number_popped = n_popped;
308  cq_doorbell->arm = arm;
309 
310  return reg;
311 }
312 
313 /**
314  * @brief MQ_DOORBELL - MQ Doorbell Register
315  */
316 #define SLI4_MQ_DOORBELL_REG 0x0140 /* register offset */
317 #define SLI4_IF6_MQ_DOORBELL_REG 0x0160 /* register offset if_type = 6 */
318 #define SLI4_MQ_DOORBELL_NUM_SHIFT 16
319 #define SLI4_MQ_DOORBELL_NUM_MASK 0x3fff
320 #define SLI4_MQ_DOORBELL_ID_MASK 0xffff
321 #define SLI4_MQ_DOORBELL(n, i) ((((n) & SLI4_MQ_DOORBELL_NUM_MASK) << SLI4_MQ_DOORBELL_NUM_SHIFT) | \
322  ((i) & SLI4_MQ_DOORBELL_ID_MASK))
323 
324 /**
325  * @brief RQ_DOORBELL - RQ Doorbell Register
326  */
327 #define SLI4_RQ_DOORBELL_REG 0x0a0 /* register offset */
328 #define SLI4_IF6_RQ_DOORBELL_REG 0x0080 /* register offset of if_type = 6 */
329 #define SLI4_RQ_DOORBELL_NUM_SHIFT 16
330 #define SLI4_RQ_DOORBELL_NUM_MASK 0x3fff
331 #define SLI4_RQ_DOORBELL_ID_MASK 0xffff
332 #define SLI4_RQ_DOORBELL(n, i) ((((n) & SLI4_RQ_DOORBELL_NUM_MASK) << SLI4_RQ_DOORBELL_NUM_SHIFT) | \
333  ((i) & SLI4_RQ_DOORBELL_ID_MASK))
334 
335 /**
336  * @brief WQ_DOORBELL - WQ Doorbell Register
337  */
338 #define SLI4_IO_WQ_DOORBELL_REG 0x040 /* register offset */
339 #define SLI4_IF6_WQ_DOORBELL_REG 0x040 /* register offset for if_type = 6 */
340 #define SLI4_WQ_DOORBELL_IDX_SHIFT 16
341 #define SLI4_WQ_DOORBELL_IDX_MASK 0x00ff
342 #define SLI4_WQ_DOORBELL_NUM_SHIFT 24
343 #define SLI4_WQ_DOORBELL_NUM_MASK 0x00ff
344 #define SLI4_WQ_DOORBELL_ID_MASK 0xffff
345 #define SLI4_WQ_DOORBELL(n, x, i) ((((n) & SLI4_WQ_DOORBELL_NUM_MASK) << SLI4_WQ_DOORBELL_NUM_SHIFT) | \
346  (((x) & SLI4_WQ_DOORBELL_IDX_MASK) << SLI4_WQ_DOORBELL_IDX_SHIFT) | \
347  ((i) & SLI4_WQ_DOORBELL_ID_MASK))
348 
349 #define SLI4_DPP_WQ_DOORBELL_NUM_SHIFT 24
350 #define SLI4_DPP_WQ_DOORBELL_NUM_MASK 0x00ff
351 #define SLI4_DPP_WQ_DOORBELL_DPP BIT(23)
352 #define SLI4_DPP_WQ_DOORBELL_DPP_ID_SHIFT 16
353 #define SLI4_DPP_WQ_DOORBELL_DPP_ID_MASK 0x001f
354 #define SLI4_DPP_WQ_DOORBELL_ID_MASK 0xffff
355 #define SLI4_DPP_WQ_DOORBELL(n, x, i) ((((n) & SLI4_DPP_WQ_DOORBELL_NUM_MASK) << SLI4_DPP_WQ_DOORBELL_NUM_SHIFT) | \
356  (SLI4_DPP_WQ_DOORBELL_DPP) | \
357  (((x) & SLI4_DPP_WQ_DOORBELL_DPP_ID_MASK) << SLI4_DPP_WQ_DOORBELL_DPP_ID_SHIFT) | \
358  ((i) & SLI4_WQ_DOORBELL_ID_MASK))
359 
360 /**
361  * @brief SLIPORT_SEMAPHORE - SLI Port Host and Port Status Register
362  */
363 #define SLI4_PORT_SEMAPHORE_REG_0 0x00ac /** register offset Interface Type 0 + 1 */
364 #define SLI4_PORT_SEMAPHORE_REG_1 0x0180 /** register offset Interface Type 0 + 1 */
365 #define SLI4_PORT_SEMAPHORE_REG_236 0x0400 /** register offset Interface Type 2 + 3 + 6*/
366 #define SLI4_PORT_SEMAPHORE_PORT_MASK 0x0000ffff
367 #define SLI4_PORT_SEMAPHORE_PORT(r) ((r) & SLI4_PORT_SEMAPHORE_PORT_MASK)
368 #define SLI4_PORT_SEMAPHORE_HOST_MASK 0x00ff0000
369 #define SLI4_PORT_SEMAPHORE_HOST_SHIFT 16
370 #define SLI4_PORT_SEMAPHORE_HOST(r) (((r) & SLI4_PORT_SEMAPHORE_HOST_MASK) >> \
371  SLI4_PORT_SEMAPHORE_HOST_SHIFT)
372 #define SLI4_PORT_SEMAPHORE_SCR2 BIT(26) /** scratch area 2 */
373 #define SLI4_PORT_SEMAPHORE_SCR1 BIT(27) /** scratch area 1 */
374 #define SLI4_PORT_SEMAPHORE_IPC BIT(28) /** IP conflict */
375 #define SLI4_PORT_SEMAPHORE_NIP BIT(29) /** no IP address */
376 #define SLI4_PORT_SEMAPHORE_SFI BIT(30) /** secondary firmware image used */
377 #define SLI4_PORT_SEMAPHORE_PERR BIT(31) /** POST fatal error */
378 
379 #define SLI4_PORT_SEMAPHORE_STATUS_POST_READY 0xc000
380 #define SLI4_PORT_SEMAPHORE_STATUS_UNRECOV_ERR 0xf000
381 #define SLI4_PORT_SEMAPHORE_STATUS_ERR_MASK 0xf000
382 #define SLI4_PORT_SEMAPHORE_IN_ERR(r) (SLI4_PORT_SEMAPHORE_STATUS_UNRECOV_ERR == ((r) & \
383  SLI4_PORT_SEMAPHORE_STATUS_ERR_MASK))
384 
385 /**
386  * @brief SLIPORT_STATUS - SLI Port Status Register
387  */
388 
389 #define SLI4_PORT_STATUS_REG_236 0x0404 /** register offset Interface Type 2 + 3 + 6*/
390 #define SLI4_PORT_STATUS_FDP BIT(21) /** function specific dump present */
391 #define SLI4_PORT_STATUS_RDY BIT(23) /** ready */
392 #define SLI4_PORT_STATUS_RN BIT(24) /** reset needed */
393 #define SLI4_PORT_STATUS_DIP BIT(25) /** dump present */
394 #define SLI4_PORT_STATUS_SPP BIT(27) /** SLI port paused */
395 #define SLI4_PORT_STATUS_OTI BIT(29) /** over temp indicator */
396 #define SLI4_PORT_STATUS_END BIT(30) /** endianness */
397 #define SLI4_PORT_STATUS_ERR BIT(31) /** SLI port error */
398 #define SLI4_PORT_STATUS_READY(r) ((r) & SLI4_PORT_STATUS_RDY)
399 #define SLI4_PORT_STATUS_ERROR(r) ((r) & SLI4_PORT_STATUS_ERR)
400 #define SLI4_PORT_STATUS_DUMP_PRESENT(r) ((r) & SLI4_PORT_STATUS_DIP)
401 #define SLI4_PORT_STATUS_FDP_PRESENT(r) ((r) & SLI4_PORT_STATUS_FDP)
402 
403 
404 #define SLI4_PHSDEV_CONTROL_REG_236 0x0414 /** register offset Interface Type 2 + 3 + 6*/
405 #define SLI4_PHYDEV_CONTROL_DRST BIT(0) /** physical device reset */
406 #define SLI4_PHYDEV_CONTROL_FRST BIT(1) /** firmware reset */
407 #define SLI4_PHYDEV_CONTROL_DD BIT(2) /** diagnostic dump */
408 #define SLI4_PHYDEV_CONTROL_FRL_MASK 0x000000f0
409 #define SLI4_PHYDEV_CONTROL_FRL_SHIFT 4
410 #define SLI4_PHYDEV_CONTROL_FRL(r) (((r) & SLI4_PHYDEV_CONTROL_FRL_MASK) >> \
411  SLI4_PHYDEV_CONTROL_FRL_SHIFT_SHIFT)
412 #define SLI4_PHYDEV_CONTROL_CFP BIT(11) /** continue from pause */
413 
414 /*************************************************************************
415  * SLI-4 mailbox command formats and definitions
416  */
417 
418 typedef struct sli4_mbox_command_header_s {
419 #if BYTE_ORDER == LITTLE_ENDIAN
420  uint32_t :8,
421  command:8,
422  status:16; /** Port writes to indicate success / fail */
423 #else
424 #error big endian version not defined
425 #endif
427 
428 #define SLI4_MBOX_COMMAND_CONFIG_LINK 0x07
429 #define SLI4_MBOX_COMMAND_DUMP 0x17
430 #define SLI4_MBOX_COMMAND_DOWN_LINK 0x06
431 #define SLI4_MBOX_COMMAND_INIT_LINK 0x05
432 #define SLI4_MBOX_COMMAND_INIT_VFI 0xa3
433 #define SLI4_MBOX_COMMAND_INIT_VPI 0xa4
434 #define SLI4_MBOX_COMMAND_POST_XRI 0xa7
435 #define SLI4_MBOX_COMMAND_RELEASE_XRI 0xac
436 #define SLI4_MBOX_COMMAND_READ_CONFIG 0x0b
437 #define SLI4_MBOX_COMMAND_READ_STATUS 0x0e
438 #define SLI4_MBOX_COMMAND_READ_NVPARMS 0x02
439 #define SLI4_MBOX_COMMAND_READ_REV 0x11
440 #define SLI4_MBOX_COMMAND_READ_LNK_STAT 0x12
441 #define SLI4_MBOX_COMMAND_READ_SPARM64 0x8d
442 #define SLI4_MBOX_COMMAND_READ_TOPOLOGY 0x95
443 #define SLI4_MBOX_COMMAND_REG_FCFI 0xa0
444 #define SLI4_MBOX_COMMAND_REG_FCFI_MRQ 0xaf
445 #define SLI4_MBOX_COMMAND_REG_RPI 0x93
446 #define SLI4_MBOX_COMMAND_REG_RX_RQ 0xa6
447 #define SLI4_MBOX_COMMAND_REG_VFI 0x9f
448 #define SLI4_MBOX_COMMAND_REG_VPI 0x96
449 #define SLI4_MBOX_COMMAND_REQUEST_FEATURES 0x9d
450 #define SLI4_MBOX_COMMAND_SLI_CONFIG 0x9b
451 #define SLI4_MBOX_COMMAND_UNREG_FCFI 0xa2
452 #define SLI4_MBOX_COMMAND_UNREG_RPI 0x14
453 #define SLI4_MBOX_COMMAND_UNREG_VFI 0xa1
454 #define SLI4_MBOX_COMMAND_UNREG_VPI 0x97
455 #define SLI4_MBOX_COMMAND_WRITE_NVPARMS 0x03
456 #define SLI4_MBOX_COMMAND_CONFIG_TOW 0xAD
457 #define SLI4_MBOX_COMMAND_CONFIG_TOW_HP 0xAE
458 
459 #define SLI4_MBOX_STATUS_SUCCESS 0x0000
460 #define SLI4_MBOX_STATUS_FAILURE 0x0001
461 #define SLI4_MBOX_STATUS_RPI_NOT_REG 0x1400
462 #define SLI4_MBOX_EXT_STATUS_OBJ_UNSUPPORTED_FIRMWARE 0xEB
463 
464 /**
465  * @brief Buffer Descriptor Entry (BDE)
466  */
467 typedef struct sli4_bde_s {
468 #if BYTE_ORDER == LITTLE_ENDIAN
469  uint32_t buffer_length:24,
470  bde_type:8;
471  union {
472  struct {
475  } data;
476  struct {
477  uint32_t offset;
478  uint32_t rsvd2;
479  } imm;
480  struct {
483  } blp;
484  } u;
485 #else
486 #error big endian version not defined
487 #endif
488 } sli4_bde_t;
489 
490 #define SLI4_BDE_TYPE_BDE_64 0x00 /** Generic 64-bit data */
491 #define SLI4_BDE_TYPE_BDE_IMM 0x01 /** Immediate data */
492 #define SLI4_BDE_TYPE_BLP 0x40 /** Buffer List Pointer */
493 
494 /**
495  * @brief Scatter-Gather Entry (SGE)
496  */
497 typedef struct sli4_sge_s {
498 #if BYTE_ORDER == LITTLE_ENDIAN
501  uint32_t data_offset:27,
502  sge_type:4,
503  last:1;
504  uint32_t buffer_length;
505 #else
506 #error big endian version not defined
507 #endif
508 } sli4_sge_t;
509 
510 /**
511  * @brief T10 DIF Scatter-Gather Entry (SGE)
512  */
513 typedef struct sli4_dif_sge_s {
514 #if BYTE_ORDER == LITTLE_ENDIAN
517  uint32_t :27,
518  sge_type:4,
519  last:1;
520  uint32_t :32;
521 #else
522 #error big endian version not defined
523 #endif
525 
526 /**
527  * @brief T10 DIF Seed Scatter-Gather Entry (SGE)
528  */
529 typedef struct sli4_diseed_sge_s {
530 #if BYTE_ORDER == LITTLE_ENDIAN
531  uint32_t ref_tag_cmp;
532  uint32_t ref_tag_repl;
533  uint32_t app_tag_repl:16,
534  :2,
535  hs:1,
536  ws:1,
537  ic:1,
538  ics:1,
539  atrt:1,
540  at:1,
541  fwd_app_tag:1,
542  repl_app_tag:1,
543  head_insert:1,
544  sge_type:4,
545  last:1;
546  uint32_t app_tag_cmp:16,
547  dif_blk_size:3,
548  auto_incr_ref_tag:1,
549  check_app_tag:1,
550  check_ref_tag:1,
551  check_crc:1,
552  new_ref_tag:1,
553  dif_op_rx:4,
554  dif_op_tx:4;
555 #else
556 #error big endian version not defined
557 #endif
559 
560 /**
561  * @brief List Segment Pointer Scatter-Gather Entry (SGE)
562  */
563 typedef struct sli4_lsp_sge_s {
564 #if BYTE_ORDER == LITTLE_ENDIAN
567  uint32_t :27,
568  sge_type:4,
569  last:1;
570  uint32_t segment_length:24,
571  :8;
572 #else
573 #error big endian version not defined
574 #endif
576 
577 #define SLI4_SGE_MAX_RESERVED 3
578 
579 #define SLI4_SGE_DIF_OP_IN_NODIF_OUT_CRC 0x00
580 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_NODIF 0x01
581 #define SLI4_SGE_DIF_OP_IN_NODIF_OUT_CHKSUM 0x02
582 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_NODIF 0x03
583 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_CRC 0x04
584 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_CHKSUM 0x05
585 #define SLI4_SGE_DIF_OP_IN_CRC_OUT_CHKSUM 0x06
586 #define SLI4_SGE_DIF_OP_IN_CHKSUM_OUT_CRC 0x07
587 #define SLI4_SGE_DIF_OP_IN_RAW_OUT_RAW 0x08
588 
589 #define SLI4_SGE_TYPE_DATA 0x00
590 #define SLI4_SGE_TYPE_CHAIN 0x03 /** Skyhawk only */
591 #define SLI4_SGE_TYPE_DIF 0x04 /** Data Integrity Field */
592 #define SLI4_SGE_TYPE_LSP 0x05 /** List Segment Pointer */
593 #define SLI4_SGE_TYPE_PEDIF 0x06 /** Post Encryption Engine DIF */
594 #define SLI4_SGE_TYPE_PESEED 0x07 /** Post Encryption Engine DIF Seed */
595 #define SLI4_SGE_TYPE_DISEED 0x08 /** DIF Seed */
596 #define SLI4_SGE_TYPE_ENC 0x09 /** Encryption */
597 #define SLI4_SGE_TYPE_ATM 0x0a /** DIF Application Tag Mask */
598 #define SLI4_SGE_TYPE_SKIP 0x0c /** SKIP */
599 
600 /**
601  * @brief CONFIG_LINK
602  */
603 typedef struct sli4_cmd_config_link_s {
605 #if BYTE_ORDER == LITTLE_ENDIAN
606  uint32_t maxbbc:8, /** Max buffer-to-buffer credit */
607  :24;
608  uint32_t alpa:8,
609  n_port_id:16,
610  :8;
611  uint32_t rsvd3;
612  uint32_t e_d_tov;
613  uint32_t lp_tov;
614  uint32_t r_a_tov;
615  uint32_t r_t_tov;
616  uint32_t al_tov;
617  uint32_t rsvd9;
618  uint32_t :8,
619  bbscn:4, /** buffer-to-buffer state change number */
620  cscn:1, /** configure BBSCN */
621  :19;
622 #else
623 #error big endian version not defined
624 #endif
626 
627 /**
628  * @brief DUMP Type 4
629  */
630 #define SLI4_WKI_TAG_SAT_TEM 0x1040
631 typedef struct sli4_cmd_dump4_s {
633 #if BYTE_ORDER == LITTLE_ENDIAN
634  uint32_t type:4,
635  :28;
636  uint32_t wki_selection:16,
637  :16;
638  uint32_t resv;
640  uint32_t resp_data[59];
641 #else
642 #error big endian version not defined
643 #endif
645 
646 /**
647  * @brief FW_INITIALIZE - initialize a SLI port
648  *
649  * @note This command uses a different format than all others.
650  */
651 
652 extern const uint8_t sli4_fw_initialize[8];
653 
654 /**
655  * @brief FW_DEINITIALIZE - deinitialize a SLI port
656  *
657  * @note This command uses a different format than all others.
658  */
659 
660 extern const uint8_t sli4_fw_deinitialize[8];
661 
662 /**
663  * @brief INIT_LINK - initialize the link for a FC/FCoE port
664  */
665 typedef struct sli4_cmd_init_link_flags_s {
666  uint32_t loopback:1,
667  topology:2,
668  #define FC_TOPOLOGY_FCAL 0
669  #define FC_TOPOLOGY_P2P 1
670  :3,
671  unfair:1,
672  skip_lirp_lilp:1,
673  gen_loop_validity_check:1,
674  skip_lisa:1,
675  enable_topology_failover:1,
676  fixed_speed:1,
677  :3,
678  select_hightest_al_pa:1,
679  :16; // pad to 32 bits
681 
682 #define SLI4_INIT_LINK_F_LOOP_BACK BIT(0)
683 #define SLI4_INIT_LINK_F_UNFAIR BIT(6)
684 #define SLI4_INIT_LINK_F_NO_LIRP BIT(7)
685 #define SLI4_INIT_LINK_F_LOOP_VALID_CHK BIT(8)
686 #define SLI4_INIT_LINK_F_NO_LISA BIT(9)
687 #define SLI4_INIT_LINK_F_FAIL_OVER BIT(10)
688 #define SLI4_INIT_LINK_F_NO_AUTOSPEED BIT(11)
689 #define SLI4_INIT_LINK_F_PICK_HI_ALPA BIT(15)
690 
691 #define SLI4_INIT_LINK_F_P2P_ONLY 1
692 #define SLI4_INIT_LINK_F_FCAL_ONLY 2
693 
694 #define SLI4_INIT_LINK_F_FCAL_FAIL_OVER 0
695 #define SLI4_INIT_LINK_F_P2P_FAIL_OVER 1
696 
697 typedef struct sli4_cmd_init_link_s {
699 #if BYTE_ORDER == LITTLE_ENDIAN
700  uint32_t selective_reset_al_pa:8,
701  :24;
702  sli4_cmd_init_link_flags_t link_flags;
704  #define FC_LINK_SPEED_1G 1
705  #define FC_LINK_SPEED_2G 2
706  #define FC_LINK_SPEED_AUTO_1_2 3
707  #define FC_LINK_SPEED_4G 4
708  #define FC_LINK_SPEED_AUTO_4_1 5
709  #define FC_LINK_SPEED_AUTO_4_2 6
710  #define FC_LINK_SPEED_AUTO_4_2_1 7
711  #define FC_LINK_SPEED_8G 8
712  #define FC_LINK_SPEED_AUTO_8_1 9
713  #define FC_LINK_SPEED_AUTO_8_2 10
714  #define FC_LINK_SPEED_AUTO_8_2_1 11
715  #define FC_LINK_SPEED_AUTO_8_4 12
716  #define FC_LINK_SPEED_AUTO_8_4_1 13
717  #define FC_LINK_SPEED_AUTO_8_4_2 14
718  #define FC_LINK_SPEED_10G 16
719  #define FC_LINK_SPEED_16G 17
720  #define FC_LINK_SPEED_AUTO_16_8_4 18
721  #define FC_LINK_SPEED_AUTO_16_8 19
722  #define FC_LINK_SPEED_32G 20
723  #define FC_LINK_SPEED_AUTO_32_16_8 21
724  #define FC_LINK_SPEED_AUTO_32_16 22
725 #else
726 #error big endian version not defined
727 #endif
729 
730 /**
731  * @brief INIT_VFI - initialize the VFI resource
732  */
733 typedef struct sli4_cmd_init_vfi_s {
735 #if BYTE_ORDER == LITTLE_ENDIAN
736  uint32_t vfi:16,
737  :12,
738  vp:1,
739  vf:1,
740  vt:1,
741  vr:1;
742  uint32_t fcfi:16,
743  vpi:16;
744  uint32_t vf_id:13,
745  pri:3,
746  :16;
747  uint32_t :24,
748  hop_count:8;
749 #else
750 #error big endian version not defined
751 #endif
753 
754 /**
755  * @brief INIT_VPI - initialize the VPI resource
756  */
757 typedef struct sli4_cmd_init_vpi_s {
759 #if BYTE_ORDER == LITTLE_ENDIAN
760  uint32_t vpi:16,
761  vfi:16;
762 #else
763 #error big endian version not defined
764 #endif
766 
767 /**
768  * @brief POST_XRI - post XRI resources to the SLI Port
769  */
770 typedef struct sli4_cmd_post_xri_s {
772 #if BYTE_ORDER == LITTLE_ENDIAN
773  uint32_t xri_base:16,
774  xri_count:12,
775  enx:1,
776  dl:1,
777  di:1,
778  val:1;
779  uint32_t :30,
780  pool:1,
781  :1;
782 #else
783 #error big endian version not defined
784 #endif
786 
787 /**
788  * @brief RELEASE_XRI - Release XRI resources from the SLI Port
789  */
790 typedef struct sli4_cmd_release_xri_s {
792 #if BYTE_ORDER == LITTLE_ENDIAN
793  uint32_t released_xri_count:5,
794  :11,
795  xri_count:5,
796  :11;
797  struct {
798  uint32_t xri_tag0:16,
799  xri_tag1:16;
800  } xri_tbl[62];
801 #else
802 #error big endian version not defined
803 #endif
805 
806 /**
807  * @brief READ_CONFIG - read SLI port configuration parameters
808  */
809 typedef struct sli4_cmd_read_config_s {
812 
813 typedef struct sli4_res_read_config_s {
815 #if BYTE_ORDER == LITTLE_ENDIAN
816  uint32_t :31,
817  ext:1; /** Resource Extents */
818  uint32_t :24,
819  topology:8;
820  uint32_t rsvd3;
821  uint32_t e_d_tov:16,
822  :16;
823  uint32_t rsvd5;
824  uint32_t r_a_tov:16,
825  :16;
826  uint32_t rsvd7;
827  uint32_t bbscn_min:4,
828  bbscn_max:4,
829  bbscn_def:4,
830  :20;
831  uint32_t lmt:16, /** Link Module Type */
832  :16;
833  uint32_t rsvd10;
834  uint32_t rsvd11;
835  uint32_t xri_base:16,
836  xri_count:16;
837  uint32_t rpi_base:16,
838  rpi_count:16;
839  uint32_t vpi_base:16,
840  vpi_count:16;
841  uint32_t vfi_base:16,
842  vfi_count:16;
843  uint32_t :16,
844  fcfi_count:16;
845  uint32_t rq_count:16,
846  eq_count:16;
847  uint32_t wq_count:16,
848  cq_count:16;
849  uint32_t pad[45];
850 #else
851 #error big endian version not defined
852 #endif
854 
855 #define SLI4_READ_CFG_TOPO_FCOE 0x0 /** FCoE topology */
856 #define SLI4_READ_CFG_TOPO_FC 0x1 /** FC topology unknown */
857 #define SLI4_READ_CFG_TOPO_FC_DA 0x2 /** FC Direct Attach (non FC-AL) topology */
858 #define SLI4_READ_CFG_TOPO_FC_AL 0x3 /** FC-AL topology */
859 
860 /**
861  * @brief READ_NVPARMS - read SLI port configuration parameters
862  */
863 typedef struct sli4_cmd_read_nvparms_s {
865 #if BYTE_ORDER == LITTLE_ENDIAN
866  uint32_t rsvd1;
867  uint32_t rsvd2;
868  uint32_t rsvd3;
869  uint32_t rsvd4;
870  uint8_t wwpn[8];
871  uint8_t wwnn[8];
872  uint32_t hard_alpa:8,
873  preferred_d_id:24;
874 #else
875 #error big endian version not defined
876 #endif
878 
879 /**
880  * @brief WRITE_NVPARMS - write SLI port configuration parameters
881  */
882 typedef struct sli4_cmd_write_nvparms_s {
884 #if BYTE_ORDER == LITTLE_ENDIAN
885  uint32_t rsvd1;
886  uint32_t rsvd2;
887  uint32_t rsvd3;
888  uint32_t rsvd4;
889  uint8_t wwpn[8];
890  uint8_t wwnn[8];
891  uint32_t hard_alpa:8,
892  preferred_d_id:24;
893 #else
894 #error big endian version not defined
895 #endif
897 
898 /**
899  * @brief READ_REV - read the Port revision levels
900  */
901 typedef struct sli4_cmd_read_rev_s {
903 #if BYTE_ORDER == LITTLE_ENDIAN
904  uint32_t :16,
905  sli_level:4,
906  fcoem:1,
907  ceev:2,
908  :6,
909  vpd:1,
910  :2;
911  uint32_t first_hw_revision;
913  uint32_t rsvd4;
915  uint32_t fc_ph_low:8,
916  fc_ph_high:8,
917  feature_level_low:8,
918  feature_level_high:8;
919  uint32_t rsvd7;
920  uint32_t first_fw_id;
921  char first_fw_name[16];
922  uint32_t second_fw_id;
923  char second_fw_name[16];
924  uint32_t rsvd18[30];
925  uint32_t available_length:24,
926  :8;
927  uint32_t physical_address_low;
931 #else
932 #error big endian version not defined
933 #endif
935 
936 /**
937  * @brief READ_SPARM64 - read the Port service parameters
938  */
939 typedef struct sli4_cmd_read_sparm64_s {
941 #if BYTE_ORDER == LITTLE_ENDIAN
942  uint32_t rsvd1;
943  uint32_t rsvd2;
945  uint32_t vpi:16,
946  :16;
947  uint32_t port_name_start:16,
948  port_name_length:16;
949  uint32_t node_name_start:16,
950  node_name_length:16;
951 #else
952 #error big endian version not defined
953 #endif
955 
956 #define SLI4_READ_SPARM64_VPI_DEFAULT 0
957 #define SLI4_READ_SPARM64_VPI_SPECIAL UINT16_MAX
958 
959 #define SLI4_READ_SPARM64_WWPN_OFFSET (4 * sizeof(uint32_t))
960 #define SLI4_READ_SPARM64_WWNN_OFFSET (SLI4_READ_SPARM64_WWPN_OFFSET + sizeof(uint64_t))
961 
962 typedef struct sli4_port_state_s {
963 #if BYTE_ORDER == LITTLE_ENDIAN
964  uint32_t nx_port_recv_state:2,
965  nx_port_trans_state:2,
966  nx_port_state_machine:4,
967  link_speed:8,
968  :14,
969  tf:1,
970  lu:1;
971 #else
972 #error big endian version not defined
973 #endif
975 
976 /**
977  * @brief READ_TOPOLOGY - read the link event information
978  */
979 typedef struct sli4_cmd_read_topology_s {
981 #if BYTE_ORDER == LITTLE_ENDIAN
982  uint32_t event_tag;
983  uint32_t attention_type:8,
984  il:1,
985  pb_recvd:1,
986  fec:1,
987  :2,
988  fecen:1,
989  :18;
990  uint32_t topology:8,
991  lip_type:8,
992  lip_al_ps:8,
993  al_pa_granted:8;
997  uint32_t max_bbc:8,
998  init_bbc:8,
999  bbscn:4,
1000  cbbscn:4,
1001  :8;
1002  uint32_t r_t_tov:9,
1003  :3,
1004  al_tov:4,
1005  lp_tov:16;
1006  uint32_t acquired_al_pa:8,
1007  :7,
1008  pb:1,
1009  specified_al_pa:16;
1010  uint32_t initial_n_port_id:24,
1011  :8;
1012  uint32_t trunk_config:8,
1013  :24;
1014 #else
1015 #error big endian version not defined
1016 #endif
1018 
1019 #define SLI4_MIN_LOOP_MAP_BYTES 128
1020 
1021 #define SLI4_READ_TOPOLOGY_LINK_UP 0x1
1022 #define SLI4_READ_TOPOLOGY_LINK_DOWN 0x2
1023 #define SLI4_READ_TOPOLOGY_LINK_NO_ALPA 0x3
1024 
1025 #define SLI4_READ_TOPOLOGY_UNKNOWN 0x0
1026 #define SLI4_READ_TOPOLOGY_NPORT 0x1
1027 #define SLI4_READ_TOPOLOGY_FC_AL 0x2
1028 
1029 #define SLI4_READ_TOPOLOGY_SPEED_NONE 0x00
1030 #define SLI4_READ_TOPOLOGY_SPEED_1G 0x04
1031 #define SLI4_READ_TOPOLOGY_SPEED_2G 0x08
1032 #define SLI4_READ_TOPOLOGY_SPEED_4G 0x10
1033 #define SLI4_READ_TOPOLOGY_SPEED_8G 0x20
1034 #define SLI4_READ_TOPOLOGY_SPEED_10G 0x40
1035 #define SLI4_READ_TOPOLOGY_SPEED_16G 0x80
1036 #define SLI4_READ_TOPOLOGY_SPEED_32G 0x90
1037 
1038 /**
1039  * @brief REG_FCFI - activate a FC Forwarder
1040  */
1041 #define SLI4_CMD_REG_FCFI_NUM_RQ_CFG 4
1042 typedef struct sli4_cmd_reg_fcfi_s {
1044 #if BYTE_ORDER == LITTLE_ENDIAN
1045  uint32_t fcf_index:16,
1046  fcfi:16;
1047  uint32_t rq_id_1:16,
1048  rq_id_0:16;
1049  uint32_t rq_id_3:16,
1050  rq_id_2:16;
1051  struct {
1052  uint32_t r_ctl_mask:8,
1053  r_ctl_match:8,
1054  type_mask:8,
1055  type_match:8;
1056  } rq_cfg[SLI4_CMD_REG_FCFI_NUM_RQ_CFG];
1057  uint32_t vlan_tag:12,
1058  vv:1,
1059  :19;
1060 #else
1061 #error big endian version not defined
1062 #endif
1064 
1065 #define SLI4_CMD_REG_FCFI_SET_FCFI_MODE 0
1066 #define SLI4_CMD_REG_FCFI_SET_MRQ_MODE 1
1067 
1068 typedef struct sli4_cmd_reg_fcfi_mrq_s {
1070 #if BYTE_ORDER == LITTLE_ENDIAN
1071  uint32_t fcf_index:16,
1072  fcfi:16;
1073 
1074  uint32_t rq_id_1:16,
1075  rq_id_0:16;
1076 
1077  uint32_t rq_id_3:16,
1078  rq_id_2:16;
1079 
1080  struct {
1081  uint32_t r_ctl_mask:8,
1082  r_ctl_match:8,
1083  type_mask:8,
1084  type_match:8;
1085  } rq_cfg_1[4];
1086 
1087  uint32_t vlan_tag:12,
1088  vv:1,
1089  mode:1,
1090  rsvd:1,
1091  xmv:1,
1092  pt:8,
1093  ptc:8;
1094 
1095  uint32_t num_mrq_pairs_1:8,
1096  mrq_filter_bitmask_1:4,
1097  rq_selection_policy_1:4,
1098  alt_mrq_filter_bit_mask_1:8,
1099  :8;
1100 
1101  uint32_t num_mrq_pairs_2:8,
1102  mrq_filter_bitmask_2:4,
1103  rq_selection_policy_2:4,
1104  alt_mrq_filter_bit_mask_2:8,
1105  :8;
1106 
1107  uint32_t rq_id_5:16,
1108  rq_id_4:16;
1109 
1110  uint32_t rq_id_7:16,
1111  rq_id_6:16;
1112 
1113  struct {
1114  uint32_t r_ctl_mask:8,
1115  r_ctl_match:8,
1116  type_mask:8,
1117  type_match:8;
1118  } rq_cfg_2[4];
1119 #endif
1121 
1122 /**
1123  * @brief REG_RPI - register a Remote Port Indicator
1124  */
1125 typedef struct sli4_cmd_reg_rpi_s {
1127 #if BYTE_ORDER == LITTLE_ENDIAN
1128  uint32_t rpi:16,
1129  :16;
1130  uint32_t remote_n_port_id:24,
1131  upd:1,
1132  :2,
1133  etow:1,
1134  :1,
1135  terp:1,
1136  hlm:1,
1137  ci:1;
1139  uint32_t vpi:16,
1140  :16;
1141 #else
1142 #error big endian version not defined
1143 #endif
1145 #define SLI4_REG_RPI_BUF_LEN 0x70
1146 
1147 
1148 /**
1149  * @brief REG_VFI - register a Virtual Fabric Indicator
1150  */
1151 typedef struct sli4_cmd_reg_vfi_s {
1153 #if BYTE_ORDER == LITTLE_ENDIAN
1154  uint32_t vfi:16,
1155  :12,
1156  vp:1,
1157  upd:1,
1158  :2;
1159  uint32_t fcfi:16,
1160  vpi:16; // vp=TRUE
1161  uint8_t wwpn[8]; // vp=TRUE
1162  sli4_bde_t sparm; // either FLOGI or PLOGI
1163  uint32_t e_d_tov;
1164  uint32_t r_a_tov;
1165  uint32_t local_n_port_id:24, // vp=TRUE
1166  :3,
1167  bbcr:1,
1168  bbscn:4;
1169 #else
1170 #error big endian version not defined
1171 #endif
1173 
1174 /**
1175  * @brief REG_VPI - register a Virtual Port Indicator
1176  */
1177 typedef struct sli4_cmd_reg_vpi_s {
1179 #if BYTE_ORDER == LITTLE_ENDIAN
1180  uint32_t rsvd1;
1181  uint32_t local_n_port_id:24,
1182  upd:1,
1183  :7;
1184  uint8_t wwpn[8];
1185  uint32_t rsvd5;
1186  uint32_t vpi:16,
1187  vfi:16;
1188 #else
1189 #error big endian version not defined
1190 #endif
1192 
1193 /**
1194  * @brief REQUEST_FEATURES - request / query SLI features
1195  */
1196 typedef union {
1197 #if BYTE_ORDER == LITTLE_ENDIAN
1198  struct {
1199  uint32_t iaab:1, /** inhibit auto-ABTS originator */
1200  npiv:1, /** NPIV support */
1201  dif:1, /** DIF/DIX support */
1202  vf:1, /** virtual fabric support */
1203  fcpi:1, /** FCP initiator support */
1204  fcpt:1, /** FCP target support */
1205  fcpc:1, /** combined FCP initiator/target */
1206  :1,
1207  rqd:1, /** recovery qualified delay */
1208  iaar:1, /** inhibit auto-ABTS responder */
1209  hlm:1, /** High Login Mode */
1210  perfh:1, /** performance hints */
1211  rxseq:1, /** RX Sequence Coalescing */
1212  rxri:1, /** Release XRI variant of Coalescing */
1213  dcl2:1, /** Disable Class 2 */
1214  rsco:1, /** Receive Sequence Coalescing Optimizations */
1215  mrqp:1, /** Multi RQ Pair Mode Support */
1216  ashdr:1, /** Application HDR Support */
1217  :14;
1218  } flag;
1219  uint32_t dword;
1220 #else
1221 #error big endian version not defined
1222 #endif
1223 } sli4_features_t;
1224 
1225 typedef struct sli4_cmd_request_features_s {
1227 #if BYTE_ORDER == LITTLE_ENDIAN
1228  uint32_t qry:1,
1229  :31;
1230 #else
1231 #error big endian version not defined
1232 #endif
1233  sli4_features_t command;
1236 
1237 /**
1238  * @brief SLI_CONFIG - submit a configuration command to Port
1239  *
1240  * Command is either embedded as part of the payload (embed) or located
1241  * in a separate memory buffer (mem)
1242  */
1243 
1244 #define SLI4_GET_SLI_CONFIG_OFFSET(buf, offset) ((uint8_t *)buf + offset)
1245 
1246 typedef struct sli4_sli_config_pmd_s {
1247  uint32_t address_low;
1248  uint32_t address_high;
1249  uint32_t length:24,
1250  :8;
1252 
1253 typedef struct sli4_cmd_sli_config_s {
1255 #if BYTE_ORDER == LITTLE_ENDIAN
1256  uint32_t emb:1,
1257  :2,
1258  pmd_count:5,
1259  :24;
1260  uint32_t payload_length;
1261  uint32_t rsvd3;
1262  uint32_t rsvd4;
1263  uint32_t rsvd5;
1264  union {
1265  uint8_t embed[58 * sizeof(uint32_t)];
1267  } payload;
1268 #else
1269 #error big endian version not defined
1270 #endif
1272 
1273 /**
1274  * @brief READ_STATUS - read tx/rx status of a particular port
1275  *
1276  */
1277 
1278 typedef struct sli4_cmd_read_status_s {
1280 #if BYTE_ORDER == LITTLE_ENDIAN
1281  uint32_t cc:1,
1282  :31;
1283  uint32_t rsvd2;
1298 
1299 #else
1300 #error big endian version not defined
1301 #endif
1303 
1304 /**
1305  * @brief READ_LNK_STAT - read link status of a particular port
1306  *
1307  */
1308 
1309 typedef struct sli4_cmd_read_link_stats_s {
1311 #if BYTE_ORDER == LITTLE_ENDIAN
1312  uint32_t rec:1,
1313  gec:1,
1314  w02of:1,
1315  w03of:1,
1316  w04of:1,
1317  w05of:1,
1318  w06of:1,
1319  w07of:1,
1320  w08of:1,
1321  w09of:1,
1322  w10of:1,
1323  w11of:1,
1324  w12of:1,
1325  w13of:1,
1326  w14of:1,
1327  w15of:1,
1328  w16of:1,
1329  w17of:1,
1330  w18of:1,
1331  w19of:1,
1332  w20of:1,
1333  w21of:1,
1334  resv0:8,
1335  clrc:1,
1336  clof:1;
1361 
1362 #else
1363 #error big endian version not defined
1364 #endif
1366 
1367 /**
1368  * @brief Format a WQE with WQ_ID Association performance hint
1369  *
1370  * @par Description
1371  * PHWQ works by over-writting part of Word 10 in the WQE with the WQ ID.
1372  *
1373  * @param entry Pointer to the WQE.
1374  * @param q_id Queue ID.
1375  *
1376  * @return None.
1377  */
1378 static inline void
1379 sli_set_wq_id_association(void *entry, uint16_t q_id)
1380 {
1381  uint32_t *wqe = entry;
1382 
1383  /*
1384  * Set Word 10, bit 0 to zero
1385  * Set Word 10, bits 15:1 to the WQ ID
1386  */
1387 #if BYTE_ORDER == LITTLE_ENDIAN
1388  wqe[10] &= ~0xffff;
1389  wqe[10] |= q_id << 1;
1390 #else
1391 #error big endian version not defined
1392 #endif
1393 }
1394 
1395 /**
1396  * @brief UNREG_FCFI - unregister a FCFI
1397  */
1398 typedef struct sli4_cmd_unreg_fcfi_s {
1400  uint32_t rsvd1;
1401 #if BYTE_ORDER == LITTLE_ENDIAN
1402  uint32_t fcfi:16,
1403  :16;
1404 #else
1405 #error big endian version not defined
1406 #endif
1408 
1409 /**
1410  * @brief UNREG_RPI - unregister one or more RPI
1411  */
1412 typedef struct sli4_cmd_unreg_rpi_s {
1414 #if BYTE_ORDER == LITTLE_ENDIAN
1415  uint32_t index:16,
1416  :13,
1417  dp:1,
1418  ii:2;
1419  uint32_t destination_n_port_id:24,
1420  :8;
1421 #else
1422 #error big endian version not defined
1423 #endif
1425 
1426 #define SLI4_UNREG_RPI_II_RPI 0x0
1427 #define SLI4_UNREG_RPI_II_VPI 0x1
1428 #define SLI4_UNREG_RPI_II_VFI 0x2
1429 #define SLI4_UNREG_RPI_II_FCFI 0x3
1430 
1431 /**
1432  * @brief UNREG_VFI - unregister one or more VFI
1433  */
1434 typedef struct sli4_cmd_unreg_vfi_s {
1436 #if BYTE_ORDER == LITTLE_ENDIAN
1437  uint32_t rsvd1;
1438  uint32_t index:16,
1439  :14,
1440  ii:2;
1441 #else
1442 #error big endian version not defined
1443 #endif
1445 
1446 #define SLI4_UNREG_VFI_II_VFI 0x0
1447 #define SLI4_UNREG_VFI_II_FCFI 0x3
1448 
1449 enum {
1454 };
1455 
1456 /**
1457  * @brief UNREG_VPI - unregister one or more VPI
1458  */
1459 typedef struct sli4_cmd_unreg_vpi_s {
1461 #if BYTE_ORDER == LITTLE_ENDIAN
1462  uint32_t rsvd1;
1463  uint32_t index:16,
1464  :14,
1465  ii:2;
1466 #else
1467 #error big endian version not defined
1468 #endif
1470 
1471 #define SLI4_UNREG_VPI_II_VPI 0x0
1472 #define SLI4_UNREG_VPI_II_VFI 0x2
1473 #define SLI4_UNREG_VPI_II_FCFI 0x3
1474 
1475 
1476 /**
1477  * @brief AUTO_XFER_RDY - Configure the auto-generate XFER-RDY feature.
1478  */
1479 typedef struct sli4_cmd_config_auto_xfer_rdy_s {
1481 #if BYTE_ORDER == LITTLE_ENDIAN
1482  uint32_t resv;
1483  uint32_t max_burst_len;
1484 #else
1485 #error big endian version not defined
1486 #endif
1488 
1489 typedef struct sli4_cmd_config_auto_xfer_rdy_hp_s {
1491 #if BYTE_ORDER == LITTLE_ENDIAN
1492  uint32_t resv;
1493  uint32_t max_burst_len;
1494  uint32_t esoc:1,
1495  :31;
1496  uint32_t block_size:16,
1497  :16;
1498 #else
1499 #error big endian version not defined
1500 #endif
1502 
1503 /**
1504  * @brief AUTO_XFER_RDY - Configure the Target Optimized Write Feature
1505  */
1506 typedef struct sli4_cmd_config_tow_s {
1508 #if BYTE_ORDER == LITTLE_ENDIAN
1509 uint32_t ooo:1,
1510  axs:1,
1511  fbs:1,
1512  :3,
1513  xpns:1,
1514  :2,
1515  axn:1,
1516  fbn:1,
1517  :3,
1518  xpnn:1,
1519  :17;
1520 uint32_t scsi_max_data_len;
1521 uint32_t :31,
1522  version:1;
1523 uint32_t rsvd4;
1525 uint32_t pool0_xri_cnt:16,
1526  pool1_xri_cnt:16;
1527 #else
1528 #error big endian version not defined
1529 #endif
1531 
1532 typedef struct sli4_cmd_config_tow_hp_s {
1534 #if BYTE_ORDER == LITTLE_ENDIAN
1535 uint32_t ooo:1,
1536  axs:1,
1537  fbs:1,
1538  :3,
1539  xpns:1,
1540  :2,
1541  axn:1,
1542  fbn:1,
1543  :3,
1544  xpnn:1,
1545  :17;
1546 uint32_t scsi_max_data_len;
1547 uint32_t esoc:1,
1548  :7,
1549  esocn:1,
1550  :23;
1551 uint32_t scsi_block_size:16,
1552  nvme_block_size:16;
1554 uint32_t pool0_xri_cnt:16,
1555  pool1_xri_cnt:16;
1556 #else
1557 #error big endian version not defined
1558 #endif
1560 
1561 /**
1562  * @brief RUN_BIU_DIAG
1563  */
1564 typedef struct sli4_cmd_config_run_biu_diag_s {
1566 #if BYTE_ORDER == LITTLE_ENDIAN
1567  uint32_t rsvd1;
1568  uint32_t tx_buf_len:24,
1569  tx_buf_flags:8;
1572  uint32_t rx_buf_len:24,
1573  rx_buf_flags:8;
1576 #else
1577 #error big endian version not defined
1578 #endif
1580 /*************************************************************************
1581  * SLI-4 common configuration command formats and definitions
1582  */
1583 
1584 #define SLI4_CFG_STATUS_SUCCESS 0x00
1585 #define SLI4_CFG_STATUS_FAILED 0x01
1586 #define SLI4_CFG_STATUS_ILLEGAL_REQUEST 0x02
1587 #define SLI4_CFG_STATUS_ILLEGAL_FIELD 0x03
1588 
1589 #define SLI4_MGMT_STATUS_FLASHROM_READ_FAILED 0xcb
1590 #define SLI4_MGMT_STATUS_FEATURE_NOT_SUPPORTED 0x44
1591 
1592 #define SLI4_CFG_ADD_STATUS_NO_STATUS 0x00
1593 #define SLI4_CFG_ADD_STATUS_INVALID_OPCODE 0x1e
1594 
1595 /**
1596  * Subsystem values.
1597  */
1598 #define SLI4_SUBSYSTEM_COMMON 0x01
1599 #define SLI4_SUBSYSTEM_LOWLEVEL 0x0B
1600 #define SLI4_SUBSYSTEM_FCFCOE 0x0c
1601 #define SLI4_SUBSYSTEM_DMTF 0x11
1602 
1603 #define SLI4_OPC_LOWLEVEL_SET_WATCHDOG 0X36
1604 #define SLI4_OPC_LOWLEVEL_SET_DIAG_LOG_OPTIONS 0X37
1605 #define SLI4_OPC_LOWLEVEL_GET_ITCM_PARITY_STATS 0x38
1606 
1607 /**
1608  * Common opcode (OPC) values.
1609  */
1610 #define SLI4_OPC_COMMON_FUNCTION_RESET 0x3d
1611 #define SLI4_OPC_COMMON_CREATE_CQ 0x0c
1612 #define SLI4_OPC_COMMON_CREATE_CQ_SET 0x1d
1613 #define SLI4_OPC_COMMON_DESTROY_CQ 0x36
1614 #define SLI4_OPC_COMMON_MODIFY_EQ_DELAY 0x29
1615 #define SLI4_OPC_COMMON_CREATE_EQ 0x0d
1616 #define SLI4_OPC_COMMON_DESTROY_EQ 0x37
1617 #define SLI4_OPC_COMMON_CREATE_MQ_EXT 0x5a
1618 #define SLI4_OPC_COMMON_DESTROY_MQ 0x35
1619 #define SLI4_OPC_COMMON_GET_CNTL_ATTRIBUTES 0x20
1620 #define SLI4_OPC_COMMON_NOP 0x21
1621 #define SLI4_OPC_COMMON_GET_RESOURCE_EXTENT_INFO 0x9a
1622 #define SLI4_OPC_COMMON_GET_SLI4_PARAMETERS 0xb5
1623 #define SLI4_OPC_COMMON_QUERY_FW_CONFIG 0x3a
1624 #define SLI4_OPC_COMMON_GET_PORT_NAME 0x4d
1625 
1626 #define SLI4_OPC_COMMON_WRITE_FLASHROM 0x07
1627 #define SLI4_OPC_COMMON_MANAGE_FAT 0x44
1628 #define SLI4_OPC_COMMON_READ_TRANSCEIVER_DATA 0x49
1629 #define SLI4_OPC_COMMON_GET_CNTL_ADDL_ATTRIBUTES 0x79
1630 #define SLI4_OPC_COMMON_GET_EXT_FAT_CAPABILITIES 0x7d
1631 #define SLI4_OPC_COMMON_SET_EXT_FAT_CAPABILITIES 0x7e
1632 #define SLI4_OPC_COMMON_EXT_FAT_CONFIGURE_SNAPSHOT 0x7f
1633 #define SLI4_OPC_COMMON_EXT_FAT_RETRIEVE_SNAPSHOT 0x80
1634 #define SLI4_OPC_COMMON_EXT_FAT_READ_STRING_TABLE 0x82
1635 #define SLI4_OPC_COMMON_RUN_BIU_DIAG 0x84
1636 #define SLI4_OPC_COMMON_GET_FUNCTION_CONFIG 0xa0
1637 #define SLI4_OPC_COMMON_GET_PROFILE_CONFIG 0xa4
1638 #define SLI4_OPC_COMMON_SET_PROFILE_CONFIG 0xa5
1639 #define SLI4_OPC_COMMON_GET_PROFILE_LIST 0xa6
1640 #define SLI4_OPC_COMMON_GET_ACTIVE_PROFILE 0xa7
1641 #define SLI4_OPC_COMMON_SET_ACTIVE_PROFILE 0xa8
1642 #define SLI4_OPC_COMMON_READ_OBJECT 0xab
1643 #define SLI4_OPC_COMMON_WRITE_OBJECT 0xac
1644 #define SLI4_OPC_COMMON_DELETE_OBJECT 0xae
1645 #define SLI4_OPC_COMMON_READ_OBJECT_LIST 0xad
1646 #define SLI4_OPC_COMMON_SET_DUMP_LOCATION 0xb8
1647 #define SLI4_OPC_COMMON_SET_FEATURES 0xbf
1648 #define SLI4_OPC_COMMON_GET_RECONFIG_LINK_INFO 0xc9
1649 #define SLI4_OPC_COMMON_SET_RECONFIG_LINK_ID 0xca
1650 
1651 #define SLI4_OPC_FCOE_SET_LINK_DIAG_STATE 0x22
1652 #define SLI4_OPC_FCOE_SET_LINK_DIAG_LOOPBACK 0x23
1653 #define SLI4_OPC_FCOE_SET_DPORT_MODE 0x27
1654 #define SLI4_OPC_FCOE_GET_DPORT_RESULTS 0x28
1655 #define SLI4_OPC_FC_SET_TRUNK_MODE 0x42
1656 
1657 
1658 /**
1659  * DMTF opcode (OPC) values.
1660  */
1661 #define SLI4_OPC_DMTF_EXEC_CLP_CMD 0x01
1662 
1663 /**
1664  * @brief Generic Command Request header
1665  */
1666 typedef struct sli4_req_hdr_s {
1667 #if BYTE_ORDER == LITTLE_ENDIAN
1668  uint32_t opcode:8,
1669  subsystem:8,
1670  :16;
1671  uint32_t timeout;
1672  uint32_t request_length;
1673  uint32_t version:8,
1674  :24;
1675 #else
1676 #error big endian version not defined
1677 #endif
1678 } sli4_req_hdr_t;
1679 
1680 /**
1681  * @brief Generic Command Response header
1682  */
1683 typedef struct sli4_res_hdr_s {
1684 #if BYTE_ORDER == LITTLE_ENDIAN
1685  uint32_t opcode:8,
1686  subsystem:8,
1687  :16;
1688  uint32_t status:8,
1689  additional_status:8,
1690  :16;
1691  uint32_t response_length;
1693 #else
1694 #error big endian version not defined
1695 #endif
1696 } sli4_res_hdr_t;
1697 
1698 /**
1699  * @brief COMMON_FUNCTION_RESET
1700  *
1701  * Resets the Port, returning it to a power-on state. This configuration
1702  * command does not have a payload and should set/expect the lengths to
1703  * be zero.
1704  */
1705 typedef struct sli4_req_common_function_reset_s {
1708 
1709 
1710 typedef struct sli4_res_common_function_reset_s {
1713 
1714 /**
1715  * @brief COMMON_CREATE_CQ_V0
1716  *
1717  * Create a Completion Queue.
1718  */
1719 typedef struct sli4_req_common_create_cq_v0_s {
1721 #if BYTE_ORDER == LITTLE_ENDIAN
1722  uint32_t num_pages:16,
1723  :16;
1724  uint32_t :12,
1725  clswm:2,
1726  nodelay:1,
1727  :12,
1728  cqecnt:2,
1729  valid:1,
1730  :1,
1731  evt:1;
1732  uint32_t :22,
1733  eq_id:8,
1734  :1,
1735  arm:1;
1736  uint32_t rsvd[2];
1737  struct {
1738  uint32_t low;
1739  uint32_t high;
1740  } page_physical_address[0];
1741 #else
1742 #error big endian version not defined
1743 #endif
1745 
1746 /**
1747  * @brief COMMON_CREATE_CQ_V2
1748  *
1749  * Create a Completion Queue.
1750  */
1751 typedef struct sli4_req_common_create_cq_v2_s {
1753 #if BYTE_ORDER == LITTLE_ENDIAN
1754  uint32_t num_pages:16,
1755  page_size:8,
1756  :8,
1757  uint32_t :12,
1758  clswm:2,
1759  nodelay:1,
1760  autovalid:1,
1761  :11,
1762  cqecnt:2,
1763  valid:1,
1764  :1,
1765  evt:1;
1766  uint32_t eq_id:16,
1767  :15,
1768  arm:1;
1769  uint32_t cqe_count:16,
1770  :16;
1771  uint32_t rsvd[1];
1772  struct {
1773  uint32_t low;
1774  uint32_t high;
1775  } page_physical_address[0];
1776 #else
1777 #error big endian version not defined
1778 #endif
1780 
1781 
1782 
1783 /**
1784  * @brief COMMON_CREATE_CQ_SET_V0
1785  *
1786  * Create a set of Completion Queues.
1787  */
1788 typedef struct sli4_req_common_create_cq_set_v0_s {
1790 #if BYTE_ORDER == LITTLE_ENDIAN
1791  uint32_t num_pages:16,
1792  page_size:8,
1793  :8;
1794  uint32_t :12,
1795  clswm:2,
1796  nodelay:1,
1797  autovalid:1,
1798  rsvd:11,
1799  cqecnt:2,
1800  valid:1,
1801  :1,
1802  evt:1;
1803  uint32_t num_cq_req:16,
1804  cqe_count:15,
1805  arm:1;
1806  uint16_t eq_id[16];
1807  struct {
1808  uint32_t low;
1809  uint32_t high;
1810  } page_physical_address[0];
1811 #else
1812 #error big endian version not defined
1813 #endif
1815 
1816 /**
1817  * CQE count.
1818  */
1819 #define SLI4_CQ_CNT_256 0
1820 #define SLI4_CQ_CNT_512 1
1821 #define SLI4_CQ_CNT_1024 2
1822 #define SLI4_CQ_CNT_LARGE 3
1823 
1824 #define SLI4_CQE_BYTES (4 * sizeof(uint32_t))
1825 
1826 #define SLI4_COMMON_CREATE_CQ_V2_MAX_PAGES 8
1827 
1828 /**
1829  * @brief Generic Common Create EQ/CQ/MQ/WQ/RQ Queue completion
1830  */
1831 typedef struct sli4_res_common_create_queue_s {
1833 #if BYTE_ORDER == LITTLE_ENDIAN
1834  uint32_t q_id:16,
1835  :8,
1836  ulp:8;
1837  uint32_t db_offset;
1838  uint32_t db_rs:16,
1839  db_fmt:16;
1840 #else
1841 #error big endian version not defined
1842 #endif
1844 
1845 typedef struct sli4_res_create_dpp_wq_s {
1847 #if BYTE_ORDER == LITTLE_ENDIAN
1848  uint32_t q_id:16,
1849  :15,
1850  dpp:1;
1851  uint32_t wq_reg_set:4,
1852  :28;
1853  uint32_t wq_db_offset;
1854  uint32_t dpp_reg_set:4,
1855  :12,
1856  dpp_id:5,
1857  :11;
1858  uint32_t dpp_offset;
1859 #else
1860 #error big endian version not defined
1861 #endif
1863 
1864 
1865 typedef struct sli4_res_common_create_queue_set_s {
1867 #if BYTE_ORDER == LITTLE_ENDIAN
1868  uint32_t q_id:16,
1869  num_q_allocated:16;
1870 #else
1871 #error big endian version not defined
1872 #endif
1874 
1875 
1876 /**
1877  * @brief Common Destroy CQ
1878  */
1879 typedef struct sli4_req_common_destroy_cq_s {
1881 #if BYTE_ORDER == LITTLE_ENDIAN
1882  uint32_t cq_id:16,
1883  :16;
1884 #else
1885 #error big endian version not defined
1886 #endif
1888 
1889 /**
1890  * @brief COMMON_MODIFY_EQ_DELAY
1891  *
1892  * Modify the delay multiplier for EQs
1893  */
1894 typedef struct sli4_req_common_modify_eq_delay_s {
1896 #if BYTE_ORDER == LITTLE_ENDIAN
1897  uint32_t num_eq;
1898  struct {
1899  uint32_t eq_id;
1900  uint32_t phase;
1902  } eq_delay_record[8];
1903 #else
1904 #error big endian version not defined
1905 #endif
1907 
1908 /**
1909  * @brief COMMON_CREATE_EQ
1910  *
1911  * Create an Event Queue.
1912  */
1913 typedef struct sli4_req_common_create_eq_s {
1915 #if BYTE_ORDER == LITTLE_ENDIAN
1916  uint32_t num_pages:16,
1917  :16;
1918  uint32_t :28,
1919  autovalid:1,
1920  valid:1,
1921  :1,
1922  eqesz:1;
1923  uint32_t :26,
1924  count:3,
1925  :2,
1926  arm:1;
1927  uint32_t :13,
1928  delay_multiplier:10,
1929  :9;
1930  uint32_t rsvd;
1931  struct {
1932  uint32_t low;
1933  uint32_t high;
1934  } page_address[8];
1935 #else
1936 #error big endian version not defined
1937 #endif
1939 
1940 #define SLI4_EQ_CNT_256 0
1941 #define SLI4_EQ_CNT_512 1
1942 #define SLI4_EQ_CNT_1024 2
1943 #define SLI4_EQ_CNT_2048 3
1944 #define SLI4_EQ_CNT_4096 4
1945 
1946 #define SLI4_EQE_SIZE_4 0
1947 #define SLI4_EQE_SIZE_16 1
1948 
1949 #define SLI4_EQE_BYTES (sizeof(uint32_t))
1950 
1951 /**
1952  * @brief Common Destroy EQ
1953  */
1954 typedef struct sli4_req_common_destroy_eq_s {
1956 #if BYTE_ORDER == LITTLE_ENDIAN
1957  uint32_t eq_id:16,
1958  :16;
1959 #else
1960 #error big endian version not defined
1961 #endif
1963 
1964 /**
1965  * @brief COMMON_CREATE_MQ_EXT
1966  *
1967  * Create a Mailbox Queue; accomodate v0 and v1 forms.
1968  */
1969 typedef struct sli4_req_common_create_mq_ext_s {
1971 #if BYTE_ORDER == LITTLE_ENDIAN
1972  uint32_t num_pages:16,
1973  cq_id_v1:16;
1975  uint32_t async_cq_id_v1:16,
1976  ring_size:4,
1977  :2,
1978  cq_id_v0:10;
1979  uint32_t :31,
1980  val:1;
1981  uint32_t acqv:1,
1982  async_cq_id_v0:10,
1983  :21;
1984  uint32_t rsvd9;
1985  struct {
1986  uint32_t low;
1987  uint32_t high;
1988  } page_physical_address[8];
1989 #else
1990 #error big endian version not defined
1991 #endif
1993 
1994 #define SLI4_MQE_SIZE_16 0x05
1995 #define SLI4_MQE_SIZE_32 0x06
1996 #define SLI4_MQE_SIZE_64 0x07
1997 #define SLI4_MQE_SIZE_128 0x08
1998 
1999 #define SLI4_MQE_BYTES 256
2000 
2001 #define SLI4_ASYNC_EVT_LINK_STATE BIT(1)
2002 #define SLI4_ASYNC_EVT_FCOE_FIP BIT(2)
2003 #define SLI4_ASYNC_EVT_DCBX BIT(3)
2004 #define SLI4_ASYNC_EVT_ISCSI BIT(4)
2005 #define SLI4_ASYNC_EVT_GRP5 BIT(5)
2006 #define SLI4_ASYNC_EVT_FC BIT(16)
2007 #define SLI4_ASYNC_EVT_SLI_PORT BIT(17)
2008 #define SLI4_ASYNC_EVT_VF BIT(18)
2009 #define SLI4_ASYNC_EVT_MR BIT(19)
2010 
2011 #define SLI4_ASYNC_EVT_ALL \
2012  SLI4_ASYNC_EVT_LINK_STATE | \
2013  SLI4_ASYNC_EVT_FCOE_FIP | \
2014  SLI4_ASYNC_EVT_DCBX | \
2015  SLI4_ASYNC_EVT_ISCSI | \
2016  SLI4_ASYNC_EVT_GRP5 | \
2017  SLI4_ASYNC_EVT_FC | \
2018  SLI4_ASYNC_EVT_SLI_PORT | \
2019  SLI4_ASYNC_EVT_VF |\
2020  SLI4_ASYNC_EVT_MR
2021 
2022 #define SLI4_ASYNC_EVT_FC_FCOE \
2023  SLI4_ASYNC_EVT_LINK_STATE | \
2024  SLI4_ASYNC_EVT_FCOE_FIP | \
2025  SLI4_ASYNC_EVT_GRP5 | \
2026  SLI4_ASYNC_EVT_FC | \
2027  SLI4_ASYNC_EVT_SLI_PORT
2028 
2029 /**
2030  * @brief Common Destroy MQ
2031  */
2032 typedef struct sli4_req_common_destroy_mq_s {
2034 #if BYTE_ORDER == LITTLE_ENDIAN
2035  uint32_t mq_id:16,
2036  :16;
2037 #else
2038 #error big endian version not defined
2039 #endif
2041 
2042 /**
2043  * @brief COMMON_GET_CNTL_ATTRIBUTES
2044  *
2045  * Query for information about the SLI Port
2046  */
2047 typedef struct sli4_res_common_get_cntl_attributes_s {
2049 #if BYTE_ORDER == LITTLE_ENDIAN
2050  uint8_t version_string[32];
2051  uint8_t manufacturer_name[32];
2053  uint32_t eprom_version_lo:8,
2054  eprom_version_hi:8,
2055  :16;
2056  uint32_t mbx_data_structure_version;
2058  uint8_t ncsi_version_string[12];
2060  uint8_t model_number[32];
2061  uint8_t description[64];
2062  uint8_t serial_number[32];
2063  uint8_t ip_version_string[32];
2064  uint8_t fw_version_string[32];
2065  uint8_t bios_version_string[32];
2066  uint8_t redboot_version_string[32];
2067  uint8_t driver_version_string[32];
2068  uint8_t fw_on_flash_version_string[32];
2070  uint32_t max_cdb_length:16,
2071  asic_revision:8,
2072  generational_guid0:8;
2073  uint32_t generational_guid1_12[3];
2074  uint32_t generational_guid13:24,
2075  hba_port_count:8;
2076  uint32_t default_link_down_timeout:16,
2077  iscsi_version_min_max:8,
2078  multifunctional_device:8;
2079  uint32_t cache_valid:8,
2080  hba_status:8,
2081  max_domains_supported:8,
2082  port_number:6,
2083  port_type:2;
2085  uint32_t hba_mtu;
2086  uint32_t iscsi_features:8,
2087  rsvd121:24;
2088  uint32_t pci_vendor_id:16,
2089  pci_device_id:16;
2090  uint32_t pci_sub_vendor_id:16,
2091  pci_sub_system_id:16;
2092  uint32_t pci_bus_number:8,
2093  pci_device_number:8,
2094  pci_function_number:8,
2095  interface_type:8;
2097  uint32_t number_of_netfilters:8,
2098  rsvd130:24;
2099 #else
2100 #error big endian version not defined
2101 #endif
2103 
2104 /**
2105  * @brief COMMON_GET_CNTL_ATTRIBUTES
2106  *
2107  * This command queries the controller information from the Flash ROM.
2108  */
2109 typedef struct sli4_req_common_get_cntl_addl_attributes_s {
2112 
2113 
2114 typedef struct sli4_res_common_get_cntl_addl_attributes_s {
2118  uint8_t rsvd0;
2120  uint8_t rsvd1[3];
2122  uint32_t rsvd2[4];
2123  char fcoe_universal_bios_version[32];
2124  char fcoe_x86_bios_version[32];
2125  char fcoe_efi_bios_version[32];
2126  char fcoe_fcode_version[32];
2127  char uefi_bios_version[32];
2128  char uefi_nic_version[32];
2129  char uefi_fcode_version[32];
2130  char uefi_iscsi_version[32];
2131  char iscsi_x86_bios_version[32];
2132  char pxe_x86_bios_version[32];
2133  uint8_t fcoe_default_wwpn[8];
2134  uint8_t ext_phy_version[32];
2135  uint8_t fc_universal_bios_version[32];
2136  uint8_t fc_x86_bios_version[32];
2137  uint8_t fc_efi_bios_version[32];
2138  uint8_t fc_fcode_version[32];
2139  uint8_t ext_phy_crc_label[8];
2140  uint8_t ipl_file_name[16];
2141  uint8_t rsvd3[72];
2143 
2144 /**
2145  * @brief COMMON_NOP
2146  *
2147  * This command does not do anything; it only returns the payload in the completion.
2148  */
2149 typedef struct sli4_req_common_nop_s {
2151 #if BYTE_ORDER == LITTLE_ENDIAN
2152  uint32_t context[2];
2153 #else
2154 #error big endian version not defined
2155 #endif
2157 
2158 typedef struct sli4_res_common_nop_s {
2160 #if BYTE_ORDER == LITTLE_ENDIAN
2161  uint32_t context[2];
2162 #else
2163 #error big endian version not defined
2164 #endif
2166 
2167 /**
2168  * @brief COMMON_GET_RESOURCE_EXTENT_INFO
2169  */
2170 typedef struct sli4_req_common_get_resource_extent_info_s {
2172 #if BYTE_ORDER == LITTLE_ENDIAN
2173  uint32_t resource_type:16,
2174  :16;
2175 #else
2176 #error big endian version not defined
2177 #endif
2179 
2180 #define SLI4_RSC_TYPE_ISCSI_INI_XRI 0x0c
2181 #define SLI4_RSC_TYPE_FCOE_VFI 0x20
2182 #define SLI4_RSC_TYPE_FCOE_VPI 0x21
2183 #define SLI4_RSC_TYPE_FCOE_RPI 0x22
2184 #define SLI4_RSC_TYPE_FCOE_XRI 0x23
2185 
2186 typedef struct sli4_res_common_get_resource_extent_info_s {
2188 #if BYTE_ORDER == LITTLE_ENDIAN
2189  uint32_t resource_extent_count:16,
2190  resource_extent_size:16;
2191 #else
2192 #error big endian version not defined
2193 #endif
2195 
2196 
2197 #define SLI4_128BYTE_WQE_SUPPORT 0x02
2198 /**
2199  * @brief COMMON_GET_SLI4_PARAMETERS
2200  */
2201 typedef struct sli4_res_common_get_sli4_parameters_s {
2203 #if BYTE_ORDER == LITTLE_ENDIAN
2204  uint32_t protocol_type:8,
2205  :24;
2206  uint32_t ft:1,
2207  :3,
2208  sli_revision:4,
2209  sli_family:4,
2210  if_type:4,
2211  sli_hint_1:8,
2212  sli_hint_2:5,
2213  :3;
2214  uint32_t eq_page_cnt:4,
2215  :4,
2216  eqe_sizes:4,
2217  :4,
2218  eq_page_sizes:8,
2219  eqe_count_method:4,
2220  :4;
2221  uint32_t eqe_count_mask:16,
2222  :16;
2223  uint32_t cq_page_cnt:4,
2224  :4,
2225  cqe_sizes:4,
2226  :2,
2227  cqv:2,
2228  cq_page_sizes:8,
2229  cqe_count_method:4,
2230  :4;
2231  uint32_t cqe_count_mask:16,
2232  :16;
2233  uint32_t mq_page_cnt:4,
2234  :10,
2235  mqv:2,
2236  mq_page_sizes:8,
2237  mqe_count_method:4,
2238  :4;
2239  uint32_t mqe_count_mask:16,
2240  :16;
2241  uint32_t wq_page_cnt:4,
2242  :4,
2243  wqe_sizes:4,
2244  :2,
2245  wqv:2,
2246  wq_page_sizes:8,
2247  wqe_count_method:4,
2248  :4;
2249  uint32_t wqe_count_mask:16,
2250  :16;
2251  uint32_t rq_page_cnt:4,
2252  :4,
2253  rqe_sizes:4,
2254  :2,
2255  rqv:2,
2256  rq_page_sizes:8,
2257  rqe_count_method:4,
2258  :4;
2259  uint32_t rqe_count_mask:16,
2260  :12,
2261  rq_db_window:4;
2262  uint32_t fcoe:1,
2263  ext:1,
2264  hdrr:1,
2265  sglr:1,
2266  fbrr:1,
2267  areg:1,
2268  tgt:1,
2269  terp:1,
2270  assi:1,
2271  wchn:1,
2272  tcca:1,
2273  trty:1,
2274  trir:1,
2275  phoff:1,
2276  phon:1,
2277  phwq:1, /** Performance Hint WQ_ID Association */
2278  boundary_4ga:1,
2279  rxc:1,
2280  hlm:1,
2281  ipr:1,
2282  rxri:1,
2283  sglc:1,
2284  timm:1,
2285  tsmm:1,
2286  :1,
2287  oas:1,
2288  lc:1,
2289  agxf:1,
2290  loopback_scope:4;
2292  uint32_t sgl_page_cnt:4,
2293  :4,
2294  sgl_page_sizes:8,
2295  sgl_pp_align:8,
2296  :8;
2297  uint32_t min_rq_buffer_size:16,
2298  :16;
2299  uint32_t max_rq_buffer_size;
2300  uint32_t physical_xri_max:16,
2301  physical_rpi_max:16;
2302  uint32_t physical_vpi_max:16,
2303  physical_vfi_max:16;
2304  uint32_t xecb:1,
2305  mdsd:1,
2306  efwd:1,
2307  nvme:1,
2308  xib:1,
2309  tow:1,
2310  xpsgl:1,
2311  fdb:1,
2312  edr:1,
2313  sriuns:1,
2314  dw19rsvd:22;
2315  uint16_t dw20w0;
2316  uint16_t dw20w1;
2317  uint32_t sgl_index_field_offset:16, /* dword 21 */
2318  sgl_index_field_size:16;
2319  uint32_t chain_sge_initial_value_lo; /* dword 22 */
2320  uint32_t chain_sge_initial_value_hi; /* dword 23 */
2321 #else
2322 #error big endian version not defined
2323 #endif
2325 
2326 
2327 /**
2328  * @brief COMMON_QUERY_FW_CONFIG
2329  *
2330  * This command retrieves firmware configuration parameters and adapter
2331  * resources available to the driver.
2332  */
2333 typedef struct sli4_req_common_query_fw_config_s {
2336 
2337 
2338 #define SLI4_FUNCTION_MODE_FCOE_INI_MODE 0x40
2339 #define SLI4_FUNCTION_MODE_FCOE_TGT_MODE 0x80
2340 #define SLI4_FUNCTION_MODE_DUA_MODE 0x800
2341 
2342 #define SLI4_ULP_MODE_FCOE_INI 0x40
2343 #define SLI4_ULP_MODE_FCOE_TGT 0x80
2344 
2345 typedef struct sli4_res_common_query_fw_config_s {
2347  uint32_t config_number;
2348  uint32_t asic_rev;
2349  uint32_t physical_port;
2350  uint32_t function_mode;
2351  uint32_t ulp0_mode;
2353  uint32_t ulp0_nic_wq_total; /* Dword 10 */
2363  uint32_t ulp0_iscsi_icd_total; /* Dword 20 */
2364  uint32_t ulp1_mode;
2373  uint32_t ulp1_lro_rqid_base; /* Dword 30 */
2378  uint32_t ulp0_cq_base;
2379  uint32_t ulp0_cq_total;
2380  uint32_t ulp0_eq_base;
2381  uint32_t ulp0_eq_total;
2383  uint32_t ulp0_iscsi_chain_icd_total; /* Dword 40 */
2387 
2388 /**
2389  * @brief COMMON_GET_PORT_NAME
2390  */
2391 typedef struct sli4_req_common_get_port_name_s {
2393 #if BYTE_ORDER == LITTLE_ENDIAN
2394  uint32_t pt:2, // only COMMON_GET_PORT_NAME_V1
2395  :30;
2396 #else
2397 #error big endian version not defined
2398 #endif
2400 
2401 typedef struct sli4_res_common_get_port_name_s {
2403  char port_name[4];
2405 
2406 /**
2407  * @brief COMMON_WRITE_FLASHROM
2408  */
2409 typedef struct sli4_req_common_write_flashrom_s {
2411 #if BYTE_ORDER == LITTLE_ENDIAN
2415  uint32_t offset;
2416  uint8_t data_buffer[4];
2417 #else
2418 #error big endian version not defined
2419 #endif
2421 
2422 #define SLI4_MGMT_FLASHROM_OPCODE_FLASH 0x01
2423 #define SLI4_MGMT_FLASHROM_OPCODE_SAVE 0x02
2424 #define SLI4_MGMT_FLASHROM_OPCODE_CLEAR 0x03
2425 #define SLI4_MGMT_FLASHROM_OPCODE_REPORT 0x04
2426 #define SLI4_MGMT_FLASHROM_OPCODE_IMAGE_INFO 0x05
2427 #define SLI4_MGMT_FLASHROM_OPCODE_IMAGE_CRC 0x06
2428 #define SLI4_MGMT_FLASHROM_OPCODE_OFFSET_BASED_FLASH 0x07
2429 #define SLI4_MGMT_FLASHROM_OPCODE_OFFSET_BASED_SAVE 0x08
2430 #define SLI4_MGMT_PHY_FLASHROM_OPCODE_FLASH 0x09
2431 #define SLI4_MGMT_PHY_FLASHROM_OPCODE_SAVE 0x0a
2432 
2433 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ISCSI 0x00
2434 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_REDBOOT 0x01
2435 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_BIOS 0x02
2436 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_PXE_BIOS 0x03
2437 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_CODE_CONTROL 0x04
2438 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_IPSEC_CFG 0x05
2439 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_INIT_DATA 0x06
2440 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ROM_OFFSET 0x07
2441 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_BIOS 0x08
2442 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ISCSI_BAK 0x09
2443 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_ACT 0x0a
2444 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_FCOE_BAK 0x0b
2445 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_CODE_CTRL_P 0x0c
2446 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_NCSI 0x0d
2447 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_NIC 0x0e
2448 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_DCBX 0x0f
2449 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_PXE_BIOS_CFG 0x10
2450 #define SLI4_FLASH_ROM_ACCESS_OP_TYPE_ALL_CFG_DATA 0x11
2451 
2452 /**
2453  * @brief COMMON_MANAGE_FAT
2454  */
2455 typedef struct sli4_req_common_manage_fat_s {
2457 #if BYTE_ORDER == LITTLE_ENDIAN
2458  uint32_t fat_operation;
2462  uint32_t data_buffer; // response only
2463 #else
2464 #error big endian version not defined
2465 #endif
2467 
2468 /**
2469  * @brief COMMON_GET_EXT_FAT_CAPABILITIES
2470  */
2471 typedef struct sli4_req_common_get_ext_fat_capabilities_s {
2473 #if BYTE_ORDER == LITTLE_ENDIAN
2474  uint32_t parameter_type;
2475 #else
2476 #error big endian version not defined
2477 #endif
2479 
2480 /**
2481  * @brief COMMON_SET_EXT_FAT_CAPABILITIES
2482  */
2483 typedef struct sli4_req_common_set_ext_fat_capabilities_s {
2485 #if BYTE_ORDER == LITTLE_ENDIAN
2487  uint32_t log_entry_size;
2488  uint32_t logging_type:8,
2489  maximum_logging_functions:8,
2490  maximum_logging_ports:8,
2491  :8;
2492  uint32_t supported_modes;
2493  uint32_t number_modules;
2494  uint32_t debug_module[14];
2495 #else
2496 #error big endian version not defined
2497 #endif
2499 
2500 /**
2501  * @brief COMMON_EXT_FAT_CONFIGURE_SNAPSHOT
2502  */
2503 typedef struct sli4_req_common_ext_fat_configure_snapshot_s {
2505 #if BYTE_ORDER == LITTLE_ENDIAN
2507 #else
2508 #error big endian version not defined
2509 #endif
2511 
2512 /**
2513  * @brief COMMON_EXT_FAT_RETRIEVE_SNAPSHOT
2514  */
2515 typedef struct sli4_req_common_ext_fat_retrieve_snapshot_s {
2517 #if BYTE_ORDER == LITTLE_ENDIAN
2518  uint32_t snapshot_mode;
2519  uint32_t start_index;
2521 #else
2522 #error big endian version not defined
2523 #endif
2525 
2526 typedef struct sli4_res_common_ext_fat_retrieve_snapshot_s {
2528 #if BYTE_ORDER == LITTLE_ENDIAN
2530  uint32_t version:8,
2531  physical_port:8,
2532  function_id:16;
2533  uint32_t trace_level;
2534  uint32_t module_mask[2];
2536  uint32_t timestamp;
2537  uint8_t string_data[16];
2538  uint32_t data[6];
2539 #else
2540 #error big endian version not defined
2541 #endif
2543 
2544 /**
2545  * @brief COMMON_EXT_FAT_READ_STRING_TABLE
2546  */
2547 typedef struct sli4_req_common_ext_fat_read_string_table_s {
2549 #if BYTE_ORDER == LITTLE_ENDIAN
2550  uint32_t byte_offset;
2551  uint32_t number_bytes;
2552 #else
2553 #error big endian version not defined
2554 #endif
2556 
2557 typedef struct sli4_res_common_ext_fat_read_string_table_s {
2559 #if BYTE_ORDER == LITTLE_ENDIAN
2562  uint32_t table_data0:8,
2563  :24;
2564  uint8_t table_data[0];
2565 #else
2566 #error big endian version not defined
2567 #endif
2569 
2570 /**
2571  * @brief COMMON_READ_TRANSCEIVER_DATA
2572  *
2573  * This command reads SFF transceiver data(Format is defined
2574  * by the SFF-8472 specification).
2575  */
2576 typedef struct sli4_req_common_read_transceiver_data_s {
2578 #if BYTE_ORDER == LITTLE_ENDIAN
2579  uint32_t page_number;
2580  uint32_t port;
2581 #else
2582 #error big endian version not defined
2583 #endif
2585 
2586 typedef struct sli4_res_common_read_transceiver_data_s {
2588 #if BYTE_ORDER == LITTLE_ENDIAN
2589  uint32_t page_number;
2590  uint32_t port;
2591  uint32_t page_data[32];
2592  uint32_t page_data_2[32];
2593 #else
2594 #error big endian version not defined
2595 #endif
2597 
2598 /**
2599  * @brief COMMON_READ_OBJECT
2600  */
2601 typedef struct sli4_req_common_read_object_s {
2603 #if BYTE_ORDER == LITTLE_ENDIAN
2604  uint32_t desired_read_length:24,
2605  :8;
2606  uint32_t read_offset;
2607  uint8_t object_name[104];
2609  sli4_bde_t host_buffer_descriptor[0];
2610 #else
2611 #error big endian version not defined
2612 #endif
2614 
2615 typedef struct sli4_res_common_read_object_s {
2617 #if BYTE_ORDER == LITTLE_ENDIAN
2619  uint32_t resv:31,
2620  eof:1;
2621 #else
2622 #error big endian version not defined
2623 #endif
2625 
2626 /**
2627  * @brief COMMON_WRITE_OBJECT
2628  */
2629 typedef struct sli4_req_common_write_object_s {
2631 #if BYTE_ORDER == LITTLE_ENDIAN
2632  uint32_t desired_write_length:24,
2633  :6,
2634  noc:1,
2635  eof:1;
2636  uint32_t write_offset;
2637  uint8_t object_name[104];
2639  sli4_bde_t host_buffer_descriptor[0];
2640 #else
2641 #error big endian version not defined
2642 #endif
2644 
2645 typedef struct sli4_res_common_write_object_s {
2647 #if BYTE_ORDER == LITTLE_ENDIAN
2649  uint32_t change_status:8,
2650  :24;
2651 #else
2652 #error big endian version not defined
2653 #endif
2655 
2656 /**
2657  * @brief COMMON_DELETE_OBJECT
2658  */
2659 typedef struct sli4_req_common_delete_object_s {
2661 #if BYTE_ORDER == LITTLE_ENDIAN
2662  uint32_t rsvd4;
2663  uint32_t rsvd5;
2664  uint8_t object_name[104];
2665 #else
2666 #error big endian version not defined
2667 #endif
2669 
2670 /**
2671  * @brief COMMON_READ_OBJECT_LIST
2672  */
2673 typedef struct sli4_req_common_read_object_list_s {
2675 #if BYTE_ORDER == LITTLE_ENDIAN
2676  uint32_t desired_read_length:24,
2677  :8;
2678  uint32_t read_offset;
2679  uint8_t object_name[104];
2681  sli4_bde_t host_buffer_descriptor[0];
2682 #else
2683 #error big endian version not defined
2684 #endif
2686 
2687 /**
2688  * @brief COMMON_SET_DUMP_LOCATION
2689  */
2690 typedef struct sli4_req_common_set_dump_location_s {
2692 #if BYTE_ORDER == LITTLE_ENDIAN
2693  uint32_t buffer_length:24,
2694  :5,
2695  fdb:1,
2696  blp:1,
2697  qry:1;
2698  uint32_t buf_addr_low;
2699  uint32_t buf_addr_high;
2700 #else
2701 #error big endian version not defined
2702 #endif
2704 
2705 typedef struct sli4_res_common_set_dump_location_s {
2707 #if BYTE_ORDER == LITTLE_ENDIAN
2708  uint32_t buffer_length;
2709 #else
2710 #error big endian version not defined
2711 #endif
2713 
2714 /**
2715  * @brief COMMON_SET_LOOPBACK_MODE
2716  */
2717 typedef struct sli4_req_common_set_loopback_mode_s {
2719 #if BYTE_ORDER == LITTLE_ENDIAN
2720  uint32_t typ:2,
2721  rsvd:14,
2722  link_number:6,
2723  link_type:2,
2724  :8;
2725 #else
2726 #error big endian version not defined
2727 #endif
2729 
2730 typedef struct sli4_res_common_set_loopback_mode_s {
2733 
2734 /**
2735  * @brief COMMON_SET_SET_FEATURES
2736  */
2737 #define SLI4_SET_FEATURES_DIF_SEED 0x01
2738 #define SLI4_SET_FEATURES_XRI_TIMER 0x03
2739 #define SLI4_SET_FEATURES_MAX_PCIE_SPEED 0x04
2740 #define SLI4_SET_FEATURES_FCTL_CHECK 0x05
2741 #define SLI4_SET_FEATURES_FEC 0x06
2742 #define SLI4_SET_FEATURES_PCIE_RECV_DETECT 0x07
2743 #define SLI4_SET_FEATURES_DIF_MEMORY_MODE 0x08
2744 #define SLI4_SET_FEATURES_SLI_PORT_PAUSE_STATE 0x09
2745 #define SLI4_SET_FEATURES_ENABLE_PCIE_OPTIONS 0x0A
2746 #define SLI4_SET_FEATURES_SET_CONFIG_AXR_T10PI 0x0C
2747 #define SLI4_SET_FEATURES_SET_CONFIG_TOW_T10PI 0x1C
2748 #define SLI4_SET_FEATURES_ENABLE_MULTI_RECEIVE_QUEUE 0x0D
2749 #define SLI4_SET_FEATURES_SET_FTD_XFER_HINT 0x0F
2750 #define SLI4_SET_FEATURES_SLI_PORT_HEALTH_CHECK 0x11
2751 #define SLI4_SET_FEATURES_AUTO_RSP_PARAM_RESET 0x19
2752 
2753 typedef struct sli4_req_common_set_features_s {
2755 #if BYTE_ORDER == LITTLE_ENDIAN
2756  uint32_t feature;
2757  uint32_t param_len;
2758  uint32_t params[8];
2759 #else
2760 #error big endian version not defined
2761 #endif
2763 
2764 typedef struct sli4_req_common_set_features_dif_seed_s {
2765 #if BYTE_ORDER == LITTLE_ENDIAN
2766  uint32_t seed:16,
2767  :16;
2768 #else
2769 #error big endian version not defined
2770 #endif
2772 
2773 typedef struct sli4_req_common_set_features_t10_pi_mem_model_s {
2774 #if BYTE_ORDER == LITTLE_ENDIAN
2775  uint32_t tmm:1,
2776  :31;
2777 #else
2778 #error big endian version not defined
2779 #endif
2781 
2782 typedef struct sli4_req_common_set_features_multirq_s {
2783 #if BYTE_ORDER == LITTLE_ENDIAN
2784  uint32_t isr:1, /*<< Include Sequence Reporting */
2785  agxfe:1, /*<< Auto Generate XFER-RDY Feature Enabled */
2786  :30;
2787  uint32_t num_rqs:8,
2788  rq_select_policy:4,
2789  :20;
2790 #else
2791 #error big endian version not defined
2792 #endif
2794 
2795 typedef struct sli4_req_common_set_features_axr_t10pi_s {
2796 #if BYTE_ORDER == LITTLE_ENDIAN
2797  uint32_t rtc:1,
2798  atv:1,
2799  tmm:1,
2800  :1,
2801  p_type:3,
2802  blk_size:3,
2803  :22;
2804  uint32_t app_tag:16,
2805  :16;
2806 #else
2807 #error big endian version not defined
2808 #endif
2810 
2811 typedef struct sli4_req_common_set_features_tow_t10pi_s {
2812 #if BYTE_ORDER == LITTLE_ENDIAN
2813  uint32_t srti:1,
2814  srtc:1,
2815  sipt:1,
2816  sspt:1,
2817  smm:1,
2818  :11,
2819  nrti:1,
2820  nrtc:1,
2821  nipt:1,
2822  nspt:1,
2823  nmm:1,
2824  :11;
2825  sli4_diseed_sge_t scsi_diseed_sge;
2826  uint32_t nvme_diseed_sge[4];
2827 #else
2828 #error big endian version not defined
2829 #endif
2831 
2832 typedef struct sli4_req_common_set_features_health_check_s {
2833 #if BYTE_ORDER == LITTLE_ENDIAN
2834  uint32_t hck:1,
2835  qry:1,
2836  :30;
2837 #else
2838 #error big endian version not defined
2839 #endif
2841 
2842 typedef struct sli4_req_common_set_features_set_fdt_xfer_hint_s {
2843 #if BYTE_ORDER == LITTLE_ENDIAN
2844  uint32_t fdt_xfer_hint;
2845 #else
2846 #error big endian version not defined
2847 #endif
2849 
2850 
2851 #define SLI4_CONFIG_FEC_LINK_TYPE_ETH (0)
2852 #define SLI4_CONFIG_FEC_LINK_TYPE_FC (1)
2853 
2854 typedef struct sli4_req_common_set_features_config_fec_s {
2855 #if BYTE_ORDER == LITTLE_ENDIAN
2856  uint32_t link_number:6,
2857  link_type:2,
2858  :8,
2859  en:1,
2860  :15;
2861 #else
2862 #error big endian version not defined
2863 #endif
2865 
2866 typedef struct sli4_req_common_set_features_pause_state_s {
2867 #if BYTE_ORDER == LITTLE_ENDIAN
2868  uint32_t eps:1,
2869  :31;
2870 #else
2871 #error big endian version not defined
2872 #endif
2874 
2875 typedef struct sli4_req_common_set_features_auto_response_param_val_reset_s {
2876 #if BYTE_ORDER == LITTLE_ENDIAN
2877  uint32_t pz:1,
2878  :31;
2879 #else
2880 #error big endian version not defined
2881 #endif
2883 
2884 /**
2885  * @brief DMTF_EXEC_CLP_CMD
2886  */
2887 typedef struct sli4_req_dmtf_exec_clp_cmd_s {
2889 #if BYTE_ORDER == LITTLE_ENDIAN
2890  uint32_t cmd_buf_length;
2896 #else
2897 #error big endian version not defined
2898 #endif
2900 
2901 typedef struct sli4_res_dmtf_exec_clp_cmd_s {
2903 #if BYTE_ORDER == LITTLE_ENDIAN
2904  uint32_t :32;
2905  uint32_t resp_length;
2906  uint32_t :32;
2907  uint32_t :32;
2908  uint32_t :32;
2909  uint32_t :32;
2910  uint32_t clp_status;
2912 #else
2913 #error big endian version not defined
2914 #endif
2916 
2917 /**
2918  * @brief Resource descriptor
2919  */
2920 
2921 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_PCIE 0x50
2922 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_NIC 0x51
2923 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_ISCSI 0x52
2924 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_FCFCOE 0x53
2925 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_RDMA 0x54
2926 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_PORT 0x55
2927 #define SLI4_RESOURCE_DESCRIPTOR_TYPE_ISAP 0x56
2928 
2929 #define SLI4_PROTOCOL_NIC_TOE 0x01
2930 #define SLI4_PROTOCOL_ISCSI 0x02
2931 #define SLI4_PROTOCOL_FCOE 0x04
2932 #define SLI4_PROTOCOL_NIC_TOE_RDMA 0x08
2933 #define SLI4_PROTOCOL_FC 0x10
2934 #define SLI4_PROTOCOL_DEFAULT 0xff
2935 
2936 typedef struct sli4_resource_descriptor_v1_s {
2937  uint32_t descriptor_type:8,
2938  descriptor_length:8,
2939  :16;
2940  uint32_t type_specific[0];
2942 
2943 typedef struct sli4_pcie_resource_descriptor_v1_s {
2944  uint32_t descriptor_type:8,
2945  descriptor_length:8,
2946  :14,
2947  imm:1,
2948  nosv:1;
2949  uint32_t :16,
2950  pf_number:10,
2951  :6;
2952  uint32_t rsvd1;
2953  uint32_t sriov_state:8,
2954  pf_state:8,
2955  pf_type:8,
2956  :8;
2957  uint32_t number_of_vfs:16,
2958  :16;
2959  uint32_t mission_roles:8,
2960  :19,
2961  pchg:1,
2962  schg:1,
2963  xchg:1,
2964  xrom:2;
2965  uint32_t rsvd2[16];
2967 
2968 typedef struct sli4_isap_resource_descriptor_v1_s {
2969  uint32_t descriptor_type:8,
2970  descriptor_length:8,
2971  :16;
2972  uint32_t iscsi_tgt:1,
2973  iscsi_ini:1,
2974  iscsi_dif:1,
2975  :29;
2976  uint32_t rsvd1[3];
2977  uint32_t fcoe_tgt:1,
2978  fcoe_ini:1,
2979  fcoe_dif:1,
2980  :29;
2981  uint32_t rsvd2[7];
2982  uint32_t mc_type0:8,
2983  mc_type1:8,
2984  mc_type2:8,
2985  mc_type3:8;
2986  uint32_t rsvd3[3];
2988 
2989 /**
2990  * @brief COMMON_GET_FUNCTION_CONFIG
2991  */
2992 typedef struct sli4_req_common_get_function_config_s {
2995 
2996 typedef struct sli4_res_common_get_function_config_s {
2998 #if BYTE_ORDER == LITTLE_ENDIAN
2999  uint32_t desc_count;
3000  uint32_t desc[54];
3001 #else
3002 #error big endian version not defined
3003 #endif
3005 
3006 /**
3007  * @brief COMMON_GET_PROFILE_CONFIG
3008  */
3009 typedef struct sli4_req_common_get_profile_config_s {
3011  uint32_t profile_id:8,
3012  typ:2,
3013  :22;
3015 
3016 typedef struct sli4_res_common_get_profile_config_s {
3018 #if BYTE_ORDER == LITTLE_ENDIAN
3019  uint32_t desc_count;
3020  uint32_t desc[0];
3021 #else
3022 #error big endian version not defined
3023 #endif
3025 
3026 /**
3027  * @brief COMMON_SET_PROFILE_CONFIG
3028  */
3029 typedef struct sli4_req_common_set_profile_config_s {
3031  uint32_t profile_id:8,
3032  :23,
3033  isap:1;
3034  uint32_t desc_count;
3035  uint32_t desc[0];
3037 
3038 typedef struct sli4_res_common_set_profile_config_s {
3040 #if BYTE_ORDER == LITTLE_ENDIAN
3041 #else
3042 #error big endian version not defined
3043 #endif
3045 
3046 /**
3047  * @brief Profile Descriptor for profile functions
3048  */
3049 typedef struct sli4_profile_descriptor_s {
3050 #if BYTE_ORDER == LITTLE_ENDIAN
3051  uint32_t profile_id:8,
3052  :8,
3053  profile_index:8,
3054  :8;
3055  uint32_t profile_description[128];
3056 #else
3057 #error big endian version not defined
3058 #endif
3060 
3061 /* We don't know in advance how many descriptors there are. We have
3062  to pick a number that we think will be big enough and ask for that
3063  many. */
3064 
3065 #define MAX_PRODUCT_DESCRIPTORS 40
3066 
3067 /**
3068  * @brief COMMON_GET_PROFILE_LIST
3069  */
3070 typedef struct sli4_req_common_get_profile_list_s {
3072 #if BYTE_ORDER == LITTLE_ENDIAN
3073  uint32_t start_profile_index:8,
3074  :24;
3075 #else
3076 #error big endian version not defined
3077 #endif
3079 
3080 typedef struct sli4_res_common_get_profile_list_s {
3082 #if BYTE_ORDER == LITTLE_ENDIAN
3085 #else
3086 #error big endian version not defined
3087 #endif
3089 
3090 /**
3091  * @brief COMMON_GET_ACTIVE_PROFILE
3092  */
3093 typedef struct sli4_req_common_get_active_profile_s {
3096 
3097 typedef struct sli4_res_common_get_active_profile_s {
3099 #if BYTE_ORDER == LITTLE_ENDIAN
3100  uint32_t active_profile_id:8,
3101  :8,
3102  next_profile_id:8,
3103  :8;
3104 #else
3105 #error big endian version not defined
3106 #endif
3108 
3109 /**
3110  * @brief COMMON_SET_ACTIVE_PROFILE
3111  */
3112 typedef struct sli4_req_common_set_active_profile_s {
3114 #if BYTE_ORDER == LITTLE_ENDIAN
3115  uint32_t active_profile_id:8,
3116  :23,
3117  fd:1;
3118 #else
3119 #error big endian version not defined
3120 #endif
3122 
3123 typedef struct sli4_res_common_set_active_profile_s {
3126 
3127 /**
3128  * @brief Link Config Descriptor for link config functions
3129  */
3130 typedef struct sli4_link_config_descriptor_s {
3131 #if BYTE_ORDER == LITTLE_ENDIAN
3132  uint32_t link_config_id:8,
3133  :24;
3134  uint32_t config_description[8];
3135 #else
3136 #error big endian version not defined
3137 #endif
3139 
3140 #define MAX_LINK_CONFIG_DESCRIPTORS 10
3141 
3142 /**
3143  * @brief COMMON_GET_RECONFIG_LINK_INFO
3144  */
3145 typedef struct sli4_req_common_get_reconfig_link_info_s {
3147 #if BYTE_ORDER == LITTLE_ENDIAN
3148 #else
3149 #error big endian version not defined
3150 #endif
3152 
3153 typedef struct sli4_res_common_get_reconfig_link_info_s {
3155 #if BYTE_ORDER == LITTLE_ENDIAN
3156  uint32_t active_link_config_id:8,
3157  :8,
3158  next_link_config_id:8,
3159  :8;
3160  uint32_t link_configuration_descriptor_count;
3162 #else
3163 #error big endian version not defined
3164 #endif
3166 
3167 /**
3168  * @brief COMMON_SET_RECONFIG_LINK_ID
3169  */
3170 typedef struct sli4_req_common_set_reconfig_link_id_s {
3172 #if BYTE_ORDER == LITTLE_ENDIAN
3173  uint32_t next_link_config_id:8,
3174  :23,
3175  fd:1;
3176 #else
3177 #error big endian version not defined
3178 #endif
3180 
3181 typedef struct sli4_res_common_set_reconfig_link_id_s {
3183 #if BYTE_ORDER == LITTLE_ENDIAN
3184 #else
3185 #error big endian version not defined
3186 #endif
3188 
3189 #define SLI4_MAX_ULP 8
3190 
3191 typedef struct sli4_req_lowlevel_get_itcm_parity_stats_s {
3193 #if BYTE_ORDER == LITTLE_ENDIAN
3194  uint32_t :8,
3195  clr_pbec:1,
3196  clr_tpec:1,
3197  :22;
3198 #else
3199 #error big endian version not defined
3200 #endif
3202 
3203 typedef struct sli4_parity_err_count_s {
3204  uint32_t pbec:16,
3205  tpec:16;
3207 
3208 typedef struct sli4_res_lowlevel_get_itcm_parity_stats_s {
3210 #if BYTE_ORDER == LITTLE_ENDIAN
3211  uint32_t num_ulp:8,
3212  clr_pbec:1,
3213  clr_tpec:1,
3214  :22;
3216 #else
3217 #error big endian version not defined
3218 #endif
3220 
3221 typedef struct sli4_req_lowlevel_set_watchdog_s {
3223 #if BYTE_ORDER == LITTLE_ENDIAN
3224  uint32_t watchdog_timeout:16,
3225  :16;
3226 #else
3227 #error big endian version not defined
3228 #endif
3229 
3231 
3232 
3233 typedef struct sli4_res_lowlevel_set_watchdog_s {
3235 #if BYTE_ORDER == LITTLE_ENDIAN
3236  uint32_t rsvd;
3237 #else
3238 #error big endian version not defined
3239 #endif
3241 
3242 
3243 #define SLI4_TRUNK_MODE_NONE 0x0
3244 #define SLI4_TRUNK_MODE_2_LINKS_PER_TRUNK 0x1
3245 #define SLI4_TRUNK_MODE_4_LINKS_PER_TRUNK 0x2
3246 
3247 typedef struct sli4_req_set_trunk_mode_s {
3249 #if BYTE_ORDER == LITTLE_ENDIAN
3250  uint8_t trunk_mode;
3251  uint8_t rsvd1[3];
3252  uint32_t reserved[2];
3253 #else
3254 #error big endian version not defined
3255 #endif
3256 
3258 
3259 
3260 typedef struct sli4_res_set_trunk_mode_s {
3262 #if BYTE_ORDER == LITTLE_ENDIAN
3263  uint32_t rsvd;
3264 #else
3265 #error big endian version not defined
3266 #endif
3268 
3269 typedef struct sli4_req_lowlevel_set_diag_log_options_s {
3271 #if BYTE_ORDER == LITTLE_ENDIAN
3272  uint32_t enable:1,
3273  reserved1:7,
3274  log_level:4,
3275  reserved2:3,
3276  reset_action:1,
3277  buffer_cnt:8,
3278  buffer_size:8;
3279  uint32_t acqe_interval:16,
3280  cq_id:16;
3281  uint32_t lwpd_addr_lo;
3282  uint32_t lwpd_addr_hi;
3283  struct {
3284  uint32_t addr_lo;
3285  uint32_t addr_hi;
3286  } buffer_desc[0];
3287 #else
3288 #error big endian version not defined
3289 #endif
3291 
3292 
3293 typedef struct sli4_res_lowlevel_set_diag_log_options_s {
3295 #if BYTE_ORDER == LITTLE_ENDIAN
3296  uint32_t rsvd;
3297 #else
3298 #error big endian version not defined
3299 #endif
3301 
3302 /**
3303  * @brief Event Queue Entry
3304  */
3305 typedef struct sli4_eqe_s {
3306 #if BYTE_ORDER == LITTLE_ENDIAN
3307  uint32_t vld:1, /** valid */
3308  major_code:3,
3309  minor_code:12,
3310  resource_id:16;
3311 #else
3312 #error big endian version not defined
3313 #endif
3314 } sli4_eqe_t;
3315 
3316 #define SLI4_MAJOR_CODE_STANDARD 0
3317 #define SLI4_MAJOR_CODE_SENTINEL 1
3318 
3319 /**
3320  * @brief Mailbox Completion Queue Entry
3321  *
3322  * A CQE generated on the completion of a MQE from a MQ.
3323  */
3324 typedef struct sli4_mcqe_s {
3325 #if BYTE_ORDER == LITTLE_ENDIAN
3326  uint32_t completion_status:16, /** values are protocol specific */
3327  extended_status:16;
3328  uint32_t mqe_tag_low;
3329  uint32_t mqe_tag_high;
3330  uint32_t :27,
3331  con:1, /** consumed - command now being executed */
3332  cmp:1, /** completed - command still executing if clear */
3333  :1,
3334  ae:1, /** async event - this is an ACQE */
3335  val:1; /** valid - contents of CQE are valid */
3336 #else
3337 #error big endian version not defined
3338 #endif
3339 } sli4_mcqe_t;
3340 
3341 
3342 /**
3343  * @brief Asynchronous Completion Queue Entry
3344  *
3345  * A CQE generated asynchronously in response to the link or other internal events.
3346  */
3347 typedef struct sli4_acqe_s {
3348 #if BYTE_ORDER == LITTLE_ENDIAN
3349  uint32_t event_data[3];
3350  uint32_t :8,
3351  event_code:8,
3352  event_type:8, /** values are protocol specific */
3353  :6,
3354  ae:1, /** async event - this is an ACQE */
3355  val:1; /** valid - contents of CQE are valid */
3356 #else
3357 #error big endian version not defined
3358 #endif
3359 } sli4_acqe_t;
3360 
3361 typedef struct sli4_port_event_acqe_s {
3362 #if BYTE_ORDER == LITTLE_ENDIAN
3363  uint8_t p0_linkstate;
3364  uint8_t p1_linkstate;
3365  uint8_t p2_linkstate;
3366  uint8_t p3_linkstate;
3367  uint32_t event_data2;
3368  uint32_t :32;
3369  uint32_t :8,
3370  event_code:8,
3371  event_type:8,
3372  :6,
3373  ae:1,
3374  val:1;
3375 #else
3376 #error big endian version not defined
3377 #endif
3379 
3380 #define SLI4_ACQE_EVENT_CODE_LINK_STATE 0x01
3381 #define SLI4_ACQE_EVENT_CODE_FCOE_FIP 0x02
3382 #define SLI4_ACQE_EVENT_CODE_DCBX 0x03
3383 #define SLI4_ACQE_EVENT_CODE_ISCSI 0x04
3384 #define SLI4_ACQE_EVENT_CODE_GRP_5 0x05
3385 #define SLI4_ACQE_EVENT_CODE_FC_LINK_EVENT 0x10
3386 #define SLI4_ACQE_EVENT_CODE_SLI_PORT_EVENT 0x11
3387 #define SLI4_ACQE_EVENT_CODE_VF_EVENT 0x12
3388 #define SLI4_ACQE_EVENT_CODE_MR_EVENT 0x13
3389 
3390 #define SLI4_ACQE_PORT_EVENT_TYPE_MISCONF_PHYPORTS 0x09
3391 #define SLI4_ACQE_PORT_EVENT_TYPE_ITCM_PARITY_EVENT 0x0D
3392 
3393 /**
3394  * @brief Register name enums
3395  */
3396 typedef enum {
3415  SLI4_REG_MAX /* must be last */
3416 } sli4_regname_e;
3417 
3418 typedef struct sli4_reg_s {
3419  uint32_t rset;
3420  uint32_t off;
3421 } sli4_reg_t;
3422 
3423 typedef enum {
3429  SLI_QTYPE_MAX, /* must be last */
3430 } sli4_qtype_e;
3431 
3432 #define SLI_USER_MQ_COUNT 1 /** User specified max mail queues */
3433 #define SLI_MAX_CQ_SET_COUNT 16
3434 #define SLI_MAX_RQ_SET_COUNT 16
3435 
3436 typedef enum {
3445  SLI_QENTRY_MAX /* must be last */
3446 } sli4_qentry_e;
3447 
3448 typedef struct sli4_queue_s {
3449  /* Common to all queue types */
3450  ocs_dma_t dma;
3451  ocs_lock_t lock;
3452  uint32_t index; /** current host entry index */
3453  uint16_t size; /** entry size */
3454  uint16_t length; /** number of entries */
3455  uint16_t n_posted; /** number entries posted */
3456  uint16_t id; /** Port assigned xQ_ID */
3457  uint16_t ulp; /** ULP assigned to this queue */
3458  uint32_t doorbell_offset;/** The offset for the doorbell */
3459  uint16_t doorbell_rset; /** register set for the doorbell */
3460  uint8_t type; /** queue type ie EQ, CQ, ... */
3461  uint32_t posted_limit; /** number of CQE/EQE to process before ringing doorbell */
3465  uint16_t phase; /** For if_type = 6, this value toggle for each iteration
3466  of the queue, a queue entry is valid when a cqe valid
3467  bit matches this value */
3468 
3469  /* Type specific gunk */
3470  union {
3471  uint32_t r_idx; /** "read" index (MQ only) */
3472  struct {
3473  uint32_t is_mq:1,/** CQ contains MQ/Async completions */
3474  is_hdr:1,/** is a RQ for packet headers */
3475  rq_batch:1;/** RQ index incremented by 8 */
3476  } flag;
3477  struct {
3478  uint8_t enabled; /** dpp enabled queues */
3479  uint8_t id; /** dpp_id associated with this queue */
3480  uint16_t db_offset; /** reg offset for dpp aperture - Lancer G7 */
3481  uint32_t db_rset; /** reg set for dpp - Lancer G7 */
3482  } dpp;
3483  } u;
3484 } sli4_queue_t;
3485 
3486 static inline void
3488 {
3489  ocs_lock(&q->lock);
3490 }
3491 
3492 static inline void
3494 {
3495  ocs_unlock(&q->lock);
3496 }
3497 
3498 #define SLI4_PAUSE_ERRX_PAIR_CNT 16
3499 
3500 #define SLI4_QUEUE_DEFAULT_CQ UINT16_MAX /** Use the default CQ */
3501 
3502 #define SLI4_QUEUE_RQ_BATCH 8
3503 
3504 typedef enum {
3507  SLI4_CB_MAX /* must be last */
3508 } sli4_callback_e;
3509 
3510 typedef enum {
3518 
3519 typedef enum {
3520  SLI_LINK_TOPO_NPORT = 1, /** fabric or point-to-point */
3527 
3528 // TODO do we need both sli4_port_type_e & sli4_link_medium_e
3529 typedef enum {
3534 
3535 typedef struct sli4_link_event_s {
3536  sli4_link_status_e status; /* link up/down */
3538  sli4_link_medium_e medium; /* Ethernet / FC */
3539  uint32_t speed; /* Mbps */
3540  uint32_t logical_link_speed; /* Mbps */
3541  uint32_t aggregate_link_speed; /* Mbps */
3542  uint8_t *loop_map;
3543  uint32_t fc_id;
3545 
3546 /**
3547  * @brief Fields retrieved from skyhawk that used used to build chained SGL
3548  */
3549 typedef struct sli4_sgl_chaining_params_s {
3558 
3559 typedef struct sli4_fip_event_s {
3560  uint32_t type;
3561  uint32_t index; /* FCF index or UINT32_MAX if invalid */
3563 
3564 typedef enum {
3570  SLI_RSRC_MAX /* must be last */
3571 } sli4_resource_e;
3572 
3573 // TODO do we need both sli4_port_type_e & sli4_link_medium_e
3574 typedef enum {
3577  SLI4_PORT_TYPE_MAX /* must be last */
3579 
3580 typedef enum {
3588 
3589 typedef enum {
3599 } sli4_asic_rev_e;
3600 
3601 typedef struct sli4_s {
3602  ocs_os_handle_t os;
3604 
3605  uint32_t sli_rev; /* SLI revision number */
3606  uint32_t sli_family;
3607  uint32_t if_type; /* SLI Interface type */
3608 
3609  sli4_asic_type_e asic_type; /*<< ASIC type */
3610  sli4_asic_rev_e asic_rev; /*<< ASIC revision */
3611  uint32_t physical_port;
3612 
3613  struct {
3614  uint16_t e_d_tov;
3615  uint16_t r_a_tov;
3616  uint16_t max_qcount[SLI_QTYPE_MAX];
3617  uint32_t max_qentries[SLI_QTYPE_MAX];
3618  uint16_t count_mask[SLI_QTYPE_MAX];
3619  uint16_t count_method[SLI_QTYPE_MAX];
3620  uint32_t qpage_count[SLI_QTYPE_MAX];
3622  uint8_t rq_batch;
3625  uint8_t topology;
3626  uint8_t wwpn[8]; // WW Port Name
3627  uint8_t wwnn[8]; // WW Node Name
3628  uint32_t fw_rev[2];
3629  uint8_t fw_name[2][16];
3630  char ipl_name[16];
3631  uint32_t hw_rev[3];
3632  uint8_t port_number;
3633  char port_name[2];
3634  char modeldesc[64];
3635  char bios_version_string[32];
3637  uint8_t is_ulp_fc[2];
3638  /*
3639  * Tracks the port resources using extents metaphor. For
3640  * devices that don't implement extents (i.e.
3641  * has_extents == FALSE), the code models each resource as
3642  * a single large extent.
3643  */
3644  struct {
3645  ocs_lock_t lock; /* resource lock */
3646  uint32_t number; /* number of extents */
3647  uint32_t size; /* number of elements in each extent */
3648  uint32_t n_alloc;/* number of elements allocated */
3649  uint32_t *base;
3650  ocs_bitmap_t *use_map;/* bitmap showing resources in use */
3651  uint32_t map_size;/* number of bits in bitmap */
3652  } extent[SLI_RSRC_MAX];
3654  uint32_t has_extents:1,
3655  auto_reg:1,
3656  auto_xfer_rdy:1,
3657  tow:1,
3658  hdr_template_req:1,
3659  perf_hint:1,
3660  perf_wq_id_association:1,
3661  cq_create_version:2,
3662  mq_create_version:2,
3663  high_login_mode:1,
3664  sgl_pre_registered:1,
3665  sgl_pre_registration_required:1,
3666  t10_dif_inline_capable:1,
3667  t10_dif_separate_capable:1,
3668  fdd_present:1,
3669  enable_bbcr:1,
3670  xib_capable:1,
3671  suppress_rsp_not_supported:1,
3672  :12;
3673  uint32_t sge_supported_length;
3674  uint32_t sgl_page_sizes;
3675  uint32_t max_sgl_pages;
3676  uint32_t max_tow_xris;
3678  size_t wqe_size;
3679  uint8_t dpp;
3680  uint8_t bbscn_max:4,
3681  bbscn_def:4;
3682  } config;
3683 
3684  /*
3685  * Callback functions
3686  */
3687  int32_t (*link)(void *, void *);
3688  void *link_arg;
3689  int32_t (*fip)(void *, void *);
3690  void *fip_arg;
3691 
3692  ocs_dma_t bmbx;
3693 #if defined(OCS_INCLUDE_DEBUG)
3694  /* Save pointer to physical memory descriptor for non-embedded SLI_CONFIG
3695  * commands for BMBX dumping purposes */
3696  ocs_dma_t *bmbx_non_emb_pmd;
3697 #endif
3698 
3699  struct {
3700  ocs_dma_t data;
3701  uint32_t length;
3702  } vpd;
3703 
3704  struct {
3705  uint32_t err1;
3706  uint32_t err2;
3707  } pause_errx_pair[SLI4_PAUSE_ERRX_PAIR_CNT];
3708 } sli4_t;
3709 
3710 /**
3711  * Get / set parameter functions
3712  */
3713 static inline uint32_t
3715 {
3716  if (rsrc >= SLI_RSRC_MAX) {
3717  return 0;
3718  }
3719 
3720  return sli4->config.extent[rsrc].size;
3721 }
3722 
3723 static inline uint32_t
3725 {
3726  if (qtype >= SLI_QTYPE_MAX) {
3727  return 0;
3728  }
3729  return sli4->config.max_qcount[qtype];
3730 }
3731 
3732 static inline uint32_t
3734 {
3735 
3736  return sli4->config.max_qentries[qtype];
3737 }
3738 
3739 static inline uint32_t
3741 {
3742  return sli4->config.sge_supported_length;
3743 }
3744 
3745 static inline uint32_t
3747 {
3748 
3749  if (sli4->config.sgl_page_sizes != 1) {
3750  ocs_log_test(sli4->os, "unsupported SGL page sizes %#x\n",
3751  sli4->config.sgl_page_sizes);
3752  return 0;
3753  }
3754 
3755  return ((sli4->config.max_sgl_pages * SLI_PAGE_SIZE) / sizeof(sli4_sge_t));
3756 }
3757 
3758 static inline sli4_link_medium_e
3760 {
3761  switch (sli4->config.topology) {
3763  return SLI_LINK_MEDIUM_ETHERNET;
3764  case SLI4_READ_CFG_TOPO_FC:
3767  return SLI_LINK_MEDIUM_FC;
3768  default:
3769  return SLI_LINK_MEDIUM_MAX;
3770  }
3771 }
3772 
3773 static inline void
3774 sli_skh_chain_sge_build(sli4_t *sli4, sli4_sge_t *sge, uint32_t xri_index, uint32_t frag_num, uint32_t offset)
3775 {
3777 
3778 
3779  ocs_memset(sge, 0, sizeof(*sge));
3781  sge->buffer_address_high = (uint32_t)cparms->chain_sge_initial_value_hi;
3782  sge->buffer_address_low =
3783  (uint32_t)((cparms->chain_sge_initial_value_lo |
3784  (((uintptr_t)(xri_index & cparms->sgl_index_field_mask)) <<
3785  cparms->sgl_index_field_offset) |
3786  (((uintptr_t)(frag_num & cparms->frag_num_field_mask)) <<
3787  cparms->frag_num_field_offset) |
3788  offset) >> 3);
3789 }
3790 
3791 static inline uint32_t
3793 {
3794  return sli4->sli_rev;
3795 }
3796 
3797 static inline uint32_t
3799 {
3800  return sli4->sli_family;
3801 }
3802 
3803 static inline uint32_t
3805 {
3806  return sli4->if_type;
3807 }
3808 
3809 static inline void *
3811 {
3812  return sli4->config.wwpn;
3813 }
3814 
3815 static inline void *
3817 {
3818  return sli4->config.wwnn;
3819 }
3820 
3821 static inline void *
3823 {
3824  return sli4->vpd.data.virt;
3825 }
3826 
3827 static inline uint32_t
3829 {
3830  return sli4->vpd.length;
3831 }
3832 
3833 static inline uint32_t
3834 sli_get_fw_revision(sli4_t *sli4, uint32_t which)
3835 {
3836  return sli4->config.fw_rev[which];
3837 }
3838 
3839 static inline void *
3840 sli_get_fw_name(sli4_t *sli4, uint32_t which)
3841 {
3842  return sli4->config.fw_name[which];
3843 }
3844 
3845 static inline char *
3847 {
3848  return sli4->config.ipl_name;
3849 }
3850 
3851 static inline uint32_t
3852 sli_get_hw_revision(sli4_t *sli4, uint32_t which)
3853 {
3854  return sli4->config.hw_rev[which];
3855 }
3856 
3857 static inline uint32_t
3859 {
3860  return sli4->config.auto_xfer_rdy;
3861 }
3862 
3863 static inline uint32_t
3865 {
3866  return sli4->config.tow;
3867 }
3868 
3869 static inline uint32_t sli_get_tow_xris_max(sli4_t *sli4)
3870 {
3871  return sli4->config.max_tow_xris;
3872 }
3873 
3874 static inline uint32_t sli_get_xib_capable(sli4_t *sli4)
3875 {
3876  return sli4->config.xib_capable;
3877 }
3878 
3879 static inline uint32_t sli_get_suppress_rsp_not_supported(sli4_t *sli4)
3880 {
3881  return sli4->config.suppress_rsp_not_supported;
3882 }
3883 
3884 static inline uint32_t
3886 {
3887  return sli4->config.features.flag.dif;
3888 }
3889 
3890 static inline uint32_t
3892 {
3893  return sli_get_dif_capable(sli4) && sli4->config.t10_dif_inline_capable;
3894 }
3895 
3896 static inline uint32_t
3898 {
3899  return sli_get_dif_capable(sli4) && sli4->config.t10_dif_separate_capable;
3900 }
3901 
3902 static inline uint32_t
3904 {
3905  return sli4->config.dual_ulp_capable;
3906 }
3907 
3908 static inline uint32_t
3910 {
3912 }
3913 
3914 static inline uint32_t
3915 sli_get_is_ulp_enabled(sli4_t *sli4, uint16_t ulp)
3916 {
3917  return sli4->config.is_ulp_fc[ulp];
3918 }
3919 
3920 static inline uint32_t
3922 {
3923  return sli4->config.features.flag.hlm;
3924 }
3925 
3926 static inline int32_t
3927 sli_set_hlm(sli4_t *sli4, uint32_t value)
3928 {
3929  if (value && !sli4->config.features.flag.hlm) {
3930  ocs_log_test(sli4->os, "HLM not supported\n");
3931  return -1;
3932  }
3933 
3934  sli4->config.high_login_mode = value != 0 ? TRUE : FALSE;
3935 
3936  return 0;
3937 }
3938 
3939 static inline uint32_t
3941 {
3942  return sli4->config.high_login_mode;
3943 }
3944 
3945 static inline uint32_t
3947 {
3948  return (sli4->if_type == SLI4_IF_TYPE_LANCER_G7 ? TRUE : FALSE);
3949 }
3950 
3951 static inline int32_t
3952 sli_set_dpp(sli4_t *sli4, uint32_t value)
3953 {
3954  if (value && (sli4->if_type != SLI4_IF_TYPE_LANCER_G7)) {
3955  ocs_log_test(sli4->os, "DPP not supported\n");
3956  return -1;
3957  }
3958 
3959  sli4->config.dpp = value != 0 ? TRUE : FALSE;
3960 
3961  return 0;
3962 }
3963 
3964 static inline uint32_t
3966 {
3967  return sli4->config.dpp;
3968 }
3969 
3970 static inline uint32_t
3972 {
3974 }
3975 
3976 static inline uint32_t
3978 {
3979  return sli4->config.sgl_pre_registered;
3980 }
3981 
3982 static inline int32_t
3983 sli_set_sgl_preregister(sli4_t *sli4, uint32_t value)
3984 {
3985  if ((value == 0) && sli4->config.sgl_pre_registration_required) {
3986  ocs_log_test(sli4->os, "SGL pre-registration required\n");
3987  return -1;
3988  }
3989 
3990  sli4->config.sgl_pre_registered = value != 0 ? TRUE : FALSE;
3991 
3992  return 0;
3993 }
3994 
3995 static inline sli4_asic_type_e
3997 {
3998  return sli4->asic_type;
3999 }
4000 
4001 static inline sli4_asic_rev_e
4003 {
4004  return sli4->asic_rev;
4005 }
4006 
4007 static inline int32_t
4008 sli_set_topology(sli4_t *sli4, uint32_t value)
4009 {
4010  int32_t rc = 0;
4011 
4012  switch (value) {
4014  case SLI4_READ_CFG_TOPO_FC:
4017  sli4->config.topology = value;
4018  break;
4019  default:
4020  ocs_log_test(sli4->os, "unsupported topology %#x\n", value);
4021  rc = -1;
4022  }
4023 
4024  return rc;
4025 }
4026 
4027 static inline uint16_t
4029 {
4030  return sli4->config.link_module_type;
4031 }
4032 
4033 static inline uint32_t
4035 {
4036  return sli4->config.port_number;
4037 }
4038 
4039 static inline char *
4041 {
4042  return sli4->config.bios_version_string;
4043 }
4044 
4045 static inline uint32_t
4046 sli_convert_mask_to_count(uint32_t method, uint32_t mask)
4047 {
4048  uint32_t count = 0;
4049 
4050  if (method) {
4051  count = 1 << ocs_lg2(mask);
4052  count *= 16;
4053  } else {
4054  count = mask;
4055  }
4056 
4057  return count;
4058 }
4059 
4060 /**
4061  * @brief Common Create Queue function prototype
4062  */
4063 typedef int32_t (*sli4_create_q_fn_t)(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, uint16_t);
4064 
4065 /**
4066  * @brief Common Destroy Queue function prototype
4067  */
4068 typedef int32_t (*sli4_destroy_q_fn_t)(sli4_t *, void *, size_t, uint16_t);
4069 
4070 
4071 /****************************************************************************
4072  * Function prototypes
4073  */
4074 extern int32_t sli_cmd_config_auto_xfer_rdy(sli4_t *, void *, size_t, uint32_t);
4075 extern int32_t sli_cmd_config_auto_xfer_rdy_hp(sli4_t *, void *, size_t, uint32_t, uint32_t);
4076 extern int32_t sli_cmd_config_optimized_write(sli4_t *, void *, size_t, uint32_t, uint32_t, uint32_t);
4077 extern int32_t sli_cmd_config_optimized_write_hp(sli4_t *, void *, size_t,
4078  uint32_t, uint32_t, uint32_t, uint32_t);
4079 extern int32_t sli_cmd_config_link(sli4_t *, void *, size_t);
4080 extern int32_t sli_cmd_down_link(sli4_t *, void *, size_t);
4081 extern int32_t sli_cmd_dump_type4(sli4_t *, void *, size_t, uint16_t);
4082 extern int32_t sli_cmd_common_read_transceiver_data(sli4_t *, void *, size_t, uint32_t, ocs_dma_t *);
4083 extern int32_t sli_cmd_read_link_stats(sli4_t *, void *, size_t,uint8_t, uint8_t, uint8_t);
4084 extern int32_t sli_cmd_read_status(sli4_t *sli4, void *buf, size_t size, uint8_t clear_counters);
4085 extern int32_t sli_cmd_init_link(sli4_t *, void *, size_t, uint32_t, uint8_t);
4086 extern int32_t sli_cmd_init_vfi(sli4_t *, void *, size_t, uint16_t, uint16_t, uint16_t);
4087 extern int32_t sli_cmd_init_vpi(sli4_t *, void *, size_t, uint16_t, uint16_t);
4088 extern int32_t sli_cmd_post_xri(sli4_t *, void *, size_t, uint16_t, uint16_t);
4089 extern int32_t sli_cmd_release_xri(sli4_t *, void *, size_t, uint8_t);
4090 extern int32_t sli_cmd_read_sparm64(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t);
4091 extern int32_t sli_cmd_read_topology(sli4_t *, void *, size_t, ocs_dma_t *);
4092 extern int32_t sli_cmd_read_config(sli4_t *, void *, size_t);
4093 extern int32_t sli_cmd_read_nvparms(sli4_t *, void *, size_t);
4094 extern int32_t sli_cmd_write_nvparms(sli4_t *, void *, size_t, uint8_t *, uint8_t *, uint8_t, uint32_t);
4095 typedef struct {
4096  uint16_t rq_id;
4097  uint8_t r_ctl_mask;
4098  uint8_t r_ctl_match;
4099  uint8_t type_mask;
4100  uint8_t type_match;
4102  uint8_t protocol;
4103  uint8_t filtermask;
4104  bool is_mrq;
4105  uint8_t mrq_set_count;
4106  uint8_t mrq_policy;
4107  uint8_t mrq_set_num;
4109 
4110 extern int32_t sli_cmd_reg_fcfi(sli4_t *, void *, size_t, uint16_t,
4112 extern int32_t sli_cmd_reg_fcfi_mrq(sli4_t *, void *, size_t, uint8_t, uint16_t, uint16_t, sli4_cmd_rq_cfg_t *);
4113 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, uint8_t);
4114 extern int32_t sli_cmd_reg_vfi(sli4_t *, void *, size_t, ocs_domain_t *);
4115 extern int32_t sli_cmd_reg_vpi(sli4_t *, void *, size_t, ocs_sli_port_t *, uint8_t);
4116 extern int32_t sli_cmd_sli_config(sli4_t *, void *, size_t, uint32_t, ocs_dma_t *);
4117 extern int32_t sli_cmd_unreg_fcfi(sli4_t *, void *, size_t, uint16_t);
4118 extern int32_t sli_cmd_unreg_rpi(sli4_t *, void *, size_t, uint16_t, sli4_resource_e, uint32_t);
4119 extern int32_t sli_cmd_unreg_vfi(sli4_t *, void *, size_t, ocs_domain_t *, uint32_t);
4120 extern int32_t sli_cmd_unreg_vpi(sli4_t *, void *, size_t, uint16_t, uint32_t);
4121 extern int32_t sli_cmd_common_nop(sli4_t *, void *, size_t, uint64_t);
4122 extern int32_t sli_cmd_common_get_resource_extent_info(sli4_t *, void *, size_t, uint16_t);
4123 extern int32_t sli_cmd_common_get_sli4_parameters(sli4_t *, void *, size_t);
4124 extern int32_t sli_cmd_common_write_object(sli4_t *, void *, size_t,
4125  uint16_t, uint16_t, uint32_t, uint32_t, char *, ocs_dma_t *);
4126 extern int32_t sli_cmd_common_delete_object(sli4_t *, void *, size_t, char *);
4127 extern int32_t sli_cmd_common_read_object(sli4_t *, void *, size_t, uint32_t,
4128  uint32_t, char *, ocs_dma_t *);
4129 extern int32_t sli_cmd_dmtf_exec_clp_cmd(sli4_t *sli4, void *buf, size_t size,
4130  ocs_dma_t *cmd,
4131  ocs_dma_t *resp);
4132 extern int32_t sli_cmd_common_set_dump_location(sli4_t *sli4, void *buf, size_t size,
4133  uint8_t query, uint8_t is_buffer_list,
4134  ocs_dma_t *buffer, uint8_t fdb);
4135 int32_t
4136 sli_cmd_config_run_biu_diag(sli4_t *sli4, void *buf, size_t size,
4137  ocs_dma_t *tx_buffer, size_t tx_buf_len,
4138  ocs_dma_t *rx_buffer, size_t rx_buf_len);
4139 extern int32_t sli_cmd_fcoe_set_loopback_mode(sli4_t *sli4, void *buf, size_t size, int type);
4140 extern int32_t sli_cmd_fc_set_trunk_mode(sli4_t *sli4, void *buf, size_t size, uint32_t trunk_mode);
4141 extern int32_t sli_cmd_common_set_features(sli4_t *, void *, size_t, uint32_t, uint32_t, void*);
4142 extern int32_t sli_cmd_common_get_profile_list(sli4_t *sli4, void *buf,
4143  size_t size, uint32_t start_profile_index, ocs_dma_t *dma);
4144 extern int32_t sli_cmd_common_get_active_profile(sli4_t *sli4, void *buf,
4145  size_t size);
4146 extern int32_t sli_cmd_common_set_active_profile(sli4_t *sli4, void *buf,
4147  size_t size,
4148  uint32_t fd,
4149  uint32_t active_profile_id);
4150 extern int32_t sli_cmd_common_get_reconfig_link_info(sli4_t *sli4, void *buf,
4151  size_t size, ocs_dma_t *dma);
4152 extern int32_t sli_cmd_common_set_reconfig_link_id(sli4_t *sli4, void *buf,
4153  size_t size, ocs_dma_t *dma,
4154  uint32_t fd, uint32_t active_link_config_id);
4155 extern int32_t sli_cmd_common_get_function_config(sli4_t *sli4, void *buf,
4156  size_t size);
4157 extern int32_t sli_cmd_common_get_profile_config(sli4_t *sli4, void *buf,
4158  size_t size, ocs_dma_t *dma);
4159 extern int32_t sli_cmd_common_set_profile_config(sli4_t *sli4, void *buf,
4160  size_t size, ocs_dma_t *dma,
4161  uint8_t profile_id, uint32_t descriptor_count,
4162  uint8_t isap);
4163 
4164 extern int32_t sli_cqe_mq(void *);
4165 extern int32_t sli_cqe_async(sli4_t *, void *);
4166 
4167 extern int32_t sli_setup(sli4_t *, ocs_os_handle_t, sli4_port_type_e);
4168 extern void sli_calc_max_qentries(sli4_t *sli4);
4169 extern int32_t sli_init(sli4_t *);
4170 extern int32_t sli_reset(sli4_t *);
4171 extern int32_t sli_fw_reset(sli4_t *);
4172 extern int32_t sli_port_migration(sli4_t *);
4173 extern int32_t sli_teardown(sli4_t *);
4174 extern int32_t sli_callback(sli4_t *, sli4_callback_e, void *, void *);
4175 extern int32_t sli_bmbx_command(sli4_t *);
4176 extern int32_t __sli_queue_init(sli4_t *, sli4_queue_t *, uint32_t, size_t, uint32_t, uint32_t);
4177 extern int32_t __sli_create_queue(sli4_t *, sli4_queue_t *);
4178 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);
4179 extern int32_t sli_queue_alloc(sli4_t *, uint32_t, sli4_queue_t *, uint32_t, sli4_queue_t *, uint16_t);
4180 extern int32_t sli_cq_alloc_set(sli4_t *, sli4_queue_t *qs[], uint32_t, uint32_t, sli4_queue_t *eqs[]);
4181 extern int32_t sli_get_queue_entry_size(sli4_t *, uint32_t);
4182 extern int32_t sli_queue_free(sli4_t *, sli4_queue_t *, uint32_t, uint32_t);
4183 extern int32_t sli_queue_reset(sli4_t *, sli4_queue_t *);
4184 extern int32_t sli_queue_is_empty(sli4_t *, sli4_queue_t *);
4185 extern int32_t sli_queue_eq_arm(sli4_t *, sli4_queue_t *, uint8_t);
4186 extern int32_t sli_queue_arm(sli4_t *, sli4_queue_t *, uint8_t);
4187 extern int32_t _sli_queue_write(sli4_t *, sli4_queue_t *, uint8_t *);
4188 extern int32_t sli_queue_write(sli4_t *, sli4_queue_t *, uint8_t *);
4189 extern int32_t sli_queue_read(sli4_t *, sli4_queue_t *, uint8_t *);
4190 extern int32_t sli_queue_index(sli4_t *, sli4_queue_t *);
4191 extern int32_t _sli_queue_poke(sli4_t *, sli4_queue_t *, uint32_t, uint8_t *);
4192 extern int32_t sli_queue_poke(sli4_t *, sli4_queue_t *, uint32_t, uint8_t *);
4193 extern int32_t sli_resource_alloc(sli4_t *, sli4_resource_e, uint32_t *, uint32_t *);
4194 extern int32_t sli_resource_free(sli4_t *, sli4_resource_e, uint32_t);
4195 extern int32_t sli_resource_reset(sli4_t *, sli4_resource_e);
4196 extern int32_t sli_eq_parse(sli4_t *, uint8_t *, uint16_t *);
4197 extern int32_t sli_cq_parse(sli4_t *, sli4_queue_t *, uint8_t *, sli4_qentry_e *, uint16_t *);
4198 
4199 extern int32_t sli_raise_ue(sli4_t *, uint8_t);
4200 extern int32_t sli_dump_is_ready(sli4_t *);
4201 extern int32_t sli_dump_is_present(sli4_t *);
4202 extern int32_t sli_reset_required(sli4_t *);
4203 extern int32_t sli_fw_error_status(sli4_t *);
4204 extern int32_t sli_fw_ready(sli4_t *);
4205 extern uint32_t sli_reg_read(sli4_t *, sli4_regname_e);
4206 extern void sli_reg_write(sli4_t *, sli4_regname_e, uint32_t);
4207 extern int32_t sli_link_is_configurable(sli4_t *);
4208 extern int32_t sli_is_paused(sli4_t *sli4);
4209 void sli_validate_pause_errors(sli4_t *slit, uint32_t *skip_dump);
4210 
4211 #endif /* !_SLI4_H */
4212 
4213 /* vim: set noexpandtab textwidth=120: */
uint32_t sgl_page_sizes
Definition: sli4.h:3674
sli4_mbox_command_header_t hdr
Definition: sli4.h:980
uint32_t chain_sge_initial_value_hi
Definition: sli4.h:3556
READ_STATUS - read tx/rx status of a particular port.
Definition: sli4.h:1278
Mailbox Completion Queue Entry.
Definition: sli4.h:3324
int32_t sli_cmd_read_link_stats(sli4_t *sli4, void *buf, size_t size, uint8_t req_ext_counters, uint8_t clear_overflow_flags, uint8_t clear_all_counters)
Write a READ_LINK_STAT command to the provided buffer.
Definition: sli4.c:679
uint32_t tow
Definition: sli4.h:3654
int32_t sli_cmd_down_link(sli4_t *sli4, void *buf, size_t size)
Write a DOWN_LINK command to the provided buffer.
Definition: sli4.c:577
ocs_os_handle_t os
Definition: sli4.h:3602
uint32_t sge_type
Definition: sli4.h:501
uint32_t buffer_length
Definition: sli4.h:504
char ipl_name[16]
Definition: sli4.h:3630
COMMON_DELETE_OBJECT.
Definition: sli4.h:2659
uint32_t uint32_t sge_supported_length
Definition: sli4.h:3654
int32_t sli_cmd_read_status(sli4_t *sli4, void *buf, size_t size, uint8_t clear_counters)
Write a READ_STATUS command to the provided buffer.
Definition: sli4.c:707
int32_t sli_cmd_common_nop(sli4_t *sli4, void *buf, size_t size, uint64_t context)
Write a COMMON_NOP command.
Definition: sli4.c:2628
uint32_t physical_port
Definition: sli4.h:3611
uint32_t event_tag
Definition: sli4.h:982
sli4_port_type_e port_type
Definition: sli4.h:3603
uint32_t ref_tag_cmp
Definition: sli4.h:531
int32_t sli_cmd_write_nvparms(sli4_t *sli4, void *buf, size_t size, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id)
Write a WRITE_NVPARMS command to the provided buffer.
Definition: sli4.c:1007
UNREG_RPI - unregister one or more RPI.
Definition: sli4.h:1412
uint32_t rsvd11
Definition: sli4.h:834
static uint32_t sli_get_hlm_capable(sli4_t *sli4)
Definition: sli4.h:3921
char bios_version_string[32]
Definition: sli4.h:3635
void * fip_arg
Definition: sli4.h:3690
Generic Common Create EQ/CQ/MQ/WQ/RQ Queue completion.
Definition: sli4.h:1831
uint32_t empty_xri_pool_count
Definition: sli4.h:1297
uint32_t length
Definition: sli4.h:3701
int32_t sli_cmd_common_read_transceiver_data(sli4_t *sli4, void *buf, size_t size, uint32_t page_num, ocs_dma_t *dma)
Write a COMMON_READ_TRANSCEIVER_DATA command.
Definition: sli4.c:629
REG_RPI - register a Remote Port Indicator.
Definition: sli4.h:1125
sli4_qtype_e
Definition: sli4.h:3423
static uint32_t sli_eq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
Definition: sli4.h:214
uint16_t e_d_tov
Definition: sli4.h:3614
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:6283
static uint32_t sli_get_is_ulp_enabled(sli4_t *sli4, uint16_t ulp)
Definition: sli4.h:3915
int32_t sli_queue_poke(sli4_t *sli4, sli4_queue_t *q, uint32_t index, uint8_t *entry)
Definition: sli4.c:5801
uint32_t uint32_t timeout
Definition: sli4.h:1668
uint16_t link_module_type
Definition: sli4.h:3621
sli4_mbox_command_header_t hdr
Definition: sli4.h:883
COMMON_EXT_FAT_READ_STRING_TABLE.
Definition: sli4.h:2547
static uint32_t sli_get_max_sgl(sli4_t *sli4)
Definition: sli4.h:3746
uint32_t second_fw_id
Definition: sli4.h:922
uint32_t rsvd1
Definition: sli4.h:1400
int32_t sli_cmd_common_set_dump_location(sli4_t *sli4, void *buf, size_t size, uint8_t query, uint8_t is_buffer_list, ocs_dma_t *buffer, uint8_t fdb)
Write a COMMON_SET_DUMP_LOCATION command.
Definition: sli4.c:3031
uint32_t n_alloc
Definition: sli4.h:3648
uint8_t enabled
Definition: sli4.h:3478
uint16_t size
Definition: sli4.h:3453
sli4_mbox_command_header_t hdr
Definition: sli4.h:864
sli4_mbox_command_header_t hdr
Definition: sli4.h:902
INIT_VFI - initialize the VFI resource.
Definition: sli4.h:733
int32_t sli_cq_parse(sli4_t *sli4, sli4_queue_t *cq, uint8_t *cqe, sli4_qentry_e *etype, uint16_t *q_id)
Parse a CQ entry to retrieve the event type and the associated queue.
Definition: sli4.c:6046
uint32_t sli_family
Definition: sli4.h:3606
uint8_t filtermask
Definition: sli4.h:4103
int32_t sli_dump_is_ready(sli4_t *sli4)
Read the SLIPORT_STATUS register to to check if a dump is present.
Definition: sli4.c:6142
uint16_t sgl_index_field_offset
Definition: sli4.h:3552
#define SLI4_MAX_ULP
Definition: sli4.h:3189
uint32_t err2
Definition: sli4.h:3706
COMMON_CREATE_MQ_EXT.
Definition: sli4.h:1969
uint32_t mqe_tag_high
Definition: sli4.h:3329
#define SLI4_PAUSE_ERRX_PAIR_CNT
Definition: sli4.h:3498
uint32_t max_qentries[SLI_QTYPE_MAX]
Definition: sli4.h:3617
struct sli4_features_t::@35 flag
uint32_t clp_detailed_status
Definition: sli4.h:2911
uint32_t suppress_rsp_not_supported
Definition: sli4.h:3654
void sli_validate_pause_errors(sli4_t *sli4, uint32_t *skip_dump)
Definition: sli4.c:6400
static void * sli_get_wwn_port(sli4_t *sli4)
Definition: sli4.h:3810
static uint32_t sli_is_dif_separate_capable(sli4_t *sli4)
Definition: sli4.h:3897
int32_t sli_cmd_init_link(sli4_t *sli4, void *buf, size_t size, uint32_t speed, uint8_t reset_alpa)
Write an INIT_LINK command to the provided buffer.
Definition: sli4.c:772
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:5044
sli4_bde_t bde_64
Definition: sli4.h:944
uint32_t total_exchanges_originator
Definition: sli4.h:1290
uint32_t receive_frame_count
Definition: sli4.h:1287
Event Queue Entry.
Definition: sli4.h:3305
uint8_t p3_linkstate
Definition: sli4.h:3366
sli4_qentry_e
Definition: sli4.h:3436
COMMON_QUERY_FW_CONFIG.
Definition: sli4.h:2333
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:3202
#define SLI4_READ_CFG_TOPO_FC_DA
Definition: sli4.h:857
sli4_sli_config_pmd_t mem
Definition: sli4.h:1266
#define SLI4_READ_CFG_TOPO_FCOE
Definition: sli4.h:855
uint32_t hw_rev[3]
Definition: sli4.h:3631
uint8_t mrq_set_count
Definition: sli4.h:4105
static uint32_t sli_get_fw_revision(sli4_t *sli4, uint32_t which)
Definition: sli4.h:3834
uint8_t dual_ulp_capable
Definition: sli4.h:3636
int32_t sli_setup(sli4_t *sli4, ocs_os_handle_t os, sli4_port_type_e port_type)
Set up the SLI context.
Definition: sli4.c:4452
static uint32_t sli_iftype6_eq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
Definition: sli4.h:268
#define SLI4_CMD_REG_FCFI_NUM_RQ_CFG
REG_FCFI - activate a FC Forwarder.
Definition: sli4.h:1041
static int32_t sli_set_dpp(sli4_t *sli4, uint32_t value)
Definition: sli4.h:3952
sli4_mbox_command_header_t hdr
Definition: sli4.h:1178
int32_t sli_cmd_config_optimized_write_hp(sli4_t *sli4, void *buf, size_t size, uint32_t max_burst_len, uint32_t xri_cnt, uint32_t block_size, uint32_t tow_feature)
Write an CONFIG_OPTIMIZED_WRITE_HP command to the provided buffer.
Definition: sli4.c:1849
uint32_t sgl_pre_registered
Definition: sli4.h:3654
sli4_mbox_command_header_t hdr
Definition: sli4.h:1565
UNREG_VFI - unregister one or more VFI.
Definition: sli4.h:1434
COMMON_NOP.
Definition: sli4.h:2149
uint16_t db_offset
Definition: sli4.h:3480
uint32_t uint32_t rsvd9
Definition: sli4.h:1981
INIT_VPI - initialize the VPI resource.
Definition: sli4.h:757
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:5645
static uint32_t sli_iftype6_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
Definition: sli4.h:291
uint32_t rset
Definition: sli4.h:3419
sli4_sgl_chaining_params_t sgl_chaining_params
Definition: sli4.h:3677
uint32_t posted_limit
Definition: sli4.h:3461
#define SLI_PAGE_SIZE
Definition: sli4.h:43
COMMON_MANAGE_FAT.
Definition: sli4.h:2455
uint32_t rsvd2
Definition: sli4.h:478
sli4_req_hdr_t hdr
Definition: sli4.h:3248
Common Destroy CQ.
Definition: sli4.h:1879
ocs_dma_t data
Definition: sli4.h:3700
sli4_res_hdr_t hdr
Definition: sli4.h:1846
T10 DIF Seed Scatter-Gather Entry (SGE)
Definition: sli4.h:529
uint8_t wwpn[8]
Definition: sli4.h:3626
uint32_t nvme_max_data_len
Definition: sli4.h:1524
static uint32_t sli_get_tow_capable(sli4_t *sli4)
Definition: sli4.h:3864
static void sli_queue_lock(sli4_queue_t *q)
Definition: sli4.h:3487
int32_t sli_queue_free(sli4_t *sli4, sli4_queue_t *q, uint32_t destroy_queues, uint32_t free_memory)
Free a queue.
Definition: sli4.c:5335
uint32_t index
Definition: sli4.h:3452
uint32_t rsvd4
Definition: sli4.h:1262
int32_t sli_fw_ready(sli4_t *sli4)
Determine if the chip FW is in a ready state.
Definition: sli4.c:6332
sli4_features_t response
Definition: sli4.h:1234
int32_t sli_queue_reset(sli4_t *sli4, sli4_queue_t *q)
Definition: sli4.c:5429
sli4_resource_e
Definition: sli4.h:3564
uint8_t mrq_set_num
Definition: sli4.h:4107
static uint32_t sli_convert_mask_to_count(uint32_t method, uint32_t mask)
Definition: sli4.h:4046
static uint32_t sli_is_dif_inline_capable(sli4_t *sli4)
Definition: sli4.h:3891
DMTF_EXEC_CLP_CMD.
Definition: sli4.h:2887
int32_t sli_resource_alloc(sli4_t *sli4, sli4_resource_e rtype, uint32_t *rid, uint32_t *index)
Allocate SLI Port resources.
Definition: sli4.c:5851
READ_SPARM64 - read the Port service parameters.
Definition: sli4.h:939
int32_t sli_cmd_unreg_rpi(sli4_t *sli4, void *buf, size_t size, uint16_t indicator, sli4_resource_e which, uint32_t fc_id)
Write an UNREG_RPI command to the provided buffer.
Definition: sli4.c:1601
int32_t sli_cmd_post_xri(sli4_t *sli4, void *buf, size_t size, uint16_t xri_base, uint16_t xri_count)
Write a POST_XRI command to the provided buffer.
Definition: sli4.c:909
int32_t sli_queue_is_empty(sli4_t *sli4, sli4_queue_t *q)
Check if the given queue is empty.
Definition: sli4.c:5463
sli4_mbox_command_header_t hdr
Definition: sli4.h:791
int32_t sli_cmd_fc_set_trunk_mode(sli4_t *sli4, void *buf, size_t size, uint32_t trunk_mode)
Write a SLI4_OPC_FC_SET_TRUNK_MODE command.
Definition: sli4.c:3165
uint32_t actual_response_length
Definition: sli4.h:1692
uint32_t buffer_address_high
Definition: sli4.h:565
uint8_t protocol
Definition: sli4.h:4102
uint32_t uint32_t read_offset
Definition: sli4.h:2604
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:263
uint32_t dropped_frames_due_to_no_rq_buffer_count
Definition: sli4.h:1294
sli4_res_hdr_t hdr
Definition: sli4.h:2902
int32_t sli_cmd_reg_fcfi(sli4_t *sli4, void *buf, size_t size, uint16_t index, sli4_cmd_rq_cfg_t rq_cfg[SLI4_CMD_REG_FCFI_NUM_RQ_CFG], uint16_t vlan_id)
Write a REG_FCFI command to the provided buffer.
Definition: sli4.c:1148
uint32_t e_d_tov
Definition: sli4.h:1163
sli4_req_hdr_t hdr
Definition: sli4.h:1880
uint32_t receive_kbyte_count
Definition: sli4.h:1285
int32_t sli_resource_reset(sli4_t *sli4, sli4_resource_e rtype)
Definition: sli4.c:5960
int32_t sli_cqe_mq(void *buf)
Check the mailbox/queue completion entry.
Definition: sli4.c:3551
sli4_req_hdr_t hdr
Definition: sli4.h:1955
Common Destroy MQ.
Definition: sli4.h:2032
uint16_t r_a_tov
Definition: sli4.h:3615
sli4_mbox_command_header_t hdr
Definition: sli4.h:758
static sli4_link_medium_e sli_get_medium(sli4_t *sli4)
Definition: sli4.h:3759
sli4_mbox_command_header_t hdr
Definition: sli4.h:734
int32_t sli_cmd_config_optimized_write(sli4_t *sli4, void *buf, size_t size, uint32_t max_burst_len, uint32_t xri_cnt, uint32_t tow_feature)
Write an CONFIG_OPTIMIZED_WRITE command to the provided buffer.
Definition: sli4.c:1810
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:5720
static void * sli_get_wwn_node(sli4_t *sli4)
Definition: sli4.h:3816
uint32_t uint32_t physical_address_low
Definition: sli4.h:925
uint32_t returned_vpd_length
Definition: sli4.h:929
static uint32_t sli_get_max_sge(sli4_t *sli4)
Definition: sli4.h:3740
#define SLI4_READ_CFG_TOPO_FC
Definition: sli4.h:856
T10 DIF Scatter-Gather Entry (SGE)
Definition: sli4.h:513
int32_t sli_teardown(sli4_t *sli4)
Tear down a SLI context.
Definition: sli4.c:4743
uint32_t db_rset
Definition: sli4.h:3481
#define SLI4_EQCQ_CQ_ID_MASK_LO
Definition: sli4.h:167
sli4_req_hdr_t hdr
Definition: sli4.h:2033
int32_t sli_cmd_reg_fcfi_mrq(sli4_t *sli4, void *buf, size_t size, uint8_t mode, uint16_t fcf_index, uint16_t vlan_id, sli4_cmd_rq_cfg_t rq_cfg[SLI4_CMD_REG_FCFI_NUM_RQ_CFG])
Write REG_FCFI_MRQ to provided command buffer.
Definition: sli4.c:1193
int32_t sli_cmd_common_write_object(sli4_t *sli4, void *buf, size_t size, uint16_t noc, uint16_t eof, uint32_t desired_write_length, uint32_t offset, char *object_name, ocs_dma_t *dma)
Write a COMMON_WRITE_OBJECT command.
Definition: sli4.c:2831
uint32_t returned_byte_cnt
Definition: sli4.h:639
#define SLI4_EQCQ_EQ_ID_MASK_LO
Definition: sli4.h:166
uint16_t rq_id
Definition: sli4.h:4096
uint8_t r_ctl_match
Definition: sli4.h:4098
COMMON_GET_EXT_FAT_CAPABILITIES.
Definition: sli4.h:2471
sli4_asic_type_e
Definition: sli4.h:3580
READ_NVPARMS - read SLI port configuration parameters.
Definition: sli4.h:863
uint32_t ref_tag_repl
Definition: sli4.h:532
sli4_mbox_command_header_t hdr
Definition: sli4.h:632
static int32_t sli_set_sgl_preregister(sli4_t *sli4, uint32_t value)
Definition: sli4.h:3983
uint32_t rsvd3
Definition: sli4.h:820
uint32_t sli_rev
Definition: sli4.h:3605
static uint32_t sli_get_sgl_preregister_required(sli4_t *sli4)
Definition: sli4.h:3971
COMMON_READ_OBJECT.
Definition: sli4.h:2601
static uint32_t sli_get_max_queue(sli4_t *sli4, sli4_qtype_e qtype)
Definition: sli4.h:3724
uint32_t third_hw_revision
Definition: sli4.h:914
void sli_calc_max_qentries(sli4_t *sli4)
Calculate max queue entries.
Definition: sli4.c:3959
COMMON_MODIFY_EQ_DELAY.
Definition: sli4.h:1894
int32_t sli_link_is_configurable(sli4_t *sli)
Determine if the link can be configured.
Definition: sli4.c:6364
uint16_t ulp
Definition: sli4.h:3457
Common Destroy EQ.
Definition: sli4.h:1954
sli4_mbox_command_header_t hdr
Definition: sli4.h:940
struct sli4_t::@47 config
uint32_t doorbell_offset
Definition: sli4.h:3458
int32_t sli_resource_free(sli4_t *sli4, sli4_resource_e rtype, uint32_t rid)
Free the SLI Port resources.
Definition: sli4.c:5913
static uint32_t sli_get_dpp(sli4_t *sli4)
Definition: sli4.h:3965
uint8_t dpp
Definition: sli4.h:3679
static void * sli_get_fw_name(sli4_t *sli4, uint32_t which)
Definition: sli4.h:3840
int32_t sli_cqe_async(sli4_t *sli4, void *buf)
Check the asynchronous event completion entry.
Definition: sli4.c:3586
int32_t sli_cmd_config_auto_xfer_rdy(sli4_t *sli4, void *buf, size_t size, uint32_t max_burst_len)
Write an CONFIG_AUTO_XFER_RDY command to the provided buffer. Command to enable AXR in G5...
Definition: sli4.c:1748
static uint32_t sli_get_suppress_rsp_not_supported(sli4_t *sli4)
Definition: sli4.h:3879
static uint32_t sli_get_hlm(sli4_t *sli4)
Definition: sli4.h:3940
sli4_regname_e
Register name enums.
Definition: sli4.h:3396
Definition: sli4.h:3601
uint32_t uint32_t rsvd7
Definition: sli4.h:824
size_t wqe_size
Definition: sli4.h:3678
COMMON_SET_DUMP_LOCATION.
Definition: sli4.h:2690
sli4_mbox_command_header_t hdr
Definition: sli4.h:1533
int32_t sli_cmd_read_sparm64(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma, uint16_t vpi)
Write a READ_SPARM64 command to the provided buffer.
Definition: sli4.c:1067
sli4_req_hdr_t hdr
Definition: sli4.h:2602
ocs_lock_t lock
Definition: sli4.h:3451
int32_t sli_cmd_common_set_reconfig_link_id(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma, uint32_t fd, uint32_t active_link_config_id)
Write a COMMON_SET_RECONFIG_LINK_ID command.
Definition: sli4.c:3505
uint32_t uint32_t read_offset
Definition: sli4.h:2676
int32_t sli_port_migration(sli4_t *sli4)
Definition: sli4.c:4701
sli4_features_t features
Definition: sli4.h:3653
static uint32_t sli_get_max_qentries(sli4_t *sli4, sli4_qtype_e qtype)
Definition: sli4.h:3733
bool protocol_valid
Definition: sli4.h:4101
uint32_t host_buffer_descriptor_count
Definition: sli4.h:2638
sli4_mbox_command_header_t hdr
Definition: sli4.h:1435
int32_t sli_queue_eq_arm(sli4_t *sli4, sli4_queue_t *q, uint8_t arm)
Arm an EQ.
Definition: sli4.c:5492
AUTO_XFER_RDY - Configure the auto-generate XFER-RDY feature.
Definition: sli4.h:1479
int32_t sli_raise_ue(sli4_t *sli4, uint8_t dump)
Cause chip to enter an unrecoverable error state.
Definition: sli4.c:6092
sli4_req_hdr_t hdr
Definition: sli4.h:2888
Buffer Descriptor Entry (BDE)
Definition: sli4.h:467
ocs_lock_t lock
Definition: sli4.h:3645
sli4_req_hdr_t hdr
Definition: sli4.h:2456
uint32_t xib_capable
Definition: sli4.h:3654
COMMON_FUNCTION_RESET.
Definition: sli4.h:1705
uint32_t t10_dif_inline_capable
Definition: sli4.h:3654
uint32_t rsvd1
Definition: sli4.h:1180
uint32_t address_low
Definition: sli4.h:1247
sli4_mbox_command_header_t hdr
Definition: sli4.h:1490
static void sli_set_wq_id_association(void *entry, uint16_t q_id)
Format a WQE with WQ_ID Association performance hint.
Definition: sli4.h:1379
COMMON_GET_PORT_NAME.
Definition: sli4.h:2391
uint32_t rq_max_buf_size
Definition: sli4.h:3624
COMMON_GET_CNTL_ATTRIBUTES.
Definition: sli4.h:2109
static uint32_t sli_get_hw_revision(sli4_t *sli4, uint32_t which)
Definition: sli4.h:3852
COMMON_SET_PROFILE_CONFIG.
Definition: sli4.h:3029
void * link_arg
Definition: sli4.h:3688
int32_t sli_get_queue_entry_size(sli4_t *sli4, uint32_t qtype)
Get queue entry size.
Definition: sli4.c:4993
int32_t sli_cmd_reg_vpi(sli4_t *sli4, void *buf, size_t size, ocs_sli_port_t *sport, uint8_t update)
Write a REG_VPI command to the provided buffer.
Definition: sli4.c:1423
sli4_req_hdr_t hdr
Definition: sli4.h:1914
COMMON_GET_SLI4_PARAMETERS.
Definition: sli4.h:2201
sli4_mbox_command_header_t hdr
Definition: sli4.h:1043
uint32_t dword
Definition: sli4.h:1219
const uint8_t sli4_fw_initialize[]
FW_INITIALIZE - initialize a SLI port.
Definition: sli4.c:63
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:6000
sli4_mbox_command_header_t hdr
Definition: sli4.h:771
uint16_t phase
Definition: sli4.h:3465
static uint32_t sli_get_sli_rev(sli4_t *sli4)
Definition: sli4.h:3792
struct sli4_t::@47::@50 extent[SLI_RSRC_MAX]
Asynchronous Completion Queue Entry.
Definition: sli4.h:3347
uint32_t empty_rq_timeout_count
Definition: sli4.h:1295
static sli4_asic_rev_e sli_get_asic_rev(sli4_t *sli4)
Definition: sli4.h:4002
uint8_t type
Definition: sli4.h:3460
uint32_t t10_dif_separate_capable
Definition: sli4.h:3654
int32_t sli_cmd_common_get_resource_extent_info(sli4_t *sli4, void *buf, size_t size, uint16_t rtype)
Write a COMMON_GET_RESOURCE_EXTENT_INFO command.
Definition: sli4.c:2663
POST_XRI - post XRI resources to the SLI Port.
Definition: sli4.h:770
uint32_t dropped_frames_due_to_no_xri_count
Definition: sli4.h:1296
uint32_t rsvd4
Definition: sli4.h:913
static int32_t sli_set_topology(sli4_t *sli4, uint32_t value)
Definition: sli4.h:4008
sli4_mbox_command_header_t hdr
Definition: sli4.h:1254
uint32_t first_fw_id
Definition: sli4.h:920
static uint32_t sli_get_sgl_preregister(sli4_t *sli4)
Definition: sli4.h:3977
#define SLI4_READ_CFG_TOPO_FC_AL
Definition: sli4.h:858
uint32_t physical_address_high
Definition: sli4.h:928
sli4_bde_t sparm
Definition: sli4.h:1162
COMMON_READ_TRANSCEIVER_DATA.
Definition: sli4.h:2576
sli4_mbox_command_header_t hdr
Definition: sli4.h:810
sli4_asic_type_e asic_type
Definition: sli4.h:3609
int32_t sli_cmd_read_nvparms(sli4_t *sli4, void *buf, size_t size)
Write a READ_NVPARMS command to the provided buffer.
Definition: sli4.c:982
uint32_t high_login_mode
Definition: sli4.h:3654
int32_t sli_dump_is_present(sli4_t *sli4)
Read the SLIPORT_STATUS register to check if a dump is present.
Definition: sli4.c:6216
uint8_t p1_linkstate
Definition: sli4.h:3364
uint32_t uint32_t rsvd1
Definition: sli4.h:2949
uint32_t mqe_tag_low
Definition: sli4.h:3328
COMMON_GET_FUNCTION_CONFIG.
Definition: sli4.h:2992
uint32_t rsvd1
Definition: sli4.h:1462
struct sli4_t::@48 vpd
uint32_t r_a_tov
Definition: sli4.h:1164
uint16_t rq_min_buf_size
Definition: sli4.h:3623
static void sli_skh_chain_sge_build(sli4_t *sli4, sli4_sge_t *sge, uint32_t xri_index, uint32_t frag_num, uint32_t offset)
Definition: sli4.h:3774
uint32_t buffer_address_low
Definition: sli4.h:516
uint32_t rsvd5
Definition: sli4.h:1263
int32_t sli_cmd_sli_config(sli4_t *sli4, void *buf, size_t size, uint32_t length, ocs_dma_t *dma)
Write a SLI_CONFIG command to the provided buffer.
Definition: sli4.c:1485
uint32_t receive_f_bsy_count
Definition: sli4.h:1293
uint16_t length
Definition: sli4.h:3454
uint32_t rsvd7
Definition: sli4.h:919
COMMON_GET_PROFILE_CONFIG.
Definition: sli4.h:3009
uint32_t if_type
Definition: sli4.h:3607
uint16_t id
Definition: sli4.h:3456
sli4_link_medium_e
Definition: sli4.h:3529
uint32_t rsvd5
Definition: sli4.h:1185
static uint32_t sli_get_sli_family(sli4_t *sli4)
Definition: sli4.h:3798
COMMON_WRITE_FLASHROM.
Definition: sli4.h:2409
uint8_t mrq_policy
Definition: sli4.h:4106
uint32_t number
Definition: sli4.h:3646
REQUEST_FEATURES - request / query SLI features.
Definition: sli4.h:1196
int32_t(* sli4_create_q_fn_t)(sli4_t *, void *, size_t, ocs_dma_t *, uint16_t, uint16_t)
Common Create Queue function prototype.
Definition: sli4.h:4063
int32_t sli_cmd_fcoe_set_loopback_mode(sli4_t *sli4, void *buf, size_t size, int type)
Write a SLI4_OPC_FCOE_SET_LINK_DIAG_LOOPBACK command.
Definition: sli4.c:3126
ocs_bitmap_t * use_map
Definition: sli4.h:3650
int32_t sli_cmd_common_get_profile_list(sli4_t *sli4, void *buf, size_t size, uint32_t start_profile_index, ocs_dma_t *dma)
Write a COMMON_COMMON_GET_PROFILE_LIST command.
Definition: sli4.c:3333
AUTO_XFER_RDY - Configure the Target Optimized Write Feature.
Definition: sli4.h:1506
int32_t sli_cmd_common_read_object(sli4_t *sli4, void *buf, size_t size, uint32_t desired_read_length, uint32_t offset, char *object_name, ocs_dma_t *dma)
Write a COMMON_READ_OBJECT command.
Definition: sli4.c:2926
static uint32_t sli_get_vpd_len(sli4_t *sli4)
Definition: sli4.h:3828
static uint32_t sli_get_max_rsrc(sli4_t *sli4, sli4_resource_e rsrc)
Definition: sli4.h:3714
sli4_link_topology_e
Definition: sli4.h:3519
COMMON_READ_OBJECT_LIST.
Definition: sli4.h:2673
static char * sli_get_bios_version_string(sli4_t *sli4)
Definition: sli4.h:4040
WRITE_NVPARMS - write SLI port configuration parameters.
Definition: sli4.h:882
int32_t sli_queue_arm(sli4_t *sli4, sli4_queue_t *q, uint8_t arm)
Arm a queue.
Definition: sli4.c:5519
Fields retrieved from skyhawk that used used to build chained SGL.
Definition: sli4.h:3549
uint16_t n_posted
Definition: sli4.h:3455
uint32_t map_size
Definition: sli4.h:3651
int32_t sli_reset(sli4_t *sli4)
Definition: sli4.c:4611
sli4_callback_e
Definition: sli4.h:3504
int32_t sli_cmd_dmtf_exec_clp_cmd(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *cmd, ocs_dma_t *resp)
Write a DMTF_EXEC_CLP_CMD command.
Definition: sli4.c:2985
sli4_res_hdr_t hdr
Definition: sli4.h:3261
RELEASE_XRI - Release XRI resources from the SLI Port.
Definition: sli4.h:790
uint16_t doorbell_rset
Definition: sli4.h:3459
static void sli_queue_unlock(sli4_queue_t *q)
Definition: sli4.h:3493
int32_t sli_cq_alloc_set(sli4_t *sli4, sli4_queue_t *qs[], uint32_t num_cqs, uint32_t n_entries, sli4_queue_t *eqs[])
Allocate a c queue set.
Definition: sli4.c:5172
uint32_t max_tow_xris
Definition: sli4.h:3676
COMMON_GET_RESOURCE_EXTENT_INFO.
Definition: sli4.h:2170
uint32_t sgl_pre_registration_required
Definition: sli4.h:3654
COMMON_CREATE_CQ_SET_V0.
Definition: sli4.h:1788
uint32_t max_num_processed
Definition: sli4.h:3462
static uint32_t sli_get_dpp_capable(sli4_t *sli4)
Definition: sli4.h:3946
sli4_res_hdr_t hdr
Definition: sli4.h:2159
uint32_t rsvd1
Definition: sli4.h:1437
sli4_mbox_command_header_t hdr
Definition: sli4.h:1226
sli4_bde_t bde_64
Definition: sli4.h:1138
COMMON_GET_PROFILE_LIST.
Definition: sli4.h:3070
int32_t sli_cmd_common_get_profile_config(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma)
Write a COMMON_COMMON_GET_PROFILE_CONFIG command.
Definition: sli4.c:3243
COMMON_SET_LOOPBACK_MODE.
Definition: sli4.h:2717
sli4_bde_t bde_loop_map
Definition: sli4.h:994
sli4_mbox_command_header_t hdr
Definition: sli4.h:1069
sli4_port_state_t link_current
Definition: sli4.h:996
COMMON_GET_ACTIVE_PROFILE.
Definition: sli4.h:3093
UNREG_FCFI - unregister a FCFI.
Definition: sli4.h:1398
uint32_t address_high
Definition: sli4.h:1248
uint32_t sgl_segment_address_low
Definition: sli4.h:481
uint32_t err1
Definition: sli4.h:3705
static uint32_t sli_page_count(size_t bytes, uint32_t page_size)
Definition: sli4.h:53
uint32_t r_idx
Definition: sli4.h:3471
#define MAX_PRODUCT_DESCRIPTORS
Definition: sli4.h:3065
static sli4_asic_type_e sli_get_asic_type(sli4_t *sli4)
Definition: sli4.h:3996
static uint16_t sli_get_link_module_type(sli4_t *sli4)
Definition: sli4.h:4028
int32_t sli_cmd_config_auto_xfer_rdy_hp(sli4_t *sli4, void *buf, size_t size, uint32_t max_burst_len, uint32_t block_size)
Write an CONFIG_AUTO_XFER_RDY_HP command to the provided buffer.
Definition: sli4.c:1778
uint32_t event_data2
Definition: sli4.h:3367
int32_t sli_reset_required(sli4_t *sli4)
Read the SLIPORT_STATUS register to check if the reset required is set.
Definition: sli4.c:6253
uint8_t fw_name[2][16]
Definition: sli4.h:3629
COMMON_EXT_FAT_CONFIGURE_SNAPSHOT.
Definition: sli4.h:2503
uint32_t sli_reg_read(sli4_t *sli, sli4_regname_e reg)
Read the given SLI register.
Definition: sli4.c:240
uint32_t last_processed_time
Definition: sli4.h:3464
int32_t sli_cmd_common_delete_object(sli4_t *sli4, void *buf, size_t size, char *object_name)
Write a COMMON_DELETE_OBJECT command.
Definition: sli4.c:2887
uint32_t buffer_address_low
Definition: sli4.h:500
int32_t sli_cmd_common_get_function_config(sli4_t *sli4, void *buf, size_t size)
#define SLI4_IF_TYPE_LANCER_G7
Definition: sli4.h:117
uint8_t type_match
Definition: sli4.h:4100
static uint32_t sli_get_is_sgl_chaining_capable(sli4_t *sli4)
Definition: sli4.h:3909
uint32_t actual_vpd_length
Definition: sli4.h:930
READ_TOPOLOGY - read the link event information.
Definition: sli4.h:979
uint32_t nvme_max_data_len
Definition: sli4.h:1553
int32_t __sli_create_queue(sli4_t *sli4, sli4_queue_t *q)
Issue the command to create a queue.
Definition: sli4.c:4893
uint32_t offset
Definition: sli4.h:477
sli4_port_state_t link_down
Definition: sli4.h:995
uint8_t rq_batch
Definition: sli4.h:3622
uint32_t buffer_address_low
Definition: sli4.h:566
sli4_mbox_command_header_t hdr
Definition: sli4.h:1507
int32_t __sli_queue_init(sli4_t *sli4, sli4_queue_t *q, uint32_t qtype, size_t size, uint32_t n_entries, uint32_t align)
Initialize a queue object.
Definition: sli4.c:4833
int32_t sli_fw_reset(sli4_t *sli4)
Issue a Firmware Reset.
Definition: sli4.c:4658
int32_t sli_cmd_reg_vfi(sli4_t *sli4, void *buf, size_t size, ocs_domain_t *domain)
Write a REG_VFI command to the provided buffer.
Definition: sli4.c:1353
#define SLI4_SGE_TYPE_CHAIN
Definition: sli4.h:590
static char * sli_get_ipl_name(sli4_t *sli4)
Definition: sli4.h:3846
int32_t _sli_queue_poke(sli4_t *sli4, sli4_queue_t *q, uint32_t index, uint8_t *entry)
Definition: sli4.c:5813
ocs_dma_t bmbx
Definition: sli4.h:3692
uint32_t rsvd4
Definition: sli4.h:1523
COMMON_SET_EXT_FAT_CAPABILITIES.
Definition: sli4.h:2483
int32_t sli_cmd_common_get_reconfig_link_info(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma)
Write a COMMON_GET_RECONFIG_LINK_INFO command.
Definition: sli4.c:3458
COMMON_CREATE_CQ_V2.
Definition: sli4.h:1751
uint32_t uint32_t uint32_t rsvd10
Definition: sli4.h:827
int32_t sli_cmd_unreg_vpi(sli4_t *sli4, void *buf, size_t size, uint16_t indicator, uint32_t which)
Write an UNREG_VPI command to the provided buffer.
Definition: sli4.c:1701
sli4_mbox_command_header_t hdr
Definition: sli4.h:1152
int32_t sli_cmd_common_set_active_profile(sli4_t *sli4, void *buf, size_t size, uint32_t fd, uint32_t active_profile_id)
Write a COMMON_COMMON_SET_ACTIVE_PROFILE command.
Definition: sli4.c:3416
uint8_t is_ulp_fc[2]
Definition: sli4.h:3637
uint32_t buffer_address_high
Definition: sli4.h:474
int32_t sli_cmd_common_get_active_profile(sli4_t *sli4, void *buf, size_t size)
Write a COMMON_COMMON_GET_ACTIVE_PROFILE command.
Definition: sli4.c:3376
uint8_t id
Definition: sli4.h:3479
#define MAX_LINK_CONFIG_DESCRIPTORS
Definition: sli4.h:3140
sli4_mbox_command_header_t hdr
Definition: sli4.h:1399
static int32_t sli_set_hlm(sli4_t *sli4, uint32_t value)
Definition: sli4.h:3927
int32_t sli_cmd_release_xri(sli4_t *sli4, void *buf, size_t size, uint8_t num_xri)
Write a RELEASE_XRI command to the provided buffer.
Definition: sli4.c:939
uint32_t uint32_t rsvd5
Definition: sli4.h:821
uint32_t index
Definition: sli4.h:3561
int32_t sli_cmd_read_config(sli4_t *sli4, void *buf, size_t size)
Write a READ_CONFIG command to the provided buffer.
Definition: sli4.c:961
uint8_t port_number
Definition: sli4.h:3632
uint32_t receive_p_bsy_count
Definition: sli4.h:1292
uint32_t chain_sge_initial_value_lo
Definition: sli4.h:3555
sli4_mbox_command_header_t hdr
Definition: sli4.h:1480
COMMON_WRITE_OBJECT.
Definition: sli4.h:2629
int32_t sli_is_paused(sli4_t *sli4)
Definition: sli4.c:6390
COMMON_GET_CNTL_ATTRIBUTES.
Definition: sli4.h:2047
static uint32_t sli_get_dif_capable(sli4_t *sli4)
Definition: sli4.h:3885
uint32_t buffer_address_high
Definition: sli4.h:499
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:5078
sli4_mbox_command_header_t hdr
Definition: sli4.h:1460
uint32_t buffer_address_high
Definition: sli4.h:515
COMMON_CREATE_CQ_V0.
Definition: sli4.h:1719
List Segment Pointer Scatter-Gather Entry (SGE)
Definition: sli4.h:563
UNREG_VPI - unregister one or more VPI.
Definition: sli4.h:1459
int32_t sli_bmbx_command(sli4_t *sli4)
Submit a command to the bootstrap mailbox and check the status.
Definition: sli4.c:493
uint32_t max_sgl_pages
Definition: sli4.h:3675
Profile Descriptor for profile functions.
Definition: sli4.h:3049
uint32_t receive_sequence_count
Definition: sli4.h:1289
int32_t sli_cmd_unreg_vfi(sli4_t *sli4, void *buf, size_t size, ocs_domain_t *domain, uint32_t which)
Write an UNREG_VFI command to the provided buffer.
Definition: sli4.c:1656
uint32_t auto_xfer_rdy
Definition: sli4.h:3654
int32_t sli_cmd_dump_type4(sli4_t *sli4, void *buf, size_t size, uint16_t wki)
Write a DUMP Type 4 command to the provided buffer.
Definition: sli4.c:602
int32_t sli_cmd_init_vpi(sli4_t *sli4, void *buf, size_t size, uint16_t vpi, uint16_t vfi)
Write an INIT_VPI command to the provided buffer.
Definition: sli4.c:883
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:4786
uint32_t type
Definition: sli4.h:3560
Scatter-Gather Entry (SGE)
Definition: sli4.h:497
READ_CONFIG - read SLI port configuration parameters.
Definition: sli4.h:809
uint32_t off
Definition: sli4.h:3420
int32_t sli_cmd_common_set_profile_config(sli4_t *sli4, void *buf, size_t size, 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:3287
REG_VFI - register a Virtual Fabric Indicator.
Definition: sli4.h:1151
int32_t sli_cmd_common_get_sli4_parameters(sli4_t *sli4, void *buf, size_t size)
Write a COMMON_GET_SLI4_PARAMETERS command.
Definition: sli4.c:2696
uint32_t * base
Definition: sli4.h:3649
uint32_t size
Definition: sli4.h:3647
uint16_t max_qcount[SLI_QTYPE_MAX]
Definition: sli4.h:3616
REG_VPI - register a Virtual Port Indicator.
Definition: sli4.h:1177
int32_t sli_cmd_config_run_biu_diag(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *tx_buffer, size_t tx_buf_len, ocs_dma_t *rx_buffer, size_t rx_buf_len)
Write a RUN_BIU_DIAG command.
Definition: sli4.c:3084
static uint32_t sli_get_if_type(sli4_t *sli4)
Definition: sli4.h:3804
uint32_t fw_rev[2]
Definition: sli4.h:3628
int32_t sli_cmd_init_vfi(sli4_t *sli4, void *buf, size_t size, uint16_t vfi, uint16_t fcfi, uint16_t vpi)
Write an INIT_VFI command to the provided buffer.
Definition: sli4.c:846
uint64_t sgl_index_field_mask
Definition: sli4.h:3554
uint8_t topology
Definition: sli4.h:3625
sli4_mbox_command_header_t hdr
Definition: sli4.h:814
static uint32_t sli_get_is_dual_ulp_capable(sli4_t *sli4)
Definition: sli4.h:3903
uint32_t total_exchanges_responder
Definition: sli4.h:1291
sli4_link_status_e
Definition: sli4.h:3510
uint32_t request_length
Definition: sli4.h:1672
uint32_t rsvd3
Definition: sli4.h:1261
uint16_t frag_num_field_offset
Definition: sli4.h:3551
int32_t sli_cmd_unreg_fcfi(sli4_t *sli4, void *buf, size_t size, uint16_t indicator)
Write a UNREG_FCFI command to the provided buffer.
Definition: sli4.c:1570
int32_t sli_cmd_config_link(sli4_t *sli4, void *buf, size_t size)
Write a CONFIG_LINK command to the provided buffer.
Definition: sli4.c:546
uint32_t flash_rom_access_operation_type
Definition: sli4.h:2413
sli4_mbox_command_header_t hdr
Definition: sli4.h:1126
uint64_t frag_num_field_mask
Definition: sli4.h:3553
Generic Command Request header.
Definition: sli4.h:1666
uint32_t uint32_t rsvd
Definition: sli4.h:1927
sli4_mbox_command_header_t hdr
Definition: sli4.h:1279
sli4_mbox_command_header_t hdr
Definition: sli4.h:1413
uint64_t max_process_time_ms
Definition: sli4.h:3463
Generic Command Response header.
Definition: sli4.h:1683
uint32_t hlm
Definition: sli4.h:1199
COMMON_SET_ACTIVE_PROFILE.
Definition: sli4.h:3112
uint32_t transmit_sequence_count
Definition: sli4.h:1288
sli4_req_hdr_t hdr
Definition: sli4.h:2150
const uint8_t sli4_fw_deinitialize[]
FW_DEINITIALIZE - deinitialize a SLI port.
Definition: sli4.c:68
uint32_t second_hw_revision
Definition: sli4.h:912
READ_REV - read the Port revision levels.
Definition: sli4.h:901
uint32_t uint32_t rsvd2
Definition: sli4.h:1281
uint8_t p0_linkstate
Definition: sli4.h:3363
sli4_res_hdr_t hdr
Definition: sli4.h:2616
COMMON_CREATE_EQ.
Definition: sli4.h:1913
int32_t sli_cmd_read_topology(sli4_t *sli4, void *buf, size_t size, ocs_dma_t *dma)
Write a READ_TOPOLOGY command to the provided buffer.
Definition: sli4.c:1108
sli4_asic_rev_e
Definition: sli4.h:3589
int32_t sli_queue_index(sli4_t *sli4, sli4_queue_t *q)
Definition: sli4.c:5790
static uint32_t sli_get_xib_capable(sli4_t *sli4)
Definition: sli4.h:3874
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:5565
static void * sli_get_vpd(sli4_t *sli4)
Definition: sli4.h:3822
uint32_t transmit_kbyte_count
Definition: sli4.h:1284
uint32_t sgl_segment_address_high
Definition: sli4.h:482
static uint32_t sli_get_portnum(sli4_t *sli4)
Definition: sli4.h:4034
int32_t sli_init(sli4_t *sli4)
Definition: sli4.c:4590
COMMON_EXT_FAT_RETRIEVE_SNAPSHOT.
Definition: sli4.h:2515
sli4_asic_rev_e asic_rev
Definition: sli4.h:3610
int32_t sli_cmd_reg_rpi(sli4_t *sli4, void *buf, size_t size, uint32_t nport_id, uint16_t rpi, uint16_t vpi, ocs_dma_t *dma, uint8_t update, uint8_t enable_t10_pi, uint8_t hlm)
Write a REG_RPI command to the provided buffer.
Definition: sli4.c:1315
static uint32_t sli_cq_doorbell(uint16_t n_popped, uint16_t id, uint8_t arm)
Definition: sli4.h:242
uint32_t uint32_t mbx_data_structure_version
Definition: sli4.h:2053
sli4_port_type_e
Definition: sli4.h:3574
static uint32_t sli_get_auto_xfer_rdy_capable(sli4_t *sli4)
Definition: sli4.h:3858
uint32_t transmit_frame_count
Definition: sli4.h:1286
static uint32_t sli_get_tow_xris_max(sli4_t *sli4)
Definition: sli4.h:3869
ocs_dma_t dma
Definition: sli4.h:3450
int32_t(* sli4_destroy_q_fn_t)(sli4_t *, void *, size_t, uint16_t)
Common Destroy Queue function prototype.
Definition: sli4.h:4068
uint8_t p2_linkstate
Definition: sli4.h:3365
uint8_t type_mask
Definition: sli4.h:4099
uint8_t wwnn[8]
Definition: sli4.h:3627
uint32_t dif
Definition: sli4.h:1199
uint8_t r_ctl_mask
Definition: sli4.h:4097
uint32_t buffer_address_low
Definition: sli4.h:473
uint32_t host_buffer_descriptor_count
Definition: sli4.h:2608