TianoCore EDK2 master
|
#include "PciResourceSupport.h"
Go to the source code of this file.
PCI bus enumeration logic function declaration for PCI bus module.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PciEnumerator.h.
EFI_STATUS AddHostBridgeEnumerator | ( | IN EFI_HANDLE | HostBridgeHandle | ) |
Add host bridge handle to global variable for enumerating.
HostBridgeHandle | Host bridge handle. |
EFI_SUCCESS | Successfully added host bridge. |
EFI_ABORTED | Host bridge is NULL, or given host bridge has been in host bridge list. |
Definition at line 2171 of file PciEnumerator.c.
EFI_STATUS ConstructAcpiResourceRequestor | ( | IN PCI_IO_DEVICE * | Bridge, |
IN PCI_RESOURCE_NODE * | IoNode, | ||
IN PCI_RESOURCE_NODE * | Mem32Node, | ||
IN PCI_RESOURCE_NODE * | PMem32Node, | ||
IN PCI_RESOURCE_NODE * | Mem64Node, | ||
IN PCI_RESOURCE_NODE * | PMem64Node, | ||
OUT VOID ** | Config | ||
) |
Summary requests for all resource type, and construct ACPI resource requestor instance.
Bridge | detecting bridge |
IoNode | Pointer to instance of I/O resource Node |
Mem32Node | Pointer to instance of 32-bit memory resource Node |
PMem32Node | Pointer to instance of 32-bit Pmemory resource node |
Mem64Node | Pointer to instance of 64-bit memory resource node |
PMem64Node | Pointer to instance of 64-bit Pmemory resource node |
Config | Output buffer holding new constructed APCI resource requestor |
EFI_SUCCESS | Successfully constructed ACPI resource. |
EFI_OUT_OF_RESOURCES | No memory available. |
Definition at line 1056 of file PciEnumerator.c.
EFI_STATUS DetermineRootBridgeAttributes | ( | IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL * | PciResAlloc, |
IN PCI_IO_DEVICE * | RootBridgeDev | ||
) |
This routine is used to determine the root bridge attribute by interfacing the host bridge resource allocation protocol.
PciResAlloc | Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL |
RootBridgeDev | Root bridge instance |
EFI_SUCCESS | Successfully got root bridge's attribute. |
other | Failed to get attribute. |
Definition at line 469 of file PciEnumerator.c.
PCI_RESOURCE_NODE * GetLargerConsumerDevice | ( | IN PCI_RESOURCE_NODE * | PciResNode1, |
IN PCI_RESOURCE_NODE * | PciResNode2 | ||
) |
Compare two resource nodes and get the larger resource consumer.
PciResNode1 | resource node 1 want to be compared |
PciResNode2 | resource node 2 want to be compared |
Definition at line 825 of file PciEnumerator.c.
UINT32 GetMaxOptionRomSize | ( | IN PCI_IO_DEVICE * | Bridge | ) |
Get Max Option Rom size on specified bridge.
Bridge | Given bridge device instance. |
Definition at line 523 of file PciEnumerator.c.
PCI_RESOURCE_NODE * GetMaxResourceConsumerDevice | ( | IN PCI_RESOURCE_NODE * | ResPool | ) |
Get the max resource consumer in the host resource pool.
ResPool | Pointer to resource pool node. |
Definition at line 860 of file PciEnumerator.c.
VOID GetResourceAllocationStatus | ( | VOID * | AcpiConfig, |
OUT UINT64 * | IoResStatus, | ||
OUT UINT64 * | Mem32ResStatus, | ||
OUT UINT64 * | PMem32ResStatus, | ||
OUT UINT64 * | Mem64ResStatus, | ||
OUT UINT64 * | PMem64ResStatus | ||
) |
Get resource allocation status from the ACPI resource descriptor.
AcpiConfig | Point to Acpi configuration table. |
IoResStatus | Return the status of I/O resource. |
Mem32ResStatus | Return the status of 32-bit Memory resource. |
PMem32ResStatus | Return the status of 32-bit Prefetchable Memory resource. |
Mem64ResStatus | Return the status of 64-bit Memory resource. |
PMem64ResStatus | Return the status of 64-bit Prefetchable Memory resource. |
Definition at line 628 of file PciEnumerator.c.
VOID GetResourceBase | ( | IN VOID * | Config, |
OUT UINT64 * | IoBase, | ||
OUT UINT64 * | Mem32Base, | ||
OUT UINT64 * | PMem32Base, | ||
OUT UINT64 * | Mem64Base, | ||
OUT UINT64 * | PMem64Base | ||
) |
Get resource base from an acpi configuration descriptor.
Config | An acpi configuration descriptor. |
IoBase | Output of I/O resource base address. |
Mem32Base | Output of 32-bit memory base address. |
PMem32Base | Output of 32-bit prefetchable memory base address. |
Mem64Base | Output of 64-bit memory base address. |
PMem64Base | Output of 64-bit prefetchable memory base address. |
Definition at line 1283 of file PciEnumerator.c.
EFI_STATUS GetResourceBaseFromBridge | ( | IN PCI_IO_DEVICE * | Bridge, |
OUT UINT64 * | IoBase, | ||
OUT UINT64 * | Mem32Base, | ||
OUT UINT64 * | PMem32Base, | ||
OUT UINT64 * | Mem64Base, | ||
OUT UINT64 * | PMem64Base | ||
) |
Get resource base address for a pci bridge device.
Bridge | Given Pci driver instance. |
IoBase | Output for base address of I/O type resource. |
Mem32Base | Output for base address of 32-bit memory type resource. |
PMem32Base | Ooutput for base address of 32-bit Pmemory type resource. |
Mem64Base | Output for base address of 64-bit memory type resource. |
PMem64Base | Output for base address of 64-bit Pmemory type resource. |
EFI_SUCCESS | Successfully got resource base address. |
EFI_OUT_OF_RESOURCES | PCI bridge is not available. |
Definition at line 1588 of file PciEnumerator.c.
BOOLEAN IsRejectiveDevice | ( | IN PCI_RESOURCE_NODE * | PciResNode | ) |
Determine whethter a PCI device can be rejected.
PciResNode | Pointer to Pci resource node instance. |
TRUE | The PCI device can be rejected. |
TRUE | The PCI device cannot be rejected. |
Definition at line 776 of file PciEnumerator.c.
EFI_STATUS NotifyPhase | ( | IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL * | PciResAlloc, |
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE | Phase | ||
) |
These are the notifications from the PCI bus driver that it is about to enter a certain phase of the PCI enumeration process.
This member function can be used to notify the host bridge driver to perform specific actions, including any chipset-specific initialization, so that the chipset is ready to enter the next phase. Eight notification points are defined at this time. See belows: EfiPciHostBridgeBeginEnumeration Resets the host bridge PCI apertures and internal data structures. The PCI enumerator should issue this notification before starting a fresh enumeration process. Enumeration cannot be restarted after sending any other notification such as EfiPciHostBridgeBeginBusAllocation. EfiPciHostBridgeBeginBusAllocation The bus allocation phase is about to begin. No specific action is required here. This notification can be used to perform any chipset-specific programming. EfiPciHostBridgeEndBusAllocation The bus allocation and bus programming phase is complete. No specific action is required here. This notification can be used to perform any chipset-specific programming. EfiPciHostBridgeBeginResourceAllocation The resource allocation phase is about to begin. No specific action is required here. This notification can be used to perform any chipset-specific programming. EfiPciHostBridgeAllocateResources Allocates resources per previously submitted requests for all the PCI root bridges. These resource settings are returned on the next call to GetProposedResources(). Before calling NotifyPhase() with a Phase of EfiPciHostBridgeAllocateResource, the PCI bus enumerator is responsible for gathering I/O and memory requests for all the PCI root bridges and submitting these requests using SubmitResources(). This function pads the resource amount to suit the root bridge hardware, takes care of dependencies between the PCI root bridges, and calls the Global Coherency Domain (GCD) with the allocation request. In the case of padding, the allocated range could be bigger than what was requested. EfiPciHostBridgeSetResources Programs the host bridge hardware to decode previously allocated resources (proposed resources) for all the PCI root bridges. After the hardware is programmed, reassigning resources will not be supported. The bus settings are not affected. EfiPciHostBridgeFreeResources Deallocates resources that were previously allocated for all the PCI root bridges and resets the I/O and memory apertures to their initial state. The bus settings are not affected. If the request to allocate resources fails, the PCI enumerator can use this notification to deallocate previous resources, adjust the requests, and retry allocation. EfiPciHostBridgeEndResourceAllocation The resource allocation phase is completed. No specific action is required here. This notification can be used to perform any chipsetspecific programming.
[in] | PciResAlloc | The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL |
[in] | Phase | The phase during enumeration |
EFI_NOT_READY | This phase cannot be entered at this time. For example, this error is valid for a Phase of EfiPciHostBridgeAllocateResources if SubmitResources() has not been called for one or more PCI root bridges before this call |
EFI_DEVICE_ERROR | Programming failed due to a hardware error. This error is valid for a Phase of EfiPciHostBridgeSetResources. |
EFI_INVALID_PARAMETER | Invalid phase parameter |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. This error is valid for a Phase of EfiPciHostBridgeAllocateResources if the previously submitted resource requests cannot be fulfilled or were only partially fulfilled. |
EFI_SUCCESS | The notification was accepted without any errors. |
Definition at line 1725 of file PciEnumerator.c.
EFI_STATUS PciAssignBusNumber | ( | IN PCI_IO_DEVICE * | Bridge, |
IN UINT8 | StartBusNumber, | ||
OUT UINT8 * | SubBusNumber | ||
) |
This routine is used to assign bus number to the given PCI bus system
Bridge | Parent root bridge instance. |
StartBusNumber | Number of beginning. |
SubBusNumber | The number of sub bus. |
EFI_SUCCESS | Successfully assigned bus number. |
EFI_DEVICE_ERROR | Failed to assign bus number. |
Definition at line 325 of file PciEnumerator.c.
EFI_STATUS PciBridgeEnumerator | ( | IN PCI_IO_DEVICE * | BridgeDev | ) |
Enumerate pci bridge, allocate resource and determine attribute for devices on this bridge.
BridgeDev | Pointer to instance of bridge device. |
EFI_SUCCESS | Successfully enumerated PCI bridge. |
other | Failed to enumerate. |
Definition at line 1373 of file PciEnumerator.c.
EFI_STATUS PciBridgeResourceAllocator | ( | IN PCI_IO_DEVICE * | Bridge | ) |
Allocate all kinds of resource for PCI bridge.
Bridge | Pointer to bridge instance. |
EFI_SUCCESS | Successfully allocated resource for PCI bridge. |
other | Failed to allocate resource for bridge. |
Definition at line 1432 of file PciEnumerator.c.
EFI_STATUS PciEnumerator | ( | IN EFI_HANDLE | Controller, |
IN EFI_HANDLE | HostBridgeHandle | ||
) |
This routine is used to enumerate entire pci bus system in a given platform.
Controller | Parent controller handle. |
HostBridgeHandle | Host bridge handle. |
EFI_SUCCESS | PCI enumeration finished successfully. |
other | Some error occurred when enumerating the pci bus system. |
Definition at line 24 of file PciEnumerator.c.
EFI_STATUS PciHostBridgeAdjustAllocation | ( | IN PCI_RESOURCE_NODE * | IoPool, |
IN PCI_RESOURCE_NODE * | Mem32Pool, | ||
IN PCI_RESOURCE_NODE * | PMem32Pool, | ||
IN PCI_RESOURCE_NODE * | Mem64Pool, | ||
IN PCI_RESOURCE_NODE * | PMem64Pool, | ||
IN UINT64 | IoResStatus, | ||
IN UINT64 | Mem32ResStatus, | ||
IN UINT64 | PMem32ResStatus, | ||
IN UINT64 | Mem64ResStatus, | ||
IN UINT64 | PMem64ResStatus | ||
) |
Adjust host bridge allocation so as to reduce resource requirement
IoPool | Pointer to instance of I/O resource Node. |
Mem32Pool | Pointer to instance of 32-bit memory resource Node. |
PMem32Pool | Pointer to instance of 32-bit Prefetchable memory resource node. |
Mem64Pool | Pointer to instance of 64-bit memory resource node. |
PMem64Pool | Pointer to instance of 64-bit Prefetchable memory resource node. |
IoResStatus | Status of I/O resource Node. |
Mem32ResStatus | Status of 32-bit memory resource Node. |
PMem32ResStatus | Status of 32-bit Prefetchable memory resource node. |
Mem64ResStatus | Status of 64-bit memory resource node. |
PMem64ResStatus | Status of 64-bit Prefetchable memory resource node. |
EFI_SUCCESS | Successfully adjusted resource on host bridge. |
EFI_ABORTED | Host bridge hasn't this resource type or no resource be adjusted. |
Definition at line 914 of file PciEnumerator.c.
EFI_STATUS PciHostBridgeDeviceAttribute | ( | IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL * | PciResAlloc | ) |
Process attributes of devices on this host bridge
PciResAlloc | Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. |
EFI_SUCCESS | Successfully process attribute. |
EFI_NOT_FOUND | Can not find the specific root bridge device. |
other | Failed to determine the root bridge device's attribute. |
Definition at line 584 of file PciEnumerator.c.
EFI_STATUS PciHostBridgeP2CProcess | ( | IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL * | PciResAlloc | ) |
Process Option Rom on this host bridge
PciResAlloc | Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. |
EFI_NOT_FOUND | Can not find the root bridge instance. |
EFI_SUCCESS | Success process. |
Process Option Rom on the specified host bridge.
PciResAlloc | Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. |
EFI_SUCCESS | Success process. |
EFI_NOT_FOUND | Can not find the root bridge instance. |
other | Some error occurred when processing Option Rom on the host bridge. |
EFI_STATUS EFIAPI PciHotPlugRequestNotify | ( | IN EFI_PCI_HOTPLUG_REQUEST_PROTOCOL * | This, |
IN EFI_PCI_HOTPLUG_OPERATION | Operation, | ||
IN EFI_HANDLE | Controller, | ||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath | OPTIONAL, | ||
IN OUT UINT8 * | NumberOfChildren, | ||
IN OUT EFI_HANDLE * | ChildHandleBuffer | ||
) |
This function allows the PCI bus driver to be notified to act as requested when a hot-plug event has happened on the hot-plug controller. Currently, the operations include add operation and remove operation..
This | A pointer to the hot plug request protocol. |
Operation | The operation the PCI bus driver is requested to make. |
Controller | The handle of the hot-plug controller. |
RemainingDevicePath | The remaining device path for the PCI-like hot-plug device. |
NumberOfChildren | The number of child handles. For a add operation, it is an output parameter. For a remove operation, it's an input parameter. |
ChildHandleBuffer | The buffer which contains the child handles. |
EFI_INVALID_PARAMETER | Operation is not a legal value. Controller is NULL or not a valid handle. NumberOfChildren is NULL. ChildHandleBuffer is NULL while Operation is add. |
EFI_OUT_OF_RESOURCES | There are no enough resources to start the devices. |
EFI_NOT_FOUND | Can not find bridge according to controller handle. |
EFI_SUCCESS | The handles for the specified device have been created or destroyed as requested, and for an add operation, the new handles are returned in ChildHandleBuffer. |
Definition at line 1991 of file PciEnumerator.c.
EFI_STATUS PciRootBridgeEnumerator | ( | IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL * | PciResAlloc, |
IN PCI_IO_DEVICE * | RootBridgeDev | ||
) |
Enumerate PCI root bridge.
PciResAlloc | Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL. |
RootBridgeDev | Instance of root bridge device. |
EFI_SUCCESS | Successfully enumerated root bridge. |
other | Failed to enumerate root bridge. |
Definition at line 115 of file PciEnumerator.c.
EFI_STATUS PreprocessController | ( | IN PCI_IO_DEVICE * | Bridge, |
IN UINT8 | Bus, | ||
IN UINT8 | Device, | ||
IN UINT8 | Func, | ||
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE | Phase | ||
) |
Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual PCI controllers before enumeration.
This function is called during the PCI enumeration process. No specific action is expected from this member function. It allows the host bridge driver to preinitialize individual PCI controllers before enumeration.
Bridge | Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance. |
Bus | The bus number of the pci device. |
Device | The device number of the pci device. |
Func | The function number of the pci device. |
Phase | The phase of the PCI device enumeration. |
EFI_SUCCESS | The requested parameters were returned. |
EFI_INVALID_PARAMETER | RootBridgeHandle is not a valid root bridge handle. |
EFI_INVALID_PARAMETER | Phase is not a valid phase that is defined in EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE. |
EFI_DEVICE_ERROR | Programming failed due to a hardware error. The PCI enumerator should not enumerate this device, including its child devices if it is a PCI-to-PCI bridge. |
Definition at line 1854 of file PciEnumerator.c.
VOID ProcessOptionRom | ( | IN PCI_IO_DEVICE * | Bridge, |
IN UINT64 | RomBase, | ||
IN UINT64 | MaxLength | ||
) |
This routine is used to process all PCI devices' Option Rom on a certain root bridge.
Bridge | Given parent's root bridge. |
RomBase | Base address of ROM driver loaded from. |
MaxLength | Maximum rom size. |
Definition at line 280 of file PciEnumerator.c.
EFI_STATUS RejectPciDevice | ( | IN PCI_IO_DEVICE * | PciDevice | ) |
Remove a PCI device from device pool and mark its bar.
PciDevice | Instance of Pci device. |
EFI_SUCCESS | Successfully remove the PCI device. |
EFI_ABORTED | Pci device is a root bridge or a PCI-PCI bridge. |
Definition at line 704 of file PciEnumerator.c.
BOOLEAN SearchHostBridgeHandle | ( | IN EFI_HANDLE | RootBridgeHandle | ) |
Search hostbridge according to given handle
RootBridgeHandle | Host bridge handle. |
TRUE | Found host bridge handle. |
FALSE | Not found hot bridge handle. |
Definition at line 2125 of file PciEnumerator.c.