TianoCore EDK2 master
Loading...
Searching...
No Matches
PciRootBridgeIo.c File Reference
#include "PciHostBridge.h"
#include "PciRootBridge.h"
#include "PciHostResource.h"

Go to the source code of this file.

Macros

#define NO_MAPPING   (VOID *) (UINTN) -1
 
#define RESOURCE_VALID(Resource)   ((Resource)->Base <= (Resource)->Limit)
 

Functions

PCI_ROOT_BRIDGE_INSTANCECreateRootBridge (IN PCI_ROOT_BRIDGE *Bridge)
 
EFI_STATUS RootBridgeIoCheckParameter (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN OPERATION_TYPE OperationType, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
 
EFI_STATUS RootBridgeIoGetMemTranslationByAddress (IN PCI_ROOT_BRIDGE_INSTANCE *RootBridge, IN UINT64 Address, IN OUT UINT64 *Translation)
 
UINT64 MultThenDivU64x64x32 (IN UINT64 Multiplicand, IN UINT64 Multiplier, IN UINT32 Divisor, OUT UINT32 *Remainder OPTIONAL)
 
UINT64 GetElapsedTick (UINT64 *CurrentTick, UINT64 StartTick, UINT64 EndTick)
 
EFI_STATUS EFIAPI RootBridgeIoPollMem (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINT64 Mask, IN UINT64 Value, IN UINT64 Delay, OUT UINT64 *Result)
 
EFI_STATUS EFIAPI RootBridgeIoPollIo (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINT64 Mask, IN UINT64 Value, IN UINT64 Delay, OUT UINT64 *Result)
 
EFI_STATUS EFIAPI RootBridgeIoMemRead (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI RootBridgeIoMemWrite (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
 
EFI_STATUS EFIAPI RootBridgeIoIoRead (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI RootBridgeIoIoWrite (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
 
EFI_STATUS EFIAPI RootBridgeIoCopyMem (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 DestAddress, IN UINT64 SrcAddress, IN UINTN Count)
 
EFI_STATUS EFIAPI RootBridgeIoPciAccess (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN BOOLEAN Read, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI RootBridgeIoPciRead (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI RootBridgeIoPciWrite (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI RootBridgeIoMap (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
 
EFI_STATUS EFIAPI RootBridgeIoUnmap (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN VOID *Mapping)
 
EFI_STATUS EFIAPI RootBridgeIoAllocateBuffer (IN EFI_PCI_ROOT_BRIDGE_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 RootBridgeIoFreeBuffer (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN UINTN Pages, OUT VOID *HostAddress)
 
EFI_STATUS EFIAPI RootBridgeIoFlush (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This)
 
EFI_STATUS EFIAPI RootBridgeIoGetAttributes (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, OUT UINT64 *Supported, OUT UINT64 *Attributes)
 
EFI_STATUS EFIAPI RootBridgeIoSetAttributes (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN UINT64 Attributes, IN OUT UINT64 *ResourceBase, IN OUT UINT64 *ResourceLength)
 
EFI_STATUS EFIAPI RootBridgeIoConfiguration (IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, OUT VOID **Resources)
 

Variables

UINT8 mInStride []
 
UINT8 mOutStride []
 

Detailed Description

PCI Root Bridge Io Protocol code.

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

Definition in file PciRootBridgeIo.c.

Macro Definition Documentation

◆ NO_MAPPING

#define NO_MAPPING   (VOID *) (UINTN) -1

Definition at line 14 of file PciRootBridgeIo.c.

◆ RESOURCE_VALID

#define RESOURCE_VALID (   Resource)    ((Resource)->Base <= (Resource)->Limit)

Definition at line 16 of file PciRootBridgeIo.c.

Function Documentation

◆ CreateRootBridge()

PCI_ROOT_BRIDGE_INSTANCE * CreateRootBridge ( IN PCI_ROOT_BRIDGE Bridge)

Construct the Pci Root Bridge instance.

Parameters
BridgeThe root bridge instance.
Returns
The pointer to PCI_ROOT_BRIDGE_INSTANCE just created or NULL if creation fails.

Definition at line 63 of file PciRootBridgeIo.c.

◆ GetElapsedTick()

UINT64 GetElapsedTick ( UINT64 *  CurrentTick,
UINT64  StartTick,
UINT64  EndTick 
)

Return the elapsed tick count from CurrentTick.

Parameters
CurrentTickOn input, the previous tick count. On output, the current tick count.
StartTickThe value the performance counter starts with when it rolls over.
EndTickThe value that the performance counter ends with before it rolls over.
Returns
The elapsed tick count from CurrentTick.

Definition at line 583 of file PciRootBridgeIo.c.

◆ MultThenDivU64x64x32()

UINT64 MultThenDivU64x64x32 ( IN UINT64  Multiplicand,
IN UINT64  Multiplier,
IN UINT32  Divisor,
OUT UINT32 *Remainder  OPTIONAL 
)

Return the result of (Multiplicand * Multiplier / Divisor).

Parameters
MultiplicandA 64-bit unsigned value.
MultiplierA 64-bit unsigned value.
DivisorA 32-bit unsigned value.
RemainderA pointer to a 32-bit unsigned value. This parameter is optional and may be NULL.
Returns
Multiplicand * Multiplier / Divisor.

Definition at line 530 of file PciRootBridgeIo.c.

◆ RootBridgeIoAllocateBuffer()

EFI_STATUS EFIAPI RootBridgeIoAllocateBuffer ( IN EFI_PCI_ROOT_BRIDGE_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 EfiPciOperationBusMasterCommonBuffer or EfiPciOperationBusMasterCommonBuffer64 mapping.

Parameters
ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
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. Only the attributes EFI_PCI_ATTRIBUTE_MEMORY_WRITE_COMBINE, EFI_PCI_ATTRIBUTE_MEMORY_CACHED, and EFI_PCI_ATTRIBUTE_DUAL_ADDRESS_CYCLE may be used with this function.
Return values
EFI_SUCCESSThe requested memory pages were allocated.
EFI_INVALID_PARAMETERMemoryType is invalid.
EFI_INVALID_PARAMETERHostAddress is NULL.
EFI_UNSUPPORTEDAttributes is unsupported. The only legal attribute bits are MEMORY_WRITE_COMBINE, MEMORY_CACHED, and DUAL_ADDRESS_CYCLE.
EFI_OUT_OF_RESOURCESThe memory pages could not be allocated.

Definition at line 1598 of file PciRootBridgeIo.c.

◆ RootBridgeIoCheckParameter()

EFI_STATUS RootBridgeIoCheckParameter ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN OPERATION_TYPE  OperationType,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN VOID *  Buffer 
)

Check parameters for IO,MMIO,PCI read/write services of PCI Root Bridge IO.

The I/O operations are carried out exactly as requested. The caller is responsible for satisfying any alignment and I/O width restrictions that a PI System on a platform might require. For example on some platforms, width requests of EfiCpuIoWidthUint64 do not work. Misaligned buffers, on the other hand, will be handled by the driver.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[in]OperationTypeI/O operation type: IO/MMIO/PCI.
[in]WidthSignifies the width of the I/O or Memory operation.
[in]AddressThe base address of the I/O operation.
[in]CountThe number of I/O operations to perform. The number of bytes moved is Width size * Count, starting at Address.
[in]BufferFor read operations, the destination buffer to store the results. For write operations, the source buffer from which to write data.
Return values
EFI_SUCCESSThe parameters for this request pass the checks.
EFI_INVALID_PARAMETERWidth is invalid for this PI system.
EFI_INVALID_PARAMETERBuffer is NULL.
EFI_INVALID_PARAMETERAddress or Count is invalid.
EFI_UNSUPPORTEDThe Buffer is not aligned for the given Width.
EFI_UNSUPPORTEDThe address range specified by Address, Width, and Count is not valid for this PI system.

Definition at line 329 of file PciRootBridgeIo.c.

◆ RootBridgeIoConfiguration()

EFI_STATUS EFIAPI RootBridgeIoConfiguration ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
OUT VOID **  Resources 
)

Retrieves the current resource settings of this PCI root bridge in the form of a set of ACPI resource descriptors.

There are only two resource descriptor types from the ACPI Specification that may be used to describe the current resources allocated to a PCI root bridge. These are the QWORD Address Space Descriptor, and the End Tag. The QWORD Address Space Descriptor can describe memory, I/O, and bus number ranges for dynamic or fixed resources. The configuration of a PCI root bridge is described with one or more QWORD Address Space Descriptors followed by an End Tag.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[out]ResourcesA pointer to the resource descriptors that describe the current configuration of this PCI root bridge. The storage for the resource descriptors is allocated by this function. The caller must treat the return buffer as read-only data, and the buffer must not be freed by the caller.
Return values
EFI_SUCCESSThe current configuration of this PCI root bridge was returned in Resources.
EFI_UNSUPPORTEDThe current configuration of this PCI root bridge could not be retrieved.

Definition at line 1882 of file PciRootBridgeIo.c.

◆ RootBridgeIoCopyMem()

EFI_STATUS EFIAPI RootBridgeIoCopyMem ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  DestAddress,
IN UINT64  SrcAddress,
IN UINTN  Count 
)

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

The CopyMem() function enables a PCI driver to copy one region of PCI root bridge memory space to another region of PCI root bridge memory space. This is especially useful for video scroll operation on a memory mapped video buffer. The memory operations are carried out exactly as requested. The caller is responsible for satisfying any alignment and memory width restrictions that a PCI root bridge on a platform might require.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL instance.
[in]WidthSignifies the width of the memory operations.
[in]DestAddressThe destination address of the memory operation. The caller is responsible for aligning the DestAddress if required.
[in]SrcAddressThe source address of the memory operation. The caller is responsible for aligning the SrcAddress if required.
[in]CountThe number of memory operations to perform. Bytes moved is Width size * Count, starting at DestAddress and SrcAddress.
Return values
EFI_SUCCESSThe data was copied from one memory region to another memory region.
EFI_INVALID_PARAMETERWidth is invalid for this PCI root bridge.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 1102 of file PciRootBridgeIo.c.

◆ RootBridgeIoFlush()

EFI_STATUS EFIAPI RootBridgeIoFlush ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This)

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

The Flush() function flushes any PCI posted write transactions from a PCI host bridge to system memory. Posted write transactions are generated by PCI bus masters when they perform write transactions to target addresses in system memory. This function does not flush posted write transactions from any PCI bridges. A PCI controller specific action must be taken to guarantee that the posted write transactions have been flushed from the PCI controller and from all the PCI bridges into the PCI host bridge. This is typically done with a PCI read transaction from the PCI controller prior to calling Flush().

Parameters
ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
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 1740 of file PciRootBridgeIo.c.

◆ RootBridgeIoFreeBuffer()

EFI_STATUS EFIAPI RootBridgeIoFreeBuffer ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN UINTN  Pages,
OUT VOID *  HostAddress 
)

Frees memory that was allocated with AllocateBuffer().

The FreeBuffer() function frees memory that was allocated with AllocateBuffer().

Parameters
ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
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 1697 of file PciRootBridgeIo.c.

◆ RootBridgeIoGetAttributes()

EFI_STATUS EFIAPI RootBridgeIoGetAttributes ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
OUT UINT64 *  Supported,
OUT UINT64 *  Attributes 
)

Gets the attributes that a PCI root bridge supports setting with SetAttributes(), and the attributes that a PCI root bridge is currently using.

The GetAttributes() function returns the mask of attributes that this PCI root bridge supports and the mask of attributes that the PCI root bridge is currently using.

Parameters
ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
SupportedA pointer to the mask of attributes that this PCI root bridge supports setting with SetAttributes().
AttributesA pointer to the mask of attributes that this PCI root bridge is currently using.
Return values
EFI_SUCCESSIf Supports is not NULL, then the attributes that the PCI root bridge supports is returned in Supports. If Attributes is not NULL, then the attributes that the PCI root bridge is currently using is returned in Attributes.
EFI_INVALID_PARAMETERBoth Supports and Attributes are NULL.

Definition at line 1771 of file PciRootBridgeIo.c.

◆ RootBridgeIoGetMemTranslationByAddress()

EFI_STATUS RootBridgeIoGetMemTranslationByAddress ( IN PCI_ROOT_BRIDGE_INSTANCE RootBridge,
IN UINT64  Address,
IN OUT UINT64 *  Translation 
)

Use address to match apertures of memory type and then get the corresponding translation.

Parameters
RootBridgeThe root bridge instance.
AddressThe address used to match aperture.
TranslationPointer containing the output translation.
Returns
EFI_SUCCESS Get translation successfully.
EFI_INVALID_PARAMETER No matched memory aperture; the input Address must be invalid.

Definition at line 497 of file PciRootBridgeIo.c.

◆ RootBridgeIoIoRead()

EFI_STATUS EFIAPI RootBridgeIoIoRead ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
OUT VOID *  Buffer 
)

Enables a PCI driver to access PCI controller registers in the PCI root bridge I/O space.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[in]WidthSignifies the width of the memory operations.
[in]AddressThe base address of the I/O operation. The caller is responsible for aligning the Address if required.
[in]CountThe number of I/O operations to perform. Bytes moved is Width size * Count, starting at Address.
[out]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 root bridge.
EFI_INVALID_PARAMETERWidth is invalid for this PCI root bridge.
EFI_INVALID_PARAMETERBuffer is NULL.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 974 of file PciRootBridgeIo.c.

◆ RootBridgeIoIoWrite()

EFI_STATUS EFIAPI RootBridgeIoIoWrite ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN VOID *  Buffer 
)

Enables a PCI driver to access PCI controller registers in the PCI root bridge I/O space.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[in]WidthSignifies the width of the memory operations.
[in]AddressThe base address of the I/O operation. The caller is responsible for aligning the Address if required.
[in]CountThe number of I/O operations to perform. Bytes moved is Width size * Count, starting at Address.
[in]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 root bridge.
EFI_INVALID_PARAMETERWidth is invalid for this PCI root bridge.
EFI_INVALID_PARAMETERBuffer is NULL.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 1033 of file PciRootBridgeIo.c.

◆ RootBridgeIoMap()

EFI_STATUS EFIAPI RootBridgeIoMap ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_OPERATION  Operation,
IN VOID *  HostAddress,
IN OUT UINTN NumberOfBytes,
OUT EFI_PHYSICAL_ADDRESS DeviceAddress,
OUT VOID **  Mapping 
)

Provides the PCI controller-specific address needed to access system memory for DMA.

Parameters
ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
OperationIndicate if the bus master is going to read or write to system memory.
HostAddressThe system memory address to map on 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 system memory's HostAddress.
MappingThe value to pass to Unmap() when the bus master DMA operation is complete.
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERInvalid parameters found.
EFI_UNSUPPORTEDThe HostAddress cannot be mapped as a common buffer.
EFI_DEVICE_ERRORThe System hardware could not map the requested address.
EFI_OUT_OF_RESOURCESThe request could not be completed due to lack of resources.

Definition at line 1331 of file PciRootBridgeIo.c.

◆ RootBridgeIoMemRead()

EFI_STATUS EFIAPI RootBridgeIoMemRead ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
OUT VOID *  Buffer 
)

Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.

The Mem.Read(), and Mem.Write() functions enable a driver to access PCI controller registers in the PCI root bridge memory space. The memory operations are carried out exactly as requested. The caller is responsible for satisfying any alignment and memory width restrictions that a PCI Root Bridge on a platform might require.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[in]WidthSignifies the width of the memory operation.
[in]AddressThe base address of the memory operation. The caller is responsible for aligning the Address if required.
[in]CountThe number of memory operations to perform. Bytes moved is Width size * Count, starting at Address.
[out]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 root bridge.
EFI_INVALID_PARAMETERWidth is invalid for this PCI root bridge.
EFI_INVALID_PARAMETERBuffer is NULL.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 840 of file PciRootBridgeIo.c.

◆ RootBridgeIoMemWrite()

EFI_STATUS EFIAPI RootBridgeIoMemWrite ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN VOID *  Buffer 
)

