162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * This file is part of the Chelsio T4 Ethernet driver for Linux.
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (c) 2003-2014 Chelsio Communications, Inc. All rights reserved.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * This software is available to you under a choice of one of two
762306a36Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
862306a36Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
962306a36Sopenharmony_ci * COPYING in the main directory of this source tree, or the
1062306a36Sopenharmony_ci * OpenIB.org BSD license below:
1162306a36Sopenharmony_ci *
1262306a36Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
1362306a36Sopenharmony_ci *     without modification, are permitted provided that the following
1462306a36Sopenharmony_ci *     conditions are met:
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci *      - Redistributions of source code must retain the above
1762306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
1862306a36Sopenharmony_ci *        disclaimer.
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
2162306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
2262306a36Sopenharmony_ci *        disclaimer in the documentation and/or other materials
2362306a36Sopenharmony_ci *        provided with the distribution.
2462306a36Sopenharmony_ci *
2562306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2662306a36Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2762306a36Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2862306a36Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2962306a36Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
3062306a36Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
3162306a36Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3262306a36Sopenharmony_ci * SOFTWARE.
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifndef __T4_VALUES_H__
3662306a36Sopenharmony_ci#define __T4_VALUES_H__
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/* This file contains definitions for various T4 register value hardware
3962306a36Sopenharmony_ci * constants.  The types of values encoded here are predominantly those for
4062306a36Sopenharmony_ci * register fields which control "modal" behavior.  For the most part, we do
4162306a36Sopenharmony_ci * not include definitions for register fields which are simple numeric
4262306a36Sopenharmony_ci * metrics, etc.
4362306a36Sopenharmony_ci */
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci/* SGE register field values.
4662306a36Sopenharmony_ci */
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/* CONTROL1 register */
4962306a36Sopenharmony_ci#define RXPKTCPLMODE_SPLIT_X		1
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#define INGPCIEBOUNDARY_SHIFT_X		5
5262306a36Sopenharmony_ci#define INGPCIEBOUNDARY_32B_X		0
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define INGPADBOUNDARY_SHIFT_X		5
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define T6_INGPADBOUNDARY_SHIFT_X	3
5762306a36Sopenharmony_ci#define T6_INGPADBOUNDARY_8B_X		0
5862306a36Sopenharmony_ci#define T6_INGPADBOUNDARY_32B_X		2
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define INGPADBOUNDARY_32B_X		0
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci/* CONTROL2 register */
6362306a36Sopenharmony_ci#define INGPACKBOUNDARY_SHIFT_X		5
6462306a36Sopenharmony_ci#define INGPACKBOUNDARY_16B_X		0
6562306a36Sopenharmony_ci#define INGPACKBOUNDARY_64B_X		1
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/* GTS register */
6862306a36Sopenharmony_ci#define SGE_TIMERREGS			6
6962306a36Sopenharmony_ci#define TIMERREG_COUNTER0_X		0
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci#define FETCHBURSTMIN_64B_X		2
7262306a36Sopenharmony_ci#define FETCHBURSTMIN_128B_X		3
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/* T6 and later use a single-bit encoding for FetchBurstMin */
7562306a36Sopenharmony_ci#define FETCHBURSTMIN_64B_T6_X		0
7662306a36Sopenharmony_ci#define FETCHBURSTMIN_128B_T6_X		1
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#define FETCHBURSTMAX_256B_X		2
7962306a36Sopenharmony_ci#define FETCHBURSTMAX_512B_X		3
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#define HOSTFCMODE_INGRESS_QUEUE_X	1
8262306a36Sopenharmony_ci#define HOSTFCMODE_STATUS_PAGE_X	2
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci#define CIDXFLUSHTHRESH_32_X		5
8562306a36Sopenharmony_ci#define CIDXFLUSHTHRESH_128_X		7
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci#define UPDATEDELIVERY_INTERRUPT_X	1
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define RSPD_TYPE_FLBUF_X		0
9062306a36Sopenharmony_ci#define RSPD_TYPE_CPL_X			1
9162306a36Sopenharmony_ci#define RSPD_TYPE_INTR_X		2
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/* Congestion Manager Definitions.
9462306a36Sopenharmony_ci */
9562306a36Sopenharmony_ci#define CONMCTXT_CNGTPMODE_S		19
9662306a36Sopenharmony_ci#define CONMCTXT_CNGTPMODE_V(x)		((x) << CONMCTXT_CNGTPMODE_S)
9762306a36Sopenharmony_ci#define CONMCTXT_CNGCHMAP_S		0
9862306a36Sopenharmony_ci#define CONMCTXT_CNGCHMAP_V(x)		((x) << CONMCTXT_CNGCHMAP_S)
9962306a36Sopenharmony_ci#define CONMCTXT_CNGTPMODE_CHANNEL_X	2
10062306a36Sopenharmony_ci#define CONMCTXT_CNGTPMODE_QUEUE_X	1
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci/* T5 and later support a new BAR2-based doorbell mechanism for Egress Queues.
10362306a36Sopenharmony_ci * The User Doorbells are each 128 bytes in length with a Simple Doorbell at
10462306a36Sopenharmony_ci * offsets 8x and a Write Combining single 64-byte Egress Queue Unit
10562306a36Sopenharmony_ci * (IDXSIZE_UNIT_X) Gather Buffer interface at offset 64.  For Ingress Queues,
10662306a36Sopenharmony_ci * we have a Going To Sleep register at offsets 8x+4.
10762306a36Sopenharmony_ci *
10862306a36Sopenharmony_ci * As noted above, we have many instances of the Simple Doorbell and Going To
10962306a36Sopenharmony_ci * Sleep registers at offsets 8x and 8x+4, respectively.  We want to use a
11062306a36Sopenharmony_ci * non-64-byte aligned offset for the Simple Doorbell in order to attempt to
11162306a36Sopenharmony_ci * avoid buffering of the writes to the Simple Doorbell and we want to use a
11262306a36Sopenharmony_ci * non-contiguous offset for the Going To Sleep writes in order to avoid
11362306a36Sopenharmony_ci * possible combining between them.
11462306a36Sopenharmony_ci */
11562306a36Sopenharmony_ci#define SGE_UDB_SIZE		128
11662306a36Sopenharmony_ci#define SGE_UDB_KDOORBELL	8
11762306a36Sopenharmony_ci#define SGE_UDB_GTS		20
11862306a36Sopenharmony_ci#define SGE_UDB_WCDOORBELL	64
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci/* CIM register field values.
12162306a36Sopenharmony_ci */
12262306a36Sopenharmony_ci#define X_MBOWNER_FW			1
12362306a36Sopenharmony_ci#define X_MBOWNER_PL			2
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci/* PCI-E definitions */
12662306a36Sopenharmony_ci#define WINDOW_SHIFT_X		10
12762306a36Sopenharmony_ci#define PCIEOFST_SHIFT_X	10
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci/* TP_VLAN_PRI_MAP controls which subset of fields will be present in the
13062306a36Sopenharmony_ci * Compressed Filter Tuple for LE filters.  Each bit set in TP_VLAN_PRI_MAP
13162306a36Sopenharmony_ci * selects for a particular field being present.  These fields, when present
13262306a36Sopenharmony_ci * in the Compressed Filter Tuple, have the following widths in bits.
13362306a36Sopenharmony_ci */
13462306a36Sopenharmony_ci#define FT_FCOE_W                       1
13562306a36Sopenharmony_ci#define FT_PORT_W                       3
13662306a36Sopenharmony_ci#define FT_VNIC_ID_W                    17
13762306a36Sopenharmony_ci#define FT_VLAN_W                       17
13862306a36Sopenharmony_ci#define FT_TOS_W                        8
13962306a36Sopenharmony_ci#define FT_PROTOCOL_W                   8
14062306a36Sopenharmony_ci#define FT_ETHERTYPE_W                  16
14162306a36Sopenharmony_ci#define FT_MACMATCH_W                   9
14262306a36Sopenharmony_ci#define FT_MPSHITTYPE_W                 3
14362306a36Sopenharmony_ci#define FT_FRAGMENTATION_W              1
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci/* Some of the Compressed Filter Tuple fields have internal structure.  These
14662306a36Sopenharmony_ci * bit shifts/masks describe those structures.  All shifts are relative to the
14762306a36Sopenharmony_ci * base position of the fields within the Compressed Filter Tuple
14862306a36Sopenharmony_ci */
14962306a36Sopenharmony_ci#define FT_VLAN_VLD_S                   16
15062306a36Sopenharmony_ci#define FT_VLAN_VLD_V(x)                ((x) << FT_VLAN_VLD_S)
15162306a36Sopenharmony_ci#define FT_VLAN_VLD_F                   FT_VLAN_VLD_V(1U)
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci#define FT_VNID_ID_VF_S                 0
15462306a36Sopenharmony_ci#define FT_VNID_ID_VF_V(x)              ((x) << FT_VNID_ID_VF_S)
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci#define FT_VNID_ID_PF_S                 7
15762306a36Sopenharmony_ci#define FT_VNID_ID_PF_V(x)              ((x) << FT_VNID_ID_PF_S)
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci#define FT_VNID_ID_VLD_S                16
16062306a36Sopenharmony_ci#define FT_VNID_ID_VLD_V(x)             ((x) << FT_VNID_ID_VLD_S)
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#endif /* __T4_VALUES_H__ */
163