1f612b815SHariprasad Shenai /*
2f612b815SHariprasad Shenai  * This file is part of the Chelsio T4 Ethernet driver for Linux.
3f612b815SHariprasad Shenai  *
4f612b815SHariprasad Shenai  * Copyright (c) 2003-2014 Chelsio Communications, Inc. All rights reserved.
5f612b815SHariprasad Shenai  *
6f612b815SHariprasad Shenai  * This software is available to you under a choice of one of two
7f612b815SHariprasad Shenai  * licenses.  You may choose to be licensed under the terms of the GNU
8f612b815SHariprasad Shenai  * General Public License (GPL) Version 2, available from the file
9f612b815SHariprasad Shenai  * COPYING in the main directory of this source tree, or the
10f612b815SHariprasad Shenai  * OpenIB.org BSD license below:
11f612b815SHariprasad Shenai  *
12f612b815SHariprasad Shenai  *     Redistribution and use in source and binary forms, with or
13f612b815SHariprasad Shenai  *     without modification, are permitted provided that the following
14f612b815SHariprasad Shenai  *     conditions are met:
15f612b815SHariprasad Shenai  *
16f612b815SHariprasad Shenai  *      - Redistributions of source code must retain the above
17f612b815SHariprasad Shenai  *        copyright notice, this list of conditions and the following
18f612b815SHariprasad Shenai  *        disclaimer.
19f612b815SHariprasad Shenai  *
20f612b815SHariprasad Shenai  *      - Redistributions in binary form must reproduce the above
21f612b815SHariprasad Shenai  *        copyright notice, this list of conditions and the following
22f612b815SHariprasad Shenai  *        disclaimer in the documentation and/or other materials
23f612b815SHariprasad Shenai  *        provided with the distribution.
24f612b815SHariprasad Shenai  *
25f612b815SHariprasad Shenai  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26f612b815SHariprasad Shenai  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27f612b815SHariprasad Shenai  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28f612b815SHariprasad Shenai  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29f612b815SHariprasad Shenai  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30f612b815SHariprasad Shenai  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31f612b815SHariprasad Shenai  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32f612b815SHariprasad Shenai  * SOFTWARE.
33f612b815SHariprasad Shenai  */
34f612b815SHariprasad Shenai 
35f612b815SHariprasad Shenai #ifndef __T4_VALUES_H__
36f612b815SHariprasad Shenai #define __T4_VALUES_H__
37f612b815SHariprasad Shenai 
38f612b815SHariprasad Shenai /* This file contains definitions for various T4 register value hardware
39f612b815SHariprasad Shenai  * constants.  The types of values encoded here are predominantly those for
40f612b815SHariprasad Shenai  * register fields which control "modal" behavior.  For the most part, we do
41f612b815SHariprasad Shenai  * not include definitions for register fields which are simple numeric
42f612b815SHariprasad Shenai  * metrics, etc.
43f612b815SHariprasad Shenai  */
44f612b815SHariprasad Shenai 
45f612b815SHariprasad Shenai /* SGE register field values.
46f612b815SHariprasad Shenai  */
47f612b815SHariprasad Shenai 
48f612b815SHariprasad Shenai /* CONTROL1 register */
49f612b815SHariprasad Shenai #define RXPKTCPLMODE_SPLIT_X		1
50f612b815SHariprasad Shenai 
51f612b815SHariprasad Shenai #define INGPCIEBOUNDARY_SHIFT_X		5
52f612b815SHariprasad Shenai #define INGPCIEBOUNDARY_32B_X		0
53f612b815SHariprasad Shenai 
54f612b815SHariprasad Shenai #define INGPADBOUNDARY_SHIFT_X		5
55f612b815SHariprasad Shenai 
56f612b815SHariprasad Shenai /* CONTROL2 register */
57f612b815SHariprasad Shenai #define INGPACKBOUNDARY_SHIFT_X		5
58f612b815SHariprasad Shenai #define INGPACKBOUNDARY_16B_X		0
59f612b815SHariprasad Shenai 
60f612b815SHariprasad Shenai /* GTS register */
61f612b815SHariprasad Shenai #define SGE_TIMERREGS			6
623a336cb1SHariprasad Shenai #define TIMERREG_COUNTER0_X		0
63f612b815SHariprasad Shenai 
64b8b1ae99SHariprasad Shenai /* Congestion Manager Definitions.
65b8b1ae99SHariprasad Shenai  */
66b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGTPMODE_S		19
67b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGTPMODE_V(x)		((x) << CONMCTXT_CNGTPMODE_S)
68b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGCHMAP_S		0
69b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGCHMAP_V(x)		((x) << CONMCTXT_CNGCHMAP_S)
70b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGTPMODE_CHANNEL_X	2
71b8b1ae99SHariprasad Shenai #define CONMCTXT_CNGTPMODE_QUEUE_X	1
72b8b1ae99SHariprasad Shenai 
73f612b815SHariprasad Shenai /* T5 and later support a new BAR2-based doorbell mechanism for Egress Queues.
74f612b815SHariprasad Shenai  * The User Doorbells are each 128 bytes in length with a Simple Doorbell at
75f612b815SHariprasad Shenai  * offsets 8x and a Write Combining single 64-byte Egress Queue Unit
76f612b815SHariprasad Shenai  * (IDXSIZE_UNIT_X) Gather Buffer interface at offset 64.  For Ingress Queues,
77f612b815SHariprasad Shenai  * we have a Going To Sleep register at offsets 8x+4.
78f612b815SHariprasad Shenai  *
79f612b815SHariprasad Shenai  * As noted above, we have many instances of the Simple Doorbell and Going To
80f612b815SHariprasad Shenai  * Sleep registers at offsets 8x and 8x+4, respectively.  We want to use a
81f612b815SHariprasad Shenai  * non-64-byte aligned offset for the Simple Doorbell in order to attempt to
82f612b815SHariprasad Shenai  * avoid buffering of the writes to the Simple Doorbell and we want to use a
83f612b815SHariprasad Shenai  * non-contiguous offset for the Going To Sleep writes in order to avoid
84f612b815SHariprasad Shenai  * possible combining between them.
85f612b815SHariprasad Shenai  */
86f612b815SHariprasad Shenai #define SGE_UDB_SIZE		128
87f612b815SHariprasad Shenai #define SGE_UDB_KDOORBELL	8
88f612b815SHariprasad Shenai #define SGE_UDB_GTS		20
89f612b815SHariprasad Shenai #define SGE_UDB_WCDOORBELL	64
90f612b815SHariprasad Shenai 
91bf7c781dSHariprasad Shenai /* CIM register field values.
92bf7c781dSHariprasad Shenai  */
93bf7c781dSHariprasad Shenai #define X_MBOWNER_FW			1
94bf7c781dSHariprasad Shenai #define X_MBOWNER_PL			2
95bf7c781dSHariprasad Shenai 
96f061de42SHariprasad Shenai /* PCI-E definitions */
97f061de42SHariprasad Shenai #define WINDOW_SHIFT_X		10
98f061de42SHariprasad Shenai #define PCIEOFST_SHIFT_X	10
99f061de42SHariprasad Shenai 
1000d804338SHariprasad Shenai /* TP_VLAN_PRI_MAP controls which subset of fields will be present in the
1010d804338SHariprasad Shenai  * Compressed Filter Tuple for LE filters.  Each bit set in TP_VLAN_PRI_MAP
1020d804338SHariprasad Shenai  * selects for a particular field being present.  These fields, when present
1030d804338SHariprasad Shenai  * in the Compressed Filter Tuple, have the following widths in bits.
1040d804338SHariprasad Shenai  */
1050d804338SHariprasad Shenai #define FT_FCOE_W                       1
1060d804338SHariprasad Shenai #define FT_PORT_W                       3
1070d804338SHariprasad Shenai #define FT_VNIC_ID_W                    17
1080d804338SHariprasad Shenai #define FT_VLAN_W                       17
1090d804338SHariprasad Shenai #define FT_TOS_W                        8
1100d804338SHariprasad Shenai #define FT_PROTOCOL_W                   8
1110d804338SHariprasad Shenai #define FT_ETHERTYPE_W                  16
1120d804338SHariprasad Shenai #define FT_MACMATCH_W                   9
1130d804338SHariprasad Shenai #define FT_MPSHITTYPE_W                 3
1140d804338SHariprasad Shenai #define FT_FRAGMENTATION_W              1
1150d804338SHariprasad Shenai 
1160d804338SHariprasad Shenai /* Some of the Compressed Filter Tuple fields have internal structure.  These
1170d804338SHariprasad Shenai  * bit shifts/masks describe those structures.  All shifts are relative to the
1180d804338SHariprasad Shenai  * base position of the fields within the Compressed Filter Tuple
1190d804338SHariprasad Shenai  */
1200d804338SHariprasad Shenai #define FT_VLAN_VLD_S                   16
1210d804338SHariprasad Shenai #define FT_VLAN_VLD_V(x)                ((x) << FT_VLAN_VLD_S)
1220d804338SHariprasad Shenai #define FT_VLAN_VLD_F                   FT_VLAN_VLD_V(1U)
1230d804338SHariprasad Shenai 
1240d804338SHariprasad Shenai #define FT_VNID_ID_VF_S                 0
1250d804338SHariprasad Shenai #define FT_VNID_ID_VF_V(x)              ((x) << FT_VNID_ID_VF_S)
1260d804338SHariprasad Shenai 
1270d804338SHariprasad Shenai #define FT_VNID_ID_PF_S                 7
1280d804338SHariprasad Shenai #define FT_VNID_ID_PF_V(x)              ((x) << FT_VNID_ID_PF_S)
1290d804338SHariprasad Shenai 
1300d804338SHariprasad Shenai #define FT_VNID_ID_VLD_S                16
1310d804338SHariprasad Shenai #define FT_VNID_ID_VLD_V(x)             ((x) << FT_VNID_ID_VLD_S)
1320d804338SHariprasad Shenai 
133f612b815SHariprasad Shenai #endif /* __T4_VALUES_H__ */
134