Enables a PCI driver to access PCI controller registers in the PCI root bridge memory space.

The Mem.Read(), and Mem.Write() functions enable a driver to access PCI controller registers in the PCI root bridge memory space. The memory operations are carried out exactly as requested. The caller is responsible for satisfying any alignment and memory width restrictions that a PCI Root Bridge on a platform might require.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[in]WidthSignifies the width of the memory operation.
[in]AddressThe base address of the memory operation. The caller is responsible for aligning the Address if required.
[in]CountThe number of memory operations to perform. Bytes moved is Width size * Count, starting at Address.
[in]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 root bridge.
EFI_INVALID_PARAMETERWidth is invalid for this PCI root bridge.
EFI_INVALID_PARAMETERBuffer is NULL.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 910 of file PciRootBridgeIo.c.

◆ RootBridgeIoPciAccess()

EFI_STATUS EFIAPI RootBridgeIoPciAccess ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN BOOLEAN  Read,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

PCI configuration space access.

Parameters
ThisA pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
ReadTRUE indicating it's a read operation.
WidthSignifies the width of the memory operation.
AddressThe address within the PCI configuration space for the PCI controller.
CountThe number of PCI configuration operations to perform.
BufferThe destination buffer to store the results.
Return values
EFI_SUCCESSThe data was read/written from/to the PCI root bridge.
EFI_INVALID_PARAMETERInvalid parameters found.

