]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h
ShellPkg/pci: Fix extended register dumping for MFVC capability
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / Pci.h
index 8a053ab981c7704d9cf649ae6c5fb9d5a32f94b9..84f82caf1fde51bd2896230ceb8ce86a7b1b534c 100644 (file)
@@ -2,7 +2,7 @@
   Header file for Pci shell Debug1 function.\r
 \r
   Copyright (c) 2013 Hewlett-Packard Development Company, L.P.\r
-  Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -23,399 +23,18 @@ typedef enum {
   PciUndefined\r
 } PCI_HEADER_TYPE;\r
 \r
-#define HEADER_TYPE_MULTI_FUNCTION    0x80\r
-\r
-#define MAX_BUS_NUMBER                255\r
-#define MAX_DEVICE_NUMBER             31\r
-#define MAX_FUNCTION_NUMBER           7\r
-\r
-#define EFI_PCI_CAPABILITY_ID_PCIEXP  0x10\r
-#define EFI_PCI_CAPABILITY_ID_PCIX    0x07\r
-\r
-#define CALC_EFI_PCI_ADDRESS(Bus, Dev, Func, Reg) \\r
-    ((UINT64) ((((UINTN) Bus) << 24) + (((UINTN) Dev) << 16) + (((UINTN) Func) << 8) + ((UINTN) Reg)))\r
-\r
-#define CALC_EFI_PCIEX_ADDRESS(Bus, Dev, Func, ExReg) ( \\r
-      (UINT64) ((((UINTN) Bus) << 24) + (((UINTN) Dev) << 16) + (((UINTN) Func) << 8) + (LShiftU64 ((UINT64) ExReg, 32))) \\r
-   );\r
-\r
 #define INDEX_OF(Field)                               ((UINT8 *) (Field) - (UINT8 *) mConfigSpace)\r
 \r
-#define PCI_BIT_0                                     0x00000001\r
-#define PCI_BIT_1                                     0x00000002\r
-#define PCI_BIT_2                                     0x00000004\r
-#define PCI_BIT_3                                     0x00000008\r
-#define PCI_BIT_4                                     0x00000010\r
-#define PCI_BIT_5                                     0x00000020\r
-#define PCI_BIT_6                                     0x00000040\r
-#define PCI_BIT_7                                     0x00000080\r
-#define PCI_BIT_8                                     0x00000100\r
-#define PCI_BIT_9                                     0x00000200\r
-#define PCI_BIT_10                                    0x00000400\r
-#define PCI_BIT_11                                    0x00000800\r
-#define PCI_BIT_12                                    0x00001000\r
-#define PCI_BIT_13                                    0x00002000\r
-#define PCI_BIT_14                                    0x00004000\r
-#define PCI_BIT_15                                    0x00008000\r
-\r
-//\r
-// PCIE device/port types\r
-//\r
-#define PCIE_PCIE_ENDPOINT                            0\r
-#define PCIE_LEGACY_PCIE_ENDPOINT                     1\r
-#define PCIE_ROOT_COMPLEX_ROOT_PORT                   4\r
-#define PCIE_SWITCH_UPSTREAM_PORT                     5\r
-#define PCIE_SWITCH_DOWNSTREAM_PORT                   6\r
-#define PCIE_PCIE_TO_PCIX_BRIDGE                      7\r
-#define PCIE_PCIX_TO_PCIE_BRIDGE                      8\r
-#define PCIE_ROOT_COMPLEX_INTEGRATED_PORT             9\r
-#define PCIE_ROOT_COMPLEX_EVENT_COLLECTOR             10\r
-#define PCIE_DEVICE_PORT_TYPE_MAX                     11\r
-\r
 #define IS_PCIE_ENDPOINT(DevicePortType) \\r
-    ((DevicePortType) == PCIE_PCIE_ENDPOINT || \\r
-     (DevicePortType) == PCIE_LEGACY_PCIE_ENDPOINT || \\r
-     (DevicePortType) == PCIE_ROOT_COMPLEX_INTEGRATED_PORT)\r
+    ((DevicePortType) == PCIE_DEVICE_PORT_TYPE_PCIE_ENDPOINT || \\r
+     (DevicePortType) == PCIE_DEVICE_PORT_TYPE_LEGACY_PCIE_ENDPOINT || \\r
+     (DevicePortType) == PCIE_DEVICE_PORT_TYPE_ROOT_COMPLEX_INTEGRATED_ENDPOINT)\r
 \r
 #define IS_PCIE_SWITCH(DevicePortType) \\r
