216
216
#define PCI_EXT_CAP_ID_RCILINK 0x06 /* Root Complex Internal Link Declaration */
217
217
#define PCI_EXT_CAP_ID_RCECOLL 0x07 /* Root Complex Event Collector */
218
218
#define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function Virtual Channel */
219
#define PCI_EXT_CAP_ID_VC2 0x09 /* Virtual Channel (2nd ID) */
219
220
#define PCI_EXT_CAP_ID_RBCB 0x0a /* Root Bridge Control Block */
220
221
#define PCI_EXT_CAP_ID_VNDR 0x0b /* Vendor specific */
221
222
#define PCI_EXT_CAP_ID_ACS 0x0d /* Access Controls */
223
#define PCI_EXT_CAP_ID_ARI 0x0e /* Alternative Routing-ID Interpretation */
224
#define PCI_EXT_CAP_ID_ATS 0x0f /* Address Translation Service */
225
#define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */
227
/*** Definitions of capabilities ***/
223
229
/* Power Management Registers */
825
842
#define PCI_EXP_RTSTA_PME_REQID 0x0000ffff /* PME Requester ID */
826
843
#define PCI_EXP_RTSTA_PME_STATUS 0x00010000 /* PME Status */
827
844
#define PCI_EXP_RTSTA_PME_PENDING 0x00020000 /* PME is Pending */
845
#define PCI_EXP_DEVCAP2 0x24 /* Device capabilities 2 */
846
#define PCI_EXP_DEVCTL2 0x28 /* Device Control */
847
#define PCI_EXP_DEV2_TIMEOUT_RANGE(x) ((x) & 0xf) /* Completion Timeout Ranges Supported */
848
#define PCI_EXP_DEV2_TIMEOUT_VALUE(x) ((x) & 0xf) /* Completion Timeout Value */
849
#define PCI_EXP_DEV2_TIMEOUT_DIS 0x0010 /* Completion Timeout Disable Supported */
850
#define PCI_EXP_DEV2_ARI 0x0020 /* ARI Forwarding */
851
#define PCI_EXP_DEVSTA2 0x2a /* Device Status */
852
#define PCI_EXP_LNKCAP2 0x2c /* Link Capabilities */
853
#define PCI_EXP_LNKCTL2 0x30 /* Link Control */
854
#define PCI_EXP_LNKCTL2_SPEED(x) ((x) & 0xf) /* Target Link Speed */
855
#define PCI_EXP_LNKCTL2_CMPLNC 0x0010 /* Enter Compliance */
856
#define PCI_EXP_LNKCTL2_SPEED_DIS 0x0020 /* Hardware Autonomous Speed Disable */
857
#define PCI_EXP_LNKCTL2_DEEMPHASIS(x) (((x) >> 6) & 1) /* Selectable De-emphasis */
858
#define PCI_EXP_LNKCTL2_MARGIN(x) (((x) >> 7) & 7) /* Transmit Margin */
859
#define PCI_EXP_LNKCTL2_MOD_CMPLNC 0x0400 /* Enter Modified Compliance */
860
#define PCI_EXP_LNKCTL2_CMPLNC_SOS 0x0800 /* Compliance SOS */
861
#define PCI_EXP_LNKCTL2_COM_DEEMPHASIS(x) (((x) >> 12) & 1) /* Compliance De-emphasis */
862
#define PCI_EXP_LNKSTA2 0x32 /* Link Status */
863
#define PCI_EXP_LINKSTA2_DEEMPHASIS(x) ((x) & 1) /* Current De-emphasis Level */
864
#define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities */
865
#define PCI_EXP_SLTCTL2 0x38 /* Slot Control */
866
#define PCI_EXP_SLTSTA2 0x3a /* Slot Status */
830
869
#define PCI_MSIX_ENABLE 0x8000
831
870
#define PCI_MSIX_MASK 0x4000
832
#define PCI_MSIX_TABSIZE 0x03ff
871
#define PCI_MSIX_TABSIZE 0x07ff
833
872
#define PCI_MSIX_TABLE 4
834
873
#define PCI_MSIX_PBA 8
835
874
#define PCI_MSIX_BIR 0x7
838
877
#define PCI_SSVID_VENDOR 4
839
878
#define PCI_SSVID_DEVICE 6
880
/* PCI Advanced Features */
882
#define PCI_AF_CAP_TP 0x01
883
#define PCI_AF_CAP_FLR 0x02
884
#define PCI_AF_CTRL 4
885
#define PCI_AF_CTRL_FLR 0x01
886
#define PCI_AF_STATUS 5
887
#define PCI_AF_STATUS_TP 0x01
889
/* SATA Host Bus Adapter */
890
#define PCI_SATA_HBA_BARS 4
891
#define PCI_SATA_HBA_REG0 8
893
/*** Definitions of extended capabilities ***/
841
895
/* Advanced Error Reporting */
842
896
#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
843
#define PCI_ERR_UNC_TRAIN 0x00000001 /* Training */
897
#define PCI_ERR_UNC_TRAIN 0x00000001 /* Undefined in PCIe rev1.1 & 2.0 spec */
844
898
#define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */
899
#define PCI_ERR_UNC_SDES 0x00000020 /* Surprise Down Error */
845
900
#define PCI_ERR_UNC_POISON_TLP 0x00001000 /* Poisoned TLP */
846
901
#define PCI_ERR_UNC_FCP 0x00002000 /* Flow Control Protocol */
847
902
#define PCI_ERR_UNC_COMP_TIME 0x00004000 /* Completion Timeout */
896
953
#define PCI_PWR_CAP 12 /* Capability */
897
954
#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */
956
/* Root Complex Link */
957
#define PCI_RCLINK_ESD 4 /* Element Self Description */
958
#define PCI_RCLINK_LINK1 16 /* First Link Entry */
959
#define PCI_RCLINK_LINK_DESC 0 /* Link Entry: Description */
960
#define PCI_RCLINK_LINK_ADDR 8 /* Link Entry: Address (64-bit) */
961
#define PCI_RCLINK_LINK_SIZE 16 /* Link Entry: sizeof */
963
/* PCIe Vendor-Specific Capability */
964
#define PCI_EVNDR_HEADER 4 /* Vendor-Specific Header */
965
#define PCI_EVNDR_REGISTERS 8 /* Vendor-Specific Registers */
967
/* Access Control Services */
968
#define PCI_ACS_CAP 0x04 /* ACS Capability Register */
969
#define PCI_ACS_CAP_VALID 0x0001 /* ACS Source Validation */
970
#define PCI_ACS_CAP_BLOCK 0x0002 /* ACS Translation Blocking */
971
#define PCI_ACS_CAP_REQ_RED 0x0004 /* ACS P2P Request Redirect */
972
#define PCI_ACS_CAP_CMPLT_RED 0x0008 /* ACS P2P Completion Redirect */
973
#define PCI_ACS_CAP_FORWARD 0x0010 /* ACS Upstream Forwarding */
974
#define PCI_ACS_CAP_EGRESS 0x0020 /* ACS P2P Egress Control */
975
#define PCI_ACS_CAP_TRANS 0x0040 /* ACS Direct Translated P2P */
976
#define PCI_ACS_CAP_VECTOR(x) (((x) >> 8) & 0xff) /* Egress Control Vector Size */
977
#define PCI_ACS_CTRL 0x06 /* ACS Control Register */
978
#define PCI_ACS_CTRL_VALID 0x0001 /* ACS Source Validation Enable */
979
#define PCI_ACS_CTRL_BLOCK 0x0002 /* ACS Translation Blocking Enable */
980
#define PCI_ACS_CTRL_REQ_RED 0x0004 /* ACS P2P Request Redirect Enable */
981
#define PCI_ACS_CTRL_CMPLT_RED 0x0008 /* ACS P2P Completion Redirect Enable */
982
#define PCI_ACS_CTRL_FORWARD 0x0010 /* ACS Upstream Forwarding Enable */
983
#define PCI_ACS_CTRL_EGRESS 0x0020 /* ACS P2P Egress Control Enable */
984
#define PCI_ACS_CTRL_TRANS 0x0040 /* ACS Direct Translated P2P Enable */
985
#define PCI_ACS_EGRESS_CTRL 0x08 /* Egress Control Vector */
987
/* Alternative Routing-ID Interpretation */
988
#define PCI_ARI_CAP 0x04 /* ARI Capability Register */
989
#define PCI_ARI_CAP_MFVC 0x0001 /* MFVC Function Groups Capability */
990
#define PCI_ARI_CAP_ACS 0x0002 /* ACS Function Groups Capability */
991
#define PCI_ARI_CAP_NFN(x) (((x) >> 8) & 0xff) /* Next Function Number */
992
#define PCI_ARI_CTRL 0x06 /* ARI Control Register */
993
#define PCI_ARI_CTRL_MFVC 0x0001 /* MFVC Function Groups Enable */
994
#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */
995
#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */
997
/* Address Translation Service */
998
#define PCI_ATS_CAP 0x04 /* ATS Capability Register */
999
#define PCI_ATS_CAP_IQD(x) ((x) & 0x1f) /* Invalidate Queue Depth */
1000
#define PCI_ATS_CTRL 0x06 /* ATS Control Register */
1001
#define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */
1002
#define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */
1004
/* Single Root I/O Virtualization */
1005
#define PCI_IOV_CAP 0x04 /* SR-IOV Capability Register */
1006
#define PCI_IOV_CAP_VFM 0x00000001 /* VF Migration Capable */
1007
#define PCI_IOV_CAP_IMN(x) ((x) >> 21) /* VF Migration Interrupt Message Number */
1008
#define PCI_IOV_CTRL 0x08 /* SR-IOV Control Register */
1009
#define PCI_IOV_CTRL_VFE 0x0001 /* VF Enable */
1010
#define PCI_IOV_CTRL_VFME 0x0002 /* VF Migration Enable */
1011
#define PCI_IOV_CTRL_VFMIE 0x0004 /* VF Migration Interrupt Enable */
1012
#define PCI_IOV_CTRL_MSE 0x0008 /* VF MSE */
1013
#define PCI_IOV_CTRL_ARI 0x0010 /* ARI Capable Hierarchy */
1014
#define PCI_IOV_STATUS 0x0a /* SR-IOV Status Register */
1015
#define PCI_IOV_STATUS_MS 0x0001 /* VF Migration Status */
1016
#define PCI_IOV_INITIALVF 0x0c /* Number of VFs that are initially associated */
1017
#define PCI_IOV_TOTALVF 0x0e /* Maximum number of VFs that could be associated */
1018
#define PCI_IOV_NUMVF 0x10 /* Number of VFs that are available */
1019
#define PCI_IOV_FDL 0x12 /* Function Dependency Link */
1020
#define PCI_IOV_OFFSET 0x14 /* First VF Offset */
1021
#define PCI_IOV_STRIDE 0x16 /* Routing ID offset from one VF to the next one */
1022
#define PCI_IOV_DID 0x1a /* VF Device ID */
1023
#define PCI_IOV_SUPPS 0x1c /* Supported Page Sizes */
1024
#define PCI_IOV_SYSPS 0x20 /* System Page Size */
1025
#define PCI_IOV_BAR_BASE 0x24 /* VF BAR0, VF BAR1, ... VF BAR5 */
1026
#define PCI_IOV_NUM_BAR 6 /* Number of VF BARs */
1027
#define PCI_IOV_MSAO 0x3c /* VF Migration State Array Offset */
1028
#define PCI_IOV_MSA_BIR(x) ((x) & 7) /* VF Migration State BIR */
1029
#define PCI_IOV_MSA_OFFSET(x) ((x) & 0xfffffff8) /* VF Migration State Offset */
900
1032
* The PCI interface treats multi-function devices as independent
901
1033
* devices. The slot/function address of each device is encoded