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