18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright(c) 2015, 2016 Intel Corporation. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 58c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as 118c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 148c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 158c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 168c2ecf20Sopenharmony_ci * General Public License for more details. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * BSD LICENSE 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 218c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 228c2ecf20Sopenharmony_ci * are met: 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above copyright 258c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 268c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above copyright 278c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 288c2ecf20Sopenharmony_ci * the documentation and/or other materials provided with the 298c2ecf20Sopenharmony_ci * distribution. 308c2ecf20Sopenharmony_ci * - Neither the name of Intel Corporation nor the names of its 318c2ecf20Sopenharmony_ci * contributors may be used to endorse or promote products derived 328c2ecf20Sopenharmony_ci * from this software without specific prior written permission. 338c2ecf20Sopenharmony_ci * 348c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 358c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 368c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 378c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 388c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 398c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 408c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 418c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 428c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 438c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 448c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 458c2ecf20Sopenharmony_ci * 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_ci#ifndef __PLATFORM_H 488c2ecf20Sopenharmony_ci#define __PLATFORM_H 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define METADATA_TABLE_FIELD_START_SHIFT 0 518c2ecf20Sopenharmony_ci#define METADATA_TABLE_FIELD_START_LEN_BITS 15 528c2ecf20Sopenharmony_ci#define METADATA_TABLE_FIELD_LEN_SHIFT 16 538c2ecf20Sopenharmony_ci#define METADATA_TABLE_FIELD_LEN_LEN_BITS 16 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci/* Header structure */ 568c2ecf20Sopenharmony_ci#define PLATFORM_CONFIG_HEADER_RECORD_IDX_SHIFT 0 578c2ecf20Sopenharmony_ci#define PLATFORM_CONFIG_HEADER_RECORD_IDX_LEN_BITS 6 588c2ecf20Sopenharmony_ci#define PLATFORM_CONFIG_HEADER_TABLE_LENGTH_SHIFT 16 598c2ecf20Sopenharmony_ci#define PLATFORM_CONFIG_HEADER_TABLE_LENGTH_LEN_BITS 12 608c2ecf20Sopenharmony_ci#define PLATFORM_CONFIG_HEADER_TABLE_TYPE_SHIFT 28 618c2ecf20Sopenharmony_ci#define PLATFORM_CONFIG_HEADER_TABLE_TYPE_LEN_BITS 4 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_cienum platform_config_table_type_encoding { 648c2ecf20Sopenharmony_ci PLATFORM_CONFIG_TABLE_RESERVED, 658c2ecf20Sopenharmony_ci PLATFORM_CONFIG_SYSTEM_TABLE, 668c2ecf20Sopenharmony_ci PLATFORM_CONFIG_PORT_TABLE, 678c2ecf20Sopenharmony_ci PLATFORM_CONFIG_RX_PRESET_TABLE, 688c2ecf20Sopenharmony_ci PLATFORM_CONFIG_TX_PRESET_TABLE, 698c2ecf20Sopenharmony_ci PLATFORM_CONFIG_QSFP_ATTEN_TABLE, 708c2ecf20Sopenharmony_ci PLATFORM_CONFIG_VARIABLE_SETTINGS_TABLE, 718c2ecf20Sopenharmony_ci PLATFORM_CONFIG_TABLE_MAX 728c2ecf20Sopenharmony_ci}; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_cienum platform_config_system_table_fields { 758c2ecf20Sopenharmony_ci SYSTEM_TABLE_RESERVED, 768c2ecf20Sopenharmony_ci SYSTEM_TABLE_NODE_STRING, 778c2ecf20Sopenharmony_ci SYSTEM_TABLE_SYSTEM_IMAGE_GUID, 788c2ecf20Sopenharmony_ci SYSTEM_TABLE_NODE_GUID, 798c2ecf20Sopenharmony_ci SYSTEM_TABLE_REVISION, 808c2ecf20Sopenharmony_ci SYSTEM_TABLE_VENDOR_OUI, 818c2ecf20Sopenharmony_ci SYSTEM_TABLE_META_VERSION, 828c2ecf20Sopenharmony_ci SYSTEM_TABLE_DEVICE_ID, 838c2ecf20Sopenharmony_ci SYSTEM_TABLE_PARTITION_ENFORCEMENT_CAP, 848c2ecf20Sopenharmony_ci SYSTEM_TABLE_QSFP_POWER_CLASS_MAX, 858c2ecf20Sopenharmony_ci SYSTEM_TABLE_QSFP_ATTENUATION_DEFAULT_12G, 868c2ecf20Sopenharmony_ci SYSTEM_TABLE_QSFP_ATTENUATION_DEFAULT_25G, 878c2ecf20Sopenharmony_ci SYSTEM_TABLE_VARIABLE_TABLE_ENTRIES_PER_PORT, 888c2ecf20Sopenharmony_ci SYSTEM_TABLE_MAX 898c2ecf20Sopenharmony_ci}; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cienum platform_config_port_table_fields { 928c2ecf20Sopenharmony_ci PORT_TABLE_RESERVED, 938c2ecf20Sopenharmony_ci PORT_TABLE_PORT_TYPE, 948c2ecf20Sopenharmony_ci PORT_TABLE_LOCAL_ATTEN_12G, 958c2ecf20Sopenharmony_ci PORT_TABLE_LOCAL_ATTEN_25G, 968c2ecf20Sopenharmony_ci PORT_TABLE_LINK_SPEED_SUPPORTED, 978c2ecf20Sopenharmony_ci PORT_TABLE_LINK_WIDTH_SUPPORTED, 988c2ecf20Sopenharmony_ci PORT_TABLE_AUTO_LANE_SHEDDING_ENABLED, 998c2ecf20Sopenharmony_ci PORT_TABLE_EXTERNAL_LOOPBACK_ALLOWED, 1008c2ecf20Sopenharmony_ci PORT_TABLE_VL_CAP, 1018c2ecf20Sopenharmony_ci PORT_TABLE_MTU_CAP, 1028c2ecf20Sopenharmony_ci PORT_TABLE_TX_LANE_ENABLE_MASK, 1038c2ecf20Sopenharmony_ci PORT_TABLE_LOCAL_MAX_TIMEOUT, 1048c2ecf20Sopenharmony_ci PORT_TABLE_REMOTE_ATTEN_12G, 1058c2ecf20Sopenharmony_ci PORT_TABLE_REMOTE_ATTEN_25G, 1068c2ecf20Sopenharmony_ci PORT_TABLE_TX_PRESET_IDX_ACTIVE_NO_EQ, 1078c2ecf20Sopenharmony_ci PORT_TABLE_TX_PRESET_IDX_ACTIVE_EQ, 1088c2ecf20Sopenharmony_ci PORT_TABLE_RX_PRESET_IDX, 1098c2ecf20Sopenharmony_ci PORT_TABLE_CABLE_REACH_CLASS, 1108c2ecf20Sopenharmony_ci PORT_TABLE_MAX 1118c2ecf20Sopenharmony_ci}; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_cienum platform_config_rx_preset_table_fields { 1148c2ecf20Sopenharmony_ci RX_PRESET_TABLE_RESERVED, 1158c2ecf20Sopenharmony_ci RX_PRESET_TABLE_QSFP_RX_CDR_APPLY, 1168c2ecf20Sopenharmony_ci RX_PRESET_TABLE_QSFP_RX_EMP_APPLY, 1178c2ecf20Sopenharmony_ci RX_PRESET_TABLE_QSFP_RX_AMP_APPLY, 1188c2ecf20Sopenharmony_ci RX_PRESET_TABLE_QSFP_RX_CDR, 1198c2ecf20Sopenharmony_ci RX_PRESET_TABLE_QSFP_RX_EMP, 1208c2ecf20Sopenharmony_ci RX_PRESET_TABLE_QSFP_RX_AMP, 1218c2ecf20Sopenharmony_ci RX_PRESET_TABLE_MAX 1228c2ecf20Sopenharmony_ci}; 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_cienum platform_config_tx_preset_table_fields { 1258c2ecf20Sopenharmony_ci TX_PRESET_TABLE_RESERVED, 1268c2ecf20Sopenharmony_ci TX_PRESET_TABLE_PRECUR, 1278c2ecf20Sopenharmony_ci TX_PRESET_TABLE_ATTN, 1288c2ecf20Sopenharmony_ci TX_PRESET_TABLE_POSTCUR, 1298c2ecf20Sopenharmony_ci TX_PRESET_TABLE_QSFP_TX_CDR_APPLY, 1308c2ecf20Sopenharmony_ci TX_PRESET_TABLE_QSFP_TX_EQ_APPLY, 1318c2ecf20Sopenharmony_ci TX_PRESET_TABLE_QSFP_TX_CDR, 1328c2ecf20Sopenharmony_ci TX_PRESET_TABLE_QSFP_TX_EQ, 1338c2ecf20Sopenharmony_ci TX_PRESET_TABLE_MAX 1348c2ecf20Sopenharmony_ci}; 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_cienum platform_config_qsfp_attn_table_fields { 1378c2ecf20Sopenharmony_ci QSFP_ATTEN_TABLE_RESERVED, 1388c2ecf20Sopenharmony_ci QSFP_ATTEN_TABLE_TX_PRESET_IDX, 1398c2ecf20Sopenharmony_ci QSFP_ATTEN_TABLE_RX_PRESET_IDX, 1408c2ecf20Sopenharmony_ci QSFP_ATTEN_TABLE_MAX 1418c2ecf20Sopenharmony_ci}; 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cienum platform_config_variable_settings_table_fields { 1448c2ecf20Sopenharmony_ci VARIABLE_SETTINGS_TABLE_RESERVED, 1458c2ecf20Sopenharmony_ci VARIABLE_SETTINGS_TABLE_TX_PRESET_IDX, 1468c2ecf20Sopenharmony_ci VARIABLE_SETTINGS_TABLE_RX_PRESET_IDX, 1478c2ecf20Sopenharmony_ci VARIABLE_SETTINGS_TABLE_MAX 1488c2ecf20Sopenharmony_ci}; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_cistruct platform_config { 1518c2ecf20Sopenharmony_ci size_t size; 1528c2ecf20Sopenharmony_ci const u8 *data; 1538c2ecf20Sopenharmony_ci}; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_cistruct platform_config_data { 1568c2ecf20Sopenharmony_ci u32 *table; 1578c2ecf20Sopenharmony_ci u32 *table_metadata; 1588c2ecf20Sopenharmony_ci u32 num_table; 1598c2ecf20Sopenharmony_ci}; 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci/* 1628c2ecf20Sopenharmony_ci * This struct acts as a quick reference into the platform_data binary image 1638c2ecf20Sopenharmony_ci * and is populated by parse_platform_config(...) depending on the specific 1648c2ecf20Sopenharmony_ci * META_VERSION 1658c2ecf20Sopenharmony_ci */ 1668c2ecf20Sopenharmony_cistruct platform_config_cache { 1678c2ecf20Sopenharmony_ci u8 cache_valid; 1688c2ecf20Sopenharmony_ci struct platform_config_data config_tables[PLATFORM_CONFIG_TABLE_MAX]; 1698c2ecf20Sopenharmony_ci}; 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci/* This section defines default values and encodings for the 1728c2ecf20Sopenharmony_ci * fields defined for each table above 1738c2ecf20Sopenharmony_ci */ 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci/* 1768c2ecf20Sopenharmony_ci * ===================================================== 1778c2ecf20Sopenharmony_ci * System table encodings 1788c2ecf20Sopenharmony_ci * ===================================================== 1798c2ecf20Sopenharmony_ci */ 1808c2ecf20Sopenharmony_ci#define PLATFORM_CONFIG_MAGIC_NUM 0x3d4f5041 1818c2ecf20Sopenharmony_ci#define PLATFORM_CONFIG_MAGIC_NUMBER_LEN 4 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci/* 1848c2ecf20Sopenharmony_ci * These power classes are the same as defined in SFF 8636 spec rev 2.4 1858c2ecf20Sopenharmony_ci * describing byte 129 in table 6-16, except enumerated in a different order 1868c2ecf20Sopenharmony_ci */ 1878c2ecf20Sopenharmony_cienum platform_config_qsfp_power_class_encoding { 1888c2ecf20Sopenharmony_ci QSFP_POWER_CLASS_1 = 1, 1898c2ecf20Sopenharmony_ci QSFP_POWER_CLASS_2, 1908c2ecf20Sopenharmony_ci QSFP_POWER_CLASS_3, 1918c2ecf20Sopenharmony_ci QSFP_POWER_CLASS_4, 1928c2ecf20Sopenharmony_ci QSFP_POWER_CLASS_5, 1938c2ecf20Sopenharmony_ci QSFP_POWER_CLASS_6, 1948c2ecf20Sopenharmony_ci QSFP_POWER_CLASS_7 1958c2ecf20Sopenharmony_ci}; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci/* 1988c2ecf20Sopenharmony_ci * ==================================================== 1998c2ecf20Sopenharmony_ci * Port table encodings 2008c2ecf20Sopenharmony_ci * ==================================================== 2018c2ecf20Sopenharmony_ci */ 2028c2ecf20Sopenharmony_cienum platform_config_port_type_encoding { 2038c2ecf20Sopenharmony_ci PORT_TYPE_UNKNOWN, 2048c2ecf20Sopenharmony_ci PORT_TYPE_DISCONNECTED, 2058c2ecf20Sopenharmony_ci PORT_TYPE_FIXED, 2068c2ecf20Sopenharmony_ci PORT_TYPE_VARIABLE, 2078c2ecf20Sopenharmony_ci PORT_TYPE_QSFP, 2088c2ecf20Sopenharmony_ci PORT_TYPE_MAX 2098c2ecf20Sopenharmony_ci}; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_cienum platform_config_link_speed_supported_encoding { 2128c2ecf20Sopenharmony_ci LINK_SPEED_SUPP_12G = 1, 2138c2ecf20Sopenharmony_ci LINK_SPEED_SUPP_25G, 2148c2ecf20Sopenharmony_ci LINK_SPEED_SUPP_12G_25G, 2158c2ecf20Sopenharmony_ci LINK_SPEED_SUPP_MAX 2168c2ecf20Sopenharmony_ci}; 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci/* 2198c2ecf20Sopenharmony_ci * This is a subset (not strict) of the link downgrades 2208c2ecf20Sopenharmony_ci * supported. The link downgrades supported are expected 2218c2ecf20Sopenharmony_ci * to be supplied to the driver by another entity such as 2228c2ecf20Sopenharmony_ci * the fabric manager 2238c2ecf20Sopenharmony_ci */ 2248c2ecf20Sopenharmony_cienum platform_config_link_width_supported_encoding { 2258c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_1X = 1, 2268c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_2X, 2278c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_2X_1X, 2288c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_3X, 2298c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_3X_1X, 2308c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_3X_2X, 2318c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_3X_2X_1X, 2328c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_4X, 2338c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_4X_1X, 2348c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_4X_2X, 2358c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_4X_2X_1X, 2368c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_4X_3X, 2378c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_4X_3X_1X, 2388c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_4X_3X_2X, 2398c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_4X_3X_2X_1X, 2408c2ecf20Sopenharmony_ci LINK_WIDTH_SUPP_MAX 2418c2ecf20Sopenharmony_ci}; 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_cienum platform_config_virtual_lane_capability_encoding { 2448c2ecf20Sopenharmony_ci VL_CAP_VL0 = 1, 2458c2ecf20Sopenharmony_ci VL_CAP_VL0_1, 2468c2ecf20Sopenharmony_ci VL_CAP_VL0_2, 2478c2ecf20Sopenharmony_ci VL_CAP_VL0_3, 2488c2ecf20Sopenharmony_ci VL_CAP_VL0_4, 2498c2ecf20Sopenharmony_ci VL_CAP_VL0_5, 2508c2ecf20Sopenharmony_ci VL_CAP_VL0_6, 2518c2ecf20Sopenharmony_ci VL_CAP_VL0_7, 2528c2ecf20Sopenharmony_ci VL_CAP_VL0_8, 2538c2ecf20Sopenharmony_ci VL_CAP_VL0_9, 2548c2ecf20Sopenharmony_ci VL_CAP_VL0_10, 2558c2ecf20Sopenharmony_ci VL_CAP_VL0_11, 2568c2ecf20Sopenharmony_ci VL_CAP_VL0_12, 2578c2ecf20Sopenharmony_ci VL_CAP_VL0_13, 2588c2ecf20Sopenharmony_ci VL_CAP_VL0_14, 2598c2ecf20Sopenharmony_ci VL_CAP_MAX 2608c2ecf20Sopenharmony_ci}; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci/* Max MTU */ 2638c2ecf20Sopenharmony_cienum platform_config_mtu_capability_encoding { 2648c2ecf20Sopenharmony_ci MTU_CAP_256 = 1, 2658c2ecf20Sopenharmony_ci MTU_CAP_512 = 2, 2668c2ecf20Sopenharmony_ci MTU_CAP_1024 = 3, 2678c2ecf20Sopenharmony_ci MTU_CAP_2048 = 4, 2688c2ecf20Sopenharmony_ci MTU_CAP_4096 = 5, 2698c2ecf20Sopenharmony_ci MTU_CAP_8192 = 6, 2708c2ecf20Sopenharmony_ci MTU_CAP_10240 = 7 2718c2ecf20Sopenharmony_ci}; 2728c2ecf20Sopenharmony_ci 2738c2ecf20Sopenharmony_cienum platform_config_local_max_timeout_encoding { 2748c2ecf20Sopenharmony_ci LOCAL_MAX_TIMEOUT_10_MS = 1, 2758c2ecf20Sopenharmony_ci LOCAL_MAX_TIMEOUT_100_MS, 2768c2ecf20Sopenharmony_ci LOCAL_MAX_TIMEOUT_1_S, 2778c2ecf20Sopenharmony_ci LOCAL_MAX_TIMEOUT_10_S, 2788c2ecf20Sopenharmony_ci LOCAL_MAX_TIMEOUT_100_S, 2798c2ecf20Sopenharmony_ci LOCAL_MAX_TIMEOUT_1000_S 2808c2ecf20Sopenharmony_ci}; 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_cienum link_tuning_encoding { 2838c2ecf20Sopenharmony_ci OPA_PASSIVE_TUNING, 2848c2ecf20Sopenharmony_ci OPA_ACTIVE_TUNING, 2858c2ecf20Sopenharmony_ci OPA_UNKNOWN_TUNING 2868c2ecf20Sopenharmony_ci}; 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci/* 2898c2ecf20Sopenharmony_ci * Shifts and masks for the link SI tuning values stuffed into the ASIC scratch 2908c2ecf20Sopenharmony_ci * registers for integrated platforms 2918c2ecf20Sopenharmony_ci */ 2928c2ecf20Sopenharmony_ci#define PORT0_PORT_TYPE_SHIFT 0 2938c2ecf20Sopenharmony_ci#define PORT0_LOCAL_ATTEN_SHIFT 4 2948c2ecf20Sopenharmony_ci#define PORT0_REMOTE_ATTEN_SHIFT 10 2958c2ecf20Sopenharmony_ci#define PORT0_DEFAULT_ATTEN_SHIFT 32 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci#define PORT1_PORT_TYPE_SHIFT 16 2988c2ecf20Sopenharmony_ci#define PORT1_LOCAL_ATTEN_SHIFT 20 2998c2ecf20Sopenharmony_ci#define PORT1_REMOTE_ATTEN_SHIFT 26 3008c2ecf20Sopenharmony_ci#define PORT1_DEFAULT_ATTEN_SHIFT 40 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_ci#define PORT0_PORT_TYPE_MASK 0xFUL 3038c2ecf20Sopenharmony_ci#define PORT0_LOCAL_ATTEN_MASK 0x3FUL 3048c2ecf20Sopenharmony_ci#define PORT0_REMOTE_ATTEN_MASK 0x3FUL 3058c2ecf20Sopenharmony_ci#define PORT0_DEFAULT_ATTEN_MASK 0xFFUL 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci#define PORT1_PORT_TYPE_MASK 0xFUL 3088c2ecf20Sopenharmony_ci#define PORT1_LOCAL_ATTEN_MASK 0x3FUL 3098c2ecf20Sopenharmony_ci#define PORT1_REMOTE_ATTEN_MASK 0x3FUL 3108c2ecf20Sopenharmony_ci#define PORT1_DEFAULT_ATTEN_MASK 0xFFUL 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci#define PORT0_PORT_TYPE_SMASK (PORT0_PORT_TYPE_MASK << \ 3138c2ecf20Sopenharmony_ci PORT0_PORT_TYPE_SHIFT) 3148c2ecf20Sopenharmony_ci#define PORT0_LOCAL_ATTEN_SMASK (PORT0_LOCAL_ATTEN_MASK << \ 3158c2ecf20Sopenharmony_ci PORT0_LOCAL_ATTEN_SHIFT) 3168c2ecf20Sopenharmony_ci#define PORT0_REMOTE_ATTEN_SMASK (PORT0_REMOTE_ATTEN_MASK << \ 3178c2ecf20Sopenharmony_ci PORT0_REMOTE_ATTEN_SHIFT) 3188c2ecf20Sopenharmony_ci#define PORT0_DEFAULT_ATTEN_SMASK (PORT0_DEFAULT_ATTEN_MASK << \ 3198c2ecf20Sopenharmony_ci PORT0_DEFAULT_ATTEN_SHIFT) 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci#define PORT1_PORT_TYPE_SMASK (PORT1_PORT_TYPE_MASK << \ 3228c2ecf20Sopenharmony_ci PORT1_PORT_TYPE_SHIFT) 3238c2ecf20Sopenharmony_ci#define PORT1_LOCAL_ATTEN_SMASK (PORT1_LOCAL_ATTEN_MASK << \ 3248c2ecf20Sopenharmony_ci PORT1_LOCAL_ATTEN_SHIFT) 3258c2ecf20Sopenharmony_ci#define PORT1_REMOTE_ATTEN_SMASK (PORT1_REMOTE_ATTEN_MASK << \ 3268c2ecf20Sopenharmony_ci PORT1_REMOTE_ATTEN_SHIFT) 3278c2ecf20Sopenharmony_ci#define PORT1_DEFAULT_ATTEN_SMASK (PORT1_DEFAULT_ATTEN_MASK << \ 3288c2ecf20Sopenharmony_ci PORT1_DEFAULT_ATTEN_SHIFT) 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci#define QSFP_MAX_POWER_SHIFT 0 3318c2ecf20Sopenharmony_ci#define TX_NO_EQ_SHIFT 4 3328c2ecf20Sopenharmony_ci#define TX_EQ_SHIFT 25 3338c2ecf20Sopenharmony_ci#define RX_SHIFT 46 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_ci#define QSFP_MAX_POWER_MASK 0xFUL 3368c2ecf20Sopenharmony_ci#define TX_NO_EQ_MASK 0x1FFFFFUL 3378c2ecf20Sopenharmony_ci#define TX_EQ_MASK 0x1FFFFFUL 3388c2ecf20Sopenharmony_ci#define RX_MASK 0xFFFFUL 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci#define QSFP_MAX_POWER_SMASK (QSFP_MAX_POWER_MASK << \ 3418c2ecf20Sopenharmony_ci QSFP_MAX_POWER_SHIFT) 3428c2ecf20Sopenharmony_ci#define TX_NO_EQ_SMASK (TX_NO_EQ_MASK << TX_NO_EQ_SHIFT) 3438c2ecf20Sopenharmony_ci#define TX_EQ_SMASK (TX_EQ_MASK << TX_EQ_SHIFT) 3448c2ecf20Sopenharmony_ci#define RX_SMASK (RX_MASK << RX_SHIFT) 3458c2ecf20Sopenharmony_ci 3468c2ecf20Sopenharmony_ci#define TX_PRECUR_SHIFT 0 3478c2ecf20Sopenharmony_ci#define TX_ATTN_SHIFT 4 3488c2ecf20Sopenharmony_ci#define QSFP_TX_CDR_APPLY_SHIFT 9 3498c2ecf20Sopenharmony_ci#define QSFP_TX_EQ_APPLY_SHIFT 10 3508c2ecf20Sopenharmony_ci#define QSFP_TX_CDR_SHIFT 11 3518c2ecf20Sopenharmony_ci#define QSFP_TX_EQ_SHIFT 12 3528c2ecf20Sopenharmony_ci#define TX_POSTCUR_SHIFT 16 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci#define TX_PRECUR_MASK 0xFUL 3558c2ecf20Sopenharmony_ci#define TX_ATTN_MASK 0x1FUL 3568c2ecf20Sopenharmony_ci#define QSFP_TX_CDR_APPLY_MASK 0x1UL 3578c2ecf20Sopenharmony_ci#define QSFP_TX_EQ_APPLY_MASK 0x1UL 3588c2ecf20Sopenharmony_ci#define QSFP_TX_CDR_MASK 0x1UL 3598c2ecf20Sopenharmony_ci#define QSFP_TX_EQ_MASK 0xFUL 3608c2ecf20Sopenharmony_ci#define TX_POSTCUR_MASK 0x1FUL 3618c2ecf20Sopenharmony_ci 3628c2ecf20Sopenharmony_ci#define TX_PRECUR_SMASK (TX_PRECUR_MASK << TX_PRECUR_SHIFT) 3638c2ecf20Sopenharmony_ci#define TX_ATTN_SMASK (TX_ATTN_MASK << TX_ATTN_SHIFT) 3648c2ecf20Sopenharmony_ci#define QSFP_TX_CDR_APPLY_SMASK (QSFP_TX_CDR_APPLY_MASK << \ 3658c2ecf20Sopenharmony_ci QSFP_TX_CDR_APPLY_SHIFT) 3668c2ecf20Sopenharmony_ci#define QSFP_TX_EQ_APPLY_SMASK (QSFP_TX_EQ_APPLY_MASK << \ 3678c2ecf20Sopenharmony_ci QSFP_TX_EQ_APPLY_SHIFT) 3688c2ecf20Sopenharmony_ci#define QSFP_TX_CDR_SMASK (QSFP_TX_CDR_MASK << QSFP_TX_CDR_SHIFT) 3698c2ecf20Sopenharmony_ci#define QSFP_TX_EQ_SMASK (QSFP_TX_EQ_MASK << QSFP_TX_EQ_SHIFT) 3708c2ecf20Sopenharmony_ci#define TX_POSTCUR_SMASK (TX_POSTCUR_MASK << TX_POSTCUR_SHIFT) 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci#define QSFP_RX_CDR_APPLY_SHIFT 0 3738c2ecf20Sopenharmony_ci#define QSFP_RX_EMP_APPLY_SHIFT 1 3748c2ecf20Sopenharmony_ci#define QSFP_RX_AMP_APPLY_SHIFT 2 3758c2ecf20Sopenharmony_ci#define QSFP_RX_CDR_SHIFT 3 3768c2ecf20Sopenharmony_ci#define QSFP_RX_EMP_SHIFT 4 3778c2ecf20Sopenharmony_ci#define QSFP_RX_AMP_SHIFT 8 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci#define QSFP_RX_CDR_APPLY_MASK 0x1UL 3808c2ecf20Sopenharmony_ci#define QSFP_RX_EMP_APPLY_MASK 0x1UL 3818c2ecf20Sopenharmony_ci#define QSFP_RX_AMP_APPLY_MASK 0x1UL 3828c2ecf20Sopenharmony_ci#define QSFP_RX_CDR_MASK 0x1UL 3838c2ecf20Sopenharmony_ci#define QSFP_RX_EMP_MASK 0xFUL 3848c2ecf20Sopenharmony_ci#define QSFP_RX_AMP_MASK 0x3UL 3858c2ecf20Sopenharmony_ci 3868c2ecf20Sopenharmony_ci#define QSFP_RX_CDR_APPLY_SMASK (QSFP_RX_CDR_APPLY_MASK << \ 3878c2ecf20Sopenharmony_ci QSFP_RX_CDR_APPLY_SHIFT) 3888c2ecf20Sopenharmony_ci#define QSFP_RX_EMP_APPLY_SMASK (QSFP_RX_EMP_APPLY_MASK << \ 3898c2ecf20Sopenharmony_ci QSFP_RX_EMP_APPLY_SHIFT) 3908c2ecf20Sopenharmony_ci#define QSFP_RX_AMP_APPLY_SMASK (QSFP_RX_AMP_APPLY_MASK << \ 3918c2ecf20Sopenharmony_ci QSFP_RX_AMP_APPLY_SHIFT) 3928c2ecf20Sopenharmony_ci#define QSFP_RX_CDR_SMASK (QSFP_RX_CDR_MASK << QSFP_RX_CDR_SHIFT) 3938c2ecf20Sopenharmony_ci#define QSFP_RX_EMP_SMASK (QSFP_RX_EMP_MASK << QSFP_RX_EMP_SHIFT) 3948c2ecf20Sopenharmony_ci#define QSFP_RX_AMP_SMASK (QSFP_RX_AMP_MASK << QSFP_RX_AMP_SHIFT) 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_ci#define BITMAP_VERSION 1 3978c2ecf20Sopenharmony_ci#define BITMAP_VERSION_SHIFT 44 3988c2ecf20Sopenharmony_ci#define BITMAP_VERSION_MASK 0xFUL 3998c2ecf20Sopenharmony_ci#define BITMAP_VERSION_SMASK (BITMAP_VERSION_MASK << \ 4008c2ecf20Sopenharmony_ci BITMAP_VERSION_SHIFT) 4018c2ecf20Sopenharmony_ci#define CHECKSUM_SHIFT 48 4028c2ecf20Sopenharmony_ci#define CHECKSUM_MASK 0xFFFFUL 4038c2ecf20Sopenharmony_ci#define CHECKSUM_SMASK (CHECKSUM_MASK << CHECKSUM_SHIFT) 4048c2ecf20Sopenharmony_ci 4058c2ecf20Sopenharmony_ci/* platform.c */ 4068c2ecf20Sopenharmony_civoid get_platform_config(struct hfi1_devdata *dd); 4078c2ecf20Sopenharmony_civoid free_platform_config(struct hfi1_devdata *dd); 4088c2ecf20Sopenharmony_civoid get_port_type(struct hfi1_pportdata *ppd); 4098c2ecf20Sopenharmony_ciint set_qsfp_tx(struct hfi1_pportdata *ppd, int on); 4108c2ecf20Sopenharmony_civoid tune_serdes(struct hfi1_pportdata *ppd); 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_ci#endif /*__PLATFORM_H*/ 413