net/bnxt: add driver register/unregister
[dpdk.git] / drivers / net / bnxt / hsi_struct_def_dpdk.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) Broadcom Limited.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Broadcom Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _HSI_STRUCT_DEF_EXTERNAL_H_
35 #define _HSI_STRUCT_DEF_EXTERNAL_H_
36
37 /* HW Resource Manager Specification 1.2.0 */
38 #define HWRM_VERSION_MAJOR      1
39 #define HWRM_VERSION_MINOR      2
40 #define HWRM_VERSION_UPDATE     0
41
42 /*
43  * Following is the signature for HWRM message field that indicates not
44  * applicable (All F's). Need to cast it the size of the field if needed.
45  */
46 #define HWRM_MAX_REQ_LEN        (128)  /* hwrm_func_buf_rgtr */
47 #define HWRM_MAX_RESP_LEN       (176)  /* hwrm_func_qstats */
48 #define HWRM_RESP_VALID_KEY     1 /* valid key for HWRM response */
49
50 /*
51  * Request types
52  */
53 #define HWRM_VER_GET                    (UINT32_C(0x0))
54 #define HWRM_FUNC_QCAPS                 (UINT32_C(0x15))
55 #define HWRM_FUNC_DRV_UNRGTR            (UINT32_C(0x1a))
56 #define HWRM_FUNC_DRV_RGTR              (UINT32_C(0x1d))
57 #define HWRM_QUEUE_QPORTCFG             (UINT32_C(0x30))
58
59 /*
60  * Note: The Hardware Resource Manager (HWRM) manages various hardware resources
61  * inside the chip. The HWRM is implemented in firmware, and runs on embedded
62  * processors inside the chip. This firmware is vital part of the chip's
63  * hardware. The chip can not be used by driver without it.
64  */
65
66 /* Input (16 bytes) */
67 struct input {
68         /*
69          * This value indicates what type of request this is. The format for the
70          * rest of the command is determined by this field.
71          */
72         uint16_t req_type;
73
74         /*
75          * This value indicates the what completion ring the request will be
76          * optionally completed on. If the value is -1, then no CR completion
77          * will be generated. Any other value must be a valid CR ring_id value
78          * for this function.
79          */
80         uint16_t cmpl_ring;
81
82         /* This value indicates the command sequence number. */
83         uint16_t seq_id;
84
85         /*
86          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
87          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
88          */
89         uint16_t target_id;
90
91         /*
92          * This is the host address where the response will be written when the
93          * request is complete. This area must be 16B aligned and must be
94          * cleared to zero before the request is made.
95          */
96         uint64_t resp_addr;
97 } __attribute__((packed));
98
99 /* Output (8 bytes) */
100 struct output {
101         /*
102          * Pass/Fail or error type Note: receiver to verify the in parameters,
103          * and fail the call with an error when appropriate
104          */
105         uint16_t error_code;
106
107         /* This field returns the type of original request. */
108         uint16_t req_type;
109
110         /* This field provides original sequence number of the command. */
111         uint16_t seq_id;
112
113         /*
114          * This field is the length of the response in bytes. The last byte of
115          * the response is a valid flag that will read as '1' when the command
116          * has been completely written to memory.
117          */
118         uint16_t resp_len;
119 } __attribute__((packed));
120
121 /* hwrm_func_qcaps */
122 /*
123  * Description: This command returns capabilities of a function. The input FID
124  * value is used to indicate what function is being queried. This allows a
125  * physical function driver to query virtual functions that are children of the
126  * physical function. The output FID value is needed to configure Rings and
127  * MSI-X vectors so their DMA operations appear correctly on the PCI bus.
128  */
129
130 /* Input (24 bytes) */
131 struct hwrm_func_qcaps_input {
132         /*
133          * This value indicates what type of request this is. The format for the
134          * rest of the command is determined by this field.
135          */
136         uint16_t req_type;
137
138         /*
139          * This value indicates the what completion ring the request will be
140          * optionally completed on. If the value is -1, then no CR completion
141          * will be generated. Any other value must be a valid CR ring_id value
142          * for this function.
143          */
144         uint16_t cmpl_ring;
145
146         /* This value indicates the command sequence number. */
147         uint16_t seq_id;
148
149         /*
150          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
151          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
152          */
153         uint16_t target_id;
154
155         /*
156          * This is the host address where the response will be written when the
157          * request is complete. This area must be 16B aligned and must be
158          * cleared to zero before the request is made.
159          */
160         uint64_t resp_addr;
161
162         /*
163          * Function ID of the function that is being queried. 0xFF... (All Fs)
164          * if the query is for the requesting function.
165          */
166         uint16_t fid;
167
168         uint16_t unused_0[3];
169 } __attribute__((packed));
170
171 /* Output (80 bytes) */
172 struct hwrm_func_qcaps_output {
173         /*
174          * Pass/Fail or error type Note: receiver to verify the in parameters,
175          * and fail the call with an error when appropriate
176          */
177         uint16_t error_code;
178
179         /* This field returns the type of original request. */
180         uint16_t req_type;
181
182         /* This field provides original sequence number of the command. */
183         uint16_t seq_id;
184
185         /*
186          * This field is the length of the response in bytes. The last byte of
187          * the response is a valid flag that will read as '1' when the command
188          * has been completely written to memory.
189          */
190         uint16_t resp_len;
191
192         /*
193          * FID value. This value is used to identify operations on the PCI bus
194          * as belonging to a particular PCI function.
195          */
196         uint16_t fid;
197
198         /*
199          * Port ID of port that this function is associated with. Valid only for
200          * the PF. 0xFF... (All Fs) if this function is not associated with any
201          * port. 0xFF... (All Fs) if this function is called from a VF.
202          */
203         uint16_t port_id;
204
205         /* If 1, then Push mode is supported on this function. */
206         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PUSH_MODE_SUPPORTED   UINT32_C(0x1)
207         /*
208          * If 1, then the global MSI-X auto-masking is enabled for the device.
209          */
210         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_GLOBAL_MSIX_AUTOMASKING \
211                                                                 UINT32_C(0x2)
212         /*
213          * If 1, then the Precision Time Protocol (PTP) processing is supported
214          * on this function. The HWRM should enable PTP on only a single
215          * Physical Function (PF) per port.
216          */
217         #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED         UINT32_C(0x4)
218         uint32_t flags;
219
220         /*
221          * This value is current MAC address configured for this function. A
222          * value of 00-00-00-00-00-00 indicates no MAC address is currently
223          * configured.
224          */
225         uint8_t perm_mac_address[6];
226
227         /*
228          * The maximum number of RSS/COS contexts that can be allocated to the
229          * function.
230          */
231         uint16_t max_rsscos_ctx;
232
233         /*
234          * The maximum number of completion rings that can be allocated to the
235          * function.
236          */
237         uint16_t max_cmpl_rings;
238
239         /*
240          * The maximum number of transmit rings that can be allocated to the
241          * function.
242          */
243         uint16_t max_tx_rings;
244
245         /*
246          * The maximum number of receive rings that can be allocated to the
247          * function.
248          */
249         uint16_t max_rx_rings;
250
251         /*
252          * The maximum number of L2 contexts that can be allocated to the
253          * function.
254          */
255         uint16_t max_l2_ctxs;
256
257         /* The maximum number of VNICs that can be allocated to the function. */
258         uint16_t max_vnics;
259
260         /*
261          * The identifier for the first VF enabled on a PF. This is valid only
262          * on the PF with SR-IOV enabled. 0xFF... (All Fs) if this command is
263          * called on a PF with SR-IOV disabled or on a VF.
264          */
265         uint16_t first_vf_id;
266
267         /*
268          * The maximum number of VFs that can be allocated to the function. This
269          * is valid only on the PF with SR-IOV enabled. 0xFF... (All Fs) if this
270          * command is called on a PF with SR-IOV disabled or on a VF.
271          */
272         uint16_t max_vfs;
273
274         /*
275          * The maximum number of statistic contexts that can be allocated to the
276          * function.
277          */
278         uint16_t max_stat_ctx;
279
280         /*
281          * The maximum number of Encapsulation records that can be offloaded by
282          * this function.
283          */
284         uint32_t max_encap_records;
285
286         /*
287          * The maximum number of decapsulation records that can be offloaded by
288          * this function.
289          */
290         uint32_t max_decap_records;
291
292         /*
293          * The maximum number of Exact Match (EM) flows that can be offloaded by
294          * this function on the TX side.
295          */
296         uint32_t max_tx_em_flows;
297
298         /*
299          * The maximum number of Wildcard Match (WM) flows that can be offloaded
300          * by this function on the TX side.
301          */
302         uint32_t max_tx_wm_flows;
303
304         /*
305          * The maximum number of Exact Match (EM) flows that can be offloaded by
306          * this function on the RX side.
307          */
308         uint32_t max_rx_em_flows;
309
310         /*
311          * The maximum number of Wildcard Match (WM) flows that can be offloaded
312          * by this function on the RX side.
313          */
314         uint32_t max_rx_wm_flows;
315
316         /*
317          * The maximum number of multicast filters that can be supported by this
318          * function on the RX side.
319          */
320         uint32_t max_mcast_filters;
321
322         /*
323          * The maximum value of flow_id that can be supported in completion
324          * records.
325          */
326         uint32_t max_flow_id;
327
328         /*
329          * The maximum number of HW ring groups that can be supported on this
330          * function.
331          */
332         uint32_t max_hw_ring_grps;
333
334         uint8_t unused_0;
335         uint8_t unused_1;
336         uint8_t unused_2;
337
338         /*
339          * This field is used in Output records to indicate that the output is
340          * completely written to RAM. This field should be read as '1' to
341          * indicate that the output has been completely written. When writing a
342          * command completion or response to an internal processor, the order of
343          * writes has to be such that this field is written last.
344          */
345         uint8_t valid;
346 } __attribute__((packed));
347
348 /* hwrm_ver_get */
349 /*
350  * Description: This function is called by a driver to determine the HWRM
351  * interface version supported by the HWRM firmware, the version of HWRM
352  * firmware implementation, the name of HWRM firmware, the versions of other
353  * embedded firmwares, and the names of other embedded firmwares, etc. Any
354  * interface or firmware version with major = 0, minor = 0, and update = 0 shall
355  * be considered an invalid version.
356  */
357
358 /* Input (24 bytes) */
359 struct hwrm_ver_get_input {
360         /*
361          * This value indicates what type of request this is. The format for the
362          * rest of the command is determined by this field.
363          */
364         uint16_t req_type;
365
366         /*
367          * This value indicates the what completion ring the request will be
368          * optionally completed on. If the value is -1, then no CR completion
369          * will be generated. Any other value must be a valid CR ring_id value
370          * for this function.
371          */
372         uint16_t cmpl_ring;
373
374         /* This value indicates the command sequence number. */
375         uint16_t seq_id;
376
377         /*
378          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
379          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
380          */
381         uint16_t target_id;
382
383         /*
384          * This is the host address where the response will be written when the
385          * request is complete. This area must be 16B aligned and must be
386          * cleared to zero before the request is made.
387          */
388         uint64_t resp_addr;
389
390         /*
391          * This field represents the major version of HWRM interface
392          * specification supported by the driver HWRM implementation. The
393          * interface major version is intended to change only when non backward
394          * compatible changes are made to the HWRM interface specification.
395          */
396         uint8_t hwrm_intf_maj;
397
398         /*
399          * This field represents the minor version of HWRM interface
400          * specification supported by the driver HWRM implementation. A change
401          * in interface minor version is used to reflect significant backward
402          * compatible modification to HWRM interface specification. This can be
403          * due to addition or removal of functionality. HWRM interface
404          * specifications with the same major version but different minor
405          * versions are compatible.
406          */
407         uint8_t hwrm_intf_min;
408
409         /*
410          * This field represents the update version of HWRM interface
411          * specification supported by the driver HWRM implementation. The
412          * interface update version is used to reflect minor changes or bug
413          * fixes to a released HWRM interface specification.
414          */
415         uint8_t hwrm_intf_upd;
416
417         uint8_t unused_0[5];
418 } __attribute__((packed));
419
420 /* Output (128 bytes) */
421 struct hwrm_ver_get_output {
422         /*
423          * Pass/Fail or error type Note: receiver to verify the in parameters,
424          * and fail the call with an error when appropriate
425          */
426         uint16_t error_code;
427
428         /* This field returns the type of original request. */
429         uint16_t req_type;
430
431         /* This field provides original sequence number of the command. */
432         uint16_t seq_id;
433
434         /*
435          * This field is the length of the response in bytes. The last byte of
436          * the response is a valid flag that will read as '1' when the command
437          * has been completely written to memory.
438          */
439         uint16_t resp_len;
440
441         /*
442          * This field represents the major version of HWRM interface
443          * specification supported by the HWRM implementation. The interface
444          * major version is intended to change only when non backward compatible
445          * changes are made to the HWRM interface specification. A HWRM
446          * implementation that is compliant with this specification shall
447          * provide value of 1 in this field.
448          */
449         uint8_t hwrm_intf_maj;
450
451         /*
452          * This field represents the minor version of HWRM interface
453          * specification supported by the HWRM implementation. A change in
454          * interface minor version is used to reflect significant backward
455          * compatible modification to HWRM interface specification. This can be
456          * due to addition or removal of functionality. HWRM interface
457          * specifications with the same major version but different minor
458          * versions are compatible. A HWRM implementation that is compliant with
459          * this specification shall provide value of 0 in this field.
460          */
461         uint8_t hwrm_intf_min;
462
463         /*
464          * This field represents the update version of HWRM interface
465          * specification supported by the HWRM implementation. The interface
466          * update version is used to reflect minor changes or bug fixes to a
467          * released HWRM interface specification. A HWRM implementation that is
468          * compliant with this specification shall provide value of 1 in this
469          * field.
470          */
471         uint8_t hwrm_intf_upd;
472
473         uint8_t hwrm_intf_rsvd;
474
475         /*
476          * This field represents the major version of HWRM firmware. A change in
477          * firmware major version represents a major firmware release.
478          */
479         uint8_t hwrm_fw_maj;
480
481         /*
482          * This field represents the minor version of HWRM firmware. A change in
483          * firmware minor version represents significant firmware functionality
484          * changes.
485          */
486         uint8_t hwrm_fw_min;
487
488         /*
489          * This field represents the build version of HWRM firmware. A change in
490          * firmware build version represents bug fixes to a released firmware.
491          */
492         uint8_t hwrm_fw_bld;
493
494         /*
495          * This field is a reserved field. This field can be used to represent
496          * firmware branches or customer specific releases tied to a specific
497          * (major,minor,update) version of the HWRM firmware.
498          */
499         uint8_t hwrm_fw_rsvd;
500
501         /*
502          * This field represents the major version of mgmt firmware. A change in
503          * major version represents a major release.
504          */
505         uint8_t mgmt_fw_maj;
506
507         /*
508          * This field represents the minor version of mgmt firmware. A change in
509          * minor version represents significant functionality changes.
510          */
511         uint8_t mgmt_fw_min;
512
513         /*
514          * This field represents the build version of mgmt firmware. A change in
515          * update version represents bug fixes.
516          */
517         uint8_t mgmt_fw_bld;
518
519         /*
520          * This field is a reserved field. This field can be used to represent
521          * firmware branches or customer specific releases tied to a specific
522          * (major,minor,update) version
523          */
524         uint8_t mgmt_fw_rsvd;
525
526         /*
527          * This field represents the major version of network control firmware.
528          * A change in major version represents a major release.
529          */
530         uint8_t netctrl_fw_maj;
531
532         /*
533          * This field represents the minor version of network control firmware.
534          * A change in minor version represents significant functionality
535          * changes.
536          */
537         uint8_t netctrl_fw_min;
538
539         /*
540          * This field represents the build version of network control firmware.
541          * A change in update version represents bug fixes.
542          */
543         uint8_t netctrl_fw_bld;
544
545         /*
546          * This field is a reserved field. This field can be used to represent
547          * firmware branches or customer specific releases tied to a specific
548          * (major,minor,update) version
549          */
550         uint8_t netctrl_fw_rsvd;
551
552         /*
553          * This field is reserved for future use. The responder should set it to
554          * 0. The requester should ignore this field.
555          */
556         uint32_t reserved1;
557
558         /*
559          * This field represents the major version of RoCE firmware. A change in
560          * major version represents a major release.
561          */
562         uint8_t roce_fw_maj;
563
564         /*
565          * This field represents the minor version of RoCE firmware. A change in
566          * minor version represents significant functionality changes.
567          */
568         uint8_t roce_fw_min;
569
570         /*
571          * This field represents the build version of RoCE firmware. A change in
572          * update version represents bug fixes.
573          */
574         uint8_t roce_fw_bld;
575
576         /*
577          * This field is a reserved field. This field can be used to represent
578          * firmware branches or customer specific releases tied to a specific
579          * (major,minor,update) version
580          */
581         uint8_t roce_fw_rsvd;
582
583         /*
584          * This field represents the name of HWRM FW (ASCII chars without NULL
585          * at the end).
586          */
587         char hwrm_fw_name[16];
588
589         /*
590          * This field represents the name of mgmt FW (ASCII chars without NULL
591          * at the end).
592          */
593         char mgmt_fw_name[16];
594
595         /*
596          * This field represents the name of network control firmware (ASCII
597          * chars without NULL at the end).
598          */
599         char netctrl_fw_name[16];
600
601         /*
602          * This field is reserved for future use. The responder should set it to
603          * 0. The requester should ignore this field.
604          */
605         uint32_t reserved2[4];
606
607         /*
608          * This field represents the name of RoCE FW (ASCII chars without NULL
609          * at the end).
610          */
611         char roce_fw_name[16];
612
613         /* This field returns the chip number. */
614         uint16_t chip_num;
615
616         /* This field returns the revision of chip. */
617         uint8_t chip_rev;
618
619         /* This field returns the chip metal number. */
620         uint8_t chip_metal;
621
622         /* This field returns the bond id of the chip. */
623         uint8_t chip_bond_id;
624
625         /*
626          * This value indicates the type of platform used for chip
627          * implementation.
628          */
629         /* ASIC */
630         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_ASIC \
631                                                         (UINT32_C(0x0) << 0)
632         /* FPGA platform of the chip. */
633         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_FPGA \
634                                                         (UINT32_C(0x1) << 0)
635         /* Palladium platform of the chip. */
636         #define HWRM_VER_GET_OUTPUT_CHIP_PLATFORM_TYPE_PALLADIUM \
637                                                         (UINT32_C(0x2) << 0)
638         uint8_t chip_platform_type;
639
640         /*
641          * This field returns the maximum value of request window that is
642          * supported by the HWRM. The request window is mapped into device
643          * address space using MMIO.
644          */
645         uint16_t max_req_win_len;
646
647         /*
648          * This field returns the maximum value of response buffer in bytes. If
649          * a request specifies the response buffer length that is greater than
650          * this value, then the HWRM should fail it. The value of this field
651          * shall be 4KB or more.
652          */
653         uint16_t max_resp_len;
654
655         /*
656          * This field returns the default request timeout value in milliseconds.
657          */
658         uint16_t def_req_timeout;
659
660         uint8_t unused_0;
661         uint8_t unused_1;
662         uint8_t unused_2;
663
664         /*
665          * This field is used in Output records to indicate that the output is
666          * completely written to RAM. This field should be read as '1' to
667          * indicate that the output has been completely written. When writing a
668          * command completion or response to an internal processor, the order of
669          * writes has to be such that this field is written last.
670          */
671         uint8_t valid;
672 } __attribute__((packed));
673
674 /* hwrm_queue_qportcfg */
675 /*
676  * Description: This function is called by a driver to query queue configuration
677  * of a port. # The HWRM shall at least advertise one queue with lossy service
678  * profile. # The driver shall use this command to query queue ids before
679  * configuring or using any queues. # If a service profile is not set for a
680  * queue, then the driver shall not use that queue without configuring a service
681  * profile for it. # If the driver is not allowed to configure service profiles,
682  * then the driver shall only use queues for which service profiles are pre-
683  * configured.
684  */
685
686 /* Input (24 bytes) */
687 struct hwrm_queue_qportcfg_input {
688         /*
689          * This value indicates what type of request this is. The format for the
690          * rest of the command is determined by this field.
691          */
692         uint16_t req_type;
693
694         /*
695          * This value indicates the what completion ring the request will be
696          * optionally completed on. If the value is -1, then no CR completion
697          * will be generated. Any other value must be a valid CR ring_id value
698          * for this function.
699          */
700         uint16_t cmpl_ring;
701
702         /* This value indicates the command sequence number. */
703         uint16_t seq_id;
704
705         /*
706          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
707          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
708          */
709         uint16_t target_id;
710
711         /*
712          * This is the host address where the response will be written when the
713          * request is complete. This area must be 16B aligned and must be
714          * cleared to zero before the request is made.
715          */
716         uint64_t resp_addr;
717
718         /*
719          * Enumeration denoting the RX, TX type of the resource. This
720          * enumeration is used for resources that are similar for both TX and RX
721          * paths of the chip.
722          */
723         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH \
724                                                         UINT32_C(0x1)
725                 /* tx path */
726         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_TX \
727                                                         (UINT32_C(0x0) << 0)
728                 /* rx path */
729         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX \
730                                                         (UINT32_C(0x1) << 0)
731         #define HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_LAST \
732                                         HWRM_QUEUE_QPORTCFG_INPUT_FLAGS_PATH_RX
733         uint32_t flags;
734
735         /*
736          * Port ID of port for which the queue configuration is being queried.
737          * This field is only required when sent by IPC.
738          */
739         uint16_t port_id;
740
741         uint16_t unused_0;
742 } __attribute__((packed));
743
744 /* Output (32 bytes) */
745 struct hwrm_queue_qportcfg_output {
746         /*
747          * Pass/Fail or error type Note: receiver to verify the in parameters,
748          * and fail the call with an error when appropriate
749          */
750         uint16_t error_code;
751
752         /* This field returns the type of original request. */
753         uint16_t req_type;
754
755         /* This field provides original sequence number of the command. */
756         uint16_t seq_id;
757
758         /*
759          * This field is the length of the response in bytes. The last byte of
760          * the response is a valid flag that will read as '1' when the command
761          * has been completely written to memory.
762          */
763         uint16_t resp_len;
764
765         /* The maximum number of queues that can be configured. */
766         uint8_t max_configurable_queues;
767
768         /* The maximum number of lossless queues that can be configured. */
769         uint8_t max_configurable_lossless_queues;
770
771         /*
772          * 0 - Not allowed. Non-zero - Allowed. If this value is non-zero, then
773          * the HWRM shall allow the host SW driver to configure queues using
774          * hwrm_queue_cfg.
775          */
776         uint8_t queue_cfg_allowed;
777
778         /*
779          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
780          * the HWRM shall allow the host SW driver to configure queue buffers
781          * using hwrm_queue_buffers_cfg.
782          */
783         uint8_t queue_buffers_cfg_allowed;
784
785         /*
786          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
787          * the HWRM shall allow the host SW driver to configure PFC using
788          * hwrm_queue_pfcenable_cfg.
789          */
790         uint8_t queue_pfcenable_cfg_allowed;
791
792         /*
793          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
794          * the HWRM shall allow the host SW driver to configure Priority to CoS
795          * mapping using hwrm_queue_pri2cos_cfg.
796          */
797         uint8_t queue_pri2cos_cfg_allowed;
798
799         /*
800          * 0 - Not allowed. Non-zero - Allowed If this value is non-zero, then
801          * the HWRM shall allow the host SW driver to configure CoS Bandwidth
802          * configuration using hwrm_queue_cos2bw_cfg.
803          */
804         uint8_t queue_cos2bw_cfg_allowed;
805
806         /* ID of CoS Queue 0. FF - Invalid id */
807         uint8_t queue_id0;
808
809         /* This value is applicable to CoS queues only. */
810                 /* Lossy (best-effort) */
811         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSY \
812                                                         (UINT32_C(0x0) << 0)
813                 /* Lossless */
814         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_LOSSLESS \
815                                                         (UINT32_C(0x1) << 0)
816                 /*
817                  * Set to 0xFF... (All Fs) if there is no service profile
818                  * specified
819                  */
820         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID0_SERVICE_PROFILE_UNKNOWN \
821                                                         (UINT32_C(0xff) << 0)
822         uint8_t queue_id0_service_profile;
823
824         /* ID of CoS Queue 1. FF - Invalid id */
825         uint8_t queue_id1;
826         /* This value is applicable to CoS queues only. */
827                 /* Lossy (best-effort) */
828         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSY \
829                                                         (UINT32_C(0x0) << 0)
830                 /* Lossless */
831         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_LOSSLESS \
832                                                         (UINT32_C(0x1) << 0)
833                 /*
834                  * Set to 0xFF... (All Fs) if there is no service profile
835                  * specified
836                  */
837         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID1_SERVICE_PROFILE_UNKNOWN \
838                                                         (UINT32_C(0xff) << 0)
839         uint8_t queue_id1_service_profile;
840
841         /* ID of CoS Queue 2. FF - Invalid id */
842         uint8_t queue_id2;
843         /* This value is applicable to CoS queues only. */
844                 /* Lossy (best-effort) */
845         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSY \
846                                                         (UINT32_C(0x0) << 0)
847                 /* Lossless */
848         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_LOSSLESS \
849                                                         (UINT32_C(0x1) << 0)
850                 /*
851                  * Set to 0xFF... (All Fs) if there is no service profile
852                  * specified
853                  */
854         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID2_SERVICE_PROFILE_UNKNOWN \
855                                                         (UINT32_C(0xff) << 0)
856         uint8_t queue_id2_service_profile;
857
858         /* ID of CoS Queue 3. FF - Invalid id */
859         uint8_t queue_id3;
860
861         /* This value is applicable to CoS queues only. */
862                 /* Lossy (best-effort) */
863         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSY \
864                                                         (UINT32_C(0x0) << 0)
865                 /* Lossless */
866         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_LOSSLESS \
867                                                         (UINT32_C(0x1) << 0)
868                 /*
869                  * Set to 0xFF... (All Fs) if there is no service profile
870                  * specified
871                  */
872         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID3_SERVICE_PROFILE_UNKNOWN \
873                                                         (UINT32_C(0xff) << 0)
874         uint8_t queue_id3_service_profile;
875
876         /* ID of CoS Queue 4. FF - Invalid id */
877         uint8_t queue_id4;
878         /* This value is applicable to CoS queues only. */
879                 /* Lossy (best-effort) */
880         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSY \
881                                                         (UINT32_C(0x0) << 0)
882                 /* Lossless */
883         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_LOSSLESS \
884                                                         (UINT32_C(0x1) << 0)
885                 /*
886                  * Set to 0xFF... (All Fs) if there is no service profile
887                  * specified
888                  */
889         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID4_SERVICE_PROFILE_UNKNOWN \
890                                                         (UINT32_C(0xff) << 0)
891         uint8_t queue_id4_service_profile;
892
893         /* ID of CoS Queue 5. FF - Invalid id */
894         uint8_t queue_id5;
895
896         /* This value is applicable to CoS queues only. */
897                 /* Lossy (best-effort) */
898         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSY \
899                                                         (UINT32_C(0x0) << 0)
900                 /* Lossless */
901         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_LOSSLESS \
902                                                         (UINT32_C(0x1) << 0)
903                 /*
904                  * Set to 0xFF... (All Fs) if there is no service profile
905                  * specified
906                  */
907         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID5_SERVICE_PROFILE_UNKNOWN \
908                                                         (UINT32_C(0xff) << 0)
909         uint8_t queue_id5_service_profile;
910
911         /* ID of CoS Queue 6. FF - Invalid id */
912         uint8_t queue_id6_service_profile;
913         /* This value is applicable to CoS queues only. */
914                 /* Lossy (best-effort) */
915         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSY \
916                                                         (UINT32_C(0x0) << 0)
917                 /* Lossless */
918         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_LOSSLESS \
919                                                         (UINT32_C(0x1) << 0)
920                 /*
921                  * Set to 0xFF... (All Fs) if there is no service profile
922                  * specified
923                  */
924         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID6_SERVICE_PROFILE_UNKNOWN \
925                                                         (UINT32_C(0xff) << 0)
926         uint8_t queue_id6;
927
928         /* ID of CoS Queue 7. FF - Invalid id */
929         uint8_t queue_id7;
930
931         /* This value is applicable to CoS queues only. */
932                 /* Lossy (best-effort) */
933         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSY \
934                                                         (UINT32_C(0x0) << 0)
935                 /* Lossless */
936         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_LOSSLESS \
937                                                         (UINT32_C(0x1) << 0)
938                 /*
939                  * Set to 0xFF... (All Fs) if there is no service profile
940                  * specified
941                  */
942         #define HWRM_QUEUE_QPORTCFG_OUTPUT_QUEUE_ID7_SERVICE_PROFILE_UNKNOWN \
943                                                         (UINT32_C(0xff) << 0)
944         uint8_t queue_id7_service_profile;
945
946         /*
947          * This field is used in Output records to indicate that the output is
948          * completely written to RAM. This field should be read as '1' to
949          * indicate that the output has been completely written. When writing a
950          * command completion or response to an internal processor, the order of
951          * writes has to be such that this field is written last.
952          */
953         uint8_t valid;
954 } __attribute__((packed));
955
956 /* hwrm_func_drv_rgtr */
957 /*
958  * Description: This command is used by the function driver to register its
959  * information with the HWRM. A function driver shall implement this command. A
960  * function driver shall use this command during the driver initialization right
961  * after the HWRM version discovery and default ring resources allocation.
962  */
963
964 /* Input (80 bytes) */
965 struct hwrm_func_drv_rgtr_input {
966         /*
967          * This value indicates what type of request this is. The format for the
968          * rest of the command is determined by this field.
969          */
970         uint16_t req_type;
971
972         /*
973          * This value indicates the what completion ring the request will be
974          * optionally completed on. If the value is -1, then no CR completion
975          * will be generated. Any other value must be a valid CR ring_id value
976          * for this function.
977          */
978         uint16_t cmpl_ring;
979
980         /* This value indicates the command sequence number. */
981         uint16_t seq_id;
982
983         /*
984          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
985          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
986          */
987         uint16_t target_id;
988
989         /*
990          * This is the host address where the response will be written when the
991          * request is complete. This area must be 16B aligned and must be
992          * cleared to zero before the request is made.
993          */
994         uint64_t resp_addr;
995
996         /*
997          * When this bit is '1', the function driver is requesting all requests
998          * from its children VF drivers to be forwarded to itself. This flag can
999          * only be set by the PF driver. If a VF driver sets this flag, it
1000          * should be ignored by the HWRM.
1001          */
1002         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_ALL_MODE        UINT32_C(0x1)
1003         /*
1004          * When this bit is '1', the function is requesting none of the requests
1005          * from its children VF drivers to be forwarded to itself. This flag can
1006          * only be set by the PF driver. If a VF driver sets this flag, it
1007          * should be ignored by the HWRM.
1008          */
1009         #define HWRM_FUNC_DRV_RGTR_INPUT_FLAGS_FWD_NONE_MODE       UINT32_C(0x2)
1010         uint32_t flags;
1011
1012         /* This bit must be '1' for the os_type field to be configured. */
1013         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_OS_TYPE           UINT32_C(0x1)
1014         /* This bit must be '1' for the ver field to be configured. */
1015         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER               UINT32_C(0x2)
1016         /* This bit must be '1' for the timestamp field to be configured. */
1017         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_TIMESTAMP         UINT32_C(0x4)
1018         /* This bit must be '1' for the vf_req_fwd field to be configured. */
1019         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VF_REQ_FWD        UINT32_C(0x8)
1020         /*
1021          * This bit must be '1' for the async_event_fwd field to be configured.
1022          */
1023         #define HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD \
1024                                                                 UINT32_C(0x10)
1025         uint32_t enables;
1026
1027         /* This value indicates the type of OS. */
1028                 /* Unknown */
1029         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_UNKNOWN \
1030                                                         (UINT32_C(0x0) << 0)
1031                 /* Other OS not listed below. */
1032         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_OTHER \
1033                                                         (UINT32_C(0x1) << 0)
1034                 /* MSDOS OS. */
1035         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_MSDOS \
1036                                                         (UINT32_C(0xe) << 0)
1037                 /* Windows OS. */
1038         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WINDOWS \
1039                                                         (UINT32_C(0x12) << 0)
1040                 /* Solaris OS. */
1041         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_SOLARIS \
1042                                                         (UINT32_C(0x1d) << 0)
1043                 /* Linux OS. */
1044         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_LINUX \
1045                                                         (UINT32_C(0x24) << 0)
1046                 /* FreeBSD OS. */
1047         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_FREEBSD \
1048                                                         (UINT32_C(0x2a) << 0)
1049                 /* VMware ESXi OS. */
1050         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_ESXI \
1051                                                         (UINT32_C(0x68) << 0)
1052                 /* Microsoft Windows 8 64-bit OS. */
1053         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN864 \
1054                                                         (UINT32_C(0x73) << 0)
1055                 /* Microsoft Windows Server 2012 R2 OS. */
1056         #define HWRM_FUNC_DRV_RGTR_INPUT_OS_TYPE_WIN2012R2 \
1057                                                         (UINT32_C(0x74) << 0)
1058         uint16_t os_type;
1059
1060         /* This is the major version of the driver. */
1061         uint8_t ver_maj;
1062
1063         /* This is the minor version of the driver. */
1064         uint8_t ver_min;
1065
1066         /* This is the update version of the driver. */
1067         uint8_t ver_upd;
1068
1069         uint8_t unused_0;
1070         uint16_t unused_1;
1071
1072         /*
1073          * This is a 32-bit timestamp provided by the driver for keep alive. The
1074          * timestamp is in multiples of 1ms.
1075          */
1076         uint32_t timestamp;
1077
1078         uint32_t unused_2;
1079
1080         /*
1081          * This is a 256-bit bit mask provided by the PF driver for letting the
1082          * HWRM know what commands issued by the VF driver to the HWRM should be
1083          * forwarded to the PF driver. Nth bit refers to the Nth req_type.
1084          * Setting Nth bit to 1 indicates that requests from the VF driver with
1085          * req_type equal to N shall be forwarded to the parent PF driver. This
1086          * field is not valid for the VF driver.
1087          */
1088         uint32_t vf_req_fwd[8];
1089
1090         /*
1091          * This is a 256-bit bit mask provided by the function driver (PF or VF
1092          * driver) to indicate the list of asynchronous event completions to be
1093          * forwarded. Nth bit refers to the Nth event_id. Setting Nth bit to 1
1094          * by the function driver shall result in the HWRM forwarding
1095          * asynchronous event completion with event_id equal to N. If all bits
1096          * are set to 0 (value of 0), then the HWRM shall not forward any
1097          * asynchronous event completion to this function driver.
1098          */
1099         uint32_t async_event_fwd[8];
1100 } __attribute__((packed));
1101
1102 /* Output (16 bytes) */
1103
1104 struct hwrm_func_drv_rgtr_output {
1105         /*
1106          * Pass/Fail or error type Note: receiver to verify the in parameters,
1107          * and fail the call with an error when appropriate
1108          */
1109         uint16_t error_code;
1110
1111         /* This field returns the type of original request. */
1112         uint16_t req_type;
1113
1114         /* This field provides original sequence number of the command. */
1115         uint16_t seq_id;
1116
1117         /*
1118          * This field is the length of the response in bytes. The last byte of
1119          * the response is a valid flag that will read as '1' when the command
1120          * has been completely written to memory.
1121          */
1122         uint16_t resp_len;
1123
1124         uint32_t unused_0;
1125         uint8_t unused_1;
1126         uint8_t unused_2;
1127         uint8_t unused_3;
1128
1129         /*
1130          * This field is used in Output records to indicate that the output is
1131          * completely written to RAM. This field should be read as '1' to
1132          * indicate that the output has been completely written. When writing a
1133          * command completion or response to an internal processor, the order of
1134          * writes has to be such that this field is written last.
1135          */
1136         uint8_t valid;
1137 } __attribute__((packed));
1138
1139 /* hwrm_func_drv_unrgtr */
1140 /*
1141  * Description: This command is used by the function driver to un register with
1142  * the HWRM. A function driver shall implement this command. A function driver
1143  * shall use this command during the driver unloading.
1144  */
1145 /* Input (24 bytes) */
1146
1147 struct hwrm_func_drv_unrgtr_input {
1148         /*
1149          * This value indicates what type of request this is. The format for the
1150          * rest of the command is determined by this field.
1151          */
1152         uint16_t req_type;
1153
1154         /*
1155          * This value indicates the what completion ring the request will be
1156          * optionally completed on. If the value is -1, then no CR completion
1157          * will be generated. Any other value must be a valid CR ring_id value
1158          * for this function.
1159          */
1160         uint16_t cmpl_ring;
1161
1162         /* This value indicates the command sequence number. */
1163         uint16_t seq_id;
1164
1165         /*
1166          * Target ID of this command. 0x0 - 0xFFF8 - Used for function ids
1167          * 0xFFF8 - 0xFFFE - Reserved for internal processors 0xFFFF - HWRM
1168          */
1169         uint16_t target_id;
1170
1171         /*
1172          * This is the host address where the response will be written when the
1173          * request is complete. This area must be 16B aligned and must be
1174          * cleared to zero before the request is made.
1175          */
1176         uint64_t resp_addr;
1177
1178         /*
1179          * When this bit is '1', the function driver is notifying the HWRM to
1180          * prepare for the shutdown.
1181          */
1182         #define HWRM_FUNC_DRV_UNRGTR_INPUT_FLAGS_PREPARE_FOR_SHUTDOWN \
1183                                                         UINT32_C(0x1)
1184         uint32_t flags;
1185
1186         uint32_t unused_0;
1187 } __attribute__((packed));
1188
1189 /* Output (16 bytes) */
1190 struct hwrm_func_drv_unrgtr_output {
1191         /*
1192          * Pass/Fail or error type Note: receiver to verify the in parameters,
1193          * and fail the call with an error when appropriate
1194          */
1195         uint16_t error_code;
1196
1197         /* This field returns the type of original request. */
1198         uint16_t req_type;
1199
1200         /* This field provides original sequence number of the command. */
1201         uint16_t seq_id;
1202
1203         /*
1204          * This field is the length of the response in bytes. The last byte of
1205          * the response is a valid flag that will read as '1' when the command
1206          * has been completely written to memory.
1207          */
1208         uint16_t resp_len;
1209
1210         uint32_t unused_0;
1211         uint8_t unused_1;
1212         uint8_t unused_2;
1213         uint8_t unused_3;
1214
1215         /*
1216          * This field is used in Output records to indicate that the output is
1217          * completely written to RAM. This field should be read as '1' to
1218          * indicate that the output has been completely written. When writing a
1219          * command completion or response to an internal processor, the order of
1220          * writes has to be such that this field is written last.
1221          */
1222         uint8_t valid;
1223 } __attribute__((packed));
1224
1225 #endif