-    ((DevicePortType == PCIE_SWITCH_UPSTREAM_PORT) || \\r
-     (DevicePortType == PCIE_SWITCH_DOWNSTREAM_PORT))\r
-\r
-//\r
-// Capabilities Register\r
-//\r
-#define PCIE_CAP_VERSION(PcieCapReg) \\r
-    ((PcieCapReg) & 0x0f)\r
-#define PCIE_CAP_DEVICEPORT_TYPE(PcieCapReg) \\r
-    (((PcieCapReg) >> 4) & 0x0f)\r
-#define PCIE_CAP_SLOT_IMPLEMENTED(PcieCapReg) \\r
-    (((PcieCapReg) >> 8) & 0x1)\r
-#define PCIE_CAP_INT_MSG_NUM(PcieCapReg) \\r
-    (((PcieCapReg) >> 9) & 0x1f)\r
-//\r
-// Device Capabilities Register\r
-//\r
-#define PCIE_CAP_MAX_PAYLOAD(PcieDeviceCap) \\r
-    ((PcieDeviceCap) & 0x7)\r
-#define PCIE_CAP_PHANTOM_FUNC(PcieDeviceCap) \\r
-    (((PcieDeviceCap) >> 3) & 0x3)\r
-#define PCIE_CAP_EXTENDED_TAG(PcieDeviceCap) \\r
-    (((PcieDeviceCap) >> 5) & 0x1)\r
-#define PCIE_CAP_L0SLATENCY(PcieDeviceCap) \\r
-    (((PcieDeviceCap) >> 6) & 0x7)\r
-#define PCIE_CAP_L1LATENCY(PcieDeviceCap) \\r
-    (((PcieDeviceCap) >> 9) & 0x7)\r
-#define PCIE_CAP_ERR_REPORTING(PcieDeviceCap) \\r
-    (((PcieDeviceCap) >> 15) & 0x1)\r
-#define PCIE_CAP_SLOT_POWER_VALUE(PcieDeviceCap) \\r
-    (((PcieDeviceCap) >> 18) & 0x0ff)\r
-#define PCIE_CAP_SLOT_POWER_SCALE(PcieDeviceCap) \\r
-    (((PcieDeviceCap) >> 26) & 0x3)\r
-#define PCIE_CAP_FUNC_LEVEL_RESET(PcieDeviceCap) \\r
-    (((PcieDeviceCap) >> 28) & 0x1)\r
-//\r
-// Device Control Register\r
-//\r
-#define PCIE_CAP_COR_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
-    ((PcieDeviceControl) & 0x1)\r
-#define PCIE_CAP_NONFAT_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 1) & 0x1)\r
-#define PCIE_CAP_FATAL_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 2) & 0x1)\r
-#define PCIE_CAP_UNSUP_REQ_REPORTING_ENABLE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 3) & 0x1)\r
-#define PCIE_CAP_RELAXED_ORDERING_ENABLE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 4) & 0x1)\r
-#define PCIE_CAP_MAX_PAYLOAD_SIZE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 5) & 0x7)\r
-#define PCIE_CAP_EXTENDED_TAG_ENABLE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 8) & 0x1)\r
-#define PCIE_CAP_PHANTOM_FUNC_ENABLE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 9) & 0x1)\r
-#define PCIE_CAP_AUX_PM_ENABLE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 10) & 0x1)\r
-#define PCIE_CAP_NO_SNOOP_ENABLE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 11) & 0x1)\r
-#define PCIE_CAP_MAX_READ_REQ_SIZE(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 12) & 0x7)\r
-#define PCIE_CAP_BRG_CONF_RETRY(PcieDeviceControl) \\r
-    (((PcieDeviceControl) >> 15) & 0x1)\r
-//\r
-// Device Status Register\r
-//\r
-#define PCIE_CAP_COR_ERR_DETECTED(PcieDeviceStatus) \\r
-    ((PcieDeviceStatus) & 0x1)\r
-#define PCIE_CAP_NONFAT_ERR_DETECTED(PcieDeviceStatus) \\r
-    (((PcieDeviceStatus) >> 1) & 0x1)\r
-#define PCIE_CAP_FATAL_ERR_DETECTED(PcieDeviceStatus) \\r
-    (((PcieDeviceStatus) >> 2) & 0x1)\r
-#define PCIE_CAP_UNSUP_REQ_DETECTED(PcieDeviceStatus) \\r
-    (((PcieDeviceStatus) >> 3) & 0x1)\r
-#define PCIE_CAP_AUX_POWER_DETECTED(PcieDeviceStatus) \\r
-    (((PcieDeviceStatus) >> 4) & 0x1)\r
-#define PCIE_CAP_TRANSACTION_PENDING(PcieDeviceStatus) \\r
-    (((PcieDeviceStatus) >> 5) & 0x1)\r
-//\r
-// Link Capabilities Register\r
-//\r
-#define PCIE_CAP_MAX_LINK_SPEED(PcieLinkCap) \\r
-    ((PcieLinkCap) & 0x0f)\r
-#define PCIE_CAP_MAX_LINK_WIDTH(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 4) & 0x3f)\r
-#define PCIE_CAP_ASPM_SUPPORT(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 10) & 0x3)\r
-#define PCIE_CAP_L0S_LATENCY(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 12) & 0x7)\r
-#define PCIE_CAP_L1_LATENCY(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 15) & 0x7)\r
-#define PCIE_CAP_CLOCK_PM(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 18) & 0x1)\r
-#define PCIE_CAP_SUP_DOWN_ERR_REPORTING(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 19) & 0x1)\r
-#define PCIE_CAP_LINK_ACTIVE_REPORTING(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 20) & 0x1)\r
-#define PCIE_CAP_LINK_BWD_NOTIF_CAP(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 21) & 0x1)\r
-#define PCIE_CAP_PORT_NUMBER(PcieLinkCap) \\r
-    (((PcieLinkCap) >> 24) & 0x0ff)\r
-//\r
-// Link Control Register\r
-//\r
-#define PCIE_CAP_ASPM_CONTROL(PcieLinkControl) \\r
-    ((PcieLinkControl) & 0x3)\r
-#define PCIE_CAP_RCB(PcieLinkControl) \\r
-    (((PcieLinkControl) >> 3) & 0x1)\r
-#define PCIE_CAP_LINK_DISABLE(PcieLinkControl) \\r
-    (((PcieLinkControl) >> 4) & 0x1)\r
-#define PCIE_CAP_COMMON_CLK_CONF(PcieLinkControl) \\r
-    (((PcieLinkControl) >> 6) & 0x1)\r
-#define PCIE_CAP_EXT_SYNC(PcieLinkControl) \\r
-    (((PcieLinkControl) >> 7) & 0x1)\r
-#define PCIE_CAP_CLK_PWR_MNG(PcieLinkControl) \\r
-    (((PcieLinkControl) >> 8) & 0x1)\r
-#define PCIE_CAP_HW_AUTO_WIDTH_DISABLE(PcieLinkControl) \\r
-    (((PcieLinkControl) >> 9) & 0x1)\r
-#define PCIE_CAP_LINK_BDW_MNG_INT_EN(PcieLinkControl) \\r
-    (((PcieLinkControl) >> 10) & 0x1)\r
-#define PCIE_CAP_LINK_AUTO_BDW_INT_EN(PcieLinkControl) \\r
-    (((PcieLinkControl) >> 11) & 0x1)\r
-//\r
-// Link Status Register\r
-//\r
-#define PCIE_CAP_CUR_LINK_SPEED(PcieLinkStatus) \\r
-    ((PcieLinkStatus) & 0x0f)\r
-#define PCIE_CAP_NEGO_LINK_WIDTH(PcieLinkStatus) \\r
-    (((PcieLinkStatus) >> 4) & 0x3f)\r
-#define PCIE_CAP_LINK_TRAINING(PcieLinkStatus) \\r
-    (((PcieLinkStatus) >> 11) & 0x1)\r
-#define PCIE_CAP_SLOT_CLK_CONF(PcieLinkStatus) \\r
-    (((PcieLinkStatus) >> 12) & 0x1)\r
-#define PCIE_CAP_DATA_LINK_ACTIVE(PcieLinkStatus) \\r
-    (((PcieLinkStatus) >> 13) & 0x1)\r
-#define PCIE_CAP_LINK_BDW_MNG_STAT(PcieLinkStatus) \\r
-    (((PcieLinkStatus) >> 14) & 0x1)\r
-#define PCIE_CAP_LINK_AUTO_BDW_STAT(PcieLinkStatus) \\r
-    (((PcieLinkStatus) >> 15) & 0x1)\r
-//\r
-// Slot Capabilities Register\r
-//\r
-#define PCIE_CAP_ATT_BUT_PRESENT(PcieSlotCap) \\r
-    ((PcieSlotCap) & 0x1)\r
-#define PCIE_CAP_PWR_CTRLLER_PRESENT(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 1) & 0x1)\r
-#define PCIE_CAP_MRL_SENSOR_PRESENT(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 2) & 0x1)\r
-#define PCIE_CAP_ATT_IND_PRESENT(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 3) & 0x1)\r
-#define PCIE_CAP_PWD_IND_PRESENT(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 4) & 0x1)\r
-#define PCIE_CAP_HOTPLUG_SUPPRISE(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 5) & 0x1)\r
-#define PCIE_CAP_HOTPLUG_CAPABLE(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 6) & 0x1)\r
-#define PCIE_CAP_SLOT_PWR_LIMIT_VALUE(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 7) & 0x0ff)\r
-#define PCIE_CAP_SLOT_PWR_LIMIT_SCALE(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 15) & 0x3)\r
-#define PCIE_CAP_ELEC_INTERLOCK_PRESENT(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 17) & 0x1)\r
-#define PCIE_CAP_NO_COMM_COMPLETED_SUP(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 18) & 0x1)\r
-#define PCIE_CAP_PHY_SLOT_NUM(PcieSlotCap) \\r
-    (((PcieSlotCap) >> 19) & 0x1fff)\r
-//\r
-// Slot Control Register\r
-//\r
-#define PCIE_CAP_ATT_BUT_ENABLE(PcieSlotControl) \\r
-    ((PcieSlotControl) & 0x1)\r
-#define PCIE_CAP_PWR_FLT_DETECT_ENABLE(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 1) & 0x1)\r
-#define PCIE_CAP_MRL_SENSOR_CHANGE_ENABLE(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 2) & 0x1)\r
-#define PCIE_CAP_PRES_DETECT_CHANGE_ENABLE(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 3) & 0x1)\r
-#define PCIE_CAP_COMM_CMPL_INT_ENABLE(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 4) & 0x1)\r
-#define PCIE_CAP_HOTPLUG_INT_ENABLE(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 5) & 0x1)\r
-#define PCIE_CAP_ATT_IND_CTRL(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 6) & 0x3)\r
-#define PCIE_CAP_PWR_IND_CTRL(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 8) & 0x3)\r
-#define PCIE_CAP_PWR_CTRLLER_CTRL(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 10) & 0x1)\r
-#define PCIE_CAP_ELEC_INTERLOCK_CTRL(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 11) & 0x1)\r
-#define PCIE_CAP_DLINK_STAT_CHANGE_ENABLE(PcieSlotControl) \\r
-    (((PcieSlotControl) >> 12) & 0x1)\r
-//\r
-// Slot Status Register\r
-//\r
-#define PCIE_CAP_ATT_BUT_PRESSED(PcieSlotStatus) \\r
-    ((PcieSlotStatus) & 0x1)\r
-#define PCIE_CAP_PWR_FLT_DETECTED(PcieSlotStatus) \\r
-    (((PcieSlotStatus) >> 1) & 0x1)\r
-#define PCIE_CAP_MRL_SENSOR_CHANGED(PcieSlotStatus) \\r
-    (((PcieSlotStatus) >> 2) & 0x1)\r
-#define PCIE_CAP_PRES_DETECT_CHANGED(PcieSlotStatus) \\r
-    (((PcieSlotStatus) >> 3) & 0x1)\r
-#define PCIE_CAP_COMM_COMPLETED(PcieSlotStatus) \\r
-    (((PcieSlotStatus) >> 4) & 0x1)\r
-#define PCIE_CAP_MRL_SENSOR_STATE(PcieSlotStatus) \\r
-    (((PcieSlotStatus) >> 5) & 0x1)\r
-#define PCIE_CAP_PRES_DETECT_STATE(PcieSlotStatus) \\r
-    (((PcieSlotStatus) >> 6) & 0x1)\r
-#define PCIE_CAP_ELEC_INTERLOCK_STATE(PcieSlotStatus) \\r
-    (((PcieSlotStatus) >> 7) & 0x1)\r
-#define PCIE_CAP_DLINK_STAT_CHANGED(PcieSlotStatus) \\r
-    (((PcieSlotStatus) >> 8) & 0x1)\r
-//\r
-// Root Control Register\r
-//\r
-#define PCIE_CAP_SYSERR_ON_CORERR_EN(PcieRootControl) \\r
-    ((PcieRootControl) & 0x1)\r
-#define PCIE_CAP_SYSERR_ON_NONFATERR_EN(PcieRootControl) \\r
-    (((PcieRootControl) >> 1) & 0x1)\r
-#define PCIE_CAP_SYSERR_ON_FATERR_EN(PcieRootControl) \\r
-    (((PcieRootControl) >> 2) & 0x1)\r
-#define PCIE_CAP_PME_INT_ENABLE(PcieRootControl) \\r
-    (((PcieRootControl) >> 3) & 0x1)\r
-#define PCIE_CAP_CRS_SW_VIS_ENABLE(PcieRootControl) \\r
-    (((PcieRootControl) >> 4) & 0x1)\r
-//\r
-// Root Capabilities Register\r
-//\r
-#define PCIE_CAP_CRS_SW_VIS(PcieRootCap) \\r
-    ((PcieRootCap) & 0x1)\r
-//\r
-// Root Status Register\r
-//\r
-#define PCIE_CAP_PME_REQ_ID(PcieRootStatus) \\r
-    ((PcieRootStatus) & 0x0ffff)\r
-#define PCIE_CAP_PME_STATUS(PcieRootStatus) \\r
-    (((PcieRootStatus) >> 16) & 0x1)\r
-#define PCIE_CAP_PME_PENDING(PcieRootStatus) \\r
-    (((PcieRootStatus) >> 17) & 0x1)\r
+    ((DevicePortType == PCIE_DEVICE_PORT_TYPE_UPSTREAM_PORT) || \\r
+     (DevicePortType == PCIE_DEVICE_PORT_TYPE_DOWNSTREAM_PORT))\r
 \r
 #pragma pack(1)\r
