xref: /freebsd/sys/dev/sfxge/common/ef10_tlv_layout.h (revision 88cbf0f746d6c640abde8b4b496eb5d019ddab8a)
13c838a9fSAndrew Rybchenko /*-
23c838a9fSAndrew Rybchenko  * Copyright (c) 2012-2015 Solarflare Communications Inc.
33c838a9fSAndrew Rybchenko  * All rights reserved.
43c838a9fSAndrew Rybchenko  *
53c838a9fSAndrew Rybchenko  * Redistribution and use in source and binary forms, with or without
63c838a9fSAndrew Rybchenko  * modification, are permitted provided that the following conditions are met:
73c838a9fSAndrew Rybchenko  *
83c838a9fSAndrew Rybchenko  * 1. Redistributions of source code must retain the above copyright notice,
93c838a9fSAndrew Rybchenko  *    this list of conditions and the following disclaimer.
103c838a9fSAndrew Rybchenko  * 2. Redistributions in binary form must reproduce the above copyright notice,
113c838a9fSAndrew Rybchenko  *    this list of conditions and the following disclaimer in the documentation
123c838a9fSAndrew Rybchenko  *    and/or other materials provided with the distribution.
133c838a9fSAndrew Rybchenko  *
143c838a9fSAndrew Rybchenko  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
153c838a9fSAndrew Rybchenko  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
163c838a9fSAndrew Rybchenko  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
173c838a9fSAndrew Rybchenko  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
183c838a9fSAndrew Rybchenko  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
193c838a9fSAndrew Rybchenko  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
203c838a9fSAndrew Rybchenko  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
213c838a9fSAndrew Rybchenko  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
223c838a9fSAndrew Rybchenko  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
233c838a9fSAndrew Rybchenko  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
243c838a9fSAndrew Rybchenko  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
253c838a9fSAndrew Rybchenko  *
263c838a9fSAndrew Rybchenko  * The views and conclusions contained in the software and documentation are
273c838a9fSAndrew Rybchenko  * those of the authors and should not be interpreted as representing official
283c838a9fSAndrew Rybchenko  * policies, either expressed or implied, of the FreeBSD Project.
293c838a9fSAndrew Rybchenko  *
303c838a9fSAndrew Rybchenko  * $FreeBSD$
313c838a9fSAndrew Rybchenko  */
323c838a9fSAndrew Rybchenko 
333c838a9fSAndrew Rybchenko /* These structures define the layouts for the TLV items stored in static and
343c838a9fSAndrew Rybchenko  * dynamic configuration partitions in NVRAM for EF10 (Huntington etc.).
353c838a9fSAndrew Rybchenko  *
363c838a9fSAndrew Rybchenko  * They contain the same sort of information that was kept in the
373c838a9fSAndrew Rybchenko  * siena_mc_static_config_hdr_t and siena_mc_dynamic_config_hdr_t structures
383c838a9fSAndrew Rybchenko  * (defined in <ci/mgmt/mc_flash_layout.h> and <ci/mgmt/mc_dynamic_cfg.h>) for
393c838a9fSAndrew Rybchenko  * Siena.
403c838a9fSAndrew Rybchenko  *
413c838a9fSAndrew Rybchenko  * These are used directly by the MC and should also be usable directly on host
423c838a9fSAndrew Rybchenko  * systems which are little-endian and do not do strange things with structure
433c838a9fSAndrew Rybchenko  * padding.  (Big-endian host systems will require some byte-swapping.)
443c838a9fSAndrew Rybchenko  *
453c838a9fSAndrew Rybchenko  *                                    -----
463c838a9fSAndrew Rybchenko  *
473c838a9fSAndrew Rybchenko  * Please refer to SF-108797-SW for a general overview of the TLV partition
483c838a9fSAndrew Rybchenko  * format.
493c838a9fSAndrew Rybchenko  *
503c838a9fSAndrew Rybchenko  *                                    -----
513c838a9fSAndrew Rybchenko  *
523c838a9fSAndrew Rybchenko  * The current tag IDs have a general structure: with the exception of the
533c838a9fSAndrew Rybchenko  * special values defined in the document, they are of the form 0xLTTTNNNN,
543c838a9fSAndrew Rybchenko  * where:
553c838a9fSAndrew Rybchenko  *
563c838a9fSAndrew Rybchenko  *   -  L is a location, indicating where this tag is expected to be found:
573c838a9fSAndrew Rybchenko  *      0 for static configuration, or 1 for dynamic configuration.   Other
583c838a9fSAndrew Rybchenko  *      values are reserved.
593c838a9fSAndrew Rybchenko  *
603c838a9fSAndrew Rybchenko  *   -  TTT is a type, which is just a unique value.  The same type value
613c838a9fSAndrew Rybchenko  *      might appear in both locations, indicating a relationship between
623c838a9fSAndrew Rybchenko  *      the items (e.g. static and dynamic VPD below).
633c838a9fSAndrew Rybchenko  *
643c838a9fSAndrew Rybchenko  *   -  NNNN is an index of some form.  Some item types are per-port, some
653c838a9fSAndrew Rybchenko  *      are per-PF, some are per-partition-type.
663c838a9fSAndrew Rybchenko  *
673c838a9fSAndrew Rybchenko  *                                    -----
683c838a9fSAndrew Rybchenko  *
693c838a9fSAndrew Rybchenko  * As with the previous Siena structures, each structure here is laid out
703c838a9fSAndrew Rybchenko  * carefully: values are aligned to their natural boundary, with explicit
713c838a9fSAndrew Rybchenko  * padding fields added where necessary.  (No, technically this does not
723c838a9fSAndrew Rybchenko  * absolutely guarantee portability.  But, in practice, compilers are generally
733c838a9fSAndrew Rybchenko  * sensible enough not to introduce completely pointless padding, and it works
743c838a9fSAndrew Rybchenko  * well enough.)
753c838a9fSAndrew Rybchenko  */
763c838a9fSAndrew Rybchenko 
773c838a9fSAndrew Rybchenko 
783c838a9fSAndrew Rybchenko #ifndef CI_MGMT_TLV_LAYOUT_H
793c838a9fSAndrew Rybchenko #define CI_MGMT_TLV_LAYOUT_H
803c838a9fSAndrew Rybchenko 
813c838a9fSAndrew Rybchenko 
823c838a9fSAndrew Rybchenko /* ----------------------------------------------------------------------------
833c838a9fSAndrew Rybchenko  *  General structure (defined by SF-108797-SW)
843c838a9fSAndrew Rybchenko  * ----------------------------------------------------------------------------
853c838a9fSAndrew Rybchenko  */
863c838a9fSAndrew Rybchenko 
873c838a9fSAndrew Rybchenko 
883c838a9fSAndrew Rybchenko /* The "end" tag.
893c838a9fSAndrew Rybchenko  *
903c838a9fSAndrew Rybchenko  * (Note that this is *not* followed by length or value fields: anything after
913c838a9fSAndrew Rybchenko  * the tag itself is irrelevant.)
923c838a9fSAndrew Rybchenko  */
933c838a9fSAndrew Rybchenko 
943c838a9fSAndrew Rybchenko #define TLV_TAG_END                     (0xEEEEEEEE)
953c838a9fSAndrew Rybchenko 
963c838a9fSAndrew Rybchenko 
973c838a9fSAndrew Rybchenko /* Other special reserved tag values.
983c838a9fSAndrew Rybchenko  */
993c838a9fSAndrew Rybchenko 
1003c838a9fSAndrew Rybchenko #define TLV_TAG_SKIP                    (0x00000000)
1013c838a9fSAndrew Rybchenko #define TLV_TAG_INVALID                 (0xFFFFFFFF)
1023c838a9fSAndrew Rybchenko 
1033c838a9fSAndrew Rybchenko 
1043c838a9fSAndrew Rybchenko /* TLV partition header.
1053c838a9fSAndrew Rybchenko  *
1063c838a9fSAndrew Rybchenko  * In a TLV partition, this must be the first item in the sequence, at offset
1073c838a9fSAndrew Rybchenko  * 0.
1083c838a9fSAndrew Rybchenko  */
1093c838a9fSAndrew Rybchenko 
1103c838a9fSAndrew Rybchenko #define TLV_TAG_PARTITION_HEADER        (0xEF10DA7A)
1113c838a9fSAndrew Rybchenko 
1123c838a9fSAndrew Rybchenko struct tlv_partition_header {
1133c838a9fSAndrew Rybchenko   uint32_t tag;
1143c838a9fSAndrew Rybchenko   uint32_t length;
1153c838a9fSAndrew Rybchenko   uint16_t type_id;
1163c838a9fSAndrew Rybchenko   uint16_t reserved;
1173c838a9fSAndrew Rybchenko   uint32_t generation;
1183c838a9fSAndrew Rybchenko   uint32_t total_length;
1193c838a9fSAndrew Rybchenko };
1203c838a9fSAndrew Rybchenko 
1213c838a9fSAndrew Rybchenko 
1223c838a9fSAndrew Rybchenko /* TLV partition trailer.
1233c838a9fSAndrew Rybchenko  *
1243c838a9fSAndrew Rybchenko  * In a TLV partition, this must be the last item in the sequence, immediately
1253c838a9fSAndrew Rybchenko  * preceding the TLV_TAG_END word.
1263c838a9fSAndrew Rybchenko  */
1273c838a9fSAndrew Rybchenko 
1283c838a9fSAndrew Rybchenko #define TLV_TAG_PARTITION_TRAILER       (0xEF101A57)
1293c838a9fSAndrew Rybchenko 
1303c838a9fSAndrew Rybchenko struct tlv_partition_trailer {
1313c838a9fSAndrew Rybchenko   uint32_t tag;
1323c838a9fSAndrew Rybchenko   uint32_t length;
1333c838a9fSAndrew Rybchenko   uint32_t generation;
1343c838a9fSAndrew Rybchenko   uint32_t checksum;
1353c838a9fSAndrew Rybchenko };
1363c838a9fSAndrew Rybchenko 
1373c838a9fSAndrew Rybchenko 
1383c838a9fSAndrew Rybchenko /* Appendable TLV partition header.
1393c838a9fSAndrew Rybchenko  *
1403c838a9fSAndrew Rybchenko  * In an appendable TLV partition, this must be the first item in the sequence,
1413c838a9fSAndrew Rybchenko  * at offset 0.  (Note that, unlike the configuration partitions, there is no
1423c838a9fSAndrew Rybchenko  * trailer before the TLV_TAG_END word.)
1433c838a9fSAndrew Rybchenko  */
1443c838a9fSAndrew Rybchenko 
1453c838a9fSAndrew Rybchenko #define TLV_TAG_APPENDABLE_PARTITION_HEADER (0xEF10ADA7)
1463c838a9fSAndrew Rybchenko 
1473c838a9fSAndrew Rybchenko struct tlv_appendable_partition_header {
1483c838a9fSAndrew Rybchenko   uint32_t tag;
1493c838a9fSAndrew Rybchenko   uint32_t length;
1503c838a9fSAndrew Rybchenko   uint16_t type_id;
1513c838a9fSAndrew Rybchenko   uint16_t reserved;
1523c838a9fSAndrew Rybchenko };
1533c838a9fSAndrew Rybchenko 
1543c838a9fSAndrew Rybchenko 
1553c838a9fSAndrew Rybchenko /* ----------------------------------------------------------------------------
1563c838a9fSAndrew Rybchenko  *  Configuration items
1573c838a9fSAndrew Rybchenko  * ----------------------------------------------------------------------------
1583c838a9fSAndrew Rybchenko  */
1593c838a9fSAndrew Rybchenko 
1603c838a9fSAndrew Rybchenko 
1613c838a9fSAndrew Rybchenko /* NIC global capabilities.
1623c838a9fSAndrew Rybchenko  */
1633c838a9fSAndrew Rybchenko 
1643c838a9fSAndrew Rybchenko #define TLV_TAG_GLOBAL_CAPABILITIES     (0x00010000)
1653c838a9fSAndrew Rybchenko 
1663c838a9fSAndrew Rybchenko struct tlv_global_capabilities {
1673c838a9fSAndrew Rybchenko   uint32_t tag;
1683c838a9fSAndrew Rybchenko   uint32_t length;
1693c838a9fSAndrew Rybchenko   uint32_t flags;
1703c838a9fSAndrew Rybchenko };
1713c838a9fSAndrew Rybchenko 
1723c838a9fSAndrew Rybchenko 
1733c838a9fSAndrew Rybchenko /* Siena-style per-port MAC address allocation.
1743c838a9fSAndrew Rybchenko  *
1753c838a9fSAndrew Rybchenko  * There are <count> addresses, starting at <base_address> and incrementing
1763c838a9fSAndrew Rybchenko  * by adding <stride> to the low-order byte(s).
1773c838a9fSAndrew Rybchenko  *
1783c838a9fSAndrew Rybchenko  * (See also TLV_TAG_GLOBAL_MAC for an alternative, specifying a global pool
1793c838a9fSAndrew Rybchenko  * of contiguous MAC addresses for the firmware to allocate as it sees fit.)
1803c838a9fSAndrew Rybchenko  */
1813c838a9fSAndrew Rybchenko 
1823c838a9fSAndrew Rybchenko #define TLV_TAG_PORT_MAC(port)          (0x00020000 + (port))
1833c838a9fSAndrew Rybchenko 
1843c838a9fSAndrew Rybchenko struct tlv_port_mac {
1853c838a9fSAndrew Rybchenko   uint32_t tag;
1863c838a9fSAndrew Rybchenko   uint32_t length;
1873c838a9fSAndrew Rybchenko   uint8_t  base_address[6];
1883c838a9fSAndrew Rybchenko   uint16_t reserved;
1893c838a9fSAndrew Rybchenko   uint16_t count;
1903c838a9fSAndrew Rybchenko   uint16_t stride;
1913c838a9fSAndrew Rybchenko };
1923c838a9fSAndrew Rybchenko 
1933c838a9fSAndrew Rybchenko 
1943c838a9fSAndrew Rybchenko /* Static VPD.
1953c838a9fSAndrew Rybchenko  *
1963c838a9fSAndrew Rybchenko  * This is the portion of VPD which is set at manufacturing time and not
1974d982a25SAndrew Rybchenko  * expected to change.  It is formatted as a standard PCI VPD block. There are
1984d982a25SAndrew Rybchenko  * global and per-pf TLVs for this, the global TLV is new for Medford and is
1994d982a25SAndrew Rybchenko  * used in preference to the per-pf TLV.
2003c838a9fSAndrew Rybchenko  */
2013c838a9fSAndrew Rybchenko 
2023c838a9fSAndrew Rybchenko #define TLV_TAG_PF_STATIC_VPD(pf)       (0x00030000 + (pf))
2033c838a9fSAndrew Rybchenko 
2043c838a9fSAndrew Rybchenko struct tlv_pf_static_vpd {
2053c838a9fSAndrew Rybchenko   uint32_t tag;
2063c838a9fSAndrew Rybchenko   uint32_t length;
2073c838a9fSAndrew Rybchenko   uint8_t  bytes[];
2083c838a9fSAndrew Rybchenko };
2093c838a9fSAndrew Rybchenko 
2104d982a25SAndrew Rybchenko #define TLV_TAG_GLOBAL_STATIC_VPD       (0x001f0000)
2114d982a25SAndrew Rybchenko 
2124d982a25SAndrew Rybchenko struct tlv_global_static_vpd {
2134d982a25SAndrew Rybchenko   uint32_t tag;
2144d982a25SAndrew Rybchenko   uint32_t length;
2154d982a25SAndrew Rybchenko   uint8_t  bytes[];
2164d982a25SAndrew Rybchenko };
2174d982a25SAndrew Rybchenko 
2183c838a9fSAndrew Rybchenko 
2193c838a9fSAndrew Rybchenko /* Dynamic VPD.
2203c838a9fSAndrew Rybchenko  *
2213c838a9fSAndrew Rybchenko  * This is the portion of VPD which may be changed (e.g. by firmware updates).
2224d982a25SAndrew Rybchenko  * It is formatted as a standard PCI VPD block. There are global and per-pf TLVs
2234d982a25SAndrew Rybchenko  * for this, the global TLV is new for Medford and is used in preference to the
2244d982a25SAndrew Rybchenko  * per-pf TLV.
2253c838a9fSAndrew Rybchenko  */
2263c838a9fSAndrew Rybchenko 
2273c838a9fSAndrew Rybchenko #define TLV_TAG_PF_DYNAMIC_VPD(pf)      (0x10030000 + (pf))
2283c838a9fSAndrew Rybchenko 
2293c838a9fSAndrew Rybchenko struct tlv_pf_dynamic_vpd {
2303c838a9fSAndrew Rybchenko   uint32_t tag;
2313c838a9fSAndrew Rybchenko   uint32_t length;
2323c838a9fSAndrew Rybchenko   uint8_t  bytes[];
2333c838a9fSAndrew Rybchenko };
2343c838a9fSAndrew Rybchenko 
2354d982a25SAndrew Rybchenko #define TLV_TAG_GLOBAL_DYNAMIC_VPD      (0x10200000)
2364d982a25SAndrew Rybchenko 
2374d982a25SAndrew Rybchenko struct tlv_global_dynamic_vpd {
2384d982a25SAndrew Rybchenko   uint32_t tag;
2394d982a25SAndrew Rybchenko   uint32_t length;
2404d982a25SAndrew Rybchenko   uint8_t  bytes[];
2414d982a25SAndrew Rybchenko };
2424d982a25SAndrew Rybchenko 
2433c838a9fSAndrew Rybchenko 
2443c838a9fSAndrew Rybchenko /* "DBI" PCI config space changes.
2453c838a9fSAndrew Rybchenko  *
2463c838a9fSAndrew Rybchenko  * This is a set of edits made to the default PCI config space values before
2474d982a25SAndrew Rybchenko  * the device is allowed to enumerate. There are global and per-pf TLVs for
2484d982a25SAndrew Rybchenko  * this, the global TLV is new for Medford and is used in preference to the
2494d982a25SAndrew Rybchenko  * per-pf TLV.
2503c838a9fSAndrew Rybchenko  */
2513c838a9fSAndrew Rybchenko 
2523c838a9fSAndrew Rybchenko #define TLV_TAG_PF_DBI(pf)              (0x00040000 + (pf))
2533c838a9fSAndrew Rybchenko 
2543c838a9fSAndrew Rybchenko struct tlv_pf_dbi {
2553c838a9fSAndrew Rybchenko   uint32_t tag;
2563c838a9fSAndrew Rybchenko   uint32_t length;
2573c838a9fSAndrew Rybchenko   struct {
2583c838a9fSAndrew Rybchenko     uint16_t addr;
2593c838a9fSAndrew Rybchenko     uint16_t byte_enables;
2603c838a9fSAndrew Rybchenko     uint32_t value;
2613c838a9fSAndrew Rybchenko   } items[];
2623c838a9fSAndrew Rybchenko };
2633c838a9fSAndrew Rybchenko 
2643c838a9fSAndrew Rybchenko 
2654d982a25SAndrew Rybchenko #define TLV_TAG_GLOBAL_DBI              (0x00210000)
2664d982a25SAndrew Rybchenko 
2674d982a25SAndrew Rybchenko struct tlv_global_dbi {
2684d982a25SAndrew Rybchenko   uint32_t tag;
2694d982a25SAndrew Rybchenko   uint32_t length;
2704d982a25SAndrew Rybchenko   struct {
2714d982a25SAndrew Rybchenko     uint16_t addr;
2724d982a25SAndrew Rybchenko     uint16_t byte_enables;
2734d982a25SAndrew Rybchenko     uint32_t value;
2744d982a25SAndrew Rybchenko   } items[];
2754d982a25SAndrew Rybchenko };
2764d982a25SAndrew Rybchenko 
2774d982a25SAndrew Rybchenko 
2783c838a9fSAndrew Rybchenko /* Partition subtype codes.
2793c838a9fSAndrew Rybchenko  *
2803c838a9fSAndrew Rybchenko  * A subtype may optionally be stored for each type of partition present in
2813c838a9fSAndrew Rybchenko  * the NVRAM.  For example, this may be used to allow a generic firmware update
2823c838a9fSAndrew Rybchenko  * utility to select a specific variant of firmware for a specific variant of
2833c838a9fSAndrew Rybchenko  * board.
2843c838a9fSAndrew Rybchenko  *
2853c838a9fSAndrew Rybchenko  * The description[] field is an optional string which is returned in the
2863c838a9fSAndrew Rybchenko  * MC_CMD_NVRAM_METADATA response if present.
2873c838a9fSAndrew Rybchenko  */
2883c838a9fSAndrew Rybchenko 
2893c838a9fSAndrew Rybchenko #define TLV_TAG_PARTITION_SUBTYPE(type) (0x00050000 + (type))
2903c838a9fSAndrew Rybchenko 
2913c838a9fSAndrew Rybchenko struct tlv_partition_subtype {
2923c838a9fSAndrew Rybchenko   uint32_t tag;
2933c838a9fSAndrew Rybchenko   uint32_t length;
2943c838a9fSAndrew Rybchenko   uint32_t subtype;
2953c838a9fSAndrew Rybchenko   uint8_t  description[];
2963c838a9fSAndrew Rybchenko };
2973c838a9fSAndrew Rybchenko 
2983c838a9fSAndrew Rybchenko 
2993c838a9fSAndrew Rybchenko /* Partition version codes.
3003c838a9fSAndrew Rybchenko  *
3013c838a9fSAndrew Rybchenko  * A version may optionally be stored for each type of partition present in
3023c838a9fSAndrew Rybchenko  * the NVRAM.  This provides a standard way of tracking the currently stored
3033c838a9fSAndrew Rybchenko  * version of each of the various component images.
3043c838a9fSAndrew Rybchenko  */
3053c838a9fSAndrew Rybchenko 
3063c838a9fSAndrew Rybchenko #define TLV_TAG_PARTITION_VERSION(type) (0x10060000 + (type))
3073c838a9fSAndrew Rybchenko 
3083c838a9fSAndrew Rybchenko struct tlv_partition_version {
3093c838a9fSAndrew Rybchenko   uint32_t tag;
3103c838a9fSAndrew Rybchenko   uint32_t length;
3113c838a9fSAndrew Rybchenko   uint16_t version_w;
3123c838a9fSAndrew Rybchenko   uint16_t version_x;
3133c838a9fSAndrew Rybchenko   uint16_t version_y;
3143c838a9fSAndrew Rybchenko   uint16_t version_z;
3153c838a9fSAndrew Rybchenko };
3163c838a9fSAndrew Rybchenko 
3173c838a9fSAndrew Rybchenko /* Global PCIe configuration */
3183c838a9fSAndrew Rybchenko 
3193c838a9fSAndrew Rybchenko #define TLV_TAG_GLOBAL_PCIE_CONFIG (0x10070000)
3203c838a9fSAndrew Rybchenko 
3213c838a9fSAndrew Rybchenko struct tlv_pcie_config {
3223c838a9fSAndrew Rybchenko   uint32_t tag;
3233c838a9fSAndrew Rybchenko   uint32_t length;
3243c838a9fSAndrew Rybchenko   int16_t max_pf_number;                        /**< Largest PF RID (lower PFs may be hidden) */
3253c838a9fSAndrew Rybchenko   uint16_t pf_aper;                             /**< BIU aperture for PF BAR2 */
3263c838a9fSAndrew Rybchenko   uint16_t vf_aper;                             /**< BIU aperture for VF BAR0 */
3273c838a9fSAndrew Rybchenko   uint16_t int_aper;                            /**< BIU aperture for PF BAR4 and VF BAR2 */
3283c838a9fSAndrew Rybchenko #define TLV_MAX_PF_DEFAULT (-1)                 /* Use FW default for largest PF RID  */
3293c838a9fSAndrew Rybchenko #define TLV_APER_DEFAULT (0xFFFF)               /* Use FW default for a given aperture */
3303c838a9fSAndrew Rybchenko };
3313c838a9fSAndrew Rybchenko 
3323c838a9fSAndrew Rybchenko /* Per-PF configuration. Note that not all these fields are necessarily useful
3333c838a9fSAndrew Rybchenko  * as the apertures are constrained by the BIU settings (the one case we do
3343c838a9fSAndrew Rybchenko  * use is to make BAR2 bigger than the BIU thinks to reserve space), but we can
3353c838a9fSAndrew Rybchenko  * tidy things up later */
3363c838a9fSAndrew Rybchenko 
3373c838a9fSAndrew Rybchenko #define TLV_TAG_PF_PCIE_CONFIG(pf)  (0x10080000 + (pf))
3383c838a9fSAndrew Rybchenko 
3393c838a9fSAndrew Rybchenko struct tlv_per_pf_pcie_config {
3403c838a9fSAndrew Rybchenko   uint32_t tag;
3413c838a9fSAndrew Rybchenko   uint32_t length;
3423c838a9fSAndrew Rybchenko   uint8_t vfs_total;
3433c838a9fSAndrew Rybchenko   uint8_t port_allocation;
3443c838a9fSAndrew Rybchenko   uint16_t vectors_per_pf;
3453c838a9fSAndrew Rybchenko   uint16_t vectors_per_vf;
3463c838a9fSAndrew Rybchenko   uint8_t pf_bar0_aperture;
3473c838a9fSAndrew Rybchenko   uint8_t pf_bar2_aperture;
3483c838a9fSAndrew Rybchenko   uint8_t vf_bar0_aperture;
3493c838a9fSAndrew Rybchenko   uint8_t vf_base;
3503c838a9fSAndrew Rybchenko   uint16_t supp_pagesz;
3513c838a9fSAndrew Rybchenko   uint16_t msix_vec_base;
3523c838a9fSAndrew Rybchenko };
3533c838a9fSAndrew Rybchenko 
3543c838a9fSAndrew Rybchenko 
3553c838a9fSAndrew Rybchenko /* Development ONLY. This is a single TLV tag for all the gubbins
3563c838a9fSAndrew Rybchenko  * that can be set through the MC command-line other than the PCIe
3573c838a9fSAndrew Rybchenko  * settings. This is a temporary measure. */
3584d982a25SAndrew Rybchenko #define TLV_TAG_TMP_GUBBINS (0x10090000)        /* legacy symbol - do not use */
3594d982a25SAndrew Rybchenko #define TLV_TAG_TMP_GUBBINS_HUNT TLV_TAG_TMP_GUBBINS
3603c838a9fSAndrew Rybchenko 
3613c838a9fSAndrew Rybchenko struct tlv_tmp_gubbins {
3623c838a9fSAndrew Rybchenko   uint32_t tag;
3633c838a9fSAndrew Rybchenko   uint32_t length;
3643c838a9fSAndrew Rybchenko   /* Consumed by dpcpu.c */
3653c838a9fSAndrew Rybchenko   uint64_t tx0_tags;     /* Bitmap */
3663c838a9fSAndrew Rybchenko   uint64_t tx1_tags;     /* Bitmap */
3673c838a9fSAndrew Rybchenko   uint64_t dl_tags;      /* Bitmap */
3683c838a9fSAndrew Rybchenko   uint32_t flags;
369501fe79dSAndrew Rybchenko #define TLV_DPCPU_TX_STRIPE (1) /* No longer used, has no effect */
3703c838a9fSAndrew Rybchenko #define TLV_DPCPU_BIU_TAGS  (2) /* Use BIU tag manager */
3713c838a9fSAndrew Rybchenko #define TLV_DPCPU_TX0_TAGS  (4) /* tx0_tags is valid */
3723c838a9fSAndrew Rybchenko #define TLV_DPCPU_TX1_TAGS  (8) /* tx1_tags is valid */
3733c838a9fSAndrew Rybchenko #define TLV_DPCPU_DL_TAGS  (16) /* dl_tags is valid */
3743c838a9fSAndrew Rybchenko   /* Consumed by features.c */
3753c838a9fSAndrew Rybchenko   uint32_t dut_features;        /* All 1s -> leave alone */
3763c838a9fSAndrew Rybchenko   int8_t with_rmon;             /* 0 -> off, 1 -> on, -1 -> leave alone */
3773c838a9fSAndrew Rybchenko   /* Consumed by clocks_hunt.c */
3783c838a9fSAndrew Rybchenko   int8_t clk_mode;             /* 0 -> off, 1 -> on, -1 -> leave alone */
3793c838a9fSAndrew Rybchenko   /* Consumed by sram.c */
3803c838a9fSAndrew Rybchenko   int8_t rx_dc_size;           /* -1 -> leave alone */
3813c838a9fSAndrew Rybchenko   int8_t tx_dc_size;
3823c838a9fSAndrew Rybchenko   int16_t num_q_allocs;
3833c838a9fSAndrew Rybchenko };
3843c838a9fSAndrew Rybchenko 
3853c838a9fSAndrew Rybchenko /* Global port configuration
3863c838a9fSAndrew Rybchenko  *
3873c838a9fSAndrew Rybchenko  * This is now deprecated in favour of a platform-provided default
3883c838a9fSAndrew Rybchenko  * and dynamic config override via tlv_global_port_options.
3893c838a9fSAndrew Rybchenko  */
3903c838a9fSAndrew Rybchenko #define TLV_TAG_GLOBAL_PORT_CONFIG      (0x000a0000)
3913c838a9fSAndrew Rybchenko 
3923c838a9fSAndrew Rybchenko struct tlv_global_port_config {
3933c838a9fSAndrew Rybchenko   uint32_t tag;
3943c838a9fSAndrew Rybchenko   uint32_t length;
3953c838a9fSAndrew Rybchenko   uint32_t ports_per_core;
3963c838a9fSAndrew Rybchenko   uint32_t max_port_speed;
3973c838a9fSAndrew Rybchenko };
3983c838a9fSAndrew Rybchenko 
3993c838a9fSAndrew Rybchenko 
4003c838a9fSAndrew Rybchenko /* Firmware options.
4013c838a9fSAndrew Rybchenko  *
4023c838a9fSAndrew Rybchenko  * This is intended for user-configurable selection of optional firmware
4033c838a9fSAndrew Rybchenko  * features and variants.
4043c838a9fSAndrew Rybchenko  *
4053c838a9fSAndrew Rybchenko  * Initially, this consists only of the satellite CPU firmware variant
4063c838a9fSAndrew Rybchenko  * selection, but this tag could be extended in the future (using the
4073c838a9fSAndrew Rybchenko  * tag length to determine whether additional fields are present).
4083c838a9fSAndrew Rybchenko  */
4093c838a9fSAndrew Rybchenko 
4103c838a9fSAndrew Rybchenko #define TLV_TAG_FIRMWARE_OPTIONS        (0x100b0000)
4113c838a9fSAndrew Rybchenko 
4123c838a9fSAndrew Rybchenko struct tlv_firmware_options {
4133c838a9fSAndrew Rybchenko   uint32_t tag;
4143c838a9fSAndrew Rybchenko   uint32_t length;
4153c838a9fSAndrew Rybchenko   uint32_t firmware_variant;
4163c838a9fSAndrew Rybchenko #define TLV_FIRMWARE_VARIANT_DRIVER_SELECTED (0xffffffff)
4173c838a9fSAndrew Rybchenko 
4183c838a9fSAndrew Rybchenko /* These are the values for overriding the driver's choice; the definitions
4193c838a9fSAndrew Rybchenko  * are taken from MCDI so that they don't get out of step.  Include
4203c838a9fSAndrew Rybchenko  * <ci/mgmt/mc_driver_pcol.h> or the equivalent from your driver's tree if
4213c838a9fSAndrew Rybchenko  * you need to use these constants.
4223c838a9fSAndrew Rybchenko  */
4233c838a9fSAndrew Rybchenko #define TLV_FIRMWARE_VARIANT_FULL_FEATURED   MC_CMD_FW_FULL_FEATURED
4243c838a9fSAndrew Rybchenko #define TLV_FIRMWARE_VARIANT_LOW_LATENCY     MC_CMD_FW_LOW_LATENCY
4253c838a9fSAndrew Rybchenko #define TLV_FIRMWARE_VARIANT_PACKED_STREAM   MC_CMD_FW_PACKED_STREAM
4263c838a9fSAndrew Rybchenko #define TLV_FIRMWARE_VARIANT_HIGH_TX_RATE    MC_CMD_FW_HIGH_TX_RATE
4273c838a9fSAndrew Rybchenko #define TLV_FIRMWARE_VARIANT_PACKED_STREAM_HASH_MODE_1 \
4283c838a9fSAndrew Rybchenko                                              MC_CMD_FW_PACKED_STREAM_HASH_MODE_1
4293c838a9fSAndrew Rybchenko };
4303c838a9fSAndrew Rybchenko 
4313c838a9fSAndrew Rybchenko /* Voltage settings
4323c838a9fSAndrew Rybchenko  *
4333c838a9fSAndrew Rybchenko  * Intended for boards with A0 silicon where the core voltage may
4343c838a9fSAndrew Rybchenko  * need tweaking. Most likely set once when the pass voltage is
4353c838a9fSAndrew Rybchenko  * determined. */
4363c838a9fSAndrew Rybchenko 
4373c838a9fSAndrew Rybchenko #define TLV_TAG_0V9_SETTINGS (0x000c0000)
4383c838a9fSAndrew Rybchenko 
4393c838a9fSAndrew Rybchenko struct tlv_0v9_settings {
4403c838a9fSAndrew Rybchenko   uint32_t tag;
4413c838a9fSAndrew Rybchenko   uint32_t length;
4423c838a9fSAndrew Rybchenko   uint16_t flags; /* Boards with high 0v9 settings may need active cooling */
4433c838a9fSAndrew Rybchenko #define TLV_TAG_0V9_REQUIRES_FAN (1)
4443c838a9fSAndrew Rybchenko   uint16_t target_voltage; /* In millivolts */
4453c838a9fSAndrew Rybchenko   /* Since the limits are meant to be centred to the target (and must at least
4463c838a9fSAndrew Rybchenko    * contain it) they need setting as well. */
4473c838a9fSAndrew Rybchenko   uint16_t warn_low;       /* In millivolts */
4483c838a9fSAndrew Rybchenko   uint16_t warn_high;      /* In millivolts */
4493c838a9fSAndrew Rybchenko   uint16_t panic_low;      /* In millivolts */
4503c838a9fSAndrew Rybchenko   uint16_t panic_high;     /* In millivolts */
4513c838a9fSAndrew Rybchenko };
4523c838a9fSAndrew Rybchenko 
4533c838a9fSAndrew Rybchenko 
4543c838a9fSAndrew Rybchenko /* Clock configuration */
4553c838a9fSAndrew Rybchenko 
4564d982a25SAndrew Rybchenko #define TLV_TAG_CLOCK_CONFIG       (0x000d0000) /* legacy symbol - do not use */
4574d982a25SAndrew Rybchenko #define TLV_TAG_CLOCK_CONFIG_HUNT  TLV_TAG_CLOCK_CONFIG
4583c838a9fSAndrew Rybchenko 
4593c838a9fSAndrew Rybchenko struct tlv_clock_config {
4603c838a9fSAndrew Rybchenko   uint32_t tag;
4613c838a9fSAndrew Rybchenko   uint32_t length;
4623c838a9fSAndrew Rybchenko   uint16_t clk_sys;        /* MHz */
4633c838a9fSAndrew Rybchenko   uint16_t clk_dpcpu;      /* MHz */
4643c838a9fSAndrew Rybchenko   uint16_t clk_icore;      /* MHz */
4653c838a9fSAndrew Rybchenko   uint16_t clk_pcs;        /* MHz */
4663c838a9fSAndrew Rybchenko };
4673c838a9fSAndrew Rybchenko 
4683c838a9fSAndrew Rybchenko #define TLV_TAG_CLOCK_CONFIG_MEDFORD      (0x00100000)
4693c838a9fSAndrew Rybchenko 
4703c838a9fSAndrew Rybchenko struct tlv_clock_config_medford {
4713c838a9fSAndrew Rybchenko   uint32_t tag;
4723c838a9fSAndrew Rybchenko   uint32_t length;
4733c838a9fSAndrew Rybchenko   uint16_t clk_sys;        /* MHz */
4743c838a9fSAndrew Rybchenko   uint16_t clk_mc;         /* MHz */
4753c838a9fSAndrew Rybchenko   uint16_t clk_rmon;       /* MHz */
4763c838a9fSAndrew Rybchenko   uint16_t clk_vswitch;    /* MHz */
4773c838a9fSAndrew Rybchenko   uint16_t clk_dpcpu;      /* MHz */
4783c838a9fSAndrew Rybchenko   uint16_t clk_pcs;        /* MHz */
4793c838a9fSAndrew Rybchenko };
4803c838a9fSAndrew Rybchenko 
4813c838a9fSAndrew Rybchenko 
4823c838a9fSAndrew Rybchenko /* EF10-style global pool of MAC addresses.
4833c838a9fSAndrew Rybchenko  *
4843c838a9fSAndrew Rybchenko  * There are <count> addresses, starting at <base_address>, which are
4853c838a9fSAndrew Rybchenko  * contiguous.  Firmware is responsible for allocating addresses from this
4863c838a9fSAndrew Rybchenko  * pool to ports / PFs as appropriate.
4873c838a9fSAndrew Rybchenko  */
4883c838a9fSAndrew Rybchenko 
4893c838a9fSAndrew Rybchenko #define TLV_TAG_GLOBAL_MAC              (0x000e0000)
4903c838a9fSAndrew Rybchenko 
4913c838a9fSAndrew Rybchenko struct tlv_global_mac {
4923c838a9fSAndrew Rybchenko   uint32_t tag;
4933c838a9fSAndrew Rybchenko   uint32_t length;
4943c838a9fSAndrew Rybchenko   uint8_t  base_address[6];
4953c838a9fSAndrew Rybchenko   uint16_t reserved1;
4963c838a9fSAndrew Rybchenko   uint16_t count;
4973c838a9fSAndrew Rybchenko   uint16_t reserved2;
4983c838a9fSAndrew Rybchenko };
4993c838a9fSAndrew Rybchenko 
5004d982a25SAndrew Rybchenko #define TLV_TAG_ATB_0V9_TARGET     (0x000f0000) /* legacy symbol - do not use */
5014d982a25SAndrew Rybchenko #define TLV_TAG_ATB_0V9_TARGET_HUNT     TLV_TAG_ATB_0V9_TARGET
5023c838a9fSAndrew Rybchenko 
5033c838a9fSAndrew Rybchenko /* The target value for the 0v9 power rail measured on-chip at the
5043c838a9fSAndrew Rybchenko  * analogue test bus */
5053c838a9fSAndrew Rybchenko struct tlv_0v9_atb_target {
5063c838a9fSAndrew Rybchenko   uint32_t tag;
5073c838a9fSAndrew Rybchenko   uint32_t length;
5083c838a9fSAndrew Rybchenko   uint16_t millivolts;
5093c838a9fSAndrew Rybchenko   uint16_t reserved;
5103c838a9fSAndrew Rybchenko };
5113c838a9fSAndrew Rybchenko 
5123c838a9fSAndrew Rybchenko /* Global PCIe configuration, second revision. This represents the visible PFs
5133c838a9fSAndrew Rybchenko  * by a bitmap rather than having the number of the highest visible one. As such
5143c838a9fSAndrew Rybchenko  * it can (for a 16-PF chip) represent a superset of what TLV_TAG_GLOBAL_PCIE_CONFIG
5153c838a9fSAndrew Rybchenko  * can and it should be used in place of that tag in future (but compatibility with
5163c838a9fSAndrew Rybchenko  * the old tag will be left in the firmware indefinitely).  */
5173c838a9fSAndrew Rybchenko 
5183c838a9fSAndrew Rybchenko #define TLV_TAG_GLOBAL_PCIE_CONFIG_R2 (0x10100000)
5193c838a9fSAndrew Rybchenko 
5203c838a9fSAndrew Rybchenko struct tlv_pcie_config_r2 {
5213c838a9fSAndrew Rybchenko   uint32_t tag;
5223c838a9fSAndrew Rybchenko   uint32_t length;
5233c838a9fSAndrew Rybchenko   uint16_t visible_pfs;                         /**< Bitmap of visible PFs */
5243c838a9fSAndrew Rybchenko   uint16_t pf_aper;                             /**< BIU aperture for PF BAR2 */
5253c838a9fSAndrew Rybchenko   uint16_t vf_aper;                             /**< BIU aperture for VF BAR0 */
5263c838a9fSAndrew Rybchenko   uint16_t int_aper;                            /**< BIU aperture for PF BAR4 and VF BAR2 */
5273c838a9fSAndrew Rybchenko };
5283c838a9fSAndrew Rybchenko 
5293c838a9fSAndrew Rybchenko /* Dynamic port mode.
5303c838a9fSAndrew Rybchenko  *
5313c838a9fSAndrew Rybchenko  * Allows selecting alternate port configuration for platforms that support it
5323c838a9fSAndrew Rybchenko  * (e.g. 1x40G vs 2x10G on Milano, 1x40G vs 4x10G on Medford). This affects the
5333c838a9fSAndrew Rybchenko  * number of externally visible ports (and, hence, PF to port mapping), so must
5343c838a9fSAndrew Rybchenko  * be done at boot time.
5353c838a9fSAndrew Rybchenko  *
5363c838a9fSAndrew Rybchenko  * This tag supercedes tlv_global_port_config.
5373c838a9fSAndrew Rybchenko  */
5383c838a9fSAndrew Rybchenko 
5393c838a9fSAndrew Rybchenko #define TLV_TAG_GLOBAL_PORT_MODE         (0x10110000)
5403c838a9fSAndrew Rybchenko 
5413c838a9fSAndrew Rybchenko struct tlv_global_port_mode {
5423c838a9fSAndrew Rybchenko   uint32_t tag;
5433c838a9fSAndrew Rybchenko   uint32_t length;
5443c838a9fSAndrew Rybchenko   uint32_t port_mode;
5453c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_DEFAULT           (0xffffffff) /* Default for given platform */
5463c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_10G                        (0) /* 10G, single SFP/10G-KR */
5473c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_40G                        (1) /* 40G, single QSFP/40G-KR */
5483c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_10G_10G                    (2) /* 2x10G, dual SFP/10G-KR or single QSFP */
5493c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_40G_40G                    (3) /* 40G + 40G, dual QSFP/40G-KR (Greenport, Medford) */
5503c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_10G_10G_10G_10G            (4) /* 2x10G + 2x10G, quad SFP/10G-KR or dual QSFP (Greenport, Medford) */
5513c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_10G_10G_10G_10G_Q          (5) /* 4x10G, single QSFP, cage 0 (Medford) */
5523c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_40G_10G_10G                (6) /* 1x40G + 2x10G, dual QSFP (Greenport, Medford) */
5533c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_10G_10G_40G                (7) /* 2x10G + 1x40G, dual QSFP (Greenport, Medford) */
5543c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_10G_10G_10G_10G_Q2         (8) /* 4x10G, single QSFP, cage 1 (Medford) */
5553c838a9fSAndrew Rybchenko #define TLV_PORT_MODE_MAX TLV_PORT_MODE_10G_10G_10G_10G_Q2
5563c838a9fSAndrew Rybchenko };
5573c838a9fSAndrew Rybchenko 
5583c838a9fSAndrew Rybchenko /* Type of the v-switch created implicitly by the firmware */
5593c838a9fSAndrew Rybchenko 
5603c838a9fSAndrew Rybchenko #define TLV_TAG_VSWITCH_TYPE(port)       (0x10120000 + (port))
5613c838a9fSAndrew Rybchenko 
5623c838a9fSAndrew Rybchenko struct tlv_vswitch_type {
5633c838a9fSAndrew Rybchenko   uint32_t tag;
5643c838a9fSAndrew Rybchenko   uint32_t length;
5653c838a9fSAndrew Rybchenko   uint32_t vswitch_type;
5663c838a9fSAndrew Rybchenko #define TLV_VSWITCH_TYPE_DEFAULT        (0xffffffff) /* Firmware default; equivalent to no TLV present for a given port */
5673c838a9fSAndrew Rybchenko #define TLV_VSWITCH_TYPE_NONE                    (0)
5683c838a9fSAndrew Rybchenko #define TLV_VSWITCH_TYPE_VLAN                    (1)
5693c838a9fSAndrew Rybchenko #define TLV_VSWITCH_TYPE_VEB                     (2)
5703c838a9fSAndrew Rybchenko #define TLV_VSWITCH_TYPE_VEPA                    (3)
5713c838a9fSAndrew Rybchenko #define TLV_VSWITCH_TYPE_MUX                     (4)
5723c838a9fSAndrew Rybchenko #define TLV_VSWITCH_TYPE_TEST                    (5)
5733c838a9fSAndrew Rybchenko };
5743c838a9fSAndrew Rybchenko 
5753c838a9fSAndrew Rybchenko /* A VLAN tag for the v-port created implicitly by the firmware */
5763c838a9fSAndrew Rybchenko 
5773c838a9fSAndrew Rybchenko #define TLV_TAG_VPORT_VLAN_TAG(pf)               (0x10130000 + (pf))
5783c838a9fSAndrew Rybchenko 
5793c838a9fSAndrew Rybchenko struct tlv_vport_vlan_tag {
5803c838a9fSAndrew Rybchenko   uint32_t tag;
5813c838a9fSAndrew Rybchenko   uint32_t length;
5823c838a9fSAndrew Rybchenko   uint32_t vlan_tag;
5833c838a9fSAndrew Rybchenko #define TLV_VPORT_NO_VLAN_TAG                    (0xFFFFFFFF) /* Default in the absence of TLV for a given PF */
5843c838a9fSAndrew Rybchenko };
5853c838a9fSAndrew Rybchenko 
5863c838a9fSAndrew Rybchenko /* Offset to be applied to the 0v9 setting, wherever it came from */
5873c838a9fSAndrew Rybchenko 
5883c838a9fSAndrew Rybchenko #define TLV_TAG_ATB_0V9_OFFSET           (0x10140000)
5893c838a9fSAndrew Rybchenko 
5903c838a9fSAndrew Rybchenko struct tlv_0v9_atb_offset {
5913c838a9fSAndrew Rybchenko   uint32_t tag;
5923c838a9fSAndrew Rybchenko   uint32_t length;
5933c838a9fSAndrew Rybchenko   int16_t  offset_millivolts;
5943c838a9fSAndrew Rybchenko   uint16_t reserved;
5953c838a9fSAndrew Rybchenko };
5963c838a9fSAndrew Rybchenko 
5973c838a9fSAndrew Rybchenko /* A privilege mask given on reset to all non-admin PCIe functions (that is other than first-PF-per-port).
5983c838a9fSAndrew Rybchenko  * The meaning of particular bits is defined in mcdi_ef10.yml under MC_CMD_PRIVILEGE_MASK, see also bug 44583.
5993c838a9fSAndrew Rybchenko  * TLV_TAG_PRIVILEGE_MASK_ADD specifies bits that should be added (ORed) to firmware default while
6003c838a9fSAndrew Rybchenko  * TLV_TAG_PRIVILEGE_MASK_REM specifies bits that should be removed (ANDed) from firmware default:
6013c838a9fSAndrew Rybchenko  * Initial_privilege_mask = (firmware_default_mask | privilege_mask_add) & ~privilege_mask_rem */
6023c838a9fSAndrew Rybchenko 
6033c838a9fSAndrew Rybchenko #define TLV_TAG_PRIVILEGE_MASK          (0x10150000) /* legacy symbol - do not use */
6043c838a9fSAndrew Rybchenko 
6053c838a9fSAndrew Rybchenko struct tlv_privilege_mask {                          /* legacy structure - do not use */
6063c838a9fSAndrew Rybchenko   uint32_t tag;
6073c838a9fSAndrew Rybchenko   uint32_t length;
6083c838a9fSAndrew Rybchenko   uint32_t privilege_mask;
6093c838a9fSAndrew Rybchenko };
6103c838a9fSAndrew Rybchenko 
6113c838a9fSAndrew Rybchenko #define TLV_TAG_PRIVILEGE_MASK_ADD      (0x10150000)
6123c838a9fSAndrew Rybchenko 
6133c838a9fSAndrew Rybchenko struct tlv_privilege_mask_add {
6143c838a9fSAndrew Rybchenko   uint32_t tag;
6153c838a9fSAndrew Rybchenko   uint32_t length;
6163c838a9fSAndrew Rybchenko   uint32_t privilege_mask_add;
6173c838a9fSAndrew Rybchenko };
6183c838a9fSAndrew Rybchenko 
6193c838a9fSAndrew Rybchenko #define TLV_TAG_PRIVILEGE_MASK_REM      (0x10160000)
6203c838a9fSAndrew Rybchenko 
6213c838a9fSAndrew Rybchenko struct tlv_privilege_mask_rem {
6223c838a9fSAndrew Rybchenko   uint32_t tag;
6233c838a9fSAndrew Rybchenko   uint32_t length;
6243c838a9fSAndrew Rybchenko   uint32_t privilege_mask_rem;
6253c838a9fSAndrew Rybchenko };
6263c838a9fSAndrew Rybchenko 
6273c838a9fSAndrew Rybchenko /* Additional privileges given to all PFs.
6283c838a9fSAndrew Rybchenko  * This tag takes precedence over TLV_TAG_PRIVILEGE_MASK_REM. */
6293c838a9fSAndrew Rybchenko 
6303c838a9fSAndrew Rybchenko #define TLV_TAG_PRIVILEGE_MASK_ADD_ALL_PFS         (0x10190000)
6313c838a9fSAndrew Rybchenko 
6323c838a9fSAndrew Rybchenko struct tlv_privilege_mask_add_all_pfs {
6333c838a9fSAndrew Rybchenko   uint32_t tag;
6343c838a9fSAndrew Rybchenko   uint32_t length;
6353c838a9fSAndrew Rybchenko   uint32_t privilege_mask_add;
6363c838a9fSAndrew Rybchenko };
6373c838a9fSAndrew Rybchenko 
6383c838a9fSAndrew Rybchenko /* Additional privileges given to a selected PF.
6393c838a9fSAndrew Rybchenko  * This tag takes precedence over TLV_TAG_PRIVILEGE_MASK_REM. */
6403c838a9fSAndrew Rybchenko 
6413c838a9fSAndrew Rybchenko #define TLV_TAG_PRIVILEGE_MASK_ADD_SINGLE_PF(pf)   (0x101A0000 + (pf))
6423c838a9fSAndrew Rybchenko 
6433c838a9fSAndrew Rybchenko struct tlv_privilege_mask_add_single_pf {
6443c838a9fSAndrew Rybchenko   uint32_t tag;
6453c838a9fSAndrew Rybchenko   uint32_t length;
6463c838a9fSAndrew Rybchenko   uint32_t privilege_mask_add;
6473c838a9fSAndrew Rybchenko };
6483c838a9fSAndrew Rybchenko 
6493c838a9fSAndrew Rybchenko /* Turning on/off the PFIOV mode.
6503c838a9fSAndrew Rybchenko  * This tag only takes effect if TLV_TAG_VSWITCH_TYPE is missing or set to DEFAULT. */
6513c838a9fSAndrew Rybchenko 
6523c838a9fSAndrew Rybchenko #define TLV_TAG_PFIOV(port)             (0x10170000 + (port))
6533c838a9fSAndrew Rybchenko 
6543c838a9fSAndrew Rybchenko struct tlv_pfiov {
6553c838a9fSAndrew Rybchenko   uint32_t tag;
6563c838a9fSAndrew Rybchenko   uint32_t length;
6573c838a9fSAndrew Rybchenko   uint32_t pfiov;
6583c838a9fSAndrew Rybchenko #define TLV_PFIOV_OFF                    (0) /* Default */
6593c838a9fSAndrew Rybchenko #define TLV_PFIOV_ON                     (1)
6603c838a9fSAndrew Rybchenko };
6613c838a9fSAndrew Rybchenko 
6623c838a9fSAndrew Rybchenko /* Multicast filter chaining mode selection.
6633c838a9fSAndrew Rybchenko  *
6643c838a9fSAndrew Rybchenko  * When enabled, multicast packets are delivered to all recipients of all
6653c838a9fSAndrew Rybchenko  * matching multicast filters, with the exception that IP multicast filters
6663c838a9fSAndrew Rybchenko  * will steal traffic from MAC multicast filters on a per-function basis.
6673c838a9fSAndrew Rybchenko  * (New behaviour.)
6683c838a9fSAndrew Rybchenko  *
6693c838a9fSAndrew Rybchenko  * When disabled, multicast packets will always be delivered only to the
6703c838a9fSAndrew Rybchenko  * recipients of the highest priority matching multicast filter.
6713c838a9fSAndrew Rybchenko  * (Legacy behaviour.)
6723c838a9fSAndrew Rybchenko  *
6733c838a9fSAndrew Rybchenko  * The DEFAULT mode (which is the same as the tag not being present at all)
6743c838a9fSAndrew Rybchenko  * is equivalent to ENABLED in production builds, and DISABLED in eftest
6753c838a9fSAndrew Rybchenko  * builds.
6763c838a9fSAndrew Rybchenko  *
6773c838a9fSAndrew Rybchenko  * This option is intended to provide run-time control over this feature
6783c838a9fSAndrew Rybchenko  * while it is being stabilised and may be withdrawn at some point in the
6793c838a9fSAndrew Rybchenko  * future; the new behaviour is intended to become the standard behaviour.
6803c838a9fSAndrew Rybchenko  */
6813c838a9fSAndrew Rybchenko 
6823c838a9fSAndrew Rybchenko #define TLV_TAG_MCAST_FILTER_CHAINING   (0x10180000)
6833c838a9fSAndrew Rybchenko 
6843c838a9fSAndrew Rybchenko struct tlv_mcast_filter_chaining {
6853c838a9fSAndrew Rybchenko   uint32_t tag;
6863c838a9fSAndrew Rybchenko   uint32_t length;
6873c838a9fSAndrew Rybchenko   uint32_t mode;
6883c838a9fSAndrew Rybchenko #define TLV_MCAST_FILTER_CHAINING_DEFAULT  (0xffffffff)
6893c838a9fSAndrew Rybchenko #define TLV_MCAST_FILTER_CHAINING_DISABLED (0)
6903c838a9fSAndrew Rybchenko #define TLV_MCAST_FILTER_CHAINING_ENABLED  (1)
6913c838a9fSAndrew Rybchenko };
6923c838a9fSAndrew Rybchenko 
6933c838a9fSAndrew Rybchenko 
6943c838a9fSAndrew Rybchenko /* Pacer rate limit per PF */
6953c838a9fSAndrew Rybchenko #define TLV_TAG_RATE_LIMIT(pf)    (0x101b0000 + (pf))
6963c838a9fSAndrew Rybchenko 
6973c838a9fSAndrew Rybchenko struct tlv_rate_limit {
6983c838a9fSAndrew Rybchenko   uint32_t tag;
6993c838a9fSAndrew Rybchenko   uint32_t length;
7003c838a9fSAndrew Rybchenko   uint32_t rate_mbps;
7013c838a9fSAndrew Rybchenko };
7023c838a9fSAndrew Rybchenko 
7033c838a9fSAndrew Rybchenko 
7043c838a9fSAndrew Rybchenko /* OCSD Enable/Disable
7053c838a9fSAndrew Rybchenko  *
7063c838a9fSAndrew Rybchenko  * This setting allows OCSD to be disabled. This is a requirement for HP
7073c838a9fSAndrew Rybchenko  * servers to support PCI passthrough for virtualization.
7083c838a9fSAndrew Rybchenko  *
7093c838a9fSAndrew Rybchenko  * The DEFAULT mode (which is the same as the tag not being present) is
7103c838a9fSAndrew Rybchenko  * equivalent to ENABLED.
7113c838a9fSAndrew Rybchenko  *
7123c838a9fSAndrew Rybchenko  * This option is not used by the MCFW, and is entirely handled by the various
7133c838a9fSAndrew Rybchenko  * drivers that support OCSD, by reading the setting before they attempt
7143c838a9fSAndrew Rybchenko  * to enable OCSD.
7153c838a9fSAndrew Rybchenko  *
7163c838a9fSAndrew Rybchenko  * bit0: OCSD Disabled/Enabled
7173c838a9fSAndrew Rybchenko  */
7183c838a9fSAndrew Rybchenko 
7193c838a9fSAndrew Rybchenko #define TLV_TAG_OCSD (0x101C0000)
7203c838a9fSAndrew Rybchenko 
7213c838a9fSAndrew Rybchenko struct tlv_ocsd {
7223c838a9fSAndrew Rybchenko   uint32_t tag;
7233c838a9fSAndrew Rybchenko   uint32_t length;
7243c838a9fSAndrew Rybchenko   uint32_t mode;
7253c838a9fSAndrew Rybchenko #define TLV_OCSD_DISABLED 0
7263c838a9fSAndrew Rybchenko #define TLV_OCSD_ENABLED 1 /* Default */
7273c838a9fSAndrew Rybchenko };
7283c838a9fSAndrew Rybchenko 
729501fe79dSAndrew Rybchenko /* Descriptor cache config.
730501fe79dSAndrew Rybchenko  *
731501fe79dSAndrew Rybchenko  * Sets the sizes of the TX and RX descriptor caches as a power of 2. It also
732501fe79dSAndrew Rybchenko  * sets the total number of VIs. When the number of VIs is reduced VIs are taken
733501fe79dSAndrew Rybchenko  * away from the highest numbered port first, so a vi_count of 1024 means 1024
734501fe79dSAndrew Rybchenko  * VIs on the first port and 0 on the second (on a Torino).
735501fe79dSAndrew Rybchenko  */
736501fe79dSAndrew Rybchenko 
737501fe79dSAndrew Rybchenko #define TLV_TAG_DESCRIPTOR_CACHE_CONFIG    (0x101d0000)
738501fe79dSAndrew Rybchenko 
739501fe79dSAndrew Rybchenko struct tlv_descriptor_cache_config {
740501fe79dSAndrew Rybchenko   uint32_t tag;
741501fe79dSAndrew Rybchenko   uint32_t length;
742501fe79dSAndrew Rybchenko   uint8_t rx_desc_cache_size;
743501fe79dSAndrew Rybchenko   uint8_t tx_desc_cache_size;
744501fe79dSAndrew Rybchenko   uint16_t vi_count;
745501fe79dSAndrew Rybchenko };
746501fe79dSAndrew Rybchenko #define TLV_DESC_CACHE_DEFAULT (0xff)
747501fe79dSAndrew Rybchenko #define TLV_VI_COUNT_DEFAULT   (0xffff)
748501fe79dSAndrew Rybchenko 
749501fe79dSAndrew Rybchenko /* RX event merging config (read batching).
750501fe79dSAndrew Rybchenko  *
751501fe79dSAndrew Rybchenko  * Sets the global maximum number of events for the merging bins, and the
752501fe79dSAndrew Rybchenko  * global timeout configuration for the bins.
753501fe79dSAndrew Rybchenko  */
754501fe79dSAndrew Rybchenko 
755501fe79dSAndrew Rybchenko #define TLV_TAG_RX_EVENT_MERGING_CONFIG    (0x101e0000)
756501fe79dSAndrew Rybchenko 
757501fe79dSAndrew Rybchenko struct tlv_rx_event_merging_config {
758501fe79dSAndrew Rybchenko   uint32_t  tag;
759501fe79dSAndrew Rybchenko   uint32_t  length;
760501fe79dSAndrew Rybchenko   uint32_t  max_events;
761501fe79dSAndrew Rybchenko #define TLV_RX_EVENT_MERGING_CONFIG_MAX_EVENTS_MAX ((1 << 4) - 1)
762501fe79dSAndrew Rybchenko   uint32_t  timeout_ns;
763501fe79dSAndrew Rybchenko };
764501fe79dSAndrew Rybchenko #define TLV_RX_EVENT_MERGING_MAX_EVENTS_DEFAULT 7
765501fe79dSAndrew Rybchenko #define TLV_RX_EVENT_MERGING_TIMEOUT_NS_DEFAULT 8740
766501fe79dSAndrew Rybchenko 
767*88cbf0f7SAndrew Rybchenko #define TLV_TAG_PCIE_LINK_SETTINGS (0x101f0000)
768*88cbf0f7SAndrew Rybchenko struct tlv_pcie_link_settings {
769*88cbf0f7SAndrew Rybchenko   uint32_t tag;
770*88cbf0f7SAndrew Rybchenko   uint32_t length;
771*88cbf0f7SAndrew Rybchenko   uint16_t gen;   /* Target PCIe generation: 1, 2, 3 */
772*88cbf0f7SAndrew Rybchenko   uint16_t width; /* Number of lanes */
773*88cbf0f7SAndrew Rybchenko };
774*88cbf0f7SAndrew Rybchenko 
775*88cbf0f7SAndrew Rybchenko #define TLV_TAG_LICENSE (0x20800000)
776*88cbf0f7SAndrew Rybchenko 
777*88cbf0f7SAndrew Rybchenko typedef struct tlv_license {
778*88cbf0f7SAndrew Rybchenko   uint32_t  tag;
779*88cbf0f7SAndrew Rybchenko   uint32_t  length;
780*88cbf0f7SAndrew Rybchenko   uint8_t   data[];
781*88cbf0f7SAndrew Rybchenko } tlv_license_t;
782*88cbf0f7SAndrew Rybchenko 
7833c838a9fSAndrew Rybchenko #endif /* CI_MGMT_TLV_LAYOUT_H */
784