xref: /linux/drivers/net/ethernet/cavium/thunder/nic_reg.h (revision 4a8755096466d1002236ac7293eae821b6de87ba)
14863dea3SSunil Goutham /*
24863dea3SSunil Goutham  * Copyright (C) 2015 Cavium, Inc.
34863dea3SSunil Goutham  *
44863dea3SSunil Goutham  * This program is free software; you can redistribute it and/or modify it
54863dea3SSunil Goutham  * under the terms of version 2 of the GNU General Public License
64863dea3SSunil Goutham  * as published by the Free Software Foundation.
74863dea3SSunil Goutham  */
84863dea3SSunil Goutham 
94863dea3SSunil Goutham #ifndef NIC_REG_H
104863dea3SSunil Goutham #define NIC_REG_H
114863dea3SSunil Goutham 
124863dea3SSunil Goutham #define   NIC_PF_REG_COUNT			29573
134863dea3SSunil Goutham #define   NIC_VF_REG_COUNT			249
144863dea3SSunil Goutham 
154863dea3SSunil Goutham /* Physical function register offsets */
164863dea3SSunil Goutham #define   NIC_PF_CFG				(0x0000)
174863dea3SSunil Goutham #define   NIC_PF_STATUS				(0x0010)
184863dea3SSunil Goutham #define   NIC_PF_INTR_TIMER_CFG			(0x0030)
194863dea3SSunil Goutham #define   NIC_PF_BIST_STATUS			(0x0040)
204863dea3SSunil Goutham #define   NIC_PF_SOFT_RESET			(0x0050)
214863dea3SSunil Goutham #define   NIC_PF_TCP_TIMER			(0x0060)
224863dea3SSunil Goutham #define   NIC_PF_BP_CFG				(0x0080)
234863dea3SSunil Goutham #define   NIC_PF_RRM_CFG			(0x0088)
244c0b6eafSSunil Goutham #define   NIC_PF_CQM_CFG			(0x00A0)
254863dea3SSunil Goutham #define   NIC_PF_CNM_CF				(0x00A8)
264863dea3SSunil Goutham #define   NIC_PF_CNM_STATUS			(0x00B0)
274863dea3SSunil Goutham #define   NIC_PF_CQ_AVG_CFG			(0x00C0)
284863dea3SSunil Goutham #define   NIC_PF_RRM_AVG_CFG			(0x00C8)
294863dea3SSunil Goutham #define   NIC_PF_INTF_0_1_SEND_CFG		(0x0200)
304863dea3SSunil Goutham #define   NIC_PF_INTF_0_1_BP_CFG		(0x0208)
314863dea3SSunil Goutham #define   NIC_PF_INTF_0_1_BP_DIS_0_1		(0x0210)
324863dea3SSunil Goutham #define   NIC_PF_INTF_0_1_BP_SW_0_1		(0x0220)
334863dea3SSunil Goutham #define   NIC_PF_RBDR_BP_STATE_0_3		(0x0240)
344863dea3SSunil Goutham #define   NIC_PF_MAILBOX_INT			(0x0410)
354863dea3SSunil Goutham #define   NIC_PF_MAILBOX_INT_W1S		(0x0430)
364863dea3SSunil Goutham #define   NIC_PF_MAILBOX_ENA_W1C		(0x0450)
374863dea3SSunil Goutham #define   NIC_PF_MAILBOX_ENA_W1S		(0x0470)
384863dea3SSunil Goutham #define   NIC_PF_RX_ETYPE_0_7			(0x0500)
39e22e86eaSZyta Szpak #define   NIC_PF_RX_GENEVE_DEF			(0x0580)
40e22e86eaSZyta Szpak #define    UDP_GENEVE_PORT_NUM				0x17C1ULL
41e22e86eaSZyta Szpak #define   NIC_PF_RX_GENEVE_PROT_DEF		(0x0588)
42e22e86eaSZyta Szpak #define    IPV6_PROT					0x86DDULL
43e22e86eaSZyta Szpak #define    IPV4_PROT					0x800ULL
44e22e86eaSZyta Szpak #define    ET_PROT					0x6558ULL
45e22e86eaSZyta Szpak #define   NIC_PF_RX_NVGRE_PROT_DEF		(0x0598)
46e22e86eaSZyta Szpak #define   NIC_PF_RX_VXLAN_DEF_0_1		(0x05A0)
47e22e86eaSZyta Szpak #define    UDP_VXLAN_PORT_NUM				0x12B5
48e22e86eaSZyta Szpak #define   NIC_PF_RX_VXLAN_PROT_DEF		(0x05B0)
49e22e86eaSZyta Szpak #define    IPV6_PROT_DEF				0x2ULL
50e22e86eaSZyta Szpak #define    IPV4_PROT_DEF				0x1ULL
51e22e86eaSZyta Szpak #define    ET_PROT_DEF					0x3ULL
5202a72bd8SSunil Goutham #define   NIC_PF_RX_CFG				(0x05D0)
534863dea3SSunil Goutham #define   NIC_PF_PKIND_0_15_CFG			(0x0600)
544863dea3SSunil Goutham #define   NIC_PF_ECC0_FLIP0			(0x1000)
554863dea3SSunil Goutham #define   NIC_PF_ECC1_FLIP0			(0x1008)
564863dea3SSunil Goutham #define   NIC_PF_ECC2_FLIP0			(0x1010)
574863dea3SSunil Goutham #define   NIC_PF_ECC3_FLIP0			(0x1018)
584863dea3SSunil Goutham #define   NIC_PF_ECC0_FLIP1			(0x1080)
594863dea3SSunil Goutham #define   NIC_PF_ECC1_FLIP1			(0x1088)
604863dea3SSunil Goutham #define   NIC_PF_ECC2_FLIP1			(0x1090)
614863dea3SSunil Goutham #define   NIC_PF_ECC3_FLIP1			(0x1098)
624863dea3SSunil Goutham #define   NIC_PF_ECC0_CDIS			(0x1100)
634863dea3SSunil Goutham #define   NIC_PF_ECC1_CDIS			(0x1108)
644863dea3SSunil Goutham #define   NIC_PF_ECC2_CDIS			(0x1110)
654863dea3SSunil Goutham #define   NIC_PF_ECC3_CDIS			(0x1118)
664863dea3SSunil Goutham #define   NIC_PF_BIST0_STATUS			(0x1280)
674863dea3SSunil Goutham #define   NIC_PF_BIST1_STATUS			(0x1288)
684863dea3SSunil Goutham #define   NIC_PF_BIST2_STATUS			(0x1290)
694863dea3SSunil Goutham #define   NIC_PF_BIST3_STATUS			(0x1298)
704863dea3SSunil Goutham #define   NIC_PF_ECC0_SBE_INT			(0x2000)
714863dea3SSunil Goutham #define   NIC_PF_ECC0_SBE_INT_W1S		(0x2008)
724863dea3SSunil Goutham #define   NIC_PF_ECC0_SBE_ENA_W1C		(0x2010)
734863dea3SSunil Goutham #define   NIC_PF_ECC0_SBE_ENA_W1S		(0x2018)
744863dea3SSunil Goutham #define   NIC_PF_ECC0_DBE_INT			(0x2100)
754863dea3SSunil Goutham #define   NIC_PF_ECC0_DBE_INT_W1S		(0x2108)
764863dea3SSunil Goutham #define   NIC_PF_ECC0_DBE_ENA_W1C		(0x2110)
774863dea3SSunil Goutham #define   NIC_PF_ECC0_DBE_ENA_W1S		(0x2118)
784863dea3SSunil Goutham #define   NIC_PF_ECC1_SBE_INT			(0x2200)
794863dea3SSunil Goutham #define   NIC_PF_ECC1_SBE_INT_W1S		(0x2208)
804863dea3SSunil Goutham #define   NIC_PF_ECC1_SBE_ENA_W1C		(0x2210)
814863dea3SSunil Goutham #define   NIC_PF_ECC1_SBE_ENA_W1S		(0x2218)
824863dea3SSunil Goutham #define   NIC_PF_ECC1_DBE_INT			(0x2300)
834863dea3SSunil Goutham #define   NIC_PF_ECC1_DBE_INT_W1S		(0x2308)
844863dea3SSunil Goutham #define   NIC_PF_ECC1_DBE_ENA_W1C		(0x2310)
854863dea3SSunil Goutham #define   NIC_PF_ECC1_DBE_ENA_W1S		(0x2318)
864863dea3SSunil Goutham #define   NIC_PF_ECC2_SBE_INT			(0x2400)
874863dea3SSunil Goutham #define   NIC_PF_ECC2_SBE_INT_W1S		(0x2408)
884863dea3SSunil Goutham #define   NIC_PF_ECC2_SBE_ENA_W1C		(0x2410)
894863dea3SSunil Goutham #define   NIC_PF_ECC2_SBE_ENA_W1S		(0x2418)
904863dea3SSunil Goutham #define   NIC_PF_ECC2_DBE_INT			(0x2500)
914863dea3SSunil Goutham #define   NIC_PF_ECC2_DBE_INT_W1S		(0x2508)
924863dea3SSunil Goutham #define   NIC_PF_ECC2_DBE_ENA_W1C		(0x2510)
934863dea3SSunil Goutham #define   NIC_PF_ECC2_DBE_ENA_W1S		(0x2518)
944863dea3SSunil Goutham #define   NIC_PF_ECC3_SBE_INT			(0x2600)
954863dea3SSunil Goutham #define   NIC_PF_ECC3_SBE_INT_W1S		(0x2608)
964863dea3SSunil Goutham #define   NIC_PF_ECC3_SBE_ENA_W1C		(0x2610)
974863dea3SSunil Goutham #define   NIC_PF_ECC3_SBE_ENA_W1S		(0x2618)
984863dea3SSunil Goutham #define   NIC_PF_ECC3_DBE_INT			(0x2700)
994863dea3SSunil Goutham #define   NIC_PF_ECC3_DBE_INT_W1S		(0x2708)
1004863dea3SSunil Goutham #define   NIC_PF_ECC3_DBE_ENA_W1C		(0x2710)
1014863dea3SSunil Goutham #define   NIC_PF_ECC3_DBE_ENA_W1S		(0x2718)
102*4a875509SSunil Goutham #define   NIC_PF_INTFX_SEND_CFG			(0x4000)
10334411b68SThanneeru Srinivasulu #define   NIC_PF_MCAM_0_191_ENA			(0x100000)
10434411b68SThanneeru Srinivasulu #define   NIC_PF_MCAM_0_191_M_0_5_DATA		(0x110000)
10534411b68SThanneeru Srinivasulu #define   NIC_PF_MCAM_CTRL			(0x120000)
1064863dea3SSunil Goutham #define   NIC_PF_CPI_0_2047_CFG			(0x200000)
10734411b68SThanneeru Srinivasulu #define   NIC_PF_MPI_0_2047_CFG			(0x210000)
1084863dea3SSunil Goutham #define   NIC_PF_RSSI_0_4097_RQ			(0x220000)
1094863dea3SSunil Goutham #define   NIC_PF_LMAC_0_7_CFG			(0x240000)
110712c3185SSunil Goutham #define   NIC_PF_LMAC_0_7_CFG2			(0x240100)
1114863dea3SSunil Goutham #define   NIC_PF_LMAC_0_7_SW_XOFF		(0x242000)
1124863dea3SSunil Goutham #define   NIC_PF_LMAC_0_7_CREDIT		(0x244000)
1134863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_TX_CFG		(0x400000)
1144863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_RX_CFG		(0x420000)
1154863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_SW_XOFF		(0x440000)
1164863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_CREDIT		(0x460000)
1174863dea3SSunil Goutham #define   NIC_PF_CHAN_0_255_RX_BP_CFG		(0x480000)
1184863dea3SSunil Goutham #define   NIC_PF_SW_SYNC_RX			(0x490000)
1194863dea3SSunil Goutham #define   NIC_PF_SW_SYNC_RX_DONE		(0x490008)
1204863dea3SSunil Goutham #define   NIC_PF_TL2_0_63_CFG			(0x500000)
1214863dea3SSunil Goutham #define   NIC_PF_TL2_0_63_PRI			(0x520000)
1220025d93eSSunil Goutham #define   NIC_PF_TL2_LMAC			(0x540000)
1234863dea3SSunil Goutham #define   NIC_PF_TL2_0_63_SH_STATUS		(0x580000)
1244863dea3SSunil Goutham #define   NIC_PF_TL3A_0_63_CFG			(0x5F0000)
1254863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_CFG			(0x600000)
1264863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_CHAN			(0x620000)
1274863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_PIR			(0x640000)
1284863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_SW_XOFF		(0x660000)
1294863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_CNM_RATE		(0x680000)
1304863dea3SSunil Goutham #define   NIC_PF_TL3_0_255_SH_STATUS		(0x6A0000)
1314863dea3SSunil Goutham #define   NIC_PF_TL4A_0_255_CFG			(0x6F0000)
1324863dea3SSunil Goutham #define   NIC_PF_TL4_0_1023_CFG			(0x800000)
1334863dea3SSunil Goutham #define   NIC_PF_TL4_0_1023_SW_XOFF		(0x820000)
1344863dea3SSunil Goutham #define   NIC_PF_TL4_0_1023_SH_STATUS		(0x840000)
1354863dea3SSunil Goutham #define   NIC_PF_TL4A_0_1023_CNM_RATE		(0x880000)
1364863dea3SSunil Goutham #define   NIC_PF_TL4A_0_1023_CNM_STATUS		(0x8A0000)
1374863dea3SSunil Goutham #define   NIC_PF_VF_0_127_MAILBOX_0_1		(0x20002030)
1384863dea3SSunil Goutham #define   NIC_PF_VNIC_0_127_TX_STAT_0_4		(0x20004000)
1394863dea3SSunil Goutham #define   NIC_PF_VNIC_0_127_RX_STAT_0_13	(0x20004100)
1404863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_LOCK_0_15		(0x20006000)
1414863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_CFG			(0x20010000)
1424863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_RQ_0_7_CFG		(0x20010400)
1434863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_RQ_0_7_DROP_CFG	(0x20010420)
1444863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_RQ_0_7_BP_CFG	(0x20010500)
1454863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_RQ_0_7_STAT_0_1	(0x20010600)
1464863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_SQ_0_7_CFG		(0x20010C00)
1474863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_SQ_0_7_CFG2		(0x20010C08)
1484863dea3SSunil Goutham #define   NIC_PF_QSET_0_127_SQ_0_7_STAT_0_1	(0x20010D00)
1494863dea3SSunil Goutham 
1504863dea3SSunil Goutham #define   NIC_PF_MSIX_VEC_0_18_ADDR		(0x000000)
1514863dea3SSunil Goutham #define   NIC_PF_MSIX_VEC_0_CTL			(0x000008)
1524863dea3SSunil Goutham #define   NIC_PF_MSIX_PBA_0			(0x0F0000)
1534863dea3SSunil Goutham 
1544863dea3SSunil Goutham /* Virtual function register offsets */
1554863dea3SSunil Goutham #define   NIC_VNIC_CFG				(0x000020)
1564863dea3SSunil Goutham #define   NIC_VF_PF_MAILBOX_0_1			(0x000130)
1574863dea3SSunil Goutham #define   NIC_VF_INT				(0x000200)
1584863dea3SSunil Goutham #define   NIC_VF_INT_W1S			(0x000220)
1594863dea3SSunil Goutham #define   NIC_VF_ENA_W1C			(0x000240)
1604863dea3SSunil Goutham #define   NIC_VF_ENA_W1S			(0x000260)
1614863dea3SSunil Goutham 
1624863dea3SSunil Goutham #define   NIC_VNIC_RSS_CFG			(0x0020E0)
1634863dea3SSunil Goutham #define   NIC_VNIC_RSS_KEY_0_4			(0x002200)
1644863dea3SSunil Goutham #define   NIC_VNIC_TX_STAT_0_4			(0x004000)
1654863dea3SSunil Goutham #define   NIC_VNIC_RX_STAT_0_13			(0x004100)
1664863dea3SSunil Goutham #define   NIC_QSET_RQ_GEN_CFG			(0x010010)
1674863dea3SSunil Goutham 
1684863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_CFG			(0x010400)
1694863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_CFG2			(0x010408)
1704863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_THRESH		(0x010410)
1714863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_BASE			(0x010420)
1724863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_HEAD			(0x010428)
1734863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_TAIL			(0x010430)
1744863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_DOOR			(0x010438)
1754863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_STATUS		(0x010440)
1764863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_STATUS2		(0x010448)
1774863dea3SSunil Goutham #define   NIC_QSET_CQ_0_7_DEBUG			(0x010450)
1784863dea3SSunil Goutham 
1794863dea3SSunil Goutham #define   NIC_QSET_RQ_0_7_CFG			(0x010600)
1804863dea3SSunil Goutham #define   NIC_QSET_RQ_0_7_STAT_0_1		(0x010700)
1814863dea3SSunil Goutham 
1824863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_CFG			(0x010800)
1834863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_THRESH		(0x010810)
1844863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_BASE			(0x010820)
1854863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_HEAD			(0x010828)
1864863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_TAIL			(0x010830)
1874863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_DOOR			(0x010838)
1884863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_STATUS		(0x010840)
1894863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_DEBUG			(0x010848)
1904863dea3SSunil Goutham #define   NIC_QSET_SQ_0_7_STAT_0_1		(0x010900)
1914863dea3SSunil Goutham 
1924863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_CFG			(0x010C00)
1934863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_THRESH		(0x010C10)
1944863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_BASE		(0x010C20)
1954863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_HEAD		(0x010C28)
1964863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_TAIL		(0x010C30)
1974863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_DOOR		(0x010C38)
1984863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_STATUS0		(0x010C40)
1994863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_STATUS1		(0x010C48)
2004863dea3SSunil Goutham #define   NIC_QSET_RBDR_0_1_PREFETCH_STATUS	(0x010C50)
2014863dea3SSunil Goutham 
2024863dea3SSunil Goutham #define   NIC_VF_MSIX_VECTOR_0_19_ADDR		(0x000000)
2034863dea3SSunil Goutham #define   NIC_VF_MSIX_VECTOR_0_19_CTL		(0x000008)
2044863dea3SSunil Goutham #define   NIC_VF_MSIX_PBA			(0x0F0000)
2054863dea3SSunil Goutham 
2064863dea3SSunil Goutham /* Offsets within registers */
2074863dea3SSunil Goutham #define   NIC_MSIX_VEC_SHIFT			4
2084863dea3SSunil Goutham #define   NIC_Q_NUM_SHIFT			18
2094863dea3SSunil Goutham #define   NIC_QS_ID_SHIFT			21
2104863dea3SSunil Goutham #define   NIC_VF_NUM_SHIFT			21
2114863dea3SSunil Goutham 
2124863dea3SSunil Goutham /* Port kind configuration register */
2134863dea3SSunil Goutham struct pkind_cfg {
2144863dea3SSunil Goutham #if defined(__BIG_ENDIAN_BITFIELD)
2154863dea3SSunil Goutham 	u64 reserved_42_63:22;
2164863dea3SSunil Goutham 	u64 hdr_sl:5;	/* Header skip length */
2174863dea3SSunil Goutham 	u64 rx_hdr:3;	/* TNS Receive header present */
2184863dea3SSunil Goutham 	u64 lenerr_en:1;/* L2 length error check enable */
2194863dea3SSunil Goutham 	u64 reserved_32_32:1;
2204863dea3SSunil Goutham 	u64 maxlen:16;	/* Max frame size */
2214863dea3SSunil Goutham 	u64 minlen:16;	/* Min frame size */
2224863dea3SSunil Goutham #elif defined(__LITTLE_ENDIAN_BITFIELD)
2234863dea3SSunil Goutham 	u64 minlen:16;
2244863dea3SSunil Goutham 	u64 maxlen:16;
2254863dea3SSunil Goutham 	u64 reserved_32_32:1;
2264863dea3SSunil Goutham 	u64 lenerr_en:1;
2274863dea3SSunil Goutham 	u64 rx_hdr:3;
2284863dea3SSunil Goutham 	u64 hdr_sl:5;
2294863dea3SSunil Goutham 	u64 reserved_42_63:22;
2304863dea3SSunil Goutham #endif
2314863dea3SSunil Goutham };
2324863dea3SSunil Goutham 
2334863dea3SSunil Goutham #endif /* NIC_REG_H */
234