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
62f612b815SHariprasad Shenai 
63f612b815SHariprasad Shenai /* T5 and later support a new BAR2-based doorbell mechanism for Egress Queues.
64f612b815SHariprasad Shenai  * The User Doorbells are each 128 bytes in length with a Simple Doorbell at
65f612b815SHariprasad Shenai  * offsets 8x and a Write Combining single 64-byte Egress Queue Unit
66f612b815SHariprasad Shenai  * (IDXSIZE_UNIT_X) Gather Buffer interface at offset 64.  For Ingress Queues,
67f612b815SHariprasad Shenai  * we have a Going To Sleep register at offsets 8x+4.
68f612b815SHariprasad Shenai  *
69f612b815SHariprasad Shenai  * As noted above, we have many instances of the Simple Doorbell and Going To
70f612b815SHariprasad Shenai  * Sleep registers at offsets 8x and 8x+4, respectively.  We want to use a
71f612b815SHariprasad Shenai  * non-64-byte aligned offset for the Simple Doorbell in order to attempt to
72f612b815SHariprasad Shenai  * avoid buffering of the writes to the Simple Doorbell and we want to use a
73f612b815SHariprasad Shenai  * non-contiguous offset for the Going To Sleep writes in order to avoid
74f612b815SHariprasad Shenai  * possible combining between them.
75f612b815SHariprasad Shenai  */
76f612b815SHariprasad Shenai #define SGE_UDB_SIZE		128
77f612b815SHariprasad Shenai #define SGE_UDB_KDOORBELL	8
78f612b815SHariprasad Shenai #define SGE_UDB_GTS		20
79f612b815SHariprasad Shenai #define SGE_UDB_WCDOORBELL	64
80f612b815SHariprasad Shenai 
81f061de42SHariprasad Shenai /* PCI-E definitions */
82f061de42SHariprasad Shenai #define WINDOW_SHIFT_X		10
83f061de42SHariprasad Shenai #define PCIEOFST_SHIFT_X	10
84f061de42SHariprasad Shenai 
850d804338SHariprasad Shenai /* TP_VLAN_PRI_MAP controls which subset of fields will be present in the
860d804338SHariprasad Shenai  * Compressed Filter Tuple for LE filters.  Each bit set in TP_VLAN_PRI_MAP
870d804338SHariprasad Shenai  * selects for a particular field being present.  These fields, when present
880d804338SHariprasad Shenai  * in the Compressed Filter Tuple, have the following widths in bits.
890d804338SHariprasad Shenai  */
900d804338SHariprasad Shenai #define FT_FCOE_W                       1
910d804338SHariprasad Shenai #define FT_PORT_W                       3
920d804338SHariprasad Shenai #define FT_VNIC_ID_W                    17
930d804338SHariprasad Shenai #define FT_VLAN_W                       17
940d804338SHariprasad Shenai #define FT_TOS_W                        8
950d804338SHariprasad Shenai #define FT_PROTOCOL_W                   8
960d804338SHariprasad Shenai #define FT_ETHERTYPE_W                  16
970d804338SHariprasad Shenai #define FT_MACMATCH_W                   9
980d804338SHariprasad Shenai #define FT_MPSHITTYPE_W                 3
990d804338SHariprasad Shenai #define FT_FRAGMENTATION_W              1
1000d804338SHariprasad Shenai 
1010d804338SHariprasad Shenai /* Some of the Compressed Filter Tuple fields have internal structure.  These
1020d804338SHariprasad Shenai  * bit shifts/masks describe those structures.  All shifts are relative to the
1030d804338SHariprasad Shenai  * base position of the fields within the Compressed Filter Tuple
1040d804338SHariprasad Shenai  */
1050d804338SHariprasad Shenai #define FT_VLAN_VLD_S                   16
1060d804338SHariprasad Shenai #define FT_VLAN_VLD_V(x)                ((x) << FT_VLAN_VLD_S)
1070d804338SHariprasad Shenai #define FT_VLAN_VLD_F                   FT_VLAN_VLD_V(1U)
1080d804338SHariprasad Shenai 
1090d804338SHariprasad Shenai #define FT_VNID_ID_VF_S                 0
1100d804338SHariprasad Shenai #define FT_VNID_ID_VF_V(x)              ((x) << FT_VNID_ID_VF_S)
1110d804338SHariprasad Shenai 
1120d804338SHariprasad Shenai #define FT_VNID_ID_PF_S                 7
1130d804338SHariprasad Shenai #define FT_VNID_ID_PF_V(x)              ((x) << FT_VNID_ID_PF_S)
1140d804338SHariprasad Shenai 
1150d804338SHariprasad Shenai #define FT_VNID_ID_VLD_S                16
1160d804338SHariprasad Shenai #define FT_VNID_ID_VLD_V(x)             ((x) << FT_VNID_ID_VLD_S)
1170d804338SHariprasad Shenai 
118f612b815SHariprasad Shenai #endif /* __T4_VALUES_H__ */
119