18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is part of the Chelsio T4 Ethernet driver for Linux.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (c) 2003-2014 Chelsio Communications, Inc. All rights reserved.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two
78c2ecf20Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
88c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
98c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the
108c2ecf20Sopenharmony_ci * OpenIB.org BSD license below:
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
138c2ecf20Sopenharmony_ci *     without modification, are permitted provided that the following
148c2ecf20Sopenharmony_ci *     conditions are met:
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci *      - Redistributions of source code must retain the above
178c2ecf20Sopenharmony_ci *        copyright notice, this list of conditions and the following
188c2ecf20Sopenharmony_ci *        disclaimer.
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
218c2ecf20Sopenharmony_ci *        copyright notice, this list of conditions and the following
228c2ecf20Sopenharmony_ci *        disclaimer in the documentation and/or other materials
238c2ecf20Sopenharmony_ci *        provided with the distribution.
248c2ecf20Sopenharmony_ci *
258c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
268c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
278c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
288c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
298c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
308c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
318c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
328c2ecf20Sopenharmony_ci * SOFTWARE.
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifndef __T4_VALUES_H__
368c2ecf20Sopenharmony_ci#define __T4_VALUES_H__
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* This file contains definitions for various T4 register value hardware
398c2ecf20Sopenharmony_ci * constants.  The types of values encoded here are predominantly those for
408c2ecf20Sopenharmony_ci * register fields which control "modal" behavior.  For the most part, we do
418c2ecf20Sopenharmony_ci * not include definitions for register fields which are simple numeric
428c2ecf20Sopenharmony_ci * metrics, etc.
438c2ecf20Sopenharmony_ci */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* SGE register field values.
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* CONTROL1 register */
498c2ecf20Sopenharmony_ci#define RXPKTCPLMODE_SPLIT_X		1
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#define INGPCIEBOUNDARY_SHIFT_X		5
528c2ecf20Sopenharmony_ci#define INGPCIEBOUNDARY_32B_X		0
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define INGPADBOUNDARY_SHIFT_X		5
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define T6_INGPADBOUNDARY_SHIFT_X	3
578c2ecf20Sopenharmony_ci#define T6_INGPADBOUNDARY_8B_X		0
588c2ecf20Sopenharmony_ci#define T6_INGPADBOUNDARY_32B_X		2
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define INGPADBOUNDARY_32B_X		0
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* CONTROL2 register */
638c2ecf20Sopenharmony_ci#define INGPACKBOUNDARY_SHIFT_X		5
648c2ecf20Sopenharmony_ci#define INGPACKBOUNDARY_16B_X		0
658c2ecf20Sopenharmony_ci#define INGPACKBOUNDARY_64B_X		1
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* GTS register */
688c2ecf20Sopenharmony_ci#define SGE_TIMERREGS			6
698c2ecf20Sopenharmony_ci#define TIMERREG_COUNTER0_X		0
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define FETCHBURSTMIN_64B_X		2
728c2ecf20Sopenharmony_ci#define FETCHBURSTMIN_128B_X		3
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* T6 and later use a single-bit encoding for FetchBurstMin */
758c2ecf20Sopenharmony_ci#define FETCHBURSTMIN_64B_T6_X		0
768c2ecf20Sopenharmony_ci#define FETCHBURSTMIN_128B_T6_X		1
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define FETCHBURSTMAX_256B_X		2
798c2ecf20Sopenharmony_ci#define FETCHBURSTMAX_512B_X		3
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define HOSTFCMODE_INGRESS_QUEUE_X	1
828c2ecf20Sopenharmony_ci#define HOSTFCMODE_STATUS_PAGE_X	2
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define CIDXFLUSHTHRESH_32_X		5
858c2ecf20Sopenharmony_ci#define CIDXFLUSHTHRESH_128_X		7
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define UPDATEDELIVERY_INTERRUPT_X	1
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define RSPD_TYPE_FLBUF_X		0
908c2ecf20Sopenharmony_ci#define RSPD_TYPE_CPL_X			1
918c2ecf20Sopenharmony_ci#define RSPD_TYPE_INTR_X		2
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/* Congestion Manager Definitions.
948c2ecf20Sopenharmony_ci */
958c2ecf20Sopenharmony_ci#define CONMCTXT_CNGTPMODE_S		19
968c2ecf20Sopenharmony_ci#define CONMCTXT_CNGTPMODE_V(x)		((x) << CONMCTXT_CNGTPMODE_S)
978c2ecf20Sopenharmony_ci#define CONMCTXT_CNGCHMAP_S		0
988c2ecf20Sopenharmony_ci#define CONMCTXT_CNGCHMAP_V(x)		((x) << CONMCTXT_CNGCHMAP_S)
998c2ecf20Sopenharmony_ci#define CONMCTXT_CNGTPMODE_CHANNEL_X	2
1008c2ecf20Sopenharmony_ci#define CONMCTXT_CNGTPMODE_QUEUE_X	1
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/* T5 and later support a new BAR2-based doorbell mechanism for Egress Queues.
1038c2ecf20Sopenharmony_ci * The User Doorbells are each 128 bytes in length with a Simple Doorbell at
1048c2ecf20Sopenharmony_ci * offsets 8x and a Write Combining single 64-byte Egress Queue Unit
1058c2ecf20Sopenharmony_ci * (IDXSIZE_UNIT_X) Gather Buffer interface at offset 64.  For Ingress Queues,
1068c2ecf20Sopenharmony_ci * we have a Going To Sleep register at offsets 8x+4.
1078c2ecf20Sopenharmony_ci *
1088c2ecf20Sopenharmony_ci * As noted above, we have many instances of the Simple Doorbell and Going To
1098c2ecf20Sopenharmony_ci * Sleep registers at offsets 8x and 8x+4, respectively.  We want to use a
1108c2ecf20Sopenharmony_ci * non-64-byte aligned offset for the Simple Doorbell in order to attempt to
1118c2ecf20Sopenharmony_ci * avoid buffering of the writes to the Simple Doorbell and we want to use a
1128c2ecf20Sopenharmony_ci * non-contiguous offset for the Going To Sleep writes in order to avoid
1138c2ecf20Sopenharmony_ci * possible combining between them.
1148c2ecf20Sopenharmony_ci */
1158c2ecf20Sopenharmony_ci#define SGE_UDB_SIZE		128
1168c2ecf20Sopenharmony_ci#define SGE_UDB_KDOORBELL	8
1178c2ecf20Sopenharmony_ci#define SGE_UDB_GTS		20
1188c2ecf20Sopenharmony_ci#define SGE_UDB_WCDOORBELL	64
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* CIM register field values.
1218c2ecf20Sopenharmony_ci */
1228c2ecf20Sopenharmony_ci#define X_MBOWNER_FW			1
1238c2ecf20Sopenharmony_ci#define X_MBOWNER_PL			2
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* PCI-E definitions */
1268c2ecf20Sopenharmony_ci#define WINDOW_SHIFT_X		10
1278c2ecf20Sopenharmony_ci#define PCIEOFST_SHIFT_X	10
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci/* TP_VLAN_PRI_MAP controls which subset of fields will be present in the
1308c2ecf20Sopenharmony_ci * Compressed Filter Tuple for LE filters.  Each bit set in TP_VLAN_PRI_MAP
1318c2ecf20Sopenharmony_ci * selects for a particular field being present.  These fields, when present
1328c2ecf20Sopenharmony_ci * in the Compressed Filter Tuple, have the following widths in bits.
1338c2ecf20Sopenharmony_ci */
1348c2ecf20Sopenharmony_ci#define FT_FCOE_W                       1
1358c2ecf20Sopenharmony_ci#define FT_PORT_W                       3
1368c2ecf20Sopenharmony_ci#define FT_VNIC_ID_W                    17
1378c2ecf20Sopenharmony_ci#define FT_VLAN_W                       17
1388c2ecf20Sopenharmony_ci#define FT_TOS_W                        8
1398c2ecf20Sopenharmony_ci#define FT_PROTOCOL_W                   8
1408c2ecf20Sopenharmony_ci#define FT_ETHERTYPE_W                  16
1418c2ecf20Sopenharmony_ci#define FT_MACMATCH_W                   9
1428c2ecf20Sopenharmony_ci#define FT_MPSHITTYPE_W                 3
1438c2ecf20Sopenharmony_ci#define FT_FRAGMENTATION_W              1
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/* Some of the Compressed Filter Tuple fields have internal structure.  These
1468c2ecf20Sopenharmony_ci * bit shifts/masks describe those structures.  All shifts are relative to the
1478c2ecf20Sopenharmony_ci * base position of the fields within the Compressed Filter Tuple
1488c2ecf20Sopenharmony_ci */
1498c2ecf20Sopenharmony_ci#define FT_VLAN_VLD_S                   16
1508c2ecf20Sopenharmony_ci#define FT_VLAN_VLD_V(x)                ((x) << FT_VLAN_VLD_S)
1518c2ecf20Sopenharmony_ci#define FT_VLAN_VLD_F                   FT_VLAN_VLD_V(1U)
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci#define FT_VNID_ID_VF_S                 0
1548c2ecf20Sopenharmony_ci#define FT_VNID_ID_VF_V(x)              ((x) << FT_VNID_ID_VF_S)
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define FT_VNID_ID_PF_S                 7
1578c2ecf20Sopenharmony_ci#define FT_VNID_ID_PF_V(x)              ((x) << FT_VNID_ID_PF_S)
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define FT_VNID_ID_VLD_S                16
1608c2ecf20Sopenharmony_ci#define FT_VNID_ID_VLD_V(x)             ((x) << FT_VNID_ID_VLD_S)
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci#endif /* __T4_VALUES_H__ */
163