cd2b14e27ec31131f7549a54a264247c6453a6d6
[dpdk.git] / drivers / net / bnxt / hsi_struct_def_dpdk.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) Broadcom Limited.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Broadcom Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _HSI_STRUCT_DEF_EXTERNAL_H_
35 #define _HSI_STRUCT_DEF_EXTERNAL_H_
36
37 /* HW Resource Manager Specification 1.2.0 */
38 #define HWRM_VERSION_MAJOR      1
39 #define HWRM_VERSION_MINOR      2
40 #define HWRM_VERSION_UPDATE     0
41
42 /*
43  * Following is the signature for HWRM message field that indicates not
44  * applicable (All F's). Need to cast it the size of the field if needed.
45  */
46 #define HWRM_MAX_REQ_LEN        (128)  /* hwrm_func_buf_rgtr */
47 #define HWRM_MAX_RESP_LEN       (176)  /* hwrm_func_qstats */
48 #define HWRM_RESP_VALID_KEY     1 /* valid key for HWRM response */
49
50 /*
51  * Request types
52  */
53 #define HWRM_VER_GET                    (UINT32_C(0x0))
54 #define HWRM_FUNC_QCAPS                 (UINT32_C(0x15))
55 #define HWRM_FUNC_DRV_UNRGTR            (UINT32_C(0x1a))
56 #define HWRM_FUNC_DRV_RGTR              (UINT32_C(0x1d))
57 #define HWRM_PORT_PHY_CFG               (UINT32_C(0x20))
58 #define HWRM_QUEUE_QPORTCFG             (UINT32_C(0x30))
59
60 /*
61  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
62  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
63  * processors inside the chip. This firmware is vital part of the chip's
64  * hardware. The chip can not be used by driver without it.
65  */
66
67 /* Input (16 bytes) */
68 struct input {
69         /*
70          * This value indicates what type of request this is. The format for the
71          * rest of the command is determined by this field.
72          */
73         uint16_t req_type;
74
75         /*
76          * This value indicates the what completion ring the request will be
77          * optionally completed on. If the value is -1, then no CR completion
78          * will be generated. Any other value must be a valid CR ring_id value
79          * for this function.
80          */
81         uint16_t cmpl_ring;
82
83         /* This value indicates the command sequence number. */
84         uint16_t seq_id;
85
86         /*
87          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
88          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
89          */
90         uint16_t target_id;
91
92         /*
93          * This is the host address where the response will be written when the
94          * request is complete. This area must be 16B aligned and must be
95          * cleared to zero before the request is made.
96          */
97         uint64_t resp_addr;
98 } __attribute__((packed));
99
100 /* Output (8 bytes) */
101 struct output {
102         /*
103          * Pass/Fail or error type Note: receiver to verify the in parameters,
104          * and fail the call with an error when appropriate
105          */
106         uint16_t error_code;
107
108         /* This field returns the type of original request. */
109         uint16_t req_type;
110
111         /* This field provides original sequence number of the command. */
112         uint16_t seq_id;
113
114         /*
115          * This field is the length of the response in bytes. The last byte of
116          * the response is a valid flag that will read as '1' when the command
117          * has been completely written to memory.
118          */
119         uint16_t resp_len;
120 } __attribute__((packed));
121
122 /* hwrm_func_qcaps */
123 /*
124  * Description: This command returns capabilities of a function. The input FID
125  * value is used to indicate what function is being queried. This allows a
126  * physical function driver to query virtual functions that are children of the
127  * physical function. The output FID value is needed to configure Rings and
128  * MSI-X vectors so their DMA operations appear correctly on the PCI bus.
129  */
130
131 /* Input (24 bytes) */
132 struct hwrm_func_qcaps_input {
133         /*
134          * This value indicates what type of request this is. The format for the
135          * rest of the command is determined by this field.
136          */
137         uint16_t req_type;
138
139         /*
140          * This value indicates the what completion ring the request will be
141          * optionally completed on. If the value is -1, then no CR completion
142          * will be generated. Any other value must be a valid CR ring_id value
143          * for this function.
144          */
145         uint16_t cmpl_ring;
146
147         /* This value indicates the command sequence number. */
148         uint16_t seq_id;
149
150         /*
151          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
152          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
153          */
154         uint16_t target_id;
155
156         /*
157          * This is the host address where the response will be written when the
158          * request is complete. This area must be 16B aligned and must be
159          * cleared to zero before the request is made.
160          */
161         uint64_t resp_addr;
162
163         /*
164          * Function ID of the function that is being queried. 0xFF... (All Fs)
165          * if the query is for the requesting function.
166          */
167         uint16_t fid;
168
169         uint16_t unused_0[3];
170 } __attribute__((packed));
171
172 /* Output (80 bytes) */
173 struct hwrm_func_qcaps_output {
174         /*
175          * Pass/Fail or error type Note: receiver to verify the in parameters,
176          * and fail the call with an error when appropriate
177          */
178         uint16_t error_code;
179
180         /* This field returns the type of original request. */
181         uint16_t req_type;
182
183         /* This field provides original sequence number of the command. */
184         uint16_t seq_id;
185
186         /*
187          * This field is the length of the response in bytes. The last byte of
188          * the response is a valid flag that will read as '1' when the command
189          * has been completely written to memory.
190          */
191         uint16_t resp_len;
192
193         /*
194          * FID value. This value is used to identify operations on the PCI bus
195          * as belonging to a particular PCI function.
196          */
197         uint16_t fid;
198
199         /*
200          * Port ID of port that this function is associated with. Valid only for
201          * the PF. 0xFF... (All Fs) if this function is not associated with any
202          * port. 0xFF... (All Fs) if this function is called from a VF.
203          */
204         uint16_t port_id;
205
206         /* If 1, then Push mode is supported on this function. */
207         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED   UINT32_C(0x1)
208         /*
209          * If 1, then the global MSI-X auto-masking is enabled for the device.
210          */
211         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING \
212                                                                 UINT32_C(0x2)
213         /*
214          * If 1, then the Precision Time Protocol (PTP) processing is supported
215          * on this function. The HWRM should enable PTP on only a single
216          * Physical Function (PF) per port.
217          */
218         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED         UINT32_C(0x4)
219         uint32_t flags;
220
221         /*
222          * This value is current MAC address configured for this function. A
223          * value of 00-00-00-00-00-00 indicates no MAC address is currently
224          * configured.
225          */
226         uint8_t perm_mac_address[6];
227
228         /*
229          * The maximum number of RSS/COS contexts that can be allocated to the
230          * function.
231          */
232         uint16_t max_rsscos_ctx;
233
234         /*
235          * The maximum number of completion rings that can be allocated to the
236          * function.
237          */
238         uint16_t max_cmpl_rings;
239
240         /*
241          * The maximum number of transmit rings that can be allocated to the
242          * function.
243          */
244         uint16_t max_tx_rings;
245
246         /*
247          * The maximum number of receive rings that can be allocated to the
248          * function.
249          */
250         uint16_t max_rx_rings;
251
252         /*
253          * The maximum number of L2 contexts that can be allocated to the
254          * function.
255          */
256         uint16_t max_l2_ctxs;
257
258         /* The maximum number of VNICs that can be allocated to the function. */
259         uint16_t max_vnics;
260
261         /*
262          * The identifier for the first VF enabled on a PF. This is valid only
263          * on the PF with SR-IOV enabled. 0xFF... (All Fs) if this command is
264          * called on a PF with SR-IOV disabled or on a VF.
265          */
266         uint16_t first_vf_id;
267
268         /*
269          * The maximum number of VFs that can be allocated to the function. This
270          * is valid only on the PF with SR-IOV enabled. 0xFF... (All Fs) if this
271          * command is called on a PF with SR-IOV disabled or on a VF.
272          */
273         uint16_t max_vfs;
274
275         /*
276          * The maximum number of statistic contexts that can be allocated to the
277          * function.
278          */
279         uint16_t max_stat_ctx;
280
281         /*
282          * The maximum number of Encapsulation records that can be offloaded by
283          * this function.
284          */
285         uint32_t max_encap_records;
286
287         /*
288          * The maximum number of decapsulation records that can be offloaded by
289          * this function.
290          */
291         uint32_t max_decap_records;
292
293         /*
294          * The maximum number of Exact Match (EM) flows that can be offloaded by
295          * this function on the TX side.
296          */
297         uint32_t max_tx_em_flows;
298
299         /*
300          * The maximum number of Wildcard Match (WM) flows that can be offloaded
301          * by this function on the TX side.
302          */
303         uint32_t max_tx_wm_flows;
304
305         /*
306          * The maximum number of Exact Match (EM) flows that can be offloaded by
307          * this function on the RX side.
308          */
309         uint32_t max_rx_em_flows;
310
311         /*
312          * The maximum number of Wildcard Match (WM) flows that can be offloaded
313          * by this function on the RX side.
314          */
315         uint32_t max_rx_wm_flows;
316
317         /*
318          * The maximum number of multicast filters that can be supported by this
319          * function on the RX side.
320          */
321         uint32_t max_mcast_filters;
322
323         /*
324          * The maximum value of flow_id that can be supported in completion
325          * records.
326          */
327         uint32_t max_flow_id;
328
329         /*
330          * The maximum number of HW ring groups that can be supported on this
331          * function.
332          */
333         uint32_t max_hw_ring_grps;
334
335         uint8_t unused_0;
336         uint8_t unused_1;
337         uint8_t unused_2;
338
339         /*
340          * This field is used in Output records to indicate that the output is
341          * completely written to RAM. This field should be read as '1' to
342          * indicate that the output has been completely written. When writing a
343          * command completion or response to an internal processor, the order of
344          * writes has to be such that this field is written last.
345          */
346         uint8_t valid;
347 } __attribute__((packed));
348
349 /* hwrm_port_phy_cfg */
350 /*
351  * Description: This command configures the PHY device for the port. It allows
352  * setting of the most generic settings for the PHY. The HWRM shall complete
353  * this command as soon as PHY settings are configured. They may not be applied
354  * when the command response is provided. A VF driver shall not be allowed to
355  * configure PHY using this command. In a network partition mode, a PF driver
356  * shall not be allowed to configure PHY using this command.
357  */
358
359 /* Input (56 bytes) */
360 struct hwrm_port_phy_cfg_input {
361         /*
362          * This value indicates what type of request this is. The format for the
363          * rest of the command is determined by this field.
364          */
365         uint16_t req_type;
366
367         /*
368          * This value indicates the what completion ring the request will be
369          * optionally completed on. If the value is -1, then no CR completion
370          * will be generated. Any other value must be a valid CR ring_id value
371          * for this function.
372          */
373         uint16_t cmpl_ring;
374
375         /* This value indicates the command sequence number. */
376         uint16_t seq_id;
377
378         /*
379          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
380          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
381          */
382         uint16_t target_id;
383
384         /*
385          * This is the host address where the response will be written when the
386          * request is complete. This area must be 16B aligned and must be
387          * cleared to zero before the request is made.
388          */
389         uint64_t resp_addr;
390
391         /*
392          * When this bit is set to '1', the PHY for the port shall be reset. #
393          * If this bit is set to 1, then the HWRM shall reset the PHY after
394          * applying PHY configuration changes specified in this command. # In
395          * order to guarantee that PHY configuration changes specified in this
396          * command take effect, the HWRM client should set this flag to 1. # If
397          * this bit is not set to 1, then the HWRM may reset the PHY depending
398          * on the current PHY configuration and settings specified in this
399          * command.
400          */
401         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESET_PHY            UINT32_C(0x1)
402         /*
403          * When this bit is set to '1', the link shall be forced to be taken
404          * down. # When this bit is set to '1", all other command input settings
405          * related to the link speed shall be ignored. Once the link state is
406          * forced down, it can be explicitly cleared from that state by setting
407          * this flag to '0'. # If this flag is set to '0', then the link shall
408          * be cleared from forced down state if the link is in forced down
409          * state. There may be conditions (e.g. out-of-band or sideband
410          * configuration changes for the link) outside the scope of the HWRM
411          * implementation that may clear forced down link state.
412          */
413         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE_LINK_DOWN      UINT32_C(0x2)
414         /*
415          * When this bit is set to '1', the link shall be forced to the
416          * force_link_speed value. When this bit is set to '1', the HWRM client
417          * should not enable any of the auto negotiation related fields
418          * represented by auto_XXX fields in this command. When this bit is set
419          * to '1' and the HWRM client has enabled a auto_XXX field in this
420          * command, then the HWRM shall ignore the enabled auto_XXX field. When
421          * this bit is set to zero, the link shall be allowed to autoneg.
422          */
423         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_FORCE                UINT32_C(0x4)
424         /*
425          * When this bit is set to '1', the auto-negotiation process shall be
426          * restarted on the link.
427          */
428         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG      UINT32_C(0x8)
429         /*
430          * When this bit is set to '1', Energy Efficient Ethernet (EEE) is
431          * requested to be enabled on this link. If EEE is not supported on this
432          * port, then this flag shall be ignored by the HWRM.
433          */
434         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_ENABLE        UINT32_C(0x10)
435         /*
436          * When this bit is set to '1', Energy Efficient Ethernet (EEE) is
437          * requested to be disabled on this link. If EEE is not supported on
438          * this port, then this flag shall be ignored by the HWRM.
439          */
440         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_DISABLE       UINT32_C(0x20)
441         /*
442          * When this bit is set to '1' and EEE is enabled on this link, then TX
443          * LPI is requested to be enabled on the link. If EEE is not supported
444          * on this port, then this flag shall be ignored by the HWRM. If EEE is
445          * disabled on this port, then this flag shall be ignored by the HWRM.
446          */
447         #define HWRM_PORT_PHY_CFG_INPUT_FLAGS_EEE_TX_LPI        UINT32_C(0x40)
448         uint32_t flags;
449
450         /* This bit must be '1' for the auto_mode field to be configured. */
451         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_MODE          UINT32_C(0x1)
452         /* This bit must be '1' for the auto_duplex field to be configured. */
453         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_DUPLEX        UINT32_C(0x2)
454         /* This bit must be '1' for the auto_pause field to be configured. */
455         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_PAUSE         UINT32_C(0x4)
456         /*
457          * This bit must be '1' for the auto_link_speed field to be configured.
458          */
459         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED    UINT32_C(0x8)
460         /*
461          * This bit must be '1' for the auto_link_speed_mask field to be
462          * configured.
463          */
464         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_AUTO_LINK_SPEED_MASK \
465                                                                 UINT32_C(0x10)
466         /* This bit must be '1' for the wirespeed field to be configured. */
467         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_WIRESPEED       UINT32_C(0x20)
468         /* This bit must be '1' for the lpbk field to be configured. */
469         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_LPBK            UINT32_C(0x40)
470         /* This bit must be '1' for the preemphasis field to be configured. */
471         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_PREEMPHASIS     UINT32_C(0x80)
472         /* This bit must be '1' for the force_pause field to be configured. */
473         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_FORCE_PAUSE     UINT32_C(0x100)
474         /*
475          * This bit must be '1' for the eee_link_speed_mask field to be
476          * configured.
477          */
478         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_EEE_LINK_SPEED_MASK \
479                                                                 UINT32_C(0x200)
480         /* This bit must be '1' for the tx_lpi_timer field to be configured. */
481         #define HWRM_PORT_PHY_CFG_INPUT_ENABLES_TX_LPI_TIMER    UINT32_C(0x400)
482         uint32_t enables;
483
484         /* Port ID of port that is to be configured. */
485         uint16_t port_id;
486
487         /*
488          * This is the speed that will be used if the force bit is '1'. If
489          * unsupported speed is selected, an error will be generated.
490          */
491                 /* 100Mb link speed */
492         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100MB \
493                                                         (UINT32_C(0x1) << 0)
494                 /* 1Gb link speed */
495         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_1GB \
496                                                         (UINT32_C(0xa) << 0)
497                 /* 2Gb link speed */
498         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2GB \
499                                                         (UINT32_C(0x14) << 0)
500                 /* 2.5Gb link speed */
501         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_2_5GB \
502                                                         (UINT32_C(0x19) << 0)
503                 /* 10Gb link speed */
504         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10GB \
505                                                         (UINT32_C(0x64) << 0)
506                 /* 20Mb link speed */
507         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_20GB \
508                                                         (UINT32_C(0xc8) << 0)
509                 /* 25Gb link speed */
510         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_25GB \
511                                                         (UINT32_C(0xfa) << 0)
512                 /* 40Gb link speed */
513         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_40GB \
514                                                         (UINT32_C(0x190) << 0)
515                 /* 50Gb link speed */
516         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_50GB \
517                                                         (UINT32_C(0x1f4) << 0)
518                 /* 100Gb link speed */
519         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_100GB \
520                                                         (UINT32_C(0x3e8) << 0)
521                 /* 10Mb link speed */
522         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_LINK_SPEED_10MB \
523                                                         (UINT32_C(0xffff) << 0)
524         uint16_t force_link_speed;
525
526         /*
527          * This value is used to identify what autoneg mode is used when the
528          * link speed is not being forced.
529          */
530                 /*
531                  * Disable autoneg or autoneg disabled. No speeds are selected.
532                  */
533         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_NONE  (UINT32_C(0x0) << 0)
534                 /* Select all possible speeds for autoneg mode. */
535         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ALL_SPEEDS \
536                                                         (UINT32_C(0x1) << 0)
537                 /*
538                  * Select only the auto_link_speed speed for autoneg mode. This
539                  * mode has been DEPRECATED. An HWRM client should not use this
540                  * mode.
541                  */
542         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_SPEED \
543                                                         (UINT32_C(0x2) << 0)
544                 /*
545                  * Select the auto_link_speed or any speed below that speed for
546                  * autoneg. This mode has been DEPRECATED. An HWRM client should
547                  * not use this mode.
548                  */
549         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_ONE_OR_BELOW \
550                                                         (UINT32_C(0x3) << 0)
551                 /*
552                  * Select the speeds based on the corresponding link speed mask
553                  * value that is provided.
554                  */
555         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_SPEED_MASK \
556                                                         (UINT32_C(0x4) << 0)
557         uint8_t auto_mode;
558
559         /*
560          * This is the duplex setting that will be used if the autoneg_mode is
561          * "one_speed" or "one_or_below".
562          */
563                 /* Half Duplex will be requested. */
564         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_HALF \
565                                                         (UINT32_C(0x0) << 0)
566                 /* Full duplex will be requested. */
567         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_FULL \
568                                                         (UINT32_C(0x1) << 0)
569                 /* Both Half and Full dupex will be requested. */
570         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_DUPLEX_BOTH \
571                                                         (UINT32_C(0x2) << 0)
572         uint8_t auto_duplex;
573
574         /*
575          * This value is used to configure the pause that will be used for
576          * autonegotiation. Add text on the usage of auto_pause and force_pause.
577          */
578         /*
579          * When this bit is '1', Generation of tx pause messages has been
580          * requested. Disabled otherwise.
581          */
582         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX              UINT32_C(0x1)
583         /*
584          * When this bit is '1', Reception of rx pause messages has been
585          * requested. Disabled otherwise.
586          */
587         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX              UINT32_C(0x2)
588         /*
589          * When set to 1, the advertisement of pause is enabled. # When the
590          * auto_mode is not set to none and this flag is set to 1, then the
591          * auto_pause bits on this port are being advertised and autoneg pause
592          * results are being interpreted. # When the auto_mode is not set to
593          * none and this flag is set to 0, the pause is forced as indicated in
594          * force_pause, and also advertised as auto_pause bits, but the autoneg
595          * results are not interpreted since the pause configuration is being
596          * forced. # When the auto_mode is set to none and this flag is set to
597          * 1, auto_pause bits should be ignored and should be set to 0.
598          */
599         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_AUTONEG_PAUSE   UINT32_C(0x4)
600         uint8_t auto_pause;
601
602         uint8_t unused_0;
603
604         /*
605          * This is the speed that will be used if the autoneg_mode is
606          * "one_speed" or "one_or_below". If an unsupported speed is selected,
607          * an error will be generated.
608          */
609                 /* 100Mb link speed */
610         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100MB \
611                                                         (UINT32_C(0x1) << 0)
612                 /* 1Gb link speed */
613         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_1GB \
614                                                         (UINT32_C(0xa) << 0)
615                 /* 2Gb link speed */
616         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2GB \
617                                                         (UINT32_C(0x14) << 0)
618                 /* 2.5Gb link speed */
619         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_2_5GB \
620                                                         (UINT32_C(0x19) << 0)
621                 /* 10Gb link speed */
622         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10GB \
623                                                         (UINT32_C(0x64) << 0)
624                 /* 20Mb link speed */
625         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_20GB \
626                                                         (UINT32_C(0xc8) << 0)
627                 /* 25Gb link speed */
628         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_25GB \
629                                                         (UINT32_C(0xfa) << 0)
630                 /* 40Gb link speed */
631         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_40GB \
632                                                         (UINT32_C(0x190) << 0)
633                 /* 50Gb link speed */
634         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_50GB \
635                                                         (UINT32_C(0x1f4) << 0)
636                 /* 100Gb link speed */
637         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_100GB \
638                                                         (UINT32_C(0x3e8) << 0)
639                 /* 10Mb link speed */
640         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_10MB \
641                                                         (UINT32_C(0xffff) << 0)
642         uint16_t auto_link_speed;
643
644         /*
645          * This is a mask of link speeds that will be used if autoneg_mode is
646          * "mask". If unsupported speed is enabled an error will be generated.
647          */
648         /* 100Mb link speed (Half-duplex) */
649         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MBHD \
650                                                         UINT32_C(0x1)
651         /* 100Mb link speed (Full-duplex) */
652         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100MB \
653                                                         UINT32_C(0x2)
654         /* 1Gb link speed (Half-duplex) */
655         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GBHD \
656                                                         UINT32_C(0x4)
657         /* 1Gb link speed (Full-duplex) */
658         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_1GB \
659                                                         UINT32_C(0x8)
660         /* 2Gb link speed */
661         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2GB \
662                                                         UINT32_C(0x10)
663         /* 2.5Gb link speed */
664         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_2_5GB \
665                                                         UINT32_C(0x20)
666         /* 10Gb link speed */
667         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10GB \
668                                                         UINT32_C(0x40)
669         /* 20Gb link speed */
670         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_20GB \
671                                                         UINT32_C(0x80)
672         /* 25Gb link speed */
673         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_25GB \
674                                                         UINT32_C(0x100)
675         /* 40Gb link speed */
676         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_40GB \
677                                                         UINT32_C(0x200)
678         /* 50Gb link speed */
679         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_50GB \
680                                                         UINT32_C(0x400)
681         /* 100Gb link speed */
682         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_100GB \
683                                                         UINT32_C(0x800)
684         /* 10Mb link speed (Half-duplex) */
685         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MBHD \
686                                                         UINT32_C(0x1000)
687         /* 10Mb link speed (Full-duplex) */
688         #define HWRM_PORT_PHY_CFG_INPUT_AUTO_LINK_SPEED_MASK_10MB \
689                                                         UINT32_C(0x2000)
690         uint16_t auto_link_speed_mask;
691
692         /* This value controls the wirespeed feature. */
693                 /* Wirespeed feature is disabled. */
694         #define HWRM_PORT_PHY_CFG_INPUT_WIRESPEED_OFF   (UINT32_C(0x0) << 0)
695                 /* Wirespeed feature is enabled. */
696         #define HWRM_PORT_PHY_CFG_INPUT_WIRESPEED_ON    (UINT32_C(0x1) << 0)
697         uint8_t wirespeed;
698
699         /* This value controls the loopback setting for the PHY. */
700                 /* No loopback is selected. Normal operation. */
701         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_NONE       (UINT32_C(0x0) << 0)
702                 /*
703                  * The HW will be configured with local loopback such that host
704                  * data is sent back to the host without modification.
705                  */
706         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_LOCAL      (UINT32_C(0x1) << 0)
707                 /*
708                  * The HW will be configured with remote loopback such that port
709                  * logic will send packets back out the transmitter that are
710                  * received.
711                  */
712         #define HWRM_PORT_PHY_CFG_INPUT_LPBK_REMOTE     (UINT32_C(0x2) << 0)
713         uint8_t lpbk;
714
715         /*
716          * This value is used to configure the pause that will be used for force
717          * mode.
718          */
719         /*
720          * When this bit is '1', Generation of tx pause messages is supported.
721          * Disabled otherwise.
722          */
723         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX             UINT32_C(0x1)
724         /*
725          * When this bit is '1', Reception of rx pause messages is supported.
726          * Disabled otherwise.
727          */
728         #define HWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX             UINT32_C(0x2)
729         uint8_t force_pause;
730
731         uint8_t unused_1;
732
733         /*
734          * This value controls the pre-emphasis to be used for the link. Driver
735          * should not set this value (use enable.preemphasis = 0) unless driver
736          * is sure of setting. Normally HWRM FW will determine proper pre-
737          * emphasis.
738          */
739         uint32_t preemphasis;
740
741         /*
742          * Setting for link speed mask that is used to advertise speeds during
743          * autonegotiation when EEE is enabled. This field is valid only when
744          * EEE is enabled. The speeds specified in this field shall be a subset
745          * of speeds specified in auto_link_speed_mask. If EEE is enabled,then
746          * at least one speed shall be provided in this mask.
747          */
748         /* Reserved */
749         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD1  UINT32_C(0x1)
750         /* 100Mb link speed (Full-duplex) */
751         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_100MB  UINT32_C(0x2)
752         /* Reserved */
753         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD2  UINT32_C(0x4)
754         /* 1Gb link speed (Full-duplex) */
755         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_1GB    UINT32_C(0x8)
756         /* Reserved */
757         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD3 \
758                                                                 UINT32_C(0x10)
759         /* Reserved */
760         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_RSVD4 \
761                                                                 UINT32_C(0x20)
762         /* 10Gb link speed */
763         #define HWRM_PORT_PHY_CFG_INPUT_EEE_LINK_SPEED_MASK_10GB \
764                                                                 UINT32_C(0x40)
765         uint16_t eee_link_speed_mask;
766
767         uint8_t unused_2;
768         uint8_t unused_3;
769
770         /*
771          * Reuested setting of TX LPI timer in microseconds. This field is valid
772          * only when EEE is enabled and TX LPI is enabled.
773          */
774         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_MASK \
775                                                         UINT32_C(0xffffff)
776         #define HWRM_PORT_PHY_CFG_INPUT_TX_LPI_TIMER_SFT           0
777         uint32_t tx_lpi_timer;
778
779         uint32_t unused_4;
780 } __attribute__((packed));
781
782 /* Output (16 bytes) */
783 struct hwrm_port_phy_cfg_output {
784         /*
785          * Pass/Fail or error type Note: receiver to verify the in parameters,
786          * and fail the call with an error when appropriate
787          */
788         uint16_t error_code;
789
790         /* This field returns the type of original request. */
791         uint16_t req_type;
792
793         /* This field provides original sequence number of the command. */
794         uint16_t seq_id;
795
796         /*
797          * This field is the length of the response in bytes. The last byte of
798          * the response is a valid flag that will read as '1' when the command
799          * has been completely written to memory.
800          */
801         uint16_t resp_len;
802
803         uint32_t unused_0;
804         uint8_t unused_1;
805         uint8_t unused_2;
806         uint8_t unused_3;
807
808         /*
809          * This field is used in Output records to indicate that the output is
810          * completely written to RAM. This field should be read as '1' to
811          * indicate that the output has been completely written. When writing a
812          * command completion or response to an internal processor, the order of
813          * writes has to be such that this field is written last.
814          */
815         uint8_t valid;
816 } __attribute__((packed));
817
818 /* hwrm_ver_get */
819 /*
820  * Description: This function is called by a driver to determine the HWRM
821  * interface version supported by the HWRM firmware, the version of HWRM
822  * firmware implementation, the name of HWRM firmware, the versions of other
823  * embedded firmwares, and the names of other embedded firmwares, etc. Any
824  * interface or firmware version with major = 0, minor = 0, and update = 0 shall
825  * be considered an invalid version.
826  */
827
828 /* Input (24 bytes) */
829 struct hwrm_ver_get_input {
830         /*
831          * This value indicates what type of request this is. The format for the
832          * rest of the command is determined by this field.
833          */
834         uint16_t req_type;
835
836         /*
837          * This value indicates the what completion ring the request will be
838          * optionally completed on. If the value is -1, then no CR completion
839          * will be generated. Any other value must be a valid CR ring_id value
840          * for this function.
841          */
842         uint16_t cmpl_ring;
843
844         /* This value indicates the command sequence number. */
845         uint16_t seq_id;
846
847         /*
848          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
849          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
850          */
851         uint16_t target_id;
852
853         /*
854          * This is the host address where the response will be written when the
855          * request is complete. This area must be 16B aligned and must be
856          * cleared to zero before the request is made.
857          */
858         uint64_t resp_addr;
859
860         /*
861          * This field represents the major version of HWRM interface
862          * specification supported by the driver HWRM implementation. The
863          * interface major version is intended to change only when non backward
864          * compatible changes are made to the HWRM interface specification.
865          */
866         uint8_t hwrm_intf_maj;
867
868         /*
869          * This field represents the minor version of HWRM interface
870          * specification supported by the driver HWRM implementation. A change
871          * in interface minor version is used to reflect significant backward
872          * compatible modification to HWRM interface specification. This can be
873          * due to addition or removal of functionality. HWRM interface
874          * specifications with the same major version but different minor
875          * versions are compatible.
876          */
877         uint8_t hwrm_intf_min;
878
879         /*
880          * This field represents the update version of HWRM interface
881          * specification supported by the driver HWRM implementation. The
882          * interface update version is used to reflect minor changes or bug
883          * fixes to a released HWRM interface specification.
884          */
885         uint8_t hwrm_intf_upd;
886
887         uint8_t unused_0[5];
888 } __attribute__((packed));
889
890 /* Output (128 bytes) */
891 struct hwrm_ver_get_output {
892         /*
893          * Pass/Fail or error type Note: receiver to verify the in parameters,
894          * and fail the call with an error when appropriate
895          */
896         uint16_t error_code;
897
898         /* This field returns the type of original request. */
899         uint16_t req_type;
900
901         /* This field provides original sequence number of the command. */
902         uint16_t seq_id;
903
904         /*
905          * This field is the length of the response in bytes. The last byte of
906          * the response is a valid flag that will read as '1' when the command
907          * has been completely written to memory.
908          */
909         uint16_t resp_len;
910
911         /*
912          * This field represents the major version of HWRM interface
913          * specification supported by the HWRM implementation. The interface
914          * major version is intended to change only when non backward compatible
915          * changes are made to the HWRM interface specification. A HWRM
916          * implementation that is compliant with this specification shall
917          * provide value of 1 in this field.
918          */
919         uint8_t hwrm_intf_maj;
920
921         /*
922          * This field represents the minor version of HWRM interface
923          * specification supported by the HWRM implementation. A change in
924          * interface minor version is used to reflect significant backward
925          * compatible modification to HWRM interface specification. This can be
926          * due to addition or removal of functionality. HWRM interface
927          * specifications with the same major version but different minor
928          * versions are compatible. A HWRM implementation that is compliant with
929          * this specification shall provide value of 0 in this field.
930          */
931         uint8_t hwrm_intf_min;
932
933         /*
934          * This field represents the update version of HWRM interface
935          * specification supported by the HWRM implementation. The interface
936          * update version is used to reflect minor changes or bug fixes to a
937          * released HWRM interface specification. A HWRM implementation that is
938          * compliant with this specification shall provide value of 1 in this
939          * field.
940          */
941         uint8_t hwrm_intf_upd;
942
943         uint8_t hwrm_intf_rsvd;
944
945         /*
946          * This field represents the major version of HWRM firmware. A change in
947          * firmware major version represents a major firmware release.
948          */
949         uint8_t hwrm_fw_maj;
950
951         /*
952          * This field represents the minor version of HWRM firmware. A change in
953          * firmware minor version represents significant firmware functionality
954          * changes.
955          */
956         uint8_t hwrm_fw_min;
957
958         /*
959          * This field represents the build version of HWRM firmware. A change in
960          * firmware build version represents bug fixes to a released firmware.
961          */
962         uint8_t hwrm_fw_bld;
963
964         /*
965          * This field is a reserved field. This field can be used to represent
966          * firmware branches or customer specific releases tied to a specific
967          * (major,minor,update) version of the HWRM firmware.
968          */
969         uint8_t hwrm_fw_rsvd;
970
971         /*
972          * This field represents the major version of mgmt firmware. A change in
973          * major version represents a major release.
974          */
975         uint8_t mgmt_fw_maj;
976
977         /*
978          * This field represents the minor version of mgmt firmware. A change in
979          * minor version represents significant functionality changes.
980          */
981         uint8_t mgmt_fw_min;
982
983         /*
984          * This field represents the build version of mgmt firmware. A change in
985          * update version represents bug fixes.
986          */
987         uint8_t mgmt_fw_bld;
988
989         /*
990          * This field is a reserved field. This field can be used to represent
991          * firmware branches or customer specific releases tied to a specific
992          * (major,minor,update) version
993          */
994         uint8_t mgmt_fw_rsvd;
995
996         /*
997          * This field represents the major version of network control firmware.
998          * A change in major version represents a major release.
999          */
1000         uint8_t netctrl_fw_maj;
1001
1002         /*
1003          * This field represents the minor version of network control firmware.
1004          * A change in minor version represents significant functionality
1005          * changes.
1006          */
1007         uint8_t netctrl_fw_min;
1008
1009         /*
1010          * This field represents the build version of network control firmware.
1011          * A change in update version represents bug fixes.
1012          */
1013         uint8_t netctrl_fw_bld;
1014
1015         /*
1016          * This field is a reserved field. This field can be used to represent
1017          * firmware branches or customer specific releases tied to a specific
1018          * (major,minor,update) version
1019          */
1020         uint8_t netctrl_fw_rsvd;
1021
1022         /*
1023          * This field is reserved for future use. The responder should set it to
1024          * 0. The requester should ignore this field.
1025          */
1026         uint32_t reserved1;
1027
1028         /*
1029          * This field represents the major version of RoCE firmware. A change in
1030          * major version represents a major release.
1031          */
1032         uint8_t roce_fw_maj;
1033
1034         /*
1035          * This field represents the minor version of RoCE firmware. A change in
1036          * minor version represents significant functionality changes.
1037          */
1038         uint8_t roce_fw_min;
1039
1040         /*
1041          * This field represents the build version of RoCE firmware. A change in
1042          * update version represents bug fixes.
1043          */
1044         uint8_t roce_fw_bld;
1045
1046         /*
1047          * This field is a reserved field. This field can be used to represent
1048          * firmware branches or customer specific releases tied to a specific
1049          * (major,minor,update) version
1050          */
1051         uint8_t roce_fw_rsvd;
1052
1053         /*
1054          * This field represents the name of HWRM FW (ASCII chars without NULL
1055          * at the end).
1056          */
1057         char hwrm_fw_name[16];
1058
1059         /*
1060          * This field represents the name of mgmt FW (ASCII chars without NULL
1061          * at the end).
1062          */
1063         char mgmt_fw_name[16];
1064
1065         /*
1066          * This field represents the name of network control firmware (ASCII
1067          * chars without NULL at the end).
1068          */
1069         char netctrl_fw_name[16];
1070
1071         /*
1072          * This field is reserved for future use. The responder should set it to
1073          * 0. The requester should ignore this field.
1074          */
1075         uint32_t reserved2[4];
1076
1077         /*
1078          * This field represents the name of RoCE FW (ASCII chars without NULL
1079          * at the end).
1080          */
1081         char roce_fw_name[16];
1082
1083         /* This field returns the chip number. */
1084         uint16_t chip_num;
1085
1086         /* This field returns the revision of chip. */
1087         uint8_t chip_rev;
1088
1089         /* This field returns the chip metal number. */
1090         uint8_t chip_metal;
1091
1092         /* This field returns the bond id of the chip. */
1093         uint8_t chip_bond_id;
1094
1095         /*
1096          * This value indicates the type of platform used for chip
1097          * implementation.
1098          */
1099         /* ASIC */
1100         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_ASIC \
1101                                                         (UINT32_C(0x0) << 0)
1102         /* FPGA platform of the chip. */
1103         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_FPGA \
1104                                                         (UINT32_C(0x1) << 0)
1105         /* Palladium platform of the chip. */
1106         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_PALLADIUM \
1107                                                         (UINT32_C(0x2) << 0)
1108         uint8_t chip_platform_type;
1109
1110         /*
1111          * This field returns the maximum value of request window that is
1112          * supported by the HWRM. The request window is mapped into device
1113          * address space using MMIO.
1114          */
1115         uint16_t max_req_win_len;
1116
1117         /*
1118          * This field returns the maximum value of response buffer in bytes. If
1119          * a request specifies the response buffer length that is greater than
1120          * this value, then the HWRM should fail it. The value of this field
1121          * shall be 4KB or more.
1122          */
1123         uint16_t max_resp_len;
1124
1125         /*
1126          * This field returns the default request timeout value in milliseconds.
1127          */
1128         uint16_t def_req_timeout;
1129
1130         uint8_t unused_0;
1131         uint8_t unused_1;
1132         uint8_t unused_2;
1133
1134         /*
1135          * This field is used in Output records to indicate that the output is
1136          * completely written to RAM. This field should be read as '1' to
1137          * indicate that the output has been completely written. When writing a
1138          * command completion or response to an internal processor, the order of
1139          * writes has to be such that this field is written last.
1140          */
1141         uint8_t valid;
1142 } __attribute__((packed));
1143
1144 /* hwrm_queue_qportcfg */
1145 /*
1146  * Description: This function is called by a driver to query queue configuration
1147  * of a port. # The HWRM shall at least advertise one queue with lossy service
1148  * profile. # The driver shall use this command to query queue ids before
1149  * configuring or using any queues. # If a service profile is not set for a
1150  * queue, then the driver shall not use that queue without configuring a service
1151  * profile for it. # If the driver is not allowed to configure service profiles,
1152  * then the driver shall only use queues for which service profiles are pre-
1153  * configured.
1154  */
1155
1156 /* Input (24 bytes) */
1157 struct hwrm_queue_qportcfg_input {
1158         /*
1159          * This value indicates what type of request this is. The format for the
1160          * rest of the command is determined by this field.
1161          */
1162         uint16_t req_type;
1163
1164         /*
1165          * This value indicates the what completion ring the request will be
1166          * optionally completed on. If the value is -1, then no CR completion
1167          * will be generated. Any other value must be a valid CR ring_id value
1168          * for this function.
1169          */
1170         uint16_t cmpl_ring;
1171
1172         /* This value indicates the command sequence number. */
1173         uint16_t seq_id;
1174
1175         /*
1176          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1177          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1178          */
1179         uint16_t target_id;
1180
1181         /*
1182          * This is the host address where the response will be written when the
1183          * request is complete. This area must be 16B aligned and must be
1184          * cleared to zero before the request is made.
1185          */
1186         uint64_t resp_addr;
1187
1188         /*
1189          * Enumeration denoting the RX, TX type of the resource. This
1190          * enumeration is used for resources that are similar for both TX and RX
1191          * paths of the chip.
1192          */
1193         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH \
1194                                                         UINT32_C(0x1)
1195                 /* tx path */
1196         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX \
1197                                                         (UINT32_C(0x0) << 0)
1198                 /* rx path */
1199         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX \
1200                                                         (UINT32_C(0x1) << 0)
1201         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
1202                                         HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
1203         uint32_t flags;
1204
1205         /*
1206          * Port ID of port for which the queue configuration is being queried.
1207          * This field is only required when sent by IPC.
1208          */
1209         uint16_t port_id;
1210
1211         uint16_t unused_0;
1212 } __attribute__((packed));
1213
1214 /* Output (32 bytes) */
1215 struct hwrm_queue_qportcfg_output {
1216         /*
1217          * Pass/Fail or error type Note: receiver to verify the in parameters,
1218          * and fail the call with an error when appropriate
1219          */
1220         uint16_t error_code;
1221
1222         /* This field returns the type of original request. */
1223         uint16_t req_type;
1224
1225         /* This field provides original sequence number of the command. */
1226         uint16_t seq_id;
1227
1228         /*
1229          * This field is the length of the response in bytes. The last byte of
1230          * the response is a valid flag that will read as '1' when the command
1231          * has been completely written to memory.
1232          */
1233         uint16_t resp_len;
1234
1235         /* The maximum number of queues that can be configured. */
1236         uint8_t max_configurable_queues;
1237
1238         /* The maximum number of lossless queues that can be configured. */
1239         uint8_t max_configurable_lossless_queues;
1240
1241         /*
1242          * 0 - Not allowed. Non-zero - Allowed. If this value is non-zero, then
1243          * the HWRM shall allow the host SW driver to configure queues using
1244          * hwrm_queue_cfg.
1245          */
1246         uint8_t queue_cfg_allowed;
1247
1248         /*
1249          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
1250          * the HWRM shall allow the host SW driver to configure queue buffers
1251          * using hwrm_queue_buffers_cfg.
1252          */
1253         uint8_t queue_buffers_cfg_allowed;
1254
1255         /*
1256          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
1257          * the HWRM shall allow the host SW driver to configure PFC using
1258          * hwrm_queue_pfcenable_cfg.
1259          */
1260         uint8_t queue_pfcenable_cfg_allowed;
1261
1262         /*
1263          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
1264          * the HWRM shall allow the host SW driver to configure Priority to CoS
1265          * mapping using hwrm_queue_pri2cos_cfg.
1266          */
1267         uint8_t queue_pri2cos_cfg_allowed;
1268
1269         /*
1270          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
1271          * the HWRM shall allow the host SW driver to configure CoS Bandwidth
1272          * configuration using hwrm_queue_cos2bw_cfg.
1273          */
1274         uint8_t queue_cos2bw_cfg_allowed;
1275
1276         /* ID of CoS Queue 0. FF - Invalid id */
1277         uint8_t queue_id0;
1278
1279         /* This value is applicable to CoS queues only. */
1280                 /* Lossy (best-effort) */
1281         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
1282                                                         (UINT32_C(0x0) << 0)
1283                 /* Lossless */
1284         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
1285                                                         (UINT32_C(0x1) << 0)
1286                 /*
1287                  * Set to 0xFF... (All Fs) if there is no service profile
1288                  * specified
1289                  */
1290         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
1291                                                         (UINT32_C(0xff) << 0)
1292         uint8_t queue_id0_service_profile;
1293
1294         /* ID of CoS Queue 1. FF - Invalid id */
1295         uint8_t queue_id1;
1296         /* This value is applicable to CoS queues only. */
1297                 /* Lossy (best-effort) */
1298         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
1299                                                         (UINT32_C(0x0) << 0)
1300                 /* Lossless */
1301         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
1302                                                         (UINT32_C(0x1) << 0)
1303                 /*
1304                  * Set to 0xFF... (All Fs) if there is no service profile
1305                  * specified
1306                  */
1307         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
1308                                                         (UINT32_C(0xff) << 0)
1309         uint8_t queue_id1_service_profile;
1310
1311         /* ID of CoS Queue 2. FF - Invalid id */
1312         uint8_t queue_id2;
1313         /* This value is applicable to CoS queues only. */
1314                 /* Lossy (best-effort) */
1315         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
1316                                                         (UINT32_C(0x0) << 0)
1317                 /* Lossless */
1318         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
1319                                                         (UINT32_C(0x1) << 0)
1320                 /*
1321                  * Set to 0xFF... (All Fs) if there is no service profile
1322                  * specified
1323                  */
1324         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
1325                                                         (UINT32_C(0xff) << 0)
1326         uint8_t queue_id2_service_profile;
1327
1328         /* ID of CoS Queue 3. FF - Invalid id */
1329         uint8_t queue_id3;
1330
1331         /* This value is applicable to CoS queues only. */
1332                 /* Lossy (best-effort) */
1333         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
1334                                                         (UINT32_C(0x0) << 0)
1335                 /* Lossless */
1336         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
1337                                                         (UINT32_C(0x1) << 0)
1338                 /*
1339                  * Set to 0xFF... (All Fs) if there is no service profile
1340                  * specified
1341                  */
1342         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
1343                                                         (UINT32_C(0xff) << 0)
1344         uint8_t queue_id3_service_profile;
1345
1346         /* ID of CoS Queue 4. FF - Invalid id */
1347         uint8_t queue_id4;
1348         /* This value is applicable to CoS queues only. */
1349                 /* Lossy (best-effort) */
1350         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
1351                                                         (UINT32_C(0x0) << 0)
1352                 /* Lossless */
1353         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
1354                                                         (UINT32_C(0x1) << 0)
1355                 /*
1356                  * Set to 0xFF... (All Fs) if there is no service profile
1357                  * specified
1358                  */
1359         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
1360                                                         (UINT32_C(0xff) << 0)
1361         uint8_t queue_id4_service_profile;
1362
1363         /* ID of CoS Queue 5. FF - Invalid id */
1364         uint8_t queue_id5;
1365
1366         /* This value is applicable to CoS queues only. */
1367                 /* Lossy (best-effort) */
1368         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
1369                                                         (UINT32_C(0x0) << 0)
1370                 /* Lossless */
1371         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
1372                                                         (UINT32_C(0x1) << 0)
1373                 /*
1374                  * Set to 0xFF... (All Fs) if there is no service profile
1375                  * specified
1376                  */
1377         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
1378                                                         (UINT32_C(0xff) << 0)
1379         uint8_t queue_id5_service_profile;
1380
1381         /* ID of CoS Queue 6. FF - Invalid id */
1382         uint8_t queue_id6_service_profile;
1383         /* This value is applicable to CoS queues only. */
1384                 /* Lossy (best-effort) */
1385         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
1386                                                         (UINT32_C(0x0) << 0)
1387                 /* Lossless */
1388         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
1389                                                         (UINT32_C(0x1) << 0)
1390                 /*
1391                  * Set to 0xFF... (All Fs) if there is no service profile
1392                  * specified
1393                  */
1394         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
1395                                                         (UINT32_C(0xff) << 0)
1396         uint8_t queue_id6;
1397
1398         /* ID of CoS Queue 7. FF - Invalid id */
1399         uint8_t queue_id7;
1400
1401         /* This value is applicable to CoS queues only. */
1402                 /* Lossy (best-effort) */
1403         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
1404                                                         (UINT32_C(0x0) << 0)
1405                 /* Lossless */
1406         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
1407                                                         (UINT32_C(0x1) << 0)
1408                 /*
1409                  * Set to 0xFF... (All Fs) if there is no service profile
1410                  * specified
1411                  */
1412         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
1413                                                         (UINT32_C(0xff) << 0)
1414         uint8_t queue_id7_service_profile;
1415
1416         /*
1417          * This field is used in Output records to indicate that the output is
1418          * completely written to RAM. This field should be read as '1' to
1419          * indicate that the output has been completely written. When writing a
1420          * command completion or response to an internal processor, the order of
1421          * writes has to be such that this field is written last.
1422          */
1423         uint8_t valid;
1424 } __attribute__((packed));
1425
1426 /* hwrm_func_drv_rgtr */
1427 /*
1428  * Description: This command is used by the function driver to register its
1429  * information with the HWRM. A function driver shall implement this command. A
1430  * function driver shall use this command during the driver initialization right
1431  * after the HWRM version discovery and default ring resources allocation.
1432  */
1433
1434 /* Input (80 bytes) */
1435 struct hwrm_func_drv_rgtr_input {
1436         /*
1437          * This value indicates what type of request this is. The format for the
1438          * rest of the command is determined by this field.
1439          */
1440         uint16_t req_type;
1441
1442         /*
1443          * This value indicates the what completion ring the request will be
1444          * optionally completed on. If the value is -1, then no CR completion
1445          * will be generated. Any other value must be a valid CR ring_id value
1446          * for this function.
1447          */
1448         uint16_t cmpl_ring;
1449
1450         /* This value indicates the command sequence number. */
1451         uint16_t seq_id;
1452
1453         /*
1454          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1455          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1456          */
1457         uint16_t target_id;
1458
1459         /*
1460          * This is the host address where the response will be written when the
1461          * request is complete. This area must be 16B aligned and must be
1462          * cleared to zero before the request is made.
1463          */
1464         uint64_t resp_addr;
1465
1466         /*
1467          * When this bit is '1', the function driver is requesting all requests
1468          * from its children VF drivers to be forwarded to itself. This flag can
1469          * only be set by the PF driver. If a VF driver sets this flag, it
1470          * should be ignored by the HWRM.
1471          */
1472         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_ALL_MODE        UINT32_C(0x1)
1473         /*
1474          * When this bit is '1', the function is requesting none of the requests
1475          * from its children VF drivers to be forwarded to itself. This flag can
1476          * only be set by the PF driver. If a VF driver sets this flag, it
1477          * should be ignored by the HWRM.
1478          */
1479         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE       UINT32_C(0x2)
1480         uint32_t flags;
1481
1482         /* This bit must be '1' for the os_type field to be configured. */
1483         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_OS_TYPE           UINT32_C(0x1)
1484         /* This bit must be '1' for the ver field to be configured. */
1485         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER               UINT32_C(0x2)
1486         /* This bit must be '1' for the timestamp field to be configured. */
1487         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_TIMESTAMP         UINT32_C(0x4)
1488         /* This bit must be '1' for the vf_req_fwd field to be configured. */
1489         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VF_REQ_FWD        UINT32_C(0x8)
1490         /*
1491          * This bit must be '1' for the async_event_fwd field to be configured.
1492          */
1493         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD \
1494                                                                 UINT32_C(0x10)
1495         uint32_t enables;
1496
1497         /* This value indicates the type of OS. */
1498                 /* Unknown */
1499         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_UNKNOWN \
1500                                                         (UINT32_C(0x0) << 0)
1501                 /* Other OS not listed below. */
1502         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_OTHER \
1503                                                         (UINT32_C(0x1) << 0)
1504                 /* MSDOS OS. */
1505         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_MSDOS \
1506                                                         (UINT32_C(0xe) << 0)
1507                 /* Windows OS. */
1508         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WINDOWS \
1509                                                         (UINT32_C(0x12) << 0)
1510                 /* Solaris OS. */
1511         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_SOLARIS \
1512                                                         (UINT32_C(0x1d) << 0)
1513                 /* Linux OS. */
1514         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_LINUX \
1515                                                         (UINT32_C(0x24) << 0)
1516                 /* FreeBSD OS. */
1517         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_FREEBSD \
1518                                                         (UINT32_C(0x2a) << 0)
1519                 /* VMware ESXi OS. */
1520         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_ESXI \
1521                                                         (UINT32_C(0x68) << 0)
1522                 /* Microsoft Windows 8 64-bit OS. */
1523         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN864 \
1524                                                         (UINT32_C(0x73) << 0)
1525                 /* Microsoft Windows Server 2012 R2 OS. */
1526         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN2012R2 \
1527                                                         (UINT32_C(0x74) << 0)
1528         uint16_t os_type;
1529
1530         /* This is the major version of the driver. */
1531         uint8_t ver_maj;
1532
1533         /* This is the minor version of the driver. */
1534         uint8_t ver_min;
1535
1536         /* This is the update version of the driver. */
1537         uint8_t ver_upd;
1538
1539         uint8_t unused_0;
1540         uint16_t unused_1;
1541
1542         /*
1543          * This is a 32-bit timestamp provided by the driver for keep alive. The
1544          * timestamp is in multiples of 1ms.
1545          */
1546         uint32_t timestamp;
1547
1548         uint32_t unused_2;
1549
1550         /*
1551          * This is a 256-bit bit mask provided by the PF driver for letting the
1552          * HWRM know what commands issued by the VF driver to the HWRM should be
1553          * forwarded to the PF driver. Nth bit refers to the Nth req_type.
1554          * Setting Nth bit to 1 indicates that requests from the VF driver with
1555          * req_type equal to N shall be forwarded to the parent PF driver. This
1556          * field is not valid for the VF driver.
1557          */
1558         uint32_t vf_req_fwd[8];
1559
1560         /*
1561          * This is a 256-bit bit mask provided by the function driver (PF or VF
1562          * driver) to indicate the list of asynchronous event completions to be
1563          * forwarded. Nth bit refers to the Nth event_id. Setting Nth bit to 1
1564          * by the function driver shall result in the HWRM forwarding
1565          * asynchronous event completion with event_id equal to N. If all bits
1566          * are set to 0 (value of 0), then the HWRM shall not forward any
1567          * asynchronous event completion to this function driver.
1568          */
1569         uint32_t async_event_fwd[8];
1570 } __attribute__((packed));
1571
1572 /* Output (16 bytes) */
1573
1574 struct hwrm_func_drv_rgtr_output {
1575         /*
1576          * Pass/Fail or error type Note: receiver to verify the in parameters,
1577          * and fail the call with an error when appropriate
1578          */
1579         uint16_t error_code;
1580
1581         /* This field returns the type of original request. */
1582         uint16_t req_type;
1583
1584         /* This field provides original sequence number of the command. */
1585         uint16_t seq_id;
1586
1587         /*
1588          * This field is the length of the response in bytes. The last byte of
1589          * the response is a valid flag that will read as '1' when the command
1590          * has been completely written to memory.
1591          */
1592         uint16_t resp_len;
1593
1594         uint32_t unused_0;
1595         uint8_t unused_1;
1596         uint8_t unused_2;
1597         uint8_t unused_3;
1598
1599         /*
1600          * This field is used in Output records to indicate that the output is
1601          * completely written to RAM. This field should be read as '1' to
1602          * indicate that the output has been completely written. When writing a
1603          * command completion or response to an internal processor, the order of
1604          * writes has to be such that this field is written last.
1605          */
1606         uint8_t valid;
1607 } __attribute__((packed));
1608
1609 /* hwrm_func_drv_unrgtr */
1610 /*
1611  * Description: This command is used by the function driver to un register with
1612  * the HWRM. A function driver shall implement this command. A function driver
1613  * shall use this command during the driver unloading.
1614  */
1615 /* Input (24 bytes) */
1616
1617 struct hwrm_func_drv_unrgtr_input {
1618         /*
1619          * This value indicates what type of request this is. The format for the
1620          * rest of the command is determined by this field.
1621          */
1622         uint16_t req_type;
1623
1624         /*
1625          * This value indicates the what completion ring the request will be
1626          * optionally completed on. If the value is -1, then no CR completion
1627          * will be generated. Any other value must be a valid CR ring_id value
1628          * for this function.
1629          */
1630         uint16_t cmpl_ring;
1631
1632         /* This value indicates the command sequence number. */
1633         uint16_t seq_id;
1634
1635         /*
1636          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1637          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1638          */
1639         uint16_t target_id;
1640
1641         /*
1642          * This is the host address where the response will be written when the
1643          * request is complete. This area must be 16B aligned and must be
1644          * cleared to zero before the request is made.
1645          */
1646         uint64_t resp_addr;
1647
1648         /*
1649          * When this bit is '1', the function driver is notifying the HWRM to
1650          * prepare for the shutdown.
1651          */
1652         #define HWRM_FUNC_DRV_UNRGTR_INPUT_FLAGS_PREPARE_FOR_SHUTDOWN \
1653                                                         UINT32_C(0x1)
1654         uint32_t flags;
1655
1656         uint32_t unused_0;
1657 } __attribute__((packed));
1658
1659 /* Output (16 bytes) */
1660 struct hwrm_func_drv_unrgtr_output {
1661         /*
1662          * Pass/Fail or error type Note: receiver to verify the in parameters,
1663          * and fail the call with an error when appropriate
1664          */
1665         uint16_t error_code;
1666
1667         /* This field returns the type of original request. */
1668         uint16_t req_type;
1669
1670         /* This field provides original sequence number of the command. */
1671         uint16_t seq_id;
1672
1673         /*
1674          * This field is the length of the response in bytes. The last byte of
1675          * the response is a valid flag that will read as '1' when the command
1676          * has been completely written to memory.
1677          */
1678         uint16_t resp_len;
1679
1680         uint32_t unused_0;
1681         uint8_t unused_1;
1682         uint8_t unused_2;
1683         uint8_t unused_3;
1684
1685         /*
1686          * This field is used in Output records to indicate that the output is
1687          * completely written to RAM. This field should be read as '1' to
1688          * indicate that the output has been completely written. When writing a
1689          * command completion or response to an internal processor, the order of
1690          * writes has to be such that this field is written last.
1691          */
1692         uint8_t valid;
1693 } __attribute__((packed));
1694
1695 #endif