1. added functions header for MACROS in PCI22.h.

2. move IS_PCI_GFX to modules, since it not defined in PCI spec.
3. added comments for some structure in ElTorito.h.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6928 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2008-12-09 06:40:02 +00:00
parent 2bd6a5f8a5
commit 1833218d93
4 changed files with 202 additions and 16 deletions

View File

@ -220,5 +220,6 @@ extern UINT64 gAllZero;
#define IS_ISA_BRIDGE(_p) IS_CLASS2 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA)
#define IS_INTEL_ISA_BRIDGE(_p) (IS_CLASS2 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE) && ((_p)->Hdr.VendorId == 0x8086) && ((_p)->Hdr.DeviceId == 0x7110))
#define IS_PCI_GFX(_p) IS_CLASS2 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_OTHER)
#endif

View File

@ -291,4 +291,6 @@ PciBusDriverBindingStop (
IN EFI_HANDLE *ChildHandleBuffer
);
#define IS_PCI_GFX(_p) IS_CLASS2 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_OTHER)
#endif

View File

@ -67,6 +67,9 @@ typedef union {
CHAR8 Reserved[82];
} Unknown;
///
/// Boot Record Volume Descriptor, defined in "El Torito" Specification.
///
struct {
UINT8 Type; ///< Must be 0
CHAR8 Id[5]; ///< "CD001"
@ -76,7 +79,10 @@ typedef union {
UINT8 EltCatalog[4]; ///< Absolute pointer to first sector of Boot Catalog
CHAR8 Unused2[13]; ///< Must be 0
} BootRecordVolume;
///
/// Primary Volumn Descriptor, defined in ISO 9660.
///
struct {
UINT8 Type;
CHAR8 Id[5]; ///< "CD001"
@ -102,7 +108,7 @@ typedef union {
/// Catalog validation entry (Catalog header)
///
struct {
UINT8 Indicator;
UINT8 Indicator; ///< Must be 01
UINT8 PlatformId;
UINT16 Reserved;
CHAR8 ManufacId[24];
@ -114,12 +120,12 @@ typedef union {
/// Initial/Default Entry or Section Entry
///
struct {
UINT8 Indicator;
UINT8 Indicator; ///< 88 = Bootable, 00 = Not Bootable
UINT8 MediaType : 4;
UINT8 Reserved1 : 4;
UINT8 Reserved1 : 4; ///< Must be 0
UINT16 LoadSegment;
UINT8 SystemType;
UINT8 Reserved2;
UINT8 Reserved2; ///< Must be 0
UINT16 SectorCount;
UINT32 Lba;
} Boot;
@ -128,9 +134,9 @@ typedef union {
/// Section Header Entry
///
struct {
UINT8 Indicator;
UINT8 Indicator; ///< 90 - Header, more header follw, 91 - Final Header
UINT8 PlatformId;
UINT16 SectionEntries;
UINT16 SectionEntries; ///< Number of section entries following this header
CHAR8 Id[28];
} Section;

View File

@ -171,7 +171,6 @@ typedef struct {
#define PCI_CLASS_DISPLAY_XGA 0x01
#define PCI_CLASS_DISPLAY_3D 0x02
#define PCI_CLASS_DISPLAY_OTHER 0x80
#define PCI_CLASS_DISPLAY_GFX 0x80
#define PCI_CLASS_MEDIA 0x04
#define PCI_CLASS_MEDIA_VIDEO 0x00
@ -302,23 +301,172 @@ typedef struct {
#define PCI_SUBCLASS_DPIO 0x00
#define PCI_SUBCLASS_DPIO_OTHER 0x80
/**
Macro that checks whether the Base Class code of device matched.
@param _p Specified device.
@param c Base Class code needs matching.
@retval TRUE Base Class code matches the specified device.
@retval FALSE Base Class code doesn't match the specified device.
**/
#define IS_CLASS1(_p, c) ((_p)->Hdr.ClassCode[2] == (c))
/**
Macro that checks whether the Base Class code and Sub-Class code of device matched.
@param _p Specified device.
@param c Base Class code needs matching.
@param s Sub-Class code needs matching.
@retval TRUE Base Class code and Sub-Class code match the specified device.
@retval FALSE Base Class code and Sub-Class code don't match the specified device.
**/
#define IS_CLASS2(_p, c, s) (IS_CLASS1 (_p, c) && ((_p)->Hdr.ClassCode[1] == (s)))
/**
Macro that checks whether the Base Class code, Sub-Class code and Interface code of device matched.
@param _p Specified device.
@param c Base Class code needs matching.
@param s Sub-Class code needs matching.
@param p Interface code needs matching.
@retval TRUE Base Class code, Sub-Class code and Interface code match the specified device.
@retval FALSE Base Class code, Sub-Class code and Interface code don't match the specified device.
**/
#define IS_CLASS3(_p, c, s, p) (IS_CLASS2 (_p, c, s) && ((_p)->Hdr.ClassCode[0] == (p)))
/**
Macro that checks whether device is a display controller.
@param _p Specified device.
@retval TRUE Device is a display controller.
@retval FALSE Device is not a display controller.
**/
#define IS_PCI_DISPLAY(_p) IS_CLASS1 (_p, PCI_CLASS_DISPLAY)
#define IS_PCI_VGA(_p) IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 0)
#define IS_PCI_8514(_p) IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 1)
#define IS_PCI_GFX(_p) IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_GFX, 0)
/**
Macro that checks whether device is a VGA-compatible controller.
@param _p Specified device.
@retval TRUE Device is a VGA-compatible controller.
@retval FALSE Device is not a VGA-compatible controller.
**/
#define IS_PCI_VGA(_p) IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, PCI_IF_VGA_VGA)
/**
Macro that checks whether device is an 8514-compatible controller.
@param _p Specified device.
@retval TRUE Device is an 8514-compatible controller.
@retval FALSE Device is not an 8514-compatible controller.
**/
#define IS_PCI_8514(_p) IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, PCI_IF_VGA_8514)
/**
Macro that checks whether device is built before the Class Code field was defined.
@param _p Specified device.
@retval TRUE Device is an old device.
@retval FALSE Device is not an old device.
**/
#define IS_PCI_OLD(_p) IS_CLASS1 (_p, PCI_CLASS_OLD)
/**
Macro that checks whether device is a VGA-compatible device built before the Class Code field was defined.
@param _p Specified device.
@retval TRUE Device is an old VGA-compatible device.
@retval FALSE Device is not an old VGA-compatible device.
**/
#define IS_PCI_OLD_VGA(_p) IS_CLASS2 (_p, PCI_CLASS_OLD, PCI_CLASS_OLD_VGA)
/**
Macro that checks whether device is an IDE controller.
@param _p Specified device.
@retval TRUE Device is an IDE controller.
@retval FALSE Device is not an IDE controller.
**/
#define IS_PCI_IDE(_p) IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_IDE)
#define IS_PCI_SCSI(_p) IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SCSI, 0)
#define IS_PCI_RAID(_p) IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_RAID, 0)
#define IS_PCI_LPC(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA, 0)
#define IS_PCI_P2P(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 0)
#define IS_PCI_P2P_SUB(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 1)
/**
Macro that checks whether device is a SCSI bus controller.
@param _p Specified device.
@retval TRUE Device is a SCSI bus controller.
@retval FALSE Device is not a SCSI bus controller.
**/
#define IS_PCI_SCSI(_p) IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SCSI)
/**
Macro that checks whether device is a RAID controller.
@param _p Specified device.
@retval TRUE Device is a RAID controller.
@retval FALSE Device is not a RAID controller.
**/
#define IS_PCI_RAID(_p) IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_RAID)
/**
Macro that checks whether device is an ISA bridge.
@param _p Specified device.
@retval TRUE Device is an ISA bridge.
@retval FALSE Device is not an ISA bridge.
**/
#define IS_PCI_LPC(_p) IS_CLASS2 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA)
/**
Macro that checks whether device is a PCI-to-PCI bridge.
@param _p Specified device.
@retval TRUE Device is a PCI-to-PCI bridge.
@retval FALSE Device is not a PCI-to-PCI bridge.
**/
#define IS_PCI_P2P(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, PCI_IF_BRIDGE_P2P)
/**
Macro that checks whether device is a Subtractive Decode PCI-to-PCI bridge.
@param _p Specified device.
@retval TRUE Device is a Subtractive Decode PCI-to-PCI bridge.
@retval FALSE Device is not a Subtractive Decode PCI-to-PCI bridge.
**/
#define IS_PCI_P2P_SUB(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, PCI_IF_BRIDGE_P2P_SUBTRACTIVE)
/**
Macro that checks whether device is a 16550-compatible serial controller.
@param _p Specified device.
@retval TRUE Device is a 16550-compatible serial controller.
@retval FALSE Device is not a 16550-compatible serial controller.
**/
#define IS_PCI_16550_SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
/**
Macro that checks whether device is a Universal Serial Bus controller.
@param _p Specified device.
@retval TRUE Device is a Universal Serial Bus controller.
@retval FALSE Device is not a Universal Serial Bus controller.
**/
#define IS_PCI_USB(_p) IS_CLASS2 (_p, PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB)
//
@ -332,9 +480,35 @@ typedef struct {
// Mask of Header type
//
#define HEADER_LAYOUT_CODE 0x7f
/**
Macro that checks whether device is a PCI-PCI bridge.
@param _p Specified device.
@retval TRUE Device is a PCI-PCI bridge.
@retval FALSE Device is not a PCI-PCI bridge.
**/
#define IS_PCI_BRIDGE(_p) (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_PCI_TO_PCI_BRIDGE))
/**
Macro that checks whether device is a CardBus bridge.
@param _p Specified device.
@retval TRUE Device is a CardBus bridge.
@retval FALSE Device is not a CardBus bridge.
**/
#define IS_CARDBUS_BRIDGE(_p) (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_CARDBUS_BRIDGE))
/**
Macro that checks whether device is a multiple functions device.
@param _p Specified device.
@retval TRUE Device is a multiple functions device.
@retval FALSE Device is not a multiple functions device.
**/
#define IS_PCI_MULTI_FUNC(_p) ((_p)->Hdr.HeaderType & HEADER_TYPE_MULTI_FUNCTION)
///
@ -382,6 +556,9 @@ typedef struct {
///
#define PCI_INT_LINE_UNKNOWN 0xFF
///
/// PCI Access Data Format
///
typedef union {
struct {
UINT32 Reg : 8;