PciIo.h

Go to the documentation of this file.
00001 /** @file
00002   EFI PCI I/O Protocol provides the basic Memory, I/O, PCI configuration,
00003   and DMA interfaces that a driver uses to access its PCI controller.
00004 
00005   Copyright (c) 2006 - 2008, Intel Corporation
00006   All rights reserved. This program and the accompanying materials
00007   are licensed and made available under the terms and conditions of the BSD License
00008   which accompanies this distribution.  The full text of the license may be found at
00009   http://opensource.org/licenses/bsd-license.php
00010 
00011   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00012   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00013 
00014 **/
00015 
00016 #ifndef __PCI_IO_H__
00017 #define __PCI_IO_H__
00018 
00019 ///
00020 /// Global ID for the PCI I/O Protocol
00021 ///
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 
00029 ///
00030 /// Prototypes for the PCI I/O Protocol
00031 ///
00032 typedef enum {
00033   EfiPciIoWidthUint8      = 0,
00034   EfiPciIoWidthUint16,
00035   EfiPciIoWidthUint32,
00036   EfiPciIoWidthUint64,
00037   EfiPciIoWidthFifoUint8,
00038   EfiPciIoWidthFifoUint16,
00039   EfiPciIoWidthFifoUint32,
00040   EfiPciIoWidthFifoUint64,
00041   EfiPciIoWidthFillUint8,
00042   EfiPciIoWidthFillUint16,
00043   EfiPciIoWidthFillUint32,
00044   EfiPciIoWidthFillUint64,
00045   EfiPciIoWidthMaximum
00046 } EFI_PCI_IO_PROTOCOL_WIDTH;
00047 
00048 //
00049 // Complete PCI address generater
00050 //
00051 #define EFI_PCI_IO_PASS_THROUGH_BAR               0xff    ///< Special BAR that passes a memory or I/O cycle through unchanged
00052 #define EFI_PCI_IO_ATTRIBUTE_MASK                 0x077f  ///< All the following I/O and Memory cycles
00053 #define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO   0x0001  ///< I/O cycles 0x0000-0x00FF (10 bit decode)
00054 #define EFI_PCI_IO_ATTRIBUTE_ISA_IO               0x0002  ///< I/O cycles 0x0100-0x03FF or greater (10 bit decode)
00055 #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO       0x0004  ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode)
00056 #define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY           0x0008  ///< MEM cycles 0xA0000-0xBFFFF (24 bit decode)
00057 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO               0x0010  ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode)
00058 #define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO       0x0020  ///< I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode)
00059 #define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO     0x0040  ///< I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode)
00060 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080  ///< Map a memory range so write are combined
00061 #define EFI_PCI_IO_ATTRIBUTE_IO                   0x0100  ///< Enable the I/O decode bit in the PCI Config Header
00062 #define EFI_PCI_IO_ATTRIBUTE_MEMORY               0x0200  ///< Enable the Memory decode bit in the PCI Config Header
00063 #define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER           0x0400  ///< Enable the DMA bit in the PCI Config Header
00064 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED        0x0800  ///< Map a memory range so all r/w accesses are cached
00065 #define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE       0x1000  ///< Disable a memory range
00066 #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE      0x2000  ///< Clear for an add-in PCI Device
00067 #define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM         0x4000  ///< Clear for a physical PCI Option ROM accessed through ROM BAR
00068 #define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE   0x8000  ///< Clear for PCI controllers that can not genrate a DAC
00069 #define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16            0x10000 ///< I/O cycles 0x0100-0x03FF or greater (16 bit decode)
00070 #define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16    0x20000 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (16 bit decode)
00071 #define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16            0x30000 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (16 bit decode)
00072 
00073 #define EFI_PCI_DEVICE_ENABLE                     (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER)
00074 #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)
00075 
00076 ///
00077 /// *******************************************************
00078 /// EFI_PCI_IO_PROTOCOL_OPERATION
00079 /// *******************************************************
00080 ///
00081 typedef enum {
00082   EfiPciIoOperationBusMasterRead,
00083   EfiPciIoOperationBusMasterWrite,
00084   EfiPciIoOperationBusMasterCommonBuffer,
00085   EfiPciIoOperationMaximum
00086 } EFI_PCI_IO_PROTOCOL_OPERATION;
00087 
00088 ///
00089 /// *******************************************************
00090 /// EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION
00091 /// *******************************************************
00092 ///
00093 typedef enum {
00094   EfiPciIoAttributeOperationGet,
00095   EfiPciIoAttributeOperationSet,
00096   EfiPciIoAttributeOperationEnable,
00097   EfiPciIoAttributeOperationDisable,
00098   EfiPciIoAttributeOperationSupported,
00099   EfiPciIoAttributeOperationMaximum
00100 } EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
00101 
00102 /**
00103   Reads from the memory space of a PCI controller. Returns when either the polling exit criteria is
00104   satisfied or after a defined duration.
00105 
00106   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00107   @param  Width                 Signifies the width of the memory or I/O operations.
00108   @param  BarIndex              The BAR index of the standard PCI Configuration header to use as the
00109                                 base address for the memory operation to perform.
00110   @param  Offset                The offset within the selected BAR to start the memory operation.
00111   @param  Mask                  Mask used for the polling criteria.
00112   @param  Value                 The comparison value used for the polling exit criteria.
00113   @param  Delay                 The number of 100 ns units to poll.
00114   @param  Result                Pointer to the last value read from the memory location.
00115 
00116   @retval EFI_SUCCESS           The last data returned from the access matched the poll exit criteria.
00117   @retval EFI_UNSUPPORTED       BarIndex not valid for this PCI controller.
00118   @retval EFI_UNSUPPORTED       Offset is not valid for the BarIndex of this PCI controller.
00119   @retval EFI_TIMEOUT           Delay expired before a match occurred.
00120   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
00121   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
00122 
00123 **/
00124 typedef
00125 EFI_STATUS
00126 (EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM)(
00127   IN EFI_PCI_IO_PROTOCOL           *This,
00128   IN  EFI_PCI_IO_PROTOCOL_WIDTH    Width,
00129   IN  UINT8                        BarIndex,
00130   IN  UINT64                       Offset,
00131   IN  UINT64                       Mask,
00132   IN  UINT64                       Value,
00133   IN  UINT64                       Delay,
00134   OUT UINT64                       *Result
00135   );
00136 
00137 /**
00138   Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.
00139 
00140   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00141   @param  Width                 Signifies the width of the memory or I/O operations.
00142   @param  BarIndex              The BAR index of the standard PCI Configuration header to use as the
00143                                 base address for the memory or I/O operation to perform.
00144   @param  Offset                The offset within the selected BAR to start the memory or I/O operation.
00145   @param  Count                 The number of memory or I/O operations to perform.
00146   @param  Buffer                For read operations, the destination buffer to store the results. For write
00147                                 operations, the source buffer to write data from.
00148 
00149   @retval EFI_SUCCESS           The data was read from or written to the PCI controller.
00150   @retval EFI_UNSUPPORTED       BarIndex not valid for this PCI controller.
00151   @retval EFI_UNSUPPORTED       The address range specified by Offset, Width, and Count is not
00152                                 valid for the PCI BAR specified by BarIndex.
00153   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
00154   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
00155 
00156 **/
00157 typedef
00158 EFI_STATUS
00159 (EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM)(
00160   IN EFI_PCI_IO_PROTOCOL              *This,
00161   IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,
00162   IN     UINT8                        BarIndex,
00163   IN     UINT64                       Offset,
00164   IN     UINTN                        Count,
00165   IN OUT VOID                         *Buffer
00166   );
00167 
00168 typedef struct {
00169   EFI_PCI_IO_PROTOCOL_IO_MEM  Read;
00170   EFI_PCI_IO_PROTOCOL_IO_MEM  Write;
00171 } EFI_PCI_IO_PROTOCOL_ACCESS;
00172 
00173 /**
00174   Enable a PCI driver to access PCI controller registers in PCI configuration space.
00175 
00176   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00177   @param  Width                 Signifies the width of the memory operations.
00178   @param  Offset                The offset within the PCI configuration space for the PCI controller.
00179   @param  Count                 The number of PCI configuration operations to perform.
00180   @param  Buffer                For read operations, the destination buffer to store the results. For write
00181                                 operations, the source buffer to write data from.
00182 
00183 
00184   @retval EFI_SUCCESS           The data was read from or written to the PCI controller.
00185   @retval EFI_UNSUPPORTED       The address range specified by Offset, Width, and Count is not
00186                                 valid for the PCI configuration header of the PCI controller.
00187   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
00188   @retval EFI_INVALID_PARAMETER Buffer is NULL or Width is invalid.
00189 
00190 **/
00191 typedef
00192 EFI_STATUS
00193 (EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG)(
00194   IN EFI_PCI_IO_PROTOCOL              *This,
00195   IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,
00196   IN     UINT32                       Offset,
00197   IN     UINTN                        Count,
00198   IN OUT VOID                         *Buffer
00199   );
00200 
00201 typedef struct {
00202   EFI_PCI_IO_PROTOCOL_CONFIG  Read;
00203   EFI_PCI_IO_PROTOCOL_CONFIG  Write;
00204 } EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
00205 
00206 /**
00207   Enables a PCI driver to copy one region of PCI memory space to another region of PCI
00208   memory space.
00209 
00210   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00211   @param  Width                 Signifies the width of the memory operations.
00212   @param  DestBarIndex          The BAR index in the standard PCI Configuration header to use as the
00213                                 base address for the memory operation to perform.
00214   @param  DestOffset            The destination offset within the BAR specified by DestBarIndex to
00215                                 start the memory writes for the copy operation.
00216   @param  SrcBarIndex           The BAR index in the standard PCI Configuration header to use as the
00217                                 base address for the memory operation to perform.
00218   @param  SrcOffset             The source offset within the BAR specified by SrcBarIndex to start
00219                                 the memory reads for the copy operation.
00220   @param  Count                 The number of memory operations to perform. Bytes moved is Width
00221                                 size * Count, starting at DestOffset and SrcOffset.
00222 
00223   @retval EFI_SUCCESS           The data was copied from one memory region to another memory region.
00224   @retval EFI_UNSUPPORTED       DestBarIndex not valid for this PCI controller.
00225   @retval EFI_UNSUPPORTED       SrcBarIndex not valid for this PCI controller.
00226   @retval EFI_UNSUPPORTED       The address range specified by DestOffset, Width, and Count
00227                                 is not valid for the PCI BAR specified by DestBarIndex.
00228   @retval EFI_UNSUPPORTED       The address range specified by SrcOffset, Width, and Count is
00229                                 not valid for the PCI BAR specified by SrcBarIndex.
00230   @retval EFI_INVALID_PARAMETER Width is invalid.
00231   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
00232 
00233 **/
00234 typedef
00235 EFI_STATUS
00236 (EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM)(
00237   IN EFI_PCI_IO_PROTOCOL              *This,
00238   IN     EFI_PCI_IO_PROTOCOL_WIDTH    Width,
00239   IN     UINT8                        DestBarIndex,
00240   IN     UINT64                       DestOffset,
00241   IN     UINT8                        SrcBarIndex,
00242   IN     UINT64                       SrcOffset,
00243   IN     UINTN                        Count
00244   );
00245 
00246 /**
00247   Provides the PCI controller-Cspecific addresses needed to access system memory.
00248 
00249   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00250   @param  Operation             Indicates if the bus master is going to read or write to system memory.
00251   @param  HostAddress           The system memory address to map to the PCI controller.
00252   @param  NumberOfBytes         On input the number of bytes to map. On output the number of bytes
00253                                 that were mapped.
00254   @param  DeviceAddress         The resulting map address for the bus master PCI controller to use to
00255                                 access the hosts HostAddress.
00256   @param  Mapping               A resulting value to pass to Unmap().
00257 
00258   @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.
00259   @retval EFI_UNSUPPORTED       The HostAddress cannot be mapped as a common buffer.
00260   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
00261   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
00262   @retval EFI_DEVICE_ERROR      The system hardware could not map the requested address.
00263 
00264 **/
00265 typedef
00266 EFI_STATUS
00267 (EFIAPI *EFI_PCI_IO_PROTOCOL_MAP)(
00268   IN EFI_PCI_IO_PROTOCOL                *This,
00269   IN     EFI_PCI_IO_PROTOCOL_OPERATION  Operation,
00270   IN     VOID                           *HostAddress,
00271   IN OUT UINTN                          *NumberOfBytes,
00272   OUT    EFI_PHYSICAL_ADDRESS           *DeviceAddress,
00273   OUT    VOID                           **Mapping
00274   );
00275 
00276 /**
00277   Completes the Map() operation and releases any corresponding resources.
00278 
00279   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00280   @param  Mapping               The mapping value returned from Map().
00281 
00282   @retval EFI_SUCCESS           The range was unmapped.
00283   @retval EFI_DEVICE_ERROR      The data was not committed to the target system memory.
00284 
00285 **/
00286 typedef
00287 EFI_STATUS
00288 (EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP)(
00289   IN EFI_PCI_IO_PROTOCOL           *This,
00290   IN  VOID                         *Mapping
00291   );
00292 
00293 /**
00294   Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer
00295   mapping.
00296 
00297   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00298   @param  Type                  This parameter is not used and must be ignored.
00299   @param  MemoryType            The type of memory to allocate, EfiBootServicesData or
00300                                 EfiRuntimeServicesData.
00301   @param  Pages                 The number of pages to allocate.
00302   @param  HostAddress           A pointer to store the base system memory address of the
00303                                 allocated range.
00304   @param  Attributes            The requested bit mask of attributes for the allocated range.
00305 
00306   @retval EFI_SUCCESS           The requested memory pages were allocated.
00307   @retval EFI_UNSUPPORTED       Attributes is unsupported. The only legal attribute bits are
00308                                 MEMORY_WRITE_COMBINE and MEMORY_CACHED.
00309   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
00310   @retval EFI_OUT_OF_RESOURCES  The memory pages could not be allocated.
00311 
00312 **/
00313 typedef
00314 EFI_STATUS
00315 (EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER)(
00316   IN EFI_PCI_IO_PROTOCOL           *This,
00317   IN  EFI_ALLOCATE_TYPE            Type,
00318   IN  EFI_MEMORY_TYPE              MemoryType,
00319   IN  UINTN                        Pages,
00320   OUT VOID                         **HostAddress,
00321   IN  UINT64                       Attributes
00322   );
00323 
00324 /**
00325   Frees memory that was allocated with AllocateBuffer().
00326 
00327   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00328   @param  Pages                 The number of pages to free.
00329   @param  HostAddress           The base system memory address of the allocated range.
00330 
00331   @retval EFI_SUCCESS           The requested memory pages were freed.
00332   @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages
00333                                 was not allocated with AllocateBuffer().
00334 
00335 **/
00336 typedef
00337 EFI_STATUS
00338 (EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER)(
00339   IN EFI_PCI_IO_PROTOCOL           *This,
00340   IN  UINTN                        Pages,
00341   IN  VOID                         *HostAddress
00342   );
00343 
00344 /**
00345   Flushes all PCI posted write transactions from a PCI host bridge to system memory.
00346 
00347   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00348 
00349   @retval EFI_SUCCESS           The PCI posted write transactions were flushed from the PCI host
00350                                 bridge to system memory.
00351   @retval EFI_DEVICE_ERROR      The PCI posted write transactions were not flushed from the PCI
00352                                 host bridge due to a hardware error.
00353 
00354 **/
00355 typedef
00356 EFI_STATUS
00357 (EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH)(
00358   IN EFI_PCI_IO_PROTOCOL  *This
00359   );
00360 
00361 /**
00362   Retrieves this PCI controller's current PCI bus number, device number, and function number.
00363 
00364   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00365   @param  SegmentNumber         The PCI controller's current PCI segment number.
00366   @param  BusNumber             The PCI controller's current PCI bus number.
00367   @param  DeviceNumber          The PCI controller's current PCI device number.
00368   @param  FunctionNumber        The PCI controller's current PCI function number.
00369 
00370   @retval EFI_SUCCESS           The PCI controller location was returned.
00371   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
00372 
00373 **/
00374 typedef
00375 EFI_STATUS
00376 (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION)(
00377   IN EFI_PCI_IO_PROTOCOL          *This,
00378   OUT UINTN                       *SegmentNumber,
00379   OUT UINTN                       *BusNumber,
00380   OUT UINTN                       *DeviceNumber,
00381   OUT UINTN                       *FunctionNumber
00382   );
00383 
00384 /**
00385   Performs an operation on the attributes that this PCI controller supports. The operations include
00386   getting the set of supported attributes, retrieving the current attributes, setting the current
00387   attributes, enabling attributes, and disabling attributes.
00388 
00389   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00390   @param  Operation             The operation to perform on the attributes for this PCI controller.
00391   @param  Attributes            The mask of attributes that are used for Set, Enable, and Disable
00392                                 operations.
00393   @param  Result                A pointer to the result mask of attributes that are returned for the Get
00394                                 and Supported operations.
00395 
00396   @retval EFI_SUCCESS           The operation on the PCI controller's attributes was completed.
00397   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
00398   @retval EFI_UNSUPPORTED       one or more of the bits set in
00399                                 Attributes are not supported by this PCI controller or one of
00400                                 its parent bridges when Operation is Set, Enable or Disable.
00401 
00402 **/
00403 typedef
00404 EFI_STATUS
00405 (EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES)(
00406   IN EFI_PCI_IO_PROTOCOL                       *This,
00407   IN  EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION  Operation,
00408   IN  UINT64                                   Attributes,
00409   OUT UINT64                                   *Result OPTIONAL
00410   );
00411 
00412 /**
00413   Gets the attributes that this PCI controller supports setting on a BAR using
00414   SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.
00415 
00416   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00417   @param  BarIndex              The BAR index of the standard PCI Configuration header to use as the
00418                                 base address for resource range. The legal range for this field is 0..5.
00419   @param  Supports              A pointer to the mask of attributes that this PCI controller supports
00420                                 setting for this BAR with SetBarAttributes().
00421   @param  Resources             A pointer to the ACPI 2.0 resource descriptors that describe the current
00422                                 configuration of this BAR of the PCI controller.
00423 
00424   @retval EFI_SUCCESS           If Supports is not NULL, then the attributes that the PCI
00425                                 controller supports are returned in Supports. If Resources
00426                                 is not NULL, then the ACPI 2.0 resource descriptors that the PCI
00427                                 controller is currently using are returned in Resources.
00428   @retval EFI_INVALID_PARAMETER Both Supports and Attributes are NULL.
00429   @retval EFI_UNSUPPORTED       BarIndex not valid for this PCI controller.
00430   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to allocate
00431                                 Resources.
00432 
00433 **/
00434 typedef
00435 EFI_STATUS
00436 (EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES)(
00437   IN EFI_PCI_IO_PROTOCOL             *This,
00438   IN  UINT8                          BarIndex,
00439   OUT UINT64                         *Supports, OPTIONAL
00440   OUT VOID                           **Resources OPTIONAL
00441   );
00442 
00443 /**
00444   Sets the attributes for a range of a BAR on a PCI controller.
00445 
00446   @param  This                  A pointer to the EFI_PCI_IO_PROTOCOL instance.
00447   @param  Attributes            The mask of attributes to set for the resource range specified by
00448                                 BarIndex, Offset, and Length.
00449   @param  BarIndex              The BAR index of the standard PCI Configuration header to use as the
00450                                 base address for resource range. The legal range for this field is 0..5.
00451   @param  Offset                A pointer to the BAR relative base address of the resource range to be
00452                                 modified by the attributes specified by Attributes.
00453   @param  Length                A pointer to the length of the resource range to be modified by the
00454                                 attributes specified by Attributes.
00455 
00456   @retval EFI_SUCCESS           The set of attributes specified by Attributes for the resource
00457                                 range specified by BarIndex, Offset, and Length were
00458                                 set on the PCI controller, and the actual resource range is returned
00459                                 in Offset and Length.
00460   @retval EFI_INVALID_PARAMETER Offset or Length is NULL.
00461   @retval EFI_UNSUPPORTED       BarIndex not valid for this PCI controller.
00462   @retval EFI_OUT_OF_RESOURCES  There are not enough resources to set the attributes on the
00463                                 resource range specified by BarIndex, Offset, and
00464                                 Length.
00465 
00466 **/
00467 typedef
00468 EFI_STATUS
00469 (EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES)(
00470   IN EFI_PCI_IO_PROTOCOL              *This,
00471   IN     UINT64                       Attributes,
00472   IN     UINT8                        BarIndex,
00473   IN OUT UINT64                       *Offset,
00474   IN OUT UINT64                       *Length
00475   );
00476 
00477 ///
00478 /// The EFI_PCI_IO_PROTOCOL provides the basic Memory, I/O, PCI configuration,
00479 /// and DMA interfaces that are used to abstract accesses to PCI controllers.
00480 /// There is one EFI_PCI_IO_PROTOCOL instance for each PCI controller on a PCI bus.
00481 /// A device driver that wishes to manage a PCI controller in a system will have to
00482 /// retrieve the EFI_PCI_IO_PROTOCOL instance that is associated with the PCI controller.
00483 ///
00484 struct _EFI_PCI_IO_PROTOCOL {
00485   EFI_PCI_IO_PROTOCOL_POLL_IO_MEM         PollMem;
00486   EFI_PCI_IO_PROTOCOL_POLL_IO_MEM         PollIo;
00487   EFI_PCI_IO_PROTOCOL_ACCESS              Mem;
00488   EFI_PCI_IO_PROTOCOL_ACCESS              Io;
00489   EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS       Pci;
00490   EFI_PCI_IO_PROTOCOL_COPY_MEM            CopyMem;
00491   EFI_PCI_IO_PROTOCOL_MAP                 Map;
00492   EFI_PCI_IO_PROTOCOL_UNMAP               Unmap;
00493   EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER     AllocateBuffer;
00494   EFI_PCI_IO_PROTOCOL_FREE_BUFFER         FreeBuffer;
00495   EFI_PCI_IO_PROTOCOL_FLUSH               Flush;
00496   EFI_PCI_IO_PROTOCOL_GET_LOCATION        GetLocation;
00497   EFI_PCI_IO_PROTOCOL_ATTRIBUTES          Attributes;
00498   EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES  GetBarAttributes;
00499   EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES  SetBarAttributes;
00500 
00501   ///
00502   /// The size, in bytes, of the ROM image.
00503   ///
00504   UINT64                                  RomSize;
00505 
00506   ///
00507   /// A pointer to the in memory copy of the ROM image. The PCI Bus Driver is responsible
00508   /// for allocating memory for the ROM image, and copying the contents of the ROM to memory.
00509   /// The contents of this buffer are either from the PCI option ROM that can be accessed
00510   /// through the ROM BAR of the PCI controller, or it is from a platform-specific location.
00511   /// The Attributes() function can be used to determine from which of these two sources
00512   /// the RomImage buffer was initialized.
00513   ///
00514   VOID                                    *RomImage;
00515 };
00516 
00517 extern EFI_GUID gEfiPciIoProtocolGuid;
00518 
00519 #endif

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