summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/dev/pci/pcireg.h
diff options
context:
space:
mode:
Diffstat (limited to 'freebsd/sys/dev/pci/pcireg.h')
-rw-r--r--freebsd/sys/dev/pci/pcireg.h256
1 files changed, 143 insertions, 113 deletions
diff --git a/freebsd/sys/dev/pci/pcireg.h b/freebsd/sys/dev/pci/pcireg.h
index f2d1ccbe..d463b7a5 100644
--- a/freebsd/sys/dev/pci/pcireg.h
+++ b/freebsd/sys/dev/pci/pcireg.h
@@ -48,6 +48,34 @@
#define PCIE_REGMAX 4095 /* highest supported config register addr. */
#define PCI_MAXHDRTYPE 2
+#define PCIE_ARI_SLOTMAX 0
+#define PCIE_ARI_FUNCMAX 255
+
+#define PCI_RID_DOMAIN_SHIFT 16
+#define PCI_RID_BUS_SHIFT 8
+#define PCI_RID_SLOT_SHIFT 3
+#define PCI_RID_FUNC_SHIFT 0
+
+#define PCI_RID(bus, slot, func) \
+ ((((bus) & PCI_BUSMAX) << PCI_RID_BUS_SHIFT) | \
+ (((slot) & PCI_SLOTMAX) << PCI_RID_SLOT_SHIFT) | \
+ (((func) & PCI_FUNCMAX) << PCI_RID_FUNC_SHIFT))
+
+#define PCI_ARI_RID(bus, func) \
+ ((((bus) & PCI_BUSMAX) << PCI_RID_BUS_SHIFT) | \
+ (((func) & PCIE_ARI_FUNCMAX) << PCI_RID_FUNC_SHIFT))
+
+#define PCI_RID2BUS(rid) (((rid) >> PCI_RID_BUS_SHIFT) & PCI_BUSMAX)
+#define PCI_RID2SLOT(rid) (((rid) >> PCI_RID_SLOT_SHIFT) & PCI_SLOTMAX)
+#define PCI_RID2FUNC(rid) (((rid) >> PCI_RID_FUNC_SHIFT) & PCI_FUNCMAX)
+
+#define PCIE_ARI_RID2SLOT(rid) (0)
+#define PCIE_ARI_RID2FUNC(rid) \
+ (((rid) >> PCI_RID_FUNC_SHIFT) & PCIE_ARI_FUNCMAX)
+
+#define PCIE_ARI_SLOT(func) (((func) >> PCI_RID_SLOT_SHIFT) & PCI_SLOTMAX)
+#define PCIE_ARI_FUNC(func) (((func) >> PCI_RID_FUNC_SHIFT) & PCI_FUNCMAX)
+
/* PCI config header registers for all devices */
#define PCIR_DEVVENDOR 0x00
@@ -118,6 +146,7 @@
#define PCIY_MSIX 0x11 /* MSI-X */
#define PCIY_SATA 0x12 /* SATA */
#define PCIY_PCIAF 0x13 /* PCI Advanced Features */
+#define PCIY_EA 0x14 /* PCI Extended Allocation */
/* Extended Capability Register Fields */
@@ -132,25 +161,35 @@
/* Extended Capability Identification Numbers */
#define PCIZ_AER 0x0001 /* Advanced Error Reporting */
-#define PCIZ_VC 0x0002 /* Virtual Channel */
+#define PCIZ_VC 0x0002 /* Virtual Channel if MFVC Ext Cap not set */
#define PCIZ_SERNUM 0x0003 /* Device Serial Number */
#define PCIZ_PWRBDGT 0x0004 /* Power Budgeting */
#define PCIZ_RCLINK_DCL 0x0005 /* Root Complex Link Declaration */
#define PCIZ_RCLINK_CTL 0x0006 /* Root Complex Internal Link Control */
#define PCIZ_RCEC_ASSOC 0x0007 /* Root Complex Event Collector Association */
#define PCIZ_MFVC 0x0008 /* Multi-Function Virtual Channel */
+#define PCIZ_VC2 0x0009 /* Virtual Channel if MFVC Ext Cap set */
#define PCIZ_RCRB 0x000a /* RCRB Header */
#define PCIZ_VENDOR 0x000b /* Vendor Unique */
+#define PCIZ_CAC 0x000c /* Configuration Access Correction -- obsolete */
#define PCIZ_ACS 0x000d /* Access Control Services */
#define PCIZ_ARI 0x000e /* Alternative Routing-ID Interpretation */
#define PCIZ_ATS 0x000f /* Address Translation Services */
#define PCIZ_SRIOV 0x0010 /* Single Root IO Virtualization */
+#define PCIZ_MRIOV 0x0011 /* Multiple Root IO Virtualization */
#define PCIZ_MULTICAST 0x0012 /* Multicast */
+#define PCIZ_PAGE_REQ 0x0013 /* Page Request */
+#define PCIZ_AMD 0x0014 /* Reserved for AMD */
#define PCIZ_RESIZE_BAR 0x0015 /* Resizable BAR */
#define PCIZ_DPA 0x0016 /* Dynamic Power Allocation */
#define PCIZ_TPH_REQ 0x0017 /* TPH Requester */
#define PCIZ_LTR 0x0018 /* Latency Tolerance Reporting */
#define PCIZ_SEC_PCIE 0x0019 /* Secondary PCI Express */
+#define PCIZ_PMUX 0x001a /* Protocol Multiplexing */
+#define PCIZ_PASID 0x001b /* Process Address Space ID */
+#define PCIZ_LN_REQ 0x001c /* LN Requester */
+#define PCIZ_DPC 0x001d /* Downstream Porto Containment */
+#define PCIZ_L1PM 0x001e /* L1 PM Substates */
/* config registers for header type 0 devices */
@@ -183,7 +222,7 @@
#define PCIM_CIS_ASI_ROM 7
#define PCIM_CIS_ADDR_MASK 0x0ffffff8
#define PCIM_CIS_ROM_MASK 0xf0000000
-#define PCIM_CIS_CONFIG_MASK 0xff
+#define PCIM_CIS_CONFIG_MASK 0xff
#define PCIR_SUBVEND_0 0x2c
#define PCIR_SUBDEV_0 0x2e
#define PCIR_BIOS 0x30
@@ -227,6 +266,11 @@
#define PCIR_BIOS_1 0x38
#define PCIR_BRIDGECTL_1 0x3e
+#define PCI_PPBMEMBASE(h,l) ((((uint64_t)(h) << 32) + ((l)<<16)) & ~0xfffff)
+#define PCI_PPBMEMLIMIT(h,l) ((((uint64_t)(h) << 32) + ((l)<<16)) | 0xfffff)
+#define PCI_PPBIOBASE(h,l) ((((h)<<16) + ((l)<<8)) & ~0xfff)
+#define PCI_PPBIOLIMIT(h,l) ((((h)<<16) + ((l)<<8)) | 0xfff)
+
/* config registers for header type 2 (CardBus) devices */
#define PCIR_MAX_BAR_2 0
@@ -246,6 +290,9 @@
#define PCIR_IOLIMIT0_2 0x30
#define PCIR_IOBASE1_2 0x34
#define PCIR_IOLIMIT1_2 0x38
+#define PCIM_CBBIO_16 0x0
+#define PCIM_CBBIO_32 0x1
+#define PCIM_CBBIO_MASK 0x3
#define PCIR_BRIDGECTL_2 0x3e
@@ -254,6 +301,11 @@
#define PCIR_PCCARDIF_2 0x44
+#define PCI_CBBMEMBASE(l) ((l) & ~0xfffff)
+#define PCI_CBBMEMLIMIT(l) ((l) | 0xfffff)
+#define PCI_CBBIOBASE(l) ((l) & ~0x3)
+#define PCI_CBBIOLIMIT(l) ((l) | 0x3)
+
/* PCI device class, subclass and programming interface definitions */
#define PCIC_OLD 0x00
@@ -351,6 +403,7 @@
#define PCIS_BASEPERIPH_RTC 0x03
#define PCIS_BASEPERIPH_PCIHOT 0x04
#define PCIS_BASEPERIPH_SDHC 0x05
+#define PCIS_BASEPERIPH_IOMMU 0x06
#define PCIS_BASEPERIPH_OTHER 0x80
#define PCIC_INPUTDEV 0x09
@@ -440,6 +493,17 @@
#define PCIB_BCR_DISCARD_TIMER_STATUS 0x0400
#define PCIB_BCR_DISCARD_TIMER_SERREN 0x0800
+#define CBB_BCR_PERR_ENABLE 0x0001
+#define CBB_BCR_SERR_ENABLE 0x0002
+#define CBB_BCR_ISA_ENABLE 0x0004
+#define CBB_BCR_VGA_ENABLE 0x0008
+#define CBB_BCR_MASTER_ABORT_MODE 0x0020
+#define CBB_BCR_CARDBUS_RESET 0x0040
+#define CBB_BCR_IREQ_INT_ENABLE 0x0080
+#define CBB_BCR_PREFETCH_0_ENABLE 0x0100
+#define CBB_BCR_PREFETCH_1_ENABLE 0x0200
+#define CBB_BCR_WRITE_POSTING_ENABLE 0x0400
+
/* PCI power manangement */
#define PCIR_POWER_CAP 0x2
#define PCIM_PCAP_SPEC 0x0007
@@ -523,6 +587,52 @@
#define PCIR_MSI_MASK 0x10
#define PCIR_MSI_PENDING 0x14
+/* PCI Enhanced Allocation registers */
+#define PCIR_EA_NUM_ENT 2 /* Number of Capability Entries */
+#define PCIM_EA_NUM_ENT_MASK 0x3f /* Num Entries Mask */
+#define PCIR_EA_FIRST_ENT 4 /* First EA Entry in List */
+#define PCIR_EA_FIRST_ENT_BRIDGE 8 /* First EA Entry for Bridges */
+#define PCIM_EA_ES 0x00000007 /* Entry Size */
+#define PCIM_EA_BEI 0x000000f0 /* BAR Equivalent Indicator */
+#define PCIM_EA_BEI_OFFSET 4
+/* 0-5 map to BARs 0-5 respectively */
+#define PCIM_EA_BEI_BAR_0 0
+#define PCIM_EA_BEI_BAR_5 5
+#define PCIM_EA_BEI_BAR(x) (((x) >> PCIM_EA_BEI_OFFSET) & 0xf)
+#define PCIM_EA_BEI_BRIDGE 0x6 /* Resource behind bridge */
+#define PCIM_EA_BEI_ENI 0x7 /* Equivalent Not Indicated */
+#define PCIM_EA_BEI_ROM 0x8 /* Expansion ROM */
+/* 9-14 map to VF BARs 0-5 respectively */
+#define PCIM_EA_BEI_VF_BAR_0 9
+#define PCIM_EA_BEI_VF_BAR_5 14
+#define PCIM_EA_BEI_RESERVED 0xf /* Reserved - Treat like ENI */
+#define PCIM_EA_PP 0x0000ff00 /* Primary Properties */
+#define PCIM_EA_PP_OFFSET 8
+#define PCIM_EA_SP_OFFSET 16
+#define PCIM_EA_SP 0x00ff0000 /* Secondary Properties */
+#define PCIM_EA_P_MEM 0x00 /* Non-Prefetch Memory */
+#define PCIM_EA_P_MEM_PREFETCH 0x01 /* Prefetchable Memory */
+#define PCIM_EA_P_IO 0x02 /* I/O Space */
+#define PCIM_EA_P_VF_MEM_PREFETCH 0x03 /* VF Prefetchable Memory */
+#define PCIM_EA_P_VF_MEM 0x04 /* VF Non-Prefetch Memory */
+#define PCIM_EA_P_BRIDGE_MEM 0x05 /* Bridge Non-Prefetch Memory */
+#define PCIM_EA_P_BRIDGE_MEM_PREFETCH 0x06 /* Bridge Prefetchable Memory */
+#define PCIM_EA_P_BRIDGE_IO 0x07 /* Bridge I/O Space */
+/* 0x08-0xfc reserved */
+#define PCIM_EA_P_MEM_RESERVED 0xfd /* Reserved Memory */
+#define PCIM_EA_P_IO_RESERVED 0xfe /* Reserved I/O Space */
+#define PCIM_EA_P_UNAVAILABLE 0xff /* Entry Unavailable */
+#define PCIM_EA_WRITABLE 0x40000000 /* Writable: 1 = RW, 0 = HwInit */
+#define PCIM_EA_ENABLE 0x80000000 /* Enable for this entry */
+#define PCIM_EA_BASE 4 /* Base Address Offset */
+#define PCIM_EA_MAX_OFFSET 8 /* MaxOffset (resource length) */
+/* bit 0 is reserved */
+#define PCIM_EA_IS_64 0x00000002 /* 64-bit field flag */
+#define PCIM_EA_FIELD_MASK 0xfffffffc /* For Base & Max Offset */
+/* Bridge config register */
+#define PCIM_EA_SEC_NR(reg) ((reg) & 0xff)
+#define PCIM_EA_SUB_NR(reg) (((reg) >> 8) & 0xff)
+
/* PCI-X definitions */
/* For header type 0 devices */
@@ -627,6 +737,9 @@
#define PCIR_VENDOR_LENGTH 0x2
#define PCIR_VENDOR_DATA 0x3
+/* PCI Device capability definitions */
+#define PCIR_DEVICE_LENGTH 0x2
+
/* PCI EHCI Debug Port definitions */
#define PCIR_DEBUG_PORT 0x2
#define PCIM_DEBUG_PORT_OFFSET 0x1FFF
@@ -737,8 +850,16 @@
#define PCIEM_SLOT_CTL_CCIE 0x0010
#define PCIEM_SLOT_CTL_HPIE 0x0020
#define PCIEM_SLOT_CTL_AIC 0x00c0
+#define PCIEM_SLOT_CTL_AI_ON 0x0040
+#define PCIEM_SLOT_CTL_AI_BLINK 0x0080
+#define PCIEM_SLOT_CTL_AI_OFF 0x00c0
#define PCIEM_SLOT_CTL_PIC 0x0300
+#define PCIEM_SLOT_CTL_PI_ON 0x0100
+#define PCIEM_SLOT_CTL_PI_BLINK 0x0200
+#define PCIEM_SLOT_CTL_PI_OFF 0x0300
#define PCIEM_SLOT_CTL_PCC 0x0400
+#define PCIEM_SLOT_CTL_PC_ON 0x0000
+#define PCIEM_SLOT_CTL_PC_OFF 0x0400
#define PCIEM_SLOT_CTL_EIC 0x0800
#define PCIEM_SLOT_CTL_DLLSCE 0x1000
#define PCIER_SLOT_STA 0x1a
@@ -764,6 +885,7 @@
#define PCIEM_ROOT_STA_PME_STATUS 0x00010000
#define PCIEM_ROOT_STA_PME_PEND 0x00020000
#define PCIER_DEVICE_CAP2 0x24
+#define PCIEM_CAP2_ARI 0x20
#define PCIER_DEVICE_CTL2 0x28
#define PCIEM_CTL2_COMP_TIMEOUT_VAL 0x000f
#define PCIEM_CTL2_COMP_TIMEOUT_DIS 0x0010
@@ -787,117 +909,6 @@
#define PCIER_SLOT_CTL2 0x38
#define PCIER_SLOT_STA2 0x3a
-/* Old compatibility definitions for PCI Express registers */
-#define PCIR_EXPRESS_FLAGS PCIER_FLAGS
-#define PCIM_EXP_FLAGS_VERSION PCIEM_FLAGS_VERSION
-#define PCIM_EXP_FLAGS_TYPE PCIEM_FLAGS_TYPE
-#define PCIM_EXP_TYPE_ENDPOINT PCIEM_TYPE_ENDPOINT
-#define PCIM_EXP_TYPE_LEGACY_ENDPOINT PCIEM_TYPE_LEGACY_ENDPOINT
-#define PCIM_EXP_TYPE_ROOT_PORT PCIEM_TYPE_ROOT_PORT
-#define PCIM_EXP_TYPE_UPSTREAM_PORT PCIEM_TYPE_UPSTREAM_PORT
-#define PCIM_EXP_TYPE_DOWNSTREAM_PORT PCIEM_TYPE_DOWNSTREAM_PORT
-#define PCIM_EXP_TYPE_PCI_BRIDGE PCIEM_TYPE_PCI_BRIDGE
-#define PCIM_EXP_TYPE_PCIE_BRIDGE PCIEM_TYPE_PCIE_BRIDGE
-#define PCIM_EXP_TYPE_ROOT_INT_EP PCIEM_TYPE_ROOT_INT_EP
-#define PCIM_EXP_TYPE_ROOT_EC PCIEM_TYPE_ROOT_EC
-#define PCIM_EXP_FLAGS_SLOT PCIEM_FLAGS_SLOT
-#define PCIM_EXP_FLAGS_IRQ PCIEM_FLAGS_IRQ
-#define PCIR_EXPRESS_DEVICE_CAP PCIER_DEVICE_CAP
-#define PCIM_EXP_CAP_MAX_PAYLOAD PCIEM_CAP_MAX_PAYLOAD
-#define PCIM_EXP_CAP_PHANTHOM_FUNCS PCIEM_CAP_PHANTHOM_FUNCS
-#define PCIM_EXP_CAP_EXT_TAG_FIELD PCIEM_CAP_EXT_TAG_FIELD
-#define PCIM_EXP_CAP_L0S_LATENCY PCIEM_CAP_L0S_LATENCY
-#define PCIM_EXP_CAP_L1_LATENCY PCIEM_CAP_L1_LATENCY
-#define PCIM_EXP_CAP_ROLE_ERR_RPT PCIEM_CAP_ROLE_ERR_RPT
-#define PCIM_EXP_CAP_SLOT_PWR_LIM_VAL PCIEM_CAP_SLOT_PWR_LIM_VAL
-#define PCIM_EXP_CAP_SLOT_PWR_LIM_SCALE PCIEM_CAP_SLOT_PWR_LIM_SCALE
-#define PCIM_EXP_CAP_FLR PCIEM_CAP_FLR
-#define PCIR_EXPRESS_DEVICE_CTL PCIER_DEVICE_CTL
-#define PCIM_EXP_CTL_COR_ENABLE PCIEM_CTL_COR_ENABLE
-#define PCIM_EXP_CTL_NFER_ENABLE PCIEM_CTL_NFER_ENABLE
-#define PCIM_EXP_CTL_FER_ENABLE PCIEM_CTL_FER_ENABLE
-#define PCIM_EXP_CTL_URR_ENABLE PCIEM_CTL_URR_ENABLE
-#define PCIM_EXP_CTL_RELAXED_ORD_ENABLE PCIEM_CTL_RELAXED_ORD_ENABLE
-#define PCIM_EXP_CTL_MAX_PAYLOAD PCIEM_CTL_MAX_PAYLOAD
-#define PCIM_EXP_CTL_EXT_TAG_FIELD PCIEM_CTL_EXT_TAG_FIELD
-#define PCIM_EXP_CTL_PHANTHOM_FUNCS PCIEM_CTL_PHANTHOM_FUNCS
-#define PCIM_EXP_CTL_AUX_POWER_PM PCIEM_CTL_AUX_POWER_PM
-#define PCIM_EXP_CTL_NOSNOOP_ENABLE PCIEM_CTL_NOSNOOP_ENABLE
-#define PCIM_EXP_CTL_MAX_READ_REQUEST PCIEM_CTL_MAX_READ_REQUEST
-#define PCIM_EXP_CTL_BRDG_CFG_RETRY PCIEM_CTL_BRDG_CFG_RETRY
-#define PCIM_EXP_CTL_INITIATE_FLR PCIEM_CTL_INITIATE_FLR
-#define PCIR_EXPRESS_DEVICE_STA PCIER_DEVICE_STA
-#define PCIM_EXP_STA_CORRECTABLE_ERROR PCIEM_STA_CORRECTABLE_ERROR
-#define PCIM_EXP_STA_NON_FATAL_ERROR PCIEM_STA_NON_FATAL_ERROR
-#define PCIM_EXP_STA_FATAL_ERROR PCIEM_STA_FATAL_ERROR
-#define PCIM_EXP_STA_UNSUPPORTED_REQ PCIEM_STA_UNSUPPORTED_REQ
-#define PCIM_EXP_STA_AUX_POWER PCIEM_STA_AUX_POWER
-#define PCIM_EXP_STA_TRANSACTION_PND PCIEM_STA_TRANSACTION_PND
-#define PCIR_EXPRESS_LINK_CAP PCIER_LINK_CAP
-#define PCIM_LINK_CAP_MAX_SPEED PCIEM_LINK_CAP_MAX_SPEED
-#define PCIM_LINK_CAP_MAX_WIDTH PCIEM_LINK_CAP_MAX_WIDTH
-#define PCIM_LINK_CAP_ASPM PCIEM_LINK_CAP_ASPM
-#define PCIM_LINK_CAP_L0S_EXIT PCIEM_LINK_CAP_L0S_EXIT
-#define PCIM_LINK_CAP_L1_EXIT PCIEM_LINK_CAP_L1_EXIT
-#define PCIM_LINK_CAP_CLOCK_PM PCIEM_LINK_CAP_CLOCK_PM
-#define PCIM_LINK_CAP_SURPRISE_DOWN PCIEM_LINK_CAP_SURPRISE_DOWN
-#define PCIM_LINK_CAP_DL_ACTIVE PCIEM_LINK_CAP_DL_ACTIVE
-#define PCIM_LINK_CAP_LINK_BW_NOTIFY PCIEM_LINK_CAP_LINK_BW_NOTIFY
-#define PCIM_LINK_CAP_ASPM_COMPLIANCE PCIEM_LINK_CAP_ASPM_COMPLIANCE
-#define PCIM_LINK_CAP_PORT PCIEM_LINK_CAP_PORT
-#define PCIR_EXPRESS_LINK_CTL PCIER_LINK_CTL
-#define PCIM_EXP_LINK_CTL_ASPMC_DIS PCIEM_LINK_CTL_ASPMC_DIS
-#define PCIM_EXP_LINK_CTL_ASPMC_L0S PCIEM_LINK_CTL_ASPMC_L0S
-#define PCIM_EXP_LINK_CTL_ASPMC_L1 PCIEM_LINK_CTL_ASPMC_L1
-#define PCIM_EXP_LINK_CTL_ASPMC PCIEM_LINK_CTL_ASPMC
-#define PCIM_EXP_LINK_CTL_RCB PCIEM_LINK_CTL_RCB
-#define PCIM_EXP_LINK_CTL_LINK_DIS PCIEM_LINK_CTL_LINK_DIS
-#define PCIM_EXP_LINK_CTL_RETRAIN_LINK PCIEM_LINK_CTL_RETRAIN_LINK
-#define PCIM_EXP_LINK_CTL_COMMON_CLOCK PCIEM_LINK_CTL_COMMON_CLOCK
-#define PCIM_EXP_LINK_CTL_EXTENDED_SYNC PCIEM_LINK_CTL_EXTENDED_SYNC
-#define PCIM_EXP_LINK_CTL_ECPM PCIEM_LINK_CTL_ECPM
-#define PCIM_EXP_LINK_CTL_HAWD PCIEM_LINK_CTL_HAWD
-#define PCIM_EXP_LINK_CTL_LBMIE PCIEM_LINK_CTL_LBMIE
-#define PCIM_EXP_LINK_CTL_LABIE PCIEM_LINK_CTL_LABIE
-#define PCIR_EXPRESS_LINK_STA PCIER_LINK_STA
-#define PCIM_LINK_STA_SPEED PCIEM_LINK_STA_SPEED
-#define PCIM_LINK_STA_WIDTH PCIEM_LINK_STA_WIDTH
-#define PCIM_LINK_STA_TRAINING_ERROR PCIEM_LINK_STA_TRAINING_ERROR
-#define PCIM_LINK_STA_TRAINING PCIEM_LINK_STA_TRAINING
-#define PCIM_LINK_STA_SLOT_CLOCK PCIEM_LINK_STA_SLOT_CLOCK
-#define PCIM_LINK_STA_DL_ACTIVE PCIEM_LINK_STA_DL_ACTIVE
-#define PCIM_LINK_STA_LINK_BW_MGMT PCIEM_LINK_STA_LINK_BW_MGMT
-#define PCIM_LINK_STA_LINK_AUTO_BW PCIEM_LINK_STA_LINK_AUTO_BW
-#define PCIR_EXPRESS_SLOT_CAP PCIER_SLOT_CAP
-#define PCIR_EXPRESS_SLOT_CTL PCIER_SLOT_CTL
-#define PCIR_EXPRESS_SLOT_STA PCIER_SLOT_STA
-#define PCIR_EXPRESS_ROOT_CTL PCIER_ROOT_CTL
-#define PCIR_EXPRESS_ROOT_CAP PCIER_ROOT_CAP
-#define PCIR_EXPRESS_ROOT_STA PCIER_ROOT_STA
-#define PCIR_EXPRESS_DEVICE_CAP2 PCIER_DEVICE_CAP2
-#define PCIR_EXPRESS_DEVICE_CTL2 PCIER_DEVICE_CTL2
-#define PCIM_EXP_CTL2_COMP_TIMEOUT_VAL PCIEM_CTL2_COMP_TIMEOUT_VAL
-#define PCIM_EXP_CTL2_COMP_TIMEOUT_DIS PCIEM_CTL2_COMP_TIMEOUT_DIS
-#define PCIM_EXP_CTL2_ARI PCIEM_CTL2_ARI
-#define PCIM_EXP_CTL2_ATOMIC_REQ_ENABLE PCIEM_CTL2_ATOMIC_REQ_ENABLE
-#define PCIM_EXP_CTL2_ATOMIC_EGR_BLOCK PCIEM_CTL2_ATOMIC_EGR_BLOCK
-#define PCIM_EXP_CTL2_ID_ORDERED_REQ_EN PCIEM_CTL2_ID_ORDERED_REQ_EN
-#define PCIM_EXP_CTL2_ID_ORDERED_CMP_EN PCIEM_CTL2_ID_ORDERED_CMP_EN
-#define PCIM_EXP_CTL2_LTR_ENABLE PCIEM_CTL2_LTR_ENABLE
-#define PCIM_EXP_CTL2_OBFF PCIEM_CTL2_OBFF
-#define PCIM_EXP_OBFF_DISABLE PCIEM_OBFF_DISABLE
-#define PCIM_EXP_OBFF_MSGA_ENABLE PCIEM_OBFF_MSGA_ENABLE
-#define PCIM_EXP_OBFF_MSGB_ENABLE PCIEM_OBFF_MSGB_ENABLE
-#define PCIM_EXP_OBFF_WAKE_ENABLE PCIEM_OBFF_WAKE_ENABLE
-#define PCIM_EXP_CTL2_END2END_TLP PCIEM_CTL2_END2END_TLP
-#define PCIR_EXPRESS_DEVICE_STA2 PCIER_DEVICE_STA2
-#define PCIR_EXPRESS_LINK_CAP2 PCIER_LINK_CAP2
-#define PCIR_EXPRESS_LINK_CTL2 PCIER_LINK_CTL2
-#define PCIR_EXPRESS_LINK_STA2 PCIER_LINK_STA2
-#define PCIR_EXPRESS_SLOT_CAP2 PCIER_SLOT_CAP2
-#define PCIR_EXPRESS_SLOT_CTL2 PCIER_SLOT_CTL2
-#define PCIR_EXPRESS_SLOT_STA2 PCIER_SLOT_STA2
-
/* MSI-X definitions */
#define PCIR_MSIX_CTRL 0x2
#define PCIM_MSIXCTRL_MSIX_ENABLE 0x8000
@@ -995,3 +1006,22 @@
/* Serial Number definitions */
#define PCIR_SERIAL_LOW 0x04
#define PCIR_SERIAL_HIGH 0x08
+
+/* SR-IOV definitions */
+#define PCIR_SRIOV_CTL 0x08
+#define PCIM_SRIOV_VF_EN 0x01
+#define PCIM_SRIOV_VF_MSE 0x08 /* Memory space enable. */
+#define PCIM_SRIOV_ARI_EN 0x10
+#define PCIR_SRIOV_TOTAL_VFS 0x0E
+#define PCIR_SRIOV_NUM_VFS 0x10
+#define PCIR_SRIOV_VF_OFF 0x14
+#define PCIR_SRIOV_VF_STRIDE 0x16
+#define PCIR_SRIOV_VF_DID 0x1A
+#define PCIR_SRIOV_PAGE_CAP 0x1C
+#define PCIR_SRIOV_PAGE_SIZE 0x20
+
+#define PCI_SRIOV_BASE_PAGE_SHIFT 12
+
+#define PCIR_SRIOV_BARS 0x24
+#define PCIR_SRIOV_BAR(x) (PCIR_SRIOV_BARS + (x) * 4)
+