-//\r
-// Common part of the PCI configuration space header for devices, P2P bridges,\r
-// and cardbus bridges\r
-//\r
-typedef struct {\r
-  UINT16  VendorId;\r
-  UINT16  DeviceId;\r
-\r
-  UINT16  Command;\r
-  UINT16  Status;\r
-\r
-  UINT8   RevisionId;\r
-  UINT8   ClassCode[3];\r
-\r
-  UINT8   CacheLineSize;\r
-  UINT8   PrimaryLatencyTimer;\r
-  UINT8   HeaderType;\r
-  UINT8   Bist;\r
-\r
-} PCI_COMMON_HEADER;\r
-\r
-//\r
-// PCI configuration space header for devices(after the common part)\r
-//\r
-typedef struct {\r
-  UINT32  Bar[6];           // Base Address Registers\r
-  UINT32  CardBusCISPtr;    // CardBus CIS Pointer\r
-  UINT16  SubVendorId;      // Subsystem Vendor ID\r
-  UINT16  SubSystemId;      // Subsystem ID\r
-  UINT32  ROMBar;           // Expansion ROM Base Address\r
-  UINT8   CapabilitiesPtr;  // Capabilities Pointer\r
-  UINT8   Reserved[3];\r
-\r
-  UINT32  Reserved1;\r
-\r
-  UINT8   InterruptLine;    // Interrupt Line\r
-  UINT8   InterruptPin;     // Interrupt Pin\r
-  UINT8   MinGnt;           // Min_Gnt\r
-  UINT8   MaxLat;           // Max_Lat\r
-} PCI_DEVICE_HEADER;\r
-\r
-//\r
-// PCI configuration space header for pci-to-pci bridges(after the common part)\r
-//\r
-typedef struct {\r
-  UINT32  Bar[2];                 // Base Address Registers\r
-  UINT8   PrimaryBus;             // Primary Bus Number\r
-  UINT8   SecondaryBus;           // Secondary Bus Number\r
-  UINT8   SubordinateBus;         // Subordinate Bus Number\r
-  UINT8   SecondaryLatencyTimer;  // Secondary Latency Timer\r
-  UINT8   IoBase;                 // I/O Base\r
-  UINT8   IoLimit;                // I/O Limit\r
-  UINT16  SecondaryStatus;        // Secondary Status\r
-  UINT16  MemoryBase;             // Memory Base\r
-  UINT16  MemoryLimit;            // Memory Limit\r
-  UINT16  PrefetchableMemBase;    // Pre-fetchable Memory Base\r
-  UINT16  PrefetchableMemLimit;   // Pre-fetchable Memory Limit\r
-  UINT32  PrefetchableBaseUpper;  // Pre-fetchable Base Upper 32 bits\r
-  UINT32  PrefetchableLimitUpper; // Pre-fetchable Limit Upper 32 bits\r
-  UINT16  IoBaseUpper;            // I/O Base Upper 16 bits\r
-  UINT16  IoLimitUpper;           // I/O Limit Upper 16 bits\r
-  UINT8   CapabilitiesPtr;        // Capabilities Pointer\r
-  UINT8   Reserved[3];\r
-\r
-  UINT32  ROMBar;                 // Expansion ROM Base Address\r
-  UINT8   InterruptLine;          // Interrupt Line\r
-  UINT8   InterruptPin;           // Interrupt Pin\r
-  UINT16  BridgeControl;          // Bridge Control\r
-} PCI_BRIDGE_HEADER;\r
-\r
-//\r
-// PCI configuration space header for cardbus bridges(after the common part)\r
-//\r
-typedef struct {\r
-  UINT32  CardBusSocketReg; // Cardus Socket/ExCA Base\r
-  // Address Register\r
-  //\r
-  UINT8   CapabilitiesPtr;      // 14h in pci-cardbus bridge.\r
-  UINT8   Reserved;\r
-  UINT16  SecondaryStatus;      // Secondary Status\r
-  UINT8   PciBusNumber;         // PCI Bus Number\r
-  UINT8   CardBusBusNumber;     // CardBus Bus Number\r
-  UINT8   SubordinateBusNumber; // Subordinate Bus Number\r
-  UINT8   CardBusLatencyTimer;  // CardBus Latency Timer\r
-  UINT32  MemoryBase0;          // Memory Base Register 0\r
-  UINT32  MemoryLimit0;         // Memory Limit Register 0\r
-  UINT32  MemoryBase1;\r
-  UINT32  MemoryLimit1;\r
-  UINT32  IoBase0;\r
-  UINT32  IoLimit0;             // I/O Base Register 0\r
-  UINT32  IoBase1;              // I/O Limit Register 0\r
-  UINT32  IoLimit1;\r
-\r
-  UINT8   InterruptLine;        // Interrupt Line\r
-  UINT8   InterruptPin;         // Interrupt Pin\r
-  UINT16  BridgeControl;        // Bridge Control\r
-} PCI_CARDBUS_HEADER;\r
-\r
 //\r
 // Data region after PCI configuration header(for cardbus bridge)\r
 //\r
