pci22.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #ifndef _PCI22_H
  2. #define _PCI22_H
  3. /*++
  4. Copyright (c) 1999 Intel Corporation
  5. Module Name:
  6. pci22.h
  7. Abstract:
  8. Support for PCI 2.2 standard.
  9. Revision History
  10. --*/
  11. #ifdef SOFT_SDV
  12. #define PCI_MAX_BUS 1
  13. #else
  14. #define PCI_MAX_BUS 255
  15. #endif
  16. #define PCI_MAX_DEVICE 31
  17. #define PCI_MAX_FUNC 7
  18. //
  19. // Command
  20. //
  21. #define PCI_VGA_PALETTE_SNOOP_DISABLED 0x20
  22. #pragma pack(1)
  23. typedef struct {
  24. UINT16 VendorId;
  25. UINT16 DeviceId;
  26. UINT16 Command;
  27. UINT16 Status;
  28. UINT8 RevisionID;
  29. UINT8 ClassCode[3];
  30. UINT8 CacheLineSize;
  31. UINT8 LaytencyTimer;
  32. UINT8 HeaderType;
  33. UINT8 BIST;
  34. } PCI_DEVICE_INDEPENDENT_REGION;
  35. typedef struct {
  36. UINT32 Bar[6];
  37. UINT32 CISPtr;
  38. UINT16 SubsystemVendorID;
  39. UINT16 SubsystemID;
  40. UINT32 ExpansionRomBar;
  41. UINT32 Reserved[2];
  42. UINT8 InterruptLine;
  43. UINT8 InterruptPin;
  44. UINT8 MinGnt;
  45. UINT8 MaxLat;
  46. } PCI_DEVICE_HEADER_TYPE_REGION;
  47. typedef struct {
  48. PCI_DEVICE_INDEPENDENT_REGION Hdr;
  49. PCI_DEVICE_HEADER_TYPE_REGION Device;
  50. } PCI_TYPE00;
  51. typedef struct {
  52. UINT32 Bar[2];
  53. UINT8 PrimaryBus;
  54. UINT8 SecondaryBus;
  55. UINT8 SubordinateBus;
  56. UINT8 SecondaryLatencyTimer;
  57. UINT8 IoBase;
  58. UINT8 IoLimit;
  59. UINT16 SecondaryStatus;
  60. UINT16 MemoryBase;
  61. UINT16 MemoryLimit;
  62. UINT16 PrefetchableMemoryBase;
  63. UINT16 PrefetchableMemoryLimit;
  64. UINT32 PrefetchableBaseUpper32;
  65. UINT32 PrefetchableLimitUpper32;
  66. UINT16 IoBaseUpper16;
  67. UINT16 IoLimitUpper16;
  68. UINT32 Reserved;
  69. UINT32 ExpansionRomBAR;
  70. UINT8 InterruptLine;
  71. UINT8 InterruptPin;
  72. UINT16 BridgeControl;
  73. } PCI_BRIDGE_CONTROL_REGISTER;
  74. #define PCI_CLASS_DISPLAY_CTRL 0x03
  75. #define PCI_CLASS_VGA 0x00
  76. #define PCI_CLASS_BRIDGE 0x06
  77. #define PCI_CLASS_ISA 0x01
  78. #define PCI_CLASS_ISA_POSITIVE_DECODE 0x80
  79. #define PCI_CLASS_NETWORK 0x02
  80. #define PCI_CLASS_ETHERNET 0x00
  81. #define HEADER_TYPE_DEVICE 0x00
  82. #define HEADER_TYPE_PCI_TO_PCI_BRIDGE 0x01
  83. #define HEADER_TYPE_MULTI_FUNCTION 0x80
  84. #define HEADER_LAYOUT_CODE 0x7f
  85. #define IS_PCI_BRIDGE(_p) ((((_p)->Hdr.HeaderType) & HEADER_LAYOUT_CODE) == HEADER_TYPE_PCI_TO_PCI_BRIDGE)
  86. #define IS_PCI_MULTI_FUNC(_p) (((_p)->Hdr.HeaderType) & HEADER_TYPE_MULTI_FUNCTION)
  87. typedef struct {
  88. PCI_DEVICE_INDEPENDENT_REGION Hdr;
  89. PCI_BRIDGE_CONTROL_REGISTER Bridge;
  90. } PCI_TYPE01;
  91. typedef struct {
  92. UINT8 Register;
  93. UINT8 Function;
  94. UINT8 Device;
  95. UINT8 Bus;
  96. UINT8 Reserved[4];
  97. } DEFIO_PCI_ADDR;
  98. typedef struct {
  99. UINT32 Reg : 8;
  100. UINT32 Func : 3;
  101. UINT32 Dev : 5;
  102. UINT32 Bus : 8;
  103. UINT32 Reserved: 7;
  104. UINT32 Enable : 1;
  105. } PCI_CONFIG_ACCESS_CF8;
  106. #pragma pack()
  107. #define EFI_ROOT_BRIDGE_LIST 'eprb'
  108. typedef struct {
  109. UINTN Signature;
  110. UINT16 BridgeNumber;
  111. UINT16 PrimaryBus;
  112. UINT16 SubordinateBus;
  113. EFI_DEVICE_PATH *DevicePath;
  114. LIST_ENTRY Link;
  115. } PCI_ROOT_BRIDGE_ENTRY;
  116. #define PCI_EXPANSION_ROM_HEADER_SIGNATURE 0xaa55
  117. #define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE 0x0EF1
  118. #define PCI_DATA_STRUCTURE_SIGNATURE EFI_SIGNATURE_32('P','C','I','R')
  119. #pragma pack(1)
  120. typedef struct {
  121. UINT16 Signature; // 0xaa55
  122. UINT8 Reserved[0x16];
  123. UINT16 PcirOffset;
  124. } PCI_EXPANSION_ROM_HEADER;
  125. typedef struct {
  126. UINT16 Signature; // 0xaa55
  127. UINT16 InitializationSize;
  128. UINT16 EfiSignature; // 0x0EF1
  129. UINT16 EfiSubsystem;
  130. UINT16 EfiMachineType;
  131. UINT8 Reserved[0x0A];
  132. UINT16 EfiImageHeaderOffset;
  133. UINT16 PcirOffset;
  134. } EFI_PCI_EXPANSION_ROM_HEADER;
  135. typedef struct {
  136. UINT32 Signature; // "PCIR"
  137. UINT16 VendorId;
  138. UINT16 DeviceId;
  139. UINT16 Reserved0;
  140. UINT16 Length;
  141. UINT8 Revision;
  142. UINT8 ClassCode[3];
  143. UINT16 ImageLength;
  144. UINT16 CodeRevision;
  145. UINT8 CodeType;
  146. UINT8 Indicator;
  147. UINT16 Reserved1;
  148. } PCI_DATA_STRUCTURE;
  149. #pragma pack()
  150. #endif