18c2ecf20Sopenharmony_ci#ifndef _CHIP_H
28c2ecf20Sopenharmony_ci#define _CHIP_H
38c2ecf20Sopenharmony_ci/*
48c2ecf20Sopenharmony_ci * Copyright(c) 2015 - 2020 Intel Corporation.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license.  When using or
78c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify
128c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as
138c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but
168c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of
178c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
188c2ecf20Sopenharmony_ci * General Public License for more details.
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * BSD LICENSE
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without
238c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions
248c2ecf20Sopenharmony_ci * are met:
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci *  - Redistributions of source code must retain the above copyright
278c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer.
288c2ecf20Sopenharmony_ci *  - Redistributions in binary form must reproduce the above copyright
298c2ecf20Sopenharmony_ci *    notice, this list of conditions and the following disclaimer in
308c2ecf20Sopenharmony_ci *    the documentation and/or other materials provided with the
318c2ecf20Sopenharmony_ci *    distribution.
328c2ecf20Sopenharmony_ci *  - Neither the name of Intel Corporation nor the names of its
338c2ecf20Sopenharmony_ci *    contributors may be used to endorse or promote products derived
348c2ecf20Sopenharmony_ci *    from this software without specific prior written permission.
358c2ecf20Sopenharmony_ci *
368c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
378c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
388c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
398c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
408c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
418c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
428c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
438c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
448c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
458c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
468c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
478c2ecf20Sopenharmony_ci *
488c2ecf20Sopenharmony_ci */
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/*
518c2ecf20Sopenharmony_ci * This file contains all of the defines that is specific to the HFI chip
528c2ecf20Sopenharmony_ci */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/* sizes */
558c2ecf20Sopenharmony_ci#define BITS_PER_REGISTER (BITS_PER_BYTE * sizeof(u64))
568c2ecf20Sopenharmony_ci#define NUM_INTERRUPT_SOURCES 768
578c2ecf20Sopenharmony_ci#define RXE_NUM_CONTEXTS 160
588c2ecf20Sopenharmony_ci#define RXE_PER_CONTEXT_SIZE 0x1000	/* 4k */
598c2ecf20Sopenharmony_ci#define RXE_NUM_TID_FLOWS 32
608c2ecf20Sopenharmony_ci#define RXE_NUM_DATA_VL 8
618c2ecf20Sopenharmony_ci#define TXE_NUM_CONTEXTS 160
628c2ecf20Sopenharmony_ci#define TXE_NUM_SDMA_ENGINES 16
638c2ecf20Sopenharmony_ci#define NUM_CONTEXTS_PER_SET 8
648c2ecf20Sopenharmony_ci#define VL_ARB_HIGH_PRIO_TABLE_SIZE 16
658c2ecf20Sopenharmony_ci#define VL_ARB_LOW_PRIO_TABLE_SIZE 16
668c2ecf20Sopenharmony_ci#define VL_ARB_TABLE_SIZE 16
678c2ecf20Sopenharmony_ci#define TXE_NUM_32_BIT_COUNTER 7
688c2ecf20Sopenharmony_ci#define TXE_NUM_64_BIT_COUNTER 30
698c2ecf20Sopenharmony_ci#define TXE_NUM_DATA_VL 8
708c2ecf20Sopenharmony_ci#define TXE_PIO_SIZE (32 * 0x100000)	/* 32 MB */
718c2ecf20Sopenharmony_ci#define PIO_BLOCK_SIZE 64			/* bytes */
728c2ecf20Sopenharmony_ci#define SDMA_BLOCK_SIZE 64			/* bytes */
738c2ecf20Sopenharmony_ci#define RCV_BUF_BLOCK_SIZE 64               /* bytes */
748c2ecf20Sopenharmony_ci#define PIO_CMASK 0x7ff	/* counter mask for free and fill counters */
758c2ecf20Sopenharmony_ci#define MAX_EAGER_ENTRIES    2048	/* max receive eager entries */
768c2ecf20Sopenharmony_ci#define MAX_TID_PAIR_ENTRIES 1024	/* max receive expected pairs */
778c2ecf20Sopenharmony_ci/*
788c2ecf20Sopenharmony_ci * Virtual? Allocation Unit, defined as AU = 8*2^vAU, 64 bytes, AU is fixed
798c2ecf20Sopenharmony_ci * at 64 bytes for all generation one devices
808c2ecf20Sopenharmony_ci */
818c2ecf20Sopenharmony_ci#define CM_VAU 3
828c2ecf20Sopenharmony_ci/* HFI link credit count, AKA receive buffer depth (RBUF_DEPTH) */
838c2ecf20Sopenharmony_ci#define CM_GLOBAL_CREDITS 0x880
848c2ecf20Sopenharmony_ci/* Number of PKey entries in the HW */
858c2ecf20Sopenharmony_ci#define MAX_PKEY_VALUES 16
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#include "chip_registers.h"
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define RXE_PER_CONTEXT_USER   (RXE + RXE_PER_CONTEXT_OFFSET)
908c2ecf20Sopenharmony_ci#define TXE_PIO_SEND (TXE + TXE_PIO_SEND_OFFSET)
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/* PBC flags */
938c2ecf20Sopenharmony_ci#define PBC_INTR		BIT_ULL(31)
948c2ecf20Sopenharmony_ci#define PBC_DC_INFO_SHIFT	(30)
958c2ecf20Sopenharmony_ci#define PBC_DC_INFO		BIT_ULL(PBC_DC_INFO_SHIFT)
968c2ecf20Sopenharmony_ci#define PBC_TEST_EBP		BIT_ULL(29)
978c2ecf20Sopenharmony_ci#define PBC_PACKET_BYPASS	BIT_ULL(28)
988c2ecf20Sopenharmony_ci#define PBC_CREDIT_RETURN	BIT_ULL(25)
998c2ecf20Sopenharmony_ci#define PBC_INSERT_BYPASS_ICRC	BIT_ULL(24)
1008c2ecf20Sopenharmony_ci#define PBC_TEST_BAD_ICRC	BIT_ULL(23)
1018c2ecf20Sopenharmony_ci#define PBC_FECN		BIT_ULL(22)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/* PbcInsertHcrc field settings */
1048c2ecf20Sopenharmony_ci#define PBC_IHCRC_LKDETH 0x0	/* insert @ local KDETH offset */
1058c2ecf20Sopenharmony_ci#define PBC_IHCRC_GKDETH 0x1	/* insert @ global KDETH offset */
1068c2ecf20Sopenharmony_ci#define PBC_IHCRC_NONE   0x2	/* no HCRC inserted */
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* PBC fields */
1098c2ecf20Sopenharmony_ci#define PBC_STATIC_RATE_CONTROL_COUNT_SHIFT 32
1108c2ecf20Sopenharmony_ci#define PBC_STATIC_RATE_CONTROL_COUNT_MASK 0xffffull
1118c2ecf20Sopenharmony_ci#define PBC_STATIC_RATE_CONTROL_COUNT_SMASK \
1128c2ecf20Sopenharmony_ci	(PBC_STATIC_RATE_CONTROL_COUNT_MASK << \
1138c2ecf20Sopenharmony_ci	PBC_STATIC_RATE_CONTROL_COUNT_SHIFT)
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define PBC_INSERT_HCRC_SHIFT 26
1168c2ecf20Sopenharmony_ci#define PBC_INSERT_HCRC_MASK 0x3ull
1178c2ecf20Sopenharmony_ci#define PBC_INSERT_HCRC_SMASK \
1188c2ecf20Sopenharmony_ci	(PBC_INSERT_HCRC_MASK << PBC_INSERT_HCRC_SHIFT)
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci#define PBC_VL_SHIFT 12
1218c2ecf20Sopenharmony_ci#define PBC_VL_MASK 0xfull
1228c2ecf20Sopenharmony_ci#define PBC_VL_SMASK (PBC_VL_MASK << PBC_VL_SHIFT)
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#define PBC_LENGTH_DWS_SHIFT 0
1258c2ecf20Sopenharmony_ci#define PBC_LENGTH_DWS_MASK 0xfffull
1268c2ecf20Sopenharmony_ci#define PBC_LENGTH_DWS_SMASK \
1278c2ecf20Sopenharmony_ci	(PBC_LENGTH_DWS_MASK << PBC_LENGTH_DWS_SHIFT)
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci/* Credit Return Fields */
1308c2ecf20Sopenharmony_ci#define CR_COUNTER_SHIFT 0
1318c2ecf20Sopenharmony_ci#define CR_COUNTER_MASK 0x7ffull
1328c2ecf20Sopenharmony_ci#define CR_COUNTER_SMASK (CR_COUNTER_MASK << CR_COUNTER_SHIFT)
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define CR_STATUS_SHIFT 11
1358c2ecf20Sopenharmony_ci#define CR_STATUS_MASK 0x1ull
1368c2ecf20Sopenharmony_ci#define CR_STATUS_SMASK (CR_STATUS_MASK << CR_STATUS_SHIFT)
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_PBC_SHIFT 12
1398c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_PBC_MASK 0x1ull
1408c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_PBC_SMASK \
1418c2ecf20Sopenharmony_ci	(CR_CREDIT_RETURN_DUE_TO_PBC_MASK << \
1428c2ecf20Sopenharmony_ci	CR_CREDIT_RETURN_DUE_TO_PBC_SHIFT)
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_THRESHOLD_SHIFT 13
1458c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_THRESHOLD_MASK 0x1ull
1468c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_THRESHOLD_SMASK \
1478c2ecf20Sopenharmony_ci	(CR_CREDIT_RETURN_DUE_TO_THRESHOLD_MASK << \
1488c2ecf20Sopenharmony_ci	CR_CREDIT_RETURN_DUE_TO_THRESHOLD_SHIFT)
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_ERR_SHIFT 14
1518c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_ERR_MASK 0x1ull
1528c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_ERR_SMASK \
1538c2ecf20Sopenharmony_ci	(CR_CREDIT_RETURN_DUE_TO_ERR_MASK << \
1548c2ecf20Sopenharmony_ci	CR_CREDIT_RETURN_DUE_TO_ERR_SHIFT)
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_FORCE_SHIFT 15
1578c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_FORCE_MASK 0x1ull
1588c2ecf20Sopenharmony_ci#define CR_CREDIT_RETURN_DUE_TO_FORCE_SMASK \
1598c2ecf20Sopenharmony_ci	(CR_CREDIT_RETURN_DUE_TO_FORCE_MASK << \
1608c2ecf20Sopenharmony_ci	CR_CREDIT_RETURN_DUE_TO_FORCE_SHIFT)
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci/* Specific IRQ sources */
1638c2ecf20Sopenharmony_ci#define CCE_ERR_INT		  0
1648c2ecf20Sopenharmony_ci#define RXE_ERR_INT		  1
1658c2ecf20Sopenharmony_ci#define MISC_ERR_INT		  2
1668c2ecf20Sopenharmony_ci#define PIO_ERR_INT		  4
1678c2ecf20Sopenharmony_ci#define SDMA_ERR_INT		  5
1688c2ecf20Sopenharmony_ci#define EGRESS_ERR_INT		  6
1698c2ecf20Sopenharmony_ci#define TXE_ERR_INT		  7
1708c2ecf20Sopenharmony_ci#define PBC_INT			240
1718c2ecf20Sopenharmony_ci#define GPIO_ASSERT_INT		241
1728c2ecf20Sopenharmony_ci#define QSFP1_INT		242
1738c2ecf20Sopenharmony_ci#define QSFP2_INT		243
1748c2ecf20Sopenharmony_ci#define TCRIT_INT		244
1758c2ecf20Sopenharmony_ci
1768c2ecf20Sopenharmony_ci/* interrupt source ranges */
1778c2ecf20Sopenharmony_ci#define IS_FIRST_SOURCE		CCE_ERR_INT
1788c2ecf20Sopenharmony_ci#define IS_GENERAL_ERR_START		  0
1798c2ecf20Sopenharmony_ci#define IS_SDMAENG_ERR_START		 16
1808c2ecf20Sopenharmony_ci#define IS_SENDCTXT_ERR_START		 32
1818c2ecf20Sopenharmony_ci#define IS_SDMA_START			192
1828c2ecf20Sopenharmony_ci#define IS_SDMA_PROGRESS_START		208
1838c2ecf20Sopenharmony_ci#define IS_SDMA_IDLE_START		224
1848c2ecf20Sopenharmony_ci#define IS_VARIOUS_START		240
1858c2ecf20Sopenharmony_ci#define IS_DC_START			248
1868c2ecf20Sopenharmony_ci#define IS_RCVAVAIL_START		256
1878c2ecf20Sopenharmony_ci#define IS_RCVURGENT_START		416
1888c2ecf20Sopenharmony_ci#define IS_SENDCREDIT_START		576
1898c2ecf20Sopenharmony_ci#define IS_RESERVED_START		736
1908c2ecf20Sopenharmony_ci#define IS_LAST_SOURCE			767
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/* derived interrupt source values */
1938c2ecf20Sopenharmony_ci#define IS_GENERAL_ERR_END		7
1948c2ecf20Sopenharmony_ci#define IS_SDMAENG_ERR_END		31
1958c2ecf20Sopenharmony_ci#define IS_SENDCTXT_ERR_END		191
1968c2ecf20Sopenharmony_ci#define IS_SDMA_END                     207
1978c2ecf20Sopenharmony_ci#define IS_SDMA_PROGRESS_END            223
1988c2ecf20Sopenharmony_ci#define IS_SDMA_IDLE_END		239
1998c2ecf20Sopenharmony_ci#define IS_VARIOUS_END			244
2008c2ecf20Sopenharmony_ci#define IS_DC_END			255
2018c2ecf20Sopenharmony_ci#define IS_RCVAVAIL_END			415
2028c2ecf20Sopenharmony_ci#define IS_RCVURGENT_END		575
2038c2ecf20Sopenharmony_ci#define IS_SENDCREDIT_END		735
2048c2ecf20Sopenharmony_ci#define IS_RESERVED_END			IS_LAST_SOURCE
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci/* DCC_CFG_PORT_CONFIG logical link states */
2078c2ecf20Sopenharmony_ci#define LSTATE_DOWN    0x1
2088c2ecf20Sopenharmony_ci#define LSTATE_INIT    0x2
2098c2ecf20Sopenharmony_ci#define LSTATE_ARMED   0x3
2108c2ecf20Sopenharmony_ci#define LSTATE_ACTIVE  0x4
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/* DCC_CFG_RESET reset states */
2138c2ecf20Sopenharmony_ci#define LCB_RX_FPE_TX_FPE_INTO_RESET   (DCC_CFG_RESET_RESET_LCB    | \
2148c2ecf20Sopenharmony_ci					DCC_CFG_RESET_RESET_TX_FPE | \
2158c2ecf20Sopenharmony_ci					DCC_CFG_RESET_RESET_RX_FPE | \
2168c2ecf20Sopenharmony_ci					DCC_CFG_RESET_ENABLE_CCLK_BCC)
2178c2ecf20Sopenharmony_ci					/* 0x17 */
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#define LCB_RX_FPE_TX_FPE_OUT_OF_RESET  DCC_CFG_RESET_ENABLE_CCLK_BCC /* 0x10 */
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci/* DC8051_STS_CUR_STATE port values (physical link states) */
2228c2ecf20Sopenharmony_ci#define PLS_DISABLED			   0x30
2238c2ecf20Sopenharmony_ci#define PLS_OFFLINE				   0x90
2248c2ecf20Sopenharmony_ci#define PLS_OFFLINE_QUIET			   0x90
2258c2ecf20Sopenharmony_ci#define PLS_OFFLINE_PLANNED_DOWN_INFORM	   0x91
2268c2ecf20Sopenharmony_ci#define PLS_OFFLINE_READY_TO_QUIET_LT	   0x92
2278c2ecf20Sopenharmony_ci#define PLS_OFFLINE_REPORT_FAILURE		   0x93
2288c2ecf20Sopenharmony_ci#define PLS_OFFLINE_READY_TO_QUIET_BCC	   0x94
2298c2ecf20Sopenharmony_ci#define PLS_OFFLINE_QUIET_DURATION	   0x95
2308c2ecf20Sopenharmony_ci#define PLS_POLLING				   0x20
2318c2ecf20Sopenharmony_ci#define PLS_POLLING_QUIET			   0x20
2328c2ecf20Sopenharmony_ci#define PLS_POLLING_ACTIVE			   0x21
2338c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY			   0x40
2348c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_DEBOUCE		   0x40
2358c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_ESTCOMM		   0x41
2368c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_ESTCOMM_TXRX_HUNT	   0x42
2378c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_ESTCOMM_LOCAL_COMPLETE   0x43
2388c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_OPTEQ			   0x44
2398c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_OPTEQ_OPTIMIZING	   0x44
2408c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_OPTEQ_LOCAL_COMPLETE	   0x45
2418c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_VERIFYCAP		   0x46
2428c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_VERIFYCAP_EXCHANGE	   0x46
2438c2ecf20Sopenharmony_ci#define PLS_CONFIGPHY_VERIFYCAP_LOCAL_COMPLETE 0x47
2448c2ecf20Sopenharmony_ci#define PLS_CONFIGLT			   0x48
2458c2ecf20Sopenharmony_ci#define PLS_CONFIGLT_CONFIGURE		   0x48
2468c2ecf20Sopenharmony_ci#define PLS_CONFIGLT_LINK_TRANSFER_ACTIVE	   0x49
2478c2ecf20Sopenharmony_ci#define PLS_LINKUP				   0x50
2488c2ecf20Sopenharmony_ci#define PLS_PHYTEST				   0xB0
2498c2ecf20Sopenharmony_ci#define PLS_INTERNAL_SERDES_LOOPBACK	   0xe1
2508c2ecf20Sopenharmony_ci#define PLS_QUICK_LINKUP			   0xe2
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci/* DC_DC8051_CFG_HOST_CMD_0.REQ_TYPE - 8051 host commands */
2538c2ecf20Sopenharmony_ci#define HCMD_LOAD_CONFIG_DATA  0x01
2548c2ecf20Sopenharmony_ci#define HCMD_READ_CONFIG_DATA  0x02
2558c2ecf20Sopenharmony_ci#define HCMD_CHANGE_PHY_STATE  0x03
2568c2ecf20Sopenharmony_ci#define HCMD_SEND_LCB_IDLE_MSG 0x04
2578c2ecf20Sopenharmony_ci#define HCMD_MISC		   0x05
2588c2ecf20Sopenharmony_ci#define HCMD_READ_LCB_IDLE_MSG 0x06
2598c2ecf20Sopenharmony_ci#define HCMD_READ_LCB_CSR      0x07
2608c2ecf20Sopenharmony_ci#define HCMD_WRITE_LCB_CSR     0x08
2618c2ecf20Sopenharmony_ci#define HCMD_INTERFACE_TEST	   0xff
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/* DC_DC8051_CFG_HOST_CMD_1.RETURN_CODE - 8051 host command return */
2648c2ecf20Sopenharmony_ci#define HCMD_SUCCESS 2
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci/* DC_DC8051_DBG_ERR_INFO_SET_BY_8051.ERROR - error flags */
2678c2ecf20Sopenharmony_ci#define SPICO_ROM_FAILED		BIT(0)
2688c2ecf20Sopenharmony_ci#define UNKNOWN_FRAME			BIT(1)
2698c2ecf20Sopenharmony_ci#define TARGET_BER_NOT_MET		BIT(2)
2708c2ecf20Sopenharmony_ci#define FAILED_SERDES_INTERNAL_LOOPBACK	BIT(3)
2718c2ecf20Sopenharmony_ci#define FAILED_SERDES_INIT		BIT(4)
2728c2ecf20Sopenharmony_ci#define FAILED_LNI_POLLING		BIT(5)
2738c2ecf20Sopenharmony_ci#define FAILED_LNI_DEBOUNCE		BIT(6)
2748c2ecf20Sopenharmony_ci#define FAILED_LNI_ESTBCOMM		BIT(7)
2758c2ecf20Sopenharmony_ci#define FAILED_LNI_OPTEQ		BIT(8)
2768c2ecf20Sopenharmony_ci#define FAILED_LNI_VERIFY_CAP1		BIT(9)
2778c2ecf20Sopenharmony_ci#define FAILED_LNI_VERIFY_CAP2		BIT(10)
2788c2ecf20Sopenharmony_ci#define FAILED_LNI_CONFIGLT		BIT(11)
2798c2ecf20Sopenharmony_ci#define HOST_HANDSHAKE_TIMEOUT		BIT(12)
2808c2ecf20Sopenharmony_ci#define EXTERNAL_DEVICE_REQ_TIMEOUT	BIT(13)
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci#define FAILED_LNI (FAILED_LNI_POLLING | FAILED_LNI_DEBOUNCE \
2838c2ecf20Sopenharmony_ci			| FAILED_LNI_ESTBCOMM | FAILED_LNI_OPTEQ \
2848c2ecf20Sopenharmony_ci			| FAILED_LNI_VERIFY_CAP1 \
2858c2ecf20Sopenharmony_ci			| FAILED_LNI_VERIFY_CAP2 \
2868c2ecf20Sopenharmony_ci			| FAILED_LNI_CONFIGLT | HOST_HANDSHAKE_TIMEOUT \
2878c2ecf20Sopenharmony_ci			| EXTERNAL_DEVICE_REQ_TIMEOUT)
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/* DC_DC8051_DBG_ERR_INFO_SET_BY_8051.HOST_MSG - host message flags */
2908c2ecf20Sopenharmony_ci#define HOST_REQ_DONE		BIT(0)
2918c2ecf20Sopenharmony_ci#define BC_PWR_MGM_MSG		BIT(1)
2928c2ecf20Sopenharmony_ci#define BC_SMA_MSG		BIT(2)
2938c2ecf20Sopenharmony_ci#define BC_BCC_UNKNOWN_MSG	BIT(3)
2948c2ecf20Sopenharmony_ci#define BC_IDLE_UNKNOWN_MSG	BIT(4)
2958c2ecf20Sopenharmony_ci#define EXT_DEVICE_CFG_REQ	BIT(5)
2968c2ecf20Sopenharmony_ci#define VERIFY_CAP_FRAME	BIT(6)
2978c2ecf20Sopenharmony_ci#define LINKUP_ACHIEVED		BIT(7)
2988c2ecf20Sopenharmony_ci#define LINK_GOING_DOWN		BIT(8)
2998c2ecf20Sopenharmony_ci#define LINK_WIDTH_DOWNGRADED	BIT(9)
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci/* DC_DC8051_CFG_EXT_DEV_1.REQ_TYPE - 8051 host requests */
3028c2ecf20Sopenharmony_ci#define HREQ_LOAD_CONFIG	0x01
3038c2ecf20Sopenharmony_ci#define HREQ_SAVE_CONFIG	0x02
3048c2ecf20Sopenharmony_ci#define HREQ_READ_CONFIG	0x03
3058c2ecf20Sopenharmony_ci#define HREQ_SET_TX_EQ_ABS	0x04
3068c2ecf20Sopenharmony_ci#define HREQ_SET_TX_EQ_REL	0x05
3078c2ecf20Sopenharmony_ci#define HREQ_ENABLE		0x06
3088c2ecf20Sopenharmony_ci#define HREQ_LCB_RESET		0x07
3098c2ecf20Sopenharmony_ci#define HREQ_CONFIG_DONE	0xfe
3108c2ecf20Sopenharmony_ci#define HREQ_INTERFACE_TEST	0xff
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci/* DC_DC8051_CFG_EXT_DEV_0.RETURN_CODE - 8051 host request return codes */
3138c2ecf20Sopenharmony_ci#define HREQ_INVALID		0x01
3148c2ecf20Sopenharmony_ci#define HREQ_SUCCESS		0x02
3158c2ecf20Sopenharmony_ci#define HREQ_NOT_SUPPORTED		0x03
3168c2ecf20Sopenharmony_ci#define HREQ_FEATURE_NOT_SUPPORTED	0x04 /* request specific feature */
3178c2ecf20Sopenharmony_ci#define HREQ_REQUEST_REJECTED	0xfe
3188c2ecf20Sopenharmony_ci#define HREQ_EXECUTION_ONGOING	0xff
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci/* MISC host command functions */
3218c2ecf20Sopenharmony_ci#define HCMD_MISC_REQUEST_LCB_ACCESS 0x1
3228c2ecf20Sopenharmony_ci#define HCMD_MISC_GRANT_LCB_ACCESS   0x2
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci/* idle flit message types */
3258c2ecf20Sopenharmony_ci#define IDLE_PHYSICAL_LINK_MGMT 0x1
3268c2ecf20Sopenharmony_ci#define IDLE_CRU		    0x2
3278c2ecf20Sopenharmony_ci#define IDLE_SMA		    0x3
3288c2ecf20Sopenharmony_ci#define IDLE_POWER_MGMT	    0x4
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci/* idle flit message send fields (both send and read) */
3318c2ecf20Sopenharmony_ci#define IDLE_PAYLOAD_MASK 0xffffffffffull /* 40 bits */
3328c2ecf20Sopenharmony_ci#define IDLE_PAYLOAD_SHIFT 8
3338c2ecf20Sopenharmony_ci#define IDLE_MSG_TYPE_MASK 0xf
3348c2ecf20Sopenharmony_ci#define IDLE_MSG_TYPE_SHIFT 0
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci/* idle flit message read fields */
3378c2ecf20Sopenharmony_ci#define READ_IDLE_MSG_TYPE_MASK 0xf
3388c2ecf20Sopenharmony_ci#define READ_IDLE_MSG_TYPE_SHIFT 0
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci/* SMA idle flit payload commands */
3418c2ecf20Sopenharmony_ci#define SMA_IDLE_ARM	1
3428c2ecf20Sopenharmony_ci#define SMA_IDLE_ACTIVE 2
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci/* DC_DC8051_CFG_MODE.GENERAL bits */
3458c2ecf20Sopenharmony_ci#define DISABLE_SELF_GUID_CHECK 0x2
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci/* Bad L2 frame error code */
3488c2ecf20Sopenharmony_ci#define BAD_L2_ERR      0x6
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci/*
3518c2ecf20Sopenharmony_ci * Eager buffer minimum and maximum sizes supported by the hardware.
3528c2ecf20Sopenharmony_ci * All power-of-two sizes in between are supported as well.
3538c2ecf20Sopenharmony_ci * MAX_EAGER_BUFFER_TOTAL is the maximum size of memory
3548c2ecf20Sopenharmony_ci * allocatable for Eager buffer to a single context. All others
3558c2ecf20Sopenharmony_ci * are limits for the RcvArray entries.
3568c2ecf20Sopenharmony_ci */
3578c2ecf20Sopenharmony_ci#define MIN_EAGER_BUFFER       (4 * 1024)
3588c2ecf20Sopenharmony_ci#define MAX_EAGER_BUFFER       (256 * 1024)
3598c2ecf20Sopenharmony_ci#define MAX_EAGER_BUFFER_TOTAL (64 * (1 << 20)) /* max per ctxt 64MB */
3608c2ecf20Sopenharmony_ci#define MAX_EXPECTED_BUFFER    (2048 * 1024)
3618c2ecf20Sopenharmony_ci#define HFI1_MIN_HDRQ_EGRBUF_CNT 32
3628c2ecf20Sopenharmony_ci#define HFI1_MAX_HDRQ_EGRBUF_CNT 16352
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci/*
3658c2ecf20Sopenharmony_ci * Receive expected base and count and eager base and count increment -
3668c2ecf20Sopenharmony_ci * the CSR fields hold multiples of this value.
3678c2ecf20Sopenharmony_ci */
3688c2ecf20Sopenharmony_ci#define RCV_SHIFT 3
3698c2ecf20Sopenharmony_ci#define RCV_INCREMENT BIT(RCV_SHIFT)
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci/*
3728c2ecf20Sopenharmony_ci * Receive header queue entry increment - the CSR holds multiples of
3738c2ecf20Sopenharmony_ci * this value.
3748c2ecf20Sopenharmony_ci */
3758c2ecf20Sopenharmony_ci#define HDRQ_SIZE_SHIFT 5
3768c2ecf20Sopenharmony_ci#define HDRQ_INCREMENT BIT(HDRQ_SIZE_SHIFT)
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ci/*
3798c2ecf20Sopenharmony_ci * Freeze handling flags
3808c2ecf20Sopenharmony_ci */
3818c2ecf20Sopenharmony_ci#define FREEZE_ABORT     0x01	/* do not do recovery */
3828c2ecf20Sopenharmony_ci#define FREEZE_SELF	     0x02	/* initiate the freeze */
3838c2ecf20Sopenharmony_ci#define FREEZE_LINK_DOWN 0x04	/* link is down */
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci/*
3868c2ecf20Sopenharmony_ci * Chip implementation codes.
3878c2ecf20Sopenharmony_ci */
3888c2ecf20Sopenharmony_ci#define ICODE_RTL_SILICON		0x00
3898c2ecf20Sopenharmony_ci#define ICODE_RTL_VCS_SIMULATION	0x01
3908c2ecf20Sopenharmony_ci#define ICODE_FPGA_EMULATION	0x02
3918c2ecf20Sopenharmony_ci#define ICODE_FUNCTIONAL_SIMULATOR	0x03
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci/*
3948c2ecf20Sopenharmony_ci * 8051 data memory size.
3958c2ecf20Sopenharmony_ci */
3968c2ecf20Sopenharmony_ci#define DC8051_DATA_MEM_SIZE 0x1000
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci/*
3998c2ecf20Sopenharmony_ci * 8051 firmware registers
4008c2ecf20Sopenharmony_ci */
4018c2ecf20Sopenharmony_ci#define NUM_GENERAL_FIELDS 0x17
4028c2ecf20Sopenharmony_ci#define NUM_LANE_FIELDS    0x8
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci/* 8051 general register Field IDs */
4058c2ecf20Sopenharmony_ci#define LINK_OPTIMIZATION_SETTINGS   0x00
4068c2ecf20Sopenharmony_ci#define LINK_TUNING_PARAMETERS	     0x02
4078c2ecf20Sopenharmony_ci#define DC_HOST_COMM_SETTINGS	     0x03
4088c2ecf20Sopenharmony_ci#define TX_SETTINGS		     0x06
4098c2ecf20Sopenharmony_ci#define VERIFY_CAP_LOCAL_PHY	     0x07
4108c2ecf20Sopenharmony_ci#define VERIFY_CAP_LOCAL_FABRIC	     0x08
4118c2ecf20Sopenharmony_ci#define VERIFY_CAP_LOCAL_LINK_MODE   0x09
4128c2ecf20Sopenharmony_ci#define LOCAL_DEVICE_ID		     0x0a
4138c2ecf20Sopenharmony_ci#define RESERVED_REGISTERS	     0x0b
4148c2ecf20Sopenharmony_ci#define LOCAL_LNI_INFO		     0x0c
4158c2ecf20Sopenharmony_ci#define REMOTE_LNI_INFO              0x0d
4168c2ecf20Sopenharmony_ci#define MISC_STATUS		     0x0e
4178c2ecf20Sopenharmony_ci#define VERIFY_CAP_REMOTE_PHY	     0x0f
4188c2ecf20Sopenharmony_ci#define VERIFY_CAP_REMOTE_FABRIC     0x10
4198c2ecf20Sopenharmony_ci#define VERIFY_CAP_REMOTE_LINK_WIDTH 0x11
4208c2ecf20Sopenharmony_ci#define LAST_LOCAL_STATE_COMPLETE    0x12
4218c2ecf20Sopenharmony_ci#define LAST_REMOTE_STATE_COMPLETE   0x13
4228c2ecf20Sopenharmony_ci#define LINK_QUALITY_INFO            0x14
4238c2ecf20Sopenharmony_ci#define REMOTE_DEVICE_ID	     0x15
4248c2ecf20Sopenharmony_ci#define LINK_DOWN_REASON	     0x16 /* first byte of offset 0x16 */
4258c2ecf20Sopenharmony_ci#define VERSION_PATCH		     0x16 /* last byte of offset 0x16 */
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci/* 8051 lane specific register field IDs */
4288c2ecf20Sopenharmony_ci#define TX_EQ_SETTINGS		0x00
4298c2ecf20Sopenharmony_ci#define CHANNEL_LOSS_SETTINGS	0x05
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ci/* Lane ID for general configuration registers */
4328c2ecf20Sopenharmony_ci#define GENERAL_CONFIG 4
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci/* LINK_TUNING_PARAMETERS fields */
4358c2ecf20Sopenharmony_ci#define TUNING_METHOD_SHIFT 24
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci/* LINK_OPTIMIZATION_SETTINGS fields */
4388c2ecf20Sopenharmony_ci#define ENABLE_EXT_DEV_CONFIG_SHIFT 24
4398c2ecf20Sopenharmony_ci
4408c2ecf20Sopenharmony_ci/* LOAD_DATA 8051 command shifts and fields */
4418c2ecf20Sopenharmony_ci#define LOAD_DATA_FIELD_ID_SHIFT 40
4428c2ecf20Sopenharmony_ci#define LOAD_DATA_FIELD_ID_MASK 0xfull
4438c2ecf20Sopenharmony_ci#define LOAD_DATA_LANE_ID_SHIFT 32
4448c2ecf20Sopenharmony_ci#define LOAD_DATA_LANE_ID_MASK 0xfull
4458c2ecf20Sopenharmony_ci#define LOAD_DATA_DATA_SHIFT   0x0
4468c2ecf20Sopenharmony_ci#define LOAD_DATA_DATA_MASK   0xffffffffull
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci/* READ_DATA 8051 command shifts and fields */
4498c2ecf20Sopenharmony_ci#define READ_DATA_FIELD_ID_SHIFT 40
4508c2ecf20Sopenharmony_ci#define READ_DATA_FIELD_ID_MASK 0xffull
4518c2ecf20Sopenharmony_ci#define READ_DATA_LANE_ID_SHIFT 32
4528c2ecf20Sopenharmony_ci#define READ_DATA_LANE_ID_MASK 0xffull
4538c2ecf20Sopenharmony_ci#define READ_DATA_DATA_SHIFT   0x0
4548c2ecf20Sopenharmony_ci#define READ_DATA_DATA_MASK   0xffffffffull
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_ci/* TX settings fields */
4578c2ecf20Sopenharmony_ci#define ENABLE_LANE_TX_SHIFT		0
4588c2ecf20Sopenharmony_ci#define ENABLE_LANE_TX_MASK		0xff
4598c2ecf20Sopenharmony_ci#define TX_POLARITY_INVERSION_SHIFT	8
4608c2ecf20Sopenharmony_ci#define TX_POLARITY_INVERSION_MASK	0xff
4618c2ecf20Sopenharmony_ci#define RX_POLARITY_INVERSION_SHIFT	16
4628c2ecf20Sopenharmony_ci#define RX_POLARITY_INVERSION_MASK	0xff
4638c2ecf20Sopenharmony_ci#define MAX_RATE_SHIFT			24
4648c2ecf20Sopenharmony_ci#define MAX_RATE_MASK			0xff
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci/* verify capability PHY fields */
4678c2ecf20Sopenharmony_ci#define CONTINIOUS_REMOTE_UPDATE_SUPPORT_SHIFT	0x4
4688c2ecf20Sopenharmony_ci#define CONTINIOUS_REMOTE_UPDATE_SUPPORT_MASK	0x1
4698c2ecf20Sopenharmony_ci#define POWER_MANAGEMENT_SHIFT			0x0
4708c2ecf20Sopenharmony_ci#define POWER_MANAGEMENT_MASK			0xf
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci/* 8051 lane register Field IDs */
4738c2ecf20Sopenharmony_ci#define SPICO_FW_VERSION 0x7	/* SPICO firmware version */
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci/* SPICO firmware version fields */
4768c2ecf20Sopenharmony_ci#define SPICO_ROM_VERSION_SHIFT 0
4778c2ecf20Sopenharmony_ci#define SPICO_ROM_VERSION_MASK 0xffff
4788c2ecf20Sopenharmony_ci#define SPICO_ROM_PROD_ID_SHIFT 16
4798c2ecf20Sopenharmony_ci#define SPICO_ROM_PROD_ID_MASK 0xffff
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_ci/* verify capability fabric fields */
4828c2ecf20Sopenharmony_ci#define VAU_SHIFT	0
4838c2ecf20Sopenharmony_ci#define VAU_MASK	0x0007
4848c2ecf20Sopenharmony_ci#define Z_SHIFT		3
4858c2ecf20Sopenharmony_ci#define Z_MASK		0x0001
4868c2ecf20Sopenharmony_ci#define VCU_SHIFT	4
4878c2ecf20Sopenharmony_ci#define VCU_MASK	0x0007
4888c2ecf20Sopenharmony_ci#define VL15BUF_SHIFT	8
4898c2ecf20Sopenharmony_ci#define VL15BUF_MASK	0x0fff
4908c2ecf20Sopenharmony_ci#define CRC_SIZES_SHIFT 20
4918c2ecf20Sopenharmony_ci#define CRC_SIZES_MASK	0x7
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci/* verify capability local link width fields */
4948c2ecf20Sopenharmony_ci#define LINK_WIDTH_SHIFT 0		/* also for remote link width */
4958c2ecf20Sopenharmony_ci#define LINK_WIDTH_MASK 0xffff		/* also for remote link width */
4968c2ecf20Sopenharmony_ci#define LOCAL_FLAG_BITS_SHIFT 16
4978c2ecf20Sopenharmony_ci#define LOCAL_FLAG_BITS_MASK 0xff
4988c2ecf20Sopenharmony_ci#define MISC_CONFIG_BITS_SHIFT 24
4998c2ecf20Sopenharmony_ci#define MISC_CONFIG_BITS_MASK 0xff
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ci/* verify capability remote link width fields */
5028c2ecf20Sopenharmony_ci#define REMOTE_TX_RATE_SHIFT 16
5038c2ecf20Sopenharmony_ci#define REMOTE_TX_RATE_MASK 0xff
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci/* LOCAL_DEVICE_ID fields */
5068c2ecf20Sopenharmony_ci#define LOCAL_DEVICE_REV_SHIFT 0
5078c2ecf20Sopenharmony_ci#define LOCAL_DEVICE_REV_MASK 0xff
5088c2ecf20Sopenharmony_ci#define LOCAL_DEVICE_ID_SHIFT 8
5098c2ecf20Sopenharmony_ci#define LOCAL_DEVICE_ID_MASK 0xffff
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_ci/* REMOTE_DEVICE_ID fields */
5128c2ecf20Sopenharmony_ci#define REMOTE_DEVICE_REV_SHIFT 0
5138c2ecf20Sopenharmony_ci#define REMOTE_DEVICE_REV_MASK 0xff
5148c2ecf20Sopenharmony_ci#define REMOTE_DEVICE_ID_SHIFT 8
5158c2ecf20Sopenharmony_ci#define REMOTE_DEVICE_ID_MASK 0xffff
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci/* local LNI link width fields */
5188c2ecf20Sopenharmony_ci#define ENABLE_LANE_RX_SHIFT 16
5198c2ecf20Sopenharmony_ci#define ENABLE_LANE_RX_MASK  0xff
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci/* mask, shift for reading 'mgmt_enabled' value from REMOTE_LNI_INFO field */
5228c2ecf20Sopenharmony_ci#define MGMT_ALLOWED_SHIFT 23
5238c2ecf20Sopenharmony_ci#define MGMT_ALLOWED_MASK 0x1
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci/* mask, shift for 'link_quality' within LINK_QUALITY_INFO field */
5268c2ecf20Sopenharmony_ci#define LINK_QUALITY_SHIFT 24
5278c2ecf20Sopenharmony_ci#define LINK_QUALITY_MASK  0x7
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci/*
5308c2ecf20Sopenharmony_ci * mask, shift for reading 'planned_down_remote_reason_code'
5318c2ecf20Sopenharmony_ci * from LINK_QUALITY_INFO field
5328c2ecf20Sopenharmony_ci */
5338c2ecf20Sopenharmony_ci#define DOWN_REMOTE_REASON_SHIFT 16
5348c2ecf20Sopenharmony_ci#define DOWN_REMOTE_REASON_MASK  0xff
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ci#define HOST_INTERFACE_VERSION 1
5378c2ecf20Sopenharmony_ci#define HOST_INTERFACE_VERSION_SHIFT 16
5388c2ecf20Sopenharmony_ci#define HOST_INTERFACE_VERSION_MASK  0xff
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci/* verify capability PHY power management bits */
5418c2ecf20Sopenharmony_ci#define PWRM_BER_CONTROL	0x1
5428c2ecf20Sopenharmony_ci#define PWRM_BANDWIDTH_CONTROL	0x2
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_ci/* 8051 link down reasons */
5458c2ecf20Sopenharmony_ci#define LDR_LINK_TRANSFER_ACTIVE_LOW   0xa
5468c2ecf20Sopenharmony_ci#define LDR_RECEIVED_LINKDOWN_IDLE_MSG 0xb
5478c2ecf20Sopenharmony_ci#define LDR_RECEIVED_HOST_OFFLINE_REQ  0xc
5488c2ecf20Sopenharmony_ci
5498c2ecf20Sopenharmony_ci/* verify capability fabric CRC size bits */
5508c2ecf20Sopenharmony_cienum {
5518c2ecf20Sopenharmony_ci	CAP_CRC_14B = (1 << 0), /* 14b CRC */
5528c2ecf20Sopenharmony_ci	CAP_CRC_48B = (1 << 1), /* 48b CRC */
5538c2ecf20Sopenharmony_ci	CAP_CRC_12B_16B_PER_LANE = (1 << 2) /* 12b-16b per lane CRC */
5548c2ecf20Sopenharmony_ci};
5558c2ecf20Sopenharmony_ci
5568c2ecf20Sopenharmony_ci#define SUPPORTED_CRCS (CAP_CRC_14B | CAP_CRC_48B)
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci/* misc status version fields */
5598c2ecf20Sopenharmony_ci#define STS_FM_VERSION_MINOR_SHIFT 16
5608c2ecf20Sopenharmony_ci#define STS_FM_VERSION_MINOR_MASK  0xff
5618c2ecf20Sopenharmony_ci#define STS_FM_VERSION_MAJOR_SHIFT 24
5628c2ecf20Sopenharmony_ci#define STS_FM_VERSION_MAJOR_MASK  0xff
5638c2ecf20Sopenharmony_ci#define STS_FM_VERSION_PATCH_SHIFT 24
5648c2ecf20Sopenharmony_ci#define STS_FM_VERSION_PATCH_MASK  0xff
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci/* LCB_CFG_CRC_MODE TX_VAL and RX_VAL CRC mode values */
5678c2ecf20Sopenharmony_ci#define LCB_CRC_16B			0x0	/* 16b CRC */
5688c2ecf20Sopenharmony_ci#define LCB_CRC_14B			0x1	/* 14b CRC */
5698c2ecf20Sopenharmony_ci#define LCB_CRC_48B			0x2	/* 48b CRC */
5708c2ecf20Sopenharmony_ci#define LCB_CRC_12B_16B_PER_LANE	0x3	/* 12b-16b per lane CRC */
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci/*
5738c2ecf20Sopenharmony_ci * the following enum is (almost) a copy/paste of the definition
5748c2ecf20Sopenharmony_ci * in the OPA spec, section 20.2.2.6.8 (PortInfo)
5758c2ecf20Sopenharmony_ci */
5768c2ecf20Sopenharmony_cienum {
5778c2ecf20Sopenharmony_ci	PORT_LTP_CRC_MODE_NONE = 0,
5788c2ecf20Sopenharmony_ci	PORT_LTP_CRC_MODE_14 = 1, /* 14-bit LTP CRC mode (optional) */
5798c2ecf20Sopenharmony_ci	PORT_LTP_CRC_MODE_16 = 2, /* 16-bit LTP CRC mode */
5808c2ecf20Sopenharmony_ci	PORT_LTP_CRC_MODE_48 = 4,
5818c2ecf20Sopenharmony_ci		/* 48-bit overlapping LTP CRC mode (optional) */
5828c2ecf20Sopenharmony_ci	PORT_LTP_CRC_MODE_PER_LANE = 8
5838c2ecf20Sopenharmony_ci		/* 12 to 16 bit per lane LTP CRC mode (optional) */
5848c2ecf20Sopenharmony_ci};
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci/* timeouts */
5878c2ecf20Sopenharmony_ci#define LINK_RESTART_DELAY 1000		/* link restart delay, in ms */
5888c2ecf20Sopenharmony_ci#define TIMEOUT_8051_START 5000         /* 8051 start timeout, in ms */
5898c2ecf20Sopenharmony_ci#define DC8051_COMMAND_TIMEOUT 1000	/* DC8051 command timeout, in ms */
5908c2ecf20Sopenharmony_ci#define FREEZE_STATUS_TIMEOUT 20	/* wait for freeze indicators, in ms */
5918c2ecf20Sopenharmony_ci#define VL_STATUS_CLEAR_TIMEOUT 5000	/* per-VL status clear, in ms */
5928c2ecf20Sopenharmony_ci#define CCE_STATUS_TIMEOUT 10		/* time to clear CCE Status, in ms */
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci/* cclock tick time, in picoseconds per tick: 1/speed * 10^12  */
5958c2ecf20Sopenharmony_ci#define ASIC_CCLOCK_PS  1242	/* 805 MHz */
5968c2ecf20Sopenharmony_ci#define FPGA_CCLOCK_PS 30300	/*  33 MHz */
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ci/*
5998c2ecf20Sopenharmony_ci * Mask of enabled MISC errors.  Do not enable the two RSA engine errors -
6008c2ecf20Sopenharmony_ci * see firmware.c:run_rsa() for details.
6018c2ecf20Sopenharmony_ci */
6028c2ecf20Sopenharmony_ci#define DRIVER_MISC_MASK \
6038c2ecf20Sopenharmony_ci	(~(MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK \
6048c2ecf20Sopenharmony_ci		| MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK))
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci/* valid values for the loopback module parameter */
6078c2ecf20Sopenharmony_ci#define LOOPBACK_NONE	0	/* no loopback - default */
6088c2ecf20Sopenharmony_ci#define LOOPBACK_SERDES 1
6098c2ecf20Sopenharmony_ci#define LOOPBACK_LCB	2
6108c2ecf20Sopenharmony_ci#define LOOPBACK_CABLE	3	/* external cable */
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_ci/* set up bits in MISC_CONFIG_BITS */
6138c2ecf20Sopenharmony_ci#define LOOPBACK_SERDES_CONFIG_BIT_MASK_SHIFT 0
6148c2ecf20Sopenharmony_ci#define EXT_CFG_LCB_RESET_SUPPORTED_SHIFT     3
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci/* read and write hardware registers */
6178c2ecf20Sopenharmony_ciu64 read_csr(const struct hfi1_devdata *dd, u32 offset);
6188c2ecf20Sopenharmony_civoid write_csr(const struct hfi1_devdata *dd, u32 offset, u64 value);
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci/*
6218c2ecf20Sopenharmony_ci * The *_kctxt_* flavor of the CSR read/write functions are for
6228c2ecf20Sopenharmony_ci * per-context or per-SDMA CSRs that are not mappable to user-space.
6238c2ecf20Sopenharmony_ci * Their spacing is not a PAGE_SIZE multiple.
6248c2ecf20Sopenharmony_ci */
6258c2ecf20Sopenharmony_cistatic inline u64 read_kctxt_csr(const struct hfi1_devdata *dd, int ctxt,
6268c2ecf20Sopenharmony_ci				 u32 offset0)
6278c2ecf20Sopenharmony_ci{
6288c2ecf20Sopenharmony_ci	/* kernel per-context CSRs are separated by 0x100 */
6298c2ecf20Sopenharmony_ci	return read_csr(dd, offset0 + (0x100 * ctxt));
6308c2ecf20Sopenharmony_ci}
6318c2ecf20Sopenharmony_ci
6328c2ecf20Sopenharmony_cistatic inline void write_kctxt_csr(struct hfi1_devdata *dd, int ctxt,
6338c2ecf20Sopenharmony_ci				   u32 offset0, u64 value)
6348c2ecf20Sopenharmony_ci{
6358c2ecf20Sopenharmony_ci	/* kernel per-context CSRs are separated by 0x100 */
6368c2ecf20Sopenharmony_ci	write_csr(dd, offset0 + (0x100 * ctxt), value);
6378c2ecf20Sopenharmony_ci}
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ciint read_lcb_csr(struct hfi1_devdata *dd, u32 offset, u64 *data);
6408c2ecf20Sopenharmony_ciint write_lcb_csr(struct hfi1_devdata *dd, u32 offset, u64 data);
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_civoid __iomem *get_csr_addr(
6438c2ecf20Sopenharmony_ci	const struct hfi1_devdata *dd,
6448c2ecf20Sopenharmony_ci	u32 offset);
6458c2ecf20Sopenharmony_ci
6468c2ecf20Sopenharmony_cistatic inline void __iomem *get_kctxt_csr_addr(
6478c2ecf20Sopenharmony_ci	const struct hfi1_devdata *dd,
6488c2ecf20Sopenharmony_ci	int ctxt,
6498c2ecf20Sopenharmony_ci	u32 offset0)
6508c2ecf20Sopenharmony_ci{
6518c2ecf20Sopenharmony_ci	return get_csr_addr(dd, offset0 + (0x100 * ctxt));
6528c2ecf20Sopenharmony_ci}
6538c2ecf20Sopenharmony_ci
6548c2ecf20Sopenharmony_ci/*
6558c2ecf20Sopenharmony_ci * The *_uctxt_* flavor of the CSR read/write functions are for
6568c2ecf20Sopenharmony_ci * per-context CSRs that are mappable to user space. All these CSRs
6578c2ecf20Sopenharmony_ci * are spaced by a PAGE_SIZE multiple in order to be mappable to
6588c2ecf20Sopenharmony_ci * different processes without exposing other contexts' CSRs
6598c2ecf20Sopenharmony_ci */
6608c2ecf20Sopenharmony_cistatic inline u64 read_uctxt_csr(const struct hfi1_devdata *dd, int ctxt,
6618c2ecf20Sopenharmony_ci				 u32 offset0)
6628c2ecf20Sopenharmony_ci{
6638c2ecf20Sopenharmony_ci	/* user per-context CSRs are separated by 0x1000 */
6648c2ecf20Sopenharmony_ci	return read_csr(dd, offset0 + (0x1000 * ctxt));
6658c2ecf20Sopenharmony_ci}
6668c2ecf20Sopenharmony_ci
6678c2ecf20Sopenharmony_cistatic inline void write_uctxt_csr(struct hfi1_devdata *dd, int ctxt,
6688c2ecf20Sopenharmony_ci				   u32 offset0, u64 value)
6698c2ecf20Sopenharmony_ci{
6708c2ecf20Sopenharmony_ci	/* user per-context CSRs are separated by 0x1000 */
6718c2ecf20Sopenharmony_ci	write_csr(dd, offset0 + (0x1000 * ctxt), value);
6728c2ecf20Sopenharmony_ci}
6738c2ecf20Sopenharmony_ci
6748c2ecf20Sopenharmony_cistatic inline u32 chip_rcv_contexts(struct hfi1_devdata *dd)
6758c2ecf20Sopenharmony_ci{
6768c2ecf20Sopenharmony_ci	return read_csr(dd, RCV_CONTEXTS);
6778c2ecf20Sopenharmony_ci}
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_cistatic inline u32 chip_send_contexts(struct hfi1_devdata *dd)
6808c2ecf20Sopenharmony_ci{
6818c2ecf20Sopenharmony_ci	return read_csr(dd, SEND_CONTEXTS);
6828c2ecf20Sopenharmony_ci}
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_cistatic inline u32 chip_sdma_engines(struct hfi1_devdata *dd)
6858c2ecf20Sopenharmony_ci{
6868c2ecf20Sopenharmony_ci	return read_csr(dd, SEND_DMA_ENGINES);
6878c2ecf20Sopenharmony_ci}
6888c2ecf20Sopenharmony_ci
6898c2ecf20Sopenharmony_cistatic inline u32 chip_pio_mem_size(struct hfi1_devdata *dd)
6908c2ecf20Sopenharmony_ci{
6918c2ecf20Sopenharmony_ci	return read_csr(dd, SEND_PIO_MEM_SIZE);
6928c2ecf20Sopenharmony_ci}
6938c2ecf20Sopenharmony_ci
6948c2ecf20Sopenharmony_cistatic inline u32 chip_sdma_mem_size(struct hfi1_devdata *dd)
6958c2ecf20Sopenharmony_ci{
6968c2ecf20Sopenharmony_ci	return read_csr(dd, SEND_DMA_MEM_SIZE);
6978c2ecf20Sopenharmony_ci}
6988c2ecf20Sopenharmony_ci
6998c2ecf20Sopenharmony_cistatic inline u32 chip_rcv_array_count(struct hfi1_devdata *dd)
7008c2ecf20Sopenharmony_ci{
7018c2ecf20Sopenharmony_ci	return read_csr(dd, RCV_ARRAY_CNT);
7028c2ecf20Sopenharmony_ci}
7038c2ecf20Sopenharmony_ci
7048c2ecf20Sopenharmony_ciu8 encode_rcv_header_entry_size(u8 size);
7058c2ecf20Sopenharmony_ciint hfi1_validate_rcvhdrcnt(struct hfi1_devdata *dd, uint thecnt);
7068c2ecf20Sopenharmony_civoid set_hdrq_regs(struct hfi1_devdata *dd, u8 ctxt, u8 entsize, u16 hdrcnt);
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ciu64 create_pbc(struct hfi1_pportdata *ppd, u64 flags, int srate_mbs, u32 vl,
7098c2ecf20Sopenharmony_ci	       u32 dw_len);
7108c2ecf20Sopenharmony_ci
7118c2ecf20Sopenharmony_ci/* firmware.c */
7128c2ecf20Sopenharmony_ci#define SBUS_MASTER_BROADCAST 0xfd
7138c2ecf20Sopenharmony_ci#define NUM_PCIE_SERDES 16	/* number of PCIe serdes on the SBus */
7148c2ecf20Sopenharmony_ciextern const u8 pcie_serdes_broadcast[];
7158c2ecf20Sopenharmony_ciextern const u8 pcie_pcs_addrs[2][NUM_PCIE_SERDES];
7168c2ecf20Sopenharmony_ci
7178c2ecf20Sopenharmony_ci/* SBus commands */
7188c2ecf20Sopenharmony_ci#define RESET_SBUS_RECEIVER 0x20
7198c2ecf20Sopenharmony_ci#define WRITE_SBUS_RECEIVER 0x21
7208c2ecf20Sopenharmony_ci#define READ_SBUS_RECEIVER  0x22
7218c2ecf20Sopenharmony_civoid sbus_request(struct hfi1_devdata *dd,
7228c2ecf20Sopenharmony_ci		  u8 receiver_addr, u8 data_addr, u8 command, u32 data_in);
7238c2ecf20Sopenharmony_ciint sbus_request_slow(struct hfi1_devdata *dd,
7248c2ecf20Sopenharmony_ci		      u8 receiver_addr, u8 data_addr, u8 command, u32 data_in);
7258c2ecf20Sopenharmony_civoid set_sbus_fast_mode(struct hfi1_devdata *dd);
7268c2ecf20Sopenharmony_civoid clear_sbus_fast_mode(struct hfi1_devdata *dd);
7278c2ecf20Sopenharmony_ciint hfi1_firmware_init(struct hfi1_devdata *dd);
7288c2ecf20Sopenharmony_ciint load_pcie_firmware(struct hfi1_devdata *dd);
7298c2ecf20Sopenharmony_ciint load_firmware(struct hfi1_devdata *dd);
7308c2ecf20Sopenharmony_civoid dispose_firmware(void);
7318c2ecf20Sopenharmony_ciint acquire_hw_mutex(struct hfi1_devdata *dd);
7328c2ecf20Sopenharmony_civoid release_hw_mutex(struct hfi1_devdata *dd);
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_ci/*
7358c2ecf20Sopenharmony_ci * Bitmask of dynamic access for ASIC block chip resources.  Each HFI has its
7368c2ecf20Sopenharmony_ci * own range of bits for the resource so it can clear its own bits on
7378c2ecf20Sopenharmony_ci * starting and exiting.  If either HFI has the resource bit set, the
7388c2ecf20Sopenharmony_ci * resource is in use.  The separate bit ranges are:
7398c2ecf20Sopenharmony_ci *	HFI0 bits  7:0
7408c2ecf20Sopenharmony_ci *	HFI1 bits 15:8
7418c2ecf20Sopenharmony_ci */
7428c2ecf20Sopenharmony_ci#define CR_SBUS  0x01	/* SBUS, THERM, and PCIE registers */
7438c2ecf20Sopenharmony_ci#define CR_EPROM 0x02	/* EEP, GPIO registers */
7448c2ecf20Sopenharmony_ci#define CR_I2C1  0x04	/* QSFP1_OE register */
7458c2ecf20Sopenharmony_ci#define CR_I2C2  0x08	/* QSFP2_OE register */
7468c2ecf20Sopenharmony_ci#define CR_DYN_SHIFT 8	/* dynamic flag shift */
7478c2ecf20Sopenharmony_ci#define CR_DYN_MASK  ((1ull << CR_DYN_SHIFT) - 1)
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci/*
7508c2ecf20Sopenharmony_ci * Bitmask of static ASIC states these are outside of the dynamic ASIC
7518c2ecf20Sopenharmony_ci * block chip resources above.  These are to be set once and never cleared.
7528c2ecf20Sopenharmony_ci * Must be holding the SBus dynamic flag when setting.
7538c2ecf20Sopenharmony_ci */
7548c2ecf20Sopenharmony_ci#define CR_THERM_INIT	0x010000
7558c2ecf20Sopenharmony_ci
7568c2ecf20Sopenharmony_ciint acquire_chip_resource(struct hfi1_devdata *dd, u32 resource, u32 mswait);
7578c2ecf20Sopenharmony_civoid release_chip_resource(struct hfi1_devdata *dd, u32 resource);
7588c2ecf20Sopenharmony_cibool check_chip_resource(struct hfi1_devdata *dd, u32 resource,
7598c2ecf20Sopenharmony_ci			 const char *func);
7608c2ecf20Sopenharmony_civoid init_chip_resources(struct hfi1_devdata *dd);
7618c2ecf20Sopenharmony_civoid finish_chip_resources(struct hfi1_devdata *dd);
7628c2ecf20Sopenharmony_ci
7638c2ecf20Sopenharmony_ci/* ms wait time for access to an SBus resoure */
7648c2ecf20Sopenharmony_ci#define SBUS_TIMEOUT 4000 /* long enough for a FW download and SBR */
7658c2ecf20Sopenharmony_ci
7668c2ecf20Sopenharmony_ci/* ms wait time for a qsfp (i2c) chain to become available */
7678c2ecf20Sopenharmony_ci#define QSFP_WAIT 20000 /* long enough for FW update to the F4 uc */
7688c2ecf20Sopenharmony_ci
7698c2ecf20Sopenharmony_civoid fabric_serdes_reset(struct hfi1_devdata *dd);
7708c2ecf20Sopenharmony_ciint read_8051_data(struct hfi1_devdata *dd, u32 addr, u32 len, u64 *result);
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci/* chip.c */
7738c2ecf20Sopenharmony_civoid read_misc_status(struct hfi1_devdata *dd, u8 *ver_major, u8 *ver_minor,
7748c2ecf20Sopenharmony_ci		      u8 *ver_patch);
7758c2ecf20Sopenharmony_ciint write_host_interface_version(struct hfi1_devdata *dd, u8 version);
7768c2ecf20Sopenharmony_civoid read_guid(struct hfi1_devdata *dd);
7778c2ecf20Sopenharmony_ciint wait_fm_ready(struct hfi1_devdata *dd, u32 mstimeout);
7788c2ecf20Sopenharmony_civoid set_link_down_reason(struct hfi1_pportdata *ppd, u8 lcl_reason,
7798c2ecf20Sopenharmony_ci			  u8 neigh_reason, u8 rem_reason);
7808c2ecf20Sopenharmony_ciint set_link_state(struct hfi1_pportdata *, u32 state);
7818c2ecf20Sopenharmony_ciint port_ltp_to_cap(int port_ltp);
7828c2ecf20Sopenharmony_civoid handle_verify_cap(struct work_struct *work);
7838c2ecf20Sopenharmony_civoid handle_freeze(struct work_struct *work);
7848c2ecf20Sopenharmony_civoid handle_link_up(struct work_struct *work);
7858c2ecf20Sopenharmony_civoid handle_link_down(struct work_struct *work);
7868c2ecf20Sopenharmony_civoid handle_link_downgrade(struct work_struct *work);
7878c2ecf20Sopenharmony_civoid handle_link_bounce(struct work_struct *work);
7888c2ecf20Sopenharmony_civoid handle_start_link(struct work_struct *work);
7898c2ecf20Sopenharmony_civoid handle_sma_message(struct work_struct *work);
7908c2ecf20Sopenharmony_ciint reset_qsfp(struct hfi1_pportdata *ppd);
7918c2ecf20Sopenharmony_civoid qsfp_event(struct work_struct *work);
7928c2ecf20Sopenharmony_civoid start_freeze_handling(struct hfi1_pportdata *ppd, int flags);
7938c2ecf20Sopenharmony_ciint send_idle_sma(struct hfi1_devdata *dd, u64 message);
7948c2ecf20Sopenharmony_ciint load_8051_config(struct hfi1_devdata *, u8, u8, u32);
7958c2ecf20Sopenharmony_ciint read_8051_config(struct hfi1_devdata *, u8, u8, u32 *);
7968c2ecf20Sopenharmony_ciint start_link(struct hfi1_pportdata *ppd);
7978c2ecf20Sopenharmony_ciint bringup_serdes(struct hfi1_pportdata *ppd);
7988c2ecf20Sopenharmony_civoid set_intr_state(struct hfi1_devdata *dd, u32 enable);
7998c2ecf20Sopenharmony_cibool apply_link_downgrade_policy(struct hfi1_pportdata *ppd,
8008c2ecf20Sopenharmony_ci				 bool refresh_widths);
8018c2ecf20Sopenharmony_civoid update_usrhead(struct hfi1_ctxtdata *rcd, u32 hd, u32 updegr, u32 egrhd,
8028c2ecf20Sopenharmony_ci		    u32 intr_adjust, u32 npkts);
8038c2ecf20Sopenharmony_ciint stop_drain_data_vls(struct hfi1_devdata *dd);
8048c2ecf20Sopenharmony_ciint open_fill_data_vls(struct hfi1_devdata *dd);
8058c2ecf20Sopenharmony_ciu32 ns_to_cclock(struct hfi1_devdata *dd, u32 ns);
8068c2ecf20Sopenharmony_ciu32 cclock_to_ns(struct hfi1_devdata *dd, u32 cclock);
8078c2ecf20Sopenharmony_civoid get_linkup_link_widths(struct hfi1_pportdata *ppd);
8088c2ecf20Sopenharmony_civoid read_ltp_rtt(struct hfi1_devdata *dd);
8098c2ecf20Sopenharmony_civoid clear_linkup_counters(struct hfi1_devdata *dd);
8108c2ecf20Sopenharmony_ciu32 hdrqempty(struct hfi1_ctxtdata *rcd);
8118c2ecf20Sopenharmony_ciint is_ax(struct hfi1_devdata *dd);
8128c2ecf20Sopenharmony_ciint is_bx(struct hfi1_devdata *dd);
8138c2ecf20Sopenharmony_cibool is_urg_masked(struct hfi1_ctxtdata *rcd);
8148c2ecf20Sopenharmony_ciu32 read_physical_state(struct hfi1_devdata *dd);
8158c2ecf20Sopenharmony_ciu32 chip_to_opa_pstate(struct hfi1_devdata *dd, u32 chip_pstate);
8168c2ecf20Sopenharmony_ciconst char *opa_lstate_name(u32 lstate);
8178c2ecf20Sopenharmony_ciconst char *opa_pstate_name(u32 pstate);
8188c2ecf20Sopenharmony_ciu32 driver_pstate(struct hfi1_pportdata *ppd);
8198c2ecf20Sopenharmony_ciu32 driver_lstate(struct hfi1_pportdata *ppd);
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_ciint acquire_lcb_access(struct hfi1_devdata *dd, int sleep_ok);
8228c2ecf20Sopenharmony_ciint release_lcb_access(struct hfi1_devdata *dd, int sleep_ok);
8238c2ecf20Sopenharmony_ci#define LCB_START DC_LCB_CSRS
8248c2ecf20Sopenharmony_ci#define LCB_END   DC_8051_CSRS /* next block is 8051 */
8258c2ecf20Sopenharmony_cistatic inline int is_lcb_offset(u32 offset)
8268c2ecf20Sopenharmony_ci{
8278c2ecf20Sopenharmony_ci	return (offset >= LCB_START && offset < LCB_END);
8288c2ecf20Sopenharmony_ci}
8298c2ecf20Sopenharmony_ci
8308c2ecf20Sopenharmony_ciextern uint num_vls;
8318c2ecf20Sopenharmony_ci
8328c2ecf20Sopenharmony_ciextern uint disable_integrity;
8338c2ecf20Sopenharmony_ciu64 read_dev_cntr(struct hfi1_devdata *dd, int index, int vl);
8348c2ecf20Sopenharmony_ciu64 write_dev_cntr(struct hfi1_devdata *dd, int index, int vl, u64 data);
8358c2ecf20Sopenharmony_ciu64 read_port_cntr(struct hfi1_pportdata *ppd, int index, int vl);
8368c2ecf20Sopenharmony_ciu64 write_port_cntr(struct hfi1_pportdata *ppd, int index, int vl, u64 data);
8378c2ecf20Sopenharmony_ciu32 read_logical_state(struct hfi1_devdata *dd);
8388c2ecf20Sopenharmony_civoid force_recv_intr(struct hfi1_ctxtdata *rcd);
8398c2ecf20Sopenharmony_ci
8408c2ecf20Sopenharmony_ci/* Per VL indexes */
8418c2ecf20Sopenharmony_cienum {
8428c2ecf20Sopenharmony_ci	C_VL_0 = 0,
8438c2ecf20Sopenharmony_ci	C_VL_1,
8448c2ecf20Sopenharmony_ci	C_VL_2,
8458c2ecf20Sopenharmony_ci	C_VL_3,
8468c2ecf20Sopenharmony_ci	C_VL_4,
8478c2ecf20Sopenharmony_ci	C_VL_5,
8488c2ecf20Sopenharmony_ci	C_VL_6,
8498c2ecf20Sopenharmony_ci	C_VL_7,
8508c2ecf20Sopenharmony_ci	C_VL_15,
8518c2ecf20Sopenharmony_ci	C_VL_COUNT
8528c2ecf20Sopenharmony_ci};
8538c2ecf20Sopenharmony_ci
8548c2ecf20Sopenharmony_cistatic inline int vl_from_idx(int idx)
8558c2ecf20Sopenharmony_ci{
8568c2ecf20Sopenharmony_ci	return (idx == C_VL_15 ? 15 : idx);
8578c2ecf20Sopenharmony_ci}
8588c2ecf20Sopenharmony_ci
8598c2ecf20Sopenharmony_cistatic inline int idx_from_vl(int vl)
8608c2ecf20Sopenharmony_ci{
8618c2ecf20Sopenharmony_ci	return (vl == 15 ? C_VL_15 : vl);
8628c2ecf20Sopenharmony_ci}
8638c2ecf20Sopenharmony_ci
8648c2ecf20Sopenharmony_ci/* Per device counter indexes */
8658c2ecf20Sopenharmony_cienum {
8668c2ecf20Sopenharmony_ci	C_RCV_OVF = 0,
8678c2ecf20Sopenharmony_ci	C_RX_LEN_ERR,
8688c2ecf20Sopenharmony_ci	C_RX_SHORT_ERR,
8698c2ecf20Sopenharmony_ci	C_RX_ICRC_ERR,
8708c2ecf20Sopenharmony_ci	C_RX_EBP,
8718c2ecf20Sopenharmony_ci	C_RX_TID_FULL,
8728c2ecf20Sopenharmony_ci	C_RX_TID_INVALID,
8738c2ecf20Sopenharmony_ci	C_RX_TID_FLGMS,
8748c2ecf20Sopenharmony_ci	C_RX_CTX_EGRS,
8758c2ecf20Sopenharmony_ci	C_RCV_TID_FLSMS,
8768c2ecf20Sopenharmony_ci	C_CCE_PCI_CR_ST,
8778c2ecf20Sopenharmony_ci	C_CCE_PCI_TR_ST,
8788c2ecf20Sopenharmony_ci	C_CCE_PIO_WR_ST,
8798c2ecf20Sopenharmony_ci	C_CCE_ERR_INT,
8808c2ecf20Sopenharmony_ci	C_CCE_SDMA_INT,
8818c2ecf20Sopenharmony_ci	C_CCE_MISC_INT,
8828c2ecf20Sopenharmony_ci	C_CCE_RCV_AV_INT,
8838c2ecf20Sopenharmony_ci	C_CCE_RCV_URG_INT,
8848c2ecf20Sopenharmony_ci	C_CCE_SEND_CR_INT,
8858c2ecf20Sopenharmony_ci	C_DC_UNC_ERR,
8868c2ecf20Sopenharmony_ci	C_DC_RCV_ERR,
8878c2ecf20Sopenharmony_ci	C_DC_FM_CFG_ERR,
8888c2ecf20Sopenharmony_ci	C_DC_RMT_PHY_ERR,
8898c2ecf20Sopenharmony_ci	C_DC_DROPPED_PKT,
8908c2ecf20Sopenharmony_ci	C_DC_MC_XMIT_PKTS,
8918c2ecf20Sopenharmony_ci	C_DC_MC_RCV_PKTS,
8928c2ecf20Sopenharmony_ci	C_DC_XMIT_CERR,
8938c2ecf20Sopenharmony_ci	C_DC_RCV_CERR,
8948c2ecf20Sopenharmony_ci	C_DC_RCV_FCC,
8958c2ecf20Sopenharmony_ci	C_DC_XMIT_FCC,
8968c2ecf20Sopenharmony_ci	C_DC_XMIT_FLITS,
8978c2ecf20Sopenharmony_ci	C_DC_RCV_FLITS,
8988c2ecf20Sopenharmony_ci	C_DC_XMIT_PKTS,
8998c2ecf20Sopenharmony_ci	C_DC_RCV_PKTS,
9008c2ecf20Sopenharmony_ci	C_DC_RX_FLIT_VL,
9018c2ecf20Sopenharmony_ci	C_DC_RX_PKT_VL,
9028c2ecf20Sopenharmony_ci	C_DC_RCV_FCN,
9038c2ecf20Sopenharmony_ci	C_DC_RCV_FCN_VL,
9048c2ecf20Sopenharmony_ci	C_DC_RCV_BCN,
9058c2ecf20Sopenharmony_ci	C_DC_RCV_BCN_VL,
9068c2ecf20Sopenharmony_ci	C_DC_RCV_BBL,
9078c2ecf20Sopenharmony_ci	C_DC_RCV_BBL_VL,
9088c2ecf20Sopenharmony_ci	C_DC_MARK_FECN,
9098c2ecf20Sopenharmony_ci	C_DC_MARK_FECN_VL,
9108c2ecf20Sopenharmony_ci	C_DC_TOTAL_CRC,
9118c2ecf20Sopenharmony_ci	C_DC_CRC_LN0,
9128c2ecf20Sopenharmony_ci	C_DC_CRC_LN1,
9138c2ecf20Sopenharmony_ci	C_DC_CRC_LN2,
9148c2ecf20Sopenharmony_ci	C_DC_CRC_LN3,
9158c2ecf20Sopenharmony_ci	C_DC_CRC_MULT_LN,
9168c2ecf20Sopenharmony_ci	C_DC_TX_REPLAY,
9178c2ecf20Sopenharmony_ci	C_DC_RX_REPLAY,
9188c2ecf20Sopenharmony_ci	C_DC_SEQ_CRC_CNT,
9198c2ecf20Sopenharmony_ci	C_DC_ESC0_ONLY_CNT,
9208c2ecf20Sopenharmony_ci	C_DC_ESC0_PLUS1_CNT,
9218c2ecf20Sopenharmony_ci	C_DC_ESC0_PLUS2_CNT,
9228c2ecf20Sopenharmony_ci	C_DC_REINIT_FROM_PEER_CNT,
9238c2ecf20Sopenharmony_ci	C_DC_SBE_CNT,
9248c2ecf20Sopenharmony_ci	C_DC_MISC_FLG_CNT,
9258c2ecf20Sopenharmony_ci	C_DC_PRF_GOOD_LTP_CNT,
9268c2ecf20Sopenharmony_ci	C_DC_PRF_ACCEPTED_LTP_CNT,
9278c2ecf20Sopenharmony_ci	C_DC_PRF_RX_FLIT_CNT,
9288c2ecf20Sopenharmony_ci	C_DC_PRF_TX_FLIT_CNT,
9298c2ecf20Sopenharmony_ci	C_DC_PRF_CLK_CNTR,
9308c2ecf20Sopenharmony_ci	C_DC_PG_DBG_FLIT_CRDTS_CNT,
9318c2ecf20Sopenharmony_ci	C_DC_PG_STS_PAUSE_COMPLETE_CNT,
9328c2ecf20Sopenharmony_ci	C_DC_PG_STS_TX_SBE_CNT,
9338c2ecf20Sopenharmony_ci	C_DC_PG_STS_TX_MBE_CNT,
9348c2ecf20Sopenharmony_ci	C_SW_CPU_INTR,
9358c2ecf20Sopenharmony_ci	C_SW_CPU_RCV_LIM,
9368c2ecf20Sopenharmony_ci	C_SW_CTX0_SEQ_DROP,
9378c2ecf20Sopenharmony_ci	C_SW_VTX_WAIT,
9388c2ecf20Sopenharmony_ci	C_SW_PIO_WAIT,
9398c2ecf20Sopenharmony_ci	C_SW_PIO_DRAIN,
9408c2ecf20Sopenharmony_ci	C_SW_KMEM_WAIT,
9418c2ecf20Sopenharmony_ci	C_SW_TID_WAIT,
9428c2ecf20Sopenharmony_ci	C_SW_SEND_SCHED,
9438c2ecf20Sopenharmony_ci	C_SDMA_DESC_FETCHED_CNT,
9448c2ecf20Sopenharmony_ci	C_SDMA_INT_CNT,
9458c2ecf20Sopenharmony_ci	C_SDMA_ERR_CNT,
9468c2ecf20Sopenharmony_ci	C_SDMA_IDLE_INT_CNT,
9478c2ecf20Sopenharmony_ci	C_SDMA_PROGRESS_INT_CNT,
9488c2ecf20Sopenharmony_ci/* MISC_ERR_STATUS */
9498c2ecf20Sopenharmony_ci	C_MISC_PLL_LOCK_FAIL_ERR,
9508c2ecf20Sopenharmony_ci	C_MISC_MBIST_FAIL_ERR,
9518c2ecf20Sopenharmony_ci	C_MISC_INVALID_EEP_CMD_ERR,
9528c2ecf20Sopenharmony_ci	C_MISC_EFUSE_DONE_PARITY_ERR,
9538c2ecf20Sopenharmony_ci	C_MISC_EFUSE_WRITE_ERR,
9548c2ecf20Sopenharmony_ci	C_MISC_EFUSE_READ_BAD_ADDR_ERR,
9558c2ecf20Sopenharmony_ci	C_MISC_EFUSE_CSR_PARITY_ERR,
9568c2ecf20Sopenharmony_ci	C_MISC_FW_AUTH_FAILED_ERR,
9578c2ecf20Sopenharmony_ci	C_MISC_KEY_MISMATCH_ERR,
9588c2ecf20Sopenharmony_ci	C_MISC_SBUS_WRITE_FAILED_ERR,
9598c2ecf20Sopenharmony_ci	C_MISC_CSR_WRITE_BAD_ADDR_ERR,
9608c2ecf20Sopenharmony_ci	C_MISC_CSR_READ_BAD_ADDR_ERR,
9618c2ecf20Sopenharmony_ci	C_MISC_CSR_PARITY_ERR,
9628c2ecf20Sopenharmony_ci/* CceErrStatus */
9638c2ecf20Sopenharmony_ci	/*
9648c2ecf20Sopenharmony_ci	* A special counter that is the aggregate count
9658c2ecf20Sopenharmony_ci	* of all the cce_err_status errors.  The remainder
9668c2ecf20Sopenharmony_ci	* are actual bits in the CceErrStatus register.
9678c2ecf20Sopenharmony_ci	*/
9688c2ecf20Sopenharmony_ci	C_CCE_ERR_STATUS_AGGREGATED_CNT,
9698c2ecf20Sopenharmony_ci	C_CCE_MSIX_CSR_PARITY_ERR,
9708c2ecf20Sopenharmony_ci	C_CCE_INT_MAP_UNC_ERR,
9718c2ecf20Sopenharmony_ci	C_CCE_INT_MAP_COR_ERR,
9728c2ecf20Sopenharmony_ci	C_CCE_MSIX_TABLE_UNC_ERR,
9738c2ecf20Sopenharmony_ci	C_CCE_MSIX_TABLE_COR_ERR,
9748c2ecf20Sopenharmony_ci	C_CCE_RXDMA_CONV_FIFO_PARITY_ERR,
9758c2ecf20Sopenharmony_ci	C_CCE_RCPL_ASYNC_FIFO_PARITY_ERR,
9768c2ecf20Sopenharmony_ci	C_CCE_SEG_WRITE_BAD_ADDR_ERR,
9778c2ecf20Sopenharmony_ci	C_CCE_SEG_READ_BAD_ADDR_ERR,
9788c2ecf20Sopenharmony_ci	C_LA_TRIGGERED,
9798c2ecf20Sopenharmony_ci	C_CCE_TRGT_CPL_TIMEOUT_ERR,
9808c2ecf20Sopenharmony_ci	C_PCIC_RECEIVE_PARITY_ERR,
9818c2ecf20Sopenharmony_ci	C_PCIC_TRANSMIT_BACK_PARITY_ERR,
9828c2ecf20Sopenharmony_ci	C_PCIC_TRANSMIT_FRONT_PARITY_ERR,
9838c2ecf20Sopenharmony_ci	C_PCIC_CPL_DAT_Q_UNC_ERR,
9848c2ecf20Sopenharmony_ci	C_PCIC_CPL_HD_Q_UNC_ERR,
9858c2ecf20Sopenharmony_ci	C_PCIC_POST_DAT_Q_UNC_ERR,
9868c2ecf20Sopenharmony_ci	C_PCIC_POST_HD_Q_UNC_ERR,
9878c2ecf20Sopenharmony_ci	C_PCIC_RETRY_SOT_MEM_UNC_ERR,
9888c2ecf20Sopenharmony_ci	C_PCIC_RETRY_MEM_UNC_ERR,
9898c2ecf20Sopenharmony_ci	C_PCIC_N_POST_DAT_Q_PARITY_ERR,
9908c2ecf20Sopenharmony_ci	C_PCIC_N_POST_H_Q_PARITY_ERR,
9918c2ecf20Sopenharmony_ci	C_PCIC_CPL_DAT_Q_COR_ERR,
9928c2ecf20Sopenharmony_ci	C_PCIC_CPL_HD_Q_COR_ERR,
9938c2ecf20Sopenharmony_ci	C_PCIC_POST_DAT_Q_COR_ERR,
9948c2ecf20Sopenharmony_ci	C_PCIC_POST_HD_Q_COR_ERR,
9958c2ecf20Sopenharmony_ci	C_PCIC_RETRY_SOT_MEM_COR_ERR,
9968c2ecf20Sopenharmony_ci	C_PCIC_RETRY_MEM_COR_ERR,
9978c2ecf20Sopenharmony_ci	C_CCE_CLI1_ASYNC_FIFO_DBG_PARITY_ERR,
9988c2ecf20Sopenharmony_ci	C_CCE_CLI1_ASYNC_FIFO_RXDMA_PARITY_ERR,
9998c2ecf20Sopenharmony_ci	C_CCE_CLI1_ASYNC_FIFO_SDMA_HD_PARITY_ERR,
10008c2ecf20Sopenharmony_ci	C_CCE_CLI1_ASYNC_FIFO_PIO_CRDT_PARITY_ERR,
10018c2ecf20Sopenharmony_ci	C_CCE_CLI2_ASYNC_FIFO_PARITY_ERR,
10028c2ecf20Sopenharmony_ci	C_CCE_CSR_CFG_BUS_PARITY_ERR,
10038c2ecf20Sopenharmony_ci	C_CCE_CLI0_ASYNC_FIFO_PARTIY_ERR,
10048c2ecf20Sopenharmony_ci	C_CCE_RSPD_DATA_PARITY_ERR,
10058c2ecf20Sopenharmony_ci	C_CCE_TRGT_ACCESS_ERR,
10068c2ecf20Sopenharmony_ci	C_CCE_TRGT_ASYNC_FIFO_PARITY_ERR,
10078c2ecf20Sopenharmony_ci	C_CCE_CSR_WRITE_BAD_ADDR_ERR,
10088c2ecf20Sopenharmony_ci	C_CCE_CSR_READ_BAD_ADDR_ERR,
10098c2ecf20Sopenharmony_ci	C_CCE_CSR_PARITY_ERR,
10108c2ecf20Sopenharmony_ci/* RcvErrStatus */
10118c2ecf20Sopenharmony_ci	C_RX_CSR_PARITY_ERR,
10128c2ecf20Sopenharmony_ci	C_RX_CSR_WRITE_BAD_ADDR_ERR,
10138c2ecf20Sopenharmony_ci	C_RX_CSR_READ_BAD_ADDR_ERR,
10148c2ecf20Sopenharmony_ci	C_RX_DMA_CSR_UNC_ERR,
10158c2ecf20Sopenharmony_ci	C_RX_DMA_DQ_FSM_ENCODING_ERR,
10168c2ecf20Sopenharmony_ci	C_RX_DMA_EQ_FSM_ENCODING_ERR,
10178c2ecf20Sopenharmony_ci	C_RX_DMA_CSR_PARITY_ERR,
10188c2ecf20Sopenharmony_ci	C_RX_RBUF_DATA_COR_ERR,
10198c2ecf20Sopenharmony_ci	C_RX_RBUF_DATA_UNC_ERR,
10208c2ecf20Sopenharmony_ci	C_RX_DMA_DATA_FIFO_RD_COR_ERR,
10218c2ecf20Sopenharmony_ci	C_RX_DMA_DATA_FIFO_RD_UNC_ERR,
10228c2ecf20Sopenharmony_ci	C_RX_DMA_HDR_FIFO_RD_COR_ERR,
10238c2ecf20Sopenharmony_ci	C_RX_DMA_HDR_FIFO_RD_UNC_ERR,
10248c2ecf20Sopenharmony_ci	C_RX_RBUF_DESC_PART2_COR_ERR,
10258c2ecf20Sopenharmony_ci	C_RX_RBUF_DESC_PART2_UNC_ERR,
10268c2ecf20Sopenharmony_ci	C_RX_RBUF_DESC_PART1_COR_ERR,
10278c2ecf20Sopenharmony_ci	C_RX_RBUF_DESC_PART1_UNC_ERR,
10288c2ecf20Sopenharmony_ci	C_RX_HQ_INTR_FSM_ERR,
10298c2ecf20Sopenharmony_ci	C_RX_HQ_INTR_CSR_PARITY_ERR,
10308c2ecf20Sopenharmony_ci	C_RX_LOOKUP_CSR_PARITY_ERR,
10318c2ecf20Sopenharmony_ci	C_RX_LOOKUP_RCV_ARRAY_COR_ERR,
10328c2ecf20Sopenharmony_ci	C_RX_LOOKUP_RCV_ARRAY_UNC_ERR,
10338c2ecf20Sopenharmony_ci	C_RX_LOOKUP_DES_PART2_PARITY_ERR,
10348c2ecf20Sopenharmony_ci	C_RX_LOOKUP_DES_PART1_UNC_COR_ERR,
10358c2ecf20Sopenharmony_ci	C_RX_LOOKUP_DES_PART1_UNC_ERR,
10368c2ecf20Sopenharmony_ci	C_RX_RBUF_NEXT_FREE_BUF_COR_ERR,
10378c2ecf20Sopenharmony_ci	C_RX_RBUF_NEXT_FREE_BUF_UNC_ERR,
10388c2ecf20Sopenharmony_ci	C_RX_RBUF_FL_INIT_WR_ADDR_PARITY_ERR,
10398c2ecf20Sopenharmony_ci	C_RX_RBUF_FL_INITDONE_PARITY_ERR,
10408c2ecf20Sopenharmony_ci	C_RX_RBUF_FL_WRITE_ADDR_PARITY_ERR,
10418c2ecf20Sopenharmony_ci	C_RX_RBUF_FL_RD_ADDR_PARITY_ERR,
10428c2ecf20Sopenharmony_ci	C_RX_RBUF_EMPTY_ERR,
10438c2ecf20Sopenharmony_ci	C_RX_RBUF_FULL_ERR,
10448c2ecf20Sopenharmony_ci	C_RX_RBUF_BAD_LOOKUP_ERR,
10458c2ecf20Sopenharmony_ci	C_RX_RBUF_CTX_ID_PARITY_ERR,
10468c2ecf20Sopenharmony_ci	C_RX_RBUF_CSR_QEOPDW_PARITY_ERR,
10478c2ecf20Sopenharmony_ci	C_RX_RBUF_CSR_Q_NUM_OF_PKT_PARITY_ERR,
10488c2ecf20Sopenharmony_ci	C_RX_RBUF_CSR_Q_T1_PTR_PARITY_ERR,
10498c2ecf20Sopenharmony_ci	C_RX_RBUF_CSR_Q_HD_PTR_PARITY_ERR,
10508c2ecf20Sopenharmony_ci	C_RX_RBUF_CSR_Q_VLD_BIT_PARITY_ERR,
10518c2ecf20Sopenharmony_ci	C_RX_RBUF_CSR_Q_NEXT_BUF_PARITY_ERR,
10528c2ecf20Sopenharmony_ci	C_RX_RBUF_CSR_Q_ENT_CNT_PARITY_ERR,
10538c2ecf20Sopenharmony_ci	C_RX_RBUF_CSR_Q_HEAD_BUF_NUM_PARITY_ERR,
10548c2ecf20Sopenharmony_ci	C_RX_RBUF_BLOCK_LIST_READ_COR_ERR,
10558c2ecf20Sopenharmony_ci	C_RX_RBUF_BLOCK_LIST_READ_UNC_ERR,
10568c2ecf20Sopenharmony_ci	C_RX_RBUF_LOOKUP_DES_COR_ERR,
10578c2ecf20Sopenharmony_ci	C_RX_RBUF_LOOKUP_DES_UNC_ERR,
10588c2ecf20Sopenharmony_ci	C_RX_RBUF_LOOKUP_DES_REG_UNC_COR_ERR,
10598c2ecf20Sopenharmony_ci	C_RX_RBUF_LOOKUP_DES_REG_UNC_ERR,
10608c2ecf20Sopenharmony_ci	C_RX_RBUF_FREE_LIST_COR_ERR,
10618c2ecf20Sopenharmony_ci	C_RX_RBUF_FREE_LIST_UNC_ERR,
10628c2ecf20Sopenharmony_ci	C_RX_RCV_FSM_ENCODING_ERR,
10638c2ecf20Sopenharmony_ci	C_RX_DMA_FLAG_COR_ERR,
10648c2ecf20Sopenharmony_ci	C_RX_DMA_FLAG_UNC_ERR,
10658c2ecf20Sopenharmony_ci	C_RX_DC_SOP_EOP_PARITY_ERR,
10668c2ecf20Sopenharmony_ci	C_RX_RCV_CSR_PARITY_ERR,
10678c2ecf20Sopenharmony_ci	C_RX_RCV_QP_MAP_TABLE_COR_ERR,
10688c2ecf20Sopenharmony_ci	C_RX_RCV_QP_MAP_TABLE_UNC_ERR,
10698c2ecf20Sopenharmony_ci	C_RX_RCV_DATA_COR_ERR,
10708c2ecf20Sopenharmony_ci	C_RX_RCV_DATA_UNC_ERR,
10718c2ecf20Sopenharmony_ci	C_RX_RCV_HDR_COR_ERR,
10728c2ecf20Sopenharmony_ci	C_RX_RCV_HDR_UNC_ERR,
10738c2ecf20Sopenharmony_ci	C_RX_DC_INTF_PARITY_ERR,
10748c2ecf20Sopenharmony_ci	C_RX_DMA_CSR_COR_ERR,
10758c2ecf20Sopenharmony_ci/* SendPioErrStatus */
10768c2ecf20Sopenharmony_ci	C_PIO_PEC_SOP_HEAD_PARITY_ERR,
10778c2ecf20Sopenharmony_ci	C_PIO_PCC_SOP_HEAD_PARITY_ERR,
10788c2ecf20Sopenharmony_ci	C_PIO_LAST_RETURNED_CNT_PARITY_ERR,
10798c2ecf20Sopenharmony_ci	C_PIO_CURRENT_FREE_CNT_PARITY_ERR,
10808c2ecf20Sopenharmony_ci	C_PIO_RSVD_31_ERR,
10818c2ecf20Sopenharmony_ci	C_PIO_RSVD_30_ERR,
10828c2ecf20Sopenharmony_ci	C_PIO_PPMC_SOP_LEN_ERR,
10838c2ecf20Sopenharmony_ci	C_PIO_PPMC_BQC_MEM_PARITY_ERR,
10848c2ecf20Sopenharmony_ci	C_PIO_VL_FIFO_PARITY_ERR,
10858c2ecf20Sopenharmony_ci	C_PIO_VLF_SOP_PARITY_ERR,
10868c2ecf20Sopenharmony_ci	C_PIO_VLF_V1_LEN_PARITY_ERR,
10878c2ecf20Sopenharmony_ci	C_PIO_BLOCK_QW_COUNT_PARITY_ERR,
10888c2ecf20Sopenharmony_ci	C_PIO_WRITE_QW_VALID_PARITY_ERR,
10898c2ecf20Sopenharmony_ci	C_PIO_STATE_MACHINE_ERR,
10908c2ecf20Sopenharmony_ci	C_PIO_WRITE_DATA_PARITY_ERR,
10918c2ecf20Sopenharmony_ci	C_PIO_HOST_ADDR_MEM_COR_ERR,
10928c2ecf20Sopenharmony_ci	C_PIO_HOST_ADDR_MEM_UNC_ERR,
10938c2ecf20Sopenharmony_ci	C_PIO_PKT_EVICT_SM_OR_ARM_SM_ERR,
10948c2ecf20Sopenharmony_ci	C_PIO_INIT_SM_IN_ERR,
10958c2ecf20Sopenharmony_ci	C_PIO_PPMC_PBL_FIFO_ERR,
10968c2ecf20Sopenharmony_ci	C_PIO_CREDIT_RET_FIFO_PARITY_ERR,
10978c2ecf20Sopenharmony_ci	C_PIO_V1_LEN_MEM_BANK1_COR_ERR,
10988c2ecf20Sopenharmony_ci	C_PIO_V1_LEN_MEM_BANK0_COR_ERR,
10998c2ecf20Sopenharmony_ci	C_PIO_V1_LEN_MEM_BANK1_UNC_ERR,
11008c2ecf20Sopenharmony_ci	C_PIO_V1_LEN_MEM_BANK0_UNC_ERR,
11018c2ecf20Sopenharmony_ci	C_PIO_SM_PKT_RESET_PARITY_ERR,
11028c2ecf20Sopenharmony_ci	C_PIO_PKT_EVICT_FIFO_PARITY_ERR,
11038c2ecf20Sopenharmony_ci	C_PIO_SBRDCTRL_CRREL_FIFO_PARITY_ERR,
11048c2ecf20Sopenharmony_ci	C_PIO_SBRDCTL_CRREL_PARITY_ERR,
11058c2ecf20Sopenharmony_ci	C_PIO_PEC_FIFO_PARITY_ERR,
11068c2ecf20Sopenharmony_ci	C_PIO_PCC_FIFO_PARITY_ERR,
11078c2ecf20Sopenharmony_ci	C_PIO_SB_MEM_FIFO1_ERR,
11088c2ecf20Sopenharmony_ci	C_PIO_SB_MEM_FIFO0_ERR,
11098c2ecf20Sopenharmony_ci	C_PIO_CSR_PARITY_ERR,
11108c2ecf20Sopenharmony_ci	C_PIO_WRITE_ADDR_PARITY_ERR,
11118c2ecf20Sopenharmony_ci	C_PIO_WRITE_BAD_CTXT_ERR,
11128c2ecf20Sopenharmony_ci/* SendDmaErrStatus */
11138c2ecf20Sopenharmony_ci	C_SDMA_PCIE_REQ_TRACKING_COR_ERR,
11148c2ecf20Sopenharmony_ci	C_SDMA_PCIE_REQ_TRACKING_UNC_ERR,
11158c2ecf20Sopenharmony_ci	C_SDMA_CSR_PARITY_ERR,
11168c2ecf20Sopenharmony_ci	C_SDMA_RPY_TAG_ERR,
11178c2ecf20Sopenharmony_ci/* SendEgressErrStatus */
11188c2ecf20Sopenharmony_ci	C_TX_READ_PIO_MEMORY_CSR_UNC_ERR,
11198c2ecf20Sopenharmony_ci	C_TX_READ_SDMA_MEMORY_CSR_UNC_ERR,
11208c2ecf20Sopenharmony_ci	C_TX_EGRESS_FIFO_COR_ERR,
11218c2ecf20Sopenharmony_ci	C_TX_READ_PIO_MEMORY_COR_ERR,
11228c2ecf20Sopenharmony_ci	C_TX_READ_SDMA_MEMORY_COR_ERR,
11238c2ecf20Sopenharmony_ci	C_TX_SB_HDR_COR_ERR,
11248c2ecf20Sopenharmony_ci	C_TX_CREDIT_OVERRUN_ERR,
11258c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO8_COR_ERR,
11268c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO7_COR_ERR,
11278c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO6_COR_ERR,
11288c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO5_COR_ERR,
11298c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO4_COR_ERR,
11308c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO3_COR_ERR,
11318c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO2_COR_ERR,
11328c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO1_COR_ERR,
11338c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO0_COR_ERR,
11348c2ecf20Sopenharmony_ci	C_TX_CREDIT_RETURN_VL_ERR,
11358c2ecf20Sopenharmony_ci	C_TX_HCRC_INSERTION_ERR,
11368c2ecf20Sopenharmony_ci	C_TX_EGRESS_FIFI_UNC_ERR,
11378c2ecf20Sopenharmony_ci	C_TX_READ_PIO_MEMORY_UNC_ERR,
11388c2ecf20Sopenharmony_ci	C_TX_READ_SDMA_MEMORY_UNC_ERR,
11398c2ecf20Sopenharmony_ci	C_TX_SB_HDR_UNC_ERR,
11408c2ecf20Sopenharmony_ci	C_TX_CREDIT_RETURN_PARITY_ERR,
11418c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO8_UNC_OR_PARITY_ERR,
11428c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO7_UNC_OR_PARITY_ERR,
11438c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO6_UNC_OR_PARITY_ERR,
11448c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO5_UNC_OR_PARITY_ERR,
11458c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO4_UNC_OR_PARITY_ERR,
11468c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO3_UNC_OR_PARITY_ERR,
11478c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO2_UNC_OR_PARITY_ERR,
11488c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO1_UNC_OR_PARITY_ERR,
11498c2ecf20Sopenharmony_ci	C_TX_LAUNCH_FIFO0_UNC_OR_PARITY_ERR,
11508c2ecf20Sopenharmony_ci	C_TX_SDMA15_DISALLOWED_PACKET_ERR,
11518c2ecf20Sopenharmony_ci	C_TX_SDMA14_DISALLOWED_PACKET_ERR,
11528c2ecf20Sopenharmony_ci	C_TX_SDMA13_DISALLOWED_PACKET_ERR,
11538c2ecf20Sopenharmony_ci	C_TX_SDMA12_DISALLOWED_PACKET_ERR,
11548c2ecf20Sopenharmony_ci	C_TX_SDMA11_DISALLOWED_PACKET_ERR,
11558c2ecf20Sopenharmony_ci	C_TX_SDMA10_DISALLOWED_PACKET_ERR,
11568c2ecf20Sopenharmony_ci	C_TX_SDMA9_DISALLOWED_PACKET_ERR,
11578c2ecf20Sopenharmony_ci	C_TX_SDMA8_DISALLOWED_PACKET_ERR,
11588c2ecf20Sopenharmony_ci	C_TX_SDMA7_DISALLOWED_PACKET_ERR,
11598c2ecf20Sopenharmony_ci	C_TX_SDMA6_DISALLOWED_PACKET_ERR,
11608c2ecf20Sopenharmony_ci	C_TX_SDMA5_DISALLOWED_PACKET_ERR,
11618c2ecf20Sopenharmony_ci	C_TX_SDMA4_DISALLOWED_PACKET_ERR,
11628c2ecf20Sopenharmony_ci	C_TX_SDMA3_DISALLOWED_PACKET_ERR,
11638c2ecf20Sopenharmony_ci	C_TX_SDMA2_DISALLOWED_PACKET_ERR,
11648c2ecf20Sopenharmony_ci	C_TX_SDMA1_DISALLOWED_PACKET_ERR,
11658c2ecf20Sopenharmony_ci	C_TX_SDMA0_DISALLOWED_PACKET_ERR,
11668c2ecf20Sopenharmony_ci	C_TX_CONFIG_PARITY_ERR,
11678c2ecf20Sopenharmony_ci	C_TX_SBRD_CTL_CSR_PARITY_ERR,
11688c2ecf20Sopenharmony_ci	C_TX_LAUNCH_CSR_PARITY_ERR,
11698c2ecf20Sopenharmony_ci	C_TX_ILLEGAL_CL_ERR,
11708c2ecf20Sopenharmony_ci	C_TX_SBRD_CTL_STATE_MACHINE_PARITY_ERR,
11718c2ecf20Sopenharmony_ci	C_TX_RESERVED_10,
11728c2ecf20Sopenharmony_ci	C_TX_RESERVED_9,
11738c2ecf20Sopenharmony_ci	C_TX_SDMA_LAUNCH_INTF_PARITY_ERR,
11748c2ecf20Sopenharmony_ci	C_TX_PIO_LAUNCH_INTF_PARITY_ERR,
11758c2ecf20Sopenharmony_ci	C_TX_RESERVED_6,
11768c2ecf20Sopenharmony_ci	C_TX_INCORRECT_LINK_STATE_ERR,
11778c2ecf20Sopenharmony_ci	C_TX_LINK_DOWN_ERR,
11788c2ecf20Sopenharmony_ci	C_TX_EGRESS_FIFO_UNDERRUN_OR_PARITY_ERR,
11798c2ecf20Sopenharmony_ci	C_TX_RESERVED_2,
11808c2ecf20Sopenharmony_ci	C_TX_PKT_INTEGRITY_MEM_UNC_ERR,
11818c2ecf20Sopenharmony_ci	C_TX_PKT_INTEGRITY_MEM_COR_ERR,
11828c2ecf20Sopenharmony_ci/* SendErrStatus */
11838c2ecf20Sopenharmony_ci	C_SEND_CSR_WRITE_BAD_ADDR_ERR,
11848c2ecf20Sopenharmony_ci	C_SEND_CSR_READ_BAD_ADD_ERR,
11858c2ecf20Sopenharmony_ci	C_SEND_CSR_PARITY_ERR,
11868c2ecf20Sopenharmony_ci/* SendCtxtErrStatus */
11878c2ecf20Sopenharmony_ci	C_PIO_WRITE_OUT_OF_BOUNDS_ERR,
11888c2ecf20Sopenharmony_ci	C_PIO_WRITE_OVERFLOW_ERR,
11898c2ecf20Sopenharmony_ci	C_PIO_WRITE_CROSSES_BOUNDARY_ERR,
11908c2ecf20Sopenharmony_ci	C_PIO_DISALLOWED_PACKET_ERR,
11918c2ecf20Sopenharmony_ci	C_PIO_INCONSISTENT_SOP_ERR,
11928c2ecf20Sopenharmony_ci/*SendDmaEngErrStatus */
11938c2ecf20Sopenharmony_ci	C_SDMA_HEADER_REQUEST_FIFO_COR_ERR,
11948c2ecf20Sopenharmony_ci	C_SDMA_HEADER_STORAGE_COR_ERR,
11958c2ecf20Sopenharmony_ci	C_SDMA_PACKET_TRACKING_COR_ERR,
11968c2ecf20Sopenharmony_ci	C_SDMA_ASSEMBLY_COR_ERR,
11978c2ecf20Sopenharmony_ci	C_SDMA_DESC_TABLE_COR_ERR,
11988c2ecf20Sopenharmony_ci	C_SDMA_HEADER_REQUEST_FIFO_UNC_ERR,
11998c2ecf20Sopenharmony_ci	C_SDMA_HEADER_STORAGE_UNC_ERR,
12008c2ecf20Sopenharmony_ci	C_SDMA_PACKET_TRACKING_UNC_ERR,
12018c2ecf20Sopenharmony_ci	C_SDMA_ASSEMBLY_UNC_ERR,
12028c2ecf20Sopenharmony_ci	C_SDMA_DESC_TABLE_UNC_ERR,
12038c2ecf20Sopenharmony_ci	C_SDMA_TIMEOUT_ERR,
12048c2ecf20Sopenharmony_ci	C_SDMA_HEADER_LENGTH_ERR,
12058c2ecf20Sopenharmony_ci	C_SDMA_HEADER_ADDRESS_ERR,
12068c2ecf20Sopenharmony_ci	C_SDMA_HEADER_SELECT_ERR,
12078c2ecf20Sopenharmony_ci	C_SMDA_RESERVED_9,
12088c2ecf20Sopenharmony_ci	C_SDMA_PACKET_DESC_OVERFLOW_ERR,
12098c2ecf20Sopenharmony_ci	C_SDMA_LENGTH_MISMATCH_ERR,
12108c2ecf20Sopenharmony_ci	C_SDMA_HALT_ERR,
12118c2ecf20Sopenharmony_ci	C_SDMA_MEM_READ_ERR,
12128c2ecf20Sopenharmony_ci	C_SDMA_FIRST_DESC_ERR,
12138c2ecf20Sopenharmony_ci	C_SDMA_TAIL_OUT_OF_BOUNDS_ERR,
12148c2ecf20Sopenharmony_ci	C_SDMA_TOO_LONG_ERR,
12158c2ecf20Sopenharmony_ci	C_SDMA_GEN_MISMATCH_ERR,
12168c2ecf20Sopenharmony_ci	C_SDMA_WRONG_DW_ERR,
12178c2ecf20Sopenharmony_ci	DEV_CNTR_LAST  /* Must be kept last */
12188c2ecf20Sopenharmony_ci};
12198c2ecf20Sopenharmony_ci
12208c2ecf20Sopenharmony_ci/* Per port counter indexes */
12218c2ecf20Sopenharmony_cienum {
12228c2ecf20Sopenharmony_ci	C_TX_UNSUP_VL = 0,
12238c2ecf20Sopenharmony_ci	C_TX_INVAL_LEN,
12248c2ecf20Sopenharmony_ci	C_TX_MM_LEN_ERR,
12258c2ecf20Sopenharmony_ci	C_TX_UNDERRUN,
12268c2ecf20Sopenharmony_ci	C_TX_FLOW_STALL,
12278c2ecf20Sopenharmony_ci	C_TX_DROPPED,
12288c2ecf20Sopenharmony_ci	C_TX_HDR_ERR,
12298c2ecf20Sopenharmony_ci	C_TX_PKT,
12308c2ecf20Sopenharmony_ci	C_TX_WORDS,
12318c2ecf20Sopenharmony_ci	C_TX_WAIT,
12328c2ecf20Sopenharmony_ci	C_TX_FLIT_VL,
12338c2ecf20Sopenharmony_ci	C_TX_PKT_VL,
12348c2ecf20Sopenharmony_ci	C_TX_WAIT_VL,
12358c2ecf20Sopenharmony_ci	C_RX_PKT,
12368c2ecf20Sopenharmony_ci	C_RX_WORDS,
12378c2ecf20Sopenharmony_ci	C_SW_LINK_DOWN,
12388c2ecf20Sopenharmony_ci	C_SW_LINK_UP,
12398c2ecf20Sopenharmony_ci	C_SW_UNKNOWN_FRAME,
12408c2ecf20Sopenharmony_ci	C_SW_XMIT_DSCD,
12418c2ecf20Sopenharmony_ci	C_SW_XMIT_DSCD_VL,
12428c2ecf20Sopenharmony_ci	C_SW_XMIT_CSTR_ERR,
12438c2ecf20Sopenharmony_ci	C_SW_RCV_CSTR_ERR,
12448c2ecf20Sopenharmony_ci	C_SW_IBP_LOOP_PKTS,
12458c2ecf20Sopenharmony_ci	C_SW_IBP_RC_RESENDS,
12468c2ecf20Sopenharmony_ci	C_SW_IBP_RNR_NAKS,
12478c2ecf20Sopenharmony_ci	C_SW_IBP_OTHER_NAKS,
12488c2ecf20Sopenharmony_ci	C_SW_IBP_RC_TIMEOUTS,
12498c2ecf20Sopenharmony_ci	C_SW_IBP_PKT_DROPS,
12508c2ecf20Sopenharmony_ci	C_SW_IBP_DMA_WAIT,
12518c2ecf20Sopenharmony_ci	C_SW_IBP_RC_SEQNAK,
12528c2ecf20Sopenharmony_ci	C_SW_IBP_RC_DUPREQ,
12538c2ecf20Sopenharmony_ci	C_SW_IBP_RDMA_SEQ,
12548c2ecf20Sopenharmony_ci	C_SW_IBP_UNALIGNED,
12558c2ecf20Sopenharmony_ci	C_SW_IBP_SEQ_NAK,
12568c2ecf20Sopenharmony_ci	C_SW_IBP_RC_CRWAITS,
12578c2ecf20Sopenharmony_ci	C_SW_CPU_RC_ACKS,
12588c2ecf20Sopenharmony_ci	C_SW_CPU_RC_QACKS,
12598c2ecf20Sopenharmony_ci	C_SW_CPU_RC_DELAYED_COMP,
12608c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_0,
12618c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_1,
12628c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_2,
12638c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_3,
12648c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_4,
12658c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_5,
12668c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_6,
12678c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_7,
12688c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_8,
12698c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_9,
12708c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_10,
12718c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_11,
12728c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_12,
12738c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_13,
12748c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_14,
12758c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_15,
12768c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_16,
12778c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_17,
12788c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_18,
12798c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_19,
12808c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_20,
12818c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_21,
12828c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_22,
12838c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_23,
12848c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_24,
12858c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_25,
12868c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_26,
12878c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_27,
12888c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_28,
12898c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_29,
12908c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_30,
12918c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_31,
12928c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_32,
12938c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_33,
12948c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_34,
12958c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_35,
12968c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_36,
12978c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_37,
12988c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_38,
12998c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_39,
13008c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_40,
13018c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_41,
13028c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_42,
13038c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_43,
13048c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_44,
13058c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_45,
13068c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_46,
13078c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_47,
13088c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_48,
13098c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_49,
13108c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_50,
13118c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_51,
13128c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_52,
13138c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_53,
13148c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_54,
13158c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_55,
13168c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_56,
13178c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_57,
13188c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_58,
13198c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_59,
13208c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_60,
13218c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_61,
13228c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_62,
13238c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_63,
13248c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_64,
13258c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_65,
13268c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_66,
13278c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_67,
13288c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_68,
13298c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_69,
13308c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_70,
13318c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_71,
13328c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_72,
13338c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_73,
13348c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_74,
13358c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_75,
13368c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_76,
13378c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_77,
13388c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_78,
13398c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_79,
13408c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_80,
13418c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_81,
13428c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_82,
13438c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_83,
13448c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_84,
13458c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_85,
13468c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_86,
13478c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_87,
13488c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_88,
13498c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_89,
13508c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_90,
13518c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_91,
13528c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_92,
13538c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_93,
13548c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_94,
13558c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_95,
13568c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_96,
13578c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_97,
13588c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_98,
13598c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_99,
13608c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_100,
13618c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_101,
13628c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_102,
13638c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_103,
13648c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_104,
13658c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_105,
13668c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_106,
13678c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_107,
13688c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_108,
13698c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_109,
13708c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_110,
13718c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_111,
13728c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_112,
13738c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_113,
13748c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_114,
13758c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_115,
13768c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_116,
13778c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_117,
13788c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_118,
13798c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_119,
13808c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_120,
13818c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_121,
13828c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_122,
13838c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_123,
13848c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_124,
13858c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_125,
13868c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_126,
13878c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_127,
13888c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_128,
13898c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_129,
13908c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_130,
13918c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_131,
13928c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_132,
13938c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_133,
13948c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_134,
13958c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_135,
13968c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_136,
13978c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_137,
13988c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_138,
13998c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_139,
14008c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_140,
14018c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_141,
14028c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_142,
14038c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_143,
14048c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_144,
14058c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_145,
14068c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_146,
14078c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_147,
14088c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_148,
14098c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_149,
14108c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_150,
14118c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_151,
14128c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_152,
14138c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_153,
14148c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_154,
14158c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_155,
14168c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_156,
14178c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_157,
14188c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_158,
14198c2ecf20Sopenharmony_ci	C_RCV_HDR_OVF_159,
14208c2ecf20Sopenharmony_ci	PORT_CNTR_LAST /* Must be kept last */
14218c2ecf20Sopenharmony_ci};
14228c2ecf20Sopenharmony_ci
14238c2ecf20Sopenharmony_ciu64 get_all_cpu_total(u64 __percpu *cntr);
14248c2ecf20Sopenharmony_civoid hfi1_start_cleanup(struct hfi1_devdata *dd);
14258c2ecf20Sopenharmony_civoid hfi1_clear_tids(struct hfi1_ctxtdata *rcd);
14268c2ecf20Sopenharmony_civoid hfi1_init_ctxt(struct send_context *sc);
14278c2ecf20Sopenharmony_civoid hfi1_put_tid(struct hfi1_devdata *dd, u32 index,
14288c2ecf20Sopenharmony_ci		  u32 type, unsigned long pa, u16 order);
14298c2ecf20Sopenharmony_civoid hfi1_quiet_serdes(struct hfi1_pportdata *ppd);
14308c2ecf20Sopenharmony_civoid hfi1_rcvctrl(struct hfi1_devdata *dd, unsigned int op,
14318c2ecf20Sopenharmony_ci		  struct hfi1_ctxtdata *rcd);
14328c2ecf20Sopenharmony_ciu32 hfi1_read_cntrs(struct hfi1_devdata *dd, char **namep, u64 **cntrp);
14338c2ecf20Sopenharmony_ciu32 hfi1_read_portcntrs(struct hfi1_pportdata *ppd, char **namep, u64 **cntrp);
14348c2ecf20Sopenharmony_ciint hfi1_get_ib_cfg(struct hfi1_pportdata *ppd, int which);
14358c2ecf20Sopenharmony_ciint hfi1_set_ib_cfg(struct hfi1_pportdata *ppd, int which, u32 val);
14368c2ecf20Sopenharmony_ciint hfi1_set_ctxt_jkey(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd,
14378c2ecf20Sopenharmony_ci		       u16 jkey);
14388c2ecf20Sopenharmony_ciint hfi1_clear_ctxt_jkey(struct hfi1_devdata *dd, struct hfi1_ctxtdata *ctxt);
14398c2ecf20Sopenharmony_ciint hfi1_set_ctxt_pkey(struct hfi1_devdata *dd, struct hfi1_ctxtdata *ctxt,
14408c2ecf20Sopenharmony_ci		       u16 pkey);
14418c2ecf20Sopenharmony_ciint hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, struct hfi1_ctxtdata *ctxt);
14428c2ecf20Sopenharmony_civoid hfi1_read_link_quality(struct hfi1_devdata *dd, u8 *link_quality);
14438c2ecf20Sopenharmony_civoid hfi1_init_vnic_rsm(struct hfi1_devdata *dd);
14448c2ecf20Sopenharmony_civoid hfi1_deinit_vnic_rsm(struct hfi1_devdata *dd);
14458c2ecf20Sopenharmony_ci
14468c2ecf20Sopenharmony_ciirqreturn_t general_interrupt(int irq, void *data);
14478c2ecf20Sopenharmony_ciirqreturn_t sdma_interrupt(int irq, void *data);
14488c2ecf20Sopenharmony_ciirqreturn_t receive_context_interrupt(int irq, void *data);
14498c2ecf20Sopenharmony_ciirqreturn_t receive_context_thread(int irq, void *data);
14508c2ecf20Sopenharmony_ciirqreturn_t receive_context_interrupt_napi(int irq, void *data);
14518c2ecf20Sopenharmony_ci
14528c2ecf20Sopenharmony_ciint set_intr_bits(struct hfi1_devdata *dd, u16 first, u16 last, bool set);
14538c2ecf20Sopenharmony_civoid init_qsfp_int(struct hfi1_devdata *dd);
14548c2ecf20Sopenharmony_civoid clear_all_interrupts(struct hfi1_devdata *dd);
14558c2ecf20Sopenharmony_civoid remap_intr(struct hfi1_devdata *dd, int isrc, int msix_intr);
14568c2ecf20Sopenharmony_civoid remap_sdma_interrupts(struct hfi1_devdata *dd, int engine, int msix_intr);
14578c2ecf20Sopenharmony_civoid reset_interrupts(struct hfi1_devdata *dd);
14588c2ecf20Sopenharmony_ciu8 hfi1_get_qp_map(struct hfi1_devdata *dd, u8 idx);
14598c2ecf20Sopenharmony_civoid hfi1_init_aip_rsm(struct hfi1_devdata *dd);
14608c2ecf20Sopenharmony_civoid hfi1_deinit_aip_rsm(struct hfi1_devdata *dd);
14618c2ecf20Sopenharmony_ci
14628c2ecf20Sopenharmony_ci/*
14638c2ecf20Sopenharmony_ci * Interrupt source table.
14648c2ecf20Sopenharmony_ci *
14658c2ecf20Sopenharmony_ci * Each entry is an interrupt source "type".  It is ordered by increasing
14668c2ecf20Sopenharmony_ci * number.
14678c2ecf20Sopenharmony_ci */
14688c2ecf20Sopenharmony_cistruct is_table {
14698c2ecf20Sopenharmony_ci	int start;	 /* interrupt source type start */
14708c2ecf20Sopenharmony_ci	int end;	 /* interrupt source type end */
14718c2ecf20Sopenharmony_ci	/* routine that returns the name of the interrupt source */
14728c2ecf20Sopenharmony_ci	char *(*is_name)(char *name, size_t size, unsigned int source);
14738c2ecf20Sopenharmony_ci	/* routine to call when receiving an interrupt */
14748c2ecf20Sopenharmony_ci	void (*is_int)(struct hfi1_devdata *dd, unsigned int source);
14758c2ecf20Sopenharmony_ci};
14768c2ecf20Sopenharmony_ci
14778c2ecf20Sopenharmony_ci#endif /* _CHIP_H */
1478