@@ -429,35 +48,17 @@ typedef struct {
 } PCI_CARDBUS_DATA;\r
 \r
 typedef union {\r
-  PCI_DEVICE_HEADER   Device;\r
-  PCI_BRIDGE_HEADER   Bridge;\r
-  PCI_CARDBUS_HEADER  CardBus;\r
+  PCI_DEVICE_HEADER_TYPE_REGION Device;\r
+  PCI_BRIDGE_CONTROL_REGISTER   Bridge;\r
+  PCI_CARDBUS_CONTROL_REGISTER  CardBus;\r
 } NON_COMMON_UNION;\r
 \r
 typedef struct {\r
-  PCI_COMMON_HEADER Common;\r
-  NON_COMMON_UNION NonCommon;\r
-  UINT32  Data[48];\r
+  PCI_DEVICE_INDEPENDENT_REGION Common;\r
+  NON_COMMON_UNION              NonCommon;\r
+  UINT32                        Data[48];\r
 } PCI_CONFIG_SPACE;\r
 \r
-typedef struct {\r
-  UINT8   PcieCapId;\r
-  UINT8   NextCapPtr;\r
-  UINT16  PcieCapReg;\r
-  UINT32  PcieDeviceCap;\r
-  UINT16  DeviceControl;\r
-  UINT16  DeviceStatus;\r
-  UINT32  LinkCap;\r
-  UINT16  LinkControl;\r
-  UINT16  LinkStatus;\r
-  UINT32  SlotCap;\r
-  UINT16  SlotControl;\r
-  UINT16  SlotStatus;\r
-  UINT16  RsvdP;\r
-  UINT16  RootControl;\r
-  UINT32  RootStatus;\r
-} PCIE_CAP_STURCTURE;\r
-\r
 #pragma pack()\r
 \r
 #endif // _PCI_H_\r