TianoCore EDK2 master
Loading...
Searching...
No Matches
PciIo.c File Reference
#include "PciBus.h"

Go to the source code of this file.

Functions

VOID InitializePciIoInstance (IN PCI_IO_DEVICE *PciIoDevice)
 
EFI_STATUS PciIoVerifyBarAccess (IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 BarIndex, IN PCI_BAR_TYPE Type, IN IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN IN UINTN Count, IN UINT64 *Offset)
 
EFI_STATUS PciIoVerifyConfigAccess (IN PCI_IO_DEVICE *PciIoDevice, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINTN Count, IN UINT64 *Offset)
 
EFI_STATUS EFIAPI PciIoPollMem (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINT64 Mask, IN UINT64 Value, IN UINT64 Delay, OUT UINT64 *Result)
 
EFI_STATUS EFIAPI PciIoPollIo (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINT64 Mask, IN UINT64 Value, IN UINT64 Delay, OUT UINT64 *Result)
 
EFI_STATUS EFIAPI PciIoMemRead (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI PciIoMemWrite (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI PciIoIoRead (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI PciIoIoWrite (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI PciIoConfigRead (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI PciIoConfigWrite (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI PciIoCopyMem (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 DestBarIndex, IN UINT64 DestOffset, IN UINT8 SrcBarIndex, IN UINT64 SrcOffset, IN UINTN Count)
 
EFI_STATUS EFIAPI PciIoMap (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
 
EFI_STATUS EFIAPI PciIoUnmap (IN EFI_PCI_IO_PROTOCOL *This, IN VOID *Mapping)
 
EFI_STATUS EFIAPI PciIoAllocateBuffer (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT VOID **HostAddress, IN UINT64 Attributes)
 
EFI_STATUS EFIAPI PciIoFreeBuffer (IN EFI_PCI_IO_PROTOCOL *This, IN UINTN Pages, IN VOID *HostAddress)
 
EFI_STATUS EFIAPI PciIoFlush (IN EFI_PCI_IO_PROTOCOL *This)
 
EFI_STATUS EFIAPI PciIoGetLocation (IN EFI_PCI_IO_PROTOCOL *This, OUT UINTN *Segment, OUT UINTN *Bus, OUT UINTN *Device, OUT UINTN *Function)
 
BOOLEAN CheckBarType (IN PCI_IO_DEVICE *PciIoDevice, IN UINT8 BarIndex, IN PCI_BAR_TYPE BarType)
 
EFI_STATUS ModifyRootBridgeAttributes (IN PCI_IO_DEVICE *PciIoDevice, IN UINT64 Attributes, IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation)
 
EFI_STATUS SupportPaletteSnoopAttributes (IN PCI_IO_DEVICE *PciIoDevice, IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation)
 
EFI_STATUS EFIAPI PciIoAttributes (IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation, IN UINT64 Attributes, OUT UINT64 *Result OPTIONAL)
 
UINT64 GetMmioAddressTranslationOffset (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *RootBridgeIo, UINT64 AddrRangeMin, UINT64 AddrLen)
 
EFI_STATUS EFIAPI PciIoGetBarAttributes (IN EFI_PCI_IO_PROTOCOL *This, IN UINT8 BarIndex, OUT UINT64 *Supports OPTIONAL, OUT VOID **Resources OPTIONAL)
 
EFI_STATUS EFIAPI PciIoSetBarAttributes (IN EFI_PCI_IO_PROTOCOL *This, IN UINT64 Attributes, IN UINT8 BarIndex, IN OUT UINT64 *Offset, IN OUT UINT64 *Length)
 
BOOLEAN PciDevicesOnTheSamePath (IN PCI_IO_DEVICE *PciDevice1, IN PCI_IO_DEVICE *PciDevice2)
 

Variables

EDKII_IOMMU_PROTOCOLmIoMmuProtocol
 
EFI_PCI_IO_PROTOCOL mPciIoInterface
 

Detailed Description

EFI PCI IO protocol functions implementation for PCI Bus module.

Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PciIo.c.

Function Documentation

◆ CheckBarType()

BOOLEAN CheckBarType ( IN PCI_IO_DEVICE PciIoDevice,
IN UINT8  BarIndex,
IN PCI_BAR_TYPE  BarType 
)

Check BAR type for PCI resource.

Parameters
PciIoDevicePCI device instance.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for the memory or I/O operation to perform.
BarTypeMemory or I/O.
Return values
TRUEPci device's bar type is same with input BarType.
TRUEPci device's bar type is not same with input BarType.

Definition at line 1282 of file PciIo.c.

◆ GetMmioAddressTranslationOffset()

UINT64 GetMmioAddressTranslationOffset ( EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL RootBridgeIo,
UINT64  AddrRangeMin,
UINT64  AddrLen 
)

Retrieve the AddrTranslationOffset from RootBridgeIo for the specified range.

Parameters
RootBridgeIoRoot Bridge IO instance.
AddrRangeMinThe base address of the MMIO.
AddrLenThe length of the MMIO.
Return values
TheAddrTranslationOffset from RootBridgeIo for the specified range, or (UINT64) -1 if the range is not found in RootBridgeIo.

Definition at line 1798 of file PciIo.c.

◆ InitializePciIoInstance()

VOID InitializePciIoInstance ( IN PCI_IO_DEVICE PciIoDevice)

Initializes a PCI I/O Instance.

Parameters
PciIoDevicePci device instance.

Definition at line 52 of file PciIo.c.

◆ ModifyRootBridgeAttributes()

EFI_STATUS ModifyRootBridgeAttributes ( IN PCI_IO_DEVICE PciIoDevice,
IN UINT64  Attributes,
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION  Operation 
)

Set/Disable new attributes to a Root Bridge.

Parameters
PciIoDevicePci device instance.
AttributesNew attribute want to be set.
OperationSet or Disable.
Return values
EFI_UNSUPPORTEDIf root bridge does not support change attribute.
EFI_SUCCESSSuccessfully set new attributes.

Definition at line 1329 of file PciIo.c.

◆ PciDevicesOnTheSamePath()

BOOLEAN PciDevicesOnTheSamePath ( IN PCI_IO_DEVICE PciDevice1,
IN PCI_IO_DEVICE PciDevice2 
)

Test whether two Pci devices has same parent bridge.

Parameters
PciDevice1The first pci device for testing.
PciDevice2The second pci device for testing.
Return values
TRUETwo Pci device has the same parent bridge.
FALSETwo Pci device has not the same parent bridge.

Definition at line 2079 of file PciIo.c.

◆ PciIoAllocateBuffer()

EFI_STATUS EFIAPI PciIoAllocateBuffer ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_ALLOCATE_TYPE  Type,
IN EFI_MEMORY_TYPE  MemoryType,
IN UINTN  Pages,
OUT VOID **  HostAddress,
IN UINT64  Attributes 
)

Allocates pages that are suitable for an EfiPciIoOperationBusMasterCommonBuffer or EfiPciOperationBusMasterCommonBuffer64 mapping.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
TypeThis parameter is not used and must be ignored.
MemoryTypeThe type of memory to allocate, EfiBootServicesData or EfiRuntimeServicesData.
PagesThe number of pages to allocate.
HostAddressA pointer to store the base system memory address of the allocated range.
AttributesThe requested bit mask of attributes for the allocated range.
Return values
EFI_SUCCESSThe requested memory pages were allocated.
EFI_UNSUPPORTEDAttributes is unsupported. The only legal attribute bits are MEMORY_WRITE_COMBINE, MEMORY_CACHED and DUAL_ADDRESS_CYCLE.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_OUT_OF_RESOURCESThe memory pages could not be allocated.

Definition at line 1108 of file PciIo.c.

◆ PciIoAttributes()

EFI_STATUS EFIAPI PciIoAttributes ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION  Operation,
IN UINT64  Attributes,
OUT UINT64 *Result  OPTIONAL 
)

Performs an operation on the attributes that this PCI controller supports. The operations include getting the set of supported attributes, retrieving the current attributes, setting the current attributes, enabling attributes, and disabling attributes.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
OperationThe operation to perform on the attributes for this PCI controller.
AttributesThe mask of attributes that are used for Set, Enable, and Disable operations.
ResultA pointer to the result mask of attributes that are returned for the Get and Supported operations.
Return values
EFI_SUCCESSThe operation on the PCI controller's attributes was completed.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_UNSUPPORTEDone or more of the bits set in Attributes are not supported by this PCI controller or one of its parent bridges when Operation is Set, Enable or Disable.

Definition at line 1525 of file PciIo.c.

◆ PciIoConfigRead()

EFI_STATUS EFIAPI PciIoConfigRead ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT32  Offset,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Enable a PCI driver to access PCI controller registers in PCI configuration space.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory operations.
OffsetThe offset within the PCI configuration space for the PCI controller.
CountThe number of PCI configuration operations to perform.
BufferFor read operations, the destination buffer to store the results. For write operations, the source buffer to write data from.
Return values
EFI_SUCCESSThe data was read from or written to the PCI controller.
EFI_UNSUPPORTEDThe address range specified by Offset, Width, and Count is not valid for the PCI configuration header of the PCI controller.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETERBuffer is NULL or Width is invalid.

Definition at line 725 of file PciIo.c.

◆ PciIoConfigWrite()

EFI_STATUS EFIAPI PciIoConfigWrite ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT32  Offset,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Enable a PCI driver to access PCI controller registers in PCI configuration space.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory operations.
OffsetThe offset within the PCI configuration space for the PCI controller.
CountThe number of PCI configuration operations to perform.
BufferFor read operations, the destination buffer to store the results. For write operations, the source buffer to write data from.
Return values
EFI_SUCCESSThe data was read from or written to the PCI controller.
EFI_UNSUPPORTEDThe address range specified by Offset, Width, and Count is not valid for the PCI configuration header of the PCI controller.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETERBuffer is NULL or Width is invalid.

Definition at line 794 of file PciIo.c.

◆ PciIoCopyMem()

EFI_STATUS EFIAPI PciIoCopyMem ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT8  DestBarIndex,
IN UINT64  DestOffset,
IN UINT8  SrcBarIndex,
IN UINT64  SrcOffset,
IN UINTN  Count 
)

Enables a PCI driver to copy one region of PCI memory space to another region of PCI memory space.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory operations.
DestBarIndexThe BAR index in the standard PCI Configuration header to use as the base address for the memory operation to perform.
DestOffsetThe destination offset within the BAR specified by DestBarIndex to start the memory writes for the copy operation.
SrcBarIndexThe BAR index in the standard PCI Configuration header to use as the base address for the memory operation to perform.
SrcOffsetThe source offset within the BAR specified by SrcBarIndex to start the memory reads for the copy operation.
CountThe number of memory operations to perform. Bytes moved is Width size * Count, starting at DestOffset and SrcOffset.
Return values
EFI_SUCCESSThe data was copied from one memory region to another memory region.
EFI_UNSUPPORTEDDestBarIndex not valid for this PCI controller.
EFI_UNSUPPORTEDSrcBarIndex not valid for this PCI controller.
EFI_UNSUPPORTEDThe address range specified by DestOffset, Width, and Count is not valid for the PCI BAR specified by DestBarIndex.
EFI_UNSUPPORTEDThe address range specified by SrcOffset, Width, and Count is not valid for the PCI BAR specified by SrcBarIndex.
EFI_INVALID_PARAMETERWidth is invalid.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 873 of file PciIo.c.

◆ PciIoFlush()

EFI_STATUS EFIAPI PciIoFlush ( IN EFI_PCI_IO_PROTOCOL This)

Flushes all PCI posted write transactions from a PCI host bridge to system memory.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
Return values
EFI_SUCCESSThe PCI posted write transactions were flushed from the PCI host bridge to system memory.
EFI_DEVICE_ERRORThe PCI posted write transactions were not flushed from the PCI host bridge due to a hardware error.

Definition at line 1207 of file PciIo.c.

◆ PciIoFreeBuffer()

EFI_STATUS EFIAPI PciIoFreeBuffer ( IN EFI_PCI_IO_PROTOCOL This,
IN UINTN  Pages,
IN VOID *  HostAddress 
)

Frees memory that was allocated with AllocateBuffer().

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
PagesThe number of pages to free.
HostAddressThe base system memory address of the allocated range.
Return values
EFI_SUCCESSThe requested memory pages were freed.
EFI_INVALID_PARAMETERThe memory range specified by HostAddress and Pages was not allocated with AllocateBuffer().

Definition at line 1166 of file PciIo.c.

◆ PciIoGetBarAttributes()

EFI_STATUS EFIAPI PciIoGetBarAttributes ( IN EFI_PCI_IO_PROTOCOL This,
IN UINT8  BarIndex,
OUT UINT64 *Supports  OPTIONAL,
OUT VOID **Resources  OPTIONAL 
)

Gets the attributes that this PCI controller supports setting on a BAR using SetBarAttributes(), and retrieves the list of resource descriptors for a BAR.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for resource range. The legal range for this field is 0..5.
SupportsA pointer to the mask of attributes that this PCI controller supports setting for this BAR with SetBarAttributes().
ResourcesA pointer to the resource descriptors that describe the current configuration of this BAR of the PCI controller.
Return values
EFI_SUCCESSIf Supports is not NULL, then the attributes that the PCI controller supports are returned in Supports. If Resources is not NULL, then the resource descriptors that the PCI controller is currently using are returned in Resources.
EFI_INVALID_PARAMETERBoth Supports and Attributes are NULL.
EFI_UNSUPPORTEDBarIndex not valid for this PCI controller.
EFI_OUT_OF_RESOURCESThere are not enough resources available to allocate Resources.

Definition at line 1862 of file PciIo.c.

◆ PciIoGetLocation()

EFI_STATUS EFIAPI PciIoGetLocation ( IN EFI_PCI_IO_PROTOCOL This,
OUT UINTN Segment,
OUT UINTN Bus,
OUT UINTN Device,
OUT UINTN Function 
)

Retrieves this PCI controller's current PCI bus number, device number, and function number.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
SegmentNumberThe PCI controller's current PCI segment number.
BusNumberThe PCI controller's current PCI bus number.
DeviceNumberThe PCI controller's current PCI device number.
FunctionNumberThe PCI controller's current PCI function number.
Return values
EFI_SUCCESSThe PCI controller location was returned.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 1245 of file PciIo.c.

◆ PciIoIoRead()

EFI_STATUS EFIAPI PciIoIoRead ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT8  BarIndex,
IN UINT64  Offset,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory or I/O operations.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for the memory or I/O operation to perform.
OffsetThe offset within the selected BAR to start the memory or I/O operation.
CountThe number of memory or I/O operations to perform.
BufferFor read operations, the destination buffer to store the results. For write operations, the source buffer to write data from.
Return values
EFI_SUCCESSThe data was read from or written to the PCI controller.
EFI_UNSUPPORTEDBarIndex not valid for this PCI controller.
EFI_UNSUPPORTEDThe address range specified by Offset, Width, and Count is not valid for the PCI BAR specified by BarIndex.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 571 of file PciIo.c.

◆ PciIoIoWrite()

EFI_STATUS EFIAPI PciIoIoWrite ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT8  BarIndex,
IN UINT64  Offset,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory or I/O operations.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for the memory or I/O operation to perform.
OffsetThe offset within the selected BAR to start the memory or I/O operation.
CountThe number of memory or I/O operations to perform.
BufferFor read operations, the destination buffer to store the results. For write operations, the source buffer to write data from.
Return values
EFI_SUCCESSThe data was read from or written to the PCI controller.
EFI_UNSUPPORTEDBarIndex not valid for this PCI controller.
EFI_UNSUPPORTEDThe address range specified by Offset, Width, and Count is not valid for the PCI BAR specified by BarIndex.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 649 of file PciIo.c.

◆ PciIoMap()

EFI_STATUS EFIAPI PciIoMap ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_OPERATION  Operation,
IN VOID *  HostAddress,
IN OUT UINTN NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS DeviceAddress,
OUT VOID **  Mapping 
)

Provides the PCI controller-specific addresses needed to access system memory.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
OperationIndicates if the bus master is going to read or write to system memory.
HostAddressThe system memory address to map to the PCI controller.
NumberOfBytesOn input the number of bytes to map. On output the number of bytes that were mapped.
DeviceAddressThe resulting map address for the bus master PCI controller to use to access the hosts HostAddress.
MappingA resulting value to pass to Unmap().
Return values
EFI_SUCCESSThe range was mapped for the returned NumberOfBytes.
EFI_UNSUPPORTEDThe HostAddress cannot be mapped as a common buffer.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_DEVICE_ERRORThe system hardware could not map the requested address.

Definition at line 964 of file PciIo.c.

◆ PciIoMemRead()

EFI_STATUS EFIAPI PciIoMemRead ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT8  BarIndex,
IN UINT64  Offset,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory or I/O operations.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for the memory or I/O operation to perform.
OffsetThe offset within the selected BAR to start the memory or I/O operation.
CountThe number of memory or I/O operations to perform.
BufferFor read operations, the destination buffer to store the results. For write operations, the source buffer to write data from.
Return values
EFI_SUCCESSThe data was read from or written to the PCI controller.
EFI_UNSUPPORTEDBarIndex not valid for this PCI controller.
EFI_UNSUPPORTEDThe address range specified by Offset, Width, and Count is not valid for the PCI BAR specified by BarIndex.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 415 of file PciIo.c.

◆ PciIoMemWrite()

EFI_STATUS EFIAPI PciIoMemWrite ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT8  BarIndex,
IN UINT64  Offset,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Enable a PCI driver to access PCI controller registers in the PCI memory or I/O space.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory or I/O operations.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for the memory or I/O operation to perform.
OffsetThe offset within the selected BAR to start the memory or I/O operation.
CountThe number of memory or I/O operations to perform.
BufferFor read operations, the destination buffer to store the results. For write operations, the source buffer to write data from.
Return values
EFI_SUCCESSThe data was read from or written to the PCI controller.
EFI_UNSUPPORTEDBarIndex not valid for this PCI controller.
EFI_UNSUPPORTEDThe address range specified by Offset, Width, and Count is not valid for the PCI BAR specified by BarIndex.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 493 of file PciIo.c.

◆ PciIoPollIo()

EFI_STATUS EFIAPI PciIoPollIo ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT8  BarIndex,
IN UINT64  Offset,
IN UINT64  Mask,
IN UINT64  Value,
IN UINT64  Delay,
OUT UINT64 *  Result 
)

Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is satisfied or after a defined duration.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory or I/O operations.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for the memory operation to perform.
OffsetThe offset within the selected BAR to start the memory operation.
MaskMask used for the polling criteria.
ValueThe comparison value used for the polling exit criteria.
DelayThe number of 100 ns units to poll.
ResultPointer to the last value read from the memory location.
Return values
EFI_SUCCESSThe last data returned from the access matched the poll exit criteria.
EFI_UNSUPPORTEDBarIndex not valid for this PCI controller.
EFI_UNSUPPORTEDOffset is not valid for the BarIndex of this PCI controller.
EFI_TIMEOUTDelay expired before a match occurred.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 309 of file PciIo.c.

◆ PciIoPollMem()

EFI_STATUS EFIAPI PciIoPollMem ( IN EFI_PCI_IO_PROTOCOL This,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINT8  BarIndex,
IN UINT64  Offset,
IN UINT64  Mask,
IN UINT64  Value,
IN UINT64  Delay,
OUT UINT64 *  Result 
)

Reads from the memory space of a PCI controller. Returns either when the polling exit criteria is satisfied or after a defined duration.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
WidthSignifies the width of the memory or I/O operations.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for the memory operation to perform.
OffsetThe offset within the selected BAR to start the memory operation.
MaskMask used for the polling criteria.
ValueThe comparison value used for the polling exit criteria.
DelayThe number of 100 ns units to poll.
ResultPointer to the last value read from the memory location.
Return values
EFI_SUCCESSThe last data returned from the access matched the poll exit criteria.
EFI_UNSUPPORTEDBarIndex not valid for this PCI controller.
EFI_UNSUPPORTEDOffset is not valid for the BarIndex of this PCI controller.
EFI_TIMEOUTDelay expired before a match occurred.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETEROne or more parameters are invalid.

Definition at line 197 of file PciIo.c.

◆ PciIoSetBarAttributes()

EFI_STATUS EFIAPI PciIoSetBarAttributes ( IN EFI_PCI_IO_PROTOCOL This,
IN UINT64  Attributes,
IN UINT8  BarIndex,
IN OUT UINT64 *  Offset,
IN OUT UINT64 *  Length 
)

Sets the attributes for a range of a BAR on a PCI controller.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
AttributesThe mask of attributes to set for the resource range specified by BarIndex, Offset, and Length.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for resource range. The legal range for this field is 0..5.
OffsetA pointer to the BAR relative base address of the resource range to be modified by the attributes specified by Attributes.
LengthA pointer to the length of the resource range to be modified by the attributes specified by Attributes.
Return values
EFI_SUCCESSThe set of attributes specified by Attributes for the resource range specified by BarIndex, Offset, and Length were set on the PCI controller, and the actual resource range is returned in Offset and Length.
EFI_INVALID_PARAMETEROffset or Length is NULL.
EFI_UNSUPPORTEDBarIndex not valid for this PCI controller.
EFI_OUT_OF_RESOURCESThere are not enough resources to set the attributes on the resource range specified by BarIndex, Offset, and Length.

Definition at line 2012 of file PciIo.c.

◆ PciIoUnmap()

EFI_STATUS EFIAPI PciIoUnmap ( IN EFI_PCI_IO_PROTOCOL This,
IN VOID *  Mapping 
)

Completes the Map() operation and releases any corresponding resources.

Parameters
ThisA pointer to the EFI_PCI_IO_PROTOCOL instance.
MappingThe mapping value returned from Map().
Return values
EFI_SUCCESSThe range was unmapped.
EFI_DEVICE_ERRORThe data was not committed to the target system memory.

Definition at line 1051 of file PciIo.c.

◆ PciIoVerifyBarAccess()

EFI_STATUS PciIoVerifyBarAccess ( IN PCI_IO_DEVICE PciIoDevice,
IN UINT8  BarIndex,
IN PCI_BAR_TYPE  Type,
IN IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN IN UINTN  Count,
IN UINT64 *  Offset 
)

Verifies access to a PCI Base Address Register (BAR).

Parameters
PciIoDevicePci device instance.
BarIndexThe BAR index of the standard PCI Configuration header to use as the base address for the memory or I/O operation to perform.
TypeOperation type could be memory or I/O.
WidthSignifies the width of the memory or I/O operations.
CountThe number of memory or I/O operations to perform.
OffsetThe offset within the PCI configuration space for the PCI controller.
Return values
EFI_INVALID_PARAMETERInvalid Width/BarIndex or Bar type.
EFI_SUCCESSSuccessfully verified.

Definition at line 75 of file PciIo.c.

◆ PciIoVerifyConfigAccess()

EFI_STATUS PciIoVerifyConfigAccess ( IN PCI_IO_DEVICE PciIoDevice,
IN EFI_PCI_IO_PROTOCOL_WIDTH  Width,
IN UINTN  Count,
IN UINT64 *  Offset 
)

Verifies access to a PCI Configuration Header.

Parameters
PciIoDevicePci device instance.
WidthSignifies the width of the memory or I/O operations.
CountThe number of memory or I/O operations to perform.
OffsetThe offset within the PCI configuration space for the PCI controller.
Return values
EFI_INVALID_PARAMETERInvalid Width
EFI_UNSUPPORTEDOffset overflowed.
EFI_SUCCESSSuccessfully verified.

Definition at line 136 of file PciIo.c.

◆ SupportPaletteSnoopAttributes()

EFI_STATUS SupportPaletteSnoopAttributes ( IN PCI_IO_DEVICE PciIoDevice,
IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION  Operation 
)

Check whether this device can be enable/disable to snoop.

Parameters
PciIoDevicePci device instance.
OperationEnable/Disable.
Return values
EFI_UNSUPPORTEDPci device is not GFX device or not support snoop.
EFI_SUCCESSSnoop can be supported.

Definition at line 1405 of file PciIo.c.

Variable Documentation

◆ mIoMmuProtocol

EDKII_IOMMU_PROTOCOL* mIoMmuProtocol
extern

Definition at line 39 of file PciBus.c.

◆ mPciIoInterface

EFI_PCI_IO_PROTOCOL mPciIoInterface
Initial value:
= {
{
},
{
},
{
},
0,
}
#define NULL
Definition: Base.h:319
EFI_STATUS EFIAPI PciIoGetLocation(IN EFI_PCI_IO_PROTOCOL *This, OUT UINTN *Segment, OUT UINTN *Bus, OUT UINTN *Device, OUT UINTN *Function)
Definition: PciIo.c:1245
EFI_STATUS EFIAPI PciIoMemRead(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
Definition: PciIo.c:415
EFI_STATUS EFIAPI PciIoAttributes(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation, IN UINT64 Attributes, OUT UINT64 *Result OPTIONAL)
Definition: PciIo.c:1525
EFI_STATUS EFIAPI PciIoSetBarAttributes(IN EFI_PCI_IO_PROTOCOL *This, IN UINT64 Attributes, IN UINT8 BarIndex, IN OUT UINT64 *Offset, IN OUT UINT64 *Length)
Definition: PciIo.c:2012
EFI_STATUS EFIAPI PciIoConfigRead(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer)
Definition: PciIo.c:725
EFI_STATUS EFIAPI PciIoMemWrite(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
Definition: PciIo.c:493
EFI_STATUS EFIAPI PciIoPollMem(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINT64 Mask, IN UINT64 Value, IN UINT64 Delay, OUT UINT64 *Result)
Definition: PciIo.c:197
EFI_STATUS EFIAPI PciIoMap(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
Definition: PciIo.c:964
EFI_STATUS EFIAPI PciIoIoWrite(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
Definition: PciIo.c:649
EFI_STATUS EFIAPI PciIoConfigWrite(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer)
Definition: PciIo.c:794
EFI_STATUS EFIAPI PciIoFlush(IN EFI_PCI_IO_PROTOCOL *This)
Definition: PciIo.c:1207
EFI_STATUS EFIAPI PciIoGetBarAttributes(IN EFI_PCI_IO_PROTOCOL *This, IN UINT8 BarIndex, OUT UINT64 *Supports OPTIONAL, OUT VOID **Resources OPTIONAL)
Definition: PciIo.c:1862
EFI_STATUS EFIAPI PciIoCopyMem(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 DestBarIndex, IN UINT64 DestOffset, IN UINT8 SrcBarIndex, IN UINT64 SrcOffset, IN UINTN Count)
Definition: PciIo.c:873
EFI_STATUS EFIAPI PciIoPollIo(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINT64 Mask, IN UINT64 Value, IN UINT64 Delay, OUT UINT64 *Result)
Definition: PciIo.c:309
EFI_STATUS EFIAPI PciIoUnmap(IN EFI_PCI_IO_PROTOCOL *This, IN VOID *Mapping)
Definition: PciIo.c:1051
EFI_STATUS EFIAPI PciIoAllocateBuffer(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT VOID **HostAddress, IN UINT64 Attributes)
Definition: PciIo.c:1108
EFI_STATUS EFIAPI PciIoIoRead(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT8 BarIndex, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
Definition: PciIo.c:571
EFI_STATUS EFIAPI PciIoFreeBuffer(IN EFI_PCI_IO_PROTOCOL *This, IN UINTN Pages, IN VOID *HostAddress)
Definition: PciIo.c:1166

Definition at line 16 of file PciIo.c.