1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2018 Intel Corporation
5 #ifndef _IFPGA_DEFINES_H_
6 #define _IFPGA_DEFINES_H_
8 #include "ifpga_compat.h"
10 #define MAX_FPGA_PORT_NUM 4
12 #define FME_FEATURE_HEADER "fme_hdr"
13 #define FME_FEATURE_THERMAL_MGMT "fme_thermal"
14 #define FME_FEATURE_POWER_MGMT "fme_power"
15 #define FME_FEATURE_GLOBAL_IPERF "fme_iperf"
16 #define FME_FEATURE_GLOBAL_ERR "fme_error"
17 #define FME_FEATURE_PR_MGMT "fme_pr"
18 #define FME_FEATURE_EMIF_MGMT "fme_emif"
19 #define FME_FEATURE_HSSI_ETH "fme_hssi"
20 #define FME_FEATURE_GLOBAL_DPERF "fme_dperf"
21 #define FME_FEATURE_QSPI_FLASH "fme_qspi_flash"
22 #define FME_FEATURE_MAX10_SPI "fme_max10_spi"
23 #define FME_FEATURE_NIOS_SPI "fme_nios_spi"
24 #define FME_FEATURE_I2C_MASTER "fme_i2c_master"
25 #define FME_FEATURE_ETH_GROUP "fme_eth_group"
27 #define PORT_FEATURE_HEADER "port_hdr"
28 #define PORT_FEATURE_UAFU "port_uafu"
29 #define PORT_FEATURE_ERR "port_err"
30 #define PORT_FEATURE_UMSG "port_umsg"
31 #define PORT_FEATURE_PR "port_pr"
32 #define PORT_FEATURE_UINT "port_uint"
33 #define PORT_FEATURE_STP "port_stp"
36 * do not check the revision id as id may be dynamic under
37 * some cases, e.g, UAFU.
39 #define SKIP_REVISION_CHECK 0xff
41 #define FME_HEADER_REVISION 1
42 #define FME_THERMAL_MGMT_REVISION 0
43 #define FME_POWER_MGMT_REVISION 1
44 #define FME_GLOBAL_IPERF_REVISION 1
45 #define FME_GLOBAL_ERR_REVISION 1
46 #define FME_PR_MGMT_REVISION 2
47 #define FME_HSSI_ETH_REVISION 0
48 #define FME_GLOBAL_DPERF_REVISION 0
49 #define FME_QSPI_REVISION 0
50 #define FME_MAX10_SPI 0
51 #define FME_I2C_MASTER 0
53 #define PORT_HEADER_REVISION 0
54 /* UAFU's header info depends on the downloaded GBS */
55 #define PORT_UAFU_REVISION SKIP_REVISION_CHECK
56 #define PORT_ERR_REVISION 1
57 #define PORT_UMSG_REVISION 0
58 #define PORT_UINT_REVISION 0
59 #define PORT_STP_REVISION 1
61 #define FEATURE_TYPE_AFU 0x1
62 #define FEATURE_TYPE_BBB 0x2
63 #define FEATURE_TYPE_PRIVATE 0x3
64 #define FEATURE_TYPE_FIU 0x4
66 #define FEATURE_FIU_ID_FME 0x0
67 #define FEATURE_FIU_ID_PORT 0x1
69 /* Reserved 0xfe for Header, 0xff for AFU*/
70 #define FEATURE_ID_FIU_HEADER 0xfe
71 #define FEATURE_ID_AFU 0xff
79 #define FME_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
80 #define FME_FEATURE_ID_THERMAL_MGMT 0x1
81 #define FME_FEATURE_ID_POWER_MGMT 0x2
82 #define FME_FEATURE_ID_GLOBAL_IPERF 0x3
83 #define FME_FEATURE_ID_GLOBAL_ERR 0x4
84 #define FME_FEATURE_ID_PR_MGMT 0x5
85 #define FME_FEATURE_ID_HSSI_ETH 0x6
86 #define FME_FEATURE_ID_GLOBAL_DPERF 0x7
87 #define FME_FEATURE_ID_QSPI_FLASH 0x8
88 #define FME_FEATURE_ID_EMIF_MGMT 0x9
89 #define FME_FEATURE_ID_MAX10_SPI 0xe
90 #define FME_FEATURE_ID_NIOS_SPI 0xd
91 #define FME_FEATURE_ID_I2C_MASTER 0xf
92 #define FME_FEATURE_ID_ETH_GROUP 0x10
94 #define PORT_FEATURE_ID_HEADER FEATURE_ID_FIU_HEADER
95 #define PORT_FEATURE_ID_ERROR 0x10
96 #define PORT_FEATURE_ID_UMSG 0x12
97 #define PORT_FEATURE_ID_UINT 0x13
98 #define PORT_FEATURE_ID_STP 0x14
99 #define PORT_FEATURE_ID_UAFU FEATURE_ID_AFU
102 * All headers and structures must be byte-packed to match the spec.
104 #pragma pack(push, 1)
106 struct feature_header {
112 u32 next_header_offset:24;
120 struct feature_bbb_header {
124 struct feature_afu_header {
135 struct feature_fiu_header {
146 struct feature_fme_capability {
150 u8 fabric_verid; /* Fabric version ID */
151 u8 socket_id:1; /* Socket id */
152 u8 rsvd1:3; /* Reserved */
153 /* pci0 link available yes /no */
154 u8 pci0_link_avile:1;
155 /* pci1 link available yes /no */
156 u8 pci1_link_avile:1;
157 /* Coherent (QPI/UPI) link available yes /no */
159 u8 rsvd2:1; /* Reserved */
160 /* IOMMU or VT-d supported yes/no */
162 u8 num_ports:3; /* Number of ports */
163 u8 sf_fab_ctl:1; /* Internal validation bit */
164 u8 rsvd3:3; /* Reserved */
166 * Address width supported in bits
167 * BXT -0x26 , SKX -0x30
169 u8 address_width_bits:6;
170 u8 rsvd4:2; /* Reserved */
171 /* Size of cache supported in kb */
173 u8 cache_assoc:4; /* Cache Associativity */
174 u16 rsvd5:15; /* Reserved */
175 u8 lock_bit:1; /* Lock bit */
180 #define FME_AFU_ACCESS_PF 0
181 #define FME_AFU_ACCESS_VF 1
183 struct feature_fme_port {
191 u8 afu_access_control:1;
193 u8 port_implemented:1;
199 struct feature_fme_fab_status {
203 u8 upilink_status:4; /* UPI Link Status */
204 u8 rsvd1:4; /* Reserved */
205 u8 pci0link_status:1; /* pci0 link status */
206 u8 rsvd2:3; /* Reserved */
207 u8 pci1link_status:1; /* pci1 link status */
208 u64 rsvd3:51; /* Reserved */
213 struct feature_fme_genprotrange2_base {
217 u16 rsvd1; /* Reserved */
218 /* Base Address of memory range */
219 u8 protected_base_addrss:4;
220 u64 rsvd2:44; /* Reserved */
225 struct feature_fme_genprotrange2_limit {
229 u16 rsvd1; /* Reserved */
230 /* Limit Address of memory range */
231 u8 protected_limit_addrss:4;
232 u16 rsvd2:11; /* Reserved */
233 u8 enable:1; /* Enable GENPROTRANGE check */
234 u32 rsvd3; /* Reserved */
239 struct feature_fme_dxe_lock {
244 * Determines write access to the DXE region CSRs
245 * 1 - CSR region is locked;
246 * 0 - it is open for write access.
250 * Determines write access to the HSSI CSR
251 * 1 - CSR region is locked;
252 * 0 - it is open for write access.
260 #define HSSI_ID_NO_HASSI 0
261 #define HSSI_ID_PCIE_RP 1
262 #define HSSI_ID_ETHERNET 2
264 struct feature_fme_bitstream_id {
268 u32 gitrepo_hash:32; /* GIT repository hash */
270 * HSSI configuration identifier:
276 u16 rsvd1:12; /* Reserved */
277 /* Bitstream version patch number */
279 /* Bitstream version minor number */
281 /* Bitstream version major number */
283 /* Bitstream version debug number */
289 struct feature_fme_bitstream_md {
293 /* Seed number userd for synthesis flow */
295 /* Synthesis date(day number - 2 digits) */
297 /* Synthesis date(month number - 2 digits) */
299 /* Synthesis date(year number - 2 digits) */
301 u64 rsvd:36; /* Reserved */
306 struct feature_fme_iommu_ctrl {
310 /* Disables IOMMU prefetcher for C0 channel */
311 u8 prefetch_disableC0:1;
312 /* Disables IOMMU prefetcher for C1 channel */
313 u8 prefetch_disableC1:1;
314 /* Disables IOMMU partial cache line writes */
315 u8 prefetch_wrdisable:1;
316 u8 rsvd1:1; /* Reserved */
318 * Select counter and read value from register
319 * iommu_stat.dbg_counters
320 * 0 - Number of 4K page translation response
321 * 1 - Number of 2M page translation response
322 * 2 - Number of 1G page translation response
325 u32 rsvd2:26; /* Reserved */
326 /* Connected to IOMMU SIP Capabilities */
327 u32 capecap_defeature;
332 struct feature_fme_iommu_stat {
336 /* Translation Enable bit from IOMMU SIP */
337 u8 translation_enable:1;
338 /* Drain request in progress */
339 u8 drain_req_inprog:1;
340 /* Invalidation current state */
342 /* C0 Response Buffer current state */
343 u8 respbuffer_stateC0:3;
344 /* C1 Response Buffer current state */
345 u8 respbuffer_stateC1:3;
346 /* Last request ID to IOMMU SIP */
348 /* Last IOMMU SIP response ID value */
350 /* Last IOMMU SIP response status value */
351 u8 last_respstatus:3;
352 /* C0 Transaction Buffer is not empty */
353 u8 transbuf_notEmptyC0:1;
354 /* C1 Transaction Buffer is not empty */
355 u8 transbuf_notEmptyC1:1;
356 /* C0 Request FIFO is not empty */
357 u8 reqFIFO_notemptyC0:1;
358 /* C1 Request FIFO is not empty */
359 u8 reqFIFO_notemptyC1:1;
360 /* C0 Response FIFO is not empty */
361 u8 respFIFO_notemptyC0:1;
362 /* C1 Response FIFO is not empty */
363 u8 respFIFO_notemptyC1:1;
364 /* C0 Response FIFO overflow detected */
365 u8 respFIFO_overflowC0:1;
366 /* C1 Response FIFO overflow detected */
367 u8 respFIFO_overflowC1:1;
368 /* C0 Transaction Buffer overflow detected */
369 u8 tranbuf_overflowC0:1;
370 /* C1 Transaction Buffer overflow detected */
371 u8 tranbuf_overflowC1:1;
372 /* Request FIFO overflow detected */
373 u8 reqFIFO_overflow:1;
374 /* IOMMU memory read in progress */
376 /* IOMMU memory write in progress */
378 u8 rsvd1:1; /* Reserved */
379 /* Value of counter selected by iommu_ctl.counter_sel */
381 u16 rsvd2:12; /* Reserved */
386 struct feature_fme_pcie0_ctrl {
390 u64 vtd_bar_lock:1; /* Lock VT-D BAR register */
392 u64 rciep:1; /* Configure PCIE0 as RCiEP */
398 struct feature_fme_llpr_smrr_base {
403 u64 base:20; /* SMRR2 memory range base address */
409 struct feature_fme_llpr_smrr_mask {
414 u64 valid:1; /* LLPR_SMRR rule is valid or not */
416 * SMRR memory range mask which determines the range
417 * of region being mapped
425 struct feature_fme_llpr_smrr2_base {
430 u64 base:20; /* SMRR2 memory range base address */
436 struct feature_fme_llpr_smrr2_mask {
441 u64 valid:1; /* LLPR_SMRR2 rule is valid or not */
443 * SMRR2 memory range mask which determines the range
444 * of region being mapped
452 struct feature_fme_llpr_meseg_base {
456 /* A[45:19] of base address memory range */
463 struct feature_fme_llpr_meseg_limit {
467 /* A[45:19] of limit address memory range */
470 u64 enable:1; /* Enable LLPR MESEG rule */
476 struct feature_fme_header {
477 struct feature_header header;
478 struct feature_afu_header afu_header;
481 struct feature_fme_capability capability;
482 struct feature_fme_port port[MAX_FPGA_PORT_NUM];
483 struct feature_fme_fab_status fab_status;
484 struct feature_fme_bitstream_id bitstream_id;
485 struct feature_fme_bitstream_md bitstream_md;
486 struct feature_fme_genprotrange2_base genprotrange2_base;
487 struct feature_fme_genprotrange2_limit genprotrange2_limit;
488 struct feature_fme_dxe_lock dxe_lock;
489 struct feature_fme_iommu_ctrl iommu_ctrl;
490 struct feature_fme_iommu_stat iommu_stat;
491 struct feature_fme_pcie0_ctrl pcie0_control;
492 struct feature_fme_llpr_smrr_base smrr_base;
493 struct feature_fme_llpr_smrr_mask smrr_mask;
494 struct feature_fme_llpr_smrr2_base smrr2_base;
495 struct feature_fme_llpr_smrr2_mask smrr2_mask;
496 struct feature_fme_llpr_meseg_base meseg_base;
497 struct feature_fme_llpr_meseg_limit meseg_limit;
500 struct feature_port_capability {
504 u8 port_number:2; /* Port Number 0-3 */
505 u8 rsvd1:6; /* Reserved */
506 u16 mmio_size; /* User MMIO size in KB */
507 u8 rsvd2; /* Reserved */
508 u8 sp_intr_num:4; /* Supported interrupts num */
509 u32 rsvd3:28; /* Reserved */
514 struct feature_port_control {
518 u8 port_sftrst:1; /* Port Soft Reset */
519 u8 rsvd1:1; /* Reserved */
520 u8 latency_tolerance:1;/* '1' >= 40us, '0' < 40us */
521 u8 rsvd2:1; /* Reserved */
522 u8 port_sftrst_ack:1; /* HW ACK for Soft Reset */
523 u64 rsvd3:59; /* Reserved */
528 #define PORT_POWER_STATE_NORMAL 0
529 #define PORT_POWER_STATE_AP1 1
530 #define PORT_POWER_STATE_AP2 2
531 #define PORT_POWER_STATE_AP6 6
533 struct feature_port_status {
537 u8 port_freeze:1; /* '1' - freezed '0' - normal */
538 u8 rsvd1:7; /* Reserved */
539 u8 power_state:4; /* Power State */
540 u8 ap1_event:1; /* AP1 event was detected */
541 u8 ap2_event:1; /* AP2 event was detected */
542 u64 rsvd2:50; /* Reserved */
547 /* Port Header Register Set */
548 struct feature_port_header {
549 struct feature_header header;
550 struct feature_afu_header afu_header;
553 struct feature_port_capability capability;
554 struct feature_port_control control;
555 struct feature_port_status status;
557 u64 user_clk_freq_cmd0;
558 u64 user_clk_freq_cmd1;
559 u64 user_clk_freq_sts0;
560 u64 user_clk_freq_sts1;
563 struct feature_fme_tmp_threshold {
567 u8 tmp_thshold1:7; /* temperature Threshold 1 */
568 /* temperature Threshold 1 enable/disable */
569 u8 tmp_thshold1_enable:1;
570 u8 tmp_thshold2:7; /* temperature Threshold 2 */
571 /* temperature Threshold 2 enable /disable */
572 u8 tmp_thshold2_enable:1;
573 u8 pro_hot_setpoint:7; /* Proc Hot set point */
574 u8 rsvd4:1; /* Reserved */
575 u8 therm_trip_thshold:7; /* Thermeal Trip Threshold */
576 u8 rsvd3:1; /* Reserved */
577 u8 thshold1_status:1; /* Threshold 1 Status */
578 u8 thshold2_status:1; /* Threshold 2 Status */
579 u8 rsvd5:1; /* Reserved */
580 /* Thermeal Trip Threshold status */
581 u8 therm_trip_thshold_status:1;
582 u8 rsvd6:4; /* Reserved */
583 /* Validation mode- Force Proc Hot */
585 /* Validation mode - Therm trip Hot */
587 u8 rsvd2:2; /* Reserved */
588 u8 thshold_policy:1; /* threshold policy */
589 u32 rsvd:19; /* Reserved */
594 /* Temperature Sensor Read values format 1 */
595 struct feature_fme_temp_rdsensor_fmt1 {
599 /* Reads out FPGA temperature in celsius */
601 u8 rsvd0:1; /* Reserved */
602 /* Temperature reading sequence number */
603 u16 tmp_reading_seq_num;
604 /* Temperature reading is valid */
605 u8 tmp_reading_valid:1;
606 u8 rsvd1:7; /* Reserved */
607 u16 dbg_mode:10; /* Debug mode */
608 u32 rsvd2:22; /* Reserved */
613 /* Temperature sensor read values format 2 */
614 struct feature_fme_temp_rdsensor_fmt2 {
615 u64 rsvd; /* Reserved */
618 /* Temperature Threshold Capability Register */
619 struct feature_fme_tmp_threshold_cap {
623 /* Temperature Threshold Unsupported */
624 u8 tmp_thshold_disabled:1;
625 u64 rsvd:63; /* Reserved */
630 /* FME THERNAL FEATURE */
631 struct feature_fme_thermal {
632 struct feature_header header;
633 struct feature_fme_tmp_threshold threshold;
634 struct feature_fme_temp_rdsensor_fmt1 rdsensor_fm1;
635 struct feature_fme_temp_rdsensor_fmt2 rdsensor_fm2;
636 struct feature_fme_tmp_threshold_cap threshold_cap;
639 /* Power Status register */
640 struct feature_fme_pm_status {
644 /* FPGA Power consumed, The format is to be defined */
646 /* FPGA Latency Tolerance Reporting */
647 u8 fpga_latency_report:1;
648 u64 rsvd:45; /* Reserved */
654 struct feature_fme_pm_ap_threshold {
659 * Number of clocks (5ns period) for assertion
666 u8 threshold1_status:1;
667 u8 threshold2_status:1;
668 u64 rsvd3:46; /* Reserved */
673 /* Xeon Power Limit */
674 struct feature_fme_pm_xeon_limit {
678 /* Power limit in Watts in 12.3 format */
680 /* Indicates that power limit has been written */
682 /* 0 - Turbe range, 1 - Entire range */
684 /* Time constant in XXYYY format */
686 u64 rsvd:40; /* Reserved */
691 /* FPGA Power Limit */
692 struct feature_fme_pm_fpga_limit {
696 /* Power limit in Watts in 12.3 format */
698 /* Indicates that power limit has been written */
700 /* 0 - Turbe range, 1 - Entire range */
702 /* Time constant in XXYYY format */
704 u64 rsvd:40; /* Reserved */
709 /* FME POWER FEATURE */
710 struct feature_fme_power {
711 struct feature_header header;
712 struct feature_fme_pm_status status;
713 struct feature_fme_pm_ap_threshold threshold;
714 struct feature_fme_pm_xeon_limit xeon_limit;
715 struct feature_fme_pm_fpga_limit fpga_limit;
718 #define CACHE_CHANNEL_RD 0
719 #define CACHE_CHANNEL_WR 1
721 enum iperf_cache_events {
726 IPERF_CACHE_RSVD, /* reserved */
727 IPERF_CACHE_HOLD_REQ,
728 IPERF_CACHE_DATA_WR_PORT_CONTEN,
729 IPERF_CACHE_TAG_WR_PORT_CONTEN,
730 IPERF_CACHE_TX_REQ_STALL,
731 IPERF_CACHE_RX_REQ_STALL,
732 IPERF_CACHE_EVICTIONS,
735 /* FPMON Cache Control */
736 struct feature_fme_ifpmon_ch_ctl {
740 u8 reset_counters:1; /* Reset Counters */
741 u8 rsvd1:7; /* Reserved */
742 u8 freeze:1; /* Freeze if set to 1 */
743 u8 rsvd2:7; /* Reserved */
744 u8 cache_event:4; /* Select the cache event */
745 u8 cci_chsel:1; /* Select the channel */
746 u64 rsvd3:43; /* Reserved */
751 /* FPMON Cache Counter */
752 struct feature_fme_ifpmon_ch_ctr {
756 /* Cache Counter for even addresse */
757 u64 cache_counter:48;
758 u16 rsvd:12; /* Reserved */
759 /* Cache Event being reported */
765 enum iperf_fab_events {
776 #define FAB_DISABLE_FILTER 0
777 #define FAB_ENABLE_FILTER 1
779 /* FPMON FAB Control */
780 struct feature_fme_ifpmon_fab_ctl {
784 u8 reset_counters:1; /* Reset Counters */
785 u8 rsvd:7; /* Reserved */
786 u8 freeze:1; /* Set to 1 frozen counter */
787 u8 rsvd1:7; /* Reserved */
788 u8 fab_evtcode:4; /* Fabric Event Code */
789 u8 port_id:2; /* Port ID */
790 u8 rsvd2:1; /* Reserved */
791 u8 port_filter:1; /* Port Filter */
792 u64 rsvd3:40; /* Reserved */
797 /* FPMON Event Counter */
798 struct feature_fme_ifpmon_fab_ctr {
802 u64 fab_cnt:60; /* Fabric event counter */
803 /* Fabric event code being reported */
809 /* FPMON Clock Counter */
810 struct feature_fme_ifpmon_clk_ctr {
811 u64 afu_interf_clock; /* Clk_16UI (AFU clock) counter. */
814 enum iperf_vtd_events {
815 IPERF_VTD_AFU_MEM_RD_TRANS,
816 IPERF_VTD_AFU_MEM_WR_TRANS,
817 IPERF_VTD_AFU_DEVTLB_RD_HIT,
818 IPERF_VTD_AFU_DEVTLB_WR_HIT,
819 IPERF_VTD_DEVTLB_4K_FILL,
820 IPERF_VTD_DEVTLB_2M_FILL,
821 IPERF_VTD_DEVTLB_1G_FILL,
824 /* VT-d control register */
825 struct feature_fme_ifpmon_vtd_ctl {
829 u8 reset_counters:1; /* Reset Counters */
830 u8 rsvd:7; /* Reserved */
831 u8 freeze:1; /* Set to 1 frozen counter */
832 u8 rsvd1:7; /* Reserved */
833 u8 vtd_evtcode:4; /* VTd and TLB event code */
834 u64 rsvd2:44; /* Reserved */
839 /* VT-d event counter */
840 struct feature_fme_ifpmon_vtd_ctr {
844 u64 vtd_counter:48; /* VTd event counter */
845 u16 rsvd:12; /* Reserved */
846 u8 event_code:4; /* VTd event code */
851 enum iperf_vtd_sip_events {
852 IPERF_VTD_SIP_IOTLB_4K_HIT,
853 IPERF_VTD_SIP_IOTLB_2M_HIT,
854 IPERF_VTD_SIP_IOTLB_1G_HIT,
855 IPERF_VTD_SIP_SLPWC_L3_HIT,
856 IPERF_VTD_SIP_SLPWC_L4_HIT,
857 IPERF_VTD_SIP_RCC_HIT,
858 IPERF_VTD_SIP_IOTLB_4K_MISS,
859 IPERF_VTD_SIP_IOTLB_2M_MISS,
860 IPERF_VTD_SIP_IOTLB_1G_MISS,
861 IPERF_VTD_SIP_SLPWC_L3_MISS,
862 IPERF_VTD_SIP_SLPWC_L4_MISS,
863 IPERF_VTD_SIP_RCC_MISS,
866 /* VT-d SIP control register */
867 struct feature_fme_ifpmon_vtd_sip_ctl {
871 u8 reset_counters:1; /* Reset Counters */
872 u8 rsvd:7; /* Reserved */
873 u8 freeze:1; /* Set to 1 frozen counter */
874 u8 rsvd1:7; /* Reserved */
875 u8 vtd_evtcode:4; /* VTd and TLB event code */
876 u64 rsvd2:44; /* Reserved */
881 /* VT-d SIP event counter */
882 struct feature_fme_ifpmon_vtd_sip_ctr {
886 u64 vtd_counter:48; /* VTd event counter */
887 u16 rsvd:12; /* Reserved */
888 u8 event_code:4; /* VTd event code */
893 /* FME IPERF FEATURE */
894 struct feature_fme_iperf {
895 struct feature_header header;
896 struct feature_fme_ifpmon_ch_ctl ch_ctl;
897 struct feature_fme_ifpmon_ch_ctr ch_ctr0;
898 struct feature_fme_ifpmon_ch_ctr ch_ctr1;
899 struct feature_fme_ifpmon_fab_ctl fab_ctl;
900 struct feature_fme_ifpmon_fab_ctr fab_ctr;
901 struct feature_fme_ifpmon_clk_ctr clk;
902 struct feature_fme_ifpmon_vtd_ctl vtd_ctl;
903 struct feature_fme_ifpmon_vtd_ctr vtd_ctr;
904 struct feature_fme_ifpmon_vtd_sip_ctl vtd_sip_ctl;
905 struct feature_fme_ifpmon_vtd_sip_ctr vtd_sip_ctr;
908 enum dperf_fab_events {
911 DPERF_FAB_MMIO_RD = 6,
915 /* FPMON FAB Control */
916 struct feature_fme_dfpmon_fab_ctl {
920 u8 reset_counters:1; /* Reset Counters */
921 u8 rsvd:7; /* Reserved */
922 u8 freeze:1; /* Set to 1 frozen counter */
923 u8 rsvd1:7; /* Reserved */
924 u8 fab_evtcode:4; /* Fabric Event Code */
925 u8 port_id:2; /* Port ID */
926 u8 rsvd2:1; /* Reserved */
927 u8 port_filter:1; /* Port Filter */
928 u64 rsvd3:40; /* Reserved */
933 /* FPMON Event Counter */
934 struct feature_fme_dfpmon_fab_ctr {
938 u64 fab_cnt:60; /* Fabric event counter */
939 /* Fabric event code being reported */
945 /* FPMON Clock Counter */
946 struct feature_fme_dfpmon_clk_ctr {
947 u64 afu_interf_clock; /* Clk_16UI (AFU clock) counter. */
950 /* FME DPERF FEATURE */
951 struct feature_fme_dperf {
952 struct feature_header header;
954 struct feature_fme_dfpmon_fab_ctl fab_ctl;
955 struct feature_fme_dfpmon_fab_ctr fab_ctr;
956 struct feature_fme_dfpmon_clk_ctr clk;
959 struct feature_fme_error0 {
960 #define FME_ERROR0_MASK 0xFFUL
961 #define FME_ERROR0_MASK_DEFAULT 0x40UL /* pcode workaround */
965 u8 fabric_err:1; /* Fabric error */
966 u8 fabfifo_overflow:1; /* Fabric fifo overflow */
967 u8 kticdc_parity_err:2;/* KTI CDC Parity Error */
968 u8 iommu_parity_err:1; /* IOMMU Parity error */
969 /* AFU PF/VF access mismatch detected */
970 u8 afu_acc_mode_err:1;
971 u8 mbp_err:1; /* Indicates an MBP event */
972 /* PCIE0 CDC Parity Error */
973 u8 pcie0cdc_parity_err:5;
974 /* PCIE1 CDC Parity Error */
975 u8 pcie1cdc_parity_err:5;
976 /* CVL CDC Parity Error */
977 u8 cvlcdc_parity_err:3;
978 u64 rsvd:44; /* Reserved */
983 /* PCIe0 Error Status register */
984 struct feature_fme_pcie0_error {
985 #define FME_PCIE0_ERROR_MASK 0xFFUL
989 u8 formattype_err:1; /* TLP format/type error */
990 u8 MWAddr_err:1; /* TLP MW address error */
991 u8 MWAddrLength_err:1; /* TLP MW length error */
992 u8 MRAddr_err:1; /* TLP MR address error */
993 u8 MRAddrLength_err:1; /* TLP MR length error */
994 u8 cpl_tag_err:1; /* TLP CPL tag error */
995 u8 cpl_status_err:1; /* TLP CPL status error */
996 u8 cpl_timeout_err:1; /* TLP CPL timeout */
997 u8 cci_parity_err:1; /* CCI bridge parity error */
998 u8 rxpoison_tlp_err:1; /* Received a TLP with EP set */
999 u64 rsvd:52; /* Reserved */
1000 u8 vfnumb_err:1; /* Number of error VF */
1001 u8 funct_type_err:1; /* Virtual (1) or Physical */
1006 /* PCIe1 Error Status register */
1007 struct feature_fme_pcie1_error {
1008 #define FME_PCIE1_ERROR_MASK 0xFFUL
1012 u8 formattype_err:1; /* TLP format/type error */
1013 u8 MWAddr_err:1; /* TLP MW address error */
1014 u8 MWAddrLength_err:1; /* TLP MW length error */
1015 u8 MRAddr_err:1; /* TLP MR address error */
1016 u8 MRAddrLength_err:1; /* TLP MR length error */
1017 u8 cpl_tag_err:1; /* TLP CPL tag error */
1018 u8 cpl_status_err:1; /* TLP CPL status error */
1019 u8 cpl_timeout_err:1; /* TLP CPL timeout */
1020 u8 cci_parity_err:1; /* CCI bridge parity error */
1021 u8 rxpoison_tlp_err:1; /* Received a TLP with EP set */
1022 u64 rsvd:54; /* Reserved */
1027 /* FME First Error register */
1028 struct feature_fme_first_error {
1029 #define FME_FIRST_ERROR_MASK ((1ULL << 60) - 1)
1034 * Indicates the Error Register that was
1037 u64 err_reg_status:60;
1039 * Holds 60 LSBs from the Error register that was
1047 /* FME Next Error register */
1048 struct feature_fme_next_error {
1049 #define FME_NEXT_ERROR_MASK ((1ULL << 60) - 1)
1054 * Indicates the Error Register that was
1057 u64 err_reg_status:60;
1059 * Holds 60 LSBs from the Error register that was
1067 /* RAS Non Fatal Error Status register */
1068 struct feature_fme_ras_nonfaterror {
1072 /* thremal threshold AP1 */
1073 u8 temp_thresh_ap1:1;
1074 /* thremal threshold AP2 */
1075 u8 temp_thresh_ap2:1;
1076 u8 pcie_error:1; /* pcie Error */
1077 u8 portfatal_error:1; /* port fatal error */
1078 u8 proc_hot:1; /* Indicates a ProcHot event */
1079 /* Indicates an AFU PF/VF access mismatch */
1080 u8 afu_acc_mode_err:1;
1081 /* Injected nonfata Error */
1082 u8 injected_nonfata_err:1;
1084 /* Temperature threshold triggered AP6*/
1085 u8 temp_thresh_AP6:1;
1086 /* Power threshold triggered AP1 */
1087 u8 power_thresh_AP1:1;
1088 /* Power threshold triggered AP2 */
1089 u8 power_thresh_AP2:1;
1090 /* Indicates a MBP event */
1092 u64 rsvd2:51; /* Reserved */
1097 /* RAS Catastrophic Fatal Error Status register */
1098 struct feature_fme_ras_catfaterror {
1102 /* KTI Link layer error detected */
1103 u8 ktilink_fatal_err:1;
1104 /* tag-n-cache error detected */
1105 u8 tagcch_fatal_err:1;
1106 /* CCI error detected */
1108 /* KTI Protocol error detected */
1109 u8 ktiprpto_fatal_err:1;
1110 /* Fatal DRAM error detected */
1111 u8 dram_fatal_err:1;
1112 /* IOMMU detected */
1113 u8 iommu_fatal_err:1;
1114 /* Fabric Fatal Error */
1115 u8 fabric_fatal_err:1;
1116 /* PCIe possion Error */
1117 u8 pcie_poison_err:1;
1118 /* Injected fatal Error */
1119 u8 inject_fata_err:1;
1120 /* Catastrophic CRC Error */
1121 u8 crc_catast_err:1;
1122 /* Catastrophic Thermal Error */
1123 u8 therm_catast_err:1;
1124 /* Injected Catastrophic Error */
1125 u8 injected_catast_err:1;
1131 /* RAS Error injection register */
1132 struct feature_fme_ras_error_inj {
1133 #define FME_RAS_ERROR_INJ_MASK 0x7UL
1137 u8 catast_error:1; /* Catastrophic error flag */
1138 u8 fatal_error:1; /* Fatal error flag */
1139 u8 nonfatal_error:1; /* NonFatal error flag */
1140 u64 rsvd:61; /* Reserved */
1145 /* FME error capabilities */
1146 struct feature_fme_error_capability {
1151 /* MSI-X vector table entry number */
1152 u16 intr_vector_num:12;
1153 u64 rsvd:51; /* Reserved */
1158 /* FME ERR FEATURE */
1159 struct feature_fme_err {
1160 struct feature_header header;
1161 struct feature_fme_error0 fme_err_mask;
1162 struct feature_fme_error0 fme_err;
1163 struct feature_fme_pcie0_error pcie0_err_mask;
1164 struct feature_fme_pcie0_error pcie0_err;
1165 struct feature_fme_pcie1_error pcie1_err_mask;
1166 struct feature_fme_pcie1_error pcie1_err;
1167 struct feature_fme_first_error fme_first_err;
1168 struct feature_fme_next_error fme_next_err;
1169 struct feature_fme_ras_nonfaterror ras_nonfat_mask;
1170 struct feature_fme_ras_nonfaterror ras_nonfaterr;
1171 struct feature_fme_ras_catfaterror ras_catfat_mask;
1172 struct feature_fme_ras_catfaterror ras_catfaterr;
1173 struct feature_fme_ras_error_inj ras_error_inj;
1174 struct feature_fme_error_capability fme_err_capability;
1177 /* FME Partial Reconfiguration Control */
1178 struct feature_fme_pr_ctl {
1182 u8 pr_reset:1; /* Reset PR Engine */
1183 u8 rsvd3:3; /* Reserved */
1184 u8 pr_reset_ack:1; /* Reset PR Engine Ack */
1185 u8 rsvd4:3; /* Reserved */
1186 u8 pr_regionid:2; /* PR Region ID */
1187 u8 rsvd1:2; /* Reserved */
1188 u8 pr_start_req:1; /* PR Start Request */
1189 u8 pr_push_complete:1; /* PR Data push complete */
1190 u8 pr_kind:1; /* PR Data push complete */
1191 u32 rsvd:17; /* Reserved */
1192 u32 config_data; /* Config data TBD */
1197 /* FME Partial Reconfiguration Status */
1198 struct feature_fme_pr_status {
1202 u16 pr_credit:9; /* PR Credits */
1203 u8 rsvd2:7; /* Reserved */
1204 u8 pr_status:1; /* PR status */
1205 u8 rsvd:3; /* Reserved */
1206 /* Altra PR Controller Block status */
1207 u8 pr_controller_status:3;
1208 u8 rsvd1:1; /* Reserved */
1209 u8 pr_host_status:4; /* PR Host status */
1210 u8 rsvd3:4; /* Reserved */
1211 /* Security Block Status fields (TBD) */
1212 u32 security_bstatus;
1217 /* FME Partial Reconfiguration Data */
1218 struct feature_fme_pr_data {
1220 u64 csr; /* PR data from the raw-binary file */
1222 /* PR data from the raw-binary file */
1229 /* FME PR Public Key */
1230 struct feature_fme_pr_key {
1231 u64 key; /* FME PR Public Hash */
1234 /* FME PR FEATURE */
1235 struct feature_fme_pr {
1236 struct feature_header header;
1237 /*Partial Reconfiguration control */
1238 struct feature_fme_pr_ctl ccip_fme_pr_control;
1240 /* Partial Reconfiguration Status */
1241 struct feature_fme_pr_status ccip_fme_pr_status;
1243 /* Partial Reconfiguration data */
1244 struct feature_fme_pr_data ccip_fme_pr_data;
1246 /* Partial Reconfiguration data */
1247 u64 ccip_fme_pr_err;
1251 /* Partial Reconfiguration data registers */
1263 /* PR Interface ID */
1264 u64 fme_pr_intfc_id_l;
1265 u64 fme_pr_intfc_id_h;
1267 /* MSIX filed to be Added */
1270 /* FME HSSI Control */
1271 struct feature_fme_hssi_eth_ctrl {
1275 u32 data:32; /* HSSI data */
1276 u16 address:16; /* HSSI address */
1280 * 0x08 - SW register RD request
1281 * 0x10 - SW register WR request
1282 * 0x40 - Auxiliar bus RD request
1283 * 0x80 - Auxiliar bus WR request
1290 /* FME HSSI Status */
1291 struct feature_fme_hssi_eth_stat {
1295 u32 data:32; /* HSSI data */
1296 u8 acknowledge:1; /* HSSI acknowledge */
1297 u8 spare:1; /* HSSI spare */
1298 u32 rsvd:30; /* Reserved */
1303 /* FME HSSI FEATURE */
1304 struct feature_fme_hssi {
1305 struct feature_header header;
1306 struct feature_fme_hssi_eth_ctrl hssi_control;
1307 struct feature_fme_hssi_eth_stat hssi_status;
1310 #define PORT_ERR_MASK 0xfff0703ff001f
1311 struct feature_port_err_key {
1315 /* Tx Channel0: Overflow */
1316 u8 tx_ch0_overflow:1;
1317 /* Tx Channel0: Invalid request encoding */
1318 u8 tx_ch0_invaldreq :1;
1319 /* Tx Channel0: Request with cl_len=3 not supported */
1320 u8 tx_ch0_cl_len3:1;
1321 /* Tx Channel0: Request with cl_len=2 not aligned 2CL */
1322 u8 tx_ch0_cl_len2:1;
1323 /* Tx Channel0: Request with cl_len=4 not aligned 4CL */
1324 u8 tx_ch0_cl_len4:1;
1326 u16 rsvd1:4; /* Reserved */
1328 /* AFU MMIO RD received while PORT is in reset */
1329 u8 mmio_rd_whilerst:1;
1330 /* AFU MMIO WR received while PORT is in reset */
1331 u8 mmio_wr_whilerst:1;
1333 u16 rsvd2:5; /* Reserved */
1335 /* Tx Channel1: Overflow */
1336 u8 tx_ch1_overflow:1;
1337 /* Tx Channel1: Invalid request encoding */
1338 u8 tx_ch1_invaldreq:1;
1339 /* Tx Channel1: Request with cl_len=3 not supported */
1340 u8 tx_ch1_cl_len3:1;
1341 /* Tx Channel1: Request with cl_len=2 not aligned 2CL */
1342 u8 tx_ch1_cl_len2:1;
1343 /* Tx Channel1: Request with cl_len=4 not aligned 4CL */
1344 u8 tx_ch1_cl_len4:1;
1346 /* Tx Channel1: Insufficient data payload */
1347 u8 tx_ch1_insuff_data:1;
1348 /* Tx Channel1: Data payload overrun */
1349 u8 tx_ch1_data_overrun:1;
1350 /* Tx Channel1 : Incorrect address */
1351 u8 tx_ch1_incorr_addr:1;
1352 /* Tx Channel1 : NON-Zero SOP Detected */
1354 /* Tx Channel1 : Illegal VC_SEL, atomic request VLO */
1355 u8 tx_ch1_illegal_vcsel:1;
1357 u8 rsvd3:6; /* Reserved */
1359 /* MMIO Read Timeout in AFU */
1360 u8 mmioread_timeout:1;
1362 /* Tx Channel2: FIFO Overflow */
1363 u8 tx_ch2_fifo_overflow:1;
1365 /* MMIO read is not matching pending request */
1366 u8 unexp_mmio_resp:1;
1368 u8 rsvd4:5; /* Reserved */
1370 /* Number of pending Requests: counter overflow */
1371 u8 tx_req_counter_overflow:1;
1372 /* Req with Address violating SMM Range */
1374 /* Req with Address violating second SMM Range */
1375 u8 llpr_smrr2_err:1;
1376 /* Req with Address violating ME Stolen message */
1378 /* Req with Address violating Generic Protected Range */
1379 u8 genprot_range_err:1;
1380 /* Req with Address violating Legacy Range low */
1381 u8 legrange_low_err:1;
1382 /* Req with Address violating Legacy Range High */
1383 u8 legrange_high_err:1;
1384 /* Req with Address violating VGA memory range */
1385 u8 vgmem_range_err:1;
1386 u8 page_fault_err:1; /* Page fault */
1387 u8 pmr_err:1; /* PMR Error */
1388 u8 ap6_event:1; /* AP6 event */
1389 /* VF FLR detected on Port with PF access control */
1390 u8 vfflr_access_err:1;
1391 u16 rsvd5:12; /* Reserved */
1396 /* Port first error register, not contain all error bits in error register. */
1397 struct feature_port_first_err_key {
1401 u8 tx_ch0_overflow:1;
1402 u8 tx_ch0_invaldreq :1;
1403 u8 tx_ch0_cl_len3:1;
1404 u8 tx_ch0_cl_len2:1;
1405 u8 tx_ch0_cl_len4:1;
1406 u8 rsvd1:4; /* Reserved */
1407 u8 mmio_rd_whilerst:1;
1408 u8 mmio_wr_whilerst:1;
1409 u8 rsvd2:5; /* Reserved */
1410 u8 tx_ch1_overflow:1;
1411 u8 tx_ch1_invaldreq:1;
1412 u8 tx_ch1_cl_len3:1;
1413 u8 tx_ch1_cl_len2:1;
1414 u8 tx_ch1_cl_len4:1;
1415 u8 tx_ch1_insuff_data:1;
1416 u8 tx_ch1_data_overrun:1;
1417 u8 tx_ch1_incorr_addr:1;
1419 u8 tx_ch1_illegal_vcsel:1;
1420 u8 rsvd3:6; /* Reserved */
1421 u8 mmioread_timeout:1;
1422 u8 tx_ch2_fifo_overflow:1;
1423 u8 rsvd4:6; /* Reserved */
1424 u8 tx_req_counter_overflow:1;
1425 u32 rsvd5:23; /* Reserved */
1430 /* Port malformed Req0 */
1431 struct feature_port_malformed_req0 {
1435 /* Port malformed Req1 */
1436 struct feature_port_malformed_req1 {
1440 /* Port debug register */
1441 struct feature_port_debug {
1445 /* Port error capabilities */
1446 struct feature_port_err_capability {
1451 /* MSI-X vector table entry number */
1452 u16 intr_vector_num:12;
1453 u64 rsvd:51; /* Reserved */
1458 /* PORT FEATURE ERROR */
1459 struct feature_port_error {
1460 struct feature_header header;
1461 struct feature_port_err_key error_mask;
1462 struct feature_port_err_key port_error;
1463 struct feature_port_first_err_key port_first_error;
1464 struct feature_port_malformed_req0 malreq0;
1465 struct feature_port_malformed_req1 malreq1;
1466 struct feature_port_debug port_debug;
1467 struct feature_port_err_capability error_capability;
1470 /* Port UMSG Capability */
1471 struct feature_port_umsg_cap {
1475 /* Number of umsg allocated to this port */
1477 /* Enable / Disable UMsg engine for this port */
1479 /* Usmg initialization status */
1480 u8 umsg_init_complete:1;
1481 /* IOMMU can not translate the umsg base address */
1482 u8 umsg_trans_error:1;
1483 u64 rsvd:53; /* Reserved */
1488 /* Port UMSG base address */
1489 struct feature_port_umsg_baseaddr {
1493 u64 base_addr:48; /* 48 bit physical address */
1494 u16 rsvd; /* Reserved */
1499 struct feature_port_umsg_mode {
1503 u32 umsg_hint_enable; /* UMSG hint enable/disable */
1504 u32 rsvd; /* Reserved */
1509 /* PORT FEATURE UMSG */
1510 struct feature_port_umsg {
1511 struct feature_header header;
1512 struct feature_port_umsg_cap capability;
1513 struct feature_port_umsg_baseaddr baseaddr;
1514 struct feature_port_umsg_mode mode;
1517 #define UMSG_EN_POLL_INVL 10 /* us */
1518 #define UMSG_EN_POLL_TIMEOUT 1000 /* us */
1520 /* Port UINT Capability */
1521 struct feature_port_uint_cap {
1525 u16 intr_num:12; /* Supported interrupts num */
1526 /* First MSI-X vector table entry number */
1527 u16 first_vec_num:12;
1533 /* PORT FEATURE UINT */
1534 struct feature_port_uint {
1535 struct feature_header header;
1536 struct feature_port_uint_cap capability;
1539 /* STP region supports mmap operation, so use page aligned size. */
1540 #define PORT_FEATURE_STP_REGION_SIZE \
1541 IFPGA_PAGE_ALIGN(sizeof(struct feature_port_stp))
1543 /* Port STP status register (for debug only)*/
1544 struct feature_port_stp_status {
1548 /* SLD Hub end-point read/write timeout */
1549 u8 sld_ep_timeout:1;
1550 /* Remote STP in reset/disable */
1552 u8 unsupported_read:1;
1553 /* MMIO timeout detected and faked with a response */
1557 u8 txfifo_overflow:1;
1558 u8 txfifo_underflow:1;
1559 u8 rxfifo_overflow:1;
1560 u8 rxfifo_underflow:1;
1561 /* Number of MMIO write requests */
1563 /* Number of MMIO read requests */
1565 /* Number of MMIO read responses */
1573 * Most registers in STP region are not touched by driver, but mmapped to user
1574 * space. So they are not defined in below data structure, as its actual size
1575 * is 0x18c per spec.
1577 struct feature_port_stp {
1578 struct feature_header header;
1579 struct feature_port_stp_status stp_status;
1583 * enum fpga_pr_states - fpga PR states
1584 * @FPGA_PR_STATE_UNKNOWN: can't determine state
1585 * @FPGA_PR_STATE_WRITE_INIT: preparing FPGA for programming
1586 * @FPGA_PR_STATE_WRITE_INIT_ERR: Error during WRITE_INIT stage
1587 * @FPGA_PR_STATE_WRITE: writing image to FPGA
1588 * @FPGA_PR_STATE_WRITE_ERR: Error while writing FPGA
1589 * @FPGA_PR_STATE_WRITE_COMPLETE: Doing post programming steps
1590 * @FPGA_PR_STATE_WRITE_COMPLETE_ERR: Error during WRITE_COMPLETE
1591 * @FPGA_PR_STATE_OPERATING: FPGA PR done
1593 enum fpga_pr_states {
1594 /* canot determine state states */
1595 FPGA_PR_STATE_UNKNOWN,
1597 /* write sequence: init, write, complete */
1598 FPGA_PR_STATE_WRITE_INIT,
1599 FPGA_PR_STATE_WRITE_INIT_ERR,
1600 FPGA_PR_STATE_WRITE,
1601 FPGA_PR_STATE_WRITE_ERR,
1602 FPGA_PR_STATE_WRITE_COMPLETE,
1603 FPGA_PR_STATE_WRITE_COMPLETE_ERR,
1610 * FPGA Manager flags
1611 * FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported
1613 #define FPGA_MGR_PARTIAL_RECONFIG BIT(0)
1616 * struct fpga_pr_info - specific information to a FPGA PR
1617 * @flags: boolean flags as defined above
1618 * @pr_err: PR error code
1619 * @state: fpga manager state
1622 struct fpga_pr_info {
1625 enum fpga_pr_states state;
1629 #define DEFINE_FPGA_PR_ERR_MSG(_name_) \
1630 static const char * const _name_[] = { \
1631 "PR operation error detected", \
1632 "PR CRC error detected", \
1633 "PR incompatiable bitstream error detected", \
1634 "PR IP protocol error detected", \
1635 "PR FIFO overflow error detected", \
1636 "PR timeout error detected", \
1637 "PR secure load error detected", \
1640 #define RST_POLL_INVL 10 /* us */
1641 #define RST_POLL_TIMEOUT 1000 /* us */
1643 #define PR_WAIT_TIMEOUT 15000000
1645 #define PR_HOST_STATUS_IDLE 0
1646 #define PR_MAX_ERR_NUM 7
1648 DEFINE_FPGA_PR_ERR_MSG(pr_err_msg);
1651 * green bitstream header must be byte-packed to match the
1660 #define GBS_GUID_H 0x414750466e6f6558
1661 #define GBS_GUID_L 0x31303076534247b7
1662 #define is_valid_bts(bts_hdr) \
1663 (((bts_hdr)->guid_h == GBS_GUID_H) && \
1664 ((bts_hdr)->guid_l == GBS_GUID_L))
1666 /* bitstream id definition */
1667 struct fme_bitstream_id {
1682 enum board_interface {
1690 struct ifpga_fme_board_info {
1691 enum board_interface type;
1697 u32 nums_of_retimer;
1698 u32 ports_per_retimer;
1704 #endif /* _BASE_IFPGA_DEFINES_H_ */