TianoCore EDK2 master
|
Go to the source code of this file.
Macros | |
#define | IS_RANGE_INVALID(Start, Size, MaxValue) (Start >= MaxValue || Size == 0) |
Hardware info library with types and accessors to parse information about PCI host bridges.
Copyright 2021 - 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file HardwareInfoPciHostBridgeLib.c.
#define IS_RANGE_INVALID | ( | Start, | |
Size, | |||
MaxValue | |||
) | (Start >= MaxValue || Size == 0) |
Definition at line 14 of file HardwareInfoPciHostBridgeLib.c.
STATIC EFI_STATUS FillHostBridgeAperture | ( | IN UINT64 | Start, |
IN UINT64 | Size, | ||
IN UINT64 | MaxValue, | ||
OUT PCI_ROOT_BRIDGE_APERTURE * | Aperture | ||
) |
Fill a PCI ROOT BRIDGE APERTURE with the proper values calculated from the provided start and size.
[in] | Start | Start address of the aperture |
[in] | Size | Size, in bytes, of the aperture |
[in] | MaxValue | Max value a valid address could take and which represents an invalid start address. |
[out] | Aperture | Pointer to the aperture to be filled |
EFI_SUCCESS | Aperture was filled successfully |
EFI_INVALID_PARAMETER | Range depicted by Start and Size is valid but ignored because aperture pointer is NULL |
EFI_WARN_BUFFER_TOO_SMALL | Aperture pointer is invalid but the range also is so no harm. |
Definition at line 157 of file HardwareInfoPciHostBridgeLib.c.
Calculate the last (inclusive) address of a range.
[in] | Start | First address of the range |
[in] | Size | Size of the range |
Definition at line 25 of file HardwareInfoPciHostBridgeLib.c.
EFI_STATUS HardwareInfoPciHostBridgeGet | ( | IN CONST HOST_BRIDGE_INFO * | HostBridge, |
IN UINTN | DataSize, | ||
OUT UINTN * | BusNrStart, | ||
OUT UINTN * | BusNrLast, | ||
OUT UINT64 *Attributes | OPTIONAL, | ||
OUT BOOLEAN *DmaAbove4G | OPTIONAL, | ||
OUT BOOLEAN *NoExtendedConfigSpace | OPTIONAL, | ||
OUT BOOLEAN *CombineMemPMem | OPTIONAL, | ||
OUT PCI_ROOT_BRIDGE_APERTURE *Io | OPTIONAL, | ||
OUT PCI_ROOT_BRIDGE_APERTURE *Mem | OPTIONAL, | ||
OUT PCI_ROOT_BRIDGE_APERTURE *MemAbove4G | OPTIONAL, | ||
OUT PCI_ROOT_BRIDGE_APERTURE *PMem | OPTIONAL, | ||
OUT PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G | OPTIONAL, | ||
OUT PCI_ROOT_BRIDGE_APERTURE *PcieConfig | OPTIONAL | ||
) |
Getter that parses information from a HOST_BRIDGE_INFO object into smaller chunks of types handled by the PciHostBridgeLib.
[in] | HostBridge | Host bridge information object |
[in] | DataSize | Size in bytes of the actually filled data available in the HostBridge object |
[out] | BusNrStart | Pointer to the Bus Number range start |
[out] | BusNrLast | Pointer to the Bus Number range end |
[out] | Attributes | Pointer to the host bridge's attributes |
[out] | DmaAbove4G | Pointer to the DMA Above 4G flag |
[out] | NoExtendedConfigSpace | Pointer to the Extended Config Space flag |
[out] | CombineMemPMem | Pointer to the Combine Mem and PMem flag |
[out] | Io | Pointer to the PIO aperture object |
[out] | Mem | Pointer to the 32-bit MMIO aperture object |
[out] | MemAbove4G | Pointer to the 64-bit MMIO aperture object |
[out] | PMem | Pointer to the 32-bit prefetchable MMIO aperture object |
[out] | PMemAbove4G | Pointer to the 64-bit prefetchable MMIO aperture object |
[out] | PcieConfig | MMIO mapped PCIe config aperture (ECAM) |
EFI_SUCCESS | Whole operation succeeded |
EFI_INVALID_PARAMETER | HostBridge object and/or non-optional output parameters are invalid |
EFI_INCOMPATIBLE_VERSION | HostBridge information provided belongs to and unsupported version |
EFI_WARN_STALE_DATA | One or more apertures having valid ranges in the HostBridge info were ignored because the correspnding aperture pointer is NULL |
Definition at line 453 of file HardwareInfoPciHostBridgeLib.c.
EFI_STATUS HardwareInfoPciHostBridgeGetApertures | ( | IN CONST HOST_BRIDGE_INFO * | HostBridge, |
IN UINTN | DataSize, | ||
OUT PCI_ROOT_BRIDGE_APERTURE * | Io, | ||
OUT PCI_ROOT_BRIDGE_APERTURE * | Mem, | ||
OUT PCI_ROOT_BRIDGE_APERTURE * | MemAbove4G, | ||
OUT PCI_ROOT_BRIDGE_APERTURE * | PMem, | ||
OUT PCI_ROOT_BRIDGE_APERTURE * | PMemAbove4G, | ||
OUT PCI_ROOT_BRIDGE_APERTURE * | PcieConfig | ||
) |
Interpret the MMIO resources in HostBridge and set the apertures in 32-bit space (Mem), 64-bit space (MemAbove4G), PIO (IO) and ECAM (PcieConfig) accordingly.
The 2 types of apertures in each MMIO space (prefetchable and non-prefetchable) may be merged into a single window, hence if both types of apertures are defined while the CombineMemPMem flag is set, the ranges must be contiguous.
[in] | HostBridge | Root bridge's resources specification |
[in] | DataSize | Size in bytes of the actually filled data available in the HostBridge object |
[out] | Mem | Pointer to 32-bit MMIO aperture |
[out] | MemAbove4G | Pointer to 64-bit MMIO aperture |
[out] | PMem | Pointer to the 32-bit prefetchable MMIO aperture |
[out] | PMemAbove4G | Pointer to the 64-bit prefetchable MMIO aperture |
[out] | PcieConfig | Pointer to MMIO mapped PCIe config aperture (ECAM) |
EFI_INVALID_PARAMETER | HostBridge object is invalid |
EFI_INCOMPATIBLE_VERSION | HostBridge information belongs to an unsupported version |
EFI_WARN_STALE_DATA | One or more valid aperture in the HostBridge's resources were ignored because corresponding aperture pointer is NULL. |
EFI_SUCCESS | Operation executed cleanly, all valid ranges were parsed into the corresponding aperture object. |
Definition at line 297 of file HardwareInfoPciHostBridgeLib.c.
EFI_STATUS HardwareInfoPciHostBridgeGetBusNrRange | ( | IN CONST HOST_BRIDGE_INFO * | HostBridge, |
IN UINTN | DataSize, | ||
OUT UINTN * | BusNrStart, | ||
OUT UINTN * | BusNrLast | ||
) |
Interpret the HostBridge resources and extact the bus number range.
[in] | HostBridge | Root bridge's resources specification |
[in] | DataSize | Size in bytes of the actually filled data available in the HostBridge object |
[out] | BusNrStart | Pointer to the Bus Number range start |
[out] | BusNrLast | Pointer to the Bus Number range end |
EFI_SUCCESS | Retrieved the bus number range without any issues. |
EFI_INVALID_PARAMETER | One of the parameters is invalid, either NULL pointer or size 0 |
EFI_INCOMPATIBLE_VERSION | HostBridge data of unsupported version |
Definition at line 270 of file HardwareInfoPciHostBridgeLib.c.
EFI_STATUS HardwareInfoPciHostBridgeGetFlags | ( | IN CONST HOST_BRIDGE_INFO * | HostBridge, |
IN UINTN | DataSize, | ||
OUT UINT64 *Attributes | OPTIONAL, | ||
OUT BOOLEAN *DmaAbove4G | OPTIONAL, | ||
OUT BOOLEAN *NoExtendedConfigSpace | OPTIONAL, | ||
OUT BOOLEAN *CombineMemPMem | OPTIONAL | ||
) |
Retrieve all flags and attributes of a host bridge describing the resources and capabilities.
[in] | HostBridge | Host bridge information object |
[in] | DataSize | Size in bytes of the actually filled data available in the HostBridge object |
[out] | Attributes | Pointer to the host bridge's attributes |
[out] | DmaAbove4G | Pointer to the DMA Above 4G flag |
[out] | NoExtendedConfigSpace | Pointer to the Extended Config Space flag |
[out] | CombineMemPMem | Pointer to the Combine Mem and PMem flag |
EFI_INVALID_PARAMETER | HostBridge object is invalid |
EFI_INCOMPATIBLE_VERSION | HostBridge information belongs to an unsupported version |
EFI_SUCCESS | Operation executed cleanly |
Definition at line 413 of file HardwareInfoPciHostBridgeLib.c.
EFI_STATUS HardwareInfoPciHostBridgeLastMmioAddress | ( | IN CONST HOST_BRIDGE_INFO * | HostBridge, |
IN UINTN | DataSize, | ||
IN BOOLEAN | HighMem, | ||
OUT UINT64 * | LastMmioAddress | ||
) |
Extract the last MMIO address, either from high (64-bit) or low (32-bit) memory used by the HostBridge's apertures.
[in] | HostBridge | Root bridge's resources specification |
[in] | DataSize | Size in bytes of the actually filled data available in the HostBridge object |
[in] | HighMem | 64-bit (true) or 32-bit (false) MMIO address |
[out] | LastMmioAddress | Pointer to last MMIO address |
EFI_SUCCESS | Operation succeeded |
EFI_INVALID_PARAMETER | One or more pointer parameters are invalid |
EFI_INCOMPATIBLE_VERSION | HostBridge information belongs to an unsupported version |
Definition at line 61 of file HardwareInfoPciHostBridgeLib.c.
STATIC VOID InvalidateRootBridgeAperture | ( | OUT PCI_ROOT_BRIDGE_APERTURE * | Aperture | ) |
Set the boundaries of an aperture to invalid values having size zero and start MaxValue (yields Start > Limit which depicts an invalid range)
[in] | MaxValue | Max value of the aperture's range (depends on the data type) |
[out] | Aperture | Aperture object to invalidate |
Definition at line 126 of file HardwareInfoPciHostBridgeLib.c.
STATIC EFI_STATUS MergeHostBridgeApertures | ( | IN UINT64 | Start, |
IN UINT64 | Size, | ||
IN UINT64 | PStart, | ||
IN UINT64 | PSize, | ||
IN UINT64 | MaxValue, | ||
OUT PCI_ROOT_BRIDGE_APERTURE * | Aperture | ||
) |
Merge 2 ranges (normal and prefetchable) into a single aperture comprehending the addresses encompassed by both of them. If both ranges are not empty they must be contiguous for correctness.
[in] | Start | Range start address |
[in] | Size | Range size in bytes |
[in] | PStart | Prefetchable range start address |
[in] | PSize | Prefetchable range size in bytes |
[in] | MaxValue | Max value a valid address could take and which represents an invalid start address. |
[out] | Aperture | Pointer to the aperture to be filled |
EFI_SUCCESS | Aperture was filled successfully |
EFI_INVALID_PARAMETER | Either range depicted by Start, Size or PStart, PSize or both are valid but ignored because aperture pointer is NULL |
EFI_WARN_BUFFER_TOO_SMALL | Aperture pointer is invalid but both ranges are too so no harm. |
Definition at line 218 of file HardwareInfoPciHostBridgeLib.c.
STATIC VOID UpdateLastAddressIfHigher | ( | IN PCI_ROOT_BRIDGE_APERTURE * | Mem, |
OUT UINT64 * | LastAddress | ||
) |
Internal helper to update LastAddress if the Limit address of the Mem aperture is higher than the provided value.
[in] | Mem | Pointer to aperture whose limit is to be compared against accumulative last address. |
[out] | LastAddress | Pointer to accumulative last address to be updated if Limit is higher |
Definition at line 50 of file HardwareInfoPciHostBridgeLib.c.