#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
#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
// 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
///\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