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