EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

MdePkg/Include/Protocol/PciIo.h

Go to the documentation of this file.
00001 
00016 #ifndef __PCI_IO_H__
00017 #define __PCI_IO_H__
00018 
00022 #define EFI_PCI_IO_PROTOCOL_GUID \
00023   { \
00024     0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a } \
00025   }
00026 
00027 typedef struct _EFI_PCI_IO_PROTOCOL  EFI_PCI_IO_PROTOCOL;
00028 
00034 typedef enum {
00035   EfiPciIoWidthUint8      = 0,
00036   EfiPciIoWidthUint16,
00037   EfiPciIoWidthUint32,
00038   EfiPciIoWidthUint64,
00039   EfiPciIoWidthFifoUint8,
00040   EfiPciIoWidthFifoUint16,
00041   EfiPciIoWidthFifoUint32,
00042   EfiPciIoWidthFifoUint64,
00043   EfiPciIoWidthFillUint8,
00044   EfiPciIoWidthFillUint16,
00045   EfiPciIoWidthFillUint32,
00046   EfiPciIoWidthFillUint64,
00047   EfiPciIoWidthMaximum
00048 } EFI_PCI_IO_PROTOCOL_WIDTH;
00049 
00050 //
00051 // Complete PCI address generater
00052 //
00053 #define EFI_PCI_IO_PASS_THROUGH_BAR               0xff    ///< Special BAR that passes a memory or I/O cycle through unchanged
00054 #define EFI_PCI_IO_ATTRIBUTE_MASK                 0x077f  ///< All the following I/O and Memory cycles
00055 #define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO   0x0001  ///< I/O cycles 0x0000-0x00FF (10 bit decode)
00056 #define EFI_PCI_IO_ATTRIBUTE_ISA_IO               0x0002  ///< I/O cycles 0x0100-0x03FF or greater (10 bit decode)
00057 #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO       0x0004  ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
00058 #define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY           0x0008  ///< MEM cycles 0xA0000-0xBFFFF (24 bit decode)
00059 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO               0x0010  ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
00060 #define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO       0x0020  ///< I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
00061 #define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO     0x0040  ///< I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)
00062 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080  ///< Map a memory range so writes are combined
00063 #define EFI_PCI_IO_ATTRIBUTE_IO                   0x0100  ///< Enable the I/O decode bit in the PCI Config Header
00064 #define EFI_PCI_IO_ATTRIBUTE_MEMORY               0x0200  ///< Enable the Memory decode bit in the PCI Config Header
00065 #define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER           0x0400  ///< Enable the DMA bit in the PCI Config Header
00066 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED        0x0800  ///< Map a memory range so all r/w accesses are cached
00067 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE       0x1000  ///< Disable a memory range
00068 #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE      0x2000  ///< Clear for an add-in PCI Device
00069 #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM         0x4000  ///< Clear for a physical PCI Option ROM accessed through ROM BAR
00070 #define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE   0x8000  ///< Clear for PCI controllers that can not genrate a DAC
00071 #define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16            0x10000 ///< I/O cycles 0x0100-0x03FF or greater (16 bit decode)
00072 #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16    0x20000 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
00073 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16            0x40000 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
00074 
00075 #define EFI_PCI_DEVICE_ENABLE                     (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER)
00076 #define EFI_VGA_DEVICE_ENABLE                     (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY | EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_IO)
00077 
00083 typedef enum {
00087   EfiPciIoOperationBusMasterRead,
00091   EfiPciIoOperationBusMasterWrite,
00096   EfiPciIoOperationBusMasterCommonBuffer,
00097   EfiPciIoOperationMaximum
00098 } EFI_PCI_IO_PROTOCOL_OPERATION;
00099 
00105 typedef enum {
00109   EfiPciIoAttributeOperationGet,
00113   EfiPciIoAttributeOperationSet,
00117   EfiPciIoAttributeOperationEnable,
00121   EfiPciIoAttributeOperationDisable,
00125   EfiPciIoAttributeOperationSupported,
00126   EfiPciIoAttributeOperationMaximum
00127 } EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
00128 
00151 typedef
00152 EFI_STATUS
00153 (EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM)(
00154   IN EFI_PCI_IO_PROTOCOL           *This,
00155   IN  EFI_PCI_IO_PROTOCOL_WIDTH    Width,
00156   IN  UINT8                        BarIndex,
00157   IN  UINT64                       Offset,
00158   IN  UINT64                       Mask,
00159   IN  UINT64                       Value,
00160   IN  UINT64                       Delay,
00161   OUT UINT64                       *Result
00162   );
00163 
00184 typedef
00185 EFI_STATUS
00186 (EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM)(
00187   IN EFI_PCI_IO_PROTOCOL              *This,
00188   IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,
00189   IN     UINT8                        BarIndex,
00190   IN     UINT64                       Offset,
00191   IN     UINTN                        Count,
00192   IN OUT VOID                         *Buffer
00193   );
00194 
00195 typedef struct {
00199   EFI_PCI_IO_PROTOCOL_IO_MEM  Read;
00203   EFI_PCI_IO_PROTOCOL_IO_MEM  Write;
00204 } EFI_PCI_IO_PROTOCOL_ACCESS;
00205 
00224 typedef
00225 EFI_STATUS
00226 (EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG)(
00227   IN EFI_PCI_IO_PROTOCOL              *This,
00228   IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,
00229   IN     UINT32                       Offset,
00230   IN     UINTN                        Count,
00231   IN OUT VOID                         *Buffer
00232   );
00233 
00234 typedef struct {
00238   EFI_PCI_IO_PROTOCOL_CONFIG  Read;
00242   EFI_PCI_IO_PROTOCOL_CONFIG  Write;
00243 } EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
00244 
00273 typedef
00274 EFI_STATUS
00275 (EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM)(
00276   IN EFI_PCI_IO_PROTOCOL              *This,
00277   IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,
00278   IN     UINT8                        DestBarIndex,
00279   IN     UINT64                       DestOffset,
00280   IN     UINT8                        SrcBarIndex,
00281   IN     UINT64                       SrcOffset,
00282   IN     UINTN                        Count
00283   );
00284 
00304 typedef
00305 EFI_STATUS
00306 (EFIAPI *EFI_PCI_IO_PROTOCOL_MAP)(
00307   IN EFI_PCI_IO_PROTOCOL                *This,
00308   IN     EFI_PCI_IO_PROTOCOL_OPERATION  Operation,
00309   IN     VOID                           *HostAddress,
00310   IN OUT UINTN                          *NumberOfBytes,
00311   OUT    EFI_PHYSICAL_ADDRESS           *DeviceAddress,
00312   OUT    VOID                           **Mapping
00313   );
00314 
00325 typedef
00326 EFI_STATUS
00327 (EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP)(
00328   IN EFI_PCI_IO_PROTOCOL           *This,
00329   IN  VOID                         *Mapping
00330   );
00331 
00352 typedef
00353 EFI_STATUS
00354 (EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER)(
00355   IN EFI_PCI_IO_PROTOCOL           *This,
00356   IN  EFI_ALLOCATE_TYPE            Type,
00357   IN  EFI_MEMORY_TYPE              MemoryType,
00358   IN  UINTN                        Pages,
00359   OUT VOID                         **HostAddress,
00360   IN  UINT64                       Attributes
00361   );
00362 
00375 typedef
00376 EFI_STATUS
00377 (EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER)(
00378   IN EFI_PCI_IO_PROTOCOL           *This,
00379   IN  UINTN                        Pages,
00380   IN  VOID                         *HostAddress
00381   );
00382 
00394 typedef
00395 EFI_STATUS
00396 (EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH)(
00397   IN EFI_PCI_IO_PROTOCOL  *This
00398   );
00399 
00413 typedef
00414 EFI_STATUS
00415 (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION)(
00416   IN EFI_PCI_IO_PROTOCOL          *This,
00417   OUT UINTN                       *SegmentNumber,
00418   OUT UINTN                       *BusNumber,
00419   OUT UINTN                       *DeviceNumber,
00420   OUT UINTN                       *FunctionNumber
00421   );
00422 
00442 typedef
00443 EFI_STATUS
00444 (EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES)(
00445   IN EFI_PCI_IO_PROTOCOL                       *This,
00446   IN  EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION  Operation,
00447   IN  UINT64                                   Attributes,
00448   OUT UINT64                                   *Result OPTIONAL
00449   );
00450 
00473 typedef
00474 EFI_STATUS
00475 (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES)(
00476   IN EFI_PCI_IO_PROTOCOL             *This,
00477   IN  UINT8                          BarIndex,
00478   OUT UINT64                         *Supports, OPTIONAL
00479   OUT VOID                           **Resources OPTIONAL
00480   );
00481 
00506 typedef
00507 EFI_STATUS
00508 (EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES)(
00509   IN EFI_PCI_IO_PROTOCOL              *This,
00510   IN     UINT64                       Attributes,
00511   IN     UINT8                        BarIndex,
00512   IN OUT UINT64                       *Offset,
00513   IN OUT UINT64                       *Length
00514   );
00515 
00523 struct _EFI_PCI_IO_PROTOCOL {
00524   EFI_PCI_IO_PROTOCOL_POLL_IO_MEM         PollMem;
00525   EFI_PCI_IO_PROTOCOL_POLL_IO_MEM         PollIo;
00526   EFI_PCI_IO_PROTOCOL_ACCESS              Mem;
00527   EFI_PCI_IO_PROTOCOL_ACCESS              Io;
00528   EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS       Pci;
00529   EFI_PCI_IO_PROTOCOL_COPY_MEM            CopyMem;
00530   EFI_PCI_IO_PROTOCOL_MAP                 Map;
00531   EFI_PCI_IO_PROTOCOL_UNMAP               Unmap;
00532   EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER     AllocateBuffer;
00533   EFI_PCI_IO_PROTOCOL_FREE_BUFFER         FreeBuffer;
00534   EFI_PCI_IO_PROTOCOL_FLUSH               Flush;
00535   EFI_PCI_IO_PROTOCOL_GET_LOCATION        GetLocation;
00536   EFI_PCI_IO_PROTOCOL_ATTRIBUTES          Attributes;
00537   EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES  GetBarAttributes;
00538   EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES  SetBarAttributes;
00539   
00543   UINT64                                  RomSize;
00544 
00553   VOID                                    *RomImage;
00554 };
00555 
00556 extern EFI_GUID gEfiPciIoProtocolGuid;
00557 
00558 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines