Pci22.h

Go to the documentation of this file.
00001 /** @file
00002   Support for PCI 2.2 standard.
00003 
00004   This file includes the definitions in the following specifications,
00005     PCI Local Bus Specification, 2.0
00006     PCI-to-PCI Bridge Architecture Specification,
00007     PC Card Standard, 8.0
00008 
00009   Copyright (c) 2006 - 2008, Intel Corporation
00010   All rights reserved. This program and the accompanying materials
00011   are licensed and made available under the terms and conditions of the BSD License
00012   which accompanies this distribution.  The full text of the license may be found at
00013   http://opensource.org/licenses/bsd-license.php
00014 
00015   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00016   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00017 
00018 **/
00019 
00020 #ifndef _PCI22_H_
00021 #define _PCI22_H_
00022 
00023 #define PCI_MAX_SEGMENT 0
00024 #define PCI_MAX_BUS     255
00025 #define PCI_MAX_DEVICE  31
00026 #define PCI_MAX_FUNC    7
00027 
00028 
00029 #pragma pack(1)
00030 typedef struct {
00031   UINT16  VendorId;
00032   UINT16  DeviceId;
00033   UINT16  Command;
00034   UINT16  Status;
00035   UINT8   RevisionID;
00036   UINT8   ClassCode[3];
00037   UINT8   CacheLineSize;
00038   UINT8   LatencyTimer;
00039   UINT8   HeaderType;
00040   UINT8   BIST;
00041 } PCI_DEVICE_INDEPENDENT_REGION;
00042 
00043 typedef struct {
00044   UINT32  Bar[6];
00045   UINT32  CISPtr;
00046   UINT16  SubsystemVendorID;
00047   UINT16  SubsystemID;
00048   UINT32  ExpansionRomBar;
00049   UINT8   CapabilityPtr;
00050   UINT8   Reserved1[3];
00051   UINT32  Reserved2;
00052   UINT8   InterruptLine;
00053   UINT8   InterruptPin;
00054   UINT8   MinGnt;
00055   UINT8   MaxLat;
00056 } PCI_DEVICE_HEADER_TYPE_REGION;
00057 
00058 typedef struct {
00059   PCI_DEVICE_INDEPENDENT_REGION Hdr;
00060   PCI_DEVICE_HEADER_TYPE_REGION Device;
00061 } PCI_TYPE00;
00062 
00063 ///
00064 /// defined in PCI-to-PCI Bridge Architecture Specification
00065 ///
00066 typedef struct {
00067   UINT32  Bar[2];
00068   UINT8   PrimaryBus;
00069   UINT8   SecondaryBus;
00070   UINT8   SubordinateBus;
00071   UINT8   SecondaryLatencyTimer;
00072   UINT8   IoBase;
00073   UINT8   IoLimit;
00074   UINT16  SecondaryStatus;
00075   UINT16  MemoryBase;
00076   UINT16  MemoryLimit;
00077   UINT16  PrefetchableMemoryBase;
00078   UINT16  PrefetchableMemoryLimit;
00079   UINT32  PrefetchableBaseUpper32;
00080   UINT32  PrefetchableLimitUpper32;
00081   UINT16  IoBaseUpper16;
00082   UINT16  IoLimitUpper16;
00083   UINT8   CapabilityPtr;
00084   UINT8   Reserved[3];
00085   UINT32  ExpansionRomBAR;
00086   UINT8   InterruptLine;
00087   UINT8   InterruptPin;
00088   UINT16  BridgeControl;
00089 } PCI_BRIDGE_CONTROL_REGISTER;
00090 
00091 typedef struct {
00092   PCI_DEVICE_INDEPENDENT_REGION Hdr;
00093   PCI_BRIDGE_CONTROL_REGISTER   Bridge;
00094 } PCI_TYPE01;
00095 
00096 typedef union {
00097   PCI_TYPE00  Device;
00098   PCI_TYPE01  Bridge;
00099 } PCI_TYPE_GENERIC;
00100 
00101 ///
00102 /// CardBus Conroller Configuration Space, defined in PC Card Standard. 8.0
00103 ///
00104 typedef struct {
00105   UINT32  CardBusSocketReg;     ///< Cardus Socket/ExCA Base
00106   UINT8   Cap_Ptr;
00107   UINT8   Reserved;
00108   UINT16  SecondaryStatus;      ///< Secondary Status
00109   UINT8   PciBusNumber;         ///< PCI Bus Number
00110   UINT8   CardBusBusNumber;     ///< CardBus Bus Number
00111   UINT8   SubordinateBusNumber; ///< Subordinate Bus Number
00112   UINT8   CardBusLatencyTimer;  ///< CardBus Latency Timer
00113   UINT32  MemoryBase0;          ///< Memory Base Register 0
00114   UINT32  MemoryLimit0;         ///< Memory Limit Register 0
00115   UINT32  MemoryBase1;
00116   UINT32  MemoryLimit1;
00117   UINT32  IoBase0;
00118   UINT32  IoLimit0;             ///< I/O Base Register 0
00119   UINT32  IoBase1;              ///< I/O Limit Register 0
00120   UINT32  IoLimit1;
00121   UINT8   InterruptLine;        ///< Interrupt Line
00122   UINT8   InterruptPin;         ///< Interrupt Pin
00123   UINT16  BridgeControl;        ///< Bridge Control
00124 } PCI_CARDBUS_CONTROL_REGISTER;
00125 
00126 ///
00127 /// Definitions of PCI class bytes and manipulation macros.
00128 ///
00129 #define PCI_CLASS_OLD                 0x00
00130 #define   PCI_CLASS_OLD_OTHER           0x00
00131 #define   PCI_CLASS_OLD_VGA             0x01
00132 
00133 #define PCI_CLASS_MASS_STORAGE        0x01
00134 #define   PCI_CLASS_MASS_STORAGE_SCSI   0x00
00135 #define   PCI_CLASS_MASS_STORAGE_IDE    0x01
00136 #define   PCI_CLASS_MASS_STORAGE_FLOPPY 0x02
00137 #define   PCI_CLASS_MASS_STORAGE_IPI    0x03
00138 #define   PCI_CLASS_MASS_STORAGE_RAID   0x04
00139 #define   PCI_CLASS_MASS_STORAGE_OTHER  0x80
00140 
00141 #define PCI_CLASS_NETWORK             0x02
00142 #define   PCI_CLASS_NETWORK_ETHERNET    0x00
00143 #define   PCI_CLASS_NETWORK_TOKENRING   0x01
00144 #define   PCI_CLASS_NETWORK_FDDI        0x02
00145 #define   PCI_CLASS_NETWORK_ATM         0x03
00146 #define   PCI_CLASS_NETWORK_ISDN        0x04
00147 #define   PCI_CLASS_NETWORK_OTHER       0x80
00148 
00149 #define PCI_CLASS_DISPLAY             0x03
00150 #define   PCI_CLASS_DISPLAY_VGA         0x00
00151 #define     PCI_IF_VGA_VGA                0x00
00152 #define     PCI_IF_VGA_8514               0x01
00153 #define   PCI_CLASS_DISPLAY_XGA         0x01
00154 #define   PCI_CLASS_DISPLAY_3D          0x02
00155 #define   PCI_CLASS_DISPLAY_OTHER       0x80
00156 #define   PCI_CLASS_DISPLAY_GFX         0x80
00157 
00158 #define PCI_CLASS_MEDIA               0x04
00159 #define   PCI_CLASS_MEDIA_VIDEO         0x00
00160 #define   PCI_CLASS_MEDIA_AUDIO         0x01
00161 #define   PCI_CLASS_MEDIA_TELEPHONE     0x02
00162 #define   PCI_CLASS_MEDIA_OTHER         0x80
00163 
00164 #define PCI_CLASS_MEMORY_CONTROLLER   0x05
00165 #define   PCI_CLASS_MEMORY_RAM          0x00
00166 #define   PCI_CLASS_MEMORY_FLASH        0x01
00167 #define   PCI_CLASS_MEMORY_OTHER        0x80
00168 
00169 #define PCI_CLASS_BRIDGE              0x06
00170 #define   PCI_CLASS_BRIDGE_HOST         0x00
00171 #define   PCI_CLASS_BRIDGE_ISA          0x01
00172 #define   PCI_CLASS_BRIDGE_EISA         0x02
00173 #define   PCI_CLASS_BRIDGE_MCA          0x03
00174 #define   PCI_CLASS_BRIDGE_P2P          0x04
00175 #define     PCI_IF_BRIDGE_P2P             0x00
00176 #define     PCI_IF_BRIDGE_P2P_SUBTRACTIVE 0x01
00177 #define   PCI_CLASS_BRIDGE_PCMCIA       0x05
00178 #define   PCI_CLASS_BRIDGE_NUBUS        0x06
00179 #define   PCI_CLASS_BRIDGE_CARDBUS      0x07
00180 #define   PCI_CLASS_BRIDGE_RACEWAY      0x08
00181 #define   PCI_CLASS_BRIDGE_OTHER        0x80
00182 #define   PCI_CLASS_BRIDGE_ISA_PDECODE  0x80
00183 
00184 #define PCI_CLASS_SCC                 0x07  ///< Simple communications controllers
00185 #define   PCI_SUBCLASS_SERIAL           0x00
00186 #define     PCI_IF_GENERIC_XT             0x00
00187 #define     PCI_IF_16450                  0x01
00188 #define     PCI_IF_16550                  0x02
00189 #define     PCI_IF_16650                  0x03
00190 #define     PCI_IF_16750                  0x04
00191 #define     PCI_IF_16850                  0x05
00192 #define     PCI_IF_16950                  0x06
00193 #define   PCI_SUBCLASS_PARALLEL         0x01
00194 #define     PCI_IF_PARALLEL_PORT          0x00
00195 #define     PCI_IF_BI_DIR_PARALLEL_PORT   0x01
00196 #define     PCI_IF_ECP_PARALLEL_PORT      0x02
00197 #define     PCI_IF_1284_CONTROLLER        0x03
00198 #define     PCI_IF_1284_DEVICE            0xFE
00199 #define   PCI_SUBCLASS_MULTIPORT_SERIAL 0x02
00200 #define   PCI_SUBCLASS_MODEM            0x03
00201 #define     PCI_IF_GENERIC_MODEM          0x00
00202 #define     PCI_IF_16450_MODEM            0x01
00203 #define     PCI_IF_16550_MODEM            0x02
00204 #define     PCI_IF_16650_MODEM            0x03
00205 #define     PCI_IF_16750_MODEM            0x04
00206 #define   PCI_SUBCLASS_SCC_OTHER          0x80
00207 
00208 #define PCI_CLASS_SYSTEM_PERIPHERAL   0x08
00209 #define   PCI_SUBCLASS_PIC              0x00
00210 #define     PCI_IF_8259_PIC               0x00
00211 #define     PCI_IF_ISA_PIC                0x01
00212 #define     PCI_IF_EISA_PIC               0x02
00213 #define     PCI_IF_APIC_CONTROLLER        0x10  ///< I/O APIC interrupt controller , 32 bye none-prefectable memory.
00214 #define     PCI_IF_APIC_CONTROLLER2       0x20
00215 #define   PCI_SUBCLASS_DMA              0x01
00216 #define     PCI_IF_8237_DMA               0x00
00217 #define     PCI_IF_ISA_DMA                0x01
00218 #define     PCI_IF_EISA_DMA               0x02
00219 #define   PCI_SUBCLASS_TIMER            0x02
00220 #define     PCI_IF_8254_TIMER             0x00
00221 #define     PCI_IF_ISA_TIMER              0x01
00222 #define     PCI_IF_EISA_TIMER             0x02
00223 #define   PCI_SUBCLASS_RTC              0x03
00224 #define     PCI_IF_GENERIC_RTC            0x00
00225 #define     PCI_IF_ISA_RTC                0x00
00226 #define   PCI_SUBCLASS_PNP_CONTROLLER   0x04    ///< HotPlug Controller
00227 #define   PCI_SUBCLASS_PERIPHERAL_OTHER 0x80
00228 
00229 #define PCI_CLASS_INPUT_DEVICE        0x09
00230 #define   PCI_SUBCLASS_KEYBOARD         0x00
00231 #define   PCI_SUBCLASS_PEN              0x01
00232 #define   PCI_SUBCLASS_MOUSE_CONTROLLER 0x02
00233 #define   PCI_SUBCLASS_SCAN_CONTROLLER  0x03
00234 #define   PCI_SUBCLASS_GAMEPORT         0x04
00235 #define     PCI_IF_GAMEPORT               0x00
00236 #define     PCI_IF_GAMEPORT1              0x01
00237 #define   PCI_SUBCLASS_INPUT_OTHER      0x80
00238 
00239 #define PCI_CLASS_DOCKING_STATION     0x0A
00240 
00241 #define PCI_CLASS_PROCESSOR           0x0B
00242 #define   PCI_SUBCLASS_PROC_386         0x00
00243 #define   PCI_SUBCLASS_PROC_486         0x01
00244 #define   PCI_SUBCLASS_PROC_PENTIUM     0x02
00245 #define   PCI_SUBCLASS_PROC_ALPHA       0x10
00246 #define   PCI_SUBCLASS_PROC_POWERPC     0x20
00247 #define   PCI_SUBCLASS_PROC_MIPS        0x30
00248 #define   PCI_SUBCLASS_PROC_CO_PORC     0x40 ///< Co-Processor
00249 
00250 #define PCI_CLASS_SERIAL              0x0C
00251 #define   PCI_CLASS_SERIAL_FIREWIRE     0x00
00252 #define     PCI_IF_1394                   0x00
00253 #define     PCI_IF_1394_OPEN_HCI          0x10
00254 #define   PCI_CLASS_SERIAL_ACCESS_BUS   0x01
00255 #define   PCI_CLASS_SERIAL_SSA          0x02
00256 #define   PCI_CLASS_SERIAL_USB          0x03
00257 #define     PCI_IF_UHCI                   0x00
00258 #define     PCI_IF_OHCI                   0x10
00259 #define     PCI_IF_USB_OTHER              0x80
00260 #define     PCI_IF_USB_DEVICE             0xFE
00261 #define   PCI_CLASS_SERIAL_FIBRECHANNEL 0x04
00262 #define   PCI_CLASS_SERIAL_SMB          0x05
00263 
00264 #define PCI_CLASS_WIRELESS            0x0D
00265 #define   PCI_SUBCLASS_IRDA             0x00
00266 #define   PCI_SUBCLASS_IR               0x01
00267 #define   PCI_SUBCLASS_RF               0x02
00268 #define   PCI_SUBCLASS_WIRELESS_OTHER   0x80
00269 
00270 #define PCI_CLASS_INTELLIGENT_IO      0x0E
00271 
00272 #define PCI_CLASS_SATELLITE           0x0F
00273 #define   PCI_SUBCLASS_TV               0x01
00274 #define   PCI_SUBCLASS_AUDIO            0x02
00275 #define   PCI_SUBCLASS_VOICE            0x03
00276 #define   PCI_SUBCLASS_DATA             0x04
00277 
00278 #define PCI_SECURITY_CONTROLLER       0x10   ///< Encryption and decryption controller
00279 #define   PCI_SUBCLASS_NET_COMPUT       0x00
00280 #define   PCI_SUBCLASS_ENTERTAINMENT    0x10
00281 #define   PCI_SUBCLASS_SECURITY_OTHER   0x80
00282 
00283 #define PCI_CLASS_DPIO                0x11
00284 #define   PCI_SUBCLASS_DPIO             0x00
00285 #define   PCI_SUBCLASS_DPIO_OTHER       0x80
00286 
00287 #define IS_CLASS1(_p, c)              ((_p)->Hdr.ClassCode[2] == (c))
00288 #define IS_CLASS2(_p, c, s)           (IS_CLASS1 (_p, c) && ((_p)->Hdr.ClassCode[1] == (s)))
00289 #define IS_CLASS3(_p, c, s, p)        (IS_CLASS2 (_p, c, s) && ((_p)->Hdr.ClassCode[0] == (p)))
00290 
00291 #define IS_PCI_DISPLAY(_p)            IS_CLASS1 (_p, PCI_CLASS_DISPLAY)
00292 #define IS_PCI_VGA(_p)                IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 0)
00293 #define IS_PCI_8514(_p)               IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA, 1)
00294 #define IS_PCI_GFX(_p)                IS_CLASS3 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_GFX, 0)
00295 #define IS_PCI_OLD(_p)                IS_CLASS1 (_p, PCI_CLASS_OLD)
00296 #define IS_PCI_OLD_VGA(_p)            IS_CLASS2 (_p, PCI_CLASS_OLD, PCI_CLASS_OLD_VGA)
00297 #define IS_PCI_IDE(_p)                IS_CLASS2 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_IDE)
00298 #define IS_PCI_SCSI(_p)               IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_SCSI, 0)
00299 #define IS_PCI_RAID(_p)               IS_CLASS3 (_p, PCI_CLASS_MASS_STORAGE, PCI_CLASS_MASS_STORAGE_RAID, 0)
00300 #define IS_PCI_LPC(_p)                IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA, 0)
00301 #define IS_PCI_P2P(_p)                IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 0)
00302 #define IS_PCI_P2P_SUB(_p)            IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_P2P, 1)
00303 #define IS_PCI_16550_SERIAL(_p)       IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
00304 #define IS_PCI_USB(_p)                IS_CLASS2 (_p, PCI_CLASS_SERIAL, PCI_CLASS_SERIAL_USB)
00305 
00306 //
00307 // the definition of Header Type
00308 //
00309 #define HEADER_TYPE_DEVICE            0x00
00310 #define HEADER_TYPE_PCI_TO_PCI_BRIDGE 0x01
00311 #define HEADER_TYPE_CARDBUS_BRIDGE    0x02
00312 #define HEADER_TYPE_MULTI_FUNCTION    0x80
00313 //
00314 // Mask of Header type
00315 //
00316 #define HEADER_LAYOUT_CODE            0x7f
00317 
00318 #define IS_PCI_BRIDGE(_p)             (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_PCI_TO_PCI_BRIDGE))
00319 #define IS_CARDBUS_BRIDGE(_p)         (((_p)->Hdr.HeaderType & HEADER_LAYOUT_CODE) == (HEADER_TYPE_CARDBUS_BRIDGE))
00320 #define IS_PCI_MULTI_FUNC(_p)         ((_p)->Hdr.HeaderType & HEADER_TYPE_MULTI_FUNCTION)
00321 
00322 ///
00323 /// Rom Base Address in Bridge, defined in PCI-to-PCI Bridge Architecure Specification,
00324 ///
00325 #define PCI_BRIDGE_ROMBAR             0x38
00326 
00327 #define PCI_MAX_BAR                   0x0006
00328 #define PCI_MAX_CONFIG_OFFSET         0x0100
00329 
00330 #define PCI_VENDOR_ID_OFFSET                        0x00
00331 #define PCI_DEVICE_ID_OFFSET                        0x02
00332 #define PCI_COMMAND_OFFSET                          0x04
00333 #define PCI_PRIMARY_STATUS_OFFSET                   0x06
00334 #define PCI_REVISION_ID_OFFSET                      0x08
00335 #define PCI_CLASSCODE_OFFSET                        0x09
00336 #define PCI_CACHELINE_SIZE_OFFSET                   0x0C
00337 #define PCI_LATENCY_TIMER_OFFSET                    0x0D
00338 #define PCI_HEADER_TYPE_OFFSET                      0x0E
00339 #define PCI_BIST_OFFSET                             0x0F
00340 #define PCI_BASE_ADDRESSREG_OFFSET                  0x10
00341 #define PCI_CARDBUS_CIS_OFFSET                      0x28
00342 #define PCI_SVID_OFFSET                             0x2C ///< SubSystem Vendor id
00343 #define PCI_SUBSYSTEM_VENDOR_ID_OFFSET              0x2C
00344 #define PCI_SID_OFFSET                              0x2E ///< SubSystem ID
00345 #define PCI_SUBSYSTEM_ID_OFFSET                     0x2E
00346 #define PCI_EXPANSION_ROM_BASE                      0x30
00347 #define PCI_CAPBILITY_POINTER_OFFSET                0x34
00348 #define PCI_INT_LINE_OFFSET                         0x3C ///< Interrupt Line Register
00349 #define PCI_INT_PIN_OFFSET                          0x3D ///< Interrupt Pin Register
00350 #define PCI_MAXGNT_OFFSET                           0x3E ///< Max Grant Register
00351 #define PCI_MAXLAT_OFFSET                           0x3F ///< Max Latency Register
00352 
00353 ///
00354 /// defined in PCI-to-PCI Bridge Architecture Specification
00355 ///
00356 #define PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET      0x18
00357 #define PCI_BRIDGE_SECONDARY_BUS_REGISTER_OFFSET    0x19
00358 #define PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET  0x1a
00359 #define PCI_BRIDGE_STATUS_REGISTER_OFFSET           0x1E
00360 #define PCI_BRIDGE_CONTROL_REGISTER_OFFSET          0x3E
00361 
00362 ///
00363 /// Interrupt Line "Unknown" or "No connection" value defined for x86 based system
00364 ///
00365 #define PCI_INT_LINE_UNKNOWN                        0xFF
00366 
00367 typedef union {
00368   struct {
00369     UINT32  Reg : 8;
00370     UINT32  Func : 3;
00371     UINT32  Dev : 5;
00372     UINT32  Bus : 8;
00373     UINT32  Reserved : 7;
00374     UINT32  Enable : 1;
00375   } Bits;
00376   UINT32  Uint32;
00377 } PCI_CONFIG_ACCESS_CF8;
00378 
00379 #pragma pack()
00380 
00381 #define EFI_PCI_COMMAND_IO_SPACE                        BIT0   ///< 0x0001
00382 #define EFI_PCI_COMMAND_MEMORY_SPACE                    BIT1   ///< 0x0002
00383 #define EFI_PCI_COMMAND_BUS_MASTER                      BIT2   ///< 0x0004
00384 #define EFI_PCI_COMMAND_SPECIAL_CYCLE                   BIT3   ///< 0x0008
00385 #define EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE     BIT4   ///< 0x0010
00386 #define EFI_PCI_COMMAND_VGA_PALETTE_SNOOP               BIT5   ///< 0x0020
00387 #define EFI_PCI_COMMAND_PARITY_ERROR_RESPOND            BIT6   ///< 0x0040
00388 #define EFI_PCI_COMMAND_STEPPING_CONTROL                BIT7   ///< 0x0080
00389 #define EFI_PCI_COMMAND_SERR                            BIT8   ///< 0x0100
00390 #define EFI_PCI_COMMAND_FAST_BACK_TO_BACK               BIT9   ///< 0x0200
00391 
00392 ///
00393 /// defined in PCI-to-PCI Bridge Architecture Specification
00394 ///
00395 #define EFI_PCI_BRIDGE_CONTROL_PARITY_ERROR_RESPONSE    BIT0   ///< 0x0001
00396 #define EFI_PCI_BRIDGE_CONTROL_SERR                     BIT1   ///< 0x0002
00397 #define EFI_PCI_BRIDGE_CONTROL_ISA                      BIT2   ///< 0x0004
00398 #define EFI_PCI_BRIDGE_CONTROL_VGA                      BIT3   ///< 0x0008
00399 #define EFI_PCI_BRIDGE_CONTROL_VGA_16                   BIT4   ///< 0x0010
00400 #define EFI_PCI_BRIDGE_CONTROL_MASTER_ABORT             BIT5   ///< 0x0020
00401 #define EFI_PCI_BRIDGE_CONTROL_RESET_SECONDARY_BUS      BIT6   ///< 0x0040
00402 #define EFI_PCI_BRIDGE_CONTROL_FAST_BACK_TO_BACK        BIT7   ///< 0x0080
00403 #define EFI_PCI_BRIDGE_CONTROL_PRIMARY_DISCARD_TIMER    BIT8   ///< 0x0100
00404 #define EFI_PCI_BRIDGE_CONTROL_SECONDARY_DISCARD_TIMER  BIT9   ///< 0x0200
00405 #define EFI_PCI_BRIDGE_CONTROL_TIMER_STATUS             BIT10  ///< 0x0400
00406 #define EFI_PCI_BRIDGE_CONTROL_DISCARD_TIMER_SERR       BIT11  ///< 0x0800
00407 
00408 ///
00409 /// Following are the PCI-CARDBUS bridge control bit, defined in PC Card Standard
00410 ///
00411 #define EFI_PCI_BRIDGE_CONTROL_IREQINT_ENABLE           BIT7   ///< 0x0080
00412 #define EFI_PCI_BRIDGE_CONTROL_RANGE0_MEMORY_TYPE       BIT8   ///< 0x0100
00413 #define EFI_PCI_BRIDGE_CONTROL_RANGE1_MEMORY_TYPE       BIT9   ///< 0x0200
00414 #define EFI_PCI_BRIDGE_CONTROL_WRITE_POSTING_ENABLE     BIT10  ///< 0x0400
00415 
00416 //
00417 // Following are the PCI status control bit
00418 //
00419 #define EFI_PCI_STATUS_CAPABILITY                       BIT4   ///< 0x0010
00420 #define EFI_PCI_STATUS_66MZ_CAPABLE                     BIT5   ///< 0x0020
00421 #define EFI_PCI_FAST_BACK_TO_BACK_CAPABLE               BIT7   ///< 0x0080
00422 #define EFI_PCI_MASTER_DATA_PARITY_ERROR                BIT8   ///< 0x0100
00423 
00424 ///
00425 /// defined in PC Card Standard
00426 ///
00427 #define EFI_PCI_CARDBUS_BRIDGE_CAPABILITY_PTR 0x14
00428 
00429 #pragma pack(1)
00430 //
00431 // PCI Capability List IDs and records
00432 //
00433 #define EFI_PCI_CAPABILITY_ID_PMI     0x01
00434 #define EFI_PCI_CAPABILITY_ID_AGP     0x02
00435 #define EFI_PCI_CAPABILITY_ID_VPD     0x03
00436 #define EFI_PCI_CAPABILITY_ID_SLOTID  0x04
00437 #define EFI_PCI_CAPABILITY_ID_MSI     0x05
00438 #define EFI_PCI_CAPABILITY_ID_HOTPLUG 0x06
00439 typedef struct {
00440   UINT8 CapabilityID;
00441   UINT8 NextItemPtr;
00442 } EFI_PCI_CAPABILITY_HDR;
00443 
00444 ///
00445 /// Capability EFI_PCI_CAPABILITY_ID_PMI, defined in PCI Power Management Interface Specifiction
00446 ///
00447 typedef struct {
00448   EFI_PCI_CAPABILITY_HDR  Hdr;
00449   UINT16                  PMC;
00450   UINT16                  PMCSR;
00451   UINT8                   BridgeExtention;
00452   UINT8                   Data;
00453 } EFI_PCI_CAPABILITY_PMI;
00454 
00455 ///
00456 /// Capability EFI_PCI_CAPABILITY_ID_AGP, defined in Accelerated Graphics Port Interface Specification
00457 ///
00458 typedef struct {
00459   EFI_PCI_CAPABILITY_HDR  Hdr;
00460   UINT8                   Rev;
00461   UINT8                   Reserved;
00462   UINT32                  Status;
00463   UINT32                  Command;
00464 } EFI_PCI_CAPABILITY_AGP;
00465 
00466 ///
00467 /// Capability EFI_PCI_CAPABILITY_ID_VPD, in PCI2.2 Spec.
00468 ///
00469 typedef struct {
00470   EFI_PCI_CAPABILITY_HDR  Hdr;
00471   UINT16                  AddrReg;
00472   UINT32                  DataReg;
00473 } EFI_PCI_CAPABILITY_VPD;
00474 
00475 ///
00476 /// Capability EFI_PCI_CAPABILITY_ID_SLOTID, defined in PCI-to-PCI Bridge Architeture Specification
00477 ///
00478 typedef struct {
00479   EFI_PCI_CAPABILITY_HDR  Hdr;
00480   UINT8                   ExpnsSlotReg;
00481   UINT8                   ChassisNo;
00482 } EFI_PCI_CAPABILITY_SLOTID;
00483 
00484 ///
00485 /// Capability EFI_PCI_CAPABILITY_ID_MSI, defined in PCI2.2
00486 ///
00487 typedef struct {
00488   EFI_PCI_CAPABILITY_HDR  Hdr;
00489   UINT16                  MsgCtrlReg;
00490   UINT32                  MsgAddrReg;
00491   UINT16                  MsgDataReg;
00492 } EFI_PCI_CAPABILITY_MSI32;
00493 
00494 typedef struct {
00495   EFI_PCI_CAPABILITY_HDR  Hdr;
00496   UINT16                  MsgCtrlReg;
00497   UINT32                  MsgAddrRegLsdw;
00498   UINT32                  MsgAddrRegMsdw;
00499   UINT16                  MsgDataReg;
00500 } EFI_PCI_CAPABILITY_MSI64;
00501 
00502 ///
00503 /// Capability EFI_PCI_CAPABILITY_ID_HOTPLUG, defined in CompactPCI Hot Swap Specification PICMG 2.1, R1.0
00504 ///
00505 typedef struct {
00506   EFI_PCI_CAPABILITY_HDR  Hdr;
00507   ///
00508   /// not finished - fields need to go here
00509   ///
00510 } EFI_PCI_CAPABILITY_HOTPLUG;
00511 
00512 #define DEVICE_ID_NOCARE    0xFFFF
00513 
00514 #define PCI_ACPI_UNUSED     0
00515 #define PCI_BAR_NOCHANGE    0
00516 #define PCI_BAR_OLD_ALIGN   0xFFFFFFFFFFFFFFFFULL
00517 #define PCI_BAR_EVEN_ALIGN  0xFFFFFFFFFFFFFFFEULL
00518 #define PCI_BAR_SQUAD_ALIGN 0xFFFFFFFFFFFFFFFDULL
00519 #define PCI_BAR_DQUAD_ALIGN 0xFFFFFFFFFFFFFFFCULL
00520 
00521 #define PCI_BAR_IDX0        0x00
00522 #define PCI_BAR_IDX1        0x01
00523 #define PCI_BAR_IDX2        0x02
00524 #define PCI_BAR_IDX3        0x03
00525 #define PCI_BAR_IDX4        0x04
00526 #define PCI_BAR_IDX5        0x05
00527 #define PCI_BAR_ALL         0xFF
00528 
00529 ///
00530 /// EFI PCI Option ROM definitions
00531 ///
00532 #define EFI_ROOT_BRIDGE_LIST                            'eprb'
00533 #define EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE       0x0EF1  ///< defined in UEFI Spec.
00534 
00535 typedef struct {
00536   UINT8 Register;
00537   UINT8 Function;
00538   UINT8 Device;
00539   UINT8 Bus;
00540   UINT8 Reserved[4];
00541 } DEFIO_PCI_ADDR;
00542 
00543 #define PCI_EXPANSION_ROM_HEADER_SIGNATURE              0xaa55
00544 #define PCI_DATA_STRUCTURE_SIGNATURE                    SIGNATURE_32 ('P', 'C', 'I', 'R')
00545 #define PCI_CODE_TYPE_PCAT_IMAGE                        0x00
00546 #define EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED         0x0001  ///<defined in UEFI spec.
00547 
00548 typedef struct {
00549   UINT16  Signature;    ///< 0xaa55
00550   UINT8   Reserved[0x16];
00551   UINT16  PcirOffset;
00552 } PCI_EXPANSION_ROM_HEADER;
00553 
00554 typedef struct {
00555   UINT16  Signature;    ///< 0xaa55
00556   UINT8   Size512;
00557   UINT8   InitEntryPoint[3];
00558   UINT8   Reserved[0x12];
00559   UINT16  PcirOffset;
00560 } EFI_LEGACY_EXPANSION_ROM_HEADER;
00561 
00562 typedef struct {
00563   UINT32  Signature;    ///< "PCIR"
00564   UINT16  VendorId;
00565   UINT16  DeviceId;
00566   UINT16  Reserved0;
00567   UINT16  Length;
00568   UINT8   Revision;
00569   UINT8   ClassCode[3];
00570   UINT16  ImageLength;
00571   UINT16  CodeRevision;
00572   UINT8   CodeType;
00573   UINT8   Indicator;
00574   UINT16  Reserved1;
00575 } PCI_DATA_STRUCTURE;
00576 
00577 ///
00578 /// defined in EFI/UEFI Spec
00579 ///
00580 typedef struct {
00581   UINT16  Signature;    ///< 0xaa55
00582   UINT16  InitializationSize;
00583   UINT32  EfiSignature; ///< 0x0EF1
00584   UINT16  EfiSubsystem;
00585   UINT16  EfiMachineType;
00586   UINT16  CompressionType;
00587   UINT8   Reserved[8];
00588   UINT16  EfiImageHeaderOffset;
00589   UINT16  PcirOffset;
00590 } EFI_PCI_EXPANSION_ROM_HEADER;
00591 
00592 typedef union {
00593   UINT8                           *Raw;
00594   PCI_EXPANSION_ROM_HEADER        *Generic;
00595   EFI_PCI_EXPANSION_ROM_HEADER    *Efi;
00596   EFI_LEGACY_EXPANSION_ROM_HEADER *PcAt;
00597 } EFI_PCI_ROM_HEADER;
00598 
00599 #pragma pack()
00600 
00601 #endif

Generated on Tue Apr 6 20:01:07 2010 for gPXE by  doxygen 1.5.7.1