Definition at line 1187 of file PciRootBridgeIo.c.

◆ RootBridgeIoPciRead()

EFI_STATUS EFIAPI RootBridgeIoPciRead ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Allows read from PCI configuration space.

Parameters
ThisA pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
WidthSignifies the width of the memory operation.
AddressThe address within the PCI configuration space for the PCI controller.
CountThe number of PCI configuration operations to perform.
BufferThe destination buffer to store the results.
Return values
EFI_SUCCESSThe data was read from the PCI root bridge.
EFI_INVALID_PARAMETERInvalid parameters found.

Definition at line 1270 of file PciRootBridgeIo.c.

◆ RootBridgeIoPciWrite()

EFI_STATUS EFIAPI RootBridgeIoPciWrite ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINTN  Count,
IN OUT VOID *  Buffer 
)

Allows write to PCI configuration space.

Parameters
ThisA pointer to EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
WidthSignifies the width of the memory operation.
AddressThe address within the PCI configuration space for the PCI controller.
CountThe number of PCI configuration operations to perform.
BufferThe source buffer to get the results.
Return values
EFI_SUCCESSThe data was written to the PCI root bridge.
EFI_INVALID_PARAMETERInvalid parameters found.

Definition at line 1297 of file PciRootBridgeIo.c.

◆ RootBridgeIoPollIo()

