1*49ef7e06SGarrett D'Amore /*
2*49ef7e06SGarrett D'Amore  * Copyright (c) 2012-2015 Solarflare Communications Inc.
3*49ef7e06SGarrett D'Amore  * All rights reserved.
4*49ef7e06SGarrett D'Amore  *
5*49ef7e06SGarrett D'Amore  * Redistribution and use in source and binary forms, with or without
6*49ef7e06SGarrett D'Amore  * modification, are permitted provided that the following conditions are met:
7*49ef7e06SGarrett D'Amore  *
8*49ef7e06SGarrett D'Amore  * 1. Redistributions of source code must retain the above copyright notice,
9*49ef7e06SGarrett D'Amore  *    this list of conditions and the following disclaimer.
10*49ef7e06SGarrett D'Amore  * 2. Redistributions in binary form must reproduce the above copyright notice,
11*49ef7e06SGarrett D'Amore  *    this list of conditions and the following disclaimer in the documentation
12*49ef7e06SGarrett D'Amore  *    and/or other materials provided with the distribution.
13*49ef7e06SGarrett D'Amore  *
14*49ef7e06SGarrett D'Amore  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15*49ef7e06SGarrett D'Amore  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16*49ef7e06SGarrett D'Amore  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17*49ef7e06SGarrett D'Amore  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18*49ef7e06SGarrett D'Amore  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19*49ef7e06SGarrett D'Amore  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20*49ef7e06SGarrett D'Amore  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21*49ef7e06SGarrett D'Amore  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22*49ef7e06SGarrett D'Amore  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23*49ef7e06SGarrett D'Amore  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24*49ef7e06SGarrett D'Amore  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*49ef7e06SGarrett D'Amore  *
26*49ef7e06SGarrett D'Amore  * The views and conclusions contained in the software and documentation are
27*49ef7e06SGarrett D'Amore  * those of the authors and should not be interpreted as representing official
28*49ef7e06SGarrett D'Amore  * policies, either expressed or implied, of the FreeBSD Project.
29*49ef7e06SGarrett D'Amore  */
30*49ef7e06SGarrett D'Amore 
31*49ef7e06SGarrett D'Amore /* These structures define the layouts for the TLV items stored in static and
32*49ef7e06SGarrett D'Amore  * dynamic configuration partitions in NVRAM for EF10 (Huntington etc.).
33*49ef7e06SGarrett D'Amore  *
34*49ef7e06SGarrett D'Amore  * They contain the same sort of information that was kept in the
35*49ef7e06SGarrett D'Amore  * siena_mc_static_config_hdr_t and siena_mc_dynamic_config_hdr_t structures
36*49ef7e06SGarrett D'Amore  * (defined in <ci/mgmt/mc_flash_layout.h> and <ci/mgmt/mc_dynamic_cfg.h>) for
37*49ef7e06SGarrett D'Amore  * Siena.
38*49ef7e06SGarrett D'Amore  *
39*49ef7e06SGarrett D'Amore  * These are used directly by the MC and should also be usable directly on host
40*49ef7e06SGarrett D'Amore  * systems which are little-endian and do not do strange things with structure
41*49ef7e06SGarrett D'Amore  * padding.  (Big-endian host systems will require some byte-swapping.)
42*49ef7e06SGarrett D'Amore  *
43*49ef7e06SGarrett D'Amore  *                                    -----
44*49ef7e06SGarrett D'Amore  *
45*49ef7e06SGarrett D'Amore  * Please refer to SF-108797-SW for a general overview of the TLV partition
46*49ef7e06SGarrett D'Amore  * format.
47*49ef7e06SGarrett D'Amore  *
48*49ef7e06SGarrett D'Amore  *                                    -----
49*49ef7e06SGarrett D'Amore  *
50*49ef7e06SGarrett D'Amore  * The current tag IDs have a general structure: with the exception of the
51*49ef7e06SGarrett D'Amore  * special values defined in the document, they are of the form 0xLTTTNNNN,
52*49ef7e06SGarrett D'Amore  * where:
53*49ef7e06SGarrett D'Amore  *
54*49ef7e06SGarrett D'Amore  *   -  L is a location, indicating where this tag is expected to be found:
55*49ef7e06SGarrett D'Amore  *        0: static configuration
56*49ef7e06SGarrett D'Amore  *        1: dynamic configuration
57*49ef7e06SGarrett D'Amore  *        2: firmware internal use
58*49ef7e06SGarrett D'Amore  *        3: license partition
59*49ef7e06SGarrett D'Amore  *
60*49ef7e06SGarrett D'Amore  *   -  TTT is a type, which is just a unique value.  The same type value
61*49ef7e06SGarrett D'Amore  *      might appear in both locations, indicating a relationship between
62*49ef7e06SGarrett D'Amore  *      the items (e.g. static and dynamic VPD below).
63*49ef7e06SGarrett D'Amore  *
64*49ef7e06SGarrett D'Amore  *   -  NNNN is an index of some form.  Some item types are per-port, some
65*49ef7e06SGarrett D'Amore  *      are per-PF, some are per-partition-type.
66*49ef7e06SGarrett D'Amore  *
67*49ef7e06SGarrett D'Amore  *                                    -----
68*49ef7e06SGarrett D'Amore  *
69*49ef7e06SGarrett D'Amore  * As with the previous Siena structures, each structure here is laid out
70*49ef7e06SGarrett D'Amore  * carefully: values are aligned to their natural boundary, with explicit
71*49ef7e06SGarrett D'Amore  * padding fields added where necessary.  (No, technically this does not
72*49ef7e06SGarrett D'Amore  * absolutely guarantee portability.  But, in practice, compilers are generally
73*49ef7e06SGarrett D'Amore  * sensible enough not to introduce completely pointless padding, and it works
74*49ef7e06SGarrett D'Amore  * well enough.)
75*49ef7e06SGarrett D'Amore  */
76*49ef7e06SGarrett D'Amore 
77*49ef7e06SGarrett D'Amore 
78*49ef7e06SGarrett D'Amore #ifndef CI_MGMT_TLV_LAYOUT_H
79*49ef7e06SGarrett D'Amore #define CI_MGMT_TLV_LAYOUT_H
80*49ef7e06SGarrett D'Amore 
81*49ef7e06SGarrett D'Amore 
82*49ef7e06SGarrett D'Amore /* ----------------------------------------------------------------------------
83*49ef7e06SGarrett D'Amore  *  General structure (defined by SF-108797-SW)
84*49ef7e06SGarrett D'Amore  * ----------------------------------------------------------------------------
85*49ef7e06SGarrett D'Amore  */
86*49ef7e06SGarrett D'Amore 
87*49ef7e06SGarrett D'Amore 
88*49ef7e06SGarrett D'Amore /* The "end" tag.
89*49ef7e06SGarrett D'Amore  *
90*49ef7e06SGarrett D'Amore  * (Note that this is *not* followed by length or value fields: anything after
91*49ef7e06SGarrett D'Amore  * the tag itself is irrelevant.)
92*49ef7e06SGarrett D'Amore  */
93*49ef7e06SGarrett D'Amore 
94*49ef7e06SGarrett D'Amore #define TLV_TAG_END                     (0xEEEEEEEE)
95*49ef7e06SGarrett D'Amore 
96*49ef7e06SGarrett D'Amore 
97*49ef7e06SGarrett D'Amore /* Other special reserved tag values.
98*49ef7e06SGarrett D'Amore  */
99*49ef7e06SGarrett D'Amore 
100*49ef7e06SGarrett D'Amore #define TLV_TAG_SKIP                    (0x00000000)
101*49ef7e06SGarrett D'Amore #define TLV_TAG_INVALID                 (0xFFFFFFFF)
102*49ef7e06SGarrett D'Amore 
103*49ef7e06SGarrett D'Amore 
104*49ef7e06SGarrett D'Amore /* TLV partition header.
105*49ef7e06SGarrett D'Amore  *
106*49ef7e06SGarrett D'Amore  * In a TLV partition, this must be the first item in the sequence, at offset
107*49ef7e06SGarrett D'Amore  * 0.
108*49ef7e06SGarrett D'Amore  */
109*49ef7e06SGarrett D'Amore 
110*49ef7e06SGarrett D'Amore #define TLV_TAG_PARTITION_HEADER        (0xEF10DA7A)
111*49ef7e06SGarrett D'Amore 
112*49ef7e06SGarrett D'Amore struct tlv_partition_header {
113*49ef7e06SGarrett D'Amore   uint32_t tag;
114*49ef7e06SGarrett D'Amore   uint32_t length;
115*49ef7e06SGarrett D'Amore   uint16_t type_id;
116*49ef7e06SGarrett D'Amore /* 0 indicates the default segment (always located at offset 0), while other values
117*49ef7e06SGarrett D'Amore  * are for RFID-selectable presets that should immediately follow the default segment.
118*49ef7e06SGarrett D'Amore  * The default segment may also have preset > 0, which means that it is a preset
119*49ef7e06SGarrett D'Amore  * selected through an RFID command and copied by FW to the location at offset 0. */
120*49ef7e06SGarrett D'Amore   uint16_t preset;
121*49ef7e06SGarrett D'Amore   uint32_t generation;
122*49ef7e06SGarrett D'Amore   uint32_t total_length;
123*49ef7e06SGarrett D'Amore };
124*49ef7e06SGarrett D'Amore 
125*49ef7e06SGarrett D'Amore 
126*49ef7e06SGarrett D'Amore /* TLV partition trailer.
127*49ef7e06SGarrett D'Amore  *
128*49ef7e06SGarrett D'Amore  * In a TLV partition, this must be the last item in the sequence, immediately
129*49ef7e06SGarrett D'Amore  * preceding the TLV_TAG_END word.
130*49ef7e06SGarrett D'Amore  */
131*49ef7e06SGarrett D'Amore 
132*49ef7e06SGarrett D'Amore #define TLV_TAG_PARTITION_TRAILER       (0xEF101A57)
133*49ef7e06SGarrett D'Amore 
134*49ef7e06SGarrett D'Amore struct tlv_partition_trailer {
135*49ef7e06SGarrett D'Amore   uint32_t tag;
136*49ef7e06SGarrett D'Amore   uint32_t length;
137*49ef7e06SGarrett D'Amore   uint32_t generation;
138*49ef7e06SGarrett D'Amore   uint32_t checksum;
139*49ef7e06SGarrett D'Amore };
140*49ef7e06SGarrett D'Amore 
141*49ef7e06SGarrett D'Amore 
142*49ef7e06SGarrett D'Amore /* Appendable TLV partition header.
143*49ef7e06SGarrett D'Amore  *
144*49ef7e06SGarrett D'Amore  * In an appendable TLV partition, this must be the first item in the sequence,
145*49ef7e06SGarrett D'Amore  * at offset 0.  (Note that, unlike the configuration partitions, there is no
146*49ef7e06SGarrett D'Amore  * trailer before the TLV_TAG_END word.)
147*49ef7e06SGarrett D'Amore  */
148*49ef7e06SGarrett D'Amore 
149*49ef7e06SGarrett D'Amore #define TLV_TAG_APPENDABLE_PARTITION_HEADER (0xEF10ADA7)
150*49ef7e06SGarrett D'Amore 
151*49ef7e06SGarrett D'Amore struct tlv_appendable_partition_header {
152*49ef7e06SGarrett D'Amore   uint32_t tag;
153*49ef7e06SGarrett D'Amore   uint32_t length;
154*49ef7e06SGarrett D'Amore   uint16_t type_id;
155*49ef7e06SGarrett D'Amore   uint16_t reserved;
156*49ef7e06SGarrett D'Amore };
157*49ef7e06SGarrett D'Amore 
158*49ef7e06SGarrett D'Amore 
159*49ef7e06SGarrett D'Amore /* ----------------------------------------------------------------------------
160*49ef7e06SGarrett D'Amore  *  Configuration items
161*49ef7e06SGarrett D'Amore  * ----------------------------------------------------------------------------
162*49ef7e06SGarrett D'Amore  */
163*49ef7e06SGarrett D'Amore 
164*49ef7e06SGarrett D'Amore 
165*49ef7e06SGarrett D'Amore /* NIC global capabilities.
166*49ef7e06SGarrett D'Amore  */
167*49ef7e06SGarrett D'Amore 
168*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_CAPABILITIES     (0x00010000)
169*49ef7e06SGarrett D'Amore 
170*49ef7e06SGarrett D'Amore struct tlv_global_capabilities {
171*49ef7e06SGarrett D'Amore   uint32_t tag;
172*49ef7e06SGarrett D'Amore   uint32_t length;
173*49ef7e06SGarrett D'Amore   uint32_t flags;
174*49ef7e06SGarrett D'Amore };
175*49ef7e06SGarrett D'Amore 
176*49ef7e06SGarrett D'Amore 
177*49ef7e06SGarrett D'Amore /* Siena-style per-port MAC address allocation.
178*49ef7e06SGarrett D'Amore  *
179*49ef7e06SGarrett D'Amore  * There are <count> addresses, starting at <base_address> and incrementing
180*49ef7e06SGarrett D'Amore  * by adding <stride> to the low-order byte(s).
181*49ef7e06SGarrett D'Amore  *
182*49ef7e06SGarrett D'Amore  * (See also TLV_TAG_GLOBAL_MAC for an alternative, specifying a global pool
183*49ef7e06SGarrett D'Amore  * of contiguous MAC addresses for the firmware to allocate as it sees fit.)
184*49ef7e06SGarrett D'Amore  */
185*49ef7e06SGarrett D'Amore 
186*49ef7e06SGarrett D'Amore #define TLV_TAG_PORT_MAC(port)          (0x00020000 + (port))
187*49ef7e06SGarrett D'Amore 
188*49ef7e06SGarrett D'Amore struct tlv_port_mac {
189*49ef7e06SGarrett D'Amore   uint32_t tag;
190*49ef7e06SGarrett D'Amore   uint32_t length;
191*49ef7e06SGarrett D'Amore   uint8_t  base_address[6];
192*49ef7e06SGarrett D'Amore   uint16_t reserved;
193*49ef7e06SGarrett D'Amore   uint16_t count;
194*49ef7e06SGarrett D'Amore   uint16_t stride;
195*49ef7e06SGarrett D'Amore };
196*49ef7e06SGarrett D'Amore 
197*49ef7e06SGarrett D'Amore 
198*49ef7e06SGarrett D'Amore /* Static VPD.
199*49ef7e06SGarrett D'Amore  *
200*49ef7e06SGarrett D'Amore  * This is the portion of VPD which is set at manufacturing time and not
201*49ef7e06SGarrett D'Amore  * expected to change.  It is formatted as a standard PCI VPD block. There are
202*49ef7e06SGarrett D'Amore  * global and per-pf TLVs for this, the global TLV is new for Medford and is
203*49ef7e06SGarrett D'Amore  * used in preference to the per-pf TLV.
204*49ef7e06SGarrett D'Amore  */
205*49ef7e06SGarrett D'Amore 
206*49ef7e06SGarrett D'Amore #define TLV_TAG_PF_STATIC_VPD(pf)       (0x00030000 + (pf))
207*49ef7e06SGarrett D'Amore 
208*49ef7e06SGarrett D'Amore struct tlv_pf_static_vpd {
209*49ef7e06SGarrett D'Amore   uint32_t tag;
210*49ef7e06SGarrett D'Amore   uint32_t length;
211*49ef7e06SGarrett D'Amore   uint8_t  bytes[];
212*49ef7e06SGarrett D'Amore };
213*49ef7e06SGarrett D'Amore 
214*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_STATIC_VPD       (0x001f0000)
215*49ef7e06SGarrett D'Amore 
216*49ef7e06SGarrett D'Amore struct tlv_global_static_vpd {
217*49ef7e06SGarrett D'Amore   uint32_t tag;
218*49ef7e06SGarrett D'Amore   uint32_t length;
219*49ef7e06SGarrett D'Amore   uint8_t  bytes[];
220*49ef7e06SGarrett D'Amore };
221*49ef7e06SGarrett D'Amore 
222*49ef7e06SGarrett D'Amore 
223*49ef7e06SGarrett D'Amore /* Dynamic VPD.
224*49ef7e06SGarrett D'Amore  *
225*49ef7e06SGarrett D'Amore  * This is the portion of VPD which may be changed (e.g. by firmware updates).
226*49ef7e06SGarrett D'Amore  * It is formatted as a standard PCI VPD block. There are global and per-pf TLVs
227*49ef7e06SGarrett D'Amore  * for this, the global TLV is new for Medford and is used in preference to the
228*49ef7e06SGarrett D'Amore  * per-pf TLV.
229*49ef7e06SGarrett D'Amore  */
230*49ef7e06SGarrett D'Amore 
231*49ef7e06SGarrett D'Amore #define TLV_TAG_PF_DYNAMIC_VPD(pf)      (0x10030000 + (pf))
232*49ef7e06SGarrett D'Amore 
233*49ef7e06SGarrett D'Amore struct tlv_pf_dynamic_vpd {
234*49ef7e06SGarrett D'Amore   uint32_t tag;
235*49ef7e06SGarrett D'Amore   uint32_t length;
236*49ef7e06SGarrett D'Amore   uint8_t  bytes[];
237*49ef7e06SGarrett D'Amore };
238*49ef7e06SGarrett D'Amore 
239*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_DYNAMIC_VPD      (0x10200000)
240*49ef7e06SGarrett D'Amore 
241*49ef7e06SGarrett D'Amore struct tlv_global_dynamic_vpd {
242*49ef7e06SGarrett D'Amore   uint32_t tag;
243*49ef7e06SGarrett D'Amore   uint32_t length;
244*49ef7e06SGarrett D'Amore   uint8_t  bytes[];
245*49ef7e06SGarrett D'Amore };
246*49ef7e06SGarrett D'Amore 
247*49ef7e06SGarrett D'Amore 
248*49ef7e06SGarrett D'Amore /* "DBI" PCI config space changes.
249*49ef7e06SGarrett D'Amore  *
250*49ef7e06SGarrett D'Amore  * This is a set of edits made to the default PCI config space values before
251*49ef7e06SGarrett D'Amore  * the device is allowed to enumerate. There are global and per-pf TLVs for
252*49ef7e06SGarrett D'Amore  * this, the global TLV is new for Medford and is used in preference to the
253*49ef7e06SGarrett D'Amore  * per-pf TLV.
254*49ef7e06SGarrett D'Amore  */
255*49ef7e06SGarrett D'Amore 
256*49ef7e06SGarrett D'Amore #define TLV_TAG_PF_DBI(pf)              (0x00040000 + (pf))
257*49ef7e06SGarrett D'Amore 
258*49ef7e06SGarrett D'Amore struct tlv_pf_dbi {
259*49ef7e06SGarrett D'Amore   uint32_t tag;
260*49ef7e06SGarrett D'Amore   uint32_t length;
261*49ef7e06SGarrett D'Amore   struct {
262*49ef7e06SGarrett D'Amore     uint16_t addr;
263*49ef7e06SGarrett D'Amore     uint16_t byte_enables;
264*49ef7e06SGarrett D'Amore     uint32_t value;
265*49ef7e06SGarrett D'Amore   } items[];
266*49ef7e06SGarrett D'Amore };
267*49ef7e06SGarrett D'Amore 
268*49ef7e06SGarrett D'Amore 
269*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_DBI              (0x00210000)
270*49ef7e06SGarrett D'Amore 
271*49ef7e06SGarrett D'Amore struct tlv_global_dbi {
272*49ef7e06SGarrett D'Amore   uint32_t tag;
273*49ef7e06SGarrett D'Amore   uint32_t length;
274*49ef7e06SGarrett D'Amore   struct {
275*49ef7e06SGarrett D'Amore     uint16_t addr;
276*49ef7e06SGarrett D'Amore     uint16_t byte_enables;
277*49ef7e06SGarrett D'Amore     uint32_t value;
278*49ef7e06SGarrett D'Amore   } items[];
279*49ef7e06SGarrett D'Amore };
280*49ef7e06SGarrett D'Amore 
281*49ef7e06SGarrett D'Amore 
282*49ef7e06SGarrett D'Amore /* Partition subtype codes.
283*49ef7e06SGarrett D'Amore  *
284*49ef7e06SGarrett D'Amore  * A subtype may optionally be stored for each type of partition present in
285*49ef7e06SGarrett D'Amore  * the NVRAM.  For example, this may be used to allow a generic firmware update
286*49ef7e06SGarrett D'Amore  * utility to select a specific variant of firmware for a specific variant of
287*49ef7e06SGarrett D'Amore  * board.
288*49ef7e06SGarrett D'Amore  *
289*49ef7e06SGarrett D'Amore  * The description[] field is an optional string which is returned in the
290*49ef7e06SGarrett D'Amore  * MC_CMD_NVRAM_METADATA response if present.
291*49ef7e06SGarrett D'Amore  */
292*49ef7e06SGarrett D'Amore 
293*49ef7e06SGarrett D'Amore #define TLV_TAG_PARTITION_SUBTYPE(type) (0x00050000 + (type))
294*49ef7e06SGarrett D'Amore 
295*49ef7e06SGarrett D'Amore struct tlv_partition_subtype {
296*49ef7e06SGarrett D'Amore   uint32_t tag;
297*49ef7e06SGarrett D'Amore   uint32_t length;
298*49ef7e06SGarrett D'Amore   uint32_t subtype;
299*49ef7e06SGarrett D'Amore   uint8_t  description[];
300*49ef7e06SGarrett D'Amore };
301*49ef7e06SGarrett D'Amore 
302*49ef7e06SGarrett D'Amore 
303*49ef7e06SGarrett D'Amore /* Partition version codes.
304*49ef7e06SGarrett D'Amore  *
305*49ef7e06SGarrett D'Amore  * A version may optionally be stored for each type of partition present in
306*49ef7e06SGarrett D'Amore  * the NVRAM.  This provides a standard way of tracking the currently stored
307*49ef7e06SGarrett D'Amore  * version of each of the various component images.
308*49ef7e06SGarrett D'Amore  */
309*49ef7e06SGarrett D'Amore 
310*49ef7e06SGarrett D'Amore #define TLV_TAG_PARTITION_VERSION(type) (0x10060000 + (type))
311*49ef7e06SGarrett D'Amore 
312*49ef7e06SGarrett D'Amore struct tlv_partition_version {
313*49ef7e06SGarrett D'Amore   uint32_t tag;
314*49ef7e06SGarrett D'Amore   uint32_t length;
315*49ef7e06SGarrett D'Amore   uint16_t version_w;
316*49ef7e06SGarrett D'Amore   uint16_t version_x;
317*49ef7e06SGarrett D'Amore   uint16_t version_y;
318*49ef7e06SGarrett D'Amore   uint16_t version_z;
319*49ef7e06SGarrett D'Amore };
320*49ef7e06SGarrett D'Amore 
321*49ef7e06SGarrett D'Amore /* Global PCIe configuration */
322*49ef7e06SGarrett D'Amore 
323*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_PCIE_CONFIG (0x10070000)
324*49ef7e06SGarrett D'Amore 
325*49ef7e06SGarrett D'Amore struct tlv_pcie_config {
326*49ef7e06SGarrett D'Amore   uint32_t tag;
327*49ef7e06SGarrett D'Amore   uint32_t length;
328*49ef7e06SGarrett D'Amore   int16_t max_pf_number;                        /**< Largest PF RID (lower PFs may be hidden) */
329*49ef7e06SGarrett D'Amore   uint16_t pf_aper;                             /**< BIU aperture for PF BAR2 */
330*49ef7e06SGarrett D'Amore   uint16_t vf_aper;                             /**< BIU aperture for VF BAR0 */
331*49ef7e06SGarrett D'Amore   uint16_t int_aper;                            /**< BIU aperture for PF BAR4 and VF BAR2 */
332*49ef7e06SGarrett D'Amore #define TLV_MAX_PF_DEFAULT (-1)                 /* Use FW default for largest PF RID  */
333*49ef7e06SGarrett D'Amore #define TLV_APER_DEFAULT (0xFFFF)               /* Use FW default for a given aperture */
334*49ef7e06SGarrett D'Amore };
335*49ef7e06SGarrett D'Amore 
336*49ef7e06SGarrett D'Amore /* Per-PF configuration. Note that not all these fields are necessarily useful
337*49ef7e06SGarrett D'Amore  * as the apertures are constrained by the BIU settings (the one case we do
338*49ef7e06SGarrett D'Amore  * use is to make BAR2 bigger than the BIU thinks to reserve space), but we can
339*49ef7e06SGarrett D'Amore  * tidy things up later */
340*49ef7e06SGarrett D'Amore 
341*49ef7e06SGarrett D'Amore #define TLV_TAG_PF_PCIE_CONFIG(pf)  (0x10080000 + (pf))
342*49ef7e06SGarrett D'Amore 
343*49ef7e06SGarrett D'Amore struct tlv_per_pf_pcie_config {
344*49ef7e06SGarrett D'Amore   uint32_t tag;
345*49ef7e06SGarrett D'Amore   uint32_t length;
346*49ef7e06SGarrett D'Amore   uint8_t vfs_total;
347*49ef7e06SGarrett D'Amore   uint8_t port_allocation;
348*49ef7e06SGarrett D'Amore   uint16_t vectors_per_pf;
349*49ef7e06SGarrett D'Amore   uint16_t vectors_per_vf;
350*49ef7e06SGarrett D'Amore   uint8_t pf_bar0_aperture;
351*49ef7e06SGarrett D'Amore   uint8_t pf_bar2_aperture;
352*49ef7e06SGarrett D'Amore   uint8_t vf_bar0_aperture;
353*49ef7e06SGarrett D'Amore   uint8_t vf_base;
354*49ef7e06SGarrett D'Amore   uint16_t supp_pagesz;
355*49ef7e06SGarrett D'Amore   uint16_t msix_vec_base;
356*49ef7e06SGarrett D'Amore };
357*49ef7e06SGarrett D'Amore 
358*49ef7e06SGarrett D'Amore 
359*49ef7e06SGarrett D'Amore /* Development ONLY. This is a single TLV tag for all the gubbins
360*49ef7e06SGarrett D'Amore  * that can be set through the MC command-line other than the PCIe
361*49ef7e06SGarrett D'Amore  * settings. This is a temporary measure. */
362*49ef7e06SGarrett D'Amore #define TLV_TAG_TMP_GUBBINS (0x10090000)        /* legacy symbol - do not use */
363*49ef7e06SGarrett D'Amore #define TLV_TAG_TMP_GUBBINS_HUNT TLV_TAG_TMP_GUBBINS
364*49ef7e06SGarrett D'Amore 
365*49ef7e06SGarrett D'Amore struct tlv_tmp_gubbins {
366*49ef7e06SGarrett D'Amore   uint32_t tag;
367*49ef7e06SGarrett D'Amore   uint32_t length;
368*49ef7e06SGarrett D'Amore   /* Consumed by dpcpu.c */
369*49ef7e06SGarrett D'Amore   uint64_t tx0_tags;     /* Bitmap */
370*49ef7e06SGarrett D'Amore   uint64_t tx1_tags;     /* Bitmap */
371*49ef7e06SGarrett D'Amore   uint64_t dl_tags;      /* Bitmap */
372*49ef7e06SGarrett D'Amore   uint32_t flags;
373*49ef7e06SGarrett D'Amore #define TLV_DPCPU_TX_STRIPE (1) /* No longer used, has no effect */
374*49ef7e06SGarrett D'Amore #define TLV_DPCPU_BIU_TAGS  (2) /* Use BIU tag manager */
375*49ef7e06SGarrett D'Amore #define TLV_DPCPU_TX0_TAGS  (4) /* tx0_tags is valid */
376*49ef7e06SGarrett D'Amore #define TLV_DPCPU_TX1_TAGS  (8) /* tx1_tags is valid */
377*49ef7e06SGarrett D'Amore #define TLV_DPCPU_DL_TAGS  (16) /* dl_tags is valid */
378*49ef7e06SGarrett D'Amore   /* Consumed by features.c */
379*49ef7e06SGarrett D'Amore   uint32_t dut_features;        /* All 1s -> leave alone */
380*49ef7e06SGarrett D'Amore   int8_t with_rmon;             /* 0 -> off, 1 -> on, -1 -> leave alone */
381*49ef7e06SGarrett D'Amore   /* Consumed by clocks_hunt.c */
382*49ef7e06SGarrett D'Amore   int8_t clk_mode;             /* 0 -> off, 1 -> on, -1 -> leave alone */
383*49ef7e06SGarrett D'Amore   /* No longer used, superseded by TLV_TAG_DESCRIPTOR_CACHE_CONFIG. */
384*49ef7e06SGarrett D'Amore   int8_t rx_dc_size;           /* -1 -> leave alone */
385*49ef7e06SGarrett D'Amore   int8_t tx_dc_size;
386*49ef7e06SGarrett D'Amore   int16_t num_q_allocs;
387*49ef7e06SGarrett D'Amore };
388*49ef7e06SGarrett D'Amore 
389*49ef7e06SGarrett D'Amore /* Global port configuration
390*49ef7e06SGarrett D'Amore  *
391*49ef7e06SGarrett D'Amore  * This is now deprecated in favour of a platform-provided default
392*49ef7e06SGarrett D'Amore  * and dynamic config override via tlv_global_port_options.
393*49ef7e06SGarrett D'Amore  */
394*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_PORT_CONFIG      (0x000a0000)
395*49ef7e06SGarrett D'Amore 
396*49ef7e06SGarrett D'Amore struct tlv_global_port_config {
397*49ef7e06SGarrett D'Amore   uint32_t tag;
398*49ef7e06SGarrett D'Amore   uint32_t length;
399*49ef7e06SGarrett D'Amore   uint32_t ports_per_core;
400*49ef7e06SGarrett D'Amore   uint32_t max_port_speed;
401*49ef7e06SGarrett D'Amore };
402*49ef7e06SGarrett D'Amore 
403*49ef7e06SGarrett D'Amore 
404*49ef7e06SGarrett D'Amore /* Firmware options.
405*49ef7e06SGarrett D'Amore  *
406*49ef7e06SGarrett D'Amore  * This is intended for user-configurable selection of optional firmware
407*49ef7e06SGarrett D'Amore  * features and variants.
408*49ef7e06SGarrett D'Amore  *
409*49ef7e06SGarrett D'Amore  * Initially, this consists only of the satellite CPU firmware variant
410*49ef7e06SGarrett D'Amore  * selection, but this tag could be extended in the future (using the
411*49ef7e06SGarrett D'Amore  * tag length to determine whether additional fields are present).
412*49ef7e06SGarrett D'Amore  */
413*49ef7e06SGarrett D'Amore 
414*49ef7e06SGarrett D'Amore #define TLV_TAG_FIRMWARE_OPTIONS        (0x100b0000)
415*49ef7e06SGarrett D'Amore 
416*49ef7e06SGarrett D'Amore struct tlv_firmware_options {
417*49ef7e06SGarrett D'Amore   uint32_t tag;
418*49ef7e06SGarrett D'Amore   uint32_t length;
419*49ef7e06SGarrett D'Amore   uint32_t firmware_variant;
420*49ef7e06SGarrett D'Amore #define TLV_FIRMWARE_VARIANT_DRIVER_SELECTED (0xffffffff)
421*49ef7e06SGarrett D'Amore 
422*49ef7e06SGarrett D'Amore /* These are the values for overriding the driver's choice; the definitions
423*49ef7e06SGarrett D'Amore  * are taken from MCDI so that they don't get out of step.  Include
424*49ef7e06SGarrett D'Amore  * <ci/mgmt/mc_driver_pcol.h> or the equivalent from your driver's tree if
425*49ef7e06SGarrett D'Amore  * you need to use these constants.
426*49ef7e06SGarrett D'Amore  */
427*49ef7e06SGarrett D'Amore #define TLV_FIRMWARE_VARIANT_FULL_FEATURED   MC_CMD_FW_FULL_FEATURED
428*49ef7e06SGarrett D'Amore #define TLV_FIRMWARE_VARIANT_LOW_LATENCY     MC_CMD_FW_LOW_LATENCY
429*49ef7e06SGarrett D'Amore #define TLV_FIRMWARE_VARIANT_PACKED_STREAM   MC_CMD_FW_PACKED_STREAM
430*49ef7e06SGarrett D'Amore #define TLV_FIRMWARE_VARIANT_HIGH_TX_RATE    MC_CMD_FW_HIGH_TX_RATE
431*49ef7e06SGarrett D'Amore #define TLV_FIRMWARE_VARIANT_PACKED_STREAM_HASH_MODE_1 \
432*49ef7e06SGarrett D'Amore                                              MC_CMD_FW_PACKED_STREAM_HASH_MODE_1
433*49ef7e06SGarrett D'Amore };
434*49ef7e06SGarrett D'Amore 
435*49ef7e06SGarrett D'Amore /* Voltage settings
436*49ef7e06SGarrett D'Amore  *
437*49ef7e06SGarrett D'Amore  * Intended for boards with A0 silicon where the core voltage may
438*49ef7e06SGarrett D'Amore  * need tweaking. Most likely set once when the pass voltage is
439*49ef7e06SGarrett D'Amore  * determined. */
440*49ef7e06SGarrett D'Amore 
441*49ef7e06SGarrett D'Amore #define TLV_TAG_0V9_SETTINGS (0x000c0000)
442*49ef7e06SGarrett D'Amore 
443*49ef7e06SGarrett D'Amore struct tlv_0v9_settings {
444*49ef7e06SGarrett D'Amore   uint32_t tag;
445*49ef7e06SGarrett D'Amore   uint32_t length;
446*49ef7e06SGarrett D'Amore   uint16_t flags; /* Boards with high 0v9 settings may need active cooling */
447*49ef7e06SGarrett D'Amore #define TLV_TAG_0V9_REQUIRES_FAN (1)
448*49ef7e06SGarrett D'Amore   uint16_t target_voltage; /* In millivolts */
449*49ef7e06SGarrett D'Amore   /* Since the limits are meant to be centred to the target (and must at least
450*49ef7e06SGarrett D'Amore    * contain it) they need setting as well. */
451*49ef7e06SGarrett D'Amore   uint16_t warn_low;       /* In millivolts */
452*49ef7e06SGarrett D'Amore   uint16_t warn_high;      /* In millivolts */
453*49ef7e06SGarrett D'Amore   uint16_t panic_low;      /* In millivolts */
454*49ef7e06SGarrett D'Amore   uint16_t panic_high;     /* In millivolts */
455*49ef7e06SGarrett D'Amore };
456*49ef7e06SGarrett D'Amore 
457*49ef7e06SGarrett D'Amore 
458*49ef7e06SGarrett D'Amore /* Clock configuration */
459*49ef7e06SGarrett D'Amore 
460*49ef7e06SGarrett D'Amore #define TLV_TAG_CLOCK_CONFIG       (0x000d0000) /* legacy symbol - do not use */
461*49ef7e06SGarrett D'Amore #define TLV_TAG_CLOCK_CONFIG_HUNT  TLV_TAG_CLOCK_CONFIG
462*49ef7e06SGarrett D'Amore 
463*49ef7e06SGarrett D'Amore struct tlv_clock_config {
464*49ef7e06SGarrett D'Amore   uint32_t tag;
465*49ef7e06SGarrett D'Amore   uint32_t length;
466*49ef7e06SGarrett D'Amore   uint16_t clk_sys;        /* MHz */
467*49ef7e06SGarrett D'Amore   uint16_t clk_dpcpu;      /* MHz */
468*49ef7e06SGarrett D'Amore   uint16_t clk_icore;      /* MHz */
469*49ef7e06SGarrett D'Amore   uint16_t clk_pcs;        /* MHz */
470*49ef7e06SGarrett D'Amore };
471*49ef7e06SGarrett D'Amore 
472*49ef7e06SGarrett D'Amore #define TLV_TAG_CLOCK_CONFIG_MEDFORD      (0x00100000)
473*49ef7e06SGarrett D'Amore 
474*49ef7e06SGarrett D'Amore struct tlv_clock_config_medford {
475*49ef7e06SGarrett D'Amore   uint32_t tag;
476*49ef7e06SGarrett D'Amore   uint32_t length;
477*49ef7e06SGarrett D'Amore   uint16_t clk_sys;        /* MHz */
478*49ef7e06SGarrett D'Amore   uint16_t clk_mc;         /* MHz */
479*49ef7e06SGarrett D'Amore   uint16_t clk_rmon;       /* MHz */
480*49ef7e06SGarrett D'Amore   uint16_t clk_vswitch;    /* MHz */
481*49ef7e06SGarrett D'Amore   uint16_t clk_dpcpu;      /* MHz */
482*49ef7e06SGarrett D'Amore   uint16_t clk_pcs;        /* MHz */
483*49ef7e06SGarrett D'Amore };
484*49ef7e06SGarrett D'Amore 
485*49ef7e06SGarrett D'Amore 
486*49ef7e06SGarrett D'Amore /* EF10-style global pool of MAC addresses.
487*49ef7e06SGarrett D'Amore  *
488*49ef7e06SGarrett D'Amore  * There are <count> addresses, starting at <base_address>, which are
489*49ef7e06SGarrett D'Amore  * contiguous.  Firmware is responsible for allocating addresses from this
490*49ef7e06SGarrett D'Amore  * pool to ports / PFs as appropriate.
491*49ef7e06SGarrett D'Amore  */
492*49ef7e06SGarrett D'Amore 
493*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_MAC              (0x000e0000)
494*49ef7e06SGarrett D'Amore 
495*49ef7e06SGarrett D'Amore struct tlv_global_mac {
496*49ef7e06SGarrett D'Amore   uint32_t tag;
497*49ef7e06SGarrett D'Amore   uint32_t length;
498*49ef7e06SGarrett D'Amore   uint8_t  base_address[6];
499*49ef7e06SGarrett D'Amore   uint16_t reserved1;
500*49ef7e06SGarrett D'Amore   uint16_t count;
501*49ef7e06SGarrett D'Amore   uint16_t reserved2;
502*49ef7e06SGarrett D'Amore };
503*49ef7e06SGarrett D'Amore 
504*49ef7e06SGarrett D'Amore #define TLV_TAG_ATB_0V9_TARGET     (0x000f0000) /* legacy symbol - do not use */
505*49ef7e06SGarrett D'Amore #define TLV_TAG_ATB_0V9_TARGET_HUNT     TLV_TAG_ATB_0V9_TARGET
506*49ef7e06SGarrett D'Amore 
507*49ef7e06SGarrett D'Amore /* The target value for the 0v9 power rail measured on-chip at the
508*49ef7e06SGarrett D'Amore  * analogue test bus */
509*49ef7e06SGarrett D'Amore struct tlv_0v9_atb_target {
510*49ef7e06SGarrett D'Amore   uint32_t tag;
511*49ef7e06SGarrett D'Amore   uint32_t length;
512*49ef7e06SGarrett D'Amore   uint16_t millivolts;
513*49ef7e06SGarrett D'Amore   uint16_t reserved;
514*49ef7e06SGarrett D'Amore };
515*49ef7e06SGarrett D'Amore 
516*49ef7e06SGarrett D'Amore /* Global PCIe configuration, second revision. This represents the visible PFs
517*49ef7e06SGarrett D'Amore  * by a bitmap rather than having the number of the highest visible one. As such
518*49ef7e06SGarrett D'Amore  * it can (for a 16-PF chip) represent a superset of what TLV_TAG_GLOBAL_PCIE_CONFIG
519*49ef7e06SGarrett D'Amore  * can and it should be used in place of that tag in future (but compatibility with
520*49ef7e06SGarrett D'Amore  * the old tag will be left in the firmware indefinitely).  */
521*49ef7e06SGarrett D'Amore 
522*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_PCIE_CONFIG_R2 (0x10100000)
523*49ef7e06SGarrett D'Amore 
524*49ef7e06SGarrett D'Amore struct tlv_pcie_config_r2 {
525*49ef7e06SGarrett D'Amore   uint32_t tag;
526*49ef7e06SGarrett D'Amore   uint32_t length;
527*49ef7e06SGarrett D'Amore   uint16_t visible_pfs;                         /**< Bitmap of visible PFs */
528*49ef7e06SGarrett D'Amore   uint16_t pf_aper;                             /**< BIU aperture for PF BAR2 */
529*49ef7e06SGarrett D'Amore   uint16_t vf_aper;                             /**< BIU aperture for VF BAR0 */
530*49ef7e06SGarrett D'Amore   uint16_t int_aper;                            /**< BIU aperture for PF BAR4 and VF BAR2 */
531*49ef7e06SGarrett D'Amore };
532*49ef7e06SGarrett D'Amore 
533*49ef7e06SGarrett D'Amore /* Dynamic port mode.
534*49ef7e06SGarrett D'Amore  *
535*49ef7e06SGarrett D'Amore  * Allows selecting alternate port configuration for platforms that support it
536*49ef7e06SGarrett D'Amore  * (e.g. 1x40G vs 2x10G on Milano, 1x40G vs 4x10G on Medford). This affects the
537*49ef7e06SGarrett D'Amore  * number of externally visible ports (and, hence, PF to port mapping), so must
538*49ef7e06SGarrett D'Amore  * be done at boot time.
539*49ef7e06SGarrett D'Amore  *
540*49ef7e06SGarrett D'Amore  * This tag supercedes tlv_global_port_config.
541*49ef7e06SGarrett D'Amore  */
542*49ef7e06SGarrett D'Amore 
543*49ef7e06SGarrett D'Amore #define TLV_TAG_GLOBAL_PORT_MODE         (0x10110000)
544*49ef7e06SGarrett D'Amore 
545*49ef7e06SGarrett D'Amore struct tlv_global_port_mode {
546*49ef7e06SGarrett D'Amore   uint32_t tag;
547*49ef7e06SGarrett D'Amore   uint32_t length;
548*49ef7e06SGarrett D'Amore   uint32_t port_mode;
549*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_DEFAULT           (0xffffffff) /* Default for given platform */
550*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_10G                        (0) /* 10G, single SFP/10G-KR */
551*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_40G                        (1) /* 40G, single QSFP/40G-KR */
552*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_10G_10G                    (2) /* 2x10G, dual SFP/10G-KR or single QSFP */
553*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_40G_40G                    (3) /* 40G + 40G, dual QSFP/40G-KR (Greenport, Medford) */
554*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_10G_10G_10G_10G            (4) /* 2x10G + 2x10G, quad SFP/10G-KR or dual QSFP (Greenport, Medford) */
555*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_10G_10G_10G_10G_Q          (5) /* 4x10G, single QSFP, cage 0 (Medford) */
556*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_40G_10G_10G                (6) /* 1x40G + 2x10G, dual QSFP (Greenport, Medford) */
557*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_10G_10G_40G                (7) /* 2x10G + 1x40G, dual QSFP (Greenport, Medford) */
558*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_10G_10G_10G_10G_Q2         (8) /* 4x10G, single QSFP, cage 1 (Medford) */
559*49ef7e06SGarrett D'Amore #define TLV_PORT_MODE_MAX TLV_PORT_MODE_10G_10G_10G_10G_Q2
560*49ef7e06SGarrett D'Amore };
561*49ef7e06SGarrett D'Amore 
562*49ef7e06SGarrett D'Amore /* Type of the v-switch created implicitly by the firmware */
563*49ef7e06SGarrett D'Amore 
564*49ef7e06SGarrett D'Amore #define TLV_TAG_VSWITCH_TYPE(port)       (0x10120000 + (port))
565*49ef7e06SGarrett D'Amore 
566*49ef7e06SGarrett D'Amore struct tlv_vswitch_type {
567*49ef7e06SGarrett D'Amore   uint32_t tag;
568*49ef7e06SGarrett D'Amore   uint32_t length;
569*49ef7e06SGarrett D'Amore   uint32_t vswitch_type;
570*49ef7e06SGarrett D'Amore #define TLV_VSWITCH_TYPE_DEFAULT        (0xffffffff) /* Firmware default; equivalent to no TLV present for a given port */
571*49ef7e06SGarrett D'Amore #define TLV_VSWITCH_TYPE_NONE                    (0)
572*49ef7e06SGarrett D'Amore #define TLV_VSWITCH_TYPE_VLAN                    (1)
573*49ef7e06SGarrett D'Amore #define TLV_VSWITCH_TYPE_VEB                     (2)
574*49ef7e06SGarrett D'Amore #define TLV_VSWITCH_TYPE_VEPA                    (3)
575*49ef7e06SGarrett D'Amore #define TLV_VSWITCH_TYPE_MUX                     (4)
576*49ef7e06SGarrett D'Amore #define TLV_VSWITCH_TYPE_TEST                    (5)
577*49ef7e06SGarrett D'Amore };
578*49ef7e06SGarrett D'Amore 
579*49ef7e06SGarrett D'Amore /* A VLAN tag for the v-port created implicitly by the firmware */
580*49ef7e06SGarrett D'Amore 
581*49ef7e06SGarrett D'Amore #define TLV_TAG_VPORT_VLAN_TAG(pf)               (0x10130000 + (pf))
582*49ef7e06SGarrett D'Amore 
583*49ef7e06SGarrett D'Amore struct tlv_vport_vlan_tag {
584*49ef7e06SGarrett D'Amore   uint32_t tag;
585*49ef7e06SGarrett D'Amore   uint32_t length;
586*49ef7e06SGarrett D'Amore   uint32_t vlan_tag;
587*49ef7e06SGarrett D'Amore #define TLV_VPORT_NO_VLAN_TAG                    (0xFFFFFFFF) /* Default in the absence of TLV for a given PF */
588*49ef7e06SGarrett D'Amore };
589*49ef7e06SGarrett D'Amore 
590*49ef7e06SGarrett D'Amore /* Offset to be applied to the 0v9 setting, wherever it came from */
591*49ef7e06SGarrett D'Amore 
592*49ef7e06SGarrett D'Amore #define TLV_TAG_ATB_0V9_OFFSET           (0x10140000)
593*49ef7e06SGarrett D'Amore 
594*49ef7e06SGarrett D'Amore struct tlv_0v9_atb_offset {
595*49ef7e06SGarrett D'Amore   uint32_t tag;
596*49ef7e06SGarrett D'Amore   uint32_t length;
597*49ef7e06SGarrett D'Amore   int16_t  offset_millivolts;
598*49ef7e06SGarrett D'Amore   uint16_t reserved;
599*49ef7e06SGarrett D'Amore };
600*49ef7e06SGarrett D'Amore 
601*49ef7e06SGarrett D'Amore /* A privilege mask given on reset to all non-admin PCIe functions (that is other than first-PF-per-port).
602*49ef7e06SGarrett D'Amore  * The meaning of particular bits is defined in mcdi_ef10.yml under MC_CMD_PRIVILEGE_MASK, see also bug 44583.
603*49ef7e06SGarrett D'Amore  * TLV_TAG_PRIVILEGE_MASK_ADD specifies bits that should be added (ORed) to firmware default while
604*49ef7e06SGarrett D'Amore  * TLV_TAG_PRIVILEGE_MASK_REM specifies bits that should be removed (ANDed) from firmware default:
605*49ef7e06SGarrett D'Amore  * Initial_privilege_mask = (firmware_default_mask | privilege_mask_add) & ~privilege_mask_rem */
606*49ef7e06SGarrett D'Amore 
607*49ef7e06SGarrett D'Amore #define TLV_TAG_PRIVILEGE_MASK          (0x10150000) /* legacy symbol - do not use */
608*49ef7e06SGarrett D'Amore 
609*49ef7e06SGarrett D'Amore struct tlv_privilege_mask {                          /* legacy structure - do not use */
610*49ef7e06SGarrett D'Amore   uint32_t tag;
611*49ef7e06SGarrett D'Amore   uint32_t length;
612*49ef7e06SGarrett D'Amore   uint32_t privilege_mask;
613*49ef7e06SGarrett D'Amore };
614*49ef7e06SGarrett D'Amore 
615*49ef7e06SGarrett D'Amore #define TLV_TAG_PRIVILEGE_MASK_ADD      (0x10150000)
616*49ef7e06SGarrett D'Amore 
617*49ef7e06SGarrett D'Amore struct tlv_privilege_mask_add {
618*49ef7e06SGarrett D'Amore   uint32_t tag;
619*49ef7e06SGarrett D'Amore   uint32_t length;
620*49ef7e06SGarrett D'Amore   uint32_t privilege_mask_add;
621*49ef7e06SGarrett D'Amore };
622*49ef7e06SGarrett D'Amore 
623*49ef7e06SGarrett D'Amore #define TLV_TAG_PRIVILEGE_MASK_REM      (0x10160000)
624*49ef7e06SGarrett D'Amore 
625*49ef7e06SGarrett D'Amore struct tlv_privilege_mask_rem {
626*49ef7e06SGarrett D'Amore   uint32_t tag;
627*49ef7e06SGarrett D'Amore   uint32_t length;
628*49ef7e06SGarrett D'Amore   uint32_t privilege_mask_rem;
629*49ef7e06SGarrett D'Amore };
630*49ef7e06SGarrett D'Amore 
631*49ef7e06SGarrett D'Amore /* Additional privileges given to all PFs.
632*49ef7e06SGarrett D'Amore  * This tag takes precedence over TLV_TAG_PRIVILEGE_MASK_REM. */
633*49ef7e06SGarrett D'Amore 
634*49ef7e06SGarrett D'Amore #define TLV_TAG_PRIVILEGE_MASK_ADD_ALL_PFS         (0x10190000)
635*49ef7e06SGarrett D'Amore 
636*49ef7e06SGarrett D'Amore struct tlv_privilege_mask_add_all_pfs {
637*49ef7e06SGarrett D'Amore   uint32_t tag;
638*49ef7e06SGarrett D'Amore   uint32_t length;
639*49ef7e06SGarrett D'Amore   uint32_t privilege_mask_add;
640*49ef7e06SGarrett D'Amore };
641*49ef7e06SGarrett D'Amore 
642*49ef7e06SGarrett D'Amore /* Additional privileges given to a selected PF.
643*49ef7e06SGarrett D'Amore  * This tag takes precedence over TLV_TAG_PRIVILEGE_MASK_REM. */
644*49ef7e06SGarrett D'Amore 
645*49ef7e06SGarrett D'Amore #define TLV_TAG_PRIVILEGE_MASK_ADD_SINGLE_PF(pf)   (0x101A0000 + (pf))
646*49ef7e06SGarrett D'Amore 
647*49ef7e06SGarrett D'Amore struct tlv_privilege_mask_add_single_pf {
648*49ef7e06SGarrett D'Amore   uint32_t tag;
649*49ef7e06SGarrett D'Amore   uint32_t length;
650*49ef7e06SGarrett D'Amore   uint32_t privilege_mask_add;
651*49ef7e06SGarrett D'Amore };
652*49ef7e06SGarrett D'Amore 
653*49ef7e06SGarrett D'Amore /* Turning on/off the PFIOV mode.
654*49ef7e06SGarrett D'Amore  * This tag only takes effect if TLV_TAG_VSWITCH_TYPE is missing or set to DEFAULT. */
655*49ef7e06SGarrett D'Amore 
656*49ef7e06SGarrett D'Amore #define TLV_TAG_PFIOV(port)             (0x10170000 + (port))
657*49ef7e06SGarrett D'Amore 
658*49ef7e06SGarrett D'Amore struct tlv_pfiov {
659*49ef7e06SGarrett D'Amore   uint32_t tag;
660*49ef7e06SGarrett D'Amore   uint32_t length;
661*49ef7e06SGarrett D'Amore   uint32_t pfiov;
662*49ef7e06SGarrett D'Amore #define TLV_PFIOV_OFF                    (0) /* Default */
663*49ef7e06SGarrett D'Amore #define TLV_PFIOV_ON                     (1)
664*49ef7e06SGarrett D'Amore };
665*49ef7e06SGarrett D'Amore 
666*49ef7e06SGarrett D'Amore /* Multicast filter chaining mode selection.
667*49ef7e06SGarrett D'Amore  *
668*49ef7e06SGarrett D'Amore  * When enabled, multicast packets are delivered to all recipients of all
669*49ef7e06SGarrett D'Amore  * matching multicast filters, with the exception that IP multicast filters
670*49ef7e06SGarrett D'Amore  * will steal traffic from MAC multicast filters on a per-function basis.
671*49ef7e06SGarrett D'Amore  * (New behaviour.)
672*49ef7e06SGarrett D'Amore  *
673*49ef7e06SGarrett D'Amore  * When disabled, multicast packets will always be delivered only to the
674*49ef7e06SGarrett D'Amore  * recipients of the highest priority matching multicast filter.
675*49ef7e06SGarrett D'Amore  * (Legacy behaviour.)
676*49ef7e06SGarrett D'Amore  *
677*49ef7e06SGarrett D'Amore  * The DEFAULT mode (which is the same as the tag not being present at all)
678*49ef7e06SGarrett D'Amore  * is equivalent to ENABLED in production builds, and DISABLED in eftest
679*49ef7e06SGarrett D'Amore  * builds.
680*49ef7e06SGarrett D'Amore  *
681*49ef7e06SGarrett D'Amore  * This option is intended to provide run-time control over this feature
682*49ef7e06SGarrett D'Amore  * while it is being stabilised and may be withdrawn at some point in the
683*49ef7e06SGarrett D'Amore  * future; the new behaviour is intended to become the standard behaviour.
684*49ef7e06SGarrett D'Amore  */
685*49ef7e06SGarrett D'Amore 
686*49ef7e06SGarrett D'Amore #define TLV_TAG_MCAST_FILTER_CHAINING   (0x10180000)
687*49ef7e06SGarrett D'Amore 
688*49ef7e06SGarrett D'Amore struct tlv_mcast_filter_chaining {
689*49ef7e06SGarrett D'Amore   uint32_t tag;
690*49ef7e06SGarrett D'Amore   uint32_t length;
691*49ef7e06SGarrett D'Amore   uint32_t mode;
692*49ef7e06SGarrett D'Amore #define TLV_MCAST_FILTER_CHAINING_DEFAULT  (0xffffffff)
693*49ef7e06SGarrett D'Amore #define TLV_MCAST_FILTER_CHAINING_DISABLED (0)
694*49ef7e06SGarrett D'Amore #define TLV_MCAST_FILTER_CHAINING_ENABLED  (1)
695*49ef7e06SGarrett D'Amore };
696*49ef7e06SGarrett D'Amore 
697*49ef7e06SGarrett D'Amore /* Pacer rate limit per PF */
698*49ef7e06SGarrett D'Amore #define TLV_TAG_RATE_LIMIT(pf)    (0x101b0000 + (pf))
699*49ef7e06SGarrett D'Amore 
700*49ef7e06SGarrett D'Amore struct tlv_rate_limit {
701*49ef7e06SGarrett D'Amore   uint32_t tag;
702*49ef7e06SGarrett D'Amore   uint32_t length;
703*49ef7e06SGarrett D'Amore   uint32_t rate_mbps;
704*49ef7e06SGarrett D'Amore };
705*49ef7e06SGarrett D'Amore 
706*49ef7e06SGarrett D'Amore /* OCSD Enable/Disable
707*49ef7e06SGarrett D'Amore  *
708*49ef7e06SGarrett D'Amore  * This setting allows OCSD to be disabled. This is a requirement for HP
709*49ef7e06SGarrett D'Amore  * servers to support PCI passthrough for virtualization.
710*49ef7e06SGarrett D'Amore  *
711*49ef7e06SGarrett D'Amore  * The DEFAULT mode (which is the same as the tag not being present) is
712*49ef7e06SGarrett D'Amore  * equivalent to ENABLED.
713*49ef7e06SGarrett D'Amore  *
714*49ef7e06SGarrett D'Amore  * This option is not used by the MCFW, and is entirely handled by the various
715*49ef7e06SGarrett D'Amore  * drivers that support OCSD, by reading the setting before they attempt
716*49ef7e06SGarrett D'Amore  * to enable OCSD.
717*49ef7e06SGarrett D'Amore  *
718*49ef7e06SGarrett D'Amore  * bit0: OCSD Disabled/Enabled
719*49ef7e06SGarrett D'Amore  */
720*49ef7e06SGarrett D'Amore 
721*49ef7e06SGarrett D'Amore #define TLV_TAG_OCSD (0x101C0000)
722*49ef7e06SGarrett D'Amore 
723*49ef7e06SGarrett D'Amore struct tlv_ocsd {
724*49ef7e06SGarrett D'Amore   uint32_t tag;
725*49ef7e06SGarrett D'Amore   uint32_t length;
726*49ef7e06SGarrett D'Amore   uint32_t mode;
727*49ef7e06SGarrett D'Amore #define TLV_OCSD_DISABLED 0
728*49ef7e06SGarrett D'Amore #define TLV_OCSD_ENABLED 1 /* Default */
729*49ef7e06SGarrett D'Amore };
730*49ef7e06SGarrett D'Amore 
731*49ef7e06SGarrett D'Amore /* Descriptor cache config.
732*49ef7e06SGarrett D'Amore  *
733*49ef7e06SGarrett D'Amore  * Sets the sizes of the TX and RX descriptor caches as a power of 2. It also
734*49ef7e06SGarrett D'Amore  * sets the total number of VIs. When the number of VIs is reduced VIs are taken
735*49ef7e06SGarrett D'Amore  * away from the highest numbered port first, so a vi_count of 1024 means 1024
736*49ef7e06SGarrett D'Amore  * VIs on the first port and 0 on the second (on a Torino).
737*49ef7e06SGarrett D'Amore  */
738*49ef7e06SGarrett D'Amore 
739*49ef7e06SGarrett D'Amore #define TLV_TAG_DESCRIPTOR_CACHE_CONFIG    (0x101d0000)
740*49ef7e06SGarrett D'Amore 
741*49ef7e06SGarrett D'Amore struct tlv_descriptor_cache_config {
742*49ef7e06SGarrett D'Amore   uint32_t tag;
743*49ef7e06SGarrett D'Amore   uint32_t length;
744*49ef7e06SGarrett D'Amore   uint8_t rx_desc_cache_size;
745*49ef7e06SGarrett D'Amore   uint8_t tx_desc_cache_size;
746*49ef7e06SGarrett D'Amore   uint16_t vi_count;
747*49ef7e06SGarrett D'Amore };
748*49ef7e06SGarrett D'Amore #define TLV_DESC_CACHE_DEFAULT (0xff)
749*49ef7e06SGarrett D'Amore #define TLV_VI_COUNT_DEFAULT   (0xffff)
750*49ef7e06SGarrett D'Amore 
751*49ef7e06SGarrett D'Amore /* RX event merging config (read batching).
752*49ef7e06SGarrett D'Amore  *
753*49ef7e06SGarrett D'Amore  * Sets the global maximum number of events for the merging bins, and the
754*49ef7e06SGarrett D'Amore  * global timeout configuration for the bins.
755*49ef7e06SGarrett D'Amore  */
756*49ef7e06SGarrett D'Amore 
757*49ef7e06SGarrett D'Amore #define TLV_TAG_RX_EVENT_MERGING_CONFIG    (0x101e0000)
758*49ef7e06SGarrett D'Amore 
759*49ef7e06SGarrett D'Amore struct tlv_rx_event_merging_config {
760*49ef7e06SGarrett D'Amore   uint32_t  tag;
761*49ef7e06SGarrett D'Amore   uint32_t  length;
762*49ef7e06SGarrett D'Amore   uint32_t  max_events;
763*49ef7e06SGarrett D'Amore #define TLV_RX_EVENT_MERGING_CONFIG_MAX_EVENTS_MAX ((1 << 4) - 1)
764*49ef7e06SGarrett D'Amore   uint32_t  timeout_ns;
765*49ef7e06SGarrett D'Amore };
766*49ef7e06SGarrett D'Amore #define TLV_RX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7
767*49ef7e06SGarrett D'Amore #define TLV_RX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 8740
768*49ef7e06SGarrett D'Amore 
769*49ef7e06SGarrett D'Amore #define TLV_TAG_PCIE_LINK_SETTINGS (0x101f0000)
770*49ef7e06SGarrett D'Amore struct tlv_pcie_link_settings {
771*49ef7e06SGarrett D'Amore   uint32_t tag;
772*49ef7e06SGarrett D'Amore   uint32_t length;
773*49ef7e06SGarrett D'Amore   uint16_t gen;   /* Target PCIe generation: 1, 2, 3 */
774*49ef7e06SGarrett D'Amore   uint16_t width; /* Number of lanes */
775*49ef7e06SGarrett D'Amore };
776*49ef7e06SGarrett D'Amore 
777*49ef7e06SGarrett D'Amore #define TLV_TAG_LICENSE (0x30800000)
778*49ef7e06SGarrett D'Amore 
779*49ef7e06SGarrett D'Amore typedef struct tlv_license {
780*49ef7e06SGarrett D'Amore   uint32_t  tag;
781*49ef7e06SGarrett D'Amore   uint32_t  length;
782*49ef7e06SGarrett D'Amore   uint8_t   data[];
783*49ef7e06SGarrett D'Amore } tlv_license_t;
784*49ef7e06SGarrett D'Amore 
785*49ef7e06SGarrett D'Amore #endif /* CI_MGMT_TLV_LAYOUT_H */
786