4 * Copyright(c) 2015, 2016 Intel Corporation.
6 * This file is provided under a dual BSD/GPLv2 license. When using or
7 * redistributing this file, you may do so under either license.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
26 * - Redistributions of source code must retain the above copyright
27 * notice, this list of conditions and the following disclaimer.
28 * - Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in
30 * the documentation and/or other materials provided with the
32 * - Neither the name of Intel Corporation nor the names of its
33 * contributors may be used to endorse or promote products derived
34 * from this software without specific prior written permission.
36 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
37 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
38 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
39 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
40 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
43 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 * This file contains all of the defines that is specific to the HFI chip
55 #define CCE_NUM_MSIX_VECTORS 256
56 #define CCE_NUM_INT_CSRS 12
57 #define CCE_NUM_INT_MAP_CSRS 96
58 #define NUM_INTERRUPT_SOURCES 768
59 #define RXE_NUM_CONTEXTS 160
60 #define RXE_PER_CONTEXT_SIZE 0x1000 /* 4k */
61 #define RXE_NUM_TID_FLOWS 32
62 #define RXE_NUM_DATA_VL 8
63 #define TXE_NUM_CONTEXTS 160
64 #define TXE_NUM_SDMA_ENGINES 16
65 #define NUM_CONTEXTS_PER_SET 8
66 #define VL_ARB_HIGH_PRIO_TABLE_SIZE 16
67 #define VL_ARB_LOW_PRIO_TABLE_SIZE 16
68 #define VL_ARB_TABLE_SIZE 16
69 #define TXE_NUM_32_BIT_COUNTER 7
70 #define TXE_NUM_64_BIT_COUNTER 30
71 #define TXE_NUM_DATA_VL 8
72 #define TXE_PIO_SIZE (32 * 0x100000) /* 32 MB */
73 #define PIO_BLOCK_SIZE 64 /* bytes */
74 #define SDMA_BLOCK_SIZE 64 /* bytes */
75 #define RCV_BUF_BLOCK_SIZE 64 /* bytes */
76 #define PIO_CMASK 0x7ff /* counter mask for free and fill counters */
77 #define MAX_EAGER_ENTRIES 2048 /* max receive eager entries */
78 #define MAX_TID_PAIR_ENTRIES 1024 /* max receive expected pairs */
80 * Virtual? Allocation Unit, defined as AU = 8*2^vAU, 64 bytes, AU is fixed
81 * at 64 bytes for all generation one devices
84 /* HFI link credit count, AKA receive buffer depth (RBUF_DEPTH) */
85 #define CM_GLOBAL_CREDITS 0x880
86 /* Number of PKey entries in the HW */
87 #define MAX_PKEY_VALUES 16
89 #include "chip_registers.h"
91 #define RXE_PER_CONTEXT_USER (RXE + RXE_PER_CONTEXT_OFFSET)
92 #define TXE_PIO_SEND (TXE + TXE_PIO_SEND_OFFSET)
95 #define PBC_INTR BIT_ULL(31)
96 #define PBC_DC_INFO_SHIFT (30)
97 #define PBC_DC_INFO BIT_ULL(PBC_DC_INFO_SHIFT)
98 #define PBC_TEST_EBP BIT_ULL(29)
99 #define PBC_PACKET_BYPASS BIT_ULL(28)
100 #define PBC_CREDIT_RETURN BIT_ULL(25)
101 #define PBC_INSERT_BYPASS_ICRC BIT_ULL(24)
102 #define PBC_TEST_BAD_ICRC BIT_ULL(23)
103 #define PBC_FECN BIT_ULL(22)
105 /* PbcInsertHcrc field settings */
106 #define PBC_IHCRC_LKDETH 0x0 /* insert @ local KDETH offset */
107 #define PBC_IHCRC_GKDETH 0x1 /* insert @ global KDETH offset */
108 #define PBC_IHCRC_NONE 0x2 /* no HCRC inserted */
111 #define PBC_STATIC_RATE_CONTROL_COUNT_SHIFT 32
112 #define PBC_STATIC_RATE_CONTROL_COUNT_MASK 0xffffull
113 #define PBC_STATIC_RATE_CONTROL_COUNT_SMASK \
114 (PBC_STATIC_RATE_CONTROL_COUNT_MASK << \
115 PBC_STATIC_RATE_CONTROL_COUNT_SHIFT)
117 #define PBC_INSERT_HCRC_SHIFT 26
118 #define PBC_INSERT_HCRC_MASK 0x3ull
119 #define PBC_INSERT_HCRC_SMASK \
120 (PBC_INSERT_HCRC_MASK << PBC_INSERT_HCRC_SHIFT)
122 #define PBC_VL_SHIFT 12
123 #define PBC_VL_MASK 0xfull
124 #define PBC_VL_SMASK (PBC_VL_MASK << PBC_VL_SHIFT)
126 #define PBC_LENGTH_DWS_SHIFT 0
127 #define PBC_LENGTH_DWS_MASK 0xfffull
128 #define PBC_LENGTH_DWS_SMASK \
129 (PBC_LENGTH_DWS_MASK << PBC_LENGTH_DWS_SHIFT)
131 /* Credit Return Fields */
132 #define CR_COUNTER_SHIFT 0
133 #define CR_COUNTER_MASK 0x7ffull
134 #define CR_COUNTER_SMASK (CR_COUNTER_MASK << CR_COUNTER_SHIFT)
136 #define CR_STATUS_SHIFT 11
137 #define CR_STATUS_MASK 0x1ull
138 #define CR_STATUS_SMASK (CR_STATUS_MASK << CR_STATUS_SHIFT)
140 #define CR_CREDIT_RETURN_DUE_TO_PBC_SHIFT 12
141 #define CR_CREDIT_RETURN_DUE_TO_PBC_MASK 0x1ull
142 #define CR_CREDIT_RETURN_DUE_TO_PBC_SMASK \
143 (CR_CREDIT_RETURN_DUE_TO_PBC_MASK << \
144 CR_CREDIT_RETURN_DUE_TO_PBC_SHIFT)
146 #define CR_CREDIT_RETURN_DUE_TO_THRESHOLD_SHIFT 13
147 #define CR_CREDIT_RETURN_DUE_TO_THRESHOLD_MASK 0x1ull
148 #define CR_CREDIT_RETURN_DUE_TO_THRESHOLD_SMASK \
149 (CR_CREDIT_RETURN_DUE_TO_THRESHOLD_MASK << \
150 CR_CREDIT_RETURN_DUE_TO_THRESHOLD_SHIFT)
152 #define CR_CREDIT_RETURN_DUE_TO_ERR_SHIFT 14
153 #define CR_CREDIT_RETURN_DUE_TO_ERR_MASK 0x1ull
154 #define CR_CREDIT_RETURN_DUE_TO_ERR_SMASK \
155 (CR_CREDIT_RETURN_DUE_TO_ERR_MASK << \
156 CR_CREDIT_RETURN_DUE_TO_ERR_SHIFT)
158 #define CR_CREDIT_RETURN_DUE_TO_FORCE_SHIFT 15
159 #define CR_CREDIT_RETURN_DUE_TO_FORCE_MASK 0x1ull
160 #define CR_CREDIT_RETURN_DUE_TO_FORCE_SMASK \
161 (CR_CREDIT_RETURN_DUE_TO_FORCE_MASK << \
162 CR_CREDIT_RETURN_DUE_TO_FORCE_SHIFT)
164 /* interrupt source numbers */
165 #define IS_GENERAL_ERR_START 0
166 #define IS_SDMAENG_ERR_START 16
167 #define IS_SENDCTXT_ERR_START 32
168 #define IS_SDMA_START 192 /* includes SDmaProgress,SDmaIdle */
169 #define IS_VARIOUS_START 240
170 #define IS_DC_START 248
171 #define IS_RCVAVAIL_START 256
172 #define IS_RCVURGENT_START 416
173 #define IS_SENDCREDIT_START 576
174 #define IS_RESERVED_START 736
175 #define IS_MAX_SOURCES 768
177 /* derived interrupt source values */
178 #define IS_GENERAL_ERR_END IS_SDMAENG_ERR_START
179 #define IS_SDMAENG_ERR_END IS_SENDCTXT_ERR_START
180 #define IS_SENDCTXT_ERR_END IS_SDMA_START
181 #define IS_SDMA_END IS_VARIOUS_START
182 #define IS_VARIOUS_END IS_DC_START
183 #define IS_DC_END IS_RCVAVAIL_START
184 #define IS_RCVAVAIL_END IS_RCVURGENT_START
185 #define IS_RCVURGENT_END IS_SENDCREDIT_START
186 #define IS_SENDCREDIT_END IS_RESERVED_START
187 #define IS_RESERVED_END IS_MAX_SOURCES
189 /* absolute interrupt numbers for QSFP1Int and QSFP2Int */
190 #define QSFP1_INT 242
191 #define QSFP2_INT 243
193 /* DCC_CFG_PORT_CONFIG logical link states */
194 #define LSTATE_DOWN 0x1
195 #define LSTATE_INIT 0x2
196 #define LSTATE_ARMED 0x3
197 #define LSTATE_ACTIVE 0x4
199 /* DC8051_STS_CUR_STATE port values (physical link states) */
200 #define PLS_DISABLED 0x30
201 #define PLS_OFFLINE 0x90
202 #define PLS_OFFLINE_QUIET 0x90
203 #define PLS_OFFLINE_PLANNED_DOWN_INFORM 0x91
204 #define PLS_OFFLINE_READY_TO_QUIET_LT 0x92
205 #define PLS_OFFLINE_REPORT_FAILURE 0x93
206 #define PLS_OFFLINE_READY_TO_QUIET_BCC 0x94
207 #define PLS_POLLING 0x20
208 #define PLS_POLLING_QUIET 0x20
209 #define PLS_POLLING_ACTIVE 0x21
210 #define PLS_CONFIGPHY 0x40
211 #define PLS_CONFIGPHY_DEBOUCE 0x40
212 #define PLS_CONFIGPHY_ESTCOMM 0x41
213 #define PLS_CONFIGPHY_ESTCOMM_TXRX_HUNT 0x42
214 #define PLS_CONFIGPHY_ESTCOMM_LOCAL_COMPLETE 0x43
215 #define PLS_CONFIGPHY_OPTEQ 0x44
216 #define PLS_CONFIGPHY_OPTEQ_OPTIMIZING 0x44
217 #define PLS_CONFIGPHY_OPTEQ_LOCAL_COMPLETE 0x45
218 #define PLS_CONFIGPHY_VERIFYCAP 0x46
219 #define PLS_CONFIGPHY_VERIFYCAP_EXCHANGE 0x46
220 #define PLS_CONFIGPHY_VERIFYCAP_LOCAL_COMPLETE 0x47
221 #define PLS_CONFIGLT 0x48
222 #define PLS_CONFIGLT_CONFIGURE 0x48
223 #define PLS_CONFIGLT_LINK_TRANSFER_ACTIVE 0x49
224 #define PLS_LINKUP 0x50
225 #define PLS_PHYTEST 0xB0
226 #define PLS_INTERNAL_SERDES_LOOPBACK 0xe1
227 #define PLS_QUICK_LINKUP 0xe2
229 /* DC_DC8051_CFG_HOST_CMD_0.REQ_TYPE - 8051 host commands */
230 #define HCMD_LOAD_CONFIG_DATA 0x01
231 #define HCMD_READ_CONFIG_DATA 0x02
232 #define HCMD_CHANGE_PHY_STATE 0x03
233 #define HCMD_SEND_LCB_IDLE_MSG 0x04
234 #define HCMD_MISC 0x05
235 #define HCMD_READ_LCB_IDLE_MSG 0x06
236 #define HCMD_READ_LCB_CSR 0x07
237 #define HCMD_WRITE_LCB_CSR 0x08
238 #define HCMD_INTERFACE_TEST 0xff
240 /* DC_DC8051_CFG_HOST_CMD_1.RETURN_CODE - 8051 host command return */
241 #define HCMD_SUCCESS 2
243 /* DC_DC8051_DBG_ERR_INFO_SET_BY_8051.ERROR - error flags */
244 #define SPICO_ROM_FAILED BIT(0)
245 #define UNKNOWN_FRAME BIT(1)
246 #define TARGET_BER_NOT_MET BIT(2)
247 #define FAILED_SERDES_INTERNAL_LOOPBACK BIT(3)
248 #define FAILED_SERDES_INIT BIT(4)
249 #define FAILED_LNI_POLLING BIT(5)
250 #define FAILED_LNI_DEBOUNCE BIT(6)
251 #define FAILED_LNI_ESTBCOMM BIT(7)
252 #define FAILED_LNI_OPTEQ BIT(8)
253 #define FAILED_LNI_VERIFY_CAP1 BIT(9)
254 #define FAILED_LNI_VERIFY_CAP2 BIT(10)
255 #define FAILED_LNI_CONFIGLT BIT(11)
256 #define HOST_HANDSHAKE_TIMEOUT BIT(12)
257 #define EXTERNAL_DEVICE_REQ_TIMEOUT BIT(13)
259 #define FAILED_LNI (FAILED_LNI_POLLING | FAILED_LNI_DEBOUNCE \
260 | FAILED_LNI_ESTBCOMM | FAILED_LNI_OPTEQ \
261 | FAILED_LNI_VERIFY_CAP1 \
262 | FAILED_LNI_VERIFY_CAP2 \
263 | FAILED_LNI_CONFIGLT | HOST_HANDSHAKE_TIMEOUT \
264 | EXTERNAL_DEVICE_REQ_TIMEOUT)
266 /* DC_DC8051_DBG_ERR_INFO_SET_BY_8051.HOST_MSG - host message flags */
267 #define HOST_REQ_DONE BIT(0)
268 #define BC_PWR_MGM_MSG BIT(1)
269 #define BC_SMA_MSG BIT(2)
270 #define BC_BCC_UNKNOWN_MSG BIT(3)
271 #define BC_IDLE_UNKNOWN_MSG BIT(4)
272 #define EXT_DEVICE_CFG_REQ BIT(5)
273 #define VERIFY_CAP_FRAME BIT(6)
274 #define LINKUP_ACHIEVED BIT(7)
275 #define LINK_GOING_DOWN BIT(8)
276 #define LINK_WIDTH_DOWNGRADED BIT(9)
278 /* DC_DC8051_CFG_EXT_DEV_1.REQ_TYPE - 8051 host requests */
279 #define HREQ_LOAD_CONFIG 0x01
280 #define HREQ_SAVE_CONFIG 0x02
281 #define HREQ_READ_CONFIG 0x03
282 #define HREQ_SET_TX_EQ_ABS 0x04
283 #define HREQ_SET_TX_EQ_REL 0x05
284 #define HREQ_ENABLE 0x06
285 #define HREQ_CONFIG_DONE 0xfe
286 #define HREQ_INTERFACE_TEST 0xff
288 /* DC_DC8051_CFG_EXT_DEV_0.RETURN_CODE - 8051 host request return codes */
289 #define HREQ_INVALID 0x01
290 #define HREQ_SUCCESS 0x02
291 #define HREQ_NOT_SUPPORTED 0x03
292 #define HREQ_FEATURE_NOT_SUPPORTED 0x04 /* request specific feature */
293 #define HREQ_REQUEST_REJECTED 0xfe
294 #define HREQ_EXECUTION_ONGOING 0xff
296 /* MISC host command functions */
297 #define HCMD_MISC_REQUEST_LCB_ACCESS 0x1
298 #define HCMD_MISC_GRANT_LCB_ACCESS 0x2
300 /* idle flit message types */
301 #define IDLE_PHYSICAL_LINK_MGMT 0x1
304 #define IDLE_POWER_MGMT 0x4
306 /* idle flit message send fields (both send and read) */
307 #define IDLE_PAYLOAD_MASK 0xffffffffffull /* 40 bits */
308 #define IDLE_PAYLOAD_SHIFT 8
309 #define IDLE_MSG_TYPE_MASK 0xf
310 #define IDLE_MSG_TYPE_SHIFT 0
312 /* idle flit message read fields */
313 #define READ_IDLE_MSG_TYPE_MASK 0xf
314 #define READ_IDLE_MSG_TYPE_SHIFT 0
316 /* SMA idle flit payload commands */
317 #define SMA_IDLE_ARM 1
318 #define SMA_IDLE_ACTIVE 2
320 /* DC_DC8051_CFG_MODE.GENERAL bits */
321 #define DISABLE_SELF_GUID_CHECK 0x2
323 /* Bad L2 frame error code */
324 #define BAD_L2_ERR 0x6
327 * Eager buffer minimum and maximum sizes supported by the hardware.
328 * All power-of-two sizes in between are supported as well.
329 * MAX_EAGER_BUFFER_TOTAL is the maximum size of memory
330 * allocatable for Eager buffer to a single context. All others
331 * are limits for the RcvArray entries.
333 #define MIN_EAGER_BUFFER (4 * 1024)
334 #define MAX_EAGER_BUFFER (256 * 1024)
335 #define MAX_EAGER_BUFFER_TOTAL (64 * (1 << 20)) /* max per ctxt 64MB */
336 #define MAX_EXPECTED_BUFFER (2048 * 1024)
339 * Receive expected base and count and eager base and count increment -
340 * the CSR fields hold multiples of this value.
343 #define RCV_INCREMENT BIT(RCV_SHIFT)
346 * Receive header queue entry increment - the CSR holds multiples of
349 #define HDRQ_SIZE_SHIFT 5
350 #define HDRQ_INCREMENT BIT(HDRQ_SIZE_SHIFT)
353 * Freeze handling flags
355 #define FREEZE_ABORT 0x01 /* do not do recovery */
356 #define FREEZE_SELF 0x02 /* initiate the freeze */
357 #define FREEZE_LINK_DOWN 0x04 /* link is down */
360 * Chip implementation codes.
362 #define ICODE_RTL_SILICON 0x00
363 #define ICODE_RTL_VCS_SIMULATION 0x01
364 #define ICODE_FPGA_EMULATION 0x02
365 #define ICODE_FUNCTIONAL_SIMULATOR 0x03
368 * 8051 data memory size.
370 #define DC8051_DATA_MEM_SIZE 0x1000
373 * 8051 firmware registers
375 #define NUM_GENERAL_FIELDS 0x17
376 #define NUM_LANE_FIELDS 0x8
378 /* 8051 general register Field IDs */
379 #define LINK_OPTIMIZATION_SETTINGS 0x00
380 #define LINK_TUNING_PARAMETERS 0x02
381 #define DC_HOST_COMM_SETTINGS 0x03
382 #define TX_SETTINGS 0x06
383 #define VERIFY_CAP_LOCAL_PHY 0x07
384 #define VERIFY_CAP_LOCAL_FABRIC 0x08
385 #define VERIFY_CAP_LOCAL_LINK_WIDTH 0x09
386 #define LOCAL_DEVICE_ID 0x0a
387 #define LOCAL_LNI_INFO 0x0c
388 #define REMOTE_LNI_INFO 0x0d
389 #define MISC_STATUS 0x0e
390 #define VERIFY_CAP_REMOTE_PHY 0x0f
391 #define VERIFY_CAP_REMOTE_FABRIC 0x10
392 #define VERIFY_CAP_REMOTE_LINK_WIDTH 0x11
393 #define LAST_LOCAL_STATE_COMPLETE 0x12
394 #define LAST_REMOTE_STATE_COMPLETE 0x13
395 #define LINK_QUALITY_INFO 0x14
396 #define REMOTE_DEVICE_ID 0x15
397 #define LINK_DOWN_REASON 0x16
399 /* 8051 lane specific register field IDs */
400 #define TX_EQ_SETTINGS 0x00
401 #define CHANNEL_LOSS_SETTINGS 0x05
403 /* Lane ID for general configuration registers */
404 #define GENERAL_CONFIG 4
406 /* LINK_TUNING_PARAMETERS fields */
407 #define TUNING_METHOD_SHIFT 24
409 /* LINK_OPTIMIZATION_SETTINGS fields */
410 #define ENABLE_EXT_DEV_CONFIG_SHIFT 24
412 /* LOAD_DATA 8051 command shifts and fields */
413 #define LOAD_DATA_FIELD_ID_SHIFT 40
414 #define LOAD_DATA_FIELD_ID_MASK 0xfull
415 #define LOAD_DATA_LANE_ID_SHIFT 32
416 #define LOAD_DATA_LANE_ID_MASK 0xfull
417 #define LOAD_DATA_DATA_SHIFT 0x0
418 #define LOAD_DATA_DATA_MASK 0xffffffffull
420 /* READ_DATA 8051 command shifts and fields */
421 #define READ_DATA_FIELD_ID_SHIFT 40
422 #define READ_DATA_FIELD_ID_MASK 0xffull
423 #define READ_DATA_LANE_ID_SHIFT 32
424 #define READ_DATA_LANE_ID_MASK 0xffull
425 #define READ_DATA_DATA_SHIFT 0x0
426 #define READ_DATA_DATA_MASK 0xffffffffull
428 /* TX settings fields */
429 #define ENABLE_LANE_TX_SHIFT 0
430 #define ENABLE_LANE_TX_MASK 0xff
431 #define TX_POLARITY_INVERSION_SHIFT 8
432 #define TX_POLARITY_INVERSION_MASK 0xff
433 #define RX_POLARITY_INVERSION_SHIFT 16
434 #define RX_POLARITY_INVERSION_MASK 0xff
435 #define MAX_RATE_SHIFT 24
436 #define MAX_RATE_MASK 0xff
438 /* verify capability PHY fields */
439 #define CONTINIOUS_REMOTE_UPDATE_SUPPORT_SHIFT 0x4
440 #define CONTINIOUS_REMOTE_UPDATE_SUPPORT_MASK 0x1
441 #define POWER_MANAGEMENT_SHIFT 0x0
442 #define POWER_MANAGEMENT_MASK 0xf
444 /* 8051 lane register Field IDs */
445 #define SPICO_FW_VERSION 0x7 /* SPICO firmware version */
447 /* SPICO firmware version fields */
448 #define SPICO_ROM_VERSION_SHIFT 0
449 #define SPICO_ROM_VERSION_MASK 0xffff
450 #define SPICO_ROM_PROD_ID_SHIFT 16
451 #define SPICO_ROM_PROD_ID_MASK 0xffff
453 /* verify capability fabric fields */
455 #define VAU_MASK 0x0007
457 #define Z_MASK 0x0001
459 #define VCU_MASK 0x0007
460 #define VL15BUF_SHIFT 8
461 #define VL15BUF_MASK 0x0fff
462 #define CRC_SIZES_SHIFT 20
463 #define CRC_SIZES_MASK 0x7
465 /* verify capability local link width fields */
466 #define LINK_WIDTH_SHIFT 0 /* also for remote link width */
467 #define LINK_WIDTH_MASK 0xffff /* also for remote link width */
468 #define LOCAL_FLAG_BITS_SHIFT 16
469 #define LOCAL_FLAG_BITS_MASK 0xff
470 #define MISC_CONFIG_BITS_SHIFT 24
471 #define MISC_CONFIG_BITS_MASK 0xff
473 /* verify capability remote link width fields */
474 #define REMOTE_TX_RATE_SHIFT 16
475 #define REMOTE_TX_RATE_MASK 0xff
477 /* LOCAL_DEVICE_ID fields */
478 #define LOCAL_DEVICE_REV_SHIFT 0
479 #define LOCAL_DEVICE_REV_MASK 0xff
480 #define LOCAL_DEVICE_ID_SHIFT 8
481 #define LOCAL_DEVICE_ID_MASK 0xffff
483 /* REMOTE_DEVICE_ID fields */
484 #define REMOTE_DEVICE_REV_SHIFT 0
485 #define REMOTE_DEVICE_REV_MASK 0xff
486 #define REMOTE_DEVICE_ID_SHIFT 8
487 #define REMOTE_DEVICE_ID_MASK 0xffff
489 /* local LNI link width fields */
490 #define ENABLE_LANE_RX_SHIFT 16
491 #define ENABLE_LANE_RX_MASK 0xff
493 /* mask, shift for reading 'mgmt_enabled' value from REMOTE_LNI_INFO field */
494 #define MGMT_ALLOWED_SHIFT 23
495 #define MGMT_ALLOWED_MASK 0x1
497 /* mask, shift for 'link_quality' within LINK_QUALITY_INFO field */
498 #define LINK_QUALITY_SHIFT 24
499 #define LINK_QUALITY_MASK 0x7
502 * mask, shift for reading 'planned_down_remote_reason_code'
503 * from LINK_QUALITY_INFO field
505 #define DOWN_REMOTE_REASON_SHIFT 16
506 #define DOWN_REMOTE_REASON_MASK 0xff
508 /* verify capability PHY power management bits */
509 #define PWRM_BER_CONTROL 0x1
510 #define PWRM_BANDWIDTH_CONTROL 0x2
512 /* 8051 link down reasons */
513 #define LDR_LINK_TRANSFER_ACTIVE_LOW 0xa
514 #define LDR_RECEIVED_LINKDOWN_IDLE_MSG 0xb
515 #define LDR_RECEIVED_HOST_OFFLINE_REQ 0xc
517 /* verify capability fabric CRC size bits */
519 CAP_CRC_14B = (1 << 0), /* 14b CRC */
520 CAP_CRC_48B = (1 << 1), /* 48b CRC */
521 CAP_CRC_12B_16B_PER_LANE = (1 << 2) /* 12b-16b per lane CRC */
524 #define SUPPORTED_CRCS (CAP_CRC_14B | CAP_CRC_48B)
526 /* misc status version fields */
527 #define STS_FM_VERSION_A_SHIFT 16
528 #define STS_FM_VERSION_A_MASK 0xff
529 #define STS_FM_VERSION_B_SHIFT 24
530 #define STS_FM_VERSION_B_MASK 0xff
532 /* LCB_CFG_CRC_MODE TX_VAL and RX_VAL CRC mode values */
533 #define LCB_CRC_16B 0x0 /* 16b CRC */
534 #define LCB_CRC_14B 0x1 /* 14b CRC */
535 #define LCB_CRC_48B 0x2 /* 48b CRC */
536 #define LCB_CRC_12B_16B_PER_LANE 0x3 /* 12b-16b per lane CRC */
539 * the following enum is (almost) a copy/paste of the definition
540 * in the OPA spec, section 20.2.2.6.8 (PortInfo)
543 PORT_LTP_CRC_MODE_NONE = 0,
544 PORT_LTP_CRC_MODE_14 = 1, /* 14-bit LTP CRC mode (optional) */
545 PORT_LTP_CRC_MODE_16 = 2, /* 16-bit LTP CRC mode */
546 PORT_LTP_CRC_MODE_48 = 4,
547 /* 48-bit overlapping LTP CRC mode (optional) */
548 PORT_LTP_CRC_MODE_PER_LANE = 8
549 /* 12 to 16 bit per lane LTP CRC mode (optional) */
553 #define LINK_RESTART_DELAY 1000 /* link restart delay, in ms */
554 #define TIMEOUT_8051_START 5000 /* 8051 start timeout, in ms */
555 #define DC8051_COMMAND_TIMEOUT 20000 /* DC8051 command timeout, in ms */
556 #define FREEZE_STATUS_TIMEOUT 20 /* wait for freeze indicators, in ms */
557 #define VL_STATUS_CLEAR_TIMEOUT 5000 /* per-VL status clear, in ms */
558 #define CCE_STATUS_TIMEOUT 10 /* time to clear CCE Status, in ms */
560 /* cclock tick time, in picoseconds per tick: 1/speed * 10^12 */
561 #define ASIC_CCLOCK_PS 1242 /* 805 MHz */
562 #define FPGA_CCLOCK_PS 30300 /* 33 MHz */
565 * Mask of enabled MISC errors. Do not enable the two RSA engine errors -
566 * see firmware.c:run_rsa() for details.
568 #define DRIVER_MISC_MASK \
569 (~(MISC_ERR_STATUS_MISC_FW_AUTH_FAILED_ERR_SMASK \
570 | MISC_ERR_STATUS_MISC_KEY_MISMATCH_ERR_SMASK))
572 /* valid values for the loopback module parameter */
573 #define LOOPBACK_NONE 0 /* no loopback - default */
574 #define LOOPBACK_SERDES 1
575 #define LOOPBACK_LCB 2
576 #define LOOPBACK_CABLE 3 /* external cable */
578 /* read and write hardware registers */
579 u64 read_csr(const struct hfi1_devdata *dd, u32 offset);
580 void write_csr(const struct hfi1_devdata *dd, u32 offset, u64 value);
583 * The *_kctxt_* flavor of the CSR read/write functions are for
584 * per-context or per-SDMA CSRs that are not mappable to user-space.
585 * Their spacing is not a PAGE_SIZE multiple.
587 static inline u64 read_kctxt_csr(const struct hfi1_devdata *dd, int ctxt,
590 /* kernel per-context CSRs are separated by 0x100 */
591 return read_csr(dd, offset0 + (0x100 * ctxt));
594 static inline void write_kctxt_csr(struct hfi1_devdata *dd, int ctxt,
595 u32 offset0, u64 value)
597 /* kernel per-context CSRs are separated by 0x100 */
598 write_csr(dd, offset0 + (0x100 * ctxt), value);
601 int read_lcb_csr(struct hfi1_devdata *dd, u32 offset, u64 *data);
602 int write_lcb_csr(struct hfi1_devdata *dd, u32 offset, u64 data);
604 void __iomem *get_csr_addr(
605 struct hfi1_devdata *dd,
608 static inline void __iomem *get_kctxt_csr_addr(
609 struct hfi1_devdata *dd,
613 return get_csr_addr(dd, offset0 + (0x100 * ctxt));
617 * The *_uctxt_* flavor of the CSR read/write functions are for
618 * per-context CSRs that are mappable to user space. All these CSRs
619 * are spaced by a PAGE_SIZE multiple in order to be mappable to
620 * different processes without exposing other contexts' CSRs
622 static inline u64 read_uctxt_csr(const struct hfi1_devdata *dd, int ctxt,
625 /* user per-context CSRs are separated by 0x1000 */
626 return read_csr(dd, offset0 + (0x1000 * ctxt));
629 static inline void write_uctxt_csr(struct hfi1_devdata *dd, int ctxt,
630 u32 offset0, u64 value)
632 /* user per-context CSRs are separated by 0x1000 */
633 write_csr(dd, offset0 + (0x1000 * ctxt), value);
636 u64 create_pbc(struct hfi1_pportdata *ppd, u64, int, u32, u32);
639 #define SBUS_MASTER_BROADCAST 0xfd
640 #define NUM_PCIE_SERDES 16 /* number of PCIe serdes on the SBus */
641 extern const u8 pcie_serdes_broadcast[];
642 extern const u8 pcie_pcs_addrs[2][NUM_PCIE_SERDES];
643 extern uint platform_config_load;
646 #define RESET_SBUS_RECEIVER 0x20
647 #define WRITE_SBUS_RECEIVER 0x21
648 #define READ_SBUS_RECEIVER 0x22
649 void sbus_request(struct hfi1_devdata *dd,
650 u8 receiver_addr, u8 data_addr, u8 command, u32 data_in);
651 int sbus_request_slow(struct hfi1_devdata *dd,
652 u8 receiver_addr, u8 data_addr, u8 command, u32 data_in);
653 void set_sbus_fast_mode(struct hfi1_devdata *dd);
654 void clear_sbus_fast_mode(struct hfi1_devdata *dd);
655 int hfi1_firmware_init(struct hfi1_devdata *dd);
656 int load_pcie_firmware(struct hfi1_devdata *dd);
657 int load_firmware(struct hfi1_devdata *dd);
658 void dispose_firmware(void);
659 int acquire_hw_mutex(struct hfi1_devdata *dd);
660 void release_hw_mutex(struct hfi1_devdata *dd);
663 * Bitmask of dynamic access for ASIC block chip resources. Each HFI has its
664 * own range of bits for the resource so it can clear its own bits on
665 * starting and exiting. If either HFI has the resource bit set, the
666 * resource is in use. The separate bit ranges are:
670 #define CR_SBUS 0x01 /* SBUS, THERM, and PCIE registers */
671 #define CR_EPROM 0x02 /* EEP, GPIO registers */
672 #define CR_I2C1 0x04 /* QSFP1_OE register */
673 #define CR_I2C2 0x08 /* QSFP2_OE register */
674 #define CR_DYN_SHIFT 8 /* dynamic flag shift */
675 #define CR_DYN_MASK ((1ull << CR_DYN_SHIFT) - 1)
678 * Bitmask of static ASIC states these are outside of the dynamic ASIC
679 * block chip resources above. These are to be set once and never cleared.
680 * Must be holding the SBus dynamic flag when setting.
682 #define CR_THERM_INIT 0x010000
684 int acquire_chip_resource(struct hfi1_devdata *dd, u32 resource, u32 mswait);
685 void release_chip_resource(struct hfi1_devdata *dd, u32 resource);
686 bool check_chip_resource(struct hfi1_devdata *dd, u32 resource,
688 void init_chip_resources(struct hfi1_devdata *dd);
689 void finish_chip_resources(struct hfi1_devdata *dd);
691 /* ms wait time for access to an SBus resoure */
692 #define SBUS_TIMEOUT 4000 /* long enough for a FW download and SBR */
694 /* ms wait time for a qsfp (i2c) chain to become available */
695 #define QSFP_WAIT 20000 /* long enough for FW update to the F4 uc */
697 void fabric_serdes_reset(struct hfi1_devdata *dd);
698 int read_8051_data(struct hfi1_devdata *dd, u32 addr, u32 len, u64 *result);
701 void read_misc_status(struct hfi1_devdata *dd, u8 *ver_a, u8 *ver_b);
702 void read_guid(struct hfi1_devdata *dd);
703 int wait_fm_ready(struct hfi1_devdata *dd, u32 mstimeout);
704 void set_link_down_reason(struct hfi1_pportdata *ppd, u8 lcl_reason,
705 u8 neigh_reason, u8 rem_reason);
706 int set_link_state(struct hfi1_pportdata *, u32 state);
707 int port_ltp_to_cap(int port_ltp);
708 void handle_verify_cap(struct work_struct *work);
709 void handle_freeze(struct work_struct *work);
710 void handle_link_up(struct work_struct *work);
711 void handle_link_down(struct work_struct *work);
712 void handle_link_downgrade(struct work_struct *work);
713 void handle_link_bounce(struct work_struct *work);
714 void handle_start_link(struct work_struct *work);
715 void handle_sma_message(struct work_struct *work);
716 void reset_qsfp(struct hfi1_pportdata *ppd);
717 void qsfp_event(struct work_struct *work);
718 void start_freeze_handling(struct hfi1_pportdata *ppd, int flags);
719 int send_idle_sma(struct hfi1_devdata *dd, u64 message);
720 int load_8051_config(struct hfi1_devdata *, u8, u8, u32);
721 int read_8051_config(struct hfi1_devdata *, u8, u8, u32 *);
722 int start_link(struct hfi1_pportdata *ppd);
723 int bringup_serdes(struct hfi1_pportdata *ppd);
724 void set_intr_state(struct hfi1_devdata *dd, u32 enable);
725 void apply_link_downgrade_policy(struct hfi1_pportdata *ppd,
727 void update_usrhead(struct hfi1_ctxtdata *, u32, u32, u32, u32, u32);
728 int stop_drain_data_vls(struct hfi1_devdata *dd);
729 int open_fill_data_vls(struct hfi1_devdata *dd);
730 u32 ns_to_cclock(struct hfi1_devdata *dd, u32 ns);
731 u32 cclock_to_ns(struct hfi1_devdata *dd, u32 cclock);
732 void get_linkup_link_widths(struct hfi1_pportdata *ppd);
733 void read_ltp_rtt(struct hfi1_devdata *dd);
734 void clear_linkup_counters(struct hfi1_devdata *dd);
735 u32 hdrqempty(struct hfi1_ctxtdata *rcd);
736 int is_ax(struct hfi1_devdata *dd);
737 int is_bx(struct hfi1_devdata *dd);
738 u32 read_physical_state(struct hfi1_devdata *dd);
739 u32 chip_to_opa_pstate(struct hfi1_devdata *dd, u32 chip_pstate);
740 u32 get_logical_state(struct hfi1_pportdata *ppd);
741 const char *opa_lstate_name(u32 lstate);
742 const char *opa_pstate_name(u32 pstate);
743 u32 driver_physical_state(struct hfi1_pportdata *ppd);
744 u32 driver_logical_state(struct hfi1_pportdata *ppd);
746 int acquire_lcb_access(struct hfi1_devdata *dd, int sleep_ok);
747 int release_lcb_access(struct hfi1_devdata *dd, int sleep_ok);
748 #define LCB_START DC_LCB_CSRS
749 #define LCB_END DC_8051_CSRS /* next block is 8051 */
750 static inline int is_lcb_offset(u32 offset)
752 return (offset >= LCB_START && offset < LCB_END);
757 extern uint disable_integrity;
758 u64 read_dev_cntr(struct hfi1_devdata *dd, int index, int vl);
759 u64 write_dev_cntr(struct hfi1_devdata *dd, int index, int vl, u64 data);
760 u64 read_port_cntr(struct hfi1_pportdata *ppd, int index, int vl);
761 u64 write_port_cntr(struct hfi1_pportdata *ppd, int index, int vl, u64 data);
762 u32 read_logical_state(struct hfi1_devdata *dd);
763 void force_recv_intr(struct hfi1_ctxtdata *rcd);
779 static inline int vl_from_idx(int idx)
781 return (idx == C_VL_15 ? 15 : idx);
784 static inline int idx_from_vl(int vl)
786 return (vl == 15 ? C_VL_15 : vl);
789 /* Per device counter indexes */
843 C_DC_REINIT_FROM_PEER_CNT,
846 C_DC_PRF_GOOD_LTP_CNT,
847 C_DC_PRF_ACCEPTED_LTP_CNT,
848 C_DC_PRF_RX_FLIT_CNT,
849 C_DC_PRF_TX_FLIT_CNT,
851 C_DC_PG_DBG_FLIT_CRDTS_CNT,
852 C_DC_PG_STS_PAUSE_COMPLETE_CNT,
853 C_DC_PG_STS_TX_SBE_CNT,
854 C_DC_PG_STS_TX_MBE_CNT,
862 C_SDMA_DESC_FETCHED_CNT,
866 C_SDMA_PROGRESS_INT_CNT,
867 /* MISC_ERR_STATUS */
868 C_MISC_PLL_LOCK_FAIL_ERR,
869 C_MISC_MBIST_FAIL_ERR,
870 C_MISC_INVALID_EEP_CMD_ERR,
871 C_MISC_EFUSE_DONE_PARITY_ERR,
872 C_MISC_EFUSE_WRITE_ERR,
873 C_MISC_EFUSE_READ_BAD_ADDR_ERR,
874 C_MISC_EFUSE_CSR_PARITY_ERR,
875 C_MISC_FW_AUTH_FAILED_ERR,
876 C_MISC_KEY_MISMATCH_ERR,
877 C_MISC_SBUS_WRITE_FAILED_ERR,
878 C_MISC_CSR_WRITE_BAD_ADDR_ERR,
879 C_MISC_CSR_READ_BAD_ADDR_ERR,
880 C_MISC_CSR_PARITY_ERR,
883 * A special counter that is the aggregate count
884 * of all the cce_err_status errors. The remainder
885 * are actual bits in the CceErrStatus register.
887 C_CCE_ERR_STATUS_AGGREGATED_CNT,
888 C_CCE_MSIX_CSR_PARITY_ERR,
889 C_CCE_INT_MAP_UNC_ERR,
890 C_CCE_INT_MAP_COR_ERR,
891 C_CCE_MSIX_TABLE_UNC_ERR,
892 C_CCE_MSIX_TABLE_COR_ERR,
893 C_CCE_RXDMA_CONV_FIFO_PARITY_ERR,
894 C_CCE_RCPL_ASYNC_FIFO_PARITY_ERR,
895 C_CCE_SEG_WRITE_BAD_ADDR_ERR,
896 C_CCE_SEG_READ_BAD_ADDR_ERR,
898 C_CCE_TRGT_CPL_TIMEOUT_ERR,
899 C_PCIC_RECEIVE_PARITY_ERR,
900 C_PCIC_TRANSMIT_BACK_PARITY_ERR,
901 C_PCIC_TRANSMIT_FRONT_PARITY_ERR,
902 C_PCIC_CPL_DAT_Q_UNC_ERR,
903 C_PCIC_CPL_HD_Q_UNC_ERR,
904 C_PCIC_POST_DAT_Q_UNC_ERR,
905 C_PCIC_POST_HD_Q_UNC_ERR,
906 C_PCIC_RETRY_SOT_MEM_UNC_ERR,
907 C_PCIC_RETRY_MEM_UNC_ERR,
908 C_PCIC_N_POST_DAT_Q_PARITY_ERR,
909 C_PCIC_N_POST_H_Q_PARITY_ERR,
910 C_PCIC_CPL_DAT_Q_COR_ERR,
911 C_PCIC_CPL_HD_Q_COR_ERR,
912 C_PCIC_POST_DAT_Q_COR_ERR,
913 C_PCIC_POST_HD_Q_COR_ERR,
914 C_PCIC_RETRY_SOT_MEM_COR_ERR,
915 C_PCIC_RETRY_MEM_COR_ERR,
916 C_CCE_CLI1_ASYNC_FIFO_DBG_PARITY_ERR,
917 C_CCE_CLI1_ASYNC_FIFO_RXDMA_PARITY_ERR,
918 C_CCE_CLI1_ASYNC_FIFO_SDMA_HD_PARITY_ERR,
919 C_CCE_CLI1_ASYNC_FIFO_PIO_CRDT_PARITY_ERR,
920 C_CCE_CLI2_ASYNC_FIFO_PARITY_ERR,
921 C_CCE_CSR_CFG_BUS_PARITY_ERR,
922 C_CCE_CLI0_ASYNC_FIFO_PARTIY_ERR,
923 C_CCE_RSPD_DATA_PARITY_ERR,
924 C_CCE_TRGT_ACCESS_ERR,
925 C_CCE_TRGT_ASYNC_FIFO_PARITY_ERR,
926 C_CCE_CSR_WRITE_BAD_ADDR_ERR,
927 C_CCE_CSR_READ_BAD_ADDR_ERR,
928 C_CCE_CSR_PARITY_ERR,
931 C_RX_CSR_WRITE_BAD_ADDR_ERR,
932 C_RX_CSR_READ_BAD_ADDR_ERR,
933 C_RX_DMA_CSR_UNC_ERR,
934 C_RX_DMA_DQ_FSM_ENCODING_ERR,
935 C_RX_DMA_EQ_FSM_ENCODING_ERR,
936 C_RX_DMA_CSR_PARITY_ERR,
937 C_RX_RBUF_DATA_COR_ERR,
938 C_RX_RBUF_DATA_UNC_ERR,
939 C_RX_DMA_DATA_FIFO_RD_COR_ERR,
940 C_RX_DMA_DATA_FIFO_RD_UNC_ERR,
941 C_RX_DMA_HDR_FIFO_RD_COR_ERR,
942 C_RX_DMA_HDR_FIFO_RD_UNC_ERR,
943 C_RX_RBUF_DESC_PART2_COR_ERR,
944 C_RX_RBUF_DESC_PART2_UNC_ERR,
945 C_RX_RBUF_DESC_PART1_COR_ERR,
946 C_RX_RBUF_DESC_PART1_UNC_ERR,
947 C_RX_HQ_INTR_FSM_ERR,
948 C_RX_HQ_INTR_CSR_PARITY_ERR,
949 C_RX_LOOKUP_CSR_PARITY_ERR,
950 C_RX_LOOKUP_RCV_ARRAY_COR_ERR,
951 C_RX_LOOKUP_RCV_ARRAY_UNC_ERR,
952 C_RX_LOOKUP_DES_PART2_PARITY_ERR,
953 C_RX_LOOKUP_DES_PART1_UNC_COR_ERR,
954 C_RX_LOOKUP_DES_PART1_UNC_ERR,
955 C_RX_RBUF_NEXT_FREE_BUF_COR_ERR,
956 C_RX_RBUF_NEXT_FREE_BUF_UNC_ERR,
957 C_RX_RBUF_FL_INIT_WR_ADDR_PARITY_ERR,
958 C_RX_RBUF_FL_INITDONE_PARITY_ERR,
959 C_RX_RBUF_FL_WRITE_ADDR_PARITY_ERR,
960 C_RX_RBUF_FL_RD_ADDR_PARITY_ERR,
963 C_RX_RBUF_BAD_LOOKUP_ERR,
964 C_RX_RBUF_CTX_ID_PARITY_ERR,
965 C_RX_RBUF_CSR_QEOPDW_PARITY_ERR,
966 C_RX_RBUF_CSR_Q_NUM_OF_PKT_PARITY_ERR,
967 C_RX_RBUF_CSR_Q_T1_PTR_PARITY_ERR,
968 C_RX_RBUF_CSR_Q_HD_PTR_PARITY_ERR,
969 C_RX_RBUF_CSR_Q_VLD_BIT_PARITY_ERR,
970 C_RX_RBUF_CSR_Q_NEXT_BUF_PARITY_ERR,
971 C_RX_RBUF_CSR_Q_ENT_CNT_PARITY_ERR,
972 C_RX_RBUF_CSR_Q_HEAD_BUF_NUM_PARITY_ERR,
973 C_RX_RBUF_BLOCK_LIST_READ_COR_ERR,
974 C_RX_RBUF_BLOCK_LIST_READ_UNC_ERR,
975 C_RX_RBUF_LOOKUP_DES_COR_ERR,
976 C_RX_RBUF_LOOKUP_DES_UNC_ERR,
977 C_RX_RBUF_LOOKUP_DES_REG_UNC_COR_ERR,
978 C_RX_RBUF_LOOKUP_DES_REG_UNC_ERR,
979 C_RX_RBUF_FREE_LIST_COR_ERR,
980 C_RX_RBUF_FREE_LIST_UNC_ERR,
981 C_RX_RCV_FSM_ENCODING_ERR,
982 C_RX_DMA_FLAG_COR_ERR,
983 C_RX_DMA_FLAG_UNC_ERR,
984 C_RX_DC_SOP_EOP_PARITY_ERR,
985 C_RX_RCV_CSR_PARITY_ERR,
986 C_RX_RCV_QP_MAP_TABLE_COR_ERR,
987 C_RX_RCV_QP_MAP_TABLE_UNC_ERR,
988 C_RX_RCV_DATA_COR_ERR,
989 C_RX_RCV_DATA_UNC_ERR,
990 C_RX_RCV_HDR_COR_ERR,
991 C_RX_RCV_HDR_UNC_ERR,
992 C_RX_DC_INTF_PARITY_ERR,
993 C_RX_DMA_CSR_COR_ERR,
994 /* SendPioErrStatus */
995 C_PIO_PEC_SOP_HEAD_PARITY_ERR,
996 C_PIO_PCC_SOP_HEAD_PARITY_ERR,
997 C_PIO_LAST_RETURNED_CNT_PARITY_ERR,
998 C_PIO_CURRENT_FREE_CNT_PARITY_ERR,
1001 C_PIO_PPMC_SOP_LEN_ERR,
1002 C_PIO_PPMC_BQC_MEM_PARITY_ERR,
1003 C_PIO_VL_FIFO_PARITY_ERR,
1004 C_PIO_VLF_SOP_PARITY_ERR,
1005 C_PIO_VLF_V1_LEN_PARITY_ERR,
1006 C_PIO_BLOCK_QW_COUNT_PARITY_ERR,
1007 C_PIO_WRITE_QW_VALID_PARITY_ERR,
1008 C_PIO_STATE_MACHINE_ERR,
1009 C_PIO_WRITE_DATA_PARITY_ERR,
1010 C_PIO_HOST_ADDR_MEM_COR_ERR,
1011 C_PIO_HOST_ADDR_MEM_UNC_ERR,
1012 C_PIO_PKT_EVICT_SM_OR_ARM_SM_ERR,
1013 C_PIO_INIT_SM_IN_ERR,
1014 C_PIO_PPMC_PBL_FIFO_ERR,
1015 C_PIO_CREDIT_RET_FIFO_PARITY_ERR,
1016 C_PIO_V1_LEN_MEM_BANK1_COR_ERR,
1017 C_PIO_V1_LEN_MEM_BANK0_COR_ERR,
1018 C_PIO_V1_LEN_MEM_BANK1_UNC_ERR,
1019 C_PIO_V1_LEN_MEM_BANK0_UNC_ERR,
1020 C_PIO_SM_PKT_RESET_PARITY_ERR,
1021 C_PIO_PKT_EVICT_FIFO_PARITY_ERR,
1022 C_PIO_SBRDCTRL_CRREL_FIFO_PARITY_ERR,
1023 C_PIO_SBRDCTL_CRREL_PARITY_ERR,
1024 C_PIO_PEC_FIFO_PARITY_ERR,
1025 C_PIO_PCC_FIFO_PARITY_ERR,
1026 C_PIO_SB_MEM_FIFO1_ERR,
1027 C_PIO_SB_MEM_FIFO0_ERR,
1028 C_PIO_CSR_PARITY_ERR,
1029 C_PIO_WRITE_ADDR_PARITY_ERR,
1030 C_PIO_WRITE_BAD_CTXT_ERR,
1031 /* SendDmaErrStatus */
1032 C_SDMA_PCIE_REQ_TRACKING_COR_ERR,
1033 C_SDMA_PCIE_REQ_TRACKING_UNC_ERR,
1034 C_SDMA_CSR_PARITY_ERR,
1036 /* SendEgressErrStatus */
1037 C_TX_READ_PIO_MEMORY_CSR_UNC_ERR,
1038 C_TX_READ_SDMA_MEMORY_CSR_UNC_ERR,
1039 C_TX_EGRESS_FIFO_COR_ERR,
1040 C_TX_READ_PIO_MEMORY_COR_ERR,
1041 C_TX_READ_SDMA_MEMORY_COR_ERR,
1042 C_TX_SB_HDR_COR_ERR,
1043 C_TX_CREDIT_OVERRUN_ERR,
1044 C_TX_LAUNCH_FIFO8_COR_ERR,
1045 C_TX_LAUNCH_FIFO7_COR_ERR,
1046 C_TX_LAUNCH_FIFO6_COR_ERR,
1047 C_TX_LAUNCH_FIFO5_COR_ERR,
1048 C_TX_LAUNCH_FIFO4_COR_ERR,
1049 C_TX_LAUNCH_FIFO3_COR_ERR,
1050 C_TX_LAUNCH_FIFO2_COR_ERR,
1051 C_TX_LAUNCH_FIFO1_COR_ERR,
1052 C_TX_LAUNCH_FIFO0_COR_ERR,
1053 C_TX_CREDIT_RETURN_VL_ERR,
1054 C_TX_HCRC_INSERTION_ERR,
1055 C_TX_EGRESS_FIFI_UNC_ERR,
1056 C_TX_READ_PIO_MEMORY_UNC_ERR,
1057 C_TX_READ_SDMA_MEMORY_UNC_ERR,
1058 C_TX_SB_HDR_UNC_ERR,
1059 C_TX_CREDIT_RETURN_PARITY_ERR,
1060 C_TX_LAUNCH_FIFO8_UNC_OR_PARITY_ERR,
1061 C_TX_LAUNCH_FIFO7_UNC_OR_PARITY_ERR,
1062 C_TX_LAUNCH_FIFO6_UNC_OR_PARITY_ERR,
1063 C_TX_LAUNCH_FIFO5_UNC_OR_PARITY_ERR,
1064 C_TX_LAUNCH_FIFO4_UNC_OR_PARITY_ERR,
1065 C_TX_LAUNCH_FIFO3_UNC_OR_PARITY_ERR,
1066 C_TX_LAUNCH_FIFO2_UNC_OR_PARITY_ERR,
1067 C_TX_LAUNCH_FIFO1_UNC_OR_PARITY_ERR,
1068 C_TX_LAUNCH_FIFO0_UNC_OR_PARITY_ERR,
1069 C_TX_SDMA15_DISALLOWED_PACKET_ERR,
1070 C_TX_SDMA14_DISALLOWED_PACKET_ERR,
1071 C_TX_SDMA13_DISALLOWED_PACKET_ERR,
1072 C_TX_SDMA12_DISALLOWED_PACKET_ERR,
1073 C_TX_SDMA11_DISALLOWED_PACKET_ERR,
1074 C_TX_SDMA10_DISALLOWED_PACKET_ERR,
1075 C_TX_SDMA9_DISALLOWED_PACKET_ERR,
1076 C_TX_SDMA8_DISALLOWED_PACKET_ERR,
1077 C_TX_SDMA7_DISALLOWED_PACKET_ERR,
1078 C_TX_SDMA6_DISALLOWED_PACKET_ERR,
1079 C_TX_SDMA5_DISALLOWED_PACKET_ERR,
1080 C_TX_SDMA4_DISALLOWED_PACKET_ERR,
1081 C_TX_SDMA3_DISALLOWED_PACKET_ERR,
1082 C_TX_SDMA2_DISALLOWED_PACKET_ERR,
1083 C_TX_SDMA1_DISALLOWED_PACKET_ERR,
1084 C_TX_SDMA0_DISALLOWED_PACKET_ERR,
1085 C_TX_CONFIG_PARITY_ERR,
1086 C_TX_SBRD_CTL_CSR_PARITY_ERR,
1087 C_TX_LAUNCH_CSR_PARITY_ERR,
1088 C_TX_ILLEGAL_CL_ERR,
1089 C_TX_SBRD_CTL_STATE_MACHINE_PARITY_ERR,
1092 C_TX_SDMA_LAUNCH_INTF_PARITY_ERR,
1093 C_TX_PIO_LAUNCH_INTF_PARITY_ERR,
1095 C_TX_INCORRECT_LINK_STATE_ERR,
1097 C_TX_EGRESS_FIFO_UNDERRUN_OR_PARITY_ERR,
1099 C_TX_PKT_INTEGRITY_MEM_UNC_ERR,
1100 C_TX_PKT_INTEGRITY_MEM_COR_ERR,
1102 C_SEND_CSR_WRITE_BAD_ADDR_ERR,
1103 C_SEND_CSR_READ_BAD_ADD_ERR,
1104 C_SEND_CSR_PARITY_ERR,
1105 /* SendCtxtErrStatus */
1106 C_PIO_WRITE_OUT_OF_BOUNDS_ERR,
1107 C_PIO_WRITE_OVERFLOW_ERR,
1108 C_PIO_WRITE_CROSSES_BOUNDARY_ERR,
1109 C_PIO_DISALLOWED_PACKET_ERR,
1110 C_PIO_INCONSISTENT_SOP_ERR,
1111 /*SendDmaEngErrStatus */
1112 C_SDMA_HEADER_REQUEST_FIFO_COR_ERR,
1113 C_SDMA_HEADER_STORAGE_COR_ERR,
1114 C_SDMA_PACKET_TRACKING_COR_ERR,
1115 C_SDMA_ASSEMBLY_COR_ERR,
1116 C_SDMA_DESC_TABLE_COR_ERR,
1117 C_SDMA_HEADER_REQUEST_FIFO_UNC_ERR,
1118 C_SDMA_HEADER_STORAGE_UNC_ERR,
1119 C_SDMA_PACKET_TRACKING_UNC_ERR,
1120 C_SDMA_ASSEMBLY_UNC_ERR,
1121 C_SDMA_DESC_TABLE_UNC_ERR,
1123 C_SDMA_HEADER_LENGTH_ERR,
1124 C_SDMA_HEADER_ADDRESS_ERR,
1125 C_SDMA_HEADER_SELECT_ERR,
1127 C_SDMA_PACKET_DESC_OVERFLOW_ERR,
1128 C_SDMA_LENGTH_MISMATCH_ERR,
1130 C_SDMA_MEM_READ_ERR,
1131 C_SDMA_FIRST_DESC_ERR,
1132 C_SDMA_TAIL_OUT_OF_BOUNDS_ERR,
1133 C_SDMA_TOO_LONG_ERR,
1134 C_SDMA_GEN_MISMATCH_ERR,
1135 C_SDMA_WRONG_DW_ERR,
1136 DEV_CNTR_LAST /* Must be kept last */
1139 /* Per port counter indexes */
1164 C_SW_IBP_RC_RESENDS,
1166 C_SW_IBP_OTHER_NAKS,
1167 C_SW_IBP_RC_TIMEOUTS,
1177 C_SW_CPU_RC_DELAYED_COMP,
1338 PORT_CNTR_LAST /* Must be kept last */
1341 u64 get_all_cpu_total(u64 __percpu *cntr);
1342 void hfi1_start_cleanup(struct hfi1_devdata *dd);
1343 void hfi1_clear_tids(struct hfi1_ctxtdata *rcd);
1344 struct ib_header *hfi1_get_msgheader(
1345 struct hfi1_devdata *dd, __le32 *rhf_addr);
1346 int hfi1_init_ctxt(struct send_context *sc);
1347 void hfi1_put_tid(struct hfi1_devdata *dd, u32 index,
1348 u32 type, unsigned long pa, u16 order);
1349 void hfi1_quiet_serdes(struct hfi1_pportdata *ppd);
1350 void hfi1_rcvctrl(struct hfi1_devdata *dd, unsigned int op, int ctxt);
1351 u32 hfi1_read_cntrs(struct hfi1_devdata *dd, char **namep, u64 **cntrp);
1352 u32 hfi1_read_portcntrs(struct hfi1_pportdata *ppd, char **namep, u64 **cntrp);
1353 u8 hfi1_ibphys_portstate(struct hfi1_pportdata *ppd);
1354 int hfi1_get_ib_cfg(struct hfi1_pportdata *ppd, int which);
1355 int hfi1_set_ib_cfg(struct hfi1_pportdata *ppd, int which, u32 val);
1356 int hfi1_set_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt, u16 jkey);
1357 int hfi1_clear_ctxt_jkey(struct hfi1_devdata *dd, unsigned ctxt);
1358 int hfi1_set_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt, u16 pkey);
1359 int hfi1_clear_ctxt_pkey(struct hfi1_devdata *dd, unsigned ctxt);
1360 void hfi1_read_link_quality(struct hfi1_devdata *dd, u8 *link_quality);
1363 * Interrupt source table.
1365 * Each entry is an interrupt source "type". It is ordered by increasing
1369 int start; /* interrupt source type start */
1370 int end; /* interrupt source type end */
1371 /* routine that returns the name of the interrupt source */
1372 char *(*is_name)(char *name, size_t size, unsigned int source);
1373 /* routine to call when receiving an interrupt */
1374 void (*is_int)(struct hfi1_devdata *dd, unsigned int source);
1377 #endif /* _CHIP_H */