EFI_STATUS EFIAPI RootBridgeIoPollIo ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINT64  Mask,
IN UINT64  Value,
IN UINT64  Delay,
OUT UINT64 *  Result 
)

Reads from the I/O space of a PCI Root Bridge. Returns when either the polling exit criteria is satisfied or after a defined duration.

This function provides a standard way to poll a PCI I/O location. A PCI I/O read operation is performed at the PCI I/O address specified by Address for the width specified by Width. The result of this PCI I/O read operation is stored in Result. This PCI I/O read operation is repeated until either a timeout of Delay 100 ns units has expired, or (Result & Mask) is equal to Value.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[in]WidthSignifies the width of the I/O operations.
[in]AddressThe base address of the I/O operations. The caller is responsible for aligning Address if required.
[in]MaskMask used for the polling criteria. Bytes above Width in Mask are ignored. The bits in the bytes below Width which are zero in Mask are ignored when polling the I/O address.
[in]ValueThe comparison value used for the polling exit criteria.
[in]DelayThe number of 100 ns units to poll. Note that timer available may be of poorer granularity.
[out]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_INVALID_PARAMETERWidth is invalid.
EFI_INVALID_PARAMETERResult is NULL.
EFI_TIMEOUTDelay expired before a match occurred.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 740 of file PciRootBridgeIo.c.

