18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Copyright (c)  2018 Intel Corporation */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _IGC_DEFINES_H_
58c2ecf20Sopenharmony_ci#define _IGC_DEFINES_H_
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* Number of Transmit and Receive Descriptors must be a multiple of 8 */
88c2ecf20Sopenharmony_ci#define REQ_TX_DESCRIPTOR_MULTIPLE	8
98c2ecf20Sopenharmony_ci#define REQ_RX_DESCRIPTOR_MULTIPLE	8
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define IGC_CTRL_EXT_DRV_LOAD	0x10000000 /* Drv loaded bit for FW */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* Definitions for power management and wakeup registers */
148c2ecf20Sopenharmony_ci/* Wake Up Control */
158c2ecf20Sopenharmony_ci#define IGC_WUC_PME_EN	0x00000002 /* PME Enable */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Wake Up Filter Control */
188c2ecf20Sopenharmony_ci#define IGC_WUFC_LNKC	0x00000001 /* Link Status Change Wakeup Enable */
198c2ecf20Sopenharmony_ci#define IGC_WUFC_MAG	0x00000002 /* Magic Packet Wakeup Enable */
208c2ecf20Sopenharmony_ci#define IGC_WUFC_EX	0x00000004 /* Directed Exact Wakeup Enable */
218c2ecf20Sopenharmony_ci#define IGC_WUFC_MC	0x00000008 /* Directed Multicast Wakeup Enable */
228c2ecf20Sopenharmony_ci#define IGC_WUFC_BC	0x00000010 /* Broadcast Wakeup Enable */
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define IGC_CTRL_ADVD3WUC	0x00100000  /* D3 WUC */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Wake Up Status */
278c2ecf20Sopenharmony_ci#define IGC_WUS_EX	0x00000004 /* Directed Exact */
288c2ecf20Sopenharmony_ci#define IGC_WUS_ARPD	0x00000020 /* Directed ARP Request */
298c2ecf20Sopenharmony_ci#define IGC_WUS_IPV4	0x00000040 /* Directed IPv4 */
308c2ecf20Sopenharmony_ci#define IGC_WUS_IPV6	0x00000080 /* Directed IPv6 */
318c2ecf20Sopenharmony_ci#define IGC_WUS_NSD	0x00000400 /* Directed IPv6 Neighbor Solicitation */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* Packet types that are enabled for wake packet delivery */
348c2ecf20Sopenharmony_ci#define WAKE_PKT_WUS ( \
358c2ecf20Sopenharmony_ci	IGC_WUS_EX   | \
368c2ecf20Sopenharmony_ci	IGC_WUS_ARPD | \
378c2ecf20Sopenharmony_ci	IGC_WUS_IPV4 | \
388c2ecf20Sopenharmony_ci	IGC_WUS_IPV6 | \
398c2ecf20Sopenharmony_ci	IGC_WUS_NSD)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* Wake Up Packet Length */
428c2ecf20Sopenharmony_ci#define IGC_WUPL_MASK	0x00000FFF
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* Wake Up Packet Memory stores the first 128 bytes of the wake up packet */
458c2ecf20Sopenharmony_ci#define IGC_WUPM_BYTES	128
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* Loop limit on how long we wait for auto-negotiation to complete */
488c2ecf20Sopenharmony_ci#define COPPER_LINK_UP_LIMIT		10
498c2ecf20Sopenharmony_ci#define PHY_AUTO_NEG_LIMIT		45
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* Number of 100 microseconds we wait for PCI Express master disable */
528c2ecf20Sopenharmony_ci#define MASTER_DISABLE_TIMEOUT		800
538c2ecf20Sopenharmony_ci/*Blocks new Master requests */
548c2ecf20Sopenharmony_ci#define IGC_CTRL_GIO_MASTER_DISABLE	0x00000004
558c2ecf20Sopenharmony_ci/* Status of Master requests. */
568c2ecf20Sopenharmony_ci#define IGC_STATUS_GIO_MASTER_ENABLE	0x00080000
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* Receive Address
598c2ecf20Sopenharmony_ci * Number of high/low register pairs in the RAR. The RAR (Receive Address
608c2ecf20Sopenharmony_ci * Registers) holds the directed and multicast addresses that we monitor.
618c2ecf20Sopenharmony_ci * Technically, we have 16 spots.  However, we reserve one of these spots
628c2ecf20Sopenharmony_ci * (RAR[15]) for our directed address used by controllers with
638c2ecf20Sopenharmony_ci * manageability enabled, allowing us room for 15 multicast addresses.
648c2ecf20Sopenharmony_ci */
658c2ecf20Sopenharmony_ci#define IGC_RAH_RAH_MASK	0x0000FFFF
668c2ecf20Sopenharmony_ci#define IGC_RAH_ASEL_MASK	0x00030000
678c2ecf20Sopenharmony_ci#define IGC_RAH_ASEL_SRC_ADDR	BIT(16)
688c2ecf20Sopenharmony_ci#define IGC_RAH_QSEL_MASK	0x000C0000
698c2ecf20Sopenharmony_ci#define IGC_RAH_QSEL_SHIFT	18
708c2ecf20Sopenharmony_ci#define IGC_RAH_QSEL_ENABLE	BIT(28)
718c2ecf20Sopenharmony_ci#define IGC_RAH_AV		0x80000000 /* Receive descriptor valid */
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#define IGC_RAL_MAC_ADDR_LEN	4
748c2ecf20Sopenharmony_ci#define IGC_RAH_MAC_ADDR_LEN	2
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* Error Codes */
778c2ecf20Sopenharmony_ci#define IGC_SUCCESS			0
788c2ecf20Sopenharmony_ci#define IGC_ERR_NVM			1
798c2ecf20Sopenharmony_ci#define IGC_ERR_PHY			2
808c2ecf20Sopenharmony_ci#define IGC_ERR_CONFIG			3
818c2ecf20Sopenharmony_ci#define IGC_ERR_PARAM			4
828c2ecf20Sopenharmony_ci#define IGC_ERR_MAC_INIT		5
838c2ecf20Sopenharmony_ci#define IGC_ERR_RESET			9
848c2ecf20Sopenharmony_ci#define IGC_ERR_MASTER_REQUESTS_PENDING	10
858c2ecf20Sopenharmony_ci#define IGC_ERR_BLK_PHY_RESET		12
868c2ecf20Sopenharmony_ci#define IGC_ERR_SWFW_SYNC		13
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/* Device Control */
898c2ecf20Sopenharmony_ci#define IGC_CTRL_DEV_RST	0x20000000  /* Device reset */
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define IGC_CTRL_PHY_RST	0x80000000  /* PHY Reset */
928c2ecf20Sopenharmony_ci#define IGC_CTRL_SLU		0x00000040  /* Set link up (Force Link) */
938c2ecf20Sopenharmony_ci#define IGC_CTRL_FRCSPD		0x00000800  /* Force Speed */
948c2ecf20Sopenharmony_ci#define IGC_CTRL_FRCDPX		0x00001000  /* Force Duplex */
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define IGC_CTRL_RFCE		0x08000000  /* Receive Flow Control enable */
978c2ecf20Sopenharmony_ci#define IGC_CTRL_TFCE		0x10000000  /* Transmit flow control enable */
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci/* As per the EAS the maximum supported size is 9.5KB (9728 bytes) */
1008c2ecf20Sopenharmony_ci#define MAX_JUMBO_FRAME_SIZE	0x2600
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/* PBA constants */
1038c2ecf20Sopenharmony_ci#define IGC_PBA_34K		0x0022
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci/* SW Semaphore Register */
1068c2ecf20Sopenharmony_ci#define IGC_SWSM_SMBI		0x00000001 /* Driver Semaphore bit */
1078c2ecf20Sopenharmony_ci#define IGC_SWSM_SWESMBI	0x00000002 /* FW Semaphore bit */
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* SWFW_SYNC Definitions */
1108c2ecf20Sopenharmony_ci#define IGC_SWFW_EEP_SM		0x1
1118c2ecf20Sopenharmony_ci#define IGC_SWFW_PHY0_SM	0x2
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/* Autoneg Advertisement Register */
1148c2ecf20Sopenharmony_ci#define NWAY_AR_10T_HD_CAPS	0x0020   /* 10T   Half Duplex Capable */
1158c2ecf20Sopenharmony_ci#define NWAY_AR_10T_FD_CAPS	0x0040   /* 10T   Full Duplex Capable */
1168c2ecf20Sopenharmony_ci#define NWAY_AR_100TX_HD_CAPS	0x0080   /* 100TX Half Duplex Capable */
1178c2ecf20Sopenharmony_ci#define NWAY_AR_100TX_FD_CAPS	0x0100   /* 100TX Full Duplex Capable */
1188c2ecf20Sopenharmony_ci#define NWAY_AR_PAUSE		0x0400   /* Pause operation desired */
1198c2ecf20Sopenharmony_ci#define NWAY_AR_ASM_DIR		0x0800   /* Asymmetric Pause Direction bit */
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci/* Link Partner Ability Register (Base Page) */
1228c2ecf20Sopenharmony_ci#define NWAY_LPAR_PAUSE		0x0400 /* LP Pause operation desired */
1238c2ecf20Sopenharmony_ci#define NWAY_LPAR_ASM_DIR	0x0800 /* LP Asymmetric Pause Direction bit */
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* 1000BASE-T Control Register */
1268c2ecf20Sopenharmony_ci#define CR_1000T_ASYM_PAUSE	0x0080 /* Advertise asymmetric pause bit */
1278c2ecf20Sopenharmony_ci#define CR_1000T_HD_CAPS	0x0100 /* Advertise 1000T HD capability */
1288c2ecf20Sopenharmony_ci#define CR_1000T_FD_CAPS	0x0200 /* Advertise 1000T FD capability  */
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci/* 1000BASE-T Status Register */
1318c2ecf20Sopenharmony_ci#define SR_1000T_REMOTE_RX_STATUS	0x1000 /* Remote receiver OK */
1328c2ecf20Sopenharmony_ci#define SR_1000T_LOCAL_RX_STATUS	0x2000 /* Local receiver OK */
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/* PHY GPY 211 registers */
1358c2ecf20Sopenharmony_ci#define STANDARD_AN_REG_MASK	0x0007 /* MMD */
1368c2ecf20Sopenharmony_ci#define ANEG_MULTIGBT_AN_CTRL	0x0020 /* MULTI GBT AN Control Register */
1378c2ecf20Sopenharmony_ci#define MMD_DEVADDR_SHIFT	16     /* Shift MMD to higher bits */
1388c2ecf20Sopenharmony_ci#define CR_2500T_FD_CAPS	0x0080 /* Advertise 2500T FD capability */
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci/* NVM Control */
1418c2ecf20Sopenharmony_ci/* Number of milliseconds for NVM auto read done after MAC reset. */
1428c2ecf20Sopenharmony_ci#define AUTO_READ_DONE_TIMEOUT		10
1438c2ecf20Sopenharmony_ci#define IGC_EECD_AUTO_RD		0x00000200  /* NVM Auto Read done */
1448c2ecf20Sopenharmony_ci#define IGC_EECD_REQ		0x00000040 /* NVM Access Request */
1458c2ecf20Sopenharmony_ci#define IGC_EECD_GNT		0x00000080 /* NVM Access Grant */
1468c2ecf20Sopenharmony_ci/* NVM Addressing bits based on type 0=small, 1=large */
1478c2ecf20Sopenharmony_ci#define IGC_EECD_ADDR_BITS		0x00000400
1488c2ecf20Sopenharmony_ci#define IGC_NVM_GRANT_ATTEMPTS		1000 /* NVM # attempts to gain grant */
1498c2ecf20Sopenharmony_ci#define IGC_EECD_SIZE_EX_MASK		0x00007800  /* NVM Size */
1508c2ecf20Sopenharmony_ci#define IGC_EECD_SIZE_EX_SHIFT		11
1518c2ecf20Sopenharmony_ci#define IGC_EECD_FLUPD_I225		0x00800000 /* Update FLASH */
1528c2ecf20Sopenharmony_ci#define IGC_EECD_FLUDONE_I225		0x04000000 /* Update FLASH done*/
1538c2ecf20Sopenharmony_ci#define IGC_EECD_FLASH_DETECTED_I225	0x00080000 /* FLASH detected */
1548c2ecf20Sopenharmony_ci#define IGC_FLUDONE_ATTEMPTS		20000
1558c2ecf20Sopenharmony_ci#define IGC_EERD_EEWR_MAX_COUNT		512 /* buffered EEPROM words rw */
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* Offset to data in NVM read/write registers */
1588c2ecf20Sopenharmony_ci#define IGC_NVM_RW_REG_DATA	16
1598c2ecf20Sopenharmony_ci#define IGC_NVM_RW_REG_DONE	2    /* Offset to READ/WRITE done bit */
1608c2ecf20Sopenharmony_ci#define IGC_NVM_RW_REG_START	1    /* Start operation */
1618c2ecf20Sopenharmony_ci#define IGC_NVM_RW_ADDR_SHIFT	2    /* Shift to the address bits */
1628c2ecf20Sopenharmony_ci#define IGC_NVM_POLL_READ	0    /* Flag for polling for read complete */
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci/* NVM Word Offsets */
1658c2ecf20Sopenharmony_ci#define NVM_CHECKSUM_REG		0x003F
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci/* For checksumming, the sum of all words in the NVM should equal 0xBABA. */
1688c2ecf20Sopenharmony_ci#define NVM_SUM				0xBABA
1698c2ecf20Sopenharmony_ci#define NVM_WORD_SIZE_BASE_SHIFT	6
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/* Collision related configuration parameters */
1728c2ecf20Sopenharmony_ci#define IGC_COLLISION_THRESHOLD		15
1738c2ecf20Sopenharmony_ci#define IGC_CT_SHIFT			4
1748c2ecf20Sopenharmony_ci#define IGC_COLLISION_DISTANCE		63
1758c2ecf20Sopenharmony_ci#define IGC_COLD_SHIFT			12
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/* Device Status */
1788c2ecf20Sopenharmony_ci#define IGC_STATUS_FD		0x00000001      /* Full duplex.0=half,1=full */
1798c2ecf20Sopenharmony_ci#define IGC_STATUS_LU		0x00000002      /* Link up.0=no,1=link */
1808c2ecf20Sopenharmony_ci#define IGC_STATUS_FUNC_MASK	0x0000000C      /* PCI Function Mask */
1818c2ecf20Sopenharmony_ci#define IGC_STATUS_FUNC_SHIFT	2
1828c2ecf20Sopenharmony_ci#define IGC_STATUS_FUNC_1	0x00000004      /* Function 1 */
1838c2ecf20Sopenharmony_ci#define IGC_STATUS_TXOFF	0x00000010      /* transmission paused */
1848c2ecf20Sopenharmony_ci#define IGC_STATUS_SPEED_100	0x00000040      /* Speed 100Mb/s */
1858c2ecf20Sopenharmony_ci#define IGC_STATUS_SPEED_1000	0x00000080      /* Speed 1000Mb/s */
1868c2ecf20Sopenharmony_ci#define IGC_STATUS_SPEED_2500	0x00400000	/* Speed 2.5Gb/s */
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci#define SPEED_10		10
1898c2ecf20Sopenharmony_ci#define SPEED_100		100
1908c2ecf20Sopenharmony_ci#define SPEED_1000		1000
1918c2ecf20Sopenharmony_ci#define SPEED_2500		2500
1928c2ecf20Sopenharmony_ci#define HALF_DUPLEX		1
1938c2ecf20Sopenharmony_ci#define FULL_DUPLEX		2
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci/* 1Gbps and 2.5Gbps half duplex is not supported, nor spec-compliant. */
1968c2ecf20Sopenharmony_ci#define ADVERTISE_10_HALF		0x0001
1978c2ecf20Sopenharmony_ci#define ADVERTISE_10_FULL		0x0002
1988c2ecf20Sopenharmony_ci#define ADVERTISE_100_HALF		0x0004
1998c2ecf20Sopenharmony_ci#define ADVERTISE_100_FULL		0x0008
2008c2ecf20Sopenharmony_ci#define ADVERTISE_1000_HALF		0x0010 /* Not used, just FYI */
2018c2ecf20Sopenharmony_ci#define ADVERTISE_1000_FULL		0x0020
2028c2ecf20Sopenharmony_ci#define ADVERTISE_2500_HALF		0x0040 /* Not used, just FYI */
2038c2ecf20Sopenharmony_ci#define ADVERTISE_2500_FULL		0x0080
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci#define IGC_ALL_SPEED_DUPLEX_2500 ( \
2068c2ecf20Sopenharmony_ci	ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \
2078c2ecf20Sopenharmony_ci	ADVERTISE_100_FULL | ADVERTISE_1000_FULL | ADVERTISE_2500_FULL)
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define AUTONEG_ADVERTISE_SPEED_DEFAULT_2500	IGC_ALL_SPEED_DUPLEX_2500
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci/* Interrupt Cause Read */
2128c2ecf20Sopenharmony_ci#define IGC_ICR_TXDW		BIT(0)	/* Transmit desc written back */
2138c2ecf20Sopenharmony_ci#define IGC_ICR_TXQE		BIT(1)	/* Transmit Queue empty */
2148c2ecf20Sopenharmony_ci#define IGC_ICR_LSC		BIT(2)	/* Link Status Change */
2158c2ecf20Sopenharmony_ci#define IGC_ICR_RXSEQ		BIT(3)	/* Rx sequence error */
2168c2ecf20Sopenharmony_ci#define IGC_ICR_RXDMT0		BIT(4)	/* Rx desc min. threshold (0) */
2178c2ecf20Sopenharmony_ci#define IGC_ICR_RXO		BIT(6)	/* Rx overrun */
2188c2ecf20Sopenharmony_ci#define IGC_ICR_RXT0		BIT(7)	/* Rx timer intr (ring 0) */
2198c2ecf20Sopenharmony_ci#define IGC_ICR_TS		BIT(19)	/* Time Sync Interrupt */
2208c2ecf20Sopenharmony_ci#define IGC_ICR_DRSTA		BIT(30)	/* Device Reset Asserted */
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci/* If this bit asserted, the driver should claim the interrupt */
2238c2ecf20Sopenharmony_ci#define IGC_ICR_INT_ASSERTED	BIT(31)
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci#define IGC_ICS_RXT0		IGC_ICR_RXT0 /* Rx timer intr */
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci#define IMS_ENABLE_MASK ( \
2288c2ecf20Sopenharmony_ci	IGC_IMS_RXT0   |    \
2298c2ecf20Sopenharmony_ci	IGC_IMS_TXDW   |    \
2308c2ecf20Sopenharmony_ci	IGC_IMS_RXDMT0 |    \
2318c2ecf20Sopenharmony_ci	IGC_IMS_RXSEQ  |    \
2328c2ecf20Sopenharmony_ci	IGC_IMS_LSC)
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci/* Interrupt Mask Set */
2358c2ecf20Sopenharmony_ci#define IGC_IMS_TXDW		IGC_ICR_TXDW	/* Tx desc written back */
2368c2ecf20Sopenharmony_ci#define IGC_IMS_RXSEQ		IGC_ICR_RXSEQ	/* Rx sequence error */
2378c2ecf20Sopenharmony_ci#define IGC_IMS_LSC		IGC_ICR_LSC	/* Link Status Change */
2388c2ecf20Sopenharmony_ci#define IGC_IMS_DOUTSYNC	IGC_ICR_DOUTSYNC /* NIC DMA out of sync */
2398c2ecf20Sopenharmony_ci#define IGC_IMS_DRSTA		IGC_ICR_DRSTA	/* Device Reset Asserted */
2408c2ecf20Sopenharmony_ci#define IGC_IMS_RXT0		IGC_ICR_RXT0	/* Rx timer intr */
2418c2ecf20Sopenharmony_ci#define IGC_IMS_RXDMT0		IGC_ICR_RXDMT0	/* Rx desc min. threshold */
2428c2ecf20Sopenharmony_ci#define IGC_IMS_TS		IGC_ICR_TS	/* Time Sync Interrupt */
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci#define IGC_QVECTOR_MASK	0x7FFC		/* Q-vector mask */
2458c2ecf20Sopenharmony_ci#define IGC_ITR_VAL_MASK	0x04		/* ITR value mask */
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci/* Interrupt Cause Set */
2488c2ecf20Sopenharmony_ci#define IGC_ICS_LSC		IGC_ICR_LSC       /* Link Status Change */
2498c2ecf20Sopenharmony_ci#define IGC_ICS_RXDMT0		IGC_ICR_RXDMT0    /* rx desc min. threshold */
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci#define IGC_ICR_DOUTSYNC	0x10000000 /* NIC DMA out of sync */
2528c2ecf20Sopenharmony_ci#define IGC_EITR_CNT_IGNR	0x80000000 /* Don't reset counters on write */
2538c2ecf20Sopenharmony_ci#define IGC_IVAR_VALID		0x80
2548c2ecf20Sopenharmony_ci#define IGC_GPIE_NSICR		0x00000001
2558c2ecf20Sopenharmony_ci#define IGC_GPIE_MSIX_MODE	0x00000010
2568c2ecf20Sopenharmony_ci#define IGC_GPIE_EIAME		0x40000000
2578c2ecf20Sopenharmony_ci#define IGC_GPIE_PBA		0x80000000
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci/* Receive Descriptor bit definitions */
2608c2ecf20Sopenharmony_ci#define IGC_RXD_STAT_DD		0x01    /* Descriptor Done */
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci/* Transmit Descriptor bit definitions */
2638c2ecf20Sopenharmony_ci#define IGC_TXD_DTYP_D		0x00100000 /* Data Descriptor */
2648c2ecf20Sopenharmony_ci#define IGC_TXD_DTYP_C		0x00000000 /* Context Descriptor */
2658c2ecf20Sopenharmony_ci#define IGC_TXD_POPTS_IXSM	0x01       /* Insert IP checksum */
2668c2ecf20Sopenharmony_ci#define IGC_TXD_POPTS_TXSM	0x02       /* Insert TCP/UDP checksum */
2678c2ecf20Sopenharmony_ci#define IGC_TXD_CMD_EOP		0x01000000 /* End of Packet */
2688c2ecf20Sopenharmony_ci#define IGC_TXD_CMD_IC		0x04000000 /* Insert Checksum */
2698c2ecf20Sopenharmony_ci#define IGC_TXD_CMD_DEXT	0x20000000 /* Desc extension (0 = legacy) */
2708c2ecf20Sopenharmony_ci#define IGC_TXD_CMD_VLE		0x40000000 /* Add VLAN tag */
2718c2ecf20Sopenharmony_ci#define IGC_TXD_STAT_DD		0x00000001 /* Descriptor Done */
2728c2ecf20Sopenharmony_ci#define IGC_TXD_CMD_TCP		0x01000000 /* TCP packet */
2738c2ecf20Sopenharmony_ci#define IGC_TXD_CMD_IP		0x02000000 /* IP packet */
2748c2ecf20Sopenharmony_ci#define IGC_TXD_CMD_TSE		0x04000000 /* TCP Seg enable */
2758c2ecf20Sopenharmony_ci#define IGC_TXD_EXTCMD_TSTAMP	0x00000010 /* IEEE1588 Timestamp packet */
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci/* IPSec Encrypt Enable */
2788c2ecf20Sopenharmony_ci#define IGC_ADVTXD_L4LEN_SHIFT	8  /* Adv ctxt L4LEN shift */
2798c2ecf20Sopenharmony_ci#define IGC_ADVTXD_MSS_SHIFT	16 /* Adv ctxt MSS shift */
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci#define IGC_ADVTXD_TSN_CNTX_FIRST	0x00000080
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci/* Transmit Control */
2848c2ecf20Sopenharmony_ci#define IGC_TCTL_EN		0x00000002 /* enable Tx */
2858c2ecf20Sopenharmony_ci#define IGC_TCTL_PSP		0x00000008 /* pad short packets */
2868c2ecf20Sopenharmony_ci#define IGC_TCTL_CT		0x00000ff0 /* collision threshold */
2878c2ecf20Sopenharmony_ci#define IGC_TCTL_COLD		0x003ff000 /* collision distance */
2888c2ecf20Sopenharmony_ci#define IGC_TCTL_RTLC		0x01000000 /* Re-transmit on late collision */
2898c2ecf20Sopenharmony_ci#define IGC_TCTL_MULR		0x10000000 /* Multiple request support */
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci/* Flow Control Constants */
2928c2ecf20Sopenharmony_ci#define FLOW_CONTROL_ADDRESS_LOW	0x00C28001
2938c2ecf20Sopenharmony_ci#define FLOW_CONTROL_ADDRESS_HIGH	0x00000100
2948c2ecf20Sopenharmony_ci#define FLOW_CONTROL_TYPE		0x8808
2958c2ecf20Sopenharmony_ci/* Enable XON frame transmission */
2968c2ecf20Sopenharmony_ci#define IGC_FCRTL_XONE			0x80000000
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci/* Management Control */
2998c2ecf20Sopenharmony_ci#define IGC_MANC_RCV_TCO_EN	0x00020000 /* Receive TCO Packets Enabled */
3008c2ecf20Sopenharmony_ci#define IGC_MANC_BLK_PHY_RST_ON_IDE	0x00040000 /* Block phy resets */
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/* Receive Control */
3038c2ecf20Sopenharmony_ci#define IGC_RCTL_RST		0x00000001 /* Software reset */
3048c2ecf20Sopenharmony_ci#define IGC_RCTL_EN		0x00000002 /* enable */
3058c2ecf20Sopenharmony_ci#define IGC_RCTL_SBP		0x00000004 /* store bad packet */
3068c2ecf20Sopenharmony_ci#define IGC_RCTL_UPE		0x00000008 /* unicast promisc enable */
3078c2ecf20Sopenharmony_ci#define IGC_RCTL_MPE		0x00000010 /* multicast promisc enable */
3088c2ecf20Sopenharmony_ci#define IGC_RCTL_LPE		0x00000020 /* long packet enable */
3098c2ecf20Sopenharmony_ci#define IGC_RCTL_LBM_MAC	0x00000040 /* MAC loopback mode */
3108c2ecf20Sopenharmony_ci#define IGC_RCTL_LBM_TCVR	0x000000C0 /* tcvr loopback mode */
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci#define IGC_RCTL_RDMTS_HALF	0x00000000 /* Rx desc min thresh size */
3138c2ecf20Sopenharmony_ci#define IGC_RCTL_BAM		0x00008000 /* broadcast enable */
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci/* Split Replication Receive Control */
3168c2ecf20Sopenharmony_ci#define IGC_SRRCTL_TIMESTAMP		0x40000000
3178c2ecf20Sopenharmony_ci#define IGC_SRRCTL_TIMER1SEL(timer)	(((timer) & 0x3) << 14)
3188c2ecf20Sopenharmony_ci#define IGC_SRRCTL_TIMER0SEL(timer)	(((timer) & 0x3) << 17)
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci/* Receive Descriptor bit definitions */
3218c2ecf20Sopenharmony_ci#define IGC_RXD_STAT_EOP	0x02	/* End of Packet */
3228c2ecf20Sopenharmony_ci#define IGC_RXD_STAT_IXSM	0x04	/* Ignore checksum */
3238c2ecf20Sopenharmony_ci#define IGC_RXD_STAT_UDPCS	0x10	/* UDP xsum calculated */
3248c2ecf20Sopenharmony_ci#define IGC_RXD_STAT_TCPCS	0x20	/* TCP xsum calculated */
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci/* Advanced Receive Descriptor bit definitions */
3278c2ecf20Sopenharmony_ci#define IGC_RXDADV_STAT_TSIP	0x08000 /* timestamp in packet */
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci#define IGC_RXDEXT_STATERR_L4E		0x20000000
3308c2ecf20Sopenharmony_ci#define IGC_RXDEXT_STATERR_IPE		0x40000000
3318c2ecf20Sopenharmony_ci#define IGC_RXDEXT_STATERR_RXE		0x80000000
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV4_TCP	0x00010000
3348c2ecf20Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV4		0x00020000
3358c2ecf20Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV6_TCP_EX	0x00040000
3368c2ecf20Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV6		0x00100000
3378c2ecf20Sopenharmony_ci#define IGC_MRQC_RSS_FIELD_IPV6_TCP	0x00200000
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci/* Header split receive */
3408c2ecf20Sopenharmony_ci#define IGC_RFCTL_IPV6_EX_DIS	0x00010000
3418c2ecf20Sopenharmony_ci#define IGC_RFCTL_LEF		0x00040000
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci#define IGC_RCTL_SZ_256		0x00030000 /* Rx buffer size 256 */
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci#define IGC_RCTL_MO_SHIFT	12 /* multicast offset shift */
3468c2ecf20Sopenharmony_ci#define IGC_RCTL_CFIEN		0x00080000 /* canonical form enable */
3478c2ecf20Sopenharmony_ci#define IGC_RCTL_DPF		0x00400000 /* discard pause frames */
3488c2ecf20Sopenharmony_ci#define IGC_RCTL_PMCF		0x00800000 /* pass MAC control frames */
3498c2ecf20Sopenharmony_ci#define IGC_RCTL_SECRC		0x04000000 /* Strip Ethernet CRC */
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci#define I225_RXPBSIZE_DEFAULT	0x000000A2 /* RXPBSIZE default */
3528c2ecf20Sopenharmony_ci#define I225_TXPBSIZE_DEFAULT	0x04000014 /* TXPBSIZE default */
3538c2ecf20Sopenharmony_ci#define IGC_RXPBS_CFG_TS_EN	0x80000000 /* Timestamp in Rx buffer */
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci#define IGC_TXPBSIZE_TSN	0x04145145 /* 5k bytes buffer for each queue */
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci#define IGC_DTXMXPKTSZ_TSN	0x19 /* 1600 bytes of max TX DMA packet size */
3588c2ecf20Sopenharmony_ci#define IGC_DTXMXPKTSZ_DEFAULT	0x98 /* 9728-byte Jumbo frames */
3598c2ecf20Sopenharmony_ci
3608c2ecf20Sopenharmony_ci/* Time Sync Interrupt Causes */
3618c2ecf20Sopenharmony_ci#define IGC_TSICR_SYS_WRAP	BIT(0) /* SYSTIM Wrap around. */
3628c2ecf20Sopenharmony_ci#define IGC_TSICR_TXTS		BIT(1) /* Transmit Timestamp. */
3638c2ecf20Sopenharmony_ci#define IGC_TSICR_TT0		BIT(3) /* Target Time 0 Trigger. */
3648c2ecf20Sopenharmony_ci#define IGC_TSICR_TT1		BIT(4) /* Target Time 1 Trigger. */
3658c2ecf20Sopenharmony_ci#define IGC_TSICR_AUTT0		BIT(5) /* Auxiliary Timestamp 0 Taken. */
3668c2ecf20Sopenharmony_ci#define IGC_TSICR_AUTT1		BIT(6) /* Auxiliary Timestamp 1 Taken. */
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci#define IGC_TSICR_INTERRUPTS	IGC_TSICR_TXTS
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci#define IGC_FTQF_VF_BP		0x00008000
3718c2ecf20Sopenharmony_ci#define IGC_FTQF_1588_TIME_STAMP	0x08000000
3728c2ecf20Sopenharmony_ci#define IGC_FTQF_MASK			0xF0000000
3738c2ecf20Sopenharmony_ci#define IGC_FTQF_MASK_PROTO_BP	0x10000000
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci/* Time Sync Receive Control bit definitions */
3768c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_MASK	0x0000000E  /* Rx type mask */
3778c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_L2_V2	0x00
3788c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_L4_V1	0x02
3798c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_L2_L4_V2	0x04
3808c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_ALL		0x08
3818c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_TYPE_EVENT_V2	0x0A
3828c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_ENABLED		0x00000010  /* enable Rx timestamping */
3838c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_SYSCFI		0x00000020  /* Sys clock frequency */
3848c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCTL_RXSYNSIG		0x00000400  /* Sample RX tstamp in PHY sop */
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci/* Time Sync Receive Configuration */
3878c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCFG_PTP_V1_CTRLT_MASK	0x000000FF
3888c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE	0x00
3898c2ecf20Sopenharmony_ci#define IGC_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE	0x01
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci/* Immediate Interrupt Receive */
3928c2ecf20Sopenharmony_ci#define IGC_IMIR_CLEAR_MASK	0xF001FFFF /* IMIR Reg Clear Mask */
3938c2ecf20Sopenharmony_ci#define IGC_IMIR_PORT_BYPASS	0x20000 /* IMIR Port Bypass Bit */
3948c2ecf20Sopenharmony_ci#define IGC_IMIR_PRIORITY_SHIFT	29 /* IMIR Priority Shift */
3958c2ecf20Sopenharmony_ci#define IGC_IMIREXT_CLEAR_MASK	0x7FFFF /* IMIREXT Reg Clear Mask */
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci/* Immediate Interrupt Receive Extended */
3988c2ecf20Sopenharmony_ci#define IGC_IMIREXT_CTRL_BP	0x00080000  /* Bypass check of ctrl bits */
3998c2ecf20Sopenharmony_ci#define IGC_IMIREXT_SIZE_BP	0x00001000  /* Packet size bypass */
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci/* Time Sync Transmit Control bit definitions */
4028c2ecf20Sopenharmony_ci#define IGC_TSYNCTXCTL_TXTT_0			0x00000001  /* Tx timestamp reg 0 valid */
4038c2ecf20Sopenharmony_ci#define IGC_TSYNCTXCTL_ENABLED			0x00000010  /* enable Tx timestamping */
4048c2ecf20Sopenharmony_ci#define IGC_TSYNCTXCTL_MAX_ALLOWED_DLY_MASK	0x0000F000  /* max delay */
4058c2ecf20Sopenharmony_ci#define IGC_TSYNCTXCTL_SYNC_COMP_ERR		0x20000000  /* sync err */
4068c2ecf20Sopenharmony_ci#define IGC_TSYNCTXCTL_SYNC_COMP		0x40000000  /* sync complete */
4078c2ecf20Sopenharmony_ci#define IGC_TSYNCTXCTL_START_SYNC		0x80000000  /* initiate sync */
4088c2ecf20Sopenharmony_ci#define IGC_TSYNCTXCTL_TXSYNSIG			0x00000020  /* Sample TX tstamp in PHY sop */
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_ci/* Transmit Scheduling */
4118c2ecf20Sopenharmony_ci#define IGC_TQAVCTRL_TRANSMIT_MODE_TSN	0x00000001
4128c2ecf20Sopenharmony_ci#define IGC_TQAVCTRL_ENHANCED_QAV	0x00000008
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci#define IGC_TXQCTL_QUEUE_MODE_LAUNCHT	0x00000001
4158c2ecf20Sopenharmony_ci#define IGC_TXQCTL_STRICT_CYCLE		0x00000002
4168c2ecf20Sopenharmony_ci#define IGC_TXQCTL_STRICT_END		0x00000004
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_ci/* Receive Checksum Control */
4198c2ecf20Sopenharmony_ci#define IGC_RXCSUM_CRCOFL	0x00000800   /* CRC32 offload enable */
4208c2ecf20Sopenharmony_ci#define IGC_RXCSUM_PCSD		0x00002000   /* packet checksum disabled */
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci/* GPY211 - I225 defines */
4238c2ecf20Sopenharmony_ci#define GPY_MMD_MASK		0xFFFF0000
4248c2ecf20Sopenharmony_ci#define GPY_MMD_SHIFT		16
4258c2ecf20Sopenharmony_ci#define GPY_REG_MASK		0x0000FFFF
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci#define IGC_MMDAC_FUNC_DATA	0x4000 /* Data, no post increment */
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_ci/* MAC definitions */
4308c2ecf20Sopenharmony_ci#define IGC_FACTPS_MNGCG	0x20000000
4318c2ecf20Sopenharmony_ci#define IGC_FWSM_MODE_MASK	0xE
4328c2ecf20Sopenharmony_ci#define IGC_FWSM_MODE_SHIFT	1
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci/* Management Control */
4358c2ecf20Sopenharmony_ci#define IGC_MANC_SMBUS_EN	0x00000001 /* SMBus Enabled - RO */
4368c2ecf20Sopenharmony_ci#define IGC_MANC_ASF_EN		0x00000002 /* ASF Enabled - RO */
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ci/* PHY */
4398c2ecf20Sopenharmony_ci#define PHY_REVISION_MASK	0xFFFFFFF0
4408c2ecf20Sopenharmony_ci#define MAX_PHY_REG_ADDRESS	0x1F  /* 5 bit address bus (0-0x1F) */
4418c2ecf20Sopenharmony_ci#define IGC_GEN_POLL_TIMEOUT	1920
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_ci/* PHY Control Register */
4448c2ecf20Sopenharmony_ci#define MII_CR_FULL_DUPLEX	0x0100  /* FDX =1, half duplex =0 */
4458c2ecf20Sopenharmony_ci#define MII_CR_RESTART_AUTO_NEG	0x0200  /* Restart auto negotiation */
4468c2ecf20Sopenharmony_ci#define MII_CR_POWER_DOWN	0x0800  /* Power down */
4478c2ecf20Sopenharmony_ci#define MII_CR_AUTO_NEG_EN	0x1000  /* Auto Neg Enable */
4488c2ecf20Sopenharmony_ci#define MII_CR_LOOPBACK		0x4000  /* 0 = normal, 1 = loopback */
4498c2ecf20Sopenharmony_ci#define MII_CR_RESET		0x8000  /* 0 = normal, 1 = PHY reset */
4508c2ecf20Sopenharmony_ci#define MII_CR_SPEED_1000	0x0040
4518c2ecf20Sopenharmony_ci#define MII_CR_SPEED_100	0x2000
4528c2ecf20Sopenharmony_ci#define MII_CR_SPEED_10		0x0000
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci/* PHY Status Register */
4558c2ecf20Sopenharmony_ci#define MII_SR_LINK_STATUS	0x0004 /* Link Status 1 = link */
4568c2ecf20Sopenharmony_ci#define MII_SR_AUTONEG_COMPLETE	0x0020 /* Auto Neg Complete */
4578c2ecf20Sopenharmony_ci#define IGC_PHY_RST_COMP	0x0100 /* Internal PHY reset completion */
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci/* PHY 1000 MII Register/Bit Definitions */
4608c2ecf20Sopenharmony_ci/* PHY Registers defined by IEEE */
4618c2ecf20Sopenharmony_ci#define PHY_CONTROL		0x00 /* Control Register */
4628c2ecf20Sopenharmony_ci#define PHY_STATUS		0x01 /* Status Register */
4638c2ecf20Sopenharmony_ci#define PHY_ID1			0x02 /* Phy Id Reg (word 1) */
4648c2ecf20Sopenharmony_ci#define PHY_ID2			0x03 /* Phy Id Reg (word 2) */
4658c2ecf20Sopenharmony_ci#define PHY_AUTONEG_ADV		0x04 /* Autoneg Advertisement */
4668c2ecf20Sopenharmony_ci#define PHY_LP_ABILITY		0x05 /* Link Partner Ability (Base Page) */
4678c2ecf20Sopenharmony_ci#define PHY_1000T_CTRL		0x09 /* 1000Base-T Control Reg */
4688c2ecf20Sopenharmony_ci#define PHY_1000T_STATUS	0x0A /* 1000Base-T Status Reg */
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci/* Bit definitions for valid PHY IDs. I = Integrated E = External */
4718c2ecf20Sopenharmony_ci#define I225_I_PHY_ID		0x67C9DC00
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci/* MDI Control */
4748c2ecf20Sopenharmony_ci#define IGC_MDIC_DATA_MASK	0x0000FFFF
4758c2ecf20Sopenharmony_ci#define IGC_MDIC_REG_MASK	0x001F0000
4768c2ecf20Sopenharmony_ci#define IGC_MDIC_REG_SHIFT	16
4778c2ecf20Sopenharmony_ci#define IGC_MDIC_PHY_MASK	0x03E00000
4788c2ecf20Sopenharmony_ci#define IGC_MDIC_PHY_SHIFT	21
4798c2ecf20Sopenharmony_ci#define IGC_MDIC_OP_WRITE	0x04000000
4808c2ecf20Sopenharmony_ci#define IGC_MDIC_OP_READ	0x08000000
4818c2ecf20Sopenharmony_ci#define IGC_MDIC_READY		0x10000000
4828c2ecf20Sopenharmony_ci#define IGC_MDIC_INT_EN		0x20000000
4838c2ecf20Sopenharmony_ci#define IGC_MDIC_ERROR		0x40000000
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci#define IGC_N0_QUEUE		-1
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci#define IGC_MAX_MAC_HDR_LEN	127
4888c2ecf20Sopenharmony_ci#define IGC_MAX_NETWORK_HDR_LEN	511
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci#define IGC_VLANPQF_QSEL(_n, q_idx) ((q_idx) << ((_n) * 4))
4918c2ecf20Sopenharmony_ci#define IGC_VLANPQF_VALID(_n)	(0x1 << (3 + (_n) * 4))
4928c2ecf20Sopenharmony_ci#define IGC_VLANPQF_QUEUE_MASK	0x03
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_ci#define IGC_ADVTXD_MACLEN_SHIFT		9  /* Adv ctxt desc mac len shift */
4958c2ecf20Sopenharmony_ci#define IGC_ADVTXD_TUCMD_IPV4		0x00000400  /* IP Packet Type:1=IPv4 */
4968c2ecf20Sopenharmony_ci#define IGC_ADVTXD_TUCMD_L4T_TCP	0x00000800  /* L4 Packet Type of TCP */
4978c2ecf20Sopenharmony_ci#define IGC_ADVTXD_TUCMD_L4T_SCTP	0x00001000 /* L4 packet TYPE of SCTP */
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_ci/* Maximum size of the MTA register table in all supported adapters */
5008c2ecf20Sopenharmony_ci#define MAX_MTA_REG			128
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci/* EEE defines */
5038c2ecf20Sopenharmony_ci#define IGC_IPCNFG_EEE_2_5G_AN		0x00000010 /* IPCNFG EEE Ena 2.5G AN */
5048c2ecf20Sopenharmony_ci#define IGC_IPCNFG_EEE_1G_AN		0x00000008 /* IPCNFG EEE Ena 1G AN */
5058c2ecf20Sopenharmony_ci#define IGC_IPCNFG_EEE_100M_AN		0x00000004 /* IPCNFG EEE Ena 100M AN */
5068c2ecf20Sopenharmony_ci#define IGC_EEER_EEE_NEG		0x20000000 /* EEE capability nego */
5078c2ecf20Sopenharmony_ci#define IGC_EEER_TX_LPI_EN		0x00010000 /* EEER Tx LPI Enable */
5088c2ecf20Sopenharmony_ci#define IGC_EEER_RX_LPI_EN		0x00020000 /* EEER Rx LPI Enable */
5098c2ecf20Sopenharmony_ci#define IGC_EEER_LPI_FC			0x00040000 /* EEER Ena on Flow Cntrl */
5108c2ecf20Sopenharmony_ci#define IGC_EEE_SU_LPI_CLK_STP		0x00800000 /* EEE LPI Clock Stop */
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ci/* LTR defines */
5138c2ecf20Sopenharmony_ci#define IGC_LTRC_EEEMS_EN		0x00000020 /* Enable EEE LTR max send */
5148c2ecf20Sopenharmony_ci#define IGC_RXPBS_SIZE_I225_MASK	0x0000003F /* Rx packet buffer size */
5158c2ecf20Sopenharmony_ci#define IGC_TW_SYSTEM_1000_MASK		0x000000FF
5168c2ecf20Sopenharmony_ci/* Minimum time for 100BASE-T where no data will be transmit following move out
5178c2ecf20Sopenharmony_ci * of EEE LPI Tx state
5188c2ecf20Sopenharmony_ci */
5198c2ecf20Sopenharmony_ci#define IGC_TW_SYSTEM_100_MASK		0x0000FF00
5208c2ecf20Sopenharmony_ci#define IGC_TW_SYSTEM_100_SHIFT		8
5218c2ecf20Sopenharmony_ci#define IGC_DMACR_DMAC_EN		0x80000000 /* Enable DMA Coalescing */
5228c2ecf20Sopenharmony_ci#define IGC_DMACR_DMACTHR_MASK		0x00FF0000
5238c2ecf20Sopenharmony_ci#define IGC_DMACR_DMACTHR_SHIFT		16
5248c2ecf20Sopenharmony_ci/* Reg val to set scale to 1024 nsec */
5258c2ecf20Sopenharmony_ci#define IGC_LTRMINV_SCALE_1024		2
5268c2ecf20Sopenharmony_ci/* Reg val to set scale to 32768 nsec */
5278c2ecf20Sopenharmony_ci#define IGC_LTRMINV_SCALE_32768		3
5288c2ecf20Sopenharmony_ci/* Reg val to set scale to 1024 nsec */
5298c2ecf20Sopenharmony_ci#define IGC_LTRMAXV_SCALE_1024		2
5308c2ecf20Sopenharmony_ci/* Reg val to set scale to 32768 nsec */
5318c2ecf20Sopenharmony_ci#define IGC_LTRMAXV_SCALE_32768		3
5328c2ecf20Sopenharmony_ci#define IGC_LTRMINV_LTRV_MASK		0x000003FF /* LTR minimum value */
5338c2ecf20Sopenharmony_ci#define IGC_LTRMAXV_LTRV_MASK		0x000003FF /* LTR maximum value */
5348c2ecf20Sopenharmony_ci#define IGC_LTRMINV_LSNP_REQ		0x00008000 /* LTR Snoop Requirement */
5358c2ecf20Sopenharmony_ci#define IGC_LTRMINV_SCALE_SHIFT		10
5368c2ecf20Sopenharmony_ci#define IGC_LTRMAXV_LSNP_REQ		0x00008000 /* LTR Snoop Requirement */
5378c2ecf20Sopenharmony_ci#define IGC_LTRMAXV_SCALE_SHIFT		10
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci#endif /* _IGC_DEFINES_H_ */
540