net/bnxt: add Rx queue create/destroy
[dpdk.git] / drivers / net / bnxt / hsi_struct_def_dpdk.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) Broadcom Limited.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Broadcom Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _HSI_STRUCT_DEF_EXTERNAL_H_
35 #define _HSI_STRUCT_DEF_EXTERNAL_H_
36
37 /* HW Resource Manager Specification 1.2.0 */
38 #define HWRM_VERSION_MAJOR      1
39 #define HWRM_VERSION_MINOR      2
40 #define HWRM_VERSION_UPDATE     0
41
42 /*
43  * Following is the signature for HWRM message field that indicates not
44  * applicable (All F's). Need to cast it the size of the field if needed.
45  */
46 #define HWRM_NA_SIGNATURE        ((uint32_t)(-1))
47 #define HWRM_MAX_REQ_LEN        (128)  /* hwrm_func_buf_rgtr */
48 #define HWRM_MAX_RESP_LEN       (176)  /* hwrm_func_qstats */
49 #define HW_HASH_INDEX_SIZE      0x80    /* 7 bit indirection table index. */
50 #define HW_HASH_KEY_SIZE        40
51 #define HWRM_RESP_VALID_KEY     1 /* valid key for HWRM response */
52
53 /*
54  * Request types
55  */
56 #define HWRM_VER_GET                    (UINT32_C(0x0))
57 #define HWRM_FUNC_QCAPS                 (UINT32_C(0x15))
58 #define HWRM_FUNC_DRV_UNRGTR            (UINT32_C(0x1a))
59 #define HWRM_FUNC_DRV_RGTR              (UINT32_C(0x1d))
60 #define HWRM_PORT_PHY_CFG               (UINT32_C(0x20))
61 #define HWRM_QUEUE_QPORTCFG             (UINT32_C(0x30))
62 #define HWRM_CFA_L2_FILTER_ALLOC        (UINT32_C(0x90))
63 #define HWRM_CFA_L2_FILTER_FREE         (UINT32_C(0x91))
64 #define HWRM_CFA_L2_FILTER_CFG          (UINT32_C(0x92))
65 #define HWRM_CFA_L2_SET_RX_MASK         (UINT32_C(0x93))
66 #define HWRM_EXEC_FWD_RESP              (UINT32_C(0xd0))
67
68 /* Return Codes */
69 #define HWRM_ERR_CODE_INVALID_PARAMS                      (UINT32_C(0x2))
70 #define HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED              (UINT32_C(0x3))
71
72 /* HWRM Forwarded Request (16 bytes) */
73 struct hwrm_fwd_req_cmpl {
74         /* Length of forwarded request in bytes. */
75         /*
76          * This field indicates the exact type of the completion. By convention,
77          * the LSB identifies the length of the record in 16B units. Even values
78          * indicate 16B records. Odd values indicate 32B records.
79          */
80         #define HWRM_FWD_REQ_CMPL_TYPE_MASK             UINT32_C(0x3f)
81         #define HWRM_FWD_REQ_CMPL_TYPE_SFT              0
82                 /* Forwarded HWRM Request */
83         #define HWRM_FWD_REQ_CMPL_TYPE_HWRM_FWD_REQ     (UINT32_C(0x22) << 0)
84         /* Length of forwarded request in bytes. */
85         #define HWRM_FWD_REQ_CMPL_REQ_LEN_MASK          UINT32_C(0xffc0)
86         #define HWRM_FWD_REQ_CMPL_REQ_LEN_SFT           6
87         uint16_t req_len_type;
88
89         /*
90          * Source ID of this request. Typically used in forwarding requests and
91          * responses. 0x0 - 0xFFF8 - Used for function ids 0xFFF8 - 0xFFFE -
92          * Reserved for internal processors 0xFFFF - HWRM
93          */
94         uint16_t source_id;
95
96         uint32_t unused_0;
97
98         /* Address of forwarded request. */
99         /*
100          * This value is written by the NIC such that it will be different for
101          * each pass through the completion queue. The even passes will write 1.
102          * The odd passes will write 0.
103          */
104         #define HWRM_FWD_REQ_CMPL_V                     UINT32_C(0x1)
105         /* Address of forwarded request. */
106         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_MASK     UINT32_C(0xfffffffe)
107         #define HWRM_FWD_REQ_CMPL_REQ_BUF_ADDR_SFT      1
108         uint64_t req_buf_addr_v;
109 } __attribute__((packed));
110
111 /* HWRM Asynchronous Event Completion Record (16 bytes) */
112 struct hwrm_async_event_cmpl {
113         /*
114          * This field indicates the exact type of the completion. By convention,
115          * the LSB identifies the length of the record in 16B units. Even values
116          * indicate 16B records. Odd values indicate 32B records.
117          */
118         #define HWRM_ASYNC_EVENT_CMPL_TYPE_MASK         UINT32_C(0x3f)
119         #define HWRM_ASYNC_EVENT_CMPL_TYPE_SFT          0
120                 /* HWRM Asynchronous Event Information */
121         #define HWRM_ASYNC_EVENT_CMPL_TYPE_HWRM_ASYNC_EVENT \
122                                                         (UINT32_C(0x2e) << 0)
123         uint16_t type;
124
125         /* Identifiers of events. */
126                 /* Link status changed */
127         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE \
128                                                         (UINT32_C(0x0) << 0)
129                 /* Link MTU changed */
130         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_MTU_CHANGE \
131                                                         (UINT32_C(0x1) << 0)
132                 /* Link speed changed */
133         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE \
134                                                         (UINT32_C(0x2) << 0)
135                 /* DCB Configuration changed */
136         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_DCB_CONFIG_CHANGE \
137                                                         (UINT32_C(0x3) << 0)
138                 /* Port connection not allowed */
139         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED \
140                                                         (UINT32_C(0x4) << 0)
141                 /* Link speed configuration was not allowed */
142         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CFG_NOT_ALLOWED \
143                                                         (UINT32_C(0x5) << 0)
144                 /* Function driver unloaded */
145         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_UNLOAD \
146                                                         (UINT32_C(0x10) << 0)
147                 /* Function driver loaded */
148         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_FUNC_DRVR_LOAD \
149                                                         (UINT32_C(0x11) << 0)
150                 /* PF driver unloaded */
151         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_UNLOAD \
152                                                         (UINT32_C(0x20) << 0)
153                 /* PF driver loaded */
154         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_DRVR_LOAD \
155                                                         (UINT32_C(0x21) << 0)
156                 /* VF Function Level Reset (FLR) */
157         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_FLR   (UINT32_C(0x30) << 0)
158                 /* VF MAC Address Change */
159         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_MAC_ADDR_CHANGE \
160                                                         (UINT32_C(0x31) << 0)
161                 /* PF-VF communication channel status change. */
162         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PF_VF_COMM_STATUS_CHANGE \
163                                                         (UINT32_C(0x32) << 0)
164                 /* HWRM Error */
165         #define HWRM_ASYNC_EVENT_CMPL_EVENT_ID_HWRM_ERROR \
166                                                         (UINT32_C(0xff) << 0)
167         uint16_t event_id;
168
169         /* Event specific data */
170         uint32_t event_data2;
171
172         /* opaque is 7 b */
173         /*
174          * This value is written by the NIC such that it will be different for
175          * each pass through the completion queue. The even passes will write 1.
176          * The odd passes will write 0.
177          */
178         #define HWRM_ASYNC_EVENT_CMPL_V                         UINT32_C(0x1)
179         /* opaque is 7 b */
180         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_MASK               UINT32_C(0xfe)
181         #define HWRM_ASYNC_EVENT_CMPL_OPAQUE_SFT                1
182         uint8_t opaque_v;
183
184         /* 8-lsb timestamp from POR (100-msec resolution) */
185         uint8_t timestamp_lo;
186
187         /* 16-lsb timestamp from POR (100-msec resolution) */
188         uint16_t timestamp_hi;
189
190         /* Event specific data */
191         uint32_t event_data1;
192 } __attribute__((packed));
193
194 /*
195  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
196  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
197  * processors inside the chip. This firmware is vital part of the chip's
198  * hardware. The chip can not be used by driver without it.
199  */
200
201 /* Input (16 bytes) */
202 struct input {
203         /*
204          * This value indicates what type of request this is. The format for the
205          * rest of the command is determined by this field.
206          */
207         uint16_t req_type;
208
209         /*
210          * This value indicates the what completion ring the request will be
211          * optionally completed on. If the value is -1, then no CR completion
212          * will be generated. Any other value must be a valid CR ring_id value
213          * for this function.
214          */
215         uint16_t cmpl_ring;
216
217         /* This value indicates the command sequence number. */
218         uint16_t seq_id;
219
220         /*
221          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
222          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
223          */
224         uint16_t target_id;
225
226         /*
227          * This is the host address where the response will be written when the
228          * request is complete. This area must be 16B aligned and must be
229          * cleared to zero before the request is made.
230          */
231         uint64_t resp_addr;
232 } __attribute__((packed));
233
234 /* Output (8 bytes) */
235 struct output {
236         /*
237          * Pass/Fail or error type Note: receiver to verify the in parameters,
238          * and fail the call with an error when appropriate
239          */
240         uint16_t error_code;
241
242         /* This field returns the type of original request. */
243         uint16_t req_type;
244
245         /* This field provides original sequence number of the command. */
246         uint16_t seq_id;
247
248         /*
249          * This field is the length of the response in bytes. The last byte of
250          * the response is a valid flag that will read as '1' when the command
251          * has been completely written to memory.
252          */
253         uint16_t resp_len;
254 } __attribute__((packed));
255
256 /* hwrm_cfa_l2_filter_alloc */
257 /*
258  * A filter is used to identify traffic that contains a matching set of
259  * parameters like unicast or broadcast MAC address or a VLAN tag amongst
260  * other things which then allows the ASIC to direct the  incoming traffic
261  * to an appropriate VNIC or Rx ring.
262  */
263
264 /* Input (96 bytes) */
265 struct hwrm_cfa_l2_filter_alloc_input {
266         /*
267          * This value indicates what type of request this is. The format for the
268          * rest of the command is determined by this field.
269          */
270         uint16_t req_type;
271
272         /*
273          * This value indicates the what completion ring the request will be
274          * optionally completed on. If the value is -1, then no CR completion
275          * will be generated. Any other value must be a valid CR ring_id value
276          * for this function.
277          */
278         uint16_t cmpl_ring;
279
280         /* This value indicates the command sequence number. */
281         uint16_t seq_id;
282
283         /*
284          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
285          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
286          */
287         uint16_t target_id;
288
289         /*
290          * This is the host address where the response will be written when the
291          * request is complete. This area must be 16B aligned and must be
292          * cleared to zero before the request is made.
293          */
294         uint64_t resp_addr;
295
296         /*
297          * Enumeration denoting the RX, TX type of the resource. This
298          * enumeration is used for resources that are similar for both TX and RX
299          * paths of the chip.
300          */
301         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH \
302                                                         UINT32_C(0x1)
303                 /* tx path */
304         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_TX \
305                                                         (UINT32_C(0x0) << 0)
306                 /* rx path */
307         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX \
308                                                         (UINT32_C(0x1) << 0)
309         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_LAST \
310                                 HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_PATH_RX
311         /*
312          * Setting of this flag indicates the applicability to the loopback
313          * path.
314          */
315         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_LOOPBACK \
316                                                         UINT32_C(0x2)
317         /*
318          * Setting of this flag indicates drop action. If this flag is not set,
319          * then it should be considered accept action.
320          */
321         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_DROP \
322                                                         UINT32_C(0x4)
323         /*
324          * If this flag is set, all t_l2_* fields are invalid and they should
325          * not be specified. If this flag is set, then l2_* fields refer to
326          * fields of outermost L2 header.
327          */
328         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST \
329                                                         UINT32_C(0x8)
330         uint32_t flags;
331
332         /* This bit must be '1' for the l2_addr field to be configured. */
333         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR \
334                                                         UINT32_C(0x1)
335         /* This bit must be '1' for the l2_addr_mask field to be configured. */
336         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK \
337                                                         UINT32_C(0x2)
338         /* This bit must be '1' for the l2_ovlan field to be configured. */
339         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN \
340                                                         UINT32_C(0x4)
341         /* This bit must be '1' for the l2_ovlan_mask field to be configured. */
342         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_OVLAN_MASK \
343                                                         UINT32_C(0x8)
344         /* This bit must be '1' for the l2_ivlan field to be configured. */
345         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN \
346                                                         UINT32_C(0x10)
347         /* This bit must be '1' for the l2_ivlan_mask field to be configured. */
348         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_IVLAN_MASK \
349                                                         UINT32_C(0x20)
350         /* This bit must be '1' for the t_l2_addr field to be configured. */
351         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR \
352                                                         UINT32_C(0x40)
353         /*
354          * This bit must be '1' for the t_l2_addr_mask field to be configured.
355          */
356         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_ADDR_MASK \
357                                                         UINT32_C(0x80)
358         /* This bit must be '1' for the t_l2_ovlan field to be configured. */
359         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN \
360                                                         UINT32_C(0x100)
361         /*
362          * This bit must be '1' for the t_l2_ovlan_mask field to be configured.
363          */
364         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_OVLAN_MASK \
365                                                         UINT32_C(0x200)
366         /* This bit must be '1' for the t_l2_ivlan field to be configured. */
367         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN \
368                                                         UINT32_C(0x400)
369         /*
370          * This bit must be '1' for the t_l2_ivlan_mask field to be configured.
371          */
372         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_T_L2_IVLAN_MASK \
373                                                         UINT32_C(0x800)
374         /* This bit must be '1' for the src_type field to be configured. */
375         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_TYPE \
376                                                         UINT32_C(0x1000)
377         /* This bit must be '1' for the src_id field to be configured. */
378         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_SRC_ID \
379                                                         UINT32_C(0x2000)
380         /* This bit must be '1' for the tunnel_type field to be configured. */
381         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_TUNNEL_TYPE \
382                                                         UINT32_C(0x4000)
383         /* This bit must be '1' for the dst_id field to be configured. */
384         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID \
385                                                         UINT32_C(0x8000)
386         /*
387          * This bit must be '1' for the mirror_vnic_id field to be configured.
388          */
389         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_MIRROR_VNIC_ID \
390                                                         UINT32_C(0x10000)
391         uint32_t enables;
392
393         /*
394          * This value sets the match value for the L2 MAC address. Destination
395          * MAC address for RX path. Source MAC address for TX path.
396          */
397         uint8_t l2_addr[6];
398
399         uint8_t unused_0;
400         uint8_t unused_1;
401
402         /*
403          * This value sets the mask value for the L2 address. A value of 0 will
404          * mask the corresponding bit from compare.
405          */
406         uint8_t l2_addr_mask[6];
407
408         /* This value sets VLAN ID value for outer VLAN. */
409         uint16_t l2_ovlan;
410
411         /*
412          * This value sets the mask value for the ovlan id. A value of 0 will
413          * mask the corresponding bit from compare.
414          */
415         uint16_t l2_ovlan_mask;
416
417         /* This value sets VLAN ID value for inner VLAN. */
418         uint16_t l2_ivlan;
419
420         /*
421          * This value sets the mask value for the ivlan id. A value of 0 will
422          * mask the corresponding bit from compare.
423          */
424         uint16_t l2_ivlan_mask;
425
426         uint8_t unused_2;
427         uint8_t unused_3;
428
429         /*
430          * This value sets the match value for the tunnel L2 MAC address.
431          * Destination MAC address for RX path. Source MAC address for TX path.
432          */
433         uint8_t t_l2_addr[6];
434
435         uint8_t unused_4;
436         uint8_t unused_5;
437
438         /*
439          * This value sets the mask value for the tunnel L2 address. A value of
440          * 0 will mask the corresponding bit from compare.
441          */
442         uint8_t t_l2_addr_mask[6];
443
444         /* This value sets VLAN ID value for tunnel outer VLAN. */
445         uint16_t t_l2_ovlan;
446
447         /*
448          * This value sets the mask value for the tunnel ovlan id. A value of 0
449          * will mask the corresponding bit from compare.
450          */
451         uint16_t t_l2_ovlan_mask;
452
453         /* This value sets VLAN ID value for tunnel inner VLAN. */
454         uint16_t t_l2_ivlan;
455
456         /*
457          * This value sets the mask value for the tunnel ivlan id. A value of 0
458          * will mask the corresponding bit from compare.
459          */
460         uint16_t t_l2_ivlan_mask;
461
462         /* This value identifies the type of source of the packet. */
463                 /* Network port */
464         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_NPORT \
465                                                         (UINT32_C(0x0) << 0)
466                 /* Physical function */
467         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_PF \
468                                                         (UINT32_C(0x1) << 0)
469                 /* Virtual function */
470         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VF \
471                                                         (UINT32_C(0x2) << 0)
472                 /* Virtual NIC of a function */
473         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_VNIC \
474                                                         (UINT32_C(0x3) << 0)
475                 /* Embedded processor for CFA management */
476         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_KONG \
477                                                         (UINT32_C(0x4) << 0)
478                 /* Embedded processor for OOB management */
479         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_APE \
480                                                         (UINT32_C(0x5) << 0)
481                 /* Embedded processor for RoCE */
482         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_BONO \
483                                                         (UINT32_C(0x6) << 0)
484                 /* Embedded processor for network proxy functions */
485         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_SRC_TYPE_TANG \
486                                                         (UINT32_C(0x7) << 0)
487         uint8_t src_type;
488
489         uint8_t unused_6;
490         /*
491          * This value is the id of the source. For a network port, it represents
492          * port_id. For a physical function, it represents fid. For a virtual
493          * function, it represents vf_id. For a vnic, it represents vnic_id. For
494          * embedded processors, this id is not valid. Notes: 1. The function ID
495          * is implied if it src_id is not provided for a src_type that is either
496          */
497         uint32_t src_id;
498
499         /* Tunnel Type. */
500                 /* Non-tunnel */
501         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NONTUNNEL \
502                                                         (UINT32_C(0x0) << 0)
503                 /* Virtual eXtensible Local Area Network (VXLAN) */
504         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_VXLAN \
505                                                         (UINT32_C(0x1) << 0)
506                 /*
507                  * Network Virtualization Generic Routing Encapsulation (NVGRE)
508                  */
509         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_NVGRE \
510                                                         (UINT32_C(0x2) << 0)
511                 /*
512                  * Generic Routing Encapsulation (GRE) inside Ethernet payload
513                  */
514         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_L2GRE \
515                                                         (UINT32_C(0x3) << 0)
516                 /* IP in IP */
517         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPIP \
518                                                         (UINT32_C(0x4) << 0)
519                 /* Generic Network Virtualization Encapsulation (Geneve) */
520         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_GENEVE \
521                                                         (UINT32_C(0x5) << 0)
522                 /* Multi-Protocol Lable Switching (MPLS) */
523         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_MPLS \
524                                                         (UINT32_C(0x6) << 0)
525                 /* Stateless Transport Tunnel (STT) */
526         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_STT \
527                                                         (UINT32_C(0x7) << 0)
528                 /*
529                  * Generic Routing Encapsulation (GRE) inside IP datagram
530                  * payload
531                  */
532         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_IPGRE \
533                                                         (UINT32_C(0x8) << 0)
534                 /* Any tunneled traffic */
535         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_TUNNEL_TYPE_ANYTUNNEL \
536                                                         (UINT32_C(0xff) << 0)
537         uint8_t tunnel_type;
538
539         uint8_t unused_7;
540
541         /*
542          * If set, this value shall represent the Logical VNIC ID of the
543          * destination VNIC for the RX path and network port id of the
544          * destination port for the TX path.
545          */
546         uint16_t dst_id;
547
548         /* Logical VNIC ID of the VNIC where traffic is mirrored. */
549         uint16_t mirror_vnic_id;
550
551         /*
552          * This hint is provided to help in placing the filter in the filter
553          * table.
554          */
555                 /* No preference */
556         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_NO_PREFER \
557                                                         (UINT32_C(0x0) << 0)
558                 /* Above the given filter */
559         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_ABOVE_FILTER \
560                                                         (UINT32_C(0x1) << 0)
561                 /* Below the given filter */
562         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_BELOW_FILTER \
563                                                         (UINT32_C(0x2) << 0)
564                 /* As high as possible */
565         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MAX \
566                                                         (UINT32_C(0x3) << 0)
567                 /* As low as possible */
568         #define HWRM_CFA_L2_FILTER_ALLOC_INPUT_PRI_HINT_MIN \
569                                                         (UINT32_C(0x4) << 0)
570         uint8_t pri_hint;
571
572         uint8_t unused_8;
573         uint32_t unused_9;
574
575         /*
576          * This is the ID of the filter that goes along with the pri_hint. This
577          * field is valid only for the following values. 1 - Above the given
578          * filter 2 - Below the given filter
579          */
580         uint64_t l2_filter_id_hint;
581 } __attribute__((packed));
582
583 /* Output (24 bytes) */
584 struct hwrm_cfa_l2_filter_alloc_output {
585         /*
586          * Pass/Fail or error type Note: receiver to verify the in parameters,
587          * and fail the call with an error when appropriate
588          */
589         uint16_t error_code;
590
591         /* This field returns the type of original request. */
592         uint16_t req_type;
593
594         /* This field provides original sequence number of the command. */
595         uint16_t seq_id;
596
597         /*
598          * This field is the length of the response in bytes. The last byte of
599          * the response is a valid flag that will read as '1' when the command
600          * has been completely written to memory.
601          */
602         uint16_t resp_len;
603
604         /*
605          * This value identifies a set of CFA data structures used for an L2
606          * context.
607          */
608         uint64_t l2_filter_id;
609
610         /*
611          * This is the ID of the flow associated with this filter. This value
612          * shall be used to match and associate the flow identifier returned in
613          * completion records. A value of 0xFFFFFFFF shall indicate no flow id.
614          */
615         uint32_t flow_id;
616
617         uint8_t unused_0;
618         uint8_t unused_1;
619         uint8_t unused_2;
620
621         /*
622          * This field is used in Output records to indicate that the output is
623          * completely written to RAM. This field should be read as '1' to
624          * indicate that the output has been completely written. When writing a
625          * command completion or response to an internal processor, the order of
626          * writes has to be such that this field is written last.
627          */
628         uint8_t valid;
629 } __attribute__((packed));
630
631 /* hwrm_cfa_l2_filter_free */
632 /*
633  * Description: Free a L2 filter. The HWRM shall free all associated filter
634  * resources with the L2 filter.
635  */
636
637 /* Input (24 bytes) */
638 struct hwrm_cfa_l2_filter_free_input {
639         /*
640          * This value indicates what type of request this is. The format for the
641          * rest of the command is determined by this field.
642          */
643         uint16_t req_type;
644
645         /*
646          * This value indicates the what completion ring the request will be
647          * optionally completed on. If the value is -1, then no CR completion
648          * will be generated. Any other value must be a valid CR ring_id value
649          * for this function.
650          */
651         uint16_t cmpl_ring;
652
653         /* This value indicates the command sequence number. */
654         uint16_t seq_id;
655
656         /*
657          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
658          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
659          */
660         uint16_t target_id;
661
662         /*
663          * This is the host address where the response will be written when the
664          * request is complete. This area must be 16B aligned and must be
665          * cleared to zero before the request is made.
666          */
667         uint64_t resp_addr;
668
669         /*
670          * This value identifies a set of CFA data structures used for an L2
671          * context.
672          */
673         uint64_t l2_filter_id;
674 } __attribute__((packed));
675
676 /* Output (16 bytes) */
677 struct hwrm_cfa_l2_filter_free_output {
678         /*
679          * Pass/Fail or error type Note: receiver to verify the in parameters,
680          * and fail the call with an error when appropriate
681          */
682         uint16_t error_code;
683
684         /* This field returns the type of original request. */
685         uint16_t req_type;
686
687         /* This field provides original sequence number of the command. */
688         uint16_t seq_id;
689
690         /*
691          * This field is the length of the response in bytes. The last byte of
692          * the response is a valid flag that will read as '1' when the command
693          * has been completely written to memory.
694          */
695         uint16_t resp_len;
696
697         uint32_t unused_0;
698         uint8_t unused_1;
699         uint8_t unused_2;
700         uint8_t unused_3;
701
702         /*
703          * This field is used in Output records to indicate that the output is
704          * completely written to RAM. This field should be read as '1' to
705          * indicate that the output has been completely written. When writing a
706          * command completion or response to an internal processor, the order of
707          * writes has to be such that this field is written last.
708          */
709         uint8_t valid;
710 } __attribute__((packed));
711
712 /* hwrm_exec_fwd_resp */
713 /*
714  * Description: This command is used to send an encapsulated request to the
715  * HWRM. This command instructs the HWRM to execute the request and forward the
716  * response of the encapsulated request to the location specified in the
717  * original request that is encapsulated. The target id of this command shall be
718  * set to 0xFFFF (HWRM). The response location in this command shall be used to
719  * acknowledge the receipt of the encapsulated request and forwarding of the
720  * response.
721  */
722
723 /* Input (128 bytes) */
724 struct hwrm_exec_fwd_resp_input {
725         /*
726          * This value indicates what type of request this is. The format for the
727          * rest of the command is determined by this field.
728          */
729         uint16_t req_type;
730
731         /*
732          * This value indicates the what completion ring the request will be
733          * optionally completed on. If the value is -1, then no CR completion
734          * will be generated. Any other value must be a valid CR ring_id value
735          * for this function.
736          */
737         uint16_t cmpl_ring;
738
739         /* This value indicates the command sequence number. */
740         uint16_t seq_id;
741
742         /*
743          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
744          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
745          */
746         uint16_t target_id;
747
748         /*
749          * This is the host address where the response will be written when the
750          * request is complete. This area must be 16B aligned and must be
751          * cleared to zero before the request is made.
752          */
753         uint64_t resp_addr;
754
755         /*
756          * This is an encapsulated request. This request should be executed by
757          * the HWRM and the response should be provided in the response buffer
758          * inside the encapsulated request.
759          */
760         uint32_t encap_request[26];
761
762         /*
763          * This value indicates the target id of the response to the
764          * encapsulated request. 0x0 - 0xFFF8 - Used for function ids 0xFFF8 -
765          * 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
766          */
767         uint16_t encap_resp_target_id;
768
769         uint16_t unused_0[3];
770 } __attribute__((packed));
771
772 /* Output (16 bytes) */
773 struct hwrm_exec_fwd_resp_output {
774         /*
775          * Pass/Fail or error type Note: receiver to verify the in parameters,
776          * and fail the call with an error when appropriate
777          */
778         uint16_t error_code;
779
780         /* This field returns the type of original request. */
781         uint16_t req_type;
782
783         /* This field provides original sequence number of the command. */
784         uint16_t seq_id;
785
786         /*
787          * This field is the length of the response in bytes. The last byte of
788          * the response is a valid flag that will read as '1' when the command
789          * has been completely written to memory.
790          */
791         uint16_t resp_len;
792
793         uint32_t unused_0;
794         uint8_t unused_1;
795         uint8_t unused_2;
796         uint8_t unused_3;
797
798         /*
799          * This field is used in Output records to indicate that the output is
800          * completely written to RAM. This field should be read as '1' to
801          * indicate that the output has been completely written. When writing a
802          * command completion or response to an internal processor, the order of
803          * writes has to be such that this field is written last.
804          */
805         uint8_t valid;
806 } __attribute__((packed));
807
808 /* hwrm_func_qcaps */
809 /*
810  * Description: This command returns capabilities of a function. The input FID
811  * value is used to indicate what function is being queried. This allows a
812  * physical function driver to query virtual functions that are children of the
813  * physical function. The output FID value is needed to configure Rings and
814  * MSI-X vectors so their DMA operations appear correctly on the PCI bus.
815  */
816
817 /* Input (24 bytes) */
818 struct hwrm_func_qcaps_input {
819         /*
820          * This value indicates what type of request this is. The format for the
821          * rest of the command is determined by this field.
822          */
823         uint16_t req_type;
824
825         /*
826          * This value indicates the what completion ring the request will be
827          * optionally completed on. If the value is -1, then no CR completion
828          * will be generated. Any other value must be a valid CR ring_id value
829          * for this function.
830          */
831         uint16_t cmpl_ring;
832
833         /* This value indicates the command sequence number. */
834         uint16_t seq_id;
835
836         /*
837          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
838          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
839          */
840         uint16_t target_id;
841
842         /*
843          * This is the host address where the response will be written when the
844          * request is complete. This area must be 16B aligned and must be
845          * cleared to zero before the request is made.
846          */
847         uint64_t resp_addr;
848
849         /*
850          * Function ID of the function that is being queried. 0xFF... (All Fs)
851          * if the query is for the requesting function.
852          */
853         uint16_t fid;
854
855         uint16_t unused_0[3];
856 } __attribute__((packed));
857
858 /* Output (80 bytes) */
859 struct hwrm_func_qcaps_output {
860         /*
861          * Pass/Fail or error type Note: receiver to verify the in parameters,
862          * and fail the call with an error when appropriate
863          */
864         uint16_t error_code;
865
866         /* This field returns the type of original request. */
867         uint16_t req_type;
868
869         /* This field provides original sequence number of the command. */
870         uint16_t seq_id;
871
872         /*
873          * This field is the length of the response in bytes. The last byte of
874          * the response is a valid flag that will read as '1' when the command
875          * has been completely written to memory.
876          */
877         uint16_t resp_len;
878
879         /*
880          * FID value. This value is used to identify operations on the PCI bus
881          * as belonging to a particular PCI function.
882          */
883         uint16_t fid;
884
885         /*
886          * Port ID of port that this function is associated with. Valid only for
887          * the PF. 0xFF... (All Fs) if this function is not associated with any
888          * port. 0xFF... (All Fs) if this function is called from a VF.
889          */
890         uint16_t port_id;
891
892         /* If 1, then Push mode is supported on this function. */
893         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED   UINT32_C(0x1)
894         /*
895          * If 1, then the global MSI-X auto-masking is enabled for the device.
896          */
897         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING \
898                                                                 UINT32_C(0x2)
899         /*
900          * If 1, then the Precision Time Protocol (PTP) processing is supported
901          * on this function. The HWRM should enable PTP on only a single
902          * Physical Function (PF) per port.
903          */
904         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED         UINT32_C(0x4)
905         uint32_t flags;
906
907         /*
908          * This value is current MAC address configured for this function. A
909          * value of 00-00-00-00-00-00 indicates no MAC address is currently
910          * configured.
911          */
912         uint8_t perm_mac_address[6];
913
914         /*
915          * The maximum number of RSS/COS contexts that can be allocated to the
916          * function.
917          */
918         uint16_t max_rsscos_ctx;
919
920         /*
921          * The maximum number of completion rings that can be allocated to the
922          * function.
923          */
924         uint16_t max_cmpl_rings;
925
926         /*
927          * The maximum number of transmit rings that can be allocated to the
928          * function.
929          */
930         uint16_t max_tx_rings;
931
932         /*
933          * The maximum number of receive rings that can be allocated to the
934          * function.
935          */
936         uint16_t max_rx_rings;
937
938         /*
939          * The maximum number of L2 contexts that can be allocated to the
940          * function.
941          */
942         uint16_t max_l2_ctxs;
943
944         /* The maximum number of VNICs that can be allocated to the function. */
945         uint16_t max_vnics;
946
947         /*
948          * The identifier for the first VF enabled on a PF. This is valid only
949          * on the PF with SR-IOV enabled. 0xFF... (All Fs) if this command is
950          * called on a PF with SR-IOV disabled or on a VF.
951          */
952         uint16_t first_vf_id;
953
954         /*
955          * The maximum number of VFs that can be allocated to the function. This
956          * is valid only on the PF with SR-IOV enabled. 0xFF... (All Fs) if this
957          * command is called on a PF with SR-IOV disabled or on a VF.
958          */
959         uint16_t max_vfs;
960
961         /*
962          * The maximum number of statistic contexts that can be allocated to the
963          * function.
964          */
965         uint16_t max_stat_ctx;
966
967         /*
968          * The maximum number of Encapsulation records that can be offloaded by
969          * this function.
970          */
971         uint32_t max_encap_records;
972
973         /*
974          * The maximum number of decapsulation records that can be offloaded by
975          * this function.
976          */
977         uint32_t max_decap_records;
978
979         /*
980          * The maximum number of Exact Match (EM) flows that can be offloaded by
981          * this function on the TX side.
982          */
983         uint32_t max_tx_em_flows;
984
985         /*
986          * The maximum number of Wildcard Match (WM) flows that can be offloaded
987          * by this function on the TX side.
988          */
989         uint32_t max_tx_wm_flows;
990
991         /*
992          * The maximum number of Exact Match (EM) flows that can be offloaded by
993          * this function on the RX side.
994          */
995         uint32_t max_rx_em_flows;
996
997         /*
998          * The maximum number of Wildcard Match (WM) flows that can be offloaded
999          * by this function on the RX side.
1000          */
1001         uint32_t max_rx_wm_flows;
1002
1003         /*
1004          * The maximum number of multicast filters that can be supported by this
1005          * function on the RX side.
1006          */
1007         uint32_t max_mcast_filters;
1008
1009         /*
1010          * The maximum value of flow_id that can be supported in completion
1011          * records.
1012          */
1013         uint32_t max_flow_id;
1014
1015         /*
1016          * The maximum number of HW ring groups that can be supported on this
1017          * function.
1018          */
1019         uint32_t max_hw_ring_grps;
1020
1021         uint8_t unused_0;
1022         uint8_t unused_1;
1023         uint8_t unused_2;
1024
1025         /*
1026          * This field is used in Output records to indicate that the output is
1027          * completely written to RAM. This field should be read as '1' to
1028          * indicate that the output has been completely written. When writing a
1029          * command completion or response to an internal processor, the order of
1030          * writes has to be such that this field is written last.
1031          */
1032         uint8_t valid;
1033 } __attribute__((packed));
1034
1035 /* hwrm_port_phy_cfg */
1036 /*
1037  * Description: This command configures the PHY device for the port. It allows
1038  * setting of the most generic settings for the PHY. The HWRM shall complete
1039  * this command as soon as PHY settings are configured. They may not be applied
1040  * when the command response is provided. A VF driver shall not be allowed to
1041  * configure PHY using this command. In a network partition mode, a PF driver
1042  * shall not be allowed to configure PHY using this command.
1043  */
1044
1045 /* Input (56 bytes) */
1046 struct hwrm_port_phy_cfg_input {
1047         /*
1048          * This value indicates what type of request this is. The format for the
1049          * rest of the command is determined by this field.
1050          */
1051         uint16_t req_type;
1052
1053         /*
1054          * This value indicates the what completion ring the request will be
1055          * optionally completed on. If the value is -1, then no CR completion
1056          * will be generated. Any other value must be a valid CR ring_id value
1057          * for this function.
1058          */
1059         uint16_t cmpl_ring;
1060
1061         /* This value indicates the command sequence number. */
1062         uint16_t seq_id;
1063
1064         /*
1065          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1066          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1067          */
1068         uint16_t target_id;
1069
1070         /*
1071          * This is the host address where the response will be written when the
1072          * request is complete. This area must be 16B aligned and must be
1073          * cleared to zero before the request is made.
1074          */
1075         uint64_t resp_addr;
1076
1077         /*
1078          * When this bit is set to '1', the PHY for the port shall be reset. #
1079          * If this bit is set to 1, then the HWRM shall reset the PHY after
1080          * applying PHY configuration changes specified in this command. # In
1081          * order to guarantee that PHY configuration changes specified in this
1082          * command take effect, the HWRM client should set this flag to 1. # If
1083          * this bit is not set to 1, then the HWRM may reset the PHY depending
1084          * on the current PHY configuration and settings specified in this
1085          * command.
1086          */
1087         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY            UINT32_C(0x1)
1088         /*
1089          * When this bit is set to '1', the link shall be forced to be taken
1090          * down. # When this bit is set to '1", all other command input settings
1091          * related to the link speed shall be ignored. Once the link state is
1092          * forced down, it can be explicitly cleared from that state by setting
1093          * this flag to '0'. # If this flag is set to '0', then the link shall
1094          * be cleared from forced down state if the link is in forced down
1095          * state. There may be conditions (e.g. out-of-band or sideband
1096          * configuration changes for the link) outside the scope of the HWRM
1097          * implementation that may clear forced down link state.
1098          */
1099         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE_LINK_DOWN      UINT32_C(0x2)
1100         /*
1101          * When this bit is set to '1', the link shall be forced to the
1102          * force_link_speed value. When this bit is set to '1', the HWRM client
1103          * should not enable any of the auto negotiation related fields
1104          * represented by auto_XXX fields in this command. When this bit is set
1105          * to '1' and the HWRM client has enabled a auto_XXX field in this
1106          * command, then the HWRM shall ignore the enabled auto_XXX field. When
1107          * this bit is set to zero, the link shall be allowed to autoneg.
1108          */
1109         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE                UINT32_C(0x4)
1110         /*
1111          * When this bit is set to '1', the auto-negotiation process shall be
1112          * restarted on the link.
1113          */
1114         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG      UINT32_C(0x8)
1115         /*
1116          * When this bit is set to '1', Energy Efficient Ethernet (EEE) is
1117          * requested to be enabled on this link. If EEE is not supported on this
1118          * port, then this flag shall be ignored by the HWRM.
1119          */
1120         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_ENABLE        UINT32_C(0x10)
1121         /*
1122          * When this bit is set to '1', Energy Efficient Ethernet (EEE) is
1123          * requested to be disabled on this link. If EEE is not supported on
1124          * this port, then this flag shall be ignored by the HWRM.
1125          */
1126         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_DISABLE       UINT32_C(0x20)
1127         /*
1128          * When this bit is set to '1' and EEE is enabled on this link, then TX
1129          * LPI is requested to be enabled on the link. If EEE is not supported
1130          * on this port, then this flag shall be ignored by the HWRM. If EEE is
1131          * disabled on this port, then this flag shall be ignored by the HWRM.
1132          */
1133         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_TX_LPI        UINT32_C(0x40)
1134         uint32_t flags;
1135
1136         /* This bit must be '1' for the auto_mode field to be configured. */
1137         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE          UINT32_C(0x1)
1138         /* This bit must be '1' for the auto_duplex field to be configured. */
1139         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX        UINT32_C(0x2)
1140         /* This bit must be '1' for the auto_pause field to be configured. */
1141         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAUSE         UINT32_C(0x4)
1142         /*
1143          * This bit must be '1' for the auto_link_speed field to be configured.
1144          */
1145         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED    UINT32_C(0x8)
1146         /*
1147          * This bit must be '1' for the auto_link_speed_mask field to be
1148          * configured.
1149          */
1150         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK \
1151                                                                 UINT32_C(0x10)
1152         /* This bit must be '1' for the wirespeed field to be configured. */
1153         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_WIRESPEED       UINT32_C(0x20)
1154         /* This bit must be '1' for the lpbk field to be configured. */
1155         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_LPBK            UINT32_C(0x40)
1156         /* This bit must be '1' for the preemphasis field to be configured. */
1157         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_PREEMPHASIS     UINT32_C(0x80)
1158         /* This bit must be '1' for the force_pause field to be configured. */
1159         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_FORCE_PAUSE     UINT32_C(0x100)
1160         /*
1161          * This bit must be '1' for the eee_link_speed_mask field to be
1162          * configured.
1163          */
1164         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_EEE_LINK_SPEED_MASK \
1165                                                                 UINT32_C(0x200)
1166         /* This bit must be '1' for the tx_lpi_timer field to be configured. */
1167         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_TX_LPI_TIMER    UINT32_C(0x400)
1168         uint32_t enables;
1169
1170         /* Port ID of port that is to be configured. */
1171         uint16_t port_id;
1172
1173         /*
1174          * This is the speed that will be used if the force bit is '1'. If
1175          * unsupported speed is selected, an error will be generated.
1176          */
1177                 /* 100Mb link speed */
1178         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100MB \
1179                                                         (UINT32_C(0x1) << 0)
1180                 /* 1Gb link speed */
1181         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_1GB \
1182                                                         (UINT32_C(0xa) << 0)
1183                 /* 2Gb link speed */
1184         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2GB \
1185                                                         (UINT32_C(0x14) << 0)
1186                 /* 2.5Gb link speed */
1187         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2_5GB \
1188                                                         (UINT32_C(0x19) << 0)
1189                 /* 10Gb link speed */
1190         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10GB \
1191                                                         (UINT32_C(0x64) << 0)
1192                 /* 20Mb link speed */
1193         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_20GB \
1194                                                         (UINT32_C(0xc8) << 0)
1195                 /* 25Gb link speed */
1196         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_25GB \
1197                                                         (UINT32_C(0xfa) << 0)
1198                 /* 40Gb link speed */
1199         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_40GB \
1200                                                         (UINT32_C(0x190) << 0)
1201                 /* 50Gb link speed */
1202         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_50GB \
1203                                                         (UINT32_C(0x1f4) << 0)
1204                 /* 100Gb link speed */
1205         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100GB \
1206                                                         (UINT32_C(0x3e8) << 0)
1207                 /* 10Mb link speed */
1208         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10MB \
1209                                                         (UINT32_C(0xffff) << 0)
1210         uint16_t force_link_speed;
1211
1212         /*
1213          * This value is used to identify what autoneg mode is used when the
1214          * link speed is not being forced.
1215          */
1216                 /*
1217                  * Disable autoneg or autoneg disabled. No speeds are selected.
1218                  */
1219         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_NONE  (UINT32_C(0x0) << 0)
1220                 /* Select all possible speeds for autoneg mode. */
1221         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS \
1222                                                         (UINT32_C(0x1) << 0)
1223                 /*
1224                  * Select only the auto_link_speed speed for autoneg mode. This
1225                  * mode has been DEPRECATED. An HWRM client should not use this
1226                  * mode.
1227                  */
1228         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_SPEED \
1229                                                         (UINT32_C(0x2) << 0)
1230                 /*
1231                  * Select the auto_link_speed or any speed below that speed for
1232                  * autoneg. This mode has been DEPRECATED. An HWRM client should
1233                  * not use this mode.
1234                  */
1235         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_OR_BELOW \
1236                                                         (UINT32_C(0x3) << 0)
1237                 /*
1238                  * Select the speeds based on the corresponding link speed mask
1239                  * value that is provided.
1240                  */
1241         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK \
1242                                                         (UINT32_C(0x4) << 0)
1243         uint8_t auto_mode;
1244
1245         /*
1246          * This is the duplex setting that will be used if the autoneg_mode is
1247          * "one_speed" or "one_or_below".
1248          */
1249                 /* Half Duplex will be requested. */
1250         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF \
1251                                                         (UINT32_C(0x0) << 0)
1252                 /* Full duplex will be requested. */
1253         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_FULL \
1254                                                         (UINT32_C(0x1) << 0)
1255                 /* Both Half and Full dupex will be requested. */
1256         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_BOTH \
1257                                                         (UINT32_C(0x2) << 0)
1258         uint8_t auto_duplex;
1259
1260         /*
1261          * This value is used to configure the pause that will be used for
1262          * autonegotiation. Add text on the usage of auto_pause and force_pause.
1263          */
1264         /*
1265          * When this bit is '1', Generation of tx pause messages has been
1266          * requested. Disabled otherwise.
1267          */
1268         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX              UINT32_C(0x1)
1269         /*
1270          * When this bit is '1', Reception of rx pause messages has been
1271          * requested. Disabled otherwise.
1272          */
1273         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX              UINT32_C(0x2)
1274         /*
1275          * When set to 1, the advertisement of pause is enabled. # When the
1276          * auto_mode is not set to none and this flag is set to 1, then the
1277          * auto_pause bits on this port are being advertised and autoneg pause
1278          * results are being interpreted. # When the auto_mode is not set to
1279          * none and this flag is set to 0, the pause is forced as indicated in
1280          * force_pause, and also advertised as auto_pause bits, but the autoneg
1281          * results are not interpreted since the pause configuration is being
1282          * forced. # When the auto_mode is set to none and this flag is set to
1283          * 1, auto_pause bits should be ignored and should be set to 0.
1284          */
1285         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_AUTONEG_PAUSE   UINT32_C(0x4)
1286         uint8_t auto_pause;
1287
1288         uint8_t unused_0;
1289
1290         /*
1291          * This is the speed that will be used if the autoneg_mode is
1292          * "one_speed" or "one_or_below". If an unsupported speed is selected,
1293          * an error will be generated.
1294          */
1295                 /* 100Mb link speed */
1296         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB \
1297                                                         (UINT32_C(0x1) << 0)
1298                 /* 1Gb link speed */
1299         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_1GB \
1300                                                         (UINT32_C(0xa) << 0)
1301                 /* 2Gb link speed */
1302         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2GB \
1303                                                         (UINT32_C(0x14) << 0)
1304                 /* 2.5Gb link speed */
1305         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2_5GB \
1306                                                         (UINT32_C(0x19) << 0)
1307                 /* 10Gb link speed */
1308         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10GB \
1309                                                         (UINT32_C(0x64) << 0)
1310                 /* 20Mb link speed */
1311         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_20GB \
1312                                                         (UINT32_C(0xc8) << 0)
1313                 /* 25Gb link speed */
1314         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_25GB \
1315                                                         (UINT32_C(0xfa) << 0)
1316                 /* 40Gb link speed */
1317         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_40GB \
1318                                                         (UINT32_C(0x190) << 0)
1319                 /* 50Gb link speed */
1320         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_50GB \
1321                                                         (UINT32_C(0x1f4) << 0)
1322                 /* 100Gb link speed */
1323         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100GB \
1324                                                         (UINT32_C(0x3e8) << 0)
1325                 /* 10Mb link speed */
1326         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10MB \
1327                                                         (UINT32_C(0xffff) << 0)
1328         uint16_t auto_link_speed;
1329
1330         /*
1331          * This is a mask of link speeds that will be used if autoneg_mode is
1332          * "mask". If unsupported speed is enabled an error will be generated.
1333          */
1334         /* 100Mb link speed (Half-duplex) */
1335         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MBHD \
1336                                                         UINT32_C(0x1)
1337         /* 100Mb link speed (Full-duplex) */
1338         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB \
1339                                                         UINT32_C(0x2)
1340         /* 1Gb link speed (Half-duplex) */
1341         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GBHD \
1342                                                         UINT32_C(0x4)
1343         /* 1Gb link speed (Full-duplex) */
1344         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GB \
1345                                                         UINT32_C(0x8)
1346         /* 2Gb link speed */
1347         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2GB \
1348                                                         UINT32_C(0x10)
1349         /* 2.5Gb link speed */
1350         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2_5GB \
1351                                                         UINT32_C(0x20)
1352         /* 10Gb link speed */
1353         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10GB \
1354                                                         UINT32_C(0x40)
1355         /* 20Gb link speed */
1356         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_20GB \
1357                                                         UINT32_C(0x80)
1358         /* 25Gb link speed */
1359         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_25GB \
1360                                                         UINT32_C(0x100)
1361         /* 40Gb link speed */
1362         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_40GB \
1363                                                         UINT32_C(0x200)
1364         /* 50Gb link speed */
1365         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_50GB \
1366                                                         UINT32_C(0x400)
1367         /* 100Gb link speed */
1368         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100GB \
1369                                                         UINT32_C(0x800)
1370         /* 10Mb link speed (Half-duplex) */
1371         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MBHD \
1372                                                         UINT32_C(0x1000)
1373         /* 10Mb link speed (Full-duplex) */
1374         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MB \
1375                                                         UINT32_C(0x2000)
1376         uint16_t auto_link_speed_mask;
1377
1378         /* This value controls the wirespeed feature. */
1379                 /* Wirespeed feature is disabled. */
1380         #define HWRM_PORT_PHY_CFG_INPUT_WIRESPEED_OFF   (UINT32_C(0x0) << 0)
1381                 /* Wirespeed feature is enabled. */
1382         #define HWRM_PORT_PHY_CFG_INPUT_WIRESPEED_ON    (UINT32_C(0x1) << 0)
1383         uint8_t wirespeed;
1384
1385         /* This value controls the loopback setting for the PHY. */
1386                 /* No loopback is selected. Normal operation. */
1387         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_NONE       (UINT32_C(0x0) << 0)
1388                 /*
1389                  * The HW will be configured with local loopback such that host
1390                  * data is sent back to the host without modification.
1391                  */
1392         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_LOCAL      (UINT32_C(0x1) << 0)
1393                 /*
1394                  * The HW will be configured with remote loopback such that port
1395                  * logic will send packets back out the transmitter that are
1396                  * received.
1397                  */
1398         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_REMOTE     (UINT32_C(0x2) << 0)
1399         uint8_t lpbk;
1400
1401         /*
1402          * This value is used to configure the pause that will be used for force
1403          * mode.
1404          */
1405         /*
1406          * When this bit is '1', Generation of tx pause messages is supported.
1407          * Disabled otherwise.
1408          */
1409         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX             UINT32_C(0x1)
1410         /*
1411          * When this bit is '1', Reception of rx pause messages is supported.
1412          * Disabled otherwise.
1413          */
1414         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX             UINT32_C(0x2)
1415         uint8_t force_pause;
1416
1417         uint8_t unused_1;
1418
1419         /*
1420          * This value controls the pre-emphasis to be used for the link. Driver
1421          * should not set this value (use enable.preemphasis = 0) unless driver
1422          * is sure of setting. Normally HWRM FW will determine proper pre-
1423          * emphasis.
1424          */
1425         uint32_t preemphasis;
1426
1427         /*
1428          * Setting for link speed mask that is used to advertise speeds during
1429          * autonegotiation when EEE is enabled. This field is valid only when
1430          * EEE is enabled. The speeds specified in this field shall be a subset
1431          * of speeds specified in auto_link_speed_mask. If EEE is enabled,then
1432          * at least one speed shall be provided in this mask.
1433          */
1434         /* Reserved */
1435         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD1  UINT32_C(0x1)
1436         /* 100Mb link speed (Full-duplex) */
1437         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_100MB  UINT32_C(0x2)
1438         /* Reserved */
1439         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD2  UINT32_C(0x4)
1440         /* 1Gb link speed (Full-duplex) */
1441         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_1GB    UINT32_C(0x8)
1442         /* Reserved */
1443         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD3 \
1444                                                                 UINT32_C(0x10)
1445         /* Reserved */
1446         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD4 \
1447                                                                 UINT32_C(0x20)
1448         /* 10Gb link speed */
1449         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_10GB \
1450                                                                 UINT32_C(0x40)
1451         uint16_t eee_link_speed_mask;
1452
1453         uint8_t unused_2;
1454         uint8_t unused_3;
1455
1456         /*
1457          * Reuested setting of TX LPI timer in microseconds. This field is valid
1458          * only when EEE is enabled and TX LPI is enabled.
1459          */
1460         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_MASK \
1461                                                         UINT32_C(0xffffff)
1462         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_SFT           0
1463         uint32_t tx_lpi_timer;
1464
1465         uint32_t unused_4;
1466 } __attribute__((packed));
1467
1468 /* Output (16 bytes) */
1469 struct hwrm_port_phy_cfg_output {
1470         /*
1471          * Pass/Fail or error type Note: receiver to verify the in parameters,
1472          * and fail the call with an error when appropriate
1473          */
1474         uint16_t error_code;
1475
1476         /* This field returns the type of original request. */
1477         uint16_t req_type;
1478
1479         /* This field provides original sequence number of the command. */
1480         uint16_t seq_id;
1481
1482         /*
1483          * This field is the length of the response in bytes. The last byte of
1484          * the response is a valid flag that will read as '1' when the command
1485          * has been completely written to memory.
1486          */
1487         uint16_t resp_len;
1488
1489         uint32_t unused_0;
1490         uint8_t unused_1;
1491         uint8_t unused_2;
1492         uint8_t unused_3;
1493
1494         /*
1495          * This field is used in Output records to indicate that the output is
1496          * completely written to RAM. This field should be read as '1' to
1497          * indicate that the output has been completely written. When writing a
1498          * command completion or response to an internal processor, the order of
1499          * writes has to be such that this field is written last.
1500          */
1501         uint8_t valid;
1502 } __attribute__((packed));
1503
1504 /* hwrm_ver_get */
1505 /*
1506  * Description: This function is called by a driver to determine the HWRM
1507  * interface version supported by the HWRM firmware, the version of HWRM
1508  * firmware implementation, the name of HWRM firmware, the versions of other
1509  * embedded firmwares, and the names of other embedded firmwares, etc. Any
1510  * interface or firmware version with major = 0, minor = 0, and update = 0 shall
1511  * be considered an invalid version.
1512  */
1513
1514 /* Input (24 bytes) */
1515 struct hwrm_ver_get_input {
1516         /*
1517          * This value indicates what type of request this is. The format for the
1518          * rest of the command is determined by this field.
1519          */
1520         uint16_t req_type;
1521
1522         /*
1523          * This value indicates the what completion ring the request will be
1524          * optionally completed on. If the value is -1, then no CR completion
1525          * will be generated. Any other value must be a valid CR ring_id value
1526          * for this function.
1527          */
1528         uint16_t cmpl_ring;
1529
1530         /* This value indicates the command sequence number. */
1531         uint16_t seq_id;
1532
1533         /*
1534          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1535          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1536          */
1537         uint16_t target_id;
1538
1539         /*
1540          * This is the host address where the response will be written when the
1541          * request is complete. This area must be 16B aligned and must be
1542          * cleared to zero before the request is made.
1543          */
1544         uint64_t resp_addr;
1545
1546         /*
1547          * This field represents the major version of HWRM interface
1548          * specification supported by the driver HWRM implementation. The
1549          * interface major version is intended to change only when non backward
1550          * compatible changes are made to the HWRM interface specification.
1551          */
1552         uint8_t hwrm_intf_maj;
1553
1554         /*
1555          * This field represents the minor version of HWRM interface
1556          * specification supported by the driver HWRM implementation. A change
1557          * in interface minor version is used to reflect significant backward
1558          * compatible modification to HWRM interface specification. This can be
1559          * due to addition or removal of functionality. HWRM interface
1560          * specifications with the same major version but different minor
1561          * versions are compatible.
1562          */
1563         uint8_t hwrm_intf_min;
1564
1565         /*
1566          * This field represents the update version of HWRM interface
1567          * specification supported by the driver HWRM implementation. The
1568          * interface update version is used to reflect minor changes or bug
1569          * fixes to a released HWRM interface specification.
1570          */
1571         uint8_t hwrm_intf_upd;
1572
1573         uint8_t unused_0[5];
1574 } __attribute__((packed));
1575
1576 /* Output (128 bytes) */
1577 struct hwrm_ver_get_output {
1578         /*
1579          * Pass/Fail or error type Note: receiver to verify the in parameters,
1580          * and fail the call with an error when appropriate
1581          */
1582         uint16_t error_code;
1583
1584         /* This field returns the type of original request. */
1585         uint16_t req_type;
1586
1587         /* This field provides original sequence number of the command. */
1588         uint16_t seq_id;
1589
1590         /*
1591          * This field is the length of the response in bytes. The last byte of
1592          * the response is a valid flag that will read as '1' when the command
1593          * has been completely written to memory.
1594          */
1595         uint16_t resp_len;
1596
1597         /*
1598          * This field represents the major version of HWRM interface
1599          * specification supported by the HWRM implementation. The interface
1600          * major version is intended to change only when non backward compatible
1601          * changes are made to the HWRM interface specification. A HWRM
1602          * implementation that is compliant with this specification shall
1603          * provide value of 1 in this field.
1604          */
1605         uint8_t hwrm_intf_maj;
1606
1607         /*
1608          * This field represents the minor version of HWRM interface
1609          * specification supported by the HWRM implementation. A change in
1610          * interface minor version is used to reflect significant backward
1611          * compatible modification to HWRM interface specification. This can be
1612          * due to addition or removal of functionality. HWRM interface
1613          * specifications with the same major version but different minor
1614          * versions are compatible. A HWRM implementation that is compliant with
1615          * this specification shall provide value of 0 in this field.
1616          */
1617         uint8_t hwrm_intf_min;
1618
1619         /*
1620          * This field represents the update version of HWRM interface
1621          * specification supported by the HWRM implementation. The interface
1622          * update version is used to reflect minor changes or bug fixes to a
1623          * released HWRM interface specification. A HWRM implementation that is
1624          * compliant with this specification shall provide value of 1 in this
1625          * field.
1626          */
1627         uint8_t hwrm_intf_upd;
1628
1629         uint8_t hwrm_intf_rsvd;
1630
1631         /*
1632          * This field represents the major version of HWRM firmware. A change in
1633          * firmware major version represents a major firmware release.
1634          */
1635         uint8_t hwrm_fw_maj;
1636
1637         /*
1638          * This field represents the minor version of HWRM firmware. A change in
1639          * firmware minor version represents significant firmware functionality
1640          * changes.
1641          */
1642         uint8_t hwrm_fw_min;
1643
1644         /*
1645          * This field represents the build version of HWRM firmware. A change in
1646          * firmware build version represents bug fixes to a released firmware.
1647          */
1648         uint8_t hwrm_fw_bld;
1649
1650         /*
1651          * This field is a reserved field. This field can be used to represent
1652          * firmware branches or customer specific releases tied to a specific
1653          * (major,minor,update) version of the HWRM firmware.
1654          */
1655         uint8_t hwrm_fw_rsvd;
1656
1657         /*
1658          * This field represents the major version of mgmt firmware. A change in
1659          * major version represents a major release.
1660          */
1661         uint8_t mgmt_fw_maj;
1662
1663         /*
1664          * This field represents the minor version of mgmt firmware. A change in
1665          * minor version represents significant functionality changes.
1666          */
1667         uint8_t mgmt_fw_min;
1668
1669         /*
1670          * This field represents the build version of mgmt firmware. A change in
1671          * update version represents bug fixes.
1672          */
1673         uint8_t mgmt_fw_bld;
1674
1675         /*
1676          * This field is a reserved field. This field can be used to represent
1677          * firmware branches or customer specific releases tied to a specific
1678          * (major,minor,update) version
1679          */
1680         uint8_t mgmt_fw_rsvd;
1681
1682         /*
1683          * This field represents the major version of network control firmware.
1684          * A change in major version represents a major release.
1685          */
1686         uint8_t netctrl_fw_maj;
1687
1688         /*
1689          * This field represents the minor version of network control firmware.
1690          * A change in minor version represents significant functionality
1691          * changes.
1692          */
1693         uint8_t netctrl_fw_min;
1694
1695         /*
1696          * This field represents the build version of network control firmware.
1697          * A change in update version represents bug fixes.
1698          */
1699         uint8_t netctrl_fw_bld;
1700
1701         /*
1702          * This field is a reserved field. This field can be used to represent
1703          * firmware branches or customer specific releases tied to a specific
1704          * (major,minor,update) version
1705          */
1706         uint8_t netctrl_fw_rsvd;
1707
1708         /*
1709          * This field is reserved for future use. The responder should set it to
1710          * 0. The requester should ignore this field.
1711          */
1712         uint32_t reserved1;
1713
1714         /*
1715          * This field represents the major version of RoCE firmware. A change in
1716          * major version represents a major release.
1717          */
1718         uint8_t roce_fw_maj;
1719
1720         /*
1721          * This field represents the minor version of RoCE firmware. A change in
1722          * minor version represents significant functionality changes.
1723          */
1724         uint8_t roce_fw_min;
1725
1726         /*
1727          * This field represents the build version of RoCE firmware. A change in
1728          * update version represents bug fixes.
1729          */
1730         uint8_t roce_fw_bld;
1731
1732         /*
1733          * This field is a reserved field. This field can be used to represent
1734          * firmware branches or customer specific releases tied to a specific
1735          * (major,minor,update) version
1736          */
1737         uint8_t roce_fw_rsvd;
1738
1739         /*
1740          * This field represents the name of HWRM FW (ASCII chars without NULL
1741          * at the end).
1742          */
1743         char hwrm_fw_name[16];
1744
1745         /*
1746          * This field represents the name of mgmt FW (ASCII chars without NULL
1747          * at the end).
1748          */
1749         char mgmt_fw_name[16];
1750
1751         /*
1752          * This field represents the name of network control firmware (ASCII
1753          * chars without NULL at the end).
1754          */
1755         char netctrl_fw_name[16];
1756
1757         /*
1758          * This field is reserved for future use. The responder should set it to
1759          * 0. The requester should ignore this field.
1760          */
1761         uint32_t reserved2[4];
1762
1763         /*
1764          * This field represents the name of RoCE FW (ASCII chars without NULL
1765          * at the end).
1766          */
1767         char roce_fw_name[16];
1768
1769         /* This field returns the chip number. */
1770         uint16_t chip_num;
1771
1772         /* This field returns the revision of chip. */
1773         uint8_t chip_rev;
1774
1775         /* This field returns the chip metal number. */
1776         uint8_t chip_metal;
1777
1778         /* This field returns the bond id of the chip. */
1779         uint8_t chip_bond_id;
1780
1781         /*
1782          * This value indicates the type of platform used for chip
1783          * implementation.
1784          */
1785         /* ASIC */
1786         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_ASIC \
1787                                                         (UINT32_C(0x0) << 0)
1788         /* FPGA platform of the chip. */
1789         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_FPGA \
1790                                                         (UINT32_C(0x1) << 0)
1791         /* Palladium platform of the chip. */
1792         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_PALLADIUM \
1793                                                         (UINT32_C(0x2) << 0)
1794         uint8_t chip_platform_type;
1795
1796         /*
1797          * This field returns the maximum value of request window that is
1798          * supported by the HWRM. The request window is mapped into device
1799          * address space using MMIO.
1800          */
1801         uint16_t max_req_win_len;
1802
1803         /*
1804          * This field returns the maximum value of response buffer in bytes. If
1805          * a request specifies the response buffer length that is greater than
1806          * this value, then the HWRM should fail it. The value of this field
1807          * shall be 4KB or more.
1808          */
1809         uint16_t max_resp_len;
1810
1811         /*
1812          * This field returns the default request timeout value in milliseconds.
1813          */
1814         uint16_t def_req_timeout;
1815
1816         uint8_t unused_0;
1817         uint8_t unused_1;
1818         uint8_t unused_2;
1819
1820         /*
1821          * This field is used in Output records to indicate that the output is
1822          * completely written to RAM. This field should be read as '1' to
1823          * indicate that the output has been completely written. When writing a
1824          * command completion or response to an internal processor, the order of
1825          * writes has to be such that this field is written last.
1826          */
1827         uint8_t valid;
1828 } __attribute__((packed));
1829
1830 /* hwrm_queue_qportcfg */
1831 /*
1832  * Description: This function is called by a driver to query queue configuration
1833  * of a port. # The HWRM shall at least advertise one queue with lossy service
1834  * profile. # The driver shall use this command to query queue ids before
1835  * configuring or using any queues. # If a service profile is not set for a
1836  * queue, then the driver shall not use that queue without configuring a service
1837  * profile for it. # If the driver is not allowed to configure service profiles,
1838  * then the driver shall only use queues for which service profiles are pre-
1839  * configured.
1840  */
1841
1842 /* Input (24 bytes) */
1843 struct hwrm_queue_qportcfg_input {
1844         /*
1845          * This value indicates what type of request this is. The format for the
1846          * rest of the command is determined by this field.
1847          */
1848         uint16_t req_type;
1849
1850         /*
1851          * This value indicates the what completion ring the request will be
1852          * optionally completed on. If the value is -1, then no CR completion
1853          * will be generated. Any other value must be a valid CR ring_id value
1854          * for this function.
1855          */
1856         uint16_t cmpl_ring;
1857
1858         /* This value indicates the command sequence number. */
1859         uint16_t seq_id;
1860
1861         /*
1862          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1863          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1864          */
1865         uint16_t target_id;
1866
1867         /*
1868          * This is the host address where the response will be written when the
1869          * request is complete. This area must be 16B aligned and must be
1870          * cleared to zero before the request is made.
1871          */
1872         uint64_t resp_addr;
1873
1874         /*
1875          * Enumeration denoting the RX, TX type of the resource. This
1876          * enumeration is used for resources that are similar for both TX and RX
1877          * paths of the chip.
1878          */
1879         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH \
1880                                                         UINT32_C(0x1)
1881                 /* tx path */
1882         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX \
1883                                                         (UINT32_C(0x0) << 0)
1884                 /* rx path */
1885         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX \
1886                                                         (UINT32_C(0x1) << 0)
1887         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
1888                                         HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
1889         uint32_t flags;
1890
1891         /*
1892          * Port ID of port for which the queue configuration is being queried.
1893          * This field is only required when sent by IPC.
1894          */
1895         uint16_t port_id;
1896
1897         uint16_t unused_0;
1898 } __attribute__((packed));
1899
1900 /* hwrm_vnic_rss_cfg */
1901 /* Description: This function is used to enable RSS configuration. */
1902
1903 /* Input (48 bytes) */
1904 struct hwrm_vnic_rss_cfg_input {
1905         /*
1906          * This value indicates what type of request this is. The format for the
1907          * rest of the command is determined by this field.
1908          */
1909         uint16_t req_type;
1910
1911         /*
1912          * This value indicates the what completion ring the request will be
1913          * optionally completed on. If the value is -1, then no CR completion
1914          * will be generated. Any other value must be a valid CR ring_id value
1915          * for this function.
1916          */
1917         uint16_t cmpl_ring;
1918
1919         /* This value indicates the command sequence number. */
1920         uint16_t seq_id;
1921
1922         /*
1923          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1924          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1925          */
1926         uint16_t target_id;
1927
1928         /*
1929          * This is the host address where the response will be written when the
1930          * request is complete. This area must be 16B aligned and must be
1931          * cleared to zero before the request is made.
1932          */
1933         uint64_t resp_addr;
1934
1935         /*
1936          * When this bit is '1', the RSS hash shall be computed over source and
1937          * destination IPv4 addresses of IPv4 packets.
1938          */
1939         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4          UINT32_C(0x1)
1940         /*
1941          * When this bit is '1', the RSS hash shall be computed over
1942          * source/destination IPv4 addresses and source/destination ports of
1943          * TCP/IPv4 packets.
1944          */
1945         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV4      UINT32_C(0x2)
1946         /*
1947          * When this bit is '1', the RSS hash shall be computed over
1948          * source/destination IPv4 addresses and source/destination ports of
1949          * UDP/IPv4 packets.
1950          */
1951         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV4      UINT32_C(0x4)
1952         /*
1953          * When this bit is '1', the RSS hash shall be computed over source and
1954          * destination IPv4 addresses of IPv6 packets.
1955          */
1956         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV6          UINT32_C(0x8)
1957         /*
1958          * When this bit is '1', the RSS hash shall be computed over
1959          * source/destination IPv6 addresses and source/destination ports of
1960          * TCP/IPv6 packets.
1961          */
1962         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_TCP_IPV6      UINT32_C(0x10)
1963         /*
1964          * When this bit is '1', the RSS hash shall be computed over
1965          * source/destination IPv6 addresses and source/destination ports of
1966          * UDP/IPv6 packets.
1967          */
1968         #define HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_UDP_IPV6      UINT32_C(0x20)
1969         uint32_t hash_type;
1970
1971         uint32_t unused_0;
1972
1973         /* This is the address for rss ring group table */
1974         uint64_t ring_grp_tbl_addr;
1975
1976         /* This is the address for rss hash key table */
1977         uint64_t hash_key_tbl_addr;
1978
1979         /* Index to the rss indirection table. */
1980         uint16_t rss_ctx_idx;
1981
1982         uint16_t unused_1[3];
1983 } __attribute__((packed));
1984
1985 /* Output (16 bytes) */
1986 struct hwrm_vnic_rss_cfg_output {
1987         /*
1988          * Pass/Fail or error type Note: receiver to verify the in parameters,
1989          * and fail the call with an error when appropriate
1990          */
1991         uint16_t error_code;
1992
1993         /* This field returns the type of original request. */
1994         uint16_t req_type;
1995
1996         /* This field provides original sequence number of the command. */
1997         uint16_t seq_id;
1998
1999         /*
2000          * This field is the length of the response in bytes. The last byte of
2001          * the response is a valid flag that will read as '1' when the command
2002          * has been completely written to memory.
2003          */
2004         uint16_t resp_len;
2005
2006         uint32_t unused_0;
2007         uint8_t unused_1;
2008         uint8_t unused_2;
2009         uint8_t unused_3;
2010
2011         /*
2012          * This field is used in Output records to indicate that the output is
2013          * completely written to RAM. This field should be read as '1' to
2014          * indicate that the output has been completely written. When writing a
2015          * command completion or response to an internal processor, the order of
2016          * writes has to be such that this field is written last.
2017          */
2018         uint8_t valid;
2019 } __attribute__((packed));
2020
2021 /* Output (32 bytes) */
2022 struct hwrm_queue_qportcfg_output {
2023         /*
2024          * Pass/Fail or error type Note: receiver to verify the in parameters,
2025          * and fail the call with an error when appropriate
2026          */
2027         uint16_t error_code;
2028
2029         /* This field returns the type of original request. */
2030         uint16_t req_type;
2031
2032         /* This field provides original sequence number of the command. */
2033         uint16_t seq_id;
2034
2035         /*
2036          * This field is the length of the response in bytes. The last byte of
2037          * the response is a valid flag that will read as '1' when the command
2038          * has been completely written to memory.
2039          */
2040         uint16_t resp_len;
2041
2042         /* The maximum number of queues that can be configured. */
2043         uint8_t max_configurable_queues;
2044
2045         /* The maximum number of lossless queues that can be configured. */
2046         uint8_t max_configurable_lossless_queues;
2047
2048         /*
2049          * 0 - Not allowed. Non-zero - Allowed. If this value is non-zero, then
2050          * the HWRM shall allow the host SW driver to configure queues using
2051          * hwrm_queue_cfg.
2052          */
2053         uint8_t queue_cfg_allowed;
2054
2055         /*
2056          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
2057          * the HWRM shall allow the host SW driver to configure queue buffers
2058          * using hwrm_queue_buffers_cfg.
2059          */
2060         uint8_t queue_buffers_cfg_allowed;
2061
2062         /*
2063          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
2064          * the HWRM shall allow the host SW driver to configure PFC using
2065          * hwrm_queue_pfcenable_cfg.
2066          */
2067         uint8_t queue_pfcenable_cfg_allowed;
2068
2069         /*
2070          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
2071          * the HWRM shall allow the host SW driver to configure Priority to CoS
2072          * mapping using hwrm_queue_pri2cos_cfg.
2073          */
2074         uint8_t queue_pri2cos_cfg_allowed;
2075
2076         /*
2077          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
2078          * the HWRM shall allow the host SW driver to configure CoS Bandwidth
2079          * configuration using hwrm_queue_cos2bw_cfg.
2080          */
2081         uint8_t queue_cos2bw_cfg_allowed;
2082
2083         /* ID of CoS Queue 0. FF - Invalid id */
2084         uint8_t queue_id0;
2085
2086         /* This value is applicable to CoS queues only. */
2087                 /* Lossy (best-effort) */
2088         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
2089                                                         (UINT32_C(0x0) << 0)
2090                 /* Lossless */
2091         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
2092                                                         (UINT32_C(0x1) << 0)
2093                 /*
2094                  * Set to 0xFF... (All Fs) if there is no service profile
2095                  * specified
2096                  */
2097         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
2098                                                         (UINT32_C(0xff) << 0)
2099         uint8_t queue_id0_service_profile;
2100
2101         /* ID of CoS Queue 1. FF - Invalid id */
2102         uint8_t queue_id1;
2103         /* This value is applicable to CoS queues only. */
2104                 /* Lossy (best-effort) */
2105         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
2106                                                         (UINT32_C(0x0) << 0)
2107                 /* Lossless */
2108         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
2109                                                         (UINT32_C(0x1) << 0)
2110                 /*
2111                  * Set to 0xFF... (All Fs) if there is no service profile
2112                  * specified
2113                  */
2114         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
2115                                                         (UINT32_C(0xff) << 0)
2116         uint8_t queue_id1_service_profile;
2117
2118         /* ID of CoS Queue 2. FF - Invalid id */
2119         uint8_t queue_id2;
2120         /* This value is applicable to CoS queues only. */
2121                 /* Lossy (best-effort) */
2122         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
2123                                                         (UINT32_C(0x0) << 0)
2124                 /* Lossless */
2125         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
2126                                                         (UINT32_C(0x1) << 0)
2127                 /*
2128                  * Set to 0xFF... (All Fs) if there is no service profile
2129                  * specified
2130                  */
2131         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
2132                                                         (UINT32_C(0xff) << 0)
2133         uint8_t queue_id2_service_profile;
2134
2135         /* ID of CoS Queue 3. FF - Invalid id */
2136         uint8_t queue_id3;
2137
2138         /* This value is applicable to CoS queues only. */
2139                 /* Lossy (best-effort) */
2140         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
2141                                                         (UINT32_C(0x0) << 0)
2142                 /* Lossless */
2143         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
2144                                                         (UINT32_C(0x1) << 0)
2145                 /*
2146                  * Set to 0xFF... (All Fs) if there is no service profile
2147                  * specified
2148                  */
2149         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
2150                                                         (UINT32_C(0xff) << 0)
2151         uint8_t queue_id3_service_profile;
2152
2153         /* ID of CoS Queue 4. FF - Invalid id */
2154         uint8_t queue_id4;
2155         /* This value is applicable to CoS queues only. */
2156                 /* Lossy (best-effort) */
2157         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
2158                                                         (UINT32_C(0x0) << 0)
2159                 /* Lossless */
2160         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
2161                                                         (UINT32_C(0x1) << 0)
2162                 /*
2163                  * Set to 0xFF... (All Fs) if there is no service profile
2164                  * specified
2165                  */
2166         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
2167                                                         (UINT32_C(0xff) << 0)
2168         uint8_t queue_id4_service_profile;
2169
2170         /* ID of CoS Queue 5. FF - Invalid id */
2171         uint8_t queue_id5;
2172
2173         /* This value is applicable to CoS queues only. */
2174                 /* Lossy (best-effort) */
2175         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
2176                                                         (UINT32_C(0x0) << 0)
2177                 /* Lossless */
2178         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
2179                                                         (UINT32_C(0x1) << 0)
2180                 /*
2181                  * Set to 0xFF... (All Fs) if there is no service profile
2182                  * specified
2183                  */
2184         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
2185                                                         (UINT32_C(0xff) << 0)
2186         uint8_t queue_id5_service_profile;
2187
2188         /* ID of CoS Queue 6. FF - Invalid id */
2189         uint8_t queue_id6_service_profile;
2190         /* This value is applicable to CoS queues only. */
2191                 /* Lossy (best-effort) */
2192         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
2193                                                         (UINT32_C(0x0) << 0)
2194                 /* Lossless */
2195         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
2196                                                         (UINT32_C(0x1) << 0)
2197                 /*
2198                  * Set to 0xFF... (All Fs) if there is no service profile
2199                  * specified
2200                  */
2201         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
2202                                                         (UINT32_C(0xff) << 0)
2203         uint8_t queue_id6;
2204
2205         /* ID of CoS Queue 7. FF - Invalid id */
2206         uint8_t queue_id7;
2207
2208         /* This value is applicable to CoS queues only. */
2209                 /* Lossy (best-effort) */
2210         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
2211                                                         (UINT32_C(0x0) << 0)
2212                 /* Lossless */
2213         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
2214                                                         (UINT32_C(0x1) << 0)
2215                 /*
2216                  * Set to 0xFF... (All Fs) if there is no service profile
2217                  * specified
2218                  */
2219         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
2220                                                         (UINT32_C(0xff) << 0)
2221         uint8_t queue_id7_service_profile;
2222
2223         /*
2224          * This field is used in Output records to indicate that the output is
2225          * completely written to RAM. This field should be read as '1' to
2226          * indicate that the output has been completely written. When writing a
2227          * command completion or response to an internal processor, the order of
2228          * writes has to be such that this field is written last.
2229          */
2230         uint8_t valid;
2231 } __attribute__((packed));
2232
2233 /* hwrm_func_drv_rgtr */
2234 /*
2235  * Description: This command is used by the function driver to register its
2236  * information with the HWRM. A function driver shall implement this command. A
2237  * function driver shall use this command during the driver initialization right
2238  * after the HWRM version discovery and default ring resources allocation.
2239  */
2240
2241 /* Input (80 bytes) */
2242 struct hwrm_func_drv_rgtr_input {
2243         /*
2244          * This value indicates what type of request this is. The format for the
2245          * rest of the command is determined by this field.
2246          */
2247         uint16_t req_type;
2248
2249         /*
2250          * This value indicates the what completion ring the request will be
2251          * optionally completed on. If the value is -1, then no CR completion
2252          * will be generated. Any other value must be a valid CR ring_id value
2253          * for this function.
2254          */
2255         uint16_t cmpl_ring;
2256
2257         /* This value indicates the command sequence number. */
2258         uint16_t seq_id;
2259
2260         /*
2261          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2262          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2263          */
2264         uint16_t target_id;
2265
2266         /*
2267          * This is the host address where the response will be written when the
2268          * request is complete. This area must be 16B aligned and must be
2269          * cleared to zero before the request is made.
2270          */
2271         uint64_t resp_addr;
2272
2273         /*
2274          * When this bit is '1', the function driver is requesting all requests
2275          * from its children VF drivers to be forwarded to itself. This flag can
2276          * only be set by the PF driver. If a VF driver sets this flag, it
2277          * should be ignored by the HWRM.
2278          */
2279         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_ALL_MODE        UINT32_C(0x1)
2280         /*
2281          * When this bit is '1', the function is requesting none of the requests
2282          * from its children VF drivers to be forwarded to itself. This flag can
2283          * only be set by the PF driver. If a VF driver sets this flag, it
2284          * should be ignored by the HWRM.
2285          */
2286         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE       UINT32_C(0x2)
2287         uint32_t flags;
2288
2289         /* This bit must be '1' for the os_type field to be configured. */
2290         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_OS_TYPE           UINT32_C(0x1)
2291         /* This bit must be '1' for the ver field to be configured. */
2292         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER               UINT32_C(0x2)
2293         /* This bit must be '1' for the timestamp field to be configured. */
2294         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_TIMESTAMP         UINT32_C(0x4)
2295         /* This bit must be '1' for the vf_req_fwd field to be configured. */
2296         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VF_REQ_FWD        UINT32_C(0x8)
2297         /*
2298          * This bit must be '1' for the async_event_fwd field to be configured.
2299          */
2300         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD \
2301                                                                 UINT32_C(0x10)
2302         uint32_t enables;
2303
2304         /* This value indicates the type of OS. */
2305                 /* Unknown */
2306         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_UNKNOWN \
2307                                                         (UINT32_C(0x0) << 0)
2308                 /* Other OS not listed below. */
2309         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_OTHER \
2310                                                         (UINT32_C(0x1) << 0)
2311                 /* MSDOS OS. */
2312         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_MSDOS \
2313                                                         (UINT32_C(0xe) << 0)
2314                 /* Windows OS. */
2315         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WINDOWS \
2316                                                         (UINT32_C(0x12) << 0)
2317                 /* Solaris OS. */
2318         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_SOLARIS \
2319                                                         (UINT32_C(0x1d) << 0)
2320                 /* Linux OS. */
2321         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_LINUX \
2322                                                         (UINT32_C(0x24) << 0)
2323                 /* FreeBSD OS. */
2324         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_FREEBSD \
2325                                                         (UINT32_C(0x2a) << 0)
2326                 /* VMware ESXi OS. */
2327         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_ESXI \
2328                                                         (UINT32_C(0x68) << 0)
2329                 /* Microsoft Windows 8 64-bit OS. */
2330         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN864 \
2331                                                         (UINT32_C(0x73) << 0)
2332                 /* Microsoft Windows Server 2012 R2 OS. */
2333         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN2012R2 \
2334                                                         (UINT32_C(0x74) << 0)
2335         uint16_t os_type;
2336
2337         /* This is the major version of the driver. */
2338         uint8_t ver_maj;
2339
2340         /* This is the minor version of the driver. */
2341         uint8_t ver_min;
2342
2343         /* This is the update version of the driver. */
2344         uint8_t ver_upd;
2345
2346         uint8_t unused_0;
2347         uint16_t unused_1;
2348
2349         /*
2350          * This is a 32-bit timestamp provided by the driver for keep alive. The
2351          * timestamp is in multiples of 1ms.
2352          */
2353         uint32_t timestamp;
2354
2355         uint32_t unused_2;
2356
2357         /*
2358          * This is a 256-bit bit mask provided by the PF driver for letting the
2359          * HWRM know what commands issued by the VF driver to the HWRM should be
2360          * forwarded to the PF driver. Nth bit refers to the Nth req_type.
2361          * Setting Nth bit to 1 indicates that requests from the VF driver with
2362          * req_type equal to N shall be forwarded to the parent PF driver. This
2363          * field is not valid for the VF driver.
2364          */
2365         uint32_t vf_req_fwd[8];
2366
2367         /*
2368          * This is a 256-bit bit mask provided by the function driver (PF or VF
2369          * driver) to indicate the list of asynchronous event completions to be
2370          * forwarded. Nth bit refers to the Nth event_id. Setting Nth bit to 1
2371          * by the function driver shall result in the HWRM forwarding
2372          * asynchronous event completion with event_id equal to N. If all bits
2373          * are set to 0 (value of 0), then the HWRM shall not forward any
2374          * asynchronous event completion to this function driver.
2375          */
2376         uint32_t async_event_fwd[8];
2377 } __attribute__((packed));
2378
2379 /* Output (16 bytes) */
2380
2381 struct hwrm_func_drv_rgtr_output {
2382         /*
2383          * Pass/Fail or error type Note: receiver to verify the in parameters,
2384          * and fail the call with an error when appropriate
2385          */
2386         uint16_t error_code;
2387
2388         /* This field returns the type of original request. */
2389         uint16_t req_type;
2390
2391         /* This field provides original sequence number of the command. */
2392         uint16_t seq_id;
2393
2394         /*
2395          * This field is the length of the response in bytes. The last byte of
2396          * the response is a valid flag that will read as '1' when the command
2397          * has been completely written to memory.
2398          */
2399         uint16_t resp_len;
2400
2401         uint32_t unused_0;
2402         uint8_t unused_1;
2403         uint8_t unused_2;
2404         uint8_t unused_3;
2405
2406         /*
2407          * This field is used in Output records to indicate that the output is
2408          * completely written to RAM. This field should be read as '1' to
2409          * indicate that the output has been completely written. When writing a
2410          * command completion or response to an internal processor, the order of
2411          * writes has to be such that this field is written last.
2412          */
2413         uint8_t valid;
2414 } __attribute__((packed));
2415
2416 /* hwrm_func_drv_unrgtr */
2417 /*
2418  * Description: This command is used by the function driver to un register with
2419  * the HWRM. A function driver shall implement this command. A function driver
2420  * shall use this command during the driver unloading.
2421  */
2422 /* Input (24 bytes) */
2423
2424 struct hwrm_func_drv_unrgtr_input {
2425         /*
2426          * This value indicates what type of request this is. The format for the
2427          * rest of the command is determined by this field.
2428          */
2429         uint16_t req_type;
2430
2431         /*
2432          * This value indicates the what completion ring the request will be
2433          * optionally completed on. If the value is -1, then no CR completion
2434          * will be generated. Any other value must be a valid CR ring_id value
2435          * for this function.
2436          */
2437         uint16_t cmpl_ring;
2438
2439         /* This value indicates the command sequence number. */
2440         uint16_t seq_id;
2441
2442         /*
2443          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
2444          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
2445          */
2446         uint16_t target_id;
2447
2448         /*
2449          * This is the host address where the response will be written when the
2450          * request is complete. This area must be 16B aligned and must be
2451          * cleared to zero before the request is made.
2452          */
2453         uint64_t resp_addr;
2454
2455         /*
2456          * When this bit is '1', the function driver is notifying the HWRM to
2457          * prepare for the shutdown.
2458          */
2459         #define HWRM_FUNC_DRV_UNRGTR_INPUT_FLAGS_PREPARE_FOR_SHUTDOWN \
2460                                                         UINT32_C(0x1)
2461         uint32_t flags;
2462
2463         uint32_t unused_0;
2464 } __attribute__((packed));
2465
2466 /* Output (16 bytes) */
2467 struct hwrm_func_drv_unrgtr_output {
2468         /*
2469          * Pass/Fail or error type Note: receiver to verify the in parameters,
2470          * and fail the call with an error when appropriate
2471          */
2472         uint16_t error_code;
2473
2474         /* This field returns the type of original request. */
2475         uint16_t req_type;
2476
2477         /* This field provides original sequence number of the command. */
2478         uint16_t seq_id;
2479
2480         /*
2481          * This field is the length of the response in bytes. The last byte of
2482          * the response is a valid flag that will read as '1' when the command
2483          * has been completely written to memory.
2484          */
2485         uint16_t resp_len;
2486
2487         uint32_t unused_0;
2488         uint8_t unused_1;
2489         uint8_t unused_2;
2490         uint8_t unused_3;
2491
2492         /*
2493          * This field is used in Output records to indicate that the output is
2494          * completely written to RAM. This field should be read as '1' to
2495          * indicate that the output has been completely written. When writing a
2496          * command completion or response to an internal processor, the order of
2497          * writes has to be such that this field is written last.
2498          */
2499         uint8_t valid;
2500 } __attribute__((packed));
2501
2502 #endif