xref: /dpdk/drivers/raw/ifpga/base/ifpga_defines.h (revision 7c4fe2ad3b1214a6704a373dbaec087a4386c4bb)
1473c88f9SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
2473c88f9SBruce Richardson  * Copyright(c) 2010-2018 Intel Corporation
3473c88f9SBruce Richardson  */
4473c88f9SBruce Richardson 
5473c88f9SBruce Richardson #ifndef _IFPGA_DEFINES_H_
6473c88f9SBruce Richardson #define _IFPGA_DEFINES_H_
7473c88f9SBruce Richardson 
8473c88f9SBruce Richardson #include "ifpga_compat.h"
9473c88f9SBruce Richardson 
10473c88f9SBruce Richardson #define MAX_FPGA_PORT_NUM  4
11473c88f9SBruce Richardson 
12473c88f9SBruce Richardson #define FME_FEATURE_HEADER          "fme_hdr"
13473c88f9SBruce Richardson #define FME_FEATURE_THERMAL_MGMT    "fme_thermal"
14473c88f9SBruce Richardson #define FME_FEATURE_POWER_MGMT      "fme_power"
15473c88f9SBruce Richardson #define FME_FEATURE_GLOBAL_IPERF    "fme_iperf"
16473c88f9SBruce Richardson #define FME_FEATURE_GLOBAL_ERR      "fme_error"
17473c88f9SBruce Richardson #define FME_FEATURE_PR_MGMT         "fme_pr"
18473c88f9SBruce Richardson #define FME_FEATURE_EMIF_MGMT       "fme_emif"
19473c88f9SBruce Richardson #define FME_FEATURE_HSSI_ETH        "fme_hssi"
20473c88f9SBruce Richardson #define FME_FEATURE_GLOBAL_DPERF    "fme_dperf"
21473c88f9SBruce Richardson #define FME_FEATURE_QSPI_FLASH	    "fme_qspi_flash"
22473c88f9SBruce Richardson #define FME_FEATURE_MAX10_SPI       "fme_max10_spi"
23473c88f9SBruce Richardson #define FME_FEATURE_NIOS_SPI        "fme_nios_spi"
24473c88f9SBruce Richardson #define FME_FEATURE_I2C_MASTER      "fme_i2c_master"
25473c88f9SBruce Richardson #define FME_FEATURE_ETH_GROUP       "fme_eth_group"
26ca6eb0f7SWei Huang #define FME_FEATURE_PMCI            "fme_pmci"
27473c88f9SBruce Richardson 
28473c88f9SBruce Richardson #define PORT_FEATURE_HEADER         "port_hdr"
29473c88f9SBruce Richardson #define PORT_FEATURE_UAFU           "port_uafu"
30473c88f9SBruce Richardson #define PORT_FEATURE_ERR            "port_err"
31473c88f9SBruce Richardson #define PORT_FEATURE_UMSG           "port_umsg"
32473c88f9SBruce Richardson #define PORT_FEATURE_PR             "port_pr"
33473c88f9SBruce Richardson #define PORT_FEATURE_UINT           "port_uint"
34473c88f9SBruce Richardson #define PORT_FEATURE_STP            "port_stp"
35473c88f9SBruce Richardson 
36473c88f9SBruce Richardson /*
37473c88f9SBruce Richardson  * do not check the revision id as id may be dynamic under
38473c88f9SBruce Richardson  * some cases, e.g, UAFU.
39473c88f9SBruce Richardson  */
40473c88f9SBruce Richardson #define SKIP_REVISION_CHECK		0xff
41473c88f9SBruce Richardson 
42473c88f9SBruce Richardson #define FME_HEADER_REVISION		1
43473c88f9SBruce Richardson #define FME_THERMAL_MGMT_REVISION	0
44473c88f9SBruce Richardson #define FME_POWER_MGMT_REVISION		1
45473c88f9SBruce Richardson #define FME_GLOBAL_IPERF_REVISION	1
46473c88f9SBruce Richardson #define FME_GLOBAL_ERR_REVISION		1
47473c88f9SBruce Richardson #define FME_PR_MGMT_REVISION		2
48473c88f9SBruce Richardson #define FME_HSSI_ETH_REVISION		0
49473c88f9SBruce Richardson #define FME_GLOBAL_DPERF_REVISION	0
50473c88f9SBruce Richardson #define FME_QSPI_REVISION		0
51473c88f9SBruce Richardson #define FME_MAX10_SPI                   0
52473c88f9SBruce Richardson #define FME_I2C_MASTER                  0
53473c88f9SBruce Richardson 
54473c88f9SBruce Richardson #define PORT_HEADER_REVISION		0
55473c88f9SBruce Richardson /* UAFU's header info depends on the downloaded GBS */
56473c88f9SBruce Richardson #define PORT_UAFU_REVISION		SKIP_REVISION_CHECK
57473c88f9SBruce Richardson #define PORT_ERR_REVISION		1
58473c88f9SBruce Richardson #define PORT_UMSG_REVISION		0
59473c88f9SBruce Richardson #define PORT_UINT_REVISION		0
60473c88f9SBruce Richardson #define PORT_STP_REVISION		1
61473c88f9SBruce Richardson 
62473c88f9SBruce Richardson #define FEATURE_TYPE_AFU	0x1
63473c88f9SBruce Richardson #define FEATURE_TYPE_BBB        0x2
64473c88f9SBruce Richardson #define FEATURE_TYPE_PRIVATE	0x3
65473c88f9SBruce Richardson #define FEATURE_TYPE_FIU	0x4
66473c88f9SBruce Richardson 
67473c88f9SBruce Richardson #define FEATURE_FIU_ID_FME	0x0
68473c88f9SBruce Richardson #define FEATURE_FIU_ID_PORT	0x1
69473c88f9SBruce Richardson 
70473c88f9SBruce Richardson /* Reserved 0xfe for Header, 0xff for AFU*/
71473c88f9SBruce Richardson #define FEATURE_ID_FIU_HEADER	0xfe
72473c88f9SBruce Richardson #define FEATURE_ID_AFU		0xff
73473c88f9SBruce Richardson 
74473c88f9SBruce Richardson enum fpga_id_type {
75473c88f9SBruce Richardson 	FME_ID,
76473c88f9SBruce Richardson 	PORT_ID,
77673c897fSWei Huang 	AFU_ID,
78473c88f9SBruce Richardson 	FPGA_ID_MAX,
79473c88f9SBruce Richardson };
80473c88f9SBruce Richardson 
81473c88f9SBruce Richardson #define FME_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
82473c88f9SBruce Richardson #define FME_FEATURE_ID_THERMAL_MGMT 0x1
83473c88f9SBruce Richardson #define FME_FEATURE_ID_POWER_MGMT 0x2
84473c88f9SBruce Richardson #define FME_FEATURE_ID_GLOBAL_IPERF 0x3
85473c88f9SBruce Richardson #define FME_FEATURE_ID_GLOBAL_ERR 0x4
86473c88f9SBruce Richardson #define FME_FEATURE_ID_PR_MGMT 0x5
87473c88f9SBruce Richardson #define FME_FEATURE_ID_HSSI_ETH 0x6
88473c88f9SBruce Richardson #define FME_FEATURE_ID_GLOBAL_DPERF 0x7
89473c88f9SBruce Richardson #define FME_FEATURE_ID_QSPI_FLASH 0x8
90473c88f9SBruce Richardson #define FME_FEATURE_ID_EMIF_MGMT  0x9
91473c88f9SBruce Richardson #define FME_FEATURE_ID_MAX10_SPI  0xe
92473c88f9SBruce Richardson #define FME_FEATURE_ID_NIOS_SPI 0xd
93473c88f9SBruce Richardson #define FME_FEATURE_ID_I2C_MASTER  0xf
94473c88f9SBruce Richardson #define FME_FEATURE_ID_ETH_GROUP 0x10
95ca6eb0f7SWei Huang #define FME_FEATURE_ID_PMCI      0x12
96473c88f9SBruce Richardson 
97473c88f9SBruce Richardson #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
98473c88f9SBruce Richardson #define PORT_FEATURE_ID_ERROR 0x10
99e55d8d4cSWei Huang #define PORT_FEATURE_ID_UMSG 0x11
100e55d8d4cSWei Huang #define PORT_FEATURE_ID_UINT 0x12
101e55d8d4cSWei Huang #define PORT_FEATURE_ID_STP 0x13
102473c88f9SBruce Richardson #define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU
103473c88f9SBruce Richardson 
104473c88f9SBruce Richardson /*
105473c88f9SBruce Richardson  * All headers and structures must be byte-packed to match the spec.
106473c88f9SBruce Richardson  */
107473c88f9SBruce Richardson #pragma pack(push, 1)
108473c88f9SBruce Richardson 
109473c88f9SBruce Richardson struct feature_header {
110473c88f9SBruce Richardson 	union {
111473c88f9SBruce Richardson 		u64 csr;
112473c88f9SBruce Richardson 		struct {
113473c88f9SBruce Richardson 			u16 id:12;
114473c88f9SBruce Richardson 			u8  revision:4;
115473c88f9SBruce Richardson 			u32 next_header_offset:24;
116473c88f9SBruce Richardson 			u8  end_of_list:1;
117473c88f9SBruce Richardson 			u32 reserved:19;
118473c88f9SBruce Richardson 			u8  type:4;
119473c88f9SBruce Richardson 		};
120473c88f9SBruce Richardson 	};
121473c88f9SBruce Richardson };
122473c88f9SBruce Richardson 
123473c88f9SBruce Richardson struct feature_bbb_header {
124473c88f9SBruce Richardson 	struct uuid guid;
125473c88f9SBruce Richardson };
126473c88f9SBruce Richardson 
127473c88f9SBruce Richardson struct feature_afu_header {
128473c88f9SBruce Richardson 	struct uuid guid;
129473c88f9SBruce Richardson 	union {
130473c88f9SBruce Richardson 		u64 csr;
131473c88f9SBruce Richardson 		struct {
132473c88f9SBruce Richardson 			u64 next_afu:24;
133473c88f9SBruce Richardson 			u64 reserved:40;
134473c88f9SBruce Richardson 		};
135473c88f9SBruce Richardson 	};
136473c88f9SBruce Richardson };
137473c88f9SBruce Richardson 
138473c88f9SBruce Richardson struct feature_fiu_header {
139473c88f9SBruce Richardson 	struct uuid guid;
140473c88f9SBruce Richardson 	union {
141473c88f9SBruce Richardson 		u64 csr;
142473c88f9SBruce Richardson 		struct {
143473c88f9SBruce Richardson 			u64 next_afu:24;
144473c88f9SBruce Richardson 			u64 reserved:40;
145473c88f9SBruce Richardson 		};
146473c88f9SBruce Richardson 	};
147473c88f9SBruce Richardson };
148473c88f9SBruce Richardson 
149473c88f9SBruce Richardson struct feature_fme_capability {
150473c88f9SBruce Richardson 	union {
151473c88f9SBruce Richardson 		u64 csr;
152473c88f9SBruce Richardson 		struct {
153473c88f9SBruce Richardson 			u8  fabric_verid;	/* Fabric version ID */
154473c88f9SBruce Richardson 			u8  socket_id:1;	/* Socket id */
155473c88f9SBruce Richardson 			u8  rsvd1:3;		/* Reserved */
156473c88f9SBruce Richardson 			/* pci0 link available yes /no */
157473c88f9SBruce Richardson 			u8  pci0_link_avile:1;
158473c88f9SBruce Richardson 			/* pci1 link available yes /no */
159473c88f9SBruce Richardson 			u8  pci1_link_avile:1;
160473c88f9SBruce Richardson 			/* Coherent (QPI/UPI) link available yes /no */
161473c88f9SBruce Richardson 			u8  qpi_link_avile:1;
162473c88f9SBruce Richardson 			u8  rsvd2:1;		/* Reserved */
163473c88f9SBruce Richardson 			/* IOMMU or VT-d supported  yes/no */
164473c88f9SBruce Richardson 			u8  iommu_support:1;
165473c88f9SBruce Richardson 			u8  num_ports:3;	/* Number of ports */
166473c88f9SBruce Richardson 			u8  sf_fab_ctl:1;	/* Internal validation bit */
167473c88f9SBruce Richardson 			u8  rsvd3:3;		/* Reserved */
168473c88f9SBruce Richardson 			/*
169473c88f9SBruce Richardson 			 * Address width supported in bits
170473c88f9SBruce Richardson 			 * BXT -0x26 , SKX -0x30
171473c88f9SBruce Richardson 			 */
172473c88f9SBruce Richardson 			u8  address_width_bits:6;
173473c88f9SBruce Richardson 			u8  rsvd4:2;		/* Reserved */
174473c88f9SBruce Richardson 			/* Size of cache supported in kb */
175473c88f9SBruce Richardson 			u16 cache_size:12;
176473c88f9SBruce Richardson 			u8  cache_assoc:4;	/* Cache Associativity */
177473c88f9SBruce Richardson 			u16 rsvd5:15;		/* Reserved */
178473c88f9SBruce Richardson 			u8  lock_bit:1;		/* Lock bit */
179473c88f9SBruce Richardson 		};
180473c88f9SBruce Richardson 	};
181473c88f9SBruce Richardson };
182473c88f9SBruce Richardson 
183473c88f9SBruce Richardson #define FME_AFU_ACCESS_PF		0
184473c88f9SBruce Richardson #define FME_AFU_ACCESS_VF		1
185473c88f9SBruce Richardson 
186473c88f9SBruce Richardson struct feature_fme_port {
187473c88f9SBruce Richardson 	union {
188473c88f9SBruce Richardson 		u64 csr;
189473c88f9SBruce Richardson 		struct {
190473c88f9SBruce Richardson 			u32 port_offset:24;
191473c88f9SBruce Richardson 			u8  reserved1;
192473c88f9SBruce Richardson 			u8  port_bar:3;
193473c88f9SBruce Richardson 			u32 reserved2:20;
194473c88f9SBruce Richardson 			u8  afu_access_control:1;
195473c88f9SBruce Richardson 			u8  reserved3:4;
196473c88f9SBruce Richardson 			u8  port_implemented:1;
197473c88f9SBruce Richardson 			u8  reserved4:3;
198473c88f9SBruce Richardson 		};
199473c88f9SBruce Richardson 	};
200473c88f9SBruce Richardson };
201473c88f9SBruce Richardson 
202473c88f9SBruce Richardson struct feature_fme_fab_status {
203473c88f9SBruce Richardson 	union {
204473c88f9SBruce Richardson 		u64 csr;
205473c88f9SBruce Richardson 		struct {
206473c88f9SBruce Richardson 			u8  upilink_status:4;   /* UPI Link Status */
207473c88f9SBruce Richardson 			u8  rsvd1:4;		/* Reserved */
208473c88f9SBruce Richardson 			u8  pci0link_status:1;  /* pci0 link status */
209473c88f9SBruce Richardson 			u8  rsvd2:3;            /* Reserved */
210473c88f9SBruce Richardson 			u8  pci1link_status:1;  /* pci1 link status */
211473c88f9SBruce Richardson 			u64 rsvd3:51;           /* Reserved */
212473c88f9SBruce Richardson 		};
213473c88f9SBruce Richardson 	};
214473c88f9SBruce Richardson };
215473c88f9SBruce Richardson 
216473c88f9SBruce Richardson struct feature_fme_genprotrange2_base {
217473c88f9SBruce Richardson 	union {
218473c88f9SBruce Richardson 		u64 csr;
219473c88f9SBruce Richardson 		struct {
220473c88f9SBruce Richardson 			u16 rsvd1;           /* Reserved */
221473c88f9SBruce Richardson 			/* Base Address of memory range */
222473c88f9SBruce Richardson 			u8  protected_base_addrss:4;
223473c88f9SBruce Richardson 			u64 rsvd2:44;           /* Reserved */
224473c88f9SBruce Richardson 		};
225473c88f9SBruce Richardson 	};
226473c88f9SBruce Richardson };
227473c88f9SBruce Richardson 
228473c88f9SBruce Richardson struct feature_fme_genprotrange2_limit {
229473c88f9SBruce Richardson 	union {
230473c88f9SBruce Richardson 		u64 csr;
231473c88f9SBruce Richardson 		struct {
232473c88f9SBruce Richardson 			u16 rsvd1;           /* Reserved */
233473c88f9SBruce Richardson 			/* Limit Address of memory range */
234473c88f9SBruce Richardson 			u8  protected_limit_addrss:4;
235473c88f9SBruce Richardson 			u16 rsvd2:11;           /* Reserved */
236473c88f9SBruce Richardson 			u8  enable:1;        /* Enable GENPROTRANGE check */
237473c88f9SBruce Richardson 			u32 rsvd3;           /* Reserved */
238473c88f9SBruce Richardson 		};
239473c88f9SBruce Richardson 	};
240473c88f9SBruce Richardson };
241473c88f9SBruce Richardson 
242473c88f9SBruce Richardson struct feature_fme_dxe_lock {
243473c88f9SBruce Richardson 	union {
244473c88f9SBruce Richardson 		u64 csr;
245473c88f9SBruce Richardson 		struct {
246473c88f9SBruce Richardson 			/*
247473c88f9SBruce Richardson 			 * Determines write access to the DXE region CSRs
248473c88f9SBruce Richardson 			 * 1 - CSR region is locked;
249473c88f9SBruce Richardson 			 * 0 - it is open for write access.
250473c88f9SBruce Richardson 			 */
251473c88f9SBruce Richardson 			u8  dxe_early_lock:1;
252473c88f9SBruce Richardson 			/*
253473c88f9SBruce Richardson 			 * Determines write access to the HSSI CSR
254473c88f9SBruce Richardson 			 * 1 - CSR region is locked;
255473c88f9SBruce Richardson 			 * 0 - it is open for write access.
256473c88f9SBruce Richardson 			 */
257473c88f9SBruce Richardson 			u8  dxe_late_lock:1;
258473c88f9SBruce Richardson 			u64 rsvd:62;
259473c88f9SBruce Richardson 		};
260473c88f9SBruce Richardson 	};
261473c88f9SBruce Richardson };
262473c88f9SBruce Richardson 
263473c88f9SBruce Richardson #define HSSI_ID_NO_HASSI	0
264473c88f9SBruce Richardson #define HSSI_ID_PCIE_RP		1
265473c88f9SBruce Richardson #define HSSI_ID_ETHERNET	2
266473c88f9SBruce Richardson 
267473c88f9SBruce Richardson struct feature_fme_bitstream_id {
268473c88f9SBruce Richardson 	union {
269473c88f9SBruce Richardson 		u64 csr;
270473c88f9SBruce Richardson 		struct {
271*7c4fe2adSWei Huang 			u8 build_patch:8;
272*7c4fe2adSWei Huang 			u8 build_minor:8;
273*7c4fe2adSWei Huang 			u8 build_major:8;
274*7c4fe2adSWei Huang 			u8 fvl_bypass:1;
275*7c4fe2adSWei Huang 			u8 mac_lightweight:1;
276*7c4fe2adSWei Huang 			u8 disagregate:1;
277*7c4fe2adSWei Huang 			u8 lightweiht:1;
278*7c4fe2adSWei Huang 			u8 seu:1;
279*7c4fe2adSWei Huang 			u8 ptp:1;
280*7c4fe2adSWei Huang 			u8 reserve:2;
281*7c4fe2adSWei Huang 			u8 interface:4;
282*7c4fe2adSWei Huang 			u32 afu_revision:12;
283*7c4fe2adSWei Huang 			u8 patch:4;
284*7c4fe2adSWei Huang 			u8 minor:4;
285*7c4fe2adSWei Huang 			u8 major:4;
286*7c4fe2adSWei Huang 			u8 reserved:4;
287*7c4fe2adSWei Huang 		} v1;
288*7c4fe2adSWei Huang 		struct {
289473c88f9SBruce Richardson 			u32 gitrepo_hash:32;	/* GIT repository hash */
290473c88f9SBruce Richardson 			/*
291473c88f9SBruce Richardson 			 * HSSI configuration identifier:
292473c88f9SBruce Richardson 			 * 0 - No HSSI
293473c88f9SBruce Richardson 			 * 1 - PCIe-RP
294473c88f9SBruce Richardson 			 * 2 - Ethernet
295473c88f9SBruce Richardson 			 */
296473c88f9SBruce Richardson 			u8  hssi_id:4;
297*7c4fe2adSWei Huang 			u8  rsvd1:4;
298*7c4fe2adSWei Huang 			u8  fim_type:8;
299473c88f9SBruce Richardson 			/* Bitstream version patch number */
300473c88f9SBruce Richardson 			u8  bs_verpatch:4;
301473c88f9SBruce Richardson 			/* Bitstream version minor number */
302473c88f9SBruce Richardson 			u8  bs_verminor:4;
303473c88f9SBruce Richardson 			/* Bitstream version major number */
304473c88f9SBruce Richardson 			u8  bs_vermajor:4;
305473c88f9SBruce Richardson 			/* Bitstream version debug number */
306473c88f9SBruce Richardson 			u8  bs_verdebug:4;
307*7c4fe2adSWei Huang 		} v2;
308473c88f9SBruce Richardson 	};
309473c88f9SBruce Richardson };
310473c88f9SBruce Richardson 
311473c88f9SBruce Richardson struct feature_fme_bitstream_md {
312473c88f9SBruce Richardson 	union {
313473c88f9SBruce Richardson 		u64 csr;
314473c88f9SBruce Richardson 		struct {
315473c88f9SBruce Richardson 			/* Seed number userd for synthesis flow */
316473c88f9SBruce Richardson 			u8  synth_seed:4;
317473c88f9SBruce Richardson 			/* Synthesis date(day number - 2 digits) */
318473c88f9SBruce Richardson 			u8  synth_day:8;
319473c88f9SBruce Richardson 			/* Synthesis date(month number - 2 digits) */
320473c88f9SBruce Richardson 			u8  synth_month:8;
321473c88f9SBruce Richardson 			/* Synthesis date(year number - 2 digits) */
322473c88f9SBruce Richardson 			u8  synth_year:8;
323473c88f9SBruce Richardson 			u64 rsvd:36;		/* Reserved */
324473c88f9SBruce Richardson 		};
325473c88f9SBruce Richardson 	};
326473c88f9SBruce Richardson };
327473c88f9SBruce Richardson 
328473c88f9SBruce Richardson struct feature_fme_iommu_ctrl {
329473c88f9SBruce Richardson 	union {
330473c88f9SBruce Richardson 		u64 csr;
331473c88f9SBruce Richardson 		struct {
332473c88f9SBruce Richardson 			/* Disables IOMMU prefetcher for C0 channel */
333473c88f9SBruce Richardson 			u8 prefetch_disableC0:1;
334473c88f9SBruce Richardson 			/* Disables IOMMU prefetcher for C1 channel */
335473c88f9SBruce Richardson 			u8 prefetch_disableC1:1;
336473c88f9SBruce Richardson 			/* Disables IOMMU partial cache line writes */
337473c88f9SBruce Richardson 			u8 prefetch_wrdisable:1;
338473c88f9SBruce Richardson 			u8 rsvd1:1;		/* Reserved */
339473c88f9SBruce Richardson 			/*
340473c88f9SBruce Richardson 			 * Select counter and read value from register
341473c88f9SBruce Richardson 			 * iommu_stat.dbg_counters
342473c88f9SBruce Richardson 			 * 0 - Number of 4K page translation response
343473c88f9SBruce Richardson 			 * 1 - Number of 2M page translation response
344473c88f9SBruce Richardson 			 * 2 - Number of 1G page translation response
345473c88f9SBruce Richardson 			 */
346473c88f9SBruce Richardson 			u8 counter_sel:2;
347473c88f9SBruce Richardson 			u32 rsvd2:26;		/* Reserved */
348473c88f9SBruce Richardson 			/* Connected to IOMMU SIP Capabilities */
349473c88f9SBruce Richardson 			u32 capecap_defeature;
350473c88f9SBruce Richardson 		};
351473c88f9SBruce Richardson 	};
352473c88f9SBruce Richardson };
353473c88f9SBruce Richardson 
354473c88f9SBruce Richardson struct feature_fme_iommu_stat {
355473c88f9SBruce Richardson 	union {
356473c88f9SBruce Richardson 		u64 csr;
357473c88f9SBruce Richardson 		struct {
358473c88f9SBruce Richardson 			/* Translation Enable bit from IOMMU SIP */
359473c88f9SBruce Richardson 			u8 translation_enable:1;
360473c88f9SBruce Richardson 			/* Drain request in progress */
361473c88f9SBruce Richardson 			u8 drain_req_inprog:1;
362473c88f9SBruce Richardson 			/* Invalidation current state */
363473c88f9SBruce Richardson 			u8 inv_state:3;
364473c88f9SBruce Richardson 			/* C0 Response Buffer current state */
365473c88f9SBruce Richardson 			u8 respbuffer_stateC0:3;
366473c88f9SBruce Richardson 			/* C1 Response Buffer current state */
367473c88f9SBruce Richardson 			u8 respbuffer_stateC1:3;
368473c88f9SBruce Richardson 			/* Last request ID to IOMMU SIP */
369473c88f9SBruce Richardson 			u8 last_reqID:4;
370473c88f9SBruce Richardson 			/* Last IOMMU SIP response ID value */
371473c88f9SBruce Richardson 			u8 last_respID:4;
372473c88f9SBruce Richardson 			/* Last IOMMU SIP response status value */
373473c88f9SBruce Richardson 			u8 last_respstatus:3;
374473c88f9SBruce Richardson 			/* C0 Transaction Buffer is not empty */
375473c88f9SBruce Richardson 			u8 transbuf_notEmptyC0:1;
376473c88f9SBruce Richardson 			/* C1 Transaction Buffer is not empty */
377473c88f9SBruce Richardson 			u8 transbuf_notEmptyC1:1;
378473c88f9SBruce Richardson 			/* C0 Request FIFO is not empty */
379473c88f9SBruce Richardson 			u8 reqFIFO_notemptyC0:1;
380473c88f9SBruce Richardson 			/* C1 Request FIFO is not empty */
381473c88f9SBruce Richardson 			u8 reqFIFO_notemptyC1:1;
382473c88f9SBruce Richardson 			/* C0 Response FIFO is not empty */
383473c88f9SBruce Richardson 			u8 respFIFO_notemptyC0:1;
384473c88f9SBruce Richardson 			/* C1 Response FIFO is not empty */
385473c88f9SBruce Richardson 			u8 respFIFO_notemptyC1:1;
386473c88f9SBruce Richardson 			/* C0 Response FIFO overflow detected */
387473c88f9SBruce Richardson 			u8 respFIFO_overflowC0:1;
388473c88f9SBruce Richardson 			/* C1 Response FIFO overflow detected */
389473c88f9SBruce Richardson 			u8 respFIFO_overflowC1:1;
390473c88f9SBruce Richardson 			/* C0 Transaction Buffer overflow detected */
391473c88f9SBruce Richardson 			u8 tranbuf_overflowC0:1;
392473c88f9SBruce Richardson 			/* C1 Transaction Buffer overflow detected */
393473c88f9SBruce Richardson 			u8 tranbuf_overflowC1:1;
394473c88f9SBruce Richardson 			/* Request FIFO overflow detected */
395473c88f9SBruce Richardson 			u8 reqFIFO_overflow:1;
396473c88f9SBruce Richardson 			/* IOMMU memory read in progress */
397473c88f9SBruce Richardson 			u8 memrd_inprog:1;
398473c88f9SBruce Richardson 			/* IOMMU memory write in progress */
399473c88f9SBruce Richardson 			u8 memwr_inprog:1;
400473c88f9SBruce Richardson 			u8 rsvd1:1;	/* Reserved */
401473c88f9SBruce Richardson 			/* Value of counter selected by iommu_ctl.counter_sel */
402473c88f9SBruce Richardson 			u16 dbg_counters:16;
403473c88f9SBruce Richardson 			u16 rsvd2:12;	/* Reserved */
404473c88f9SBruce Richardson 		};
405473c88f9SBruce Richardson 	};
406473c88f9SBruce Richardson };
407473c88f9SBruce Richardson 
408473c88f9SBruce Richardson struct feature_fme_pcie0_ctrl {
409473c88f9SBruce Richardson 	union {
410473c88f9SBruce Richardson 		u64 csr;
411473c88f9SBruce Richardson 		struct {
412473c88f9SBruce Richardson 			u64 vtd_bar_lock:1;	/* Lock VT-D BAR register */
413473c88f9SBruce Richardson 			u64 rsvd1:3;
414473c88f9SBruce Richardson 			u64 rciep:1;		/* Configure PCIE0 as RCiEP */
415473c88f9SBruce Richardson 			u64 rsvd2:59;
416473c88f9SBruce Richardson 		};
417473c88f9SBruce Richardson 	};
418473c88f9SBruce Richardson };
419473c88f9SBruce Richardson 
420473c88f9SBruce Richardson struct feature_fme_llpr_smrr_base {
421473c88f9SBruce Richardson 	union {
422473c88f9SBruce Richardson 		u64 csr;
423473c88f9SBruce Richardson 		struct {
424473c88f9SBruce Richardson 			u64 rsvd1:12;
425473c88f9SBruce Richardson 			u64 base:20;	/* SMRR2 memory range base address */
426473c88f9SBruce Richardson 			u64 rsvd2:32;
427473c88f9SBruce Richardson 		};
428473c88f9SBruce Richardson 	};
429473c88f9SBruce Richardson };
430473c88f9SBruce Richardson 
431473c88f9SBruce Richardson struct feature_fme_llpr_smrr_mask {
432473c88f9SBruce Richardson 	union {
433473c88f9SBruce Richardson 		u64 csr;
434473c88f9SBruce Richardson 		struct {
435473c88f9SBruce Richardson 			u64 rsvd1:11;
436473c88f9SBruce Richardson 			u64 valid:1;	/* LLPR_SMRR rule is valid or not */
437473c88f9SBruce Richardson 			/*
438473c88f9SBruce Richardson 			 * SMRR memory range mask which determines the range
439473c88f9SBruce Richardson 			 * of region being mapped
440473c88f9SBruce Richardson 			 */
441473c88f9SBruce Richardson 			u64 phys_mask:20;
442473c88f9SBruce Richardson 			u64 rsvd2:32;
443473c88f9SBruce Richardson 		};
444473c88f9SBruce Richardson 	};
445473c88f9SBruce Richardson };
446473c88f9SBruce Richardson 
447473c88f9SBruce Richardson struct feature_fme_llpr_smrr2_base {
448473c88f9SBruce Richardson 	union {
449473c88f9SBruce Richardson 		u64 csr;
450473c88f9SBruce Richardson 		struct {
451473c88f9SBruce Richardson 			u64 rsvd1:12;
452473c88f9SBruce Richardson 			u64 base:20;	/* SMRR2 memory range base address */
453473c88f9SBruce Richardson 			u64 rsvd2:32;
454473c88f9SBruce Richardson 		};
455473c88f9SBruce Richardson 	};
456473c88f9SBruce Richardson };
457473c88f9SBruce Richardson 
458473c88f9SBruce Richardson struct feature_fme_llpr_smrr2_mask {
459473c88f9SBruce Richardson 	union {
460473c88f9SBruce Richardson 		u64 csr;
461473c88f9SBruce Richardson 		struct {
462473c88f9SBruce Richardson 			u64 rsvd1:11;
463473c88f9SBruce Richardson 			u64 valid:1;	/* LLPR_SMRR2 rule is valid or not */
464473c88f9SBruce Richardson 			/*
465473c88f9SBruce Richardson 			 * SMRR2 memory range mask which determines the range
466473c88f9SBruce Richardson 			 * of region being mapped
467473c88f9SBruce Richardson 			 */
468473c88f9SBruce Richardson 			u64 phys_mask:20;
469473c88f9SBruce Richardson 			u64 rsvd2:32;
470473c88f9SBruce Richardson 		};
471473c88f9SBruce Richardson 	};
472473c88f9SBruce Richardson };
473473c88f9SBruce Richardson 
474473c88f9SBruce Richardson struct feature_fme_llpr_meseg_base {
475473c88f9SBruce Richardson 	union {
476473c88f9SBruce Richardson 		u64 csr;
477473c88f9SBruce Richardson 		struct {
478473c88f9SBruce Richardson 			/* A[45:19] of base address memory range */
479473c88f9SBruce Richardson 			u64 me_base:27;
480473c88f9SBruce Richardson 			u64 rsvd:37;
481473c88f9SBruce Richardson 		};
482473c88f9SBruce Richardson 	};
483473c88f9SBruce Richardson };
484473c88f9SBruce Richardson 
485473c88f9SBruce Richardson struct feature_fme_llpr_meseg_limit {
486473c88f9SBruce Richardson 	union {
487473c88f9SBruce Richardson 		u64 csr;
488473c88f9SBruce Richardson 		struct {
489473c88f9SBruce Richardson 			/* A[45:19] of limit address memory range */
490473c88f9SBruce Richardson 			u64 me_limit:27;
491473c88f9SBruce Richardson 			u64 rsvd1:4;
492473c88f9SBruce Richardson 			u64 enable:1;	/* Enable LLPR MESEG rule */
493473c88f9SBruce Richardson 			u64 rsvd2:32;
494473c88f9SBruce Richardson 		};
495473c88f9SBruce Richardson 	};
496473c88f9SBruce Richardson };
497473c88f9SBruce Richardson 
498473c88f9SBruce Richardson struct feature_fme_header {
499473c88f9SBruce Richardson 	struct feature_header header;
500473c88f9SBruce Richardson 	struct feature_afu_header afu_header;
501473c88f9SBruce Richardson 	u64 reserved;
502473c88f9SBruce Richardson 	u64 scratchpad;
503473c88f9SBruce Richardson 	struct feature_fme_capability capability;
504473c88f9SBruce Richardson 	struct feature_fme_port port[MAX_FPGA_PORT_NUM];
505473c88f9SBruce Richardson 	struct feature_fme_fab_status fab_status;
506473c88f9SBruce Richardson 	struct feature_fme_bitstream_id bitstream_id;
507473c88f9SBruce Richardson 	struct feature_fme_bitstream_md bitstream_md;
508473c88f9SBruce Richardson 	struct feature_fme_genprotrange2_base genprotrange2_base;
509473c88f9SBruce Richardson 	struct feature_fme_genprotrange2_limit genprotrange2_limit;
510473c88f9SBruce Richardson 	struct feature_fme_dxe_lock dxe_lock;
511473c88f9SBruce Richardson 	struct feature_fme_iommu_ctrl iommu_ctrl;
512473c88f9SBruce Richardson 	struct feature_fme_iommu_stat iommu_stat;
513473c88f9SBruce Richardson 	struct feature_fme_pcie0_ctrl pcie0_control;
514473c88f9SBruce Richardson 	struct feature_fme_llpr_smrr_base smrr_base;
515473c88f9SBruce Richardson 	struct feature_fme_llpr_smrr_mask smrr_mask;
516473c88f9SBruce Richardson 	struct feature_fme_llpr_smrr2_base smrr2_base;
517473c88f9SBruce Richardson 	struct feature_fme_llpr_smrr2_mask smrr2_mask;
518473c88f9SBruce Richardson 	struct feature_fme_llpr_meseg_base meseg_base;
519473c88f9SBruce Richardson 	struct feature_fme_llpr_meseg_limit meseg_limit;
520473c88f9SBruce Richardson };
521473c88f9SBruce Richardson 
522473c88f9SBruce Richardson struct feature_port_capability {
523473c88f9SBruce Richardson 	union {
524473c88f9SBruce Richardson 		u64 csr;
525473c88f9SBruce Richardson 		struct {
526473c88f9SBruce Richardson 			u8 port_number:2;	/* Port Number 0-3 */
527473c88f9SBruce Richardson 			u8 rsvd1:6;		/* Reserved */
528473c88f9SBruce Richardson 			u16 mmio_size;		/* User MMIO size in KB */
529473c88f9SBruce Richardson 			u8 rsvd2;		/* Reserved */
530473c88f9SBruce Richardson 			u8 sp_intr_num:4;	/* Supported interrupts num */
531473c88f9SBruce Richardson 			u32 rsvd3:28;		/* Reserved */
532473c88f9SBruce Richardson 		};
533473c88f9SBruce Richardson 	};
534473c88f9SBruce Richardson };
535473c88f9SBruce Richardson 
536473c88f9SBruce Richardson struct feature_port_control {
537473c88f9SBruce Richardson 	union {
538473c88f9SBruce Richardson 		u64 csr;
539473c88f9SBruce Richardson 		struct {
540473c88f9SBruce Richardson 			u8 port_sftrst:1;	/* Port Soft Reset */
541473c88f9SBruce Richardson 			u8 rsvd1:1;		/* Reserved */
542473c88f9SBruce Richardson 			u8 latency_tolerance:1;/* '1' >= 40us, '0' < 40us */
543473c88f9SBruce Richardson 			u8 rsvd2:1;		/* Reserved */
544473c88f9SBruce Richardson 			u8 port_sftrst_ack:1;	/* HW ACK for Soft Reset */
545473c88f9SBruce Richardson 			u64 rsvd3:59;		/* Reserved */
546473c88f9SBruce Richardson 		};
547473c88f9SBruce Richardson 	};
548473c88f9SBruce Richardson };
549473c88f9SBruce Richardson 
550473c88f9SBruce Richardson #define PORT_POWER_STATE_NORMAL		0
551473c88f9SBruce Richardson #define PORT_POWER_STATE_AP1		1
552473c88f9SBruce Richardson #define PORT_POWER_STATE_AP2		2
553473c88f9SBruce Richardson #define PORT_POWER_STATE_AP6		6
554473c88f9SBruce Richardson 
555473c88f9SBruce Richardson struct feature_port_status {
556473c88f9SBruce Richardson 	union {
557473c88f9SBruce Richardson 		u64 csr;
558473c88f9SBruce Richardson 		struct {
559473c88f9SBruce Richardson 			u8 port_freeze:1;	/* '1' - freezed '0' - normal */
560473c88f9SBruce Richardson 			u8 rsvd1:7;		/* Reserved */
561473c88f9SBruce Richardson 			u8 power_state:4;	/* Power State */
562473c88f9SBruce Richardson 			u8 ap1_event:1;		/* AP1 event was detected  */
563473c88f9SBruce Richardson 			u8 ap2_event:1;		/* AP2 event was detected  */
564473c88f9SBruce Richardson 			u64 rsvd2:50;		/* Reserved */
565473c88f9SBruce Richardson 		};
566473c88f9SBruce Richardson 	};
567473c88f9SBruce Richardson };
568473c88f9SBruce Richardson 
569473c88f9SBruce Richardson /* Port Header Register Set */
570473c88f9SBruce Richardson struct feature_port_header {
571473c88f9SBruce Richardson 	struct feature_header header;
572473c88f9SBruce Richardson 	struct feature_afu_header afu_header;
573473c88f9SBruce Richardson 	u64 port_mailbox;
574473c88f9SBruce Richardson 	u64 scratchpad;
575473c88f9SBruce Richardson 	struct feature_port_capability capability;
576473c88f9SBruce Richardson 	struct feature_port_control control;
577473c88f9SBruce Richardson 	struct feature_port_status status;
578473c88f9SBruce Richardson 	u64 rsvd2;
579473c88f9SBruce Richardson 	u64 user_clk_freq_cmd0;
580473c88f9SBruce Richardson 	u64 user_clk_freq_cmd1;
581473c88f9SBruce Richardson 	u64 user_clk_freq_sts0;
582473c88f9SBruce Richardson 	u64 user_clk_freq_sts1;
583473c88f9SBruce Richardson };
584473c88f9SBruce Richardson 
585473c88f9SBruce Richardson struct feature_fme_tmp_threshold {
586473c88f9SBruce Richardson 	union {
587473c88f9SBruce Richardson 		u64 csr;
588473c88f9SBruce Richardson 		struct {
589473c88f9SBruce Richardson 			u8  tmp_thshold1:7;	  /* temperature Threshold 1 */
590473c88f9SBruce Richardson 			/* temperature Threshold 1 enable/disable */
591473c88f9SBruce Richardson 			u8  tmp_thshold1_enable:1;
592473c88f9SBruce Richardson 			u8  tmp_thshold2:7;       /* temperature Threshold 2 */
593473c88f9SBruce Richardson 			/* temperature Threshold 2 enable /disable */
594473c88f9SBruce Richardson 			u8  tmp_thshold2_enable:1;
595473c88f9SBruce Richardson 			u8  pro_hot_setpoint:7;   /* Proc Hot set point */
596473c88f9SBruce Richardson 			u8  rsvd4:1;              /* Reserved */
597473c88f9SBruce Richardson 			u8  therm_trip_thshold:7; /* Thermeal Trip Threshold */
598473c88f9SBruce Richardson 			u8  rsvd3:1;              /* Reserved */
599473c88f9SBruce Richardson 			u8  thshold1_status:1;	  /* Threshold 1 Status */
600473c88f9SBruce Richardson 			u8  thshold2_status:1;    /* Threshold 2 Status */
601473c88f9SBruce Richardson 			u8  rsvd5:1;              /* Reserved */
602473c88f9SBruce Richardson 			/* Thermeal Trip Threshold status */
603473c88f9SBruce Richardson 			u8  therm_trip_thshold_status:1;
604473c88f9SBruce Richardson 			u8  rsvd6:4;		  /* Reserved */
605473c88f9SBruce Richardson 			/* Validation mode- Force Proc Hot */
606473c88f9SBruce Richardson 			u8  valmodeforce:1;
607473c88f9SBruce Richardson 			/* Validation mode - Therm trip Hot */
608473c88f9SBruce Richardson 			u8  valmodetherm:1;
609473c88f9SBruce Richardson 			u8  rsvd2:2;              /* Reserved */
610473c88f9SBruce Richardson 			u8  thshold_policy:1;     /* threshold policy */
611473c88f9SBruce Richardson 			u32 rsvd:19;              /* Reserved */
612473c88f9SBruce Richardson 		};
613473c88f9SBruce Richardson 	};
614473c88f9SBruce Richardson };
615473c88f9SBruce Richardson 
616473c88f9SBruce Richardson /* Temperature Sensor Read values format 1 */
617473c88f9SBruce Richardson struct feature_fme_temp_rdsensor_fmt1 {
618473c88f9SBruce Richardson 	union {
619473c88f9SBruce Richardson 		u64 csr;
620473c88f9SBruce Richardson 		struct {
621473c88f9SBruce Richardson 			/* Reads out FPGA temperature in celsius */
622473c88f9SBruce Richardson 			u8  fpga_temp:7;
623473c88f9SBruce Richardson 			u8  rsvd0:1;			/* Reserved */
624473c88f9SBruce Richardson 			/* Temperature reading sequence number */
625473c88f9SBruce Richardson 			u16 tmp_reading_seq_num;
626473c88f9SBruce Richardson 			/* Temperature reading is valid */
627473c88f9SBruce Richardson 			u8  tmp_reading_valid:1;
628473c88f9SBruce Richardson 			u8  rsvd1:7;			/* Reserved */
629473c88f9SBruce Richardson 			u16 dbg_mode:10;		/* Debug mode */
630473c88f9SBruce Richardson 			u32 rsvd2:22;			/* Reserved */
631473c88f9SBruce Richardson 		};
632473c88f9SBruce Richardson 	};
633473c88f9SBruce Richardson };
634473c88f9SBruce Richardson 
635473c88f9SBruce Richardson /* Temperature sensor read values format 2 */
636473c88f9SBruce Richardson struct feature_fme_temp_rdsensor_fmt2 {
637473c88f9SBruce Richardson 	u64 rsvd;	/* Reserved */
638473c88f9SBruce Richardson };
639473c88f9SBruce Richardson 
640473c88f9SBruce Richardson /* Temperature Threshold Capability Register */
641473c88f9SBruce Richardson struct feature_fme_tmp_threshold_cap {
642473c88f9SBruce Richardson 	union {
643473c88f9SBruce Richardson 		u64 csr;
644473c88f9SBruce Richardson 		struct {
645473c88f9SBruce Richardson 			/* Temperature Threshold Unsupported */
646473c88f9SBruce Richardson 			u8  tmp_thshold_disabled:1;
647473c88f9SBruce Richardson 			u64 rsvd:63;			/* Reserved */
648473c88f9SBruce Richardson 		};
649473c88f9SBruce Richardson 	};
650473c88f9SBruce Richardson };
651473c88f9SBruce Richardson 
652473c88f9SBruce Richardson /* FME THERNAL FEATURE */
653473c88f9SBruce Richardson struct feature_fme_thermal {
654473c88f9SBruce Richardson 	struct feature_header header;
655473c88f9SBruce Richardson 	struct feature_fme_tmp_threshold threshold;
656473c88f9SBruce Richardson 	struct feature_fme_temp_rdsensor_fmt1 rdsensor_fm1;
657473c88f9SBruce Richardson 	struct feature_fme_temp_rdsensor_fmt2 rdsensor_fm2;
658473c88f9SBruce Richardson 	struct feature_fme_tmp_threshold_cap threshold_cap;
659473c88f9SBruce Richardson };
660473c88f9SBruce Richardson 
661473c88f9SBruce Richardson /* Power Status register */
662473c88f9SBruce Richardson struct feature_fme_pm_status {
663473c88f9SBruce Richardson 	union {
664473c88f9SBruce Richardson 		u64 csr;
665473c88f9SBruce Richardson 		struct {
666473c88f9SBruce Richardson 			/* FPGA Power consumed, The format is to be defined */
667473c88f9SBruce Richardson 			u32 pwr_consumed:18;
668473c88f9SBruce Richardson 			/* FPGA Latency Tolerance Reporting */
669473c88f9SBruce Richardson 			u8  fpga_latency_report:1;
670473c88f9SBruce Richardson 			u64 rsvd:45;			/* Reserved */
671473c88f9SBruce Richardson 		};
672473c88f9SBruce Richardson 	};
673473c88f9SBruce Richardson };
674473c88f9SBruce Richardson 
675473c88f9SBruce Richardson /* AP Thresholds */
676473c88f9SBruce Richardson struct feature_fme_pm_ap_threshold {
677473c88f9SBruce Richardson 	union {
678473c88f9SBruce Richardson 		u64 csr;
679473c88f9SBruce Richardson 		struct {
680473c88f9SBruce Richardson 			/*
681473c88f9SBruce Richardson 			 * Number of clocks (5ns period) for assertion
682473c88f9SBruce Richardson 			 * of FME_data
683473c88f9SBruce Richardson 			 */
684473c88f9SBruce Richardson 			u8  threshold1:7;
685473c88f9SBruce Richardson 			u8  rsvd1:1;
686473c88f9SBruce Richardson 			u8  threshold2:7;
687473c88f9SBruce Richardson 			u8  rsvd2:1;
688473c88f9SBruce Richardson 			u8  threshold1_status:1;
689473c88f9SBruce Richardson 			u8  threshold2_status:1;
690473c88f9SBruce Richardson 			u64 rsvd3:46;		/* Reserved */
691473c88f9SBruce Richardson 		};
692473c88f9SBruce Richardson 	};
693473c88f9SBruce Richardson };
694473c88f9SBruce Richardson 
695473c88f9SBruce Richardson /* Xeon Power Limit */
696473c88f9SBruce Richardson struct feature_fme_pm_xeon_limit {
697473c88f9SBruce Richardson 	union {
698473c88f9SBruce Richardson 		u64 csr;
699473c88f9SBruce Richardson 		struct {
700473c88f9SBruce Richardson 			/* Power limit in Watts in 12.3 format */
701473c88f9SBruce Richardson 			u16 pwr_limit:15;
702473c88f9SBruce Richardson 			/* Indicates that power limit has been written */
703473c88f9SBruce Richardson 			u8  enable:1;
704473c88f9SBruce Richardson 			/* 0 - Turbe range, 1 - Entire range */
705473c88f9SBruce Richardson 			u8  clamping:1;
706473c88f9SBruce Richardson 			/* Time constant in XXYYY format */
707473c88f9SBruce Richardson 			u8  time:7;
708473c88f9SBruce Richardson 			u64 rsvd:40;		/* Reserved */
709473c88f9SBruce Richardson 		};
710473c88f9SBruce Richardson 	};
711473c88f9SBruce Richardson };
712473c88f9SBruce Richardson 
713473c88f9SBruce Richardson /* FPGA Power Limit */
714473c88f9SBruce Richardson struct feature_fme_pm_fpga_limit {
715473c88f9SBruce Richardson 	union {
716473c88f9SBruce Richardson 		u64 csr;
717473c88f9SBruce Richardson 		struct {
718473c88f9SBruce Richardson 			/* Power limit in Watts in 12.3 format */
719473c88f9SBruce Richardson 			u16 pwr_limit:15;
720473c88f9SBruce Richardson 			/* Indicates that power limit has been written */
721473c88f9SBruce Richardson 			u8  enable:1;
722473c88f9SBruce Richardson 			/* 0 - Turbe range, 1 - Entire range */
723473c88f9SBruce Richardson 			u8  clamping:1;
724473c88f9SBruce Richardson 			/* Time constant in XXYYY format */
725473c88f9SBruce Richardson 			u8  time:7;
726473c88f9SBruce Richardson 			u64 rsvd:40;		/* Reserved */
727473c88f9SBruce Richardson 		};
728473c88f9SBruce Richardson 	};
729473c88f9SBruce Richardson };
730473c88f9SBruce Richardson 
731473c88f9SBruce Richardson /* FME POWER FEATURE */
732473c88f9SBruce Richardson struct feature_fme_power {
733473c88f9SBruce Richardson 	struct feature_header header;
734473c88f9SBruce Richardson 	struct feature_fme_pm_status status;
735473c88f9SBruce Richardson 	struct feature_fme_pm_ap_threshold threshold;
736473c88f9SBruce Richardson 	struct feature_fme_pm_xeon_limit xeon_limit;
737473c88f9SBruce Richardson 	struct feature_fme_pm_fpga_limit fpga_limit;
738473c88f9SBruce Richardson };
739473c88f9SBruce Richardson 
740473c88f9SBruce Richardson #define CACHE_CHANNEL_RD	0
741473c88f9SBruce Richardson #define CACHE_CHANNEL_WR	1
742473c88f9SBruce Richardson 
743473c88f9SBruce Richardson enum iperf_cache_events {
744473c88f9SBruce Richardson 	IPERF_CACHE_RD_HIT,
745473c88f9SBruce Richardson 	IPERF_CACHE_WR_HIT,
746473c88f9SBruce Richardson 	IPERF_CACHE_RD_MISS,
747473c88f9SBruce Richardson 	IPERF_CACHE_WR_MISS,
748473c88f9SBruce Richardson 	IPERF_CACHE_RSVD, /* reserved */
749473c88f9SBruce Richardson 	IPERF_CACHE_HOLD_REQ,
750473c88f9SBruce Richardson 	IPERF_CACHE_DATA_WR_PORT_CONTEN,
751473c88f9SBruce Richardson 	IPERF_CACHE_TAG_WR_PORT_CONTEN,
752473c88f9SBruce Richardson 	IPERF_CACHE_TX_REQ_STALL,
753473c88f9SBruce Richardson 	IPERF_CACHE_RX_REQ_STALL,
754473c88f9SBruce Richardson 	IPERF_CACHE_EVICTIONS,
755473c88f9SBruce Richardson };
756473c88f9SBruce Richardson 
757473c88f9SBruce Richardson /* FPMON Cache Control */
758473c88f9SBruce Richardson struct feature_fme_ifpmon_ch_ctl {
759473c88f9SBruce Richardson 	union {
760473c88f9SBruce Richardson 		u64 csr;
761473c88f9SBruce Richardson 		struct {
762473c88f9SBruce Richardson 			u8  reset_counters:1;	/* Reset Counters */
763473c88f9SBruce Richardson 			u8  rsvd1:7;		/* Reserved */
764473c88f9SBruce Richardson 			u8  freeze:1;		/* Freeze if set to 1 */
765473c88f9SBruce Richardson 			u8  rsvd2:7;		/* Reserved */
766473c88f9SBruce Richardson 			u8  cache_event:4;	/* Select the cache event */
767473c88f9SBruce Richardson 			u8  cci_chsel:1;	/* Select the channel */
768473c88f9SBruce Richardson 			u64 rsvd3:43;		/* Reserved */
769473c88f9SBruce Richardson 		};
770473c88f9SBruce Richardson 	};
771473c88f9SBruce Richardson };
772473c88f9SBruce Richardson 
773473c88f9SBruce Richardson /* FPMON Cache Counter */
774473c88f9SBruce Richardson struct feature_fme_ifpmon_ch_ctr {
775473c88f9SBruce Richardson 	union {
776473c88f9SBruce Richardson 		u64 csr;
777473c88f9SBruce Richardson 		struct {
778473c88f9SBruce Richardson 			/* Cache Counter for even addresse */
779473c88f9SBruce Richardson 			u64 cache_counter:48;
780473c88f9SBruce Richardson 			u16 rsvd:12;		/* Reserved */
781473c88f9SBruce Richardson 			/* Cache Event being reported */
782473c88f9SBruce Richardson 			u8  event_code:4;
783473c88f9SBruce Richardson 		};
784473c88f9SBruce Richardson 	};
785473c88f9SBruce Richardson };
786473c88f9SBruce Richardson 
787473c88f9SBruce Richardson enum iperf_fab_events {
788473c88f9SBruce Richardson 	IPERF_FAB_PCIE0_RD,
789473c88f9SBruce Richardson 	IPERF_FAB_PCIE0_WR,
790473c88f9SBruce Richardson 	IPERF_FAB_PCIE1_RD,
791473c88f9SBruce Richardson 	IPERF_FAB_PCIE1_WR,
792473c88f9SBruce Richardson 	IPERF_FAB_UPI_RD,
793473c88f9SBruce Richardson 	IPERF_FAB_UPI_WR,
794473c88f9SBruce Richardson 	IPERF_FAB_MMIO_RD,
795473c88f9SBruce Richardson 	IPERF_FAB_MMIO_WR,
796473c88f9SBruce Richardson };
797473c88f9SBruce Richardson 
798473c88f9SBruce Richardson #define FAB_DISABLE_FILTER     0
799473c88f9SBruce Richardson #define FAB_ENABLE_FILTER      1
800473c88f9SBruce Richardson 
801473c88f9SBruce Richardson /* FPMON FAB Control */
802473c88f9SBruce Richardson struct feature_fme_ifpmon_fab_ctl {
803473c88f9SBruce Richardson 	union {
804473c88f9SBruce Richardson 		u64 csr;
805473c88f9SBruce Richardson 		struct {
806473c88f9SBruce Richardson 			u8  reset_counters:1;	/* Reset Counters */
807473c88f9SBruce Richardson 			u8  rsvd:7;		/* Reserved */
808473c88f9SBruce Richardson 			u8  freeze:1;		/* Set to 1 frozen counter */
809473c88f9SBruce Richardson 			u8  rsvd1:7;		/* Reserved */
810473c88f9SBruce Richardson 			u8  fab_evtcode:4;	/* Fabric Event Code */
811473c88f9SBruce Richardson 			u8  port_id:2;		/* Port ID */
812473c88f9SBruce Richardson 			u8  rsvd2:1;		/* Reserved */
813473c88f9SBruce Richardson 			u8  port_filter:1;	/* Port Filter */
814473c88f9SBruce Richardson 			u64 rsvd3:40;		/* Reserved */
815473c88f9SBruce Richardson 		};
816473c88f9SBruce Richardson 	};
817473c88f9SBruce Richardson };
818473c88f9SBruce Richardson 
819473c88f9SBruce Richardson /* FPMON Event Counter */
820473c88f9SBruce Richardson struct feature_fme_ifpmon_fab_ctr {
821473c88f9SBruce Richardson 	union {
822473c88f9SBruce Richardson 		u64 csr;
823473c88f9SBruce Richardson 		struct {
824473c88f9SBruce Richardson 			u64 fab_cnt:60;	/* Fabric event counter */
825473c88f9SBruce Richardson 			/* Fabric event code being reported */
826473c88f9SBruce Richardson 			u8  event_code:4;
827473c88f9SBruce Richardson 		};
828473c88f9SBruce Richardson 	};
829473c88f9SBruce Richardson };
830473c88f9SBruce Richardson 
831473c88f9SBruce Richardson /* FPMON Clock Counter */
832473c88f9SBruce Richardson struct feature_fme_ifpmon_clk_ctr {
833473c88f9SBruce Richardson 	u64 afu_interf_clock;		/* Clk_16UI (AFU clock) counter. */
834473c88f9SBruce Richardson };
835473c88f9SBruce Richardson 
836473c88f9SBruce Richardson enum iperf_vtd_events {
837473c88f9SBruce Richardson 	IPERF_VTD_AFU_MEM_RD_TRANS,
838473c88f9SBruce Richardson 	IPERF_VTD_AFU_MEM_WR_TRANS,
839473c88f9SBruce Richardson 	IPERF_VTD_AFU_DEVTLB_RD_HIT,
840473c88f9SBruce Richardson 	IPERF_VTD_AFU_DEVTLB_WR_HIT,
841473c88f9SBruce Richardson 	IPERF_VTD_DEVTLB_4K_FILL,
842473c88f9SBruce Richardson 	IPERF_VTD_DEVTLB_2M_FILL,
843473c88f9SBruce Richardson 	IPERF_VTD_DEVTLB_1G_FILL,
844473c88f9SBruce Richardson };
845473c88f9SBruce Richardson 
846473c88f9SBruce Richardson /* VT-d control register */
847473c88f9SBruce Richardson struct feature_fme_ifpmon_vtd_ctl {
848473c88f9SBruce Richardson 	union {
849473c88f9SBruce Richardson 		u64 csr;
850473c88f9SBruce Richardson 		struct {
851473c88f9SBruce Richardson 			u8  reset_counters:1;	/* Reset Counters */
852473c88f9SBruce Richardson 			u8  rsvd:7;		/* Reserved */
853473c88f9SBruce Richardson 			u8  freeze:1;		/* Set to 1 frozen counter */
854473c88f9SBruce Richardson 			u8  rsvd1:7;		/* Reserved */
855473c88f9SBruce Richardson 			u8  vtd_evtcode:4;	/* VTd and TLB event code */
856473c88f9SBruce Richardson 			u64 rsvd2:44;		/* Reserved */
857473c88f9SBruce Richardson 		};
858473c88f9SBruce Richardson 	};
859473c88f9SBruce Richardson };
860473c88f9SBruce Richardson 
861473c88f9SBruce Richardson /* VT-d event counter */
862473c88f9SBruce Richardson struct feature_fme_ifpmon_vtd_ctr {
863473c88f9SBruce Richardson 	union {
864473c88f9SBruce Richardson 		u64 csr;
865473c88f9SBruce Richardson 		struct {
866473c88f9SBruce Richardson 			u64 vtd_counter:48;	/* VTd event counter */
867473c88f9SBruce Richardson 			u16 rsvd:12;		/* Reserved */
868473c88f9SBruce Richardson 			u8  event_code:4;	/* VTd event code */
869473c88f9SBruce Richardson 		};
870473c88f9SBruce Richardson 	};
871473c88f9SBruce Richardson };
872473c88f9SBruce Richardson 
873473c88f9SBruce Richardson enum iperf_vtd_sip_events {
874473c88f9SBruce Richardson 	IPERF_VTD_SIP_IOTLB_4K_HIT,
875473c88f9SBruce Richardson 	IPERF_VTD_SIP_IOTLB_2M_HIT,
876473c88f9SBruce Richardson 	IPERF_VTD_SIP_IOTLB_1G_HIT,
877473c88f9SBruce Richardson 	IPERF_VTD_SIP_SLPWC_L3_HIT,
878473c88f9SBruce Richardson 	IPERF_VTD_SIP_SLPWC_L4_HIT,
879473c88f9SBruce Richardson 	IPERF_VTD_SIP_RCC_HIT,
880473c88f9SBruce Richardson 	IPERF_VTD_SIP_IOTLB_4K_MISS,
881473c88f9SBruce Richardson 	IPERF_VTD_SIP_IOTLB_2M_MISS,
882473c88f9SBruce Richardson 	IPERF_VTD_SIP_IOTLB_1G_MISS,
883473c88f9SBruce Richardson 	IPERF_VTD_SIP_SLPWC_L3_MISS,
884473c88f9SBruce Richardson 	IPERF_VTD_SIP_SLPWC_L4_MISS,
885473c88f9SBruce Richardson 	IPERF_VTD_SIP_RCC_MISS,
886473c88f9SBruce Richardson };
887473c88f9SBruce Richardson 
888473c88f9SBruce Richardson /* VT-d SIP control register */
889473c88f9SBruce Richardson struct feature_fme_ifpmon_vtd_sip_ctl {
890473c88f9SBruce Richardson 	union {
891473c88f9SBruce Richardson 		u64 csr;
892473c88f9SBruce Richardson 		struct {
893473c88f9SBruce Richardson 			u8  reset_counters:1;	/* Reset Counters */
894473c88f9SBruce Richardson 			u8  rsvd:7;		/* Reserved */
895473c88f9SBruce Richardson 			u8  freeze:1;		/* Set to 1 frozen counter */
896473c88f9SBruce Richardson 			u8  rsvd1:7;		/* Reserved */
897473c88f9SBruce Richardson 			u8  vtd_evtcode:4;	/* VTd and TLB event code */
898473c88f9SBruce Richardson 			u64 rsvd2:44;		/* Reserved */
899473c88f9SBruce Richardson 		};
900473c88f9SBruce Richardson 	};
901473c88f9SBruce Richardson };
902473c88f9SBruce Richardson 
903473c88f9SBruce Richardson /* VT-d SIP event counter */
904473c88f9SBruce Richardson struct feature_fme_ifpmon_vtd_sip_ctr {
905473c88f9SBruce Richardson 	union {
906473c88f9SBruce Richardson 		u64 csr;
907473c88f9SBruce Richardson 		struct {
908473c88f9SBruce Richardson 			u64 vtd_counter:48;	/* VTd event counter */
909473c88f9SBruce Richardson 			u16 rsvd:12;		/* Reserved */
910473c88f9SBruce Richardson 			u8 event_code:4;	/* VTd event code */
911473c88f9SBruce Richardson 		};
912473c88f9SBruce Richardson 	};
913473c88f9SBruce Richardson };
914473c88f9SBruce Richardson 
915473c88f9SBruce Richardson /* FME IPERF FEATURE */
916473c88f9SBruce Richardson struct feature_fme_iperf {
917473c88f9SBruce Richardson 	struct feature_header header;
918473c88f9SBruce Richardson 	struct feature_fme_ifpmon_ch_ctl ch_ctl;
919473c88f9SBruce Richardson 	struct feature_fme_ifpmon_ch_ctr ch_ctr0;
920473c88f9SBruce Richardson 	struct feature_fme_ifpmon_ch_ctr ch_ctr1;
921473c88f9SBruce Richardson 	struct feature_fme_ifpmon_fab_ctl fab_ctl;
922473c88f9SBruce Richardson 	struct feature_fme_ifpmon_fab_ctr fab_ctr;
923473c88f9SBruce Richardson 	struct feature_fme_ifpmon_clk_ctr clk;
924473c88f9SBruce Richardson 	struct feature_fme_ifpmon_vtd_ctl vtd_ctl;
925473c88f9SBruce Richardson 	struct feature_fme_ifpmon_vtd_ctr vtd_ctr;
926473c88f9SBruce Richardson 	struct feature_fme_ifpmon_vtd_sip_ctl vtd_sip_ctl;
927473c88f9SBruce Richardson 	struct feature_fme_ifpmon_vtd_sip_ctr vtd_sip_ctr;
928473c88f9SBruce Richardson };
929473c88f9SBruce Richardson 
930473c88f9SBruce Richardson enum dperf_fab_events {
931473c88f9SBruce Richardson 	DPERF_FAB_PCIE0_RD,
932473c88f9SBruce Richardson 	DPERF_FAB_PCIE0_WR,
933473c88f9SBruce Richardson 	DPERF_FAB_MMIO_RD = 6,
934473c88f9SBruce Richardson 	DPERF_FAB_MMIO_WR,
935473c88f9SBruce Richardson };
936473c88f9SBruce Richardson 
937473c88f9SBruce Richardson /* FPMON FAB Control */
938473c88f9SBruce Richardson struct feature_fme_dfpmon_fab_ctl {
939473c88f9SBruce Richardson 	union {
940473c88f9SBruce Richardson 		u64 csr;
941473c88f9SBruce Richardson 		struct {
942473c88f9SBruce Richardson 			u8  reset_counters:1;	/* Reset Counters */
943473c88f9SBruce Richardson 			u8  rsvd:7;		/* Reserved */
944473c88f9SBruce Richardson 			u8  freeze:1;		/* Set to 1 frozen counter */
945473c88f9SBruce Richardson 			u8  rsvd1:7;		/* Reserved */
946473c88f9SBruce Richardson 			u8  fab_evtcode:4;	/* Fabric Event Code */
947473c88f9SBruce Richardson 			u8  port_id:2;		/* Port ID */
948473c88f9SBruce Richardson 			u8  rsvd2:1;		/* Reserved */
949473c88f9SBruce Richardson 			u8  port_filter:1;	/* Port Filter */
950473c88f9SBruce Richardson 			u64 rsvd3:40;		/* Reserved */
951473c88f9SBruce Richardson 		};
952473c88f9SBruce Richardson 	};
953473c88f9SBruce Richardson };
954473c88f9SBruce Richardson 
955473c88f9SBruce Richardson /* FPMON Event Counter */
956473c88f9SBruce Richardson struct feature_fme_dfpmon_fab_ctr {
957473c88f9SBruce Richardson 	union {
958473c88f9SBruce Richardson 		u64 csr;
959473c88f9SBruce Richardson 		struct {
960473c88f9SBruce Richardson 			u64 fab_cnt:60;	/* Fabric event counter */
961473c88f9SBruce Richardson 			/* Fabric event code being reported */
962473c88f9SBruce Richardson 			u8  event_code:4;
963473c88f9SBruce Richardson 		};
964473c88f9SBruce Richardson 	};
965473c88f9SBruce Richardson };
966473c88f9SBruce Richardson 
967473c88f9SBruce Richardson /* FPMON Clock Counter */
968473c88f9SBruce Richardson struct feature_fme_dfpmon_clk_ctr {
969473c88f9SBruce Richardson 	u64 afu_interf_clock;		/* Clk_16UI (AFU clock) counter. */
970473c88f9SBruce Richardson };
971473c88f9SBruce Richardson 
972473c88f9SBruce Richardson /* FME DPERF FEATURE */
973473c88f9SBruce Richardson struct feature_fme_dperf {
974473c88f9SBruce Richardson 	struct feature_header header;
975473c88f9SBruce Richardson 	u64 rsvd[3];
976473c88f9SBruce Richardson 	struct feature_fme_dfpmon_fab_ctl fab_ctl;
977473c88f9SBruce Richardson 	struct feature_fme_dfpmon_fab_ctr fab_ctr;
978473c88f9SBruce Richardson 	struct feature_fme_dfpmon_clk_ctr clk;
979473c88f9SBruce Richardson };
980473c88f9SBruce Richardson 
981473c88f9SBruce Richardson struct feature_fme_error0 {
982473c88f9SBruce Richardson #define FME_ERROR0_MASK_DEFAULT 0x40UL  /* pcode workaround */
983473c88f9SBruce Richardson 	union {
984473c88f9SBruce Richardson 		u64 csr;
985473c88f9SBruce Richardson 		struct {
986473c88f9SBruce Richardson 			u8  fabric_err:1;	/* Fabric error */
987473c88f9SBruce Richardson 			u8  fabfifo_overflow:1;	/* Fabric fifo overflow */
9885548d7e5STianfei Zhang 			u8  reserved2:3;
989473c88f9SBruce Richardson 			/* AFU PF/VF access mismatch detected */
990473c88f9SBruce Richardson 			u8  afu_acc_mode_err:1;
9915548d7e5STianfei Zhang 			u8  reserved6:1;
992473c88f9SBruce Richardson 			/* PCIE0 CDC Parity Error */
993473c88f9SBruce Richardson 			u8  pcie0cdc_parity_err:5;
994473c88f9SBruce Richardson 			/* PCIE1 CDC Parity Error */
995473c88f9SBruce Richardson 			u8  pcie1cdc_parity_err:5;
996473c88f9SBruce Richardson 			/* CVL CDC Parity Error */
997473c88f9SBruce Richardson 			u8  cvlcdc_parity_err:3;
9985548d7e5STianfei Zhang 			u8  fpgaseuerr:1;
9995548d7e5STianfei Zhang 			u64 rsvd:43;		/* Reserved */
1000473c88f9SBruce Richardson 		};
1001473c88f9SBruce Richardson 	};
1002473c88f9SBruce Richardson };
1003473c88f9SBruce Richardson 
1004473c88f9SBruce Richardson /* PCIe0 Error Status register */
1005473c88f9SBruce Richardson struct feature_fme_pcie0_error {
1006473c88f9SBruce Richardson #define FME_PCIE0_ERROR_MASK   0xFFUL
1007473c88f9SBruce Richardson 	union {
1008473c88f9SBruce Richardson 		u64 csr;
1009473c88f9SBruce Richardson 		struct {
1010473c88f9SBruce Richardson 			u8  formattype_err:1;	/* TLP format/type error */
1011473c88f9SBruce Richardson 			u8  MWAddr_err:1;	/* TLP MW address error */
1012473c88f9SBruce Richardson 			u8  MWAddrLength_err:1;	/* TLP MW length error */
1013473c88f9SBruce Richardson 			u8  MRAddr_err:1;	/* TLP MR address error */
1014473c88f9SBruce Richardson 			u8  MRAddrLength_err:1;	/* TLP MR length error */
1015473c88f9SBruce Richardson 			u8  cpl_tag_err:1;	/* TLP CPL tag error */
1016473c88f9SBruce Richardson 			u8  cpl_status_err:1;	/* TLP CPL status error */
1017473c88f9SBruce Richardson 			u8  cpl_timeout_err:1;	/* TLP CPL timeout */
1018473c88f9SBruce Richardson 			u8  cci_parity_err:1;	/* CCI bridge parity error */
1019473c88f9SBruce Richardson 			u8  rxpoison_tlp_err:1;	/* Received a TLP with EP set */
1020473c88f9SBruce Richardson 			u64 rsvd:52;		/* Reserved */
1021473c88f9SBruce Richardson 			u8  vfnumb_err:1;	/* Number of error VF */
1022473c88f9SBruce Richardson 			u8  funct_type_err:1;	/* Virtual (1) or Physical */
1023473c88f9SBruce Richardson 		};
1024473c88f9SBruce Richardson 	};
1025473c88f9SBruce Richardson };
1026473c88f9SBruce Richardson 
1027473c88f9SBruce Richardson /* PCIe1 Error Status register */
1028473c88f9SBruce Richardson struct feature_fme_pcie1_error {
1029473c88f9SBruce Richardson #define FME_PCIE1_ERROR_MASK   0xFFUL
1030473c88f9SBruce Richardson 	union {
1031473c88f9SBruce Richardson 		u64 csr;
1032473c88f9SBruce Richardson 		struct {
1033473c88f9SBruce Richardson 			u8  formattype_err:1;	/* TLP format/type error */
1034473c88f9SBruce Richardson 			u8  MWAddr_err:1;	/* TLP MW address error */
1035473c88f9SBruce Richardson 			u8  MWAddrLength_err:1;	/* TLP MW length error */
1036473c88f9SBruce Richardson 			u8  MRAddr_err:1;	/* TLP MR address error */
1037473c88f9SBruce Richardson 			u8  MRAddrLength_err:1;	/* TLP MR length error */
1038473c88f9SBruce Richardson 			u8  cpl_tag_err:1;	/* TLP CPL tag error */
1039473c88f9SBruce Richardson 			u8  cpl_status_err:1;	/* TLP CPL status error */
1040473c88f9SBruce Richardson 			u8  cpl_timeout_err:1;	/* TLP CPL timeout */
1041473c88f9SBruce Richardson 			u8  cci_parity_err:1;	/* CCI bridge parity error */
1042473c88f9SBruce Richardson 			u8  rxpoison_tlp_err:1;	/* Received a TLP with EP set */
1043473c88f9SBruce Richardson 			u64 rsvd:54;		/* Reserved */
1044473c88f9SBruce Richardson 		};
1045473c88f9SBruce Richardson 	};
1046473c88f9SBruce Richardson };
1047473c88f9SBruce Richardson 
1048473c88f9SBruce Richardson /* FME First Error register */
1049473c88f9SBruce Richardson struct feature_fme_first_error {
1050473c88f9SBruce Richardson #define FME_FIRST_ERROR_MASK   ((1ULL << 60) - 1)
1051473c88f9SBruce Richardson 	union {
1052473c88f9SBruce Richardson 		u64 csr;
1053473c88f9SBruce Richardson 		struct {
1054473c88f9SBruce Richardson 			/*
1055473c88f9SBruce Richardson 			 * Indicates the Error Register that was
1056473c88f9SBruce Richardson 			 * triggered first
1057473c88f9SBruce Richardson 			 */
1058473c88f9SBruce Richardson 			u64 err_reg_status:60;
1059473c88f9SBruce Richardson 			/*
1060473c88f9SBruce Richardson 			 * Holds 60 LSBs from the Error register that was
1061473c88f9SBruce Richardson 			 * triggered first
1062473c88f9SBruce Richardson 			 */
1063473c88f9SBruce Richardson 			u8 errReg_id:4;
1064473c88f9SBruce Richardson 		};
1065473c88f9SBruce Richardson 	};
1066473c88f9SBruce Richardson };
1067473c88f9SBruce Richardson 
1068473c88f9SBruce Richardson /* FME Next Error register */
1069473c88f9SBruce Richardson struct feature_fme_next_error {
1070473c88f9SBruce Richardson #define FME_NEXT_ERROR_MASK    ((1ULL << 60) - 1)
1071473c88f9SBruce Richardson 	union {
1072473c88f9SBruce Richardson 		u64 csr;
1073473c88f9SBruce Richardson 		struct {
1074473c88f9SBruce Richardson 			/*
1075473c88f9SBruce Richardson 			 * Indicates the Error Register that was
1076473c88f9SBruce Richardson 			 * triggered second
1077473c88f9SBruce Richardson 			 */
1078473c88f9SBruce Richardson 			u64 err_reg_status:60;
1079473c88f9SBruce Richardson 			/*
1080473c88f9SBruce Richardson 			 * Holds 60 LSBs from the Error register that was
1081473c88f9SBruce Richardson 			 * triggered second
1082473c88f9SBruce Richardson 			 */
1083473c88f9SBruce Richardson 			u8  errReg_id:4;
1084473c88f9SBruce Richardson 		};
1085473c88f9SBruce Richardson 	};
1086473c88f9SBruce Richardson };
1087473c88f9SBruce Richardson 
1088473c88f9SBruce Richardson /* RAS Non Fatal Error Status register */
1089473c88f9SBruce Richardson struct feature_fme_ras_nonfaterror {
1090473c88f9SBruce Richardson 	union {
1091473c88f9SBruce Richardson 		u64 csr;
1092473c88f9SBruce Richardson 		struct {
1093473c88f9SBruce Richardson 			/* thremal threshold AP1 */
1094473c88f9SBruce Richardson 			u8  temp_thresh_ap1:1;
1095473c88f9SBruce Richardson 			/* thremal threshold AP2 */
1096473c88f9SBruce Richardson 			u8  temp_thresh_ap2:1;
1097473c88f9SBruce Richardson 			u8  pcie_error:1;	/* pcie Error */
1098473c88f9SBruce Richardson 			u8  portfatal_error:1;	/* port fatal error */
1099473c88f9SBruce Richardson 			u8  proc_hot:1;		/* Indicates a ProcHot event */
1100473c88f9SBruce Richardson 			/* Indicates an AFU PF/VF access mismatch */
1101473c88f9SBruce Richardson 			u8  afu_acc_mode_err:1;
1102473c88f9SBruce Richardson 			/* Injected nonfata Error */
1103473c88f9SBruce Richardson 			u8  injected_nonfata_err:1;
1104473c88f9SBruce Richardson 			u8  rsvd1:2;
1105473c88f9SBruce Richardson 			/* Temperature threshold triggered AP6*/
1106473c88f9SBruce Richardson 			u8  temp_thresh_AP6:1;
1107473c88f9SBruce Richardson 			/* Power threshold triggered AP1 */
1108473c88f9SBruce Richardson 			u8  power_thresh_AP1:1;
1109473c88f9SBruce Richardson 			/* Power threshold triggered AP2 */
1110473c88f9SBruce Richardson 			u8  power_thresh_AP2:1;
1111473c88f9SBruce Richardson 			/* Indicates a MBP event */
1112473c88f9SBruce Richardson 			u8  mbp_err:1;
1113473c88f9SBruce Richardson 			u64 rsvd2:51;		/* Reserved */
1114473c88f9SBruce Richardson 		};
1115473c88f9SBruce Richardson 	};
1116473c88f9SBruce Richardson };
1117473c88f9SBruce Richardson 
1118473c88f9SBruce Richardson /* RAS Catastrophic Fatal Error Status register */
1119473c88f9SBruce Richardson struct feature_fme_ras_catfaterror {
1120473c88f9SBruce Richardson 	union {
1121473c88f9SBruce Richardson 		u64 csr;
1122473c88f9SBruce Richardson 		struct {
1123473c88f9SBruce Richardson 			/* KTI Link layer error detected */
1124473c88f9SBruce Richardson 			u8  ktilink_fatal_err:1;
1125473c88f9SBruce Richardson 			/* tag-n-cache error detected */
1126473c88f9SBruce Richardson 			u8  tagcch_fatal_err:1;
1127473c88f9SBruce Richardson 			/* CCI error detected */
1128473c88f9SBruce Richardson 			u8  cci_fatal_err:1;
1129473c88f9SBruce Richardson 			/* KTI Protocol error detected */
1130473c88f9SBruce Richardson 			u8  ktiprpto_fatal_err:1;
1131473c88f9SBruce Richardson 			/* Fatal DRAM error detected */
1132473c88f9SBruce Richardson 			u8  dram_fatal_err:1;
1133473c88f9SBruce Richardson 			/* IOMMU detected */
1134473c88f9SBruce Richardson 			u8  iommu_fatal_err:1;
1135473c88f9SBruce Richardson 			/* Fabric Fatal Error */
1136473c88f9SBruce Richardson 			u8  fabric_fatal_err:1;
1137473c88f9SBruce Richardson 			/* PCIe possion Error */
1138473c88f9SBruce Richardson 			u8  pcie_poison_err:1;
1139473c88f9SBruce Richardson 			/* Injected fatal Error */
1140473c88f9SBruce Richardson 			u8  inject_fata_err:1;
1141473c88f9SBruce Richardson 			/* Catastrophic CRC Error */
1142473c88f9SBruce Richardson 			u8  crc_catast_err:1;
1143473c88f9SBruce Richardson 			/* Catastrophic Thermal Error */
1144473c88f9SBruce Richardson 			u8  therm_catast_err:1;
1145473c88f9SBruce Richardson 			/* Injected Catastrophic Error */
1146473c88f9SBruce Richardson 			u8  injected_catast_err:1;
1147fc02b0bfSTianfei Zhang 			/* SEU error on BMC */
1148fc02b0bfSTianfei Zhang 			u8  bmc_seu_catast_err:1;
1149fc02b0bfSTianfei Zhang 			u64 rsvd:51;
1150473c88f9SBruce Richardson 		};
1151473c88f9SBruce Richardson 	};
1152473c88f9SBruce Richardson };
1153473c88f9SBruce Richardson 
1154473c88f9SBruce Richardson /* RAS Error injection register */
1155473c88f9SBruce Richardson struct feature_fme_ras_error_inj {
1156473c88f9SBruce Richardson #define FME_RAS_ERROR_INJ_MASK      0x7UL
1157473c88f9SBruce Richardson 	union {
1158473c88f9SBruce Richardson 		u64 csr;
1159473c88f9SBruce Richardson 		struct {
1160473c88f9SBruce Richardson 			u8  catast_error:1;	/* Catastrophic error flag */
1161473c88f9SBruce Richardson 			u8  fatal_error:1;	/* Fatal error flag */
1162473c88f9SBruce Richardson 			u8  nonfatal_error:1;	/* NonFatal error flag */
1163473c88f9SBruce Richardson 			u64 rsvd:61;		/* Reserved */
1164473c88f9SBruce Richardson 		};
1165473c88f9SBruce Richardson 	};
1166473c88f9SBruce Richardson };
1167473c88f9SBruce Richardson 
1168473c88f9SBruce Richardson /* FME error capabilities */
1169473c88f9SBruce Richardson struct feature_fme_error_capability {
1170473c88f9SBruce Richardson 	union {
1171473c88f9SBruce Richardson 	u64 csr;
1172473c88f9SBruce Richardson 		struct {
1173473c88f9SBruce Richardson 			u8 support_intr:1;
1174473c88f9SBruce Richardson 			/* MSI-X vector table entry number */
1175473c88f9SBruce Richardson 			u16 intr_vector_num:12;
117610349b73STianfei Zhang 			u64 rsvd:50;	/* Reserved */
117710349b73STianfei Zhang 			u64 seu_support:1;
1178473c88f9SBruce Richardson 		};
1179473c88f9SBruce Richardson 	};
1180473c88f9SBruce Richardson };
1181473c88f9SBruce Richardson 
1182473c88f9SBruce Richardson /* FME ERR FEATURE */
1183473c88f9SBruce Richardson struct feature_fme_err {
1184473c88f9SBruce Richardson 	struct feature_header header;
1185473c88f9SBruce Richardson 	struct feature_fme_error0 fme_err_mask;
1186473c88f9SBruce Richardson 	struct feature_fme_error0 fme_err;
1187473c88f9SBruce Richardson 	struct feature_fme_pcie0_error pcie0_err_mask;
1188473c88f9SBruce Richardson 	struct feature_fme_pcie0_error pcie0_err;
1189473c88f9SBruce Richardson 	struct feature_fme_pcie1_error pcie1_err_mask;
1190473c88f9SBruce Richardson 	struct feature_fme_pcie1_error pcie1_err;
1191473c88f9SBruce Richardson 	struct feature_fme_first_error fme_first_err;
1192473c88f9SBruce Richardson 	struct feature_fme_next_error fme_next_err;
1193473c88f9SBruce Richardson 	struct feature_fme_ras_nonfaterror ras_nonfat_mask;
1194473c88f9SBruce Richardson 	struct feature_fme_ras_nonfaterror ras_nonfaterr;
1195473c88f9SBruce Richardson 	struct feature_fme_ras_catfaterror ras_catfat_mask;
1196473c88f9SBruce Richardson 	struct feature_fme_ras_catfaterror ras_catfaterr;
1197473c88f9SBruce Richardson 	struct feature_fme_ras_error_inj ras_error_inj;
1198473c88f9SBruce Richardson 	struct feature_fme_error_capability fme_err_capability;
119910349b73STianfei Zhang 	u64 seu_emr_l;
120010349b73STianfei Zhang 	u64 seu_emr_h;
1201473c88f9SBruce Richardson };
1202473c88f9SBruce Richardson 
1203473c88f9SBruce Richardson /* FME Partial Reconfiguration Control */
1204473c88f9SBruce Richardson struct feature_fme_pr_ctl {
1205473c88f9SBruce Richardson 	union {
1206473c88f9SBruce Richardson 		u64 csr;
1207473c88f9SBruce Richardson 		struct {
1208473c88f9SBruce Richardson 			u8  pr_reset:1;		/* Reset PR Engine */
1209473c88f9SBruce Richardson 			u8  rsvd3:3;		/* Reserved */
1210473c88f9SBruce Richardson 			u8  pr_reset_ack:1;	/* Reset PR Engine Ack */
1211473c88f9SBruce Richardson 			u8  rsvd4:3;		/* Reserved */
1212473c88f9SBruce Richardson 			u8  pr_regionid:2;	/* PR Region ID */
1213473c88f9SBruce Richardson 			u8  rsvd1:2;		/* Reserved */
1214473c88f9SBruce Richardson 			u8  pr_start_req:1;	/* PR Start Request */
1215473c88f9SBruce Richardson 			u8  pr_push_complete:1;	/* PR Data push complete */
1216473c88f9SBruce Richardson 			u8  pr_kind:1;		/* PR Data push complete */
1217473c88f9SBruce Richardson 			u32 rsvd:17;		/* Reserved */
1218473c88f9SBruce Richardson 			u32 config_data;	/* Config data TBD */
1219473c88f9SBruce Richardson 		};
1220473c88f9SBruce Richardson 	};
1221473c88f9SBruce Richardson };
1222473c88f9SBruce Richardson 
1223473c88f9SBruce Richardson /* FME Partial Reconfiguration Status */
1224473c88f9SBruce Richardson struct feature_fme_pr_status {
1225473c88f9SBruce Richardson 	union {
1226473c88f9SBruce Richardson 		u64 csr;
1227473c88f9SBruce Richardson 		struct {
1228473c88f9SBruce Richardson 			u16 pr_credit:9;	/* PR Credits */
1229473c88f9SBruce Richardson 			u8  rsvd2:7;		/* Reserved */
1230473c88f9SBruce Richardson 			u8  pr_status:1;	/* PR status */
1231473c88f9SBruce Richardson 			u8  rsvd:3;		/* Reserved */
1232473c88f9SBruce Richardson 			/* Altra PR Controller Block status */
1233473c88f9SBruce Richardson 			u8  pr_controller_status:3;
1234473c88f9SBruce Richardson 			u8  rsvd1:1;            /* Reserved */
1235473c88f9SBruce Richardson 			u8  pr_host_status:4;   /* PR Host status */
1236473c88f9SBruce Richardson 			u8  rsvd3:4;		/* Reserved */
1237473c88f9SBruce Richardson 			/* Security Block Status fields (TBD) */
1238473c88f9SBruce Richardson 			u32 security_bstatus;
1239473c88f9SBruce Richardson 		};
1240473c88f9SBruce Richardson 	};
1241473c88f9SBruce Richardson };
1242473c88f9SBruce Richardson 
1243473c88f9SBruce Richardson /* FME Partial Reconfiguration Data */
1244473c88f9SBruce Richardson struct feature_fme_pr_data {
1245473c88f9SBruce Richardson 	union {
1246473c88f9SBruce Richardson 		u64 csr;	/* PR data from the raw-binary file */
1247473c88f9SBruce Richardson 		struct {
1248473c88f9SBruce Richardson 			/* PR data from the raw-binary file */
1249473c88f9SBruce Richardson 			u32 pr_data_raw;
1250473c88f9SBruce Richardson 			u32 rsvd;
1251473c88f9SBruce Richardson 		};
1252473c88f9SBruce Richardson 	};
1253473c88f9SBruce Richardson };
1254473c88f9SBruce Richardson 
1255473c88f9SBruce Richardson /* FME PR Public Key */
1256473c88f9SBruce Richardson struct feature_fme_pr_key {
1257473c88f9SBruce Richardson 	u64 key;		/* FME PR Public Hash */
1258473c88f9SBruce Richardson };
1259473c88f9SBruce Richardson 
1260473c88f9SBruce Richardson /* FME PR FEATURE */
1261473c88f9SBruce Richardson struct feature_fme_pr {
1262473c88f9SBruce Richardson 	struct feature_header header;
1263473c88f9SBruce Richardson 	/*Partial Reconfiguration control */
1264473c88f9SBruce Richardson 	struct feature_fme_pr_ctl	ccip_fme_pr_control;
1265473c88f9SBruce Richardson 
1266473c88f9SBruce Richardson 	/* Partial Reconfiguration Status */
1267473c88f9SBruce Richardson 	struct feature_fme_pr_status	ccip_fme_pr_status;
1268473c88f9SBruce Richardson 
1269473c88f9SBruce Richardson 	/* Partial Reconfiguration data */
1270473c88f9SBruce Richardson 	struct feature_fme_pr_data	ccip_fme_pr_data;
1271473c88f9SBruce Richardson 
1272473c88f9SBruce Richardson 	/* Partial Reconfiguration data */
1273473c88f9SBruce Richardson 	u64				ccip_fme_pr_err;
1274473c88f9SBruce Richardson 
1275473c88f9SBruce Richardson 	u64 rsvd1[3];
1276473c88f9SBruce Richardson 
1277473c88f9SBruce Richardson 	/* Partial Reconfiguration data registers */
1278473c88f9SBruce Richardson 	u64 fme_pr_data1;
1279473c88f9SBruce Richardson 	u64 fme_pr_data2;
1280473c88f9SBruce Richardson 	u64 fme_pr_data3;
1281473c88f9SBruce Richardson 	u64 fme_pr_data4;
1282473c88f9SBruce Richardson 	u64 fme_pr_data5;
1283473c88f9SBruce Richardson 	u64 fme_pr_data6;
1284473c88f9SBruce Richardson 	u64 fme_pr_data7;
1285473c88f9SBruce Richardson 	u64 fme_pr_data8;
1286473c88f9SBruce Richardson 
1287473c88f9SBruce Richardson 	u64 rsvd2[5];
1288473c88f9SBruce Richardson 
1289473c88f9SBruce Richardson 	/* PR Interface ID */
1290473c88f9SBruce Richardson 	u64 fme_pr_intfc_id_l;
1291473c88f9SBruce Richardson 	u64 fme_pr_intfc_id_h;
1292473c88f9SBruce Richardson 
1293473c88f9SBruce Richardson 	/* MSIX filed to be Added */
1294473c88f9SBruce Richardson };
1295473c88f9SBruce Richardson 
1296473c88f9SBruce Richardson /* FME HSSI Control */
1297473c88f9SBruce Richardson struct feature_fme_hssi_eth_ctrl {
1298473c88f9SBruce Richardson 	union {
1299473c88f9SBruce Richardson 		u64 csr;
1300473c88f9SBruce Richardson 		struct {
1301473c88f9SBruce Richardson 			u32 data:32;		/* HSSI data */
1302473c88f9SBruce Richardson 			u16 address:16;		/* HSSI address */
1303473c88f9SBruce Richardson 			/*
1304473c88f9SBruce Richardson 			 * HSSI comamnd
1305473c88f9SBruce Richardson 			 * 0x0 - No request
1306473c88f9SBruce Richardson 			 * 0x08 - SW register RD request
1307473c88f9SBruce Richardson 			 * 0x10 - SW register WR request
1308473c88f9SBruce Richardson 			 * 0x40 - Auxiliar bus RD request
1309473c88f9SBruce Richardson 			 * 0x80 - Auxiliar bus WR request
1310473c88f9SBruce Richardson 			 */
1311473c88f9SBruce Richardson 			u16 cmd:16;
1312473c88f9SBruce Richardson 		};
1313473c88f9SBruce Richardson 	};
1314473c88f9SBruce Richardson };
1315473c88f9SBruce Richardson 
1316473c88f9SBruce Richardson /* FME HSSI Status */
1317473c88f9SBruce Richardson struct feature_fme_hssi_eth_stat {
1318473c88f9SBruce Richardson 	union {
1319473c88f9SBruce Richardson 		u64 csr;
1320473c88f9SBruce Richardson 		struct {
1321473c88f9SBruce Richardson 			u32 data:32;		/* HSSI data */
1322473c88f9SBruce Richardson 			u8  acknowledge:1;	/* HSSI acknowledge */
1323473c88f9SBruce Richardson 			u8  spare:1;		/* HSSI spare */
1324473c88f9SBruce Richardson 			u32 rsvd:30;		/* Reserved */
1325473c88f9SBruce Richardson 		};
1326473c88f9SBruce Richardson 	};
1327473c88f9SBruce Richardson };
1328473c88f9SBruce Richardson 
1329473c88f9SBruce Richardson /* FME HSSI FEATURE */
1330473c88f9SBruce Richardson struct feature_fme_hssi {
1331473c88f9SBruce Richardson 	struct feature_header header;
1332473c88f9SBruce Richardson 	struct feature_fme_hssi_eth_ctrl	hssi_control;
1333473c88f9SBruce Richardson 	struct feature_fme_hssi_eth_stat	hssi_status;
1334473c88f9SBruce Richardson };
1335473c88f9SBruce Richardson 
1336473c88f9SBruce Richardson #define PORT_ERR_MASK		0xfff0703ff001f
1337473c88f9SBruce Richardson struct feature_port_err_key {
1338473c88f9SBruce Richardson 	union {
1339473c88f9SBruce Richardson 		u64 csr;
1340473c88f9SBruce Richardson 		struct {
1341473c88f9SBruce Richardson 			/* Tx Channel0: Overflow */
1342473c88f9SBruce Richardson 			u8 tx_ch0_overflow:1;
1343473c88f9SBruce Richardson 			/* Tx Channel0: Invalid request encoding */
1344473c88f9SBruce Richardson 			u8 tx_ch0_invaldreq :1;
1345473c88f9SBruce Richardson 			/* Tx Channel0: Request with cl_len=3 not supported */
1346473c88f9SBruce Richardson 			u8 tx_ch0_cl_len3:1;
1347473c88f9SBruce Richardson 			/* Tx Channel0: Request with cl_len=2 not aligned 2CL */
1348473c88f9SBruce Richardson 			u8 tx_ch0_cl_len2:1;
1349473c88f9SBruce Richardson 			/* Tx Channel0: Request with cl_len=4 not aligned 4CL */
1350473c88f9SBruce Richardson 			u8 tx_ch0_cl_len4:1;
1351473c88f9SBruce Richardson 
1352473c88f9SBruce Richardson 			u16 rsvd1:4;			/* Reserved */
1353473c88f9SBruce Richardson 
1354473c88f9SBruce Richardson 			/* AFU MMIO RD received while PORT is in reset */
1355473c88f9SBruce Richardson 			u8 mmio_rd_whilerst:1;
1356473c88f9SBruce Richardson 			/* AFU MMIO WR received while PORT is in reset */
1357473c88f9SBruce Richardson 			u8 mmio_wr_whilerst:1;
1358473c88f9SBruce Richardson 
1359473c88f9SBruce Richardson 			u16 rsvd2:5;			/* Reserved */
1360473c88f9SBruce Richardson 
1361473c88f9SBruce Richardson 			/* Tx Channel1: Overflow */
1362473c88f9SBruce Richardson 			u8 tx_ch1_overflow:1;
1363473c88f9SBruce Richardson 			/* Tx Channel1: Invalid request encoding */
1364473c88f9SBruce Richardson 			u8 tx_ch1_invaldreq:1;
1365473c88f9SBruce Richardson 			/* Tx Channel1: Request with cl_len=3 not supported */
1366473c88f9SBruce Richardson 			u8 tx_ch1_cl_len3:1;
1367473c88f9SBruce Richardson 			/* Tx Channel1: Request with cl_len=2 not aligned 2CL */
1368473c88f9SBruce Richardson 			u8 tx_ch1_cl_len2:1;
1369473c88f9SBruce Richardson 			/* Tx Channel1: Request with cl_len=4 not aligned 4CL */
1370473c88f9SBruce Richardson 			u8 tx_ch1_cl_len4:1;
1371473c88f9SBruce Richardson 
1372473c88f9SBruce Richardson 			/* Tx Channel1: Insufficient data payload */
1373473c88f9SBruce Richardson 			u8 tx_ch1_insuff_data:1;
1374473c88f9SBruce Richardson 			/* Tx Channel1: Data payload overrun */
1375473c88f9SBruce Richardson 			u8 tx_ch1_data_overrun:1;
1376473c88f9SBruce Richardson 			/* Tx Channel1 : Incorrect address */
1377473c88f9SBruce Richardson 			u8 tx_ch1_incorr_addr:1;
1378473c88f9SBruce Richardson 			/* Tx Channel1 : NON-Zero SOP Detected */
1379473c88f9SBruce Richardson 			u8 tx_ch1_nzsop:1;
1380473c88f9SBruce Richardson 			/* Tx Channel1 : Illegal VC_SEL, atomic request VLO */
1381473c88f9SBruce Richardson 			u8 tx_ch1_illegal_vcsel:1;
1382473c88f9SBruce Richardson 
1383473c88f9SBruce Richardson 			u8 rsvd3:6;			/* Reserved */
1384473c88f9SBruce Richardson 
1385473c88f9SBruce Richardson 			/* MMIO Read Timeout in AFU */
1386473c88f9SBruce Richardson 			u8 mmioread_timeout:1;
1387473c88f9SBruce Richardson 
1388473c88f9SBruce Richardson 			/* Tx Channel2: FIFO Overflow */
1389473c88f9SBruce Richardson 			u8 tx_ch2_fifo_overflow:1;
1390473c88f9SBruce Richardson 
1391473c88f9SBruce Richardson 			/* MMIO read is not matching pending request */
1392473c88f9SBruce Richardson 			u8 unexp_mmio_resp:1;
1393473c88f9SBruce Richardson 
1394473c88f9SBruce Richardson 			u8 rsvd4:5;			/* Reserved */
1395473c88f9SBruce Richardson 
1396473c88f9SBruce Richardson 			/* Number of pending Requests: counter overflow */
1397473c88f9SBruce Richardson 			u8 tx_req_counter_overflow:1;
1398473c88f9SBruce Richardson 			/* Req with Address violating SMM Range */
1399473c88f9SBruce Richardson 			u8 llpr_smrr_err:1;
1400473c88f9SBruce Richardson 			/* Req with Address violating second SMM Range */
1401473c88f9SBruce Richardson 			u8 llpr_smrr2_err:1;
1402473c88f9SBruce Richardson 			/* Req with Address violating ME Stolen message */
1403473c88f9SBruce Richardson 			u8 llpr_mesg_err:1;
1404473c88f9SBruce Richardson 			/* Req with Address violating Generic Protected Range */
1405473c88f9SBruce Richardson 			u8 genprot_range_err:1;
1406473c88f9SBruce Richardson 			/* Req with Address violating Legacy Range low */
1407473c88f9SBruce Richardson 			u8 legrange_low_err:1;
1408473c88f9SBruce Richardson 			/* Req with Address violating Legacy Range High */
1409473c88f9SBruce Richardson 			u8 legrange_high_err:1;
1410473c88f9SBruce Richardson 			/* Req with Address violating VGA memory range */
1411473c88f9SBruce Richardson 			u8 vgmem_range_err:1;
1412473c88f9SBruce Richardson 			u8 page_fault_err:1;		/* Page fault */
1413473c88f9SBruce Richardson 			u8 pmr_err:1;			/* PMR Error */
1414473c88f9SBruce Richardson 			u8 ap6_event:1;			/* AP6 event */
1415473c88f9SBruce Richardson 			/* VF FLR detected on Port with PF access control */
1416473c88f9SBruce Richardson 			u8 vfflr_access_err:1;
1417473c88f9SBruce Richardson 			u16 rsvd5:12;			/* Reserved */
1418473c88f9SBruce Richardson 		};
1419473c88f9SBruce Richardson 	};
1420473c88f9SBruce Richardson };
1421473c88f9SBruce Richardson 
1422473c88f9SBruce Richardson /* Port first error register, not contain all error bits in error register. */
1423473c88f9SBruce Richardson struct feature_port_first_err_key {
1424473c88f9SBruce Richardson 	union {
1425473c88f9SBruce Richardson 		u64 csr;
1426473c88f9SBruce Richardson 		struct {
1427473c88f9SBruce Richardson 			u8 tx_ch0_overflow:1;
1428473c88f9SBruce Richardson 			u8 tx_ch0_invaldreq :1;
1429473c88f9SBruce Richardson 			u8 tx_ch0_cl_len3:1;
1430473c88f9SBruce Richardson 			u8 tx_ch0_cl_len2:1;
1431473c88f9SBruce Richardson 			u8 tx_ch0_cl_len4:1;
1432473c88f9SBruce Richardson 			u8 rsvd1:4;			/* Reserved */
1433473c88f9SBruce Richardson 			u8 mmio_rd_whilerst:1;
1434473c88f9SBruce Richardson 			u8 mmio_wr_whilerst:1;
1435473c88f9SBruce Richardson 			u8 rsvd2:5;			/* Reserved */
1436473c88f9SBruce Richardson 			u8 tx_ch1_overflow:1;
1437473c88f9SBruce Richardson 			u8 tx_ch1_invaldreq:1;
1438473c88f9SBruce Richardson 			u8 tx_ch1_cl_len3:1;
1439473c88f9SBruce Richardson 			u8 tx_ch1_cl_len2:1;
1440473c88f9SBruce Richardson 			u8 tx_ch1_cl_len4:1;
1441473c88f9SBruce Richardson 			u8 tx_ch1_insuff_data:1;
1442473c88f9SBruce Richardson 			u8 tx_ch1_data_overrun:1;
1443473c88f9SBruce Richardson 			u8 tx_ch1_incorr_addr:1;
1444473c88f9SBruce Richardson 			u8 tx_ch1_nzsop:1;
1445473c88f9SBruce Richardson 			u8 tx_ch1_illegal_vcsel:1;
1446473c88f9SBruce Richardson 			u8 rsvd3:6;			/* Reserved */
1447473c88f9SBruce Richardson 			u8 mmioread_timeout:1;
1448473c88f9SBruce Richardson 			u8 tx_ch2_fifo_overflow:1;
1449473c88f9SBruce Richardson 			u8 rsvd4:6;			/* Reserved */
1450473c88f9SBruce Richardson 			u8 tx_req_counter_overflow:1;
1451473c88f9SBruce Richardson 			u32 rsvd5:23;			/* Reserved */
1452473c88f9SBruce Richardson 		};
1453473c88f9SBruce Richardson 	};
1454473c88f9SBruce Richardson };
1455473c88f9SBruce Richardson 
1456473c88f9SBruce Richardson /* Port malformed Req0 */
1457473c88f9SBruce Richardson struct feature_port_malformed_req0 {
1458473c88f9SBruce Richardson 	u64 header_lsb;
1459473c88f9SBruce Richardson };
1460473c88f9SBruce Richardson 
1461473c88f9SBruce Richardson /* Port malformed Req1 */
1462473c88f9SBruce Richardson struct feature_port_malformed_req1 {
1463473c88f9SBruce Richardson 	u64 header_msb;
1464473c88f9SBruce Richardson };
1465473c88f9SBruce Richardson 
1466473c88f9SBruce Richardson /* Port debug register */
1467473c88f9SBruce Richardson struct feature_port_debug {
1468473c88f9SBruce Richardson 	u64 port_debug;
1469473c88f9SBruce Richardson };
1470473c88f9SBruce Richardson 
1471473c88f9SBruce Richardson /* Port error capabilities */
1472473c88f9SBruce Richardson struct feature_port_err_capability {
1473473c88f9SBruce Richardson 	union {
1474473c88f9SBruce Richardson 		u64 csr;
1475473c88f9SBruce Richardson 		struct {
1476473c88f9SBruce Richardson 			u8  support_intr:1;
1477473c88f9SBruce Richardson 			/* MSI-X vector table entry number */
1478473c88f9SBruce Richardson 			u16 intr_vector_num:12;
1479473c88f9SBruce Richardson 			u64 rsvd:51;            /* Reserved */
1480473c88f9SBruce Richardson 		};
1481473c88f9SBruce Richardson 	};
1482473c88f9SBruce Richardson };
1483473c88f9SBruce Richardson 
1484473c88f9SBruce Richardson /* PORT FEATURE ERROR */
1485473c88f9SBruce Richardson struct feature_port_error {
1486473c88f9SBruce Richardson 	struct feature_header header;
1487473c88f9SBruce Richardson 	struct feature_port_err_key error_mask;
1488473c88f9SBruce Richardson 	struct feature_port_err_key port_error;
1489473c88f9SBruce Richardson 	struct feature_port_first_err_key port_first_error;
1490473c88f9SBruce Richardson 	struct feature_port_malformed_req0 malreq0;
1491473c88f9SBruce Richardson 	struct feature_port_malformed_req1 malreq1;
1492473c88f9SBruce Richardson 	struct feature_port_debug port_debug;
1493473c88f9SBruce Richardson 	struct feature_port_err_capability error_capability;
1494473c88f9SBruce Richardson };
1495473c88f9SBruce Richardson 
1496473c88f9SBruce Richardson /* Port UMSG Capability */
1497473c88f9SBruce Richardson struct feature_port_umsg_cap {
1498473c88f9SBruce Richardson 	union {
1499473c88f9SBruce Richardson 		u64 csr;
1500473c88f9SBruce Richardson 		struct {
1501473c88f9SBruce Richardson 			/* Number of umsg allocated to this port */
1502473c88f9SBruce Richardson 			u8 umsg_allocated;
1503473c88f9SBruce Richardson 			/* Enable / Disable UMsg engine for this port */
1504473c88f9SBruce Richardson 			u8 umsg_enable:1;
1505473c88f9SBruce Richardson 			/* Usmg initialization status */
1506473c88f9SBruce Richardson 			u8 umsg_init_complete:1;
1507473c88f9SBruce Richardson 			/* IOMMU can not translate the umsg base address */
1508473c88f9SBruce Richardson 			u8 umsg_trans_error:1;
1509473c88f9SBruce Richardson 			u64 rsvd:53;		/* Reserved */
1510473c88f9SBruce Richardson 		};
1511473c88f9SBruce Richardson 	};
1512473c88f9SBruce Richardson };
1513473c88f9SBruce Richardson 
1514473c88f9SBruce Richardson /* Port UMSG base address */
1515473c88f9SBruce Richardson struct feature_port_umsg_baseaddr {
1516473c88f9SBruce Richardson 	union {
1517473c88f9SBruce Richardson 		u64 csr;
1518473c88f9SBruce Richardson 		struct {
1519473c88f9SBruce Richardson 			u64 base_addr:48;	/* 48 bit physical address */
1520473c88f9SBruce Richardson 			u16 rsvd;		/* Reserved */
1521473c88f9SBruce Richardson 		};
1522473c88f9SBruce Richardson 	};
1523473c88f9SBruce Richardson };
1524473c88f9SBruce Richardson 
1525473c88f9SBruce Richardson struct feature_port_umsg_mode {
1526473c88f9SBruce Richardson 	union {
1527473c88f9SBruce Richardson 		u64 csr;
1528473c88f9SBruce Richardson 		struct {
1529473c88f9SBruce Richardson 			u32 umsg_hint_enable;	/* UMSG hint enable/disable */
1530473c88f9SBruce Richardson 			u32 rsvd;		/* Reserved */
1531473c88f9SBruce Richardson 		};
1532473c88f9SBruce Richardson 	};
1533473c88f9SBruce Richardson };
1534473c88f9SBruce Richardson 
1535473c88f9SBruce Richardson /* PORT FEATURE UMSG */
1536473c88f9SBruce Richardson struct feature_port_umsg {
1537473c88f9SBruce Richardson 	struct feature_header header;
1538473c88f9SBruce Richardson 	struct feature_port_umsg_cap capability;
1539473c88f9SBruce Richardson 	struct feature_port_umsg_baseaddr baseaddr;
1540473c88f9SBruce Richardson 	struct feature_port_umsg_mode mode;
1541473c88f9SBruce Richardson };
1542473c88f9SBruce Richardson 
1543473c88f9SBruce Richardson #define UMSG_EN_POLL_INVL 10 /* us */
1544473c88f9SBruce Richardson #define UMSG_EN_POLL_TIMEOUT 1000 /* us */
1545473c88f9SBruce Richardson 
1546473c88f9SBruce Richardson /* Port UINT Capability */
1547473c88f9SBruce Richardson struct feature_port_uint_cap {
1548473c88f9SBruce Richardson 	union {
1549473c88f9SBruce Richardson 		u64 csr;
1550473c88f9SBruce Richardson 		struct {
1551473c88f9SBruce Richardson 			u16 intr_num:12;	/* Supported interrupts num */
1552473c88f9SBruce Richardson 			/* First MSI-X vector table entry number */
1553473c88f9SBruce Richardson 			u16 first_vec_num:12;
1554473c88f9SBruce Richardson 			u64 rsvd:40;
1555473c88f9SBruce Richardson 		};
1556473c88f9SBruce Richardson 	};
1557473c88f9SBruce Richardson };
1558473c88f9SBruce Richardson 
1559473c88f9SBruce Richardson /* PORT FEATURE UINT */
1560473c88f9SBruce Richardson struct feature_port_uint {
1561473c88f9SBruce Richardson 	struct feature_header header;
1562473c88f9SBruce Richardson 	struct feature_port_uint_cap capability;
1563473c88f9SBruce Richardson };
1564473c88f9SBruce Richardson 
1565473c88f9SBruce Richardson /* STP region supports mmap operation, so use page aligned size. */
1566473c88f9SBruce Richardson #define PORT_FEATURE_STP_REGION_SIZE \
1567473c88f9SBruce Richardson 	IFPGA_PAGE_ALIGN(sizeof(struct feature_port_stp))
1568473c88f9SBruce Richardson 
1569473c88f9SBruce Richardson /* Port STP status register (for debug only)*/
1570473c88f9SBruce Richardson struct feature_port_stp_status {
1571473c88f9SBruce Richardson 	union {
1572473c88f9SBruce Richardson 		u64 csr;
1573473c88f9SBruce Richardson 		struct {
1574473c88f9SBruce Richardson 			/* SLD Hub end-point read/write timeout */
1575473c88f9SBruce Richardson 			u8 sld_ep_timeout:1;
1576473c88f9SBruce Richardson 			/* Remote STP in reset/disable */
1577473c88f9SBruce Richardson 			u8 rstp_disabled:1;
1578473c88f9SBruce Richardson 			u8 unsupported_read:1;
1579473c88f9SBruce Richardson 			/* MMIO timeout detected and faked with a response */
1580473c88f9SBruce Richardson 			u8 mmio_timeout:1;
1581473c88f9SBruce Richardson 			u8 txfifo_count:4;
1582473c88f9SBruce Richardson 			u8 rxfifo_count:4;
1583473c88f9SBruce Richardson 			u8 txfifo_overflow:1;
1584473c88f9SBruce Richardson 			u8 txfifo_underflow:1;
1585473c88f9SBruce Richardson 			u8 rxfifo_overflow:1;
1586473c88f9SBruce Richardson 			u8 rxfifo_underflow:1;
1587473c88f9SBruce Richardson 			/* Number of MMIO write requests */
1588473c88f9SBruce Richardson 			u16 write_requests;
1589473c88f9SBruce Richardson 			/* Number of MMIO read requests */
1590473c88f9SBruce Richardson 			u16 read_requests;
1591473c88f9SBruce Richardson 			/* Number of MMIO read responses */
1592473c88f9SBruce Richardson 			u16 read_responses;
1593473c88f9SBruce Richardson 		};
1594473c88f9SBruce Richardson 	};
1595473c88f9SBruce Richardson };
1596473c88f9SBruce Richardson 
1597473c88f9SBruce Richardson /*
1598473c88f9SBruce Richardson  * PORT FEATURE STP
1599473c88f9SBruce Richardson  * Most registers in STP region are not touched by driver, but mmapped to user
1600473c88f9SBruce Richardson  * space. So they are not defined in below data structure, as its actual size
1601473c88f9SBruce Richardson  * is 0x18c per spec.
1602473c88f9SBruce Richardson  */
1603473c88f9SBruce Richardson struct feature_port_stp {
1604473c88f9SBruce Richardson 	struct feature_header header;
1605473c88f9SBruce Richardson 	struct feature_port_stp_status stp_status;
1606473c88f9SBruce Richardson };
1607473c88f9SBruce Richardson 
1608473c88f9SBruce Richardson /**
1609473c88f9SBruce Richardson  * enum fpga_pr_states - fpga PR states
1610473c88f9SBruce Richardson  * @FPGA_PR_STATE_UNKNOWN: can't determine state
1611473c88f9SBruce Richardson  * @FPGA_PR_STATE_WRITE_INIT: preparing FPGA for programming
1612473c88f9SBruce Richardson  * @FPGA_PR_STATE_WRITE_INIT_ERR: Error during WRITE_INIT stage
1613473c88f9SBruce Richardson  * @FPGA_PR_STATE_WRITE: writing image to FPGA
1614473c88f9SBruce Richardson  * @FPGA_PR_STATE_WRITE_ERR: Error while writing FPGA
1615473c88f9SBruce Richardson  * @FPGA_PR_STATE_WRITE_COMPLETE: Doing post programming steps
1616473c88f9SBruce Richardson  * @FPGA_PR_STATE_WRITE_COMPLETE_ERR: Error during WRITE_COMPLETE
1617473c88f9SBruce Richardson  * @FPGA_PR_STATE_OPERATING: FPGA PR done
1618473c88f9SBruce Richardson  */
1619473c88f9SBruce Richardson enum fpga_pr_states {
1620473c88f9SBruce Richardson 	/* canot determine state states */
1621473c88f9SBruce Richardson 	FPGA_PR_STATE_UNKNOWN,
1622473c88f9SBruce Richardson 
1623473c88f9SBruce Richardson 	/* write sequence: init, write, complete */
1624473c88f9SBruce Richardson 	FPGA_PR_STATE_WRITE_INIT,
1625473c88f9SBruce Richardson 	FPGA_PR_STATE_WRITE_INIT_ERR,
1626473c88f9SBruce Richardson 	FPGA_PR_STATE_WRITE,
1627473c88f9SBruce Richardson 	FPGA_PR_STATE_WRITE_ERR,
1628473c88f9SBruce Richardson 	FPGA_PR_STATE_WRITE_COMPLETE,
1629473c88f9SBruce Richardson 	FPGA_PR_STATE_WRITE_COMPLETE_ERR,
1630473c88f9SBruce Richardson 
1631473c88f9SBruce Richardson 	/* FPGA PR done */
1632473c88f9SBruce Richardson 	FPGA_PR_STATE_DONE,
1633473c88f9SBruce Richardson };
1634473c88f9SBruce Richardson 
1635473c88f9SBruce Richardson /*
1636473c88f9SBruce Richardson  * FPGA Manager flags
1637473c88f9SBruce Richardson  * FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
1638473c88f9SBruce Richardson  */
1639473c88f9SBruce Richardson #define FPGA_MGR_PARTIAL_RECONFIG	BIT(0)
1640473c88f9SBruce Richardson 
1641473c88f9SBruce Richardson /**
1642473c88f9SBruce Richardson  * struct fpga_pr_info - specific information to a FPGA PR
1643473c88f9SBruce Richardson  * @flags: boolean flags as defined above
1644473c88f9SBruce Richardson  * @pr_err: PR error code
1645473c88f9SBruce Richardson  * @state: fpga manager state
1646473c88f9SBruce Richardson  * @port_id: port id
1647473c88f9SBruce Richardson  */
1648473c88f9SBruce Richardson struct fpga_pr_info {
1649473c88f9SBruce Richardson 	u32 flags;
1650473c88f9SBruce Richardson 	u64 pr_err;
1651473c88f9SBruce Richardson 	enum fpga_pr_states state;
1652473c88f9SBruce Richardson 	int port_id;
1653473c88f9SBruce Richardson };
1654473c88f9SBruce Richardson 
1655473c88f9SBruce Richardson #define DEFINE_FPGA_PR_ERR_MSG(_name_)			\
1656473c88f9SBruce Richardson static const char * const _name_[] = {			\
1657473c88f9SBruce Richardson 	"PR operation error detected",			\
1658473c88f9SBruce Richardson 	"PR CRC error detected",			\
1659473c88f9SBruce Richardson 	"PR incompatiable bitstream error detected",	\
1660473c88f9SBruce Richardson 	"PR IP protocol error detected",		\
1661473c88f9SBruce Richardson 	"PR FIFO overflow error detected",		\
1662473c88f9SBruce Richardson 	"PR timeout error detected",			\
1663473c88f9SBruce Richardson 	"PR secure load error detected",		\
1664473c88f9SBruce Richardson }
1665473c88f9SBruce Richardson 
1666473c88f9SBruce Richardson #define RST_POLL_INVL 10 /* us */
1667473c88f9SBruce Richardson #define RST_POLL_TIMEOUT 1000 /* us */
1668473c88f9SBruce Richardson 
1669473c88f9SBruce Richardson #define PR_WAIT_TIMEOUT   15000000
1670473c88f9SBruce Richardson 
1671473c88f9SBruce Richardson #define PR_HOST_STATUS_IDLE	0
1672473c88f9SBruce Richardson #define PR_MAX_ERR_NUM	7
1673473c88f9SBruce Richardson 
1674473c88f9SBruce Richardson DEFINE_FPGA_PR_ERR_MSG(pr_err_msg);
1675473c88f9SBruce Richardson 
1676473c88f9SBruce Richardson /*
1677473c88f9SBruce Richardson  * green bitstream header must be byte-packed to match the
1678473c88f9SBruce Richardson  * real file format.
1679473c88f9SBruce Richardson  */
1680473c88f9SBruce Richardson struct bts_header {
1681473c88f9SBruce Richardson 	u64 guid_h;
1682473c88f9SBruce Richardson 	u64 guid_l;
1683473c88f9SBruce Richardson 	u32 metadata_len;
1684473c88f9SBruce Richardson };
1685473c88f9SBruce Richardson 
1686473c88f9SBruce Richardson #define GBS_GUID_H		0x414750466e6f6558
1687473c88f9SBruce Richardson #define GBS_GUID_L		0x31303076534247b7
1688473c88f9SBruce Richardson #define is_valid_bts(bts_hdr)				\
1689473c88f9SBruce Richardson 	(((bts_hdr)->guid_h == GBS_GUID_H) &&		\
1690473c88f9SBruce Richardson 	((bts_hdr)->guid_l == GBS_GUID_L))
1691473c88f9SBruce Richardson 
1692c127953fSTianfei Zhang #define check_support(n) (n == 1 ? "support" : "no")
1693c127953fSTianfei Zhang 
1694473c88f9SBruce Richardson enum board_interface {
1695473c88f9SBruce Richardson 	VC_8_10G = 0,
1696473c88f9SBruce Richardson 	VC_4_25G = 1,
1697473c88f9SBruce Richardson 	VC_2_1_25 = 2,
1698473c88f9SBruce Richardson 	VC_4_25G_2_25G = 3,
1699473c88f9SBruce Richardson 	VC_2_2_25G = 4,
1700473c88f9SBruce Richardson };
1701473c88f9SBruce Richardson 
1702*7c4fe2adSWei Huang enum fim_type {
1703*7c4fe2adSWei Huang 	BASE_ADP = 0,
1704*7c4fe2adSWei Huang 	BASE_FDK,
1705*7c4fe2adSWei Huang 	BASE_X16_ADP,
1706*7c4fe2adSWei Huang 	BASE_X16_FDK,
1707*7c4fe2adSWei Huang 	FIMA_10G_ADP,
1708*7c4fe2adSWei Huang 	FIMA_25G_ADP,
1709*7c4fe2adSWei Huang 	FIMA_100G_ADP,
1710*7c4fe2adSWei Huang 	FIMB_ADP,
1711*7c4fe2adSWei Huang 	FIMC_ADP
1712*7c4fe2adSWei Huang };
1713*7c4fe2adSWei Huang 
1714*7c4fe2adSWei Huang enum hssi_id {
1715*7c4fe2adSWei Huang 	NO_HSSI = 0,
1716*7c4fe2adSWei Huang 	PCIE_RP,
1717*7c4fe2adSWei Huang 	ETHER_NET
1718*7c4fe2adSWei Huang };
1719*7c4fe2adSWei Huang 
1720c127953fSTianfei Zhang enum pac_major {
1721c127953fSTianfei Zhang 	VISTA_CREEK = 0,
1722c127953fSTianfei Zhang 	RUSH_CREEK = 1,
1723c127953fSTianfei Zhang 	DARBY_CREEK = 2,
1724*7c4fe2adSWei Huang 	LIGHTNING_CREEK = 3,
1725*7c4fe2adSWei Huang 	ARROW_CREEK = 5,
1726c127953fSTianfei Zhang };
1727c127953fSTianfei Zhang 
1728c127953fSTianfei Zhang enum pac_minor {
1729c127953fSTianfei Zhang 	DCP_1_0 = 0,
1730c127953fSTianfei Zhang 	DCP_1_1 = 1,
1731c127953fSTianfei Zhang 	DCP_1_2 = 2,
1732c127953fSTianfei Zhang };
1733c127953fSTianfei Zhang 
1734c127953fSTianfei Zhang struct opae_board_info {
1735c127953fSTianfei Zhang 	enum pac_major major;
1736c127953fSTianfei Zhang 	enum pac_minor minor;
1737c127953fSTianfei Zhang 
1738*7c4fe2adSWei Huang 	u32 boot_page;
1739*7c4fe2adSWei Huang 	u32 max10_version;
1740*7c4fe2adSWei Huang 	u32 nios_fw_version;
1741*7c4fe2adSWei Huang 
1742*7c4fe2adSWei Huang 	union {
1743*7c4fe2adSWei Huang 		struct {  /* N3000 specific */
1744*7c4fe2adSWei Huang 			enum board_interface type;
1745c127953fSTianfei Zhang 			u8 fvl_bypass;
1746c127953fSTianfei Zhang 			u8 mac_lightweight;
1747c127953fSTianfei Zhang 			u8 disaggregate;
1748c127953fSTianfei Zhang 			u8 lightweight;
1749c127953fSTianfei Zhang 			u8 seu;
1750c127953fSTianfei Zhang 			u8 ptp;
1751473c88f9SBruce Richardson 			u32 nums_of_retimer;
1752473c88f9SBruce Richardson 			u32 ports_per_retimer;
1753473c88f9SBruce Richardson 			u32 nums_of_fvl;
1754473c88f9SBruce Richardson 			u32 ports_per_fvl;
1755473c88f9SBruce Richardson 		};
1756*7c4fe2adSWei Huang 		struct {
1757*7c4fe2adSWei Huang 			enum fim_type n6000_fim_type;
1758*7c4fe2adSWei Huang 			enum hssi_id n6000_hssi_id;
1759*7c4fe2adSWei Huang 		};
1760*7c4fe2adSWei Huang 	};
1761*7c4fe2adSWei Huang };
1762473c88f9SBruce Richardson 
1763473c88f9SBruce Richardson #pragma pack(pop)
1764473c88f9SBruce Richardson #endif /* _BASE_IFPGA_DEFINES_H_ */
1765