TianoCore EDK2 master
|
#include <IndustryStandard/Acpi10.h>
#include <IndustryStandard/Q35MchIch9.h>
#include <IndustryStandard/QemuPciBridgeCapabilities.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PciCapLib.h>
#include <Library/PciCapPciSegmentLib.h>
#include <Library/PciLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Protocol/PciHotPlugInit.h>
#include <Protocol/PciRootBridgeIo.h>
Go to the source code of this file.
Data Structures | |
struct | RESOURCE_PADDING |
Variables | |
STATIC BOOLEAN | mPciExtConfSpaceSupported |
STATIC EFI_PCI_HOT_PLUG_INIT_PROTOCOL | mPciHotPlugInit |
This driver implements EFI_PCI_HOT_PLUG_INIT_PROTOCOL, providing the PCI bus driver with resource padding information, for PCIe hotplug purposes.
Copyright (C) 2016, Red Hat, Inc.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PciHotPlugInit.c.
EFI_STATUS EFIAPI DriverInitialize | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Entry point for this driver.
[in] | ImageHandle | Image handle of this driver. |
[in] | SystemTable | Pointer to SystemTable. |
EFI_SUCESS | Driver has loaded successfully. |
Definition at line 811 of file PciHotPlugInit.c.
STATIC EFI_STATUS EFIAPI GetResourcePadding | ( | IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL * | This, |
IN EFI_DEVICE_PATH_PROTOCOL * | HpcDevicePath, | ||
IN UINT64 | HpcPciAddress, | ||
OUT EFI_HPC_STATE * | HpcState, | ||
OUT VOID ** | Padding, | ||
OUT EFI_HPC_PADDING_ATTRIBUTES * | Attributes | ||
) |
Returns the resource padding that is required by the PCI bus that is controlled by the specified Hot Plug Controller (HPC).
This function returns the resource padding that is required by the PCI bus that is controlled by the specified HPC. This member function is called for all the root HPCs and nonroot HPCs that are detected by the PCI bus enumerator. This function will be called before PCI resource allocation is completed. This function must be called after all the root HPCs, with the possible exception of a PCI-to-CardBus bridge, have completed initialization.
[in] | This | Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance. |
[in] | HpcDevicePath | The device path to the HPC. |
[in] | HpcPciAddress | The address of the HPC function on the PCI bus. |
[in] | HpcState | The state of the HPC hardware. |
[out] | Padding | The amount of resource padding that is required by the PCI bus under the control of the specified HPC. |
[out] | Attributes | Describes how padding is accounted for. The padding is returned in the form of ACPI 2.0 resource descriptors. |
EFI_SUCCESS | The resource padding was successfully returned. |
EFI_UNSUPPORTED | This instance of the EFI_PCI_HOT_PLUG_INIT_PROTOCOL does not support the specified HPC. |
EFI_NOT_READY | This function was called before HPC initialization is complete. |
EFI_INVALID_PARAMETER | HpcState or Padding or Attributes is NULL. |
EFI_OUT_OF_RESOURCES | ACPI 2.0 resource descriptors for Padding cannot be allocated due to insufficient resources. |
Definition at line 547 of file PciHotPlugInit.c.
STATIC EFI_STATUS EFIAPI GetRootHpcList | ( | IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL * | This, |
OUT UINTN * | HpcCount, | ||
OUT EFI_HPC_LOCATION ** | HpcList | ||
) |
Returns a list of root Hot Plug Controllers (HPCs) that require initialization during the boot process.
This procedure returns a list of root HPCs. The PCI bus driver must initialize these controllers during the boot process. The PCI bus driver may or may not be able to detect these HPCs. If the platform includes a PCI-to-CardBus bridge, it can be included in this list if it requires initialization. The HpcList must be self consistent. An HPC cannot control any of its parent buses. Only one HPC can control a PCI bus. Because this list includes only root HPCs, no HPC in the list can be a child of another HPC. This policy must be enforced by the EFI_PCI_HOT_PLUG_INIT_PROTOCOL. The PCI bus driver may not check for such invalid conditions. The callee allocates the buffer HpcList
[in] | This | Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance. |
[out] | HpcCount | The number of root HPCs that were returned. |
[out] | HpcList | The list of root HPCs. HpcCount defines the number of elements in this list. |
EFI_SUCCESS | HpcList was returned. |
EFI_OUT_OF_RESOURCES | HpcList was not returned due to insufficient resources. |
EFI_INVALID_PARAMETER | HpcCount is NULL or HpcList is NULL. |
Definition at line 430 of file PciHotPlugInit.c.
Round up a positive 32-bit value to the next whole power of two, and return the bit position of the highest bit set in the result. Equivalent to ceil(log2(x)).
[in] | Operand | The 32-bit operand to evaluate. |
-1 | Operand is zero. |
-1 | Operand is positive, not a whole power of two, and rounding it up to the next power of two does not fit into 32 bits. |
0..31 | Otherwise, return ceil(log2(Value)). |
Definition at line 187 of file PciHotPlugInit.c.
Round up a positive 64-bit value to the next whole power of two, and return the bit position of the highest bit set in the result. Equivalent to ceil(log2(x)).
[in] | Operand | The 64-bit operand to evaluate. |
-1 | Operand is zero. |
-1 | Operand is positive, not a whole power of two, and rounding it up to the next power of two does not fit into 64 bits. |
0..63 | Otherwise, return ceil(log2(Value)). |
Definition at line 227 of file PciHotPlugInit.c.
STATIC VOID InitializeResourcePadding | ( | OUT RESOURCE_PADDING * | ResourcePadding | ) |
Initialize a RESOURCE_PADDING object.
[out] | ResourcePadding | The caller-allocated RESOURCE_PADDING object to initialize. |
Definition at line 72 of file PciHotPlugInit.c.
STATIC EFI_STATUS EFIAPI InitializeRootHpc | ( | IN EFI_PCI_HOT_PLUG_INIT_PROTOCOL * | This, |
IN EFI_DEVICE_PATH_PROTOCOL * | HpcDevicePath, | ||
IN UINT64 | HpcPciAddress, | ||
IN EFI_EVENT Event | OPTIONAL, | ||
OUT EFI_HPC_STATE * | HpcState | ||
) |
Initializes one root Hot Plug Controller (HPC). This process may causes initialization of its subordinate buses.
This function initializes the specified HPC. At the end of initialization, the hot-plug slots or sockets (controlled by this HPC) are powered and are connected to the bus. All the necessary registers in the HPC are set up. For a Standard (PCI) Hot Plug Controller (SHPC), the registers that must be set up are defined in the PCI Standard Hot Plug Controller and Subsystem Specification.
[in] | This | Pointer to the EFI_PCI_HOT_PLUG_INIT_PROTOCOL instance. |
[in] | HpcDevicePath | The device path to the HPC that is being initialized. |
[in] | HpcPciAddress | The address of the HPC function on the PCI bus. |
[in] | Event | The event that should be signaled when the HPC initialization is complete. Set to NULL if the caller wants to wait until the entire initialization process is complete. |
[out] | HpcState | The state of the HPC hardware. The state is EFI_HPC_STATE_INITIALIZED or EFI_HPC_STATE_ENABLED. |
EFI_SUCCESS | If Event is NULL, the specific HPC was successfully initialized. If Event is not NULL, Event will be signaled at a later time when initialization is complete. |
EFI_UNSUPPORTED | This instance of EFI_PCI_HOT_PLUG_INIT_PROTOCOL does not support the specified HPC. |
EFI_OUT_OF_RESOURCES | Initialization failed due to insufficient resources. |
EFI_INVALID_PARAMETER | HpcState is NULL. |
Definition at line 487 of file PciHotPlugInit.c.
STATIC EFI_STATUS QueryReservationHint | ( | IN CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS * | HpcPciAddress, |
OUT QEMU_PCI_BRIDGE_CAPABILITY_RESOURCE_RESERVATION * | ReservationHint | ||
) |
Look up the QEMU-specific Resource Reservation capability in the conventional config space of a Hotplug Controller (that is, PCI Bridge).
On error, the contents of ReservationHint are indeterminate.
[in] | HpcPciAddress | The address of the PCI Bridge – Bus, Device, Function – in UEFI (not PciLib) encoding. |
[out] | ReservationHint | The caller-allocated capability structure to populate from the PCI Bridge's config space. |
EFI_SUCCESS | The capability has been found, ReservationHint has been populated. |
EFI_NOT_FOUND | The capability is missing. |
Definition at line 272 of file PciHotPlugInit.c.
STATIC VOID SetIoPadding | ( | IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR * | Descriptor, |
IN UINTN | SizeExponent | ||
) |
Set up a descriptor entry for reserving IO space.
[in,out] | Descriptor | The descriptor to configure. The caller shall have initialized Descriptor earlier, with InitializeResourcePadding(). |
[in] | SizeExponent | The size and natural alignment of the reservation are determined by raising two to this power. |
Definition at line 115 of file PciHotPlugInit.c.
STATIC VOID SetMmioPadding | ( | IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR * | Descriptor, |
IN BOOLEAN | Prefetchable, | ||
IN BOOLEAN | ThirtyTwoBitOnly, | ||
IN UINTN | SizeExponent | ||
) |
Set up a descriptor entry for reserving MMIO space.
[in,out] | Descriptor | The descriptor to configure. The caller shall have initialized Descriptor earlier, with InitializeResourcePadding(). |
[in] | Prefetchable | TRUE if the descriptor should reserve prefetchable MMIO space. Pass FALSE for reserving non-prefetchable MMIO space. |
[in] | ThirtyTwoBitOnly | TRUE if the reservation should be limited to 32-bit address space. FALSE if the reservation can be satisfied from 64-bit address space. ThirtyTwoBitOnly is ignored if Prefetchable is FALSE; in that case ThirtyTwoBitOnly is always considered TRUE. |
[in] | SizeExponent | The size and natural alignment of the reservation are determined by raising two to this power. |
Definition at line 149 of file PciHotPlugInit.c.
STATIC BOOLEAN mPciExtConfSpaceSupported |
Definition at line 30 of file PciHotPlugInit.c.
STATIC EFI_PCI_HOT_PLUG_INIT_PROTOCOL mPciHotPlugInit |
Definition at line 38 of file PciHotPlugInit.c.