◆ RootBridgeIoPollMem()

EFI_STATUS EFIAPI RootBridgeIoPollMem ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH  Width,
IN UINT64  Address,
IN UINT64  Mask,
IN UINT64  Value,
IN UINT64  Delay,
OUT UINT64 *  Result 
)

Polls an address in memory mapped I/O space until an exit condition is met, or a timeout occurs.

This function provides a standard way to poll a PCI memory location. A PCI memory read operation is performed at the PCI memory address specified by Address for the width specified by Width. The result of this PCI memory read operation is stored in Result. This PCI memory read operation is repeated until either a timeout of Delay 100 ns units has expired, or (Result & Mask) is equal to Value.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[in]WidthSignifies the width of the memory operations.
[in]AddressThe base address of the memory operations. The caller is responsible for aligning Address if required.
[in]MaskMask used for the polling criteria. Bytes above Width in Mask are ignored. The bits in the bytes below Width which are zero in Mask are ignored when polling the memory address.
[in]ValueThe comparison value used for the polling exit criteria.
[in]DelayThe number of 100 ns units to poll. Note that timer available may be of poorer granularity.
[out]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_INVALID_PARAMETERWidth is invalid.
EFI_INVALID_PARAMETERResult is NULL.
EFI_TIMEOUTDelay expired before a match occurred.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.

