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