]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/IndustryStandard/Pci22.h
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / Pci22.h
index 88f39fbae7c03bb935333ff560cd9c5f54700ae0..bf06205bf9026a70a29f213e05160200f9317825 100644 (file)
@@ -2,12 +2,12 @@
   Support for PCI 2.2 standard.\r
 \r
   This file includes the definitions in the following specifications,\r
-    PCI Local Bus Specification, 2.0\r
-    PCI-to-PCI Bridge Architecture Specification,\r
+    PCI Local Bus Specification, 2.2\r
+    PCI-to-PCI Bridge Architecture Specification, Revision 1.2\r
     PC Card Standard, 8.0\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
-  All rights reserved. This program and the accompanying materials                          \r
+  Copyright (c) 2006 - 2009, 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
   http://opensource.org/licenses/bsd-license.php                                            \r
 #ifndef _PCI22_H_\r
 #define _PCI22_H_\r
 \r
-#define PCI_MAX_SEGMENT 0\r
 #define PCI_MAX_BUS     255\r
 #define PCI_MAX_DEVICE  31\r
 #define PCI_MAX_FUNC    7\r
 \r
+#pragma pack(1)\r
 \r
+///\r
+/// Common header region in PCI Configuration Space\r
+/// Section 6.1, PCI Local Bus Specification, 2.2\r
+///\r
 typedef struct {\r
   UINT16  VendorId;\r
   UINT16  DeviceId;\r
@@ -39,6 +43,10 @@ typedef struct {
   UINT8   BIST;\r
 } PCI_DEVICE_INDEPENDENT_REGION;\r
 \r
+///\r
+/// PCI Device header region in PCI Configuration Space\r
+/// Section 6.1, PCI Local Bus Specification, 2.2\r
+///\r
 typedef struct {\r
   UINT32  Bar[6];\r
   UINT32  CISPtr;\r
@@ -54,13 +62,18 @@ typedef struct {
   UINT8   MaxLat;\r
 } PCI_DEVICE_HEADER_TYPE_REGION;\r
 \r
+///\r
+/// PCI Device Configuration Space\r
+/// Section 6.1, PCI Local Bus Specification, 2.2\r
+///\r
 typedef struct {\r
   PCI_DEVICE_INDEPENDENT_REGION Hdr;\r
   PCI_DEVICE_HEADER_TYPE_REGION Device;\r
 } PCI_TYPE00;\r
 \r
 ///\r
-/// defined in PCI-to-PCI Bridge Architecture Specification\r
+/// PCI-PCI Bridge header region in PCI Configuration Space\r
+/// Section 3.2, PCI-PCI Bridge Architecture, Version 1.2\r
 ///\r
 typedef struct {\r
   UINT32  Bar[2];\r
@@ -87,6 +100,10 @@ typedef struct {
   UINT16  BridgeControl;\r
 } PCI_BRIDGE_CONTROL_REGISTER;\r
 \r
+///\r
+/// PCI-to-PCI Bridge Configuration Space\r
+/// Section 3.2, PCI-PCI Bridge Architecture, Version 1.2\r
+///\r
 typedef struct {\r
   PCI_DEVICE_INDEPENDENT_REGION Hdr;\r
   PCI_BRIDGE_CONTROL_REGISTER   Bridge;\r
@@ -98,7 +115,8 @@ typedef union {
 } PCI_TYPE_GENERIC;\r
 \r
 /// \r
-/// CardBus Conroller Configuration Space, defined in PC Card Standard. 8.0\r
+/// CardBus Conroller Configuration Space, \r
+/// Section 4.5.1, PC Card Standard. 8.0\r
 ///\r
 typedef struct {\r
   UINT32  CardBusSocketReg;     ///< Cardus Socket/ExCA Base\r
@@ -152,7 +170,6 @@ typedef struct {
 #define   PCI_CLASS_DISPLAY_XGA         0x01\r
 #define   PCI_CLASS_DISPLAY_3D          0x02\r
 #define   PCI_CLASS_DISPLAY_OTHER       0x80  \r
-#define   PCI_CLASS_DISPLAY_GFX         0x80\r
 \r
 #define PCI_CLASS_MEDIA               0x04\r
 #define   PCI_CLASS_MEDIA_VIDEO         0x00\r
@@ -283,23 +300,172 @@ typedef struct {
 #define   PCI_SUBCLASS_DPIO             0x00\r
 #define   PCI_SUBCLASS_DPIO_OTHER       0x80\r
 \r
+/**  \r
+  Macro that checks whether the Base Class code of device matched.\r
+\r
+  @param  _p      Specified device.\r
+  @param  c       Base Class code needs matching.\r
+\r
+  @retval TRUE    Base Class code matches the specified device.\r
+  @retval FALSE   Base Class code doesn't match the specified device.         \r
+\r
+**/\r
 #define IS_CLASS1(_p, c)              ((_p)->Hdr.ClassCode[2] == (c))\r
+/**  \r
+  Macro that checks whether the Base Class code and Sub-Class code of device matched.\r
+\r
+  @param  _p      Specified device.\r
+  @param  c       Base Class code needs matching.\r
+  @param  s       Sub-Class code needs matching.\r
+\r
+  @retval TRUE    Base Class code and Sub-Class code match the specified device.\r
+  @retval FALSE   Base Class code and Sub-Class code don't match the specified device.         \r
+\r
+**/\r
 #define IS_CLASS2(_p, c, s)           (IS_CLASS1 (_p, c) && ((_p)->Hdr.ClassCode[1] == (s)))\r
+/**  \r
+  Macro that checks whether the Base Class code, Sub-Class code and Interface code of device matched.\r
+\r
+  @param  _p      Specified device.\r
+  @param  c       Base Class code needs matching.\r
+  @param  s       Sub-Class code needs matching.\r
+  @param  p       Interface code needs matching.\r
+\r
+  @retval TRUE    Base Class code, Sub-Class code and Interface code match the specified device.\r
+  @retval FALSE   Base Class code, Sub-Class code and Interface code don't match the specified device.         \r
+\r
+**/\r
 #define IS_CLASS3(_p, c, s, p)        (IS_CLASS2 (_p, c, s) && ((_p)->Hdr.ClassCode[0] == (p)))\r
 \r
+/**  \r
+  Macro that checks whether device is a display controller.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a display controller.\r
+  @retval FALSE   Device is not a display controller.\r
+\r
+**/\r
 #define IS_PCI_DISPLAY(_p)            IS_CLASS1 (_p, PCI_CLASS_DISPLAY)\r
-#define IS_PCI_VGA(_p)                IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 0)\r
-#define IS_PCI_8514(_p)               IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 1)\r
-#define IS_PCI_GFX(_p)                IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_GFX, 0)\r
+/**  \r
+  Macro that checks whether device is a VGA-compatible controller.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a VGA-compatible controller.\r
+  @retval FALSE   Device is not a VGA-compatible controller.\r
+\r
+**/\r
+#define IS_PCI_VGA(_p)                IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, PCI_IF_VGA_VGA)\r
+/**  \r
+  Macro that checks whether device is an 8514-compatible controller.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is an 8514-compatible controller.\r
+  @retval FALSE   Device is not an 8514-compatible controller.\r
+\r
+**/\r
+#define IS_PCI_8514(_p)               IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, PCI_IF_VGA_8514)\r
+/**  \r
+  Macro that checks whether device is built before the Class Code field was defined.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is an old device.\r
+  @retval FALSE   Device is not an old device.\r
+\r
+**/\r
 #define IS_PCI_OLD(_p)                IS_CLASS1 (_p, PCI_CLASS_OLD)\r
+/**  \r
+  Macro that checks whether device is a VGA-compatible device built before the Class Code field was defined.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is an old VGA-compatible device.\r
+  @retval FALSE   Device is not an old VGA-compatible device.\r
+\r
+**/\r
 #define IS_PCI_OLD_VGA(_p)            IS_CLASS2 (_p, PCI_CLASS_OLD, PCI_CLASS_OLD_VGA)\r
+/**  \r
+  Macro that checks whether device is an IDE controller.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is an IDE controller.\r
+  @retval FALSE   Device is not an IDE controller.\r
+\r
+**/\r
 #define IS_PCI_IDE(_p)                IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_IDE)\r
-#define IS_PCI_SCSI(_p)               IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SCSI, 0)\r
-#define IS_PCI_RAID(_p)               IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_RAID, 0)\r
-#define IS_PCI_LPC(_p)                IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA, 0)\r
-#define IS_PCI_P2P(_p)                IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 0)\r
-#define IS_PCI_P2P_SUB(_p)            IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 1)\r
+/**  \r
+  Macro that checks whether device is a SCSI bus controller.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a SCSI bus controller.\r
+  @retval FALSE   Device is not a SCSI bus controller.\r
+\r
+**/\r
+#define IS_PCI_SCSI(_p)               IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SCSI)\r
+/**  \r
+  Macro that checks whether device is a RAID controller.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a RAID controller.\r
+  @retval FALSE   Device is not a RAID controller.\r
+\r
+**/\r
+#define IS_PCI_RAID(_p)               IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_RAID)\r
+/**  \r
+  Macro that checks whether device is an ISA bridge.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is an ISA bridge.\r
+  @retval FALSE   Device is not an ISA bridge.\r
+\r
+**/\r
+#define IS_PCI_LPC(_p)                IS_CLASS2 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA)\r
+/**  \r
+  Macro that checks whether device is a PCI-to-PCI bridge.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a PCI-to-PCI bridge.\r
+  @retval FALSE   Device is not a PCI-to-PCI bridge.\r
+\r
+**/\r
+#define IS_PCI_P2P(_p)                IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, PCI_IF_BRIDGE_P2P)\r
+/**  \r
+  Macro that checks whether device is a Subtractive Decode PCI-to-PCI bridge.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a Subtractive Decode PCI-to-PCI bridge.\r
+  @retval FALSE   Device is not a Subtractive Decode PCI-to-PCI bridge.\r
+\r
+**/\r
+#define IS_PCI_P2P_SUB(_p)            IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, PCI_IF_BRIDGE_P2P_SUBTRACTIVE)\r
+/**  \r
+  Macro that checks whether device is a 16550-compatible serial controller.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a 16550-compatible serial controller.\r
+  @retval FALSE   Device is not a 16550-compatible serial controller.\r
+\r
+**/\r
 #define IS_PCI_16550_SERIAL(_p)       IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)\r
+/**  \r
+  Macro that checks whether device is a Universal Serial Bus controller.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a Universal Serial Bus controller.\r
+  @retval FALSE   Device is not a Universal Serial Bus controller.\r
+\r
+**/\r
 #define IS_PCI_USB(_p)                IS_CLASS2 (_p, PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB)\r
 \r
 //\r
@@ -313,9 +479,35 @@ typedef struct {
 // Mask of Header type\r
 //\r
 #define HEADER_LAYOUT_CODE            0x7f\r
+/**  \r
+  Macro that checks whether device is a PCI-PCI bridge.\r
 \r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a PCI-PCI bridge.\r
+  @retval FALSE   Device is not a PCI-PCI bridge.\r
+\r
+**/\r
 #define IS_PCI_BRIDGE(_p)             (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_PCI_TO_PCI_BRIDGE))\r
+/**  \r
+  Macro that checks whether device is a CardBus bridge.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a CardBus bridge.\r
+  @retval FALSE   Device is not a CardBus bridge.\r
+\r
+**/\r
 #define IS_CARDBUS_BRIDGE(_p)         (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_CARDBUS_BRIDGE))\r
+/**  \r
+  Macro that checks whether device is a multiple functions device.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a multiple functions device.\r
+  @retval FALSE   Device is not a multiple functions device.\r
+\r
+**/\r
 #define IS_PCI_MULTI_FUNC(_p)         ((_p)->Hdr.HeaderType & HEADER_TYPE_MULTI_FUNCTION)\r
 \r
 ///\r
@@ -363,6 +555,9 @@ typedef struct {
 ///\r
 #define PCI_INT_LINE_UNKNOWN                        0xFF               \r
 \r
+///\r
+/// PCI Access Data Format\r
+///\r
 typedef union {\r
   struct {\r
     UINT32  Reg : 8;\r
@@ -375,6 +570,8 @@ typedef union {
   UINT32  Uint32;\r
 } PCI_CONFIG_ACCESS_CF8;\r
 \r
+#pragma pack()\r
+\r
 #define EFI_PCI_COMMAND_IO_SPACE                        BIT0   ///< 0x0001\r
 #define EFI_PCI_COMMAND_MEMORY_SPACE                    BIT1   ///< 0x0002\r
 #define EFI_PCI_COMMAND_BUS_MASTER                      BIT2   ///< 0x0004\r
@@ -423,6 +620,7 @@ typedef union {
 ///\r
 #define EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR 0x14\r
 \r
+#pragma pack(1)\r
 //\r
 // PCI Capability List IDs and records\r
 //\r
@@ -433,13 +631,18 @@ typedef union {
 #define EFI_PCI_CAPABILITY_ID_MSI     0x05\r
 #define EFI_PCI_CAPABILITY_ID_HOTPLUG 0x06\r
 \r
+///\r
+/// Capabilities List Header\r
+/// Section 6.7, PCI Local Bus Specification, 2.2\r
+///\r
 typedef struct {\r
   UINT8 CapabilityID;\r
   UINT8 NextItemPtr;\r
 } EFI_PCI_CAPABILITY_HDR;\r
 \r
 ///\r
-/// Capability EFI_PCI_CAPABILITY_ID_PMI, defined in PCI Power Management Interface Specifiction\r
+/// Power Management Register Block Definition \r
+/// Section 3.2, PCI Power Management Interface Specifiction, Revision 1.2\r
 ///\r
 typedef struct {\r
   EFI_PCI_CAPABILITY_HDR  Hdr;\r
@@ -450,7 +653,8 @@ typedef struct {
 } EFI_PCI_CAPABILITY_PMI;\r
 \r
 ///\r
-/// Capability EFI_PCI_CAPABILITY_ID_AGP, defined in Accelerated Graphics Port Interface Specification\r
+/// A.G.P Capability\r
+/// Section 6.1.4, Accelerated Graphics Port Interface Specification, Revision 1.0\r
 ///\r
 typedef struct {\r
   EFI_PCI_CAPABILITY_HDR  Hdr;\r
@@ -461,7 +665,8 @@ typedef struct {
 } EFI_PCI_CAPABILITY_AGP;\r
 \r
 ///\r
-/// Capability EFI_PCI_CAPABILITY_ID_VPD, in PCI2.2 Spec.\r
+/// VPD Capability Structure\r
+/// Appendix I, PCI Local Bus Specification, 2.2\r
 ///\r
 typedef struct {\r
   EFI_PCI_CAPABILITY_HDR  Hdr;\r
@@ -470,7 +675,8 @@ typedef struct {
 } EFI_PCI_CAPABILITY_VPD;\r
 \r
 ///\r
-/// Capability EFI_PCI_CAPABILITY_ID_SLOTID, defined in PCI-to-PCI Bridge Architeture Specification\r
+/// Slot Numbering Capabilities Register\r
+/// Section 3.2.6, PCI-to-PCI Bridge Architeture Specification, Revision 1.2\r
 ///\r
 typedef struct {\r
   EFI_PCI_CAPABILITY_HDR  Hdr;\r
@@ -479,7 +685,8 @@ typedef struct {
 } EFI_PCI_CAPABILITY_SLOTID;\r
 \r
 ///\r
-/// Capability EFI_PCI_CAPABILITY_ID_MSI, defined in PCI2.2\r
+/// Message Capability Structure for 32-bit Message Address\r
+/// Section 6.8.1, PCI Local Bus Specification, 2.2\r
 ///\r
 typedef struct {\r
   EFI_PCI_CAPABILITY_HDR  Hdr;\r
@@ -488,6 +695,10 @@ typedef struct {
   UINT16                  MsgDataReg;\r
 } EFI_PCI_CAPABILITY_MSI32;\r
 \r
+///\r
+/// Message Capability Structure for 64-bit Message Address\r
+/// Section 6.8.1, PCI Local Bus Specification, 2.2\r
+///\r
 typedef struct {\r
   EFI_PCI_CAPABILITY_HDR  Hdr;\r
   UINT16                  MsgCtrlReg;\r
@@ -497,7 +708,8 @@ typedef struct {
 } EFI_PCI_CAPABILITY_MSI64;\r
 \r
 ///\r
-/// Capability EFI_PCI_CAPABILITY_ID_HOTPLUG, defined in CompactPCI Hot Swap Specification PICMG 2.1, R1.0\r
+/// Capability EFI_PCI_CAPABILITY_ID_HOTPLUG, \r
+/// CompactPCI Hot Swap Specification PICMG 2.1, R1.0\r
 ///\r
 typedef struct {\r
   EFI_PCI_CAPABILITY_HDR  Hdr;\r
@@ -529,25 +741,25 @@ typedef struct {
 #define EFI_ROOT_BRIDGE_LIST                            'eprb'  \r
 #define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE       0x0EF1  ///< defined in UEFI Spec.\r
 \r
-typedef struct {\r
-  UINT8 Register;\r
-  UINT8 Function;\r
-  UINT8 Device;\r
-  UINT8 Bus;\r
-  UINT8 Reserved[4];\r
-} DEFIO_PCI_ADDR;\r
-\r
 #define PCI_EXPANSION_ROM_HEADER_SIGNATURE              0xaa55\r
 #define PCI_DATA_STRUCTURE_SIGNATURE                    SIGNATURE_32 ('P', 'C', 'I', 'R')\r
 #define PCI_CODE_TYPE_PCAT_IMAGE                        0x00\r
-#define EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED         0x0001  ///<defined in UEFI spec.\r
+#define EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED         0x0001  ///< defined in UEFI spec.\r
 \r
+///\r
+/// Standard PCI Expansion ROM Header\r
+/// Section 13.4.2, Unified Extensible Firmware Interface Specification, Version 2.1\r
+///\r
 typedef struct {\r
   UINT16  Signature;    ///< 0xaa55\r
   UINT8   Reserved[0x16];\r
   UINT16  PcirOffset;\r
 } PCI_EXPANSION_ROM_HEADER;\r
 \r
+///\r
+/// Legacy ROM Header Extensions\r
+/// Section 6.3.3.1, PCI Local Bus Specification, 2.2\r
+///\r
 typedef struct {\r
   UINT16  Signature;    ///< 0xaa55\r
   UINT8   Size512;\r
@@ -556,6 +768,10 @@ typedef struct {
   UINT16  PcirOffset;\r
 } EFI_LEGACY_EXPANSION_ROM_HEADER;\r
 \r
+///\r
+/// PCI Data Structure Format\r
+/// Section 6.3.1.2, PCI Local Bus Specification, 2.2\r
+///\r
 typedef struct {\r
   UINT32  Signature;    ///< "PCIR"\r
   UINT16  VendorId;\r
@@ -572,7 +788,8 @@ typedef struct {
 } PCI_DATA_STRUCTURE;\r
 \r
 ///\r
-/// defined in EFI/UEFI Spec\r
+/// EFI PCI Expansion ROM Header\r
+/// Section 13.4.2, Unified Extensible Firmware Interface Specification, Version 2.1\r
 ///\r
 typedef struct {\r
   UINT16  Signature;    ///< 0xaa55\r
@@ -593,4 +810,6 @@ typedef union {
   EFI_LEGACY_EXPANSION_ROM_HEADER *PcAt;\r
 } EFI_PCI_ROM_HEADER;\r
 \r
+#pragma pack()\r
+\r
 #endif\r