162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Copyright (c)  2018 Intel Corporation */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef _IGC_REGS_H_
562306a36Sopenharmony_ci#define _IGC_REGS_H_
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci/* General Register Descriptions */
862306a36Sopenharmony_ci#define IGC_CTRL		0x00000  /* Device Control - RW */
962306a36Sopenharmony_ci#define IGC_STATUS		0x00008  /* Device Status - RO */
1062306a36Sopenharmony_ci#define IGC_EECD		0x00010  /* EEPROM/Flash Control - RW */
1162306a36Sopenharmony_ci#define IGC_CTRL_EXT		0x00018  /* Extended Device Control - RW */
1262306a36Sopenharmony_ci#define IGC_MDIC		0x00020  /* MDI Control - RW */
1362306a36Sopenharmony_ci#define IGC_CONNSW		0x00034  /* Copper/Fiber switch control - RW */
1462306a36Sopenharmony_ci#define IGC_VET			0x00038  /* VLAN Ether Type - RW */
1562306a36Sopenharmony_ci#define IGC_I225_PHPM		0x00E14  /* I225 PHY Power Management */
1662306a36Sopenharmony_ci#define IGC_GPHY_VERSION	0x0001E  /* I225 gPHY Firmware Version */
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/* Internal Packet Buffer Size Registers */
1962306a36Sopenharmony_ci#define IGC_RXPBS		0x02404  /* Rx Packet Buffer Size - RW */
2062306a36Sopenharmony_ci#define IGC_TXPBS		0x03404  /* Tx Packet Buffer Size - RW */
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/* NVM  Register Descriptions */
2362306a36Sopenharmony_ci#define IGC_EERD		0x12014  /* EEprom mode read - RW */
2462306a36Sopenharmony_ci#define IGC_EEWR		0x12018  /* EEprom mode write - RW */
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* Flow Control Register Descriptions */
2762306a36Sopenharmony_ci#define IGC_FCAL		0x00028  /* FC Address Low - RW */
2862306a36Sopenharmony_ci#define IGC_FCAH		0x0002C  /* FC Address High - RW */
2962306a36Sopenharmony_ci#define IGC_FCT			0x00030  /* FC Type - RW */
3062306a36Sopenharmony_ci#define IGC_FCTTV		0x00170  /* FC Transmit Timer - RW */
3162306a36Sopenharmony_ci#define IGC_FCRTL		0x02160  /* FC Receive Threshold Low - RW */
3262306a36Sopenharmony_ci#define IGC_FCRTH		0x02168  /* FC Receive Threshold High - RW */
3362306a36Sopenharmony_ci#define IGC_FCRTV		0x02460  /* FC Refresh Timer Value - RW */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/* Semaphore registers */
3662306a36Sopenharmony_ci#define IGC_SW_FW_SYNC		0x05B5C  /* SW-FW Synchronization - RW */
3762306a36Sopenharmony_ci#define IGC_SWSM		0x05B50  /* SW Semaphore */
3862306a36Sopenharmony_ci#define IGC_FWSM		0x05B54  /* FW Semaphore */
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/* Function Active and Power State to MNG */
4162306a36Sopenharmony_ci#define IGC_FACTPS		0x05B30
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/* Interrupt Register Description */
4462306a36Sopenharmony_ci#define IGC_EICR		0x01580  /* Ext. Interrupt Cause read - W0 */
4562306a36Sopenharmony_ci#define IGC_EICS		0x01520  /* Ext. Interrupt Cause Set - W0 */
4662306a36Sopenharmony_ci#define IGC_EIMS		0x01524  /* Ext. Interrupt Mask Set/Read - RW */
4762306a36Sopenharmony_ci#define IGC_EIMC		0x01528  /* Ext. Interrupt Mask Clear - WO */
4862306a36Sopenharmony_ci#define IGC_EIAC		0x0152C  /* Ext. Interrupt Auto Clear - RW */
4962306a36Sopenharmony_ci#define IGC_EIAM		0x01530  /* Ext. Interrupt Auto Mask - RW */
5062306a36Sopenharmony_ci#define IGC_ICR			0x01500  /* Intr Cause Read - RC/W1C */
5162306a36Sopenharmony_ci#define IGC_ICS			0x01504  /* Intr Cause Set - WO */
5262306a36Sopenharmony_ci#define IGC_IMS			0x01508  /* Intr Mask Set/Read - RW */
5362306a36Sopenharmony_ci#define IGC_IMC			0x0150C  /* Intr Mask Clear - WO */
5462306a36Sopenharmony_ci#define IGC_IAM			0x01510  /* Intr Ack Auto Mask- RW */
5562306a36Sopenharmony_ci/* Intr Throttle - RW */
5662306a36Sopenharmony_ci#define IGC_EITR(_n)		(0x01680 + (0x4 * (_n)))
5762306a36Sopenharmony_ci/* Interrupt Vector Allocation - RW */
5862306a36Sopenharmony_ci#define IGC_IVAR0		0x01700
5962306a36Sopenharmony_ci#define IGC_IVAR_MISC		0x01740  /* IVAR for "other" causes - RW */
6062306a36Sopenharmony_ci#define IGC_GPIE		0x01514  /* General Purpose Intr Enable - RW */
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci/* RSS registers */
6362306a36Sopenharmony_ci#define IGC_MRQC		0x05818 /* Multiple Receive Control - RW */
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/* Filtering Registers */
6662306a36Sopenharmony_ci#define IGC_ETQF(_n)		(0x05CB0 + (4 * (_n))) /* EType Queue Fltr */
6762306a36Sopenharmony_ci#define IGC_FHFT(_n)		(0x09000 + (256 * (_n))) /* Flexible Host Filter */
6862306a36Sopenharmony_ci#define IGC_FHFT_EXT(_n)	(0x09A00 + (256 * (_n))) /* Flexible Host Filter Extended */
6962306a36Sopenharmony_ci#define IGC_FHFTSL		0x05804 /* Flex Filter indirect table select */
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/* ETQF register bit definitions */
7262306a36Sopenharmony_ci#define IGC_ETQF_FILTER_ENABLE	BIT(26)
7362306a36Sopenharmony_ci#define IGC_ETQF_QUEUE_ENABLE	BIT(31)
7462306a36Sopenharmony_ci#define IGC_ETQF_QUEUE_SHIFT	16
7562306a36Sopenharmony_ci#define IGC_ETQF_QUEUE_MASK	0x00070000
7662306a36Sopenharmony_ci#define IGC_ETQF_ETYPE_MASK	0x0000FFFF
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci/* FHFT register bit definitions */
7962306a36Sopenharmony_ci#define IGC_FHFT_LENGTH_MASK	GENMASK(7, 0)
8062306a36Sopenharmony_ci#define IGC_FHFT_QUEUE_SHIFT	8
8162306a36Sopenharmony_ci#define IGC_FHFT_QUEUE_MASK	GENMASK(10, 8)
8262306a36Sopenharmony_ci#define IGC_FHFT_PRIO_SHIFT	16
8362306a36Sopenharmony_ci#define IGC_FHFT_PRIO_MASK	GENMASK(18, 16)
8462306a36Sopenharmony_ci#define IGC_FHFT_IMM_INT	BIT(24)
8562306a36Sopenharmony_ci#define IGC_FHFT_DROP		BIT(25)
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci/* FHFTSL register bit definitions */
8862306a36Sopenharmony_ci#define IGC_FHFTSL_FTSL_SHIFT	0
8962306a36Sopenharmony_ci#define IGC_FHFTSL_FTSL_MASK	GENMASK(1, 0)
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci/* Redirection Table - RW Array */
9262306a36Sopenharmony_ci#define IGC_RETA(_i)		(0x05C00 + ((_i) * 4))
9362306a36Sopenharmony_ci/* RSS Random Key - RW Array */
9462306a36Sopenharmony_ci#define IGC_RSSRK(_i)		(0x05C80 + ((_i) * 4))
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci/* Receive Register Descriptions */
9762306a36Sopenharmony_ci#define IGC_RCTL		0x00100  /* Rx Control - RW */
9862306a36Sopenharmony_ci#define IGC_SRRCTL(_n)		(0x0C00C + ((_n) * 0x40))
9962306a36Sopenharmony_ci#define IGC_PSRTYPE(_i)		(0x05480 + ((_i) * 4))
10062306a36Sopenharmony_ci#define IGC_RDBAL(_n)		(0x0C000 + ((_n) * 0x40))
10162306a36Sopenharmony_ci#define IGC_RDBAH(_n)		(0x0C004 + ((_n) * 0x40))
10262306a36Sopenharmony_ci#define IGC_RDLEN(_n)		(0x0C008 + ((_n) * 0x40))
10362306a36Sopenharmony_ci#define IGC_RDH(_n)		(0x0C010 + ((_n) * 0x40))
10462306a36Sopenharmony_ci#define IGC_RDT(_n)		(0x0C018 + ((_n) * 0x40))
10562306a36Sopenharmony_ci#define IGC_RXDCTL(_n)		(0x0C028 + ((_n) * 0x40))
10662306a36Sopenharmony_ci#define IGC_RQDPC(_n)		(0x0C030 + ((_n) * 0x40))
10762306a36Sopenharmony_ci#define IGC_RXCSUM		0x05000  /* Rx Checksum Control - RW */
10862306a36Sopenharmony_ci#define IGC_RLPML		0x05004  /* Rx Long Packet Max Length */
10962306a36Sopenharmony_ci#define IGC_RFCTL		0x05008  /* Receive Filter Control*/
11062306a36Sopenharmony_ci#define IGC_MTA			0x05200  /* Multicast Table Array - RW Array */
11162306a36Sopenharmony_ci#define IGC_RA			0x05400  /* Receive Address - RW Array */
11262306a36Sopenharmony_ci#define IGC_UTA			0x0A000  /* Unicast Table Array - RW */
11362306a36Sopenharmony_ci#define IGC_RAL(_n)		(0x05400 + ((_n) * 0x08))
11462306a36Sopenharmony_ci#define IGC_RAH(_n)		(0x05404 + ((_n) * 0x08))
11562306a36Sopenharmony_ci#define IGC_VLANPQF		0x055B0  /* VLAN Priority Queue Filter - RW */
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci/* Transmit Register Descriptions */
11862306a36Sopenharmony_ci#define IGC_TCTL		0x00400  /* Tx Control - RW */
11962306a36Sopenharmony_ci#define IGC_TIPG		0x00410  /* Tx Inter-packet gap - RW */
12062306a36Sopenharmony_ci#define IGC_TDBAL(_n)		(0x0E000 + ((_n) * 0x40))
12162306a36Sopenharmony_ci#define IGC_TDBAH(_n)		(0x0E004 + ((_n) * 0x40))
12262306a36Sopenharmony_ci#define IGC_TDLEN(_n)		(0x0E008 + ((_n) * 0x40))
12362306a36Sopenharmony_ci#define IGC_TDH(_n)		(0x0E010 + ((_n) * 0x40))
12462306a36Sopenharmony_ci#define IGC_TDT(_n)		(0x0E018 + ((_n) * 0x40))
12562306a36Sopenharmony_ci#define IGC_TXDCTL(_n)		(0x0E028 + ((_n) * 0x40))
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci/* MMD Register Descriptions */
12862306a36Sopenharmony_ci#define IGC_MMDAC		13 /* MMD Access Control */
12962306a36Sopenharmony_ci#define IGC_MMDAAD		14 /* MMD Access Address/Data */
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci/* Statistics Register Descriptions */
13262306a36Sopenharmony_ci#define IGC_CRCERRS	0x04000  /* CRC Error Count - R/clr */
13362306a36Sopenharmony_ci#define IGC_ALGNERRC	0x04004  /* Alignment Error Count - R/clr */
13462306a36Sopenharmony_ci#define IGC_RXERRC	0x0400C  /* Receive Error Count - R/clr */
13562306a36Sopenharmony_ci#define IGC_MPC		0x04010  /* Missed Packet Count - R/clr */
13662306a36Sopenharmony_ci#define IGC_SCC		0x04014  /* Single Collision Count - R/clr */
13762306a36Sopenharmony_ci#define IGC_ECOL	0x04018  /* Excessive Collision Count - R/clr */
13862306a36Sopenharmony_ci#define IGC_MCC		0x0401C  /* Multiple Collision Count - R/clr */
13962306a36Sopenharmony_ci#define IGC_LATECOL	0x04020  /* Late Collision Count - R/clr */
14062306a36Sopenharmony_ci#define IGC_COLC	0x04028  /* Collision Count - R/clr */
14162306a36Sopenharmony_ci#define IGC_RERC	0x0402C  /* Receive Error Count - R/clr */
14262306a36Sopenharmony_ci#define IGC_DC		0x04030  /* Defer Count - R/clr */
14362306a36Sopenharmony_ci#define IGC_TNCRS	0x04034  /* Tx-No CRS - R/clr */
14462306a36Sopenharmony_ci#define IGC_HTDPMC	0x0403C  /* Host Transmit Discarded by MAC - R/clr */
14562306a36Sopenharmony_ci#define IGC_RLEC	0x04040  /* Receive Length Error Count - R/clr */
14662306a36Sopenharmony_ci#define IGC_XONRXC	0x04048  /* XON Rx Count - R/clr */
14762306a36Sopenharmony_ci#define IGC_XONTXC	0x0404C  /* XON Tx Count - R/clr */
14862306a36Sopenharmony_ci#define IGC_XOFFRXC	0x04050  /* XOFF Rx Count - R/clr */
14962306a36Sopenharmony_ci#define IGC_XOFFTXC	0x04054  /* XOFF Tx Count - R/clr */
15062306a36Sopenharmony_ci#define IGC_FCRUC	0x04058  /* Flow Control Rx Unsupported Count- R/clr */
15162306a36Sopenharmony_ci#define IGC_PRC64	0x0405C  /* Packets Rx (64 bytes) - R/clr */
15262306a36Sopenharmony_ci#define IGC_PRC127	0x04060  /* Packets Rx (65-127 bytes) - R/clr */
15362306a36Sopenharmony_ci#define IGC_PRC255	0x04064  /* Packets Rx (128-255 bytes) - R/clr */
15462306a36Sopenharmony_ci#define IGC_PRC511	0x04068  /* Packets Rx (255-511 bytes) - R/clr */
15562306a36Sopenharmony_ci#define IGC_PRC1023	0x0406C  /* Packets Rx (512-1023 bytes) - R/clr */
15662306a36Sopenharmony_ci#define IGC_PRC1522	0x04070  /* Packets Rx (1024-1522 bytes) - R/clr */
15762306a36Sopenharmony_ci#define IGC_GPRC	0x04074  /* Good Packets Rx Count - R/clr */
15862306a36Sopenharmony_ci#define IGC_BPRC	0x04078  /* Broadcast Packets Rx Count - R/clr */
15962306a36Sopenharmony_ci#define IGC_MPRC	0x0407C  /* Multicast Packets Rx Count - R/clr */
16062306a36Sopenharmony_ci#define IGC_GPTC	0x04080  /* Good Packets Tx Count - R/clr */
16162306a36Sopenharmony_ci#define IGC_GORCL	0x04088  /* Good Octets Rx Count Low - R/clr */
16262306a36Sopenharmony_ci#define IGC_GORCH	0x0408C  /* Good Octets Rx Count High - R/clr */
16362306a36Sopenharmony_ci#define IGC_GOTCL	0x04090  /* Good Octets Tx Count Low - R/clr */
16462306a36Sopenharmony_ci#define IGC_GOTCH	0x04094  /* Good Octets Tx Count High - R/clr */
16562306a36Sopenharmony_ci#define IGC_RNBC	0x040A0  /* Rx No Buffers Count - R/clr */
16662306a36Sopenharmony_ci#define IGC_RUC		0x040A4  /* Rx Undersize Count - R/clr */
16762306a36Sopenharmony_ci#define IGC_RFC		0x040A8  /* Rx Fragment Count - R/clr */
16862306a36Sopenharmony_ci#define IGC_ROC		0x040AC  /* Rx Oversize Count - R/clr */
16962306a36Sopenharmony_ci#define IGC_RJC		0x040B0  /* Rx Jabber Count - R/clr */
17062306a36Sopenharmony_ci#define IGC_MGTPRC	0x040B4  /* Management Packets Rx Count - R/clr */
17162306a36Sopenharmony_ci#define IGC_MGTPDC	0x040B8  /* Management Packets Dropped Count - R/clr */
17262306a36Sopenharmony_ci#define IGC_MGTPTC	0x040BC  /* Management Packets Tx Count - R/clr */
17362306a36Sopenharmony_ci#define IGC_TORL	0x040C0  /* Total Octets Rx Low - R/clr */
17462306a36Sopenharmony_ci#define IGC_TORH	0x040C4  /* Total Octets Rx High - R/clr */
17562306a36Sopenharmony_ci#define IGC_TOTL	0x040C8  /* Total Octets Tx Low - R/clr */
17662306a36Sopenharmony_ci#define IGC_TOTH	0x040CC  /* Total Octets Tx High - R/clr */
17762306a36Sopenharmony_ci#define IGC_TPR		0x040D0  /* Total Packets Rx - R/clr */
17862306a36Sopenharmony_ci#define IGC_TPT		0x040D4  /* Total Packets Tx - R/clr */
17962306a36Sopenharmony_ci#define IGC_PTC64	0x040D8  /* Packets Tx (64 bytes) - R/clr */
18062306a36Sopenharmony_ci#define IGC_PTC127	0x040DC  /* Packets Tx (65-127 bytes) - R/clr */
18162306a36Sopenharmony_ci#define IGC_PTC255	0x040E0  /* Packets Tx (128-255 bytes) - R/clr */
18262306a36Sopenharmony_ci#define IGC_PTC511	0x040E4  /* Packets Tx (256-511 bytes) - R/clr */
18362306a36Sopenharmony_ci#define IGC_PTC1023	0x040E8  /* Packets Tx (512-1023 bytes) - R/clr */
18462306a36Sopenharmony_ci#define IGC_PTC1522	0x040EC  /* Packets Tx (1024-1522 Bytes) - R/clr */
18562306a36Sopenharmony_ci#define IGC_MPTC	0x040F0  /* Multicast Packets Tx Count - R/clr */
18662306a36Sopenharmony_ci#define IGC_BPTC	0x040F4  /* Broadcast Packets Tx Count - R/clr */
18762306a36Sopenharmony_ci#define IGC_TSCTC	0x040F8  /* TCP Segmentation Context Tx - R/clr */
18862306a36Sopenharmony_ci#define IGC_IAC		0x04100  /* Interrupt Assertion Count */
18962306a36Sopenharmony_ci#define IGC_RPTHC	0x04104  /* Rx Packets To Host */
19062306a36Sopenharmony_ci#define IGC_TLPIC	0x04148  /* EEE Tx LPI Count */
19162306a36Sopenharmony_ci#define IGC_RLPIC	0x0414C  /* EEE Rx LPI Count */
19262306a36Sopenharmony_ci#define IGC_HGPTC	0x04118  /* Host Good Packets Tx Count */
19362306a36Sopenharmony_ci#define IGC_RXDMTC	0x04120  /* Rx Descriptor Minimum Threshold Count */
19462306a36Sopenharmony_ci#define IGC_HGORCL	0x04128  /* Host Good Octets Received Count Low */
19562306a36Sopenharmony_ci#define IGC_HGORCH	0x0412C  /* Host Good Octets Received Count High */
19662306a36Sopenharmony_ci#define IGC_HGOTCL	0x04130  /* Host Good Octets Transmit Count Low */
19762306a36Sopenharmony_ci#define IGC_HGOTCH	0x04134  /* Host Good Octets Transmit Count High */
19862306a36Sopenharmony_ci#define IGC_LENERRS	0x04138  /* Length Errors Count */
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ci/* Time sync registers */
20162306a36Sopenharmony_ci#define IGC_TSICR	0x0B66C  /* Time Sync Interrupt Cause */
20262306a36Sopenharmony_ci#define IGC_TSIM	0x0B674  /* Time Sync Interrupt Mask Register */
20362306a36Sopenharmony_ci#define IGC_TSAUXC	0x0B640  /* Timesync Auxiliary Control register */
20462306a36Sopenharmony_ci#define IGC_TSYNCRXCTL	0x0B620  /* Rx Time Sync Control register - RW */
20562306a36Sopenharmony_ci#define IGC_TSYNCTXCTL	0x0B614  /* Tx Time Sync Control register - RW */
20662306a36Sopenharmony_ci#define IGC_TSYNCRXCFG	0x05F50  /* Time Sync Rx Configuration - RW */
20762306a36Sopenharmony_ci#define IGC_TSSDP	0x0003C  /* Time Sync SDP Configuration Register - RW */
20862306a36Sopenharmony_ci#define IGC_TRGTTIML0	0x0B644 /* Target Time Register 0 Low  - RW */
20962306a36Sopenharmony_ci#define IGC_TRGTTIMH0	0x0B648 /* Target Time Register 0 High - RW */
21062306a36Sopenharmony_ci#define IGC_TRGTTIML1	0x0B64C /* Target Time Register 1 Low  - RW */
21162306a36Sopenharmony_ci#define IGC_TRGTTIMH1	0x0B650 /* Target Time Register 1 High - RW */
21262306a36Sopenharmony_ci#define IGC_FREQOUT0	0x0B654 /* Frequency Out 0 Control Register - RW */
21362306a36Sopenharmony_ci#define IGC_FREQOUT1	0x0B658 /* Frequency Out 1 Control Register - RW */
21462306a36Sopenharmony_ci#define IGC_AUXSTMPL0	0x0B65C /* Auxiliary Time Stamp 0 Register Low  - RO */
21562306a36Sopenharmony_ci#define IGC_AUXSTMPH0	0x0B660 /* Auxiliary Time Stamp 0 Register High - RO */
21662306a36Sopenharmony_ci#define IGC_AUXSTMPL1	0x0B664 /* Auxiliary Time Stamp 1 Register Low  - RO */
21762306a36Sopenharmony_ci#define IGC_AUXSTMPH1	0x0B668 /* Auxiliary Time Stamp 1 Register High - RO */
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci#define IGC_IMIR(_i)	(0x05A80 + ((_i) * 4))  /* Immediate Interrupt */
22062306a36Sopenharmony_ci#define IGC_IMIREXT(_i)	(0x05AA0 + ((_i) * 4))  /* Immediate INTR Ext*/
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci#define IGC_FTQF(_n)	(0x059E0 + (4 * (_n)))  /* 5-tuple Queue Fltr */
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci/* Transmit Scheduling Registers */
22562306a36Sopenharmony_ci#define IGC_TQAVCTRL		0x3570
22662306a36Sopenharmony_ci#define IGC_TXQCTL(_n)		(0x3344 + 0x4 * (_n))
22762306a36Sopenharmony_ci#define IGC_GTXOFFSET		0x3310
22862306a36Sopenharmony_ci#define IGC_BASET_L		0x3314
22962306a36Sopenharmony_ci#define IGC_BASET_H		0x3318
23062306a36Sopenharmony_ci#define IGC_QBVCYCLET		0x331C
23162306a36Sopenharmony_ci#define IGC_QBVCYCLET_S		0x3320
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ci#define IGC_STQT(_n)		(0x3324 + 0x4 * (_n))
23462306a36Sopenharmony_ci#define IGC_ENDQT(_n)		(0x3334 + 0x4 * (_n))
23562306a36Sopenharmony_ci#define IGC_DTXMXPKTSZ		0x355C
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci#define IGC_TQAVCC(_n)		(0x3004 + ((_n) * 0x40))
23862306a36Sopenharmony_ci#define IGC_TQAVHC(_n)		(0x300C + ((_n) * 0x40))
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci/* System Time Registers */
24162306a36Sopenharmony_ci#define IGC_SYSTIML	0x0B600  /* System time register Low - RO */
24262306a36Sopenharmony_ci#define IGC_SYSTIMH	0x0B604  /* System time register High - RO */
24362306a36Sopenharmony_ci#define IGC_SYSTIMR	0x0B6F8  /* System time register Residue */
24462306a36Sopenharmony_ci#define IGC_TIMINCA	0x0B608  /* Increment attributes register - RW */
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci/* TX Timestamp Low */
24762306a36Sopenharmony_ci#define IGC_TXSTMPL_0		0x0B618
24862306a36Sopenharmony_ci#define IGC_TXSTMPL_1		0x0B698
24962306a36Sopenharmony_ci#define IGC_TXSTMPL_2		0x0B6B8
25062306a36Sopenharmony_ci#define IGC_TXSTMPL_3		0x0B6D8
25162306a36Sopenharmony_ci
25262306a36Sopenharmony_ci/* TX Timestamp High */
25362306a36Sopenharmony_ci#define IGC_TXSTMPH_0		0x0B61C
25462306a36Sopenharmony_ci#define IGC_TXSTMPH_1		0x0B69C
25562306a36Sopenharmony_ci#define IGC_TXSTMPH_2		0x0B6BC
25662306a36Sopenharmony_ci#define IGC_TXSTMPH_3		0x0B6DC
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci#define IGC_TXSTMPL	0x0B618  /* Tx timestamp value Low - RO */
25962306a36Sopenharmony_ci#define IGC_TXSTMPH	0x0B61C  /* Tx timestamp value High - RO */
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ci#define IGC_TIMADJ	0x0B60C  /* Time Adjustment Offset Register */
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_ci/* PCIe Registers */
26462306a36Sopenharmony_ci#define IGC_PTM_CTRL		0x12540  /* PTM Control */
26562306a36Sopenharmony_ci#define IGC_PTM_STAT		0x12544  /* PTM Status */
26662306a36Sopenharmony_ci#define IGC_PTM_CYCLE_CTRL	0x1254C  /* PTM Cycle Control */
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci/* PTM Time registers */
26962306a36Sopenharmony_ci#define IGC_PTM_T1_TIM0_L	0x12558  /* T1 on Timer 0 Low */
27062306a36Sopenharmony_ci#define IGC_PTM_T1_TIM0_H	0x1255C  /* T1 on Timer 0 High */
27162306a36Sopenharmony_ci
27262306a36Sopenharmony_ci#define IGC_PTM_CURR_T2_L	0x1258C  /* Current T2 Low */
27362306a36Sopenharmony_ci#define IGC_PTM_CURR_T2_H	0x12590  /* Current T2 High */
27462306a36Sopenharmony_ci#define IGC_PTM_PREV_T2_L	0x12584  /* Previous T2 Low */
27562306a36Sopenharmony_ci#define IGC_PTM_PREV_T2_H	0x12588  /* Previous T2 High */
27662306a36Sopenharmony_ci#define IGC_PTM_PREV_T4M1	0x12578  /* T4 Minus T1 on previous PTM Cycle */
27762306a36Sopenharmony_ci#define IGC_PTM_CURR_T4M1	0x1257C  /* T4 Minus T1 on this PTM Cycle */
27862306a36Sopenharmony_ci#define IGC_PTM_PREV_T3M2	0x12580  /* T3 Minus T2 on previous PTM Cycle */
27962306a36Sopenharmony_ci#define IGC_PTM_TDELAY		0x12594  /* PTM PCIe Link Delay */
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci#define IGC_PCIE_DIG_DELAY	0x12550  /* PCIe Digital Delay */
28262306a36Sopenharmony_ci#define IGC_PCIE_PHY_DELAY	0x12554  /* PCIe PHY Delay */
28362306a36Sopenharmony_ci
28462306a36Sopenharmony_ci/* Management registers */
28562306a36Sopenharmony_ci#define IGC_MANC	0x05820  /* Management Control - RW */
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_ci/* Shadow Ram Write Register - RW */
28862306a36Sopenharmony_ci#define IGC_SRWR	0x12018
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci/* Wake Up registers */
29162306a36Sopenharmony_ci#define IGC_WUC		0x05800  /* Wakeup Control - RW */
29262306a36Sopenharmony_ci#define IGC_WUFC	0x05808  /* Wakeup Filter Control - RW */
29362306a36Sopenharmony_ci#define IGC_WUS		0x05810  /* Wakeup Status - R/W1C */
29462306a36Sopenharmony_ci#define IGC_WUPL	0x05900  /* Wakeup Packet Length - RW */
29562306a36Sopenharmony_ci#define IGC_WUFC_EXT	0x0580C  /* Wakeup Filter Control Register Extended - RW */
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci/* Wake Up packet memory */
29862306a36Sopenharmony_ci#define IGC_WUPM_REG(_i)	(0x05A00 + ((_i) * 4))
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci/* Energy Efficient Ethernet "EEE" registers */
30162306a36Sopenharmony_ci#define IGC_EEER	0x0E30 /* Energy Efficient Ethernet "EEE"*/
30262306a36Sopenharmony_ci#define IGC_IPCNFG	0x0E38 /* Internal PHY Configuration */
30362306a36Sopenharmony_ci#define IGC_EEE_SU	0x0E34 /* EEE Setup */
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci/* LTR registers */
30662306a36Sopenharmony_ci#define IGC_LTRC	0x01A0 /* Latency Tolerance Reporting Control */
30762306a36Sopenharmony_ci#define IGC_LTRMINV	0x5BB0 /* LTR Minimum Value */
30862306a36Sopenharmony_ci#define IGC_LTRMAXV	0x5BB4 /* LTR Maximum Value */
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci/* forward declaration */
31162306a36Sopenharmony_cistruct igc_hw;
31262306a36Sopenharmony_ciu32 igc_rd32(struct igc_hw *hw, u32 reg);
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci/* write operations, indexed using DWORDS */
31562306a36Sopenharmony_ci#define wr32(reg, val) \
31662306a36Sopenharmony_cido { \
31762306a36Sopenharmony_ci	u8 __iomem *hw_addr = READ_ONCE((hw)->hw_addr); \
31862306a36Sopenharmony_ci	if (!IGC_REMOVED(hw_addr)) \
31962306a36Sopenharmony_ci		writel((val), &hw_addr[(reg)]); \
32062306a36Sopenharmony_ci} while (0)
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci#define rd32(reg) (igc_rd32(hw, reg))
32362306a36Sopenharmony_ci
32462306a36Sopenharmony_ci#define wrfl() ((void)rd32(IGC_STATUS))
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci#define array_wr32(reg, offset, value) \
32762306a36Sopenharmony_ci	wr32((reg) + ((offset) << 2), (value))
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci#define array_rd32(reg, offset) (igc_rd32(hw, (reg) + ((offset) << 2)))
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci#define IGC_REMOVED(h) unlikely(!(h))
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci#endif
334