xref: /freebsd/sys/dev/vnic/nic_reg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
13c0086b8SZbigniew Bodek /*
23c0086b8SZbigniew Bodek  * Copyright (C) 2015 Cavium Inc.
33c0086b8SZbigniew Bodek  * All rights reserved.
43c0086b8SZbigniew Bodek  *
53c0086b8SZbigniew Bodek  * Redistribution and use in source and binary forms, with or without
63c0086b8SZbigniew Bodek  * modification, are permitted provided that the following conditions
73c0086b8SZbigniew Bodek  * are met:
83c0086b8SZbigniew Bodek  * 1. Redistributions of source code must retain the above copyright
93c0086b8SZbigniew Bodek  *    notice, this list of conditions and the following disclaimer.
103c0086b8SZbigniew Bodek  * 2. Redistributions in binary form must reproduce the above copyright
113c0086b8SZbigniew Bodek  *    notice, this list of conditions and the following disclaimer in the
123c0086b8SZbigniew Bodek  *    documentation and/or other materials provided with the distribution.
133c0086b8SZbigniew Bodek  *
143c0086b8SZbigniew Bodek  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
153c0086b8SZbigniew Bodek  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
163c0086b8SZbigniew Bodek  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
173c0086b8SZbigniew Bodek  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
183c0086b8SZbigniew Bodek  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
193c0086b8SZbigniew Bodek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
203c0086b8SZbigniew Bodek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
213c0086b8SZbigniew Bodek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
223c0086b8SZbigniew Bodek  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
233c0086b8SZbigniew Bodek  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
243c0086b8SZbigniew Bodek  * SUCH DAMAGE.
253c0086b8SZbigniew Bodek  *
263c0086b8SZbigniew Bodek  */
273c0086b8SZbigniew Bodek 
283c0086b8SZbigniew Bodek #ifndef NIC_REG_H
293c0086b8SZbigniew Bodek #define NIC_REG_H
303c0086b8SZbigniew Bodek 
313c0086b8SZbigniew Bodek #define	NIC_PF_REG_COUNT			29573
323c0086b8SZbigniew Bodek #define	NIC_VF_REG_COUNT			249
333c0086b8SZbigniew Bodek 
343c0086b8SZbigniew Bodek /* Physical function register offsets */
353c0086b8SZbigniew Bodek #define	NIC_PF_CFG				(0x0000)
363c0086b8SZbigniew Bodek #define	NIC_PF_STATUS				(0x0010)
373c0086b8SZbigniew Bodek #define	NIC_PF_INTR_TIMER_CFG			(0x0030)
383c0086b8SZbigniew Bodek #define	NIC_PF_BIST_STATUS			(0x0040)
393c0086b8SZbigniew Bodek #define	NIC_PF_SOFT_RESET			(0x0050)
403c0086b8SZbigniew Bodek #define	NIC_PF_TCP_TIMER			(0x0060)
413c0086b8SZbigniew Bodek #define	NIC_PF_BP_CFG				(0x0080)
423c0086b8SZbigniew Bodek #define	NIC_PF_RRM_CFG				(0x0088)
433c0086b8SZbigniew Bodek #define	NIC_PF_CQM_CF				(0x00A0)
443c0086b8SZbigniew Bodek #define	NIC_PF_CNM_CF				(0x00A8)
453c0086b8SZbigniew Bodek #define	NIC_PF_CNM_STATUS			(0x00B0)
463c0086b8SZbigniew Bodek #define	NIC_PF_CQ_AVG_CFG			(0x00C0)
473c0086b8SZbigniew Bodek #define	NIC_PF_RRM_AVG_CFG			(0x00C8)
483c0086b8SZbigniew Bodek #define	NIC_PF_INTF_0_1_SEND_CFG		(0x0200)
493c0086b8SZbigniew Bodek #define	NIC_PF_INTF_0_1_BP_CFG			(0x0208)
503c0086b8SZbigniew Bodek #define	NIC_PF_INTF_0_1_BP_DIS_0_1		(0x0210)
513c0086b8SZbigniew Bodek #define	NIC_PF_INTF_0_1_BP_SW_0_1		(0x0220)
523c0086b8SZbigniew Bodek #define	NIC_PF_RBDR_BP_STATE_0_3		(0x0240)
533c0086b8SZbigniew Bodek #define	NIC_PF_MAILBOX_INT			(0x0410)
543c0086b8SZbigniew Bodek #define	NIC_PF_MAILBOX_INT_W1S			(0x0430)
553c0086b8SZbigniew Bodek #define	NIC_PF_MAILBOX_ENA_W1C			(0x0450)
563c0086b8SZbigniew Bodek #define	NIC_PF_MAILBOX_ENA_W1S			(0x0470)
573c0086b8SZbigniew Bodek #define	NIC_PF_RX_ETYPE_0_7			(0x0500)
583c0086b8SZbigniew Bodek #define	NIC_PF_PKIND_0_15_CFG			(0x0600)
593c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_FLIP0			(0x1000)
603c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_FLIP0			(0x1008)
613c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_FLIP0			(0x1010)
623c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_FLIP0			(0x1018)
633c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_FLIP1			(0x1080)
643c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_FLIP1			(0x1088)
653c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_FLIP1			(0x1090)
663c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_FLIP1			(0x1098)
673c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_CDIS			(0x1100)
683c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_CDIS			(0x1108)
693c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_CDIS			(0x1110)
703c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_CDIS			(0x1118)
713c0086b8SZbigniew Bodek #define	NIC_PF_BIST0_STATUS			(0x1280)
723c0086b8SZbigniew Bodek #define	NIC_PF_BIST1_STATUS			(0x1288)
733c0086b8SZbigniew Bodek #define	NIC_PF_BIST2_STATUS			(0x1290)
743c0086b8SZbigniew Bodek #define	NIC_PF_BIST3_STATUS			(0x1298)
753c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_SBE_INT			(0x2000)
763c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_SBE_INT_W1S			(0x2008)
773c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_SBE_ENA_W1C			(0x2010)
783c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_SBE_ENA_W1S			(0x2018)
793c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_DBE_INT			(0x2100)
803c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_DBE_INT_W1S			(0x2108)
813c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_DBE_ENA_W1C			(0x2110)
823c0086b8SZbigniew Bodek #define	NIC_PF_ECC0_DBE_ENA_W1S			(0x2118)
833c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_SBE_INT			(0x2200)
843c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_SBE_INT_W1S			(0x2208)
853c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_SBE_ENA_W1C			(0x2210)
863c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_SBE_ENA_W1S			(0x2218)
873c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_DBE_INT			(0x2300)
883c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_DBE_INT_W1S			(0x2308)
893c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_DBE_ENA_W1C			(0x2310)
903c0086b8SZbigniew Bodek #define	NIC_PF_ECC1_DBE_ENA_W1S			(0x2318)
913c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_SBE_INT			(0x2400)
923c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_SBE_INT_W1S			(0x2408)
933c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_SBE_ENA_W1C			(0x2410)
943c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_SBE_ENA_W1S			(0x2418)
953c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_DBE_INT			(0x2500)
963c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_DBE_INT_W1S			(0x2508)
973c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_DBE_ENA_W1C			(0x2510)
983c0086b8SZbigniew Bodek #define	NIC_PF_ECC2_DBE_ENA_W1S			(0x2518)
993c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_SBE_INT			(0x2600)
1003c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_SBE_INT_W1S			(0x2608)
1013c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_SBE_ENA_W1C			(0x2610)
1023c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_SBE_ENA_W1S			(0x2618)
1033c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_DBE_INT			(0x2700)
1043c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_DBE_INT_W1S			(0x2708)
1053c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_DBE_ENA_W1C			(0x2710)
1063c0086b8SZbigniew Bodek #define	NIC_PF_ECC3_DBE_ENA_W1S			(0x2718)
1073c0086b8SZbigniew Bodek #define	NIC_PF_CPI_0_2047_CFG			(0x200000)
108*3ad422a9SZbigniew Bodek #define	NIC_PF_MPI_0_2047_CFG			(0x210000)
1093c0086b8SZbigniew Bodek #define	NIC_PF_RSSI_0_4097_RQ			(0x220000)
1103c0086b8SZbigniew Bodek #define	NIC_PF_LMAC_0_7_CFG			(0x240000)
1113c0086b8SZbigniew Bodek #define	NIC_PF_LMAC_0_7_SW_XOFF			(0x242000)
1123c0086b8SZbigniew Bodek #define	NIC_PF_LMAC_0_7_CREDIT			(0x244000)
1133c0086b8SZbigniew Bodek #define	NIC_PF_CHAN_0_255_TX_CFG		(0x400000)
1143c0086b8SZbigniew Bodek #define	NIC_PF_CHAN_0_255_RX_CFG		(0x420000)
1153c0086b8SZbigniew Bodek #define	NIC_PF_CHAN_0_255_SW_XOFF		(0x440000)
1163c0086b8SZbigniew Bodek #define	NIC_PF_CHAN_0_255_CREDIT		(0x460000)
1173c0086b8SZbigniew Bodek #define	NIC_PF_CHAN_0_255_RX_BP_CFG		(0x480000)
1183c0086b8SZbigniew Bodek #define	NIC_PF_SW_SYNC_RX			(0x490000)
1193c0086b8SZbigniew Bodek #define	NIC_PF_SW_SYNC_RX_DONE			(0x490008)
1203c0086b8SZbigniew Bodek #define	NIC_PF_TL2_0_63_CFG			(0x500000)
1213c0086b8SZbigniew Bodek #define	NIC_PF_TL2_0_63_PRI			(0x520000)
1223c0086b8SZbigniew Bodek #define	NIC_PF_TL2_0_63_SH_STATUS		(0x580000)
1233c0086b8SZbigniew Bodek #define	NIC_PF_TL3A_0_63_CFG			(0x5F0000)
1243c0086b8SZbigniew Bodek #define	NIC_PF_TL3_0_255_CFG			(0x600000)
1253c0086b8SZbigniew Bodek #define	NIC_PF_TL3_0_255_CHAN			(0x620000)
1263c0086b8SZbigniew Bodek #define	NIC_PF_TL3_0_255_PIR			(0x640000)
1273c0086b8SZbigniew Bodek #define	NIC_PF_TL3_0_255_SW_XOFF		(0x660000)
1283c0086b8SZbigniew Bodek #define	NIC_PF_TL3_0_255_CNM_RATE		(0x680000)
1293c0086b8SZbigniew Bodek #define	NIC_PF_TL3_0_255_SH_STATUS		(0x6A0000)
1303c0086b8SZbigniew Bodek #define	NIC_PF_TL4A_0_255_CFG			(0x6F0000)
1313c0086b8SZbigniew Bodek #define	NIC_PF_TL4_0_1023_CFG			(0x800000)
1323c0086b8SZbigniew Bodek #define	NIC_PF_TL4_0_1023_SW_XOFF		(0x820000)
1333c0086b8SZbigniew Bodek #define	NIC_PF_TL4_0_1023_SH_STATUS		(0x840000)
1343c0086b8SZbigniew Bodek #define	NIC_PF_TL4A_0_1023_CNM_RATE		(0x880000)
1353c0086b8SZbigniew Bodek #define	NIC_PF_TL4A_0_1023_CNM_STATUS		(0x8A0000)
1363c0086b8SZbigniew Bodek #define	NIC_PF_VF_0_127_MAILBOX_0_1		(0x20002030)
1373c0086b8SZbigniew Bodek #define	NIC_PF_VNIC_0_127_TX_STAT_0_4		(0x20004000)
1383c0086b8SZbigniew Bodek #define	NIC_PF_VNIC_0_127_RX_STAT_0_13		(0x20004100)
1393c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_LOCK_0_15		(0x20006000)
1403c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_CFG			(0x20010000)
1413c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_RQ_0_7_CFG		(0x20010400)
1423c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_RQ_0_7_DROP_CFG	(0x20010420)
1433c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_RQ_0_7_BP_CFG		(0x20010500)
1443c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_RQ_0_7_STAT_0_1	(0x20010600)
1453c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_SQ_0_7_CFG		(0x20010C00)
1463c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_SQ_0_7_CFG2		(0x20010C08)
1473c0086b8SZbigniew Bodek #define	NIC_PF_QSET_0_127_SQ_0_7_STAT_0_1	(0x20010D00)
1483c0086b8SZbigniew Bodek 
1493c0086b8SZbigniew Bodek #define	NIC_PF_MSIX_VEC_0_18_ADDR		(0x000000)
1503c0086b8SZbigniew Bodek #define	NIC_PF_MSIX_VEC_0_CTL			(0x000008)
1513c0086b8SZbigniew Bodek #define	NIC_PF_MSIX_PBA_0			(0x0F0000)
1523c0086b8SZbigniew Bodek 
1533c0086b8SZbigniew Bodek /* Virtual function register offsets */
1543c0086b8SZbigniew Bodek #define	NIC_VNIC_CFG				(0x000020)
1553c0086b8SZbigniew Bodek #define	NIC_VF_PF_MAILBOX_0_1			(0x000130)
1563c0086b8SZbigniew Bodek #define	NIC_VF_INT				(0x000200)
1573c0086b8SZbigniew Bodek #define	NIC_VF_INT_W1S				(0x000220)
1583c0086b8SZbigniew Bodek #define	NIC_VF_ENA_W1C				(0x000240)
1593c0086b8SZbigniew Bodek #define	NIC_VF_ENA_W1S				(0x000260)
1603c0086b8SZbigniew Bodek 
1613c0086b8SZbigniew Bodek #define	NIC_VNIC_RSS_CFG			(0x0020E0)
1623c0086b8SZbigniew Bodek #define	NIC_VNIC_RSS_KEY_0_4			(0x002200)
1633c0086b8SZbigniew Bodek #define	NIC_VNIC_TX_STAT_0_4			(0x004000)
1643c0086b8SZbigniew Bodek #define	NIC_VNIC_RX_STAT_0_13			(0x004100)
1653c0086b8SZbigniew Bodek #define	NIC_QSET_RQ_GEN_CFG			(0x010010)
1663c0086b8SZbigniew Bodek 
1673c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_CFG			(0x010400)
1683c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_CFG2			(0x010408)
1693c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_THRESH			(0x010410)
1703c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_BASE			(0x010420)
1713c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_HEAD			(0x010428)
1723c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_TAIL			(0x010430)
1733c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_DOOR			(0x010438)
1743c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_STATUS			(0x010440)
1753c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_STATUS2			(0x010448)
1763c0086b8SZbigniew Bodek #define	NIC_QSET_CQ_0_7_DEBUG			(0x010450)
1773c0086b8SZbigniew Bodek 
1783c0086b8SZbigniew Bodek #define	NIC_QSET_RQ_0_7_CFG			(0x010600)
1793c0086b8SZbigniew Bodek #define	NIC_QSET_RQ_0_7_STAT_0_1		(0x010700)
1803c0086b8SZbigniew Bodek 
1813c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_CFG			(0x010800)
1823c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_THRESH			(0x010810)
1833c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_BASE			(0x010820)
1843c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_HEAD			(0x010828)
1853c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_TAIL			(0x010830)
1863c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_DOOR			(0x010838)
1873c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_STATUS			(0x010840)
1883c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_DEBUG			(0x010848)
1893c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_CNM_CHG			(0x010860)
1903c0086b8SZbigniew Bodek #define	NIC_QSET_SQ_0_7_STAT_0_1		(0x010900)
1913c0086b8SZbigniew Bodek 
1923c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_CFG			(0x010C00)
1933c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_THRESH		(0x010C10)
1943c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_BASE			(0x010C20)
1953c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_HEAD			(0x010C28)
1963c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_TAIL			(0x010C30)
1973c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_DOOR			(0x010C38)
1983c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_STATUS0		(0x010C40)
1993c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_STATUS1		(0x010C48)
2003c0086b8SZbigniew Bodek #define	NIC_QSET_RBDR_0_1_PREFETCH_STATUS	(0x010C50)
2013c0086b8SZbigniew Bodek 
2023c0086b8SZbigniew Bodek #define	NIC_VF_MSIX_VECTOR_0_19_ADDR		(0x000000)
2033c0086b8SZbigniew Bodek #define	NIC_VF_MSIX_VECTOR_0_19_CTL		(0x000008)
2043c0086b8SZbigniew Bodek #define	NIC_VF_MSIX_PBA				(0x0F0000)
2053c0086b8SZbigniew Bodek 
2063c0086b8SZbigniew Bodek /* Offsets within registers */
2073c0086b8SZbigniew Bodek #define	NIC_MSIX_VEC_SHIFT			4
2083c0086b8SZbigniew Bodek #define	NIC_Q_NUM_SHIFT				18
2093c0086b8SZbigniew Bodek #define	NIC_QS_ID_SHIFT				21
2103c0086b8SZbigniew Bodek #define	NIC_VF_NUM_SHIFT			21
2113c0086b8SZbigniew Bodek 
2123c0086b8SZbigniew Bodek /* Port kind configuration register */
2133c0086b8SZbigniew Bodek struct pkind_cfg {
2142306b72aSZbigniew Bodek 	uint64_t minlen:16;
2152306b72aSZbigniew Bodek 	uint64_t maxlen:16;
2162306b72aSZbigniew Bodek 	uint64_t reserved_32_32:1;
2172306b72aSZbigniew Bodek 	uint64_t lenerr_en:1;
2182306b72aSZbigniew Bodek 	uint64_t rx_hdr:3;
2192306b72aSZbigniew Bodek 	uint64_t hdr_sl:5;
2202306b72aSZbigniew Bodek 	uint64_t reserved_42_63:22;
2213c0086b8SZbigniew Bodek };
2223c0086b8SZbigniew Bodek 
2233c0086b8SZbigniew Bodek #endif /* NIC_REG_H */
224