Definition at line 636 of file PciRootBridgeIo.c.

◆ RootBridgeIoSetAttributes()

EFI_STATUS EFIAPI RootBridgeIoSetAttributes ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN UINT64  Attributes,
IN OUT UINT64 *  ResourceBase,
IN OUT UINT64 *  ResourceLength 
)

Sets attributes for a resource range on a PCI root bridge.

The SetAttributes() function sets the attributes specified in Attributes for the PCI root bridge on the resource range specified by ResourceBase and ResourceLength. Since the granularity of setting these attributes may vary from resource type to resource type, and from platform to platform, the actual resource range and the one passed in by the caller may differ. As a result, this function may set the attributes specified by Attributes on a larger resource range than the caller requested. The actual range is returned in ResourceBase and ResourceLength. The caller is responsible for verifying that the actual range for which the attributes were set is acceptable.

Parameters
ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
AttributesThe mask of attributes to set. If the attribute bit MEMORY_WRITE_COMBINE, MEMORY_CACHED, or MEMORY_DISABLE is set, then the resource range is specified by ResourceBase and ResourceLength. If MEMORY_WRITE_COMBINE, MEMORY_CACHED, and MEMORY_DISABLE are not set, then ResourceBase and ResourceLength are ignored, and may be NULL.
ResourceBaseA pointer to the base address of the resource range to be modified by the attributes specified by Attributes.
ResourceLengthA pointer to the length of the resource range to be modified by the attributes specified by Attributes.
Return values
EFI_SUCCESSThe current configuration of this PCI root bridge was returned in Resources.
EFI_UNSUPPORTEDThe current configuration of this PCI root bridge could not be retrieved.

Definition at line 1836 of file PciRootBridgeIo.c.

◆ RootBridgeIoUnmap()

EFI_STATUS EFIAPI RootBridgeIoUnmap ( IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL This,
IN VOID *  Mapping 
)

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

The Unmap() function completes the Map() operation and releases any corresponding resources. If the operation was an EfiPciOperationBusMasterWrite or EfiPciOperationBusMasterWrite64, the data is committed to the target system memory. Any resources used for the mapping are freed.

Parameters
[in]ThisA pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
[in]MappingThe mapping value returned from Map().
Return values
EFI_SUCCESSThe range was unmapped.
EFI_INVALID_PARAMETERMapping is not a value that was returned by Map().
EFI_DEVICE_ERRORThe data was not committed to the target system memory.

Definition at line 1497 of file PciRootBridgeIo.c.

Variable Documentation

◆ mInStride

UINT8 mInStride[]
Initial value:
= {
1,
2,
4,
8,
0,
0,
0,
0,
1,
2,
4,
8
}

Definition at line 21 of file PciRootBridgeIo.c.

◆ mOutStride

UINT8 mOutStride[]
Initial value:
= {
1,
2,
4,
8,
1,
2,
4,
8,
0,
0,
0,
0
}

Definition at line 39 of file PciRootBridgeIo.c.