summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
diff options
context:
space:
mode:
Diffstat (limited to 'IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c')
-rw-r--r--IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c671
1 files changed, 283 insertions, 388 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
index 9e68da8afe..7784a1d869 100644
--- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
+++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
@@ -17,27 +17,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "PciResourceSupport.h"
#include "PciOptionRomSupport.h"
-EFI_STATUS
-PciEnumerator (
- IN EFI_HANDLE Controller
- )
/**
-
-Routine Description:
-
This routine is used to enumerate entire pci bus system
in a given platform
-Arguments:
-
-Returns:
-
- None
-
+ @param Controller Parent controller handle
+
+ @return Status of enumerating
**/
-// TODO: Controller - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
+EFI_STATUS
+PciEnumerator (
+ IN EFI_HANDLE Controller
+ )
{
EFI_HANDLE HostBridgeHandle;
@@ -134,25 +125,21 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Enumerate PCI root bridge
+
+ @param PciResAlloc Pointer to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
+ @param RootBridgeDev Instance of root bridge device
+
+ @retval EFI_SUCCESS Success to enumerate root bridge
+ @retval Others Fail to enumerate root bridge
+
+**/
EFI_STATUS
PciRootBridgeEnumerator (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
IN PCI_IO_DEVICE *RootBridgeDev
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: RootBridgeDev - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *pConfiguration;
@@ -246,29 +233,21 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ This routine is used to process option rom on a certain root bridge
+
+ @param Bridge Given parent's root bridge
+ @param RomBase Base address of ROM driver loaded from
+ @param MaxLength Max rom size
+
+ @retval EFI_SUCCESS Success to process option rom image.
+**/
EFI_STATUS
ProcessOptionRom (
IN PCI_IO_DEVICE *Bridge,
IN UINT64 RomBase,
IN UINT64 MaxLength
)
-/**
-
-Routine Description:
-
- This routine is used to process option rom on a certain root bridge
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: Bridge - add argument and description to function comment
-// TODO: RomBase - add argument and description to function comment
-// TODO: MaxLength - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
LIST_ENTRY *CurrentLink;
PCI_IO_DEVICE *Temp;
@@ -301,30 +280,21 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ This routine is used to assign bus number to the given PCI bus system
+
+ @param Bridge Parent root bridge instance
+ @param StartBusNumber Number of beginning
+ @param SubBusNumber the number of sub bus
+
+ @retval EFI_SUCCESS Success to assign bus number
+**/
EFI_STATUS
PciAssignBusNumber (
IN PCI_IO_DEVICE *Bridge,
IN UINT8 StartBusNumber,
OUT UINT8 *SubBusNumber
)
-/**
-
-Routine Description:
-
- This routine is used to assign bus number to the given PCI bus system
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: Bridge - add argument and description to function comment
-// TODO: StartBusNumber - add argument and description to function comment
-// TODO: SubBusNumber - add argument and description to function comment
-// TODO: EFI_DEVICE_ERROR - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_STATUS Status;
PCI_TYPE00 Pci;
@@ -451,28 +421,21 @@ Returns:
return EFI_SUCCESS;
}
-EFI_STATUS
-DetermineRootBridgeAttributes (
- IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
- IN PCI_IO_DEVICE *RootBridgeDev
- )
/**
-
-Routine Description:
-
This routine is used to determine the root bridge attribute by interfacing
the host bridge resource allocation protocol.
-Arguments:
-
-Returns:
-
- None
-
+ @param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
+ @param RootBridgeDev Root bridge instance
+
+ @retval EFI_SUCCESS Success to get root bridge's attribute
+ @retval Others Fail to get attribute
**/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: RootBridgeDev - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
+EFI_STATUS
+DetermineRootBridgeAttributes (
+ IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
+ IN PCI_IO_DEVICE *RootBridgeDev
+ )
{
UINT64 Attributes;
EFI_STATUS Status;
@@ -514,24 +477,16 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Get Max Option Rom size on this bridge
+
+ @param Bridge Bridge device instance
+ @return Max size of option rom
+**/
UINT64
GetMaxOptionRomSize (
IN PCI_IO_DEVICE *Bridge
)
-/**
-
-Routine Description:
-
- Get Max Option Rom size on this bridge
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: Bridge - add argument and description to function comment
{
LIST_ENTRY *CurrentLink;
PCI_IO_DEVICE *Temp;
@@ -582,26 +537,19 @@ Returns:
return MaxOptionRomSize;
}
+/**
+ Process attributes of devices on this host bridge
+
+ @param PciResAlloc Protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
+
+ @retval EFI_NOT_FOUND Can not find the specific root bridge device
+ @retval EFI_SUCCESS Success Process attribute
+ @retval Others Can not determine the root bridge device's attribute
+**/
EFI_STATUS
PciHostBridgeDeviceAttribute (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc
)
-/**
-
-Routine Description:
-
- Process attributes of devices on this host bridge
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_HANDLE RootBridgeHandle;
PCI_IO_DEVICE *RootBridgeDev;
@@ -633,6 +581,18 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Get resource allocation status from the ACPI pointer
+
+ @param AcpiConfig Point to Acpi configuration table
+ @param IoResStatus Return the status of I/O resource
+ @param Mem32ResStatus Return the status of 32-bit Memory resource
+ @param PMem32ResStatus Return the status of 32-bit PMemory resource
+ @param Mem64ResStatus Return the status of 64-bit Memory resource
+ @param PMem64ResStatus Return the status of 64-bit PMemory resource
+
+ @retval EFI_SUCCESS Success to get resource allocation status from ACPI configuration table.
+**/
EFI_STATUS
GetResourceAllocationStatus (
VOID *AcpiConfig,
@@ -642,26 +602,6 @@ GetResourceAllocationStatus (
OUT UINT64 *Mem64ResStatus,
OUT UINT64 *PMem64ResStatus
)
-/**
-
-Routine Description:
-
- Get resource allocation status from the ACPI pointer
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: AcpiConfig - add argument and description to function comment
-// TODO: IoResStatus - add argument and description to function comment
-// TODO: Mem32ResStatus - add argument and description to function comment
-// TODO: PMem32ResStatus - add argument and description to function comment
-// TODO: Mem64ResStatus - add argument and description to function comment
-// TODO: PMem64ResStatus - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
UINT8 *Temp;
@@ -724,28 +664,18 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Remove a PCI device from device pool and mark its bar
+
+ @param PciDevice Instance of Pci device
+
+ @retval EFI_SUCCESS Success Operation
+ @retval EFI_ABORTED Pci device is a root bridge
+**/
EFI_STATUS
RejectPciDevice (
IN PCI_IO_DEVICE *PciDevice
)
-/**
-
-Routine Description:
-
- Remove a PCI device from device pool and mark its bar
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: PciDevice - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_ABORTED - add return value to function comment
{
PCI_IO_DEVICE *Bridge;
PCI_IO_DEVICE *Temp;
@@ -805,24 +735,17 @@ Returns:
return EFI_ABORTED;
}
+/**
+ Determine whethter a PCI device can be rejected
+
+ @param PciResNode Pointer to Pci resource node instance
+
+ @return whethter a PCI device can be rejected
+**/
BOOLEAN
IsRejectiveDevice (
IN PCI_RESOURCE_NODE *PciResNode
)
-/**
-
-Routine Description:
-
- Determine whethter a PCI device can be rejected
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: PciResNode - add argument and description to function comment
{
PCI_IO_DEVICE *Temp;
@@ -859,26 +782,19 @@ Returns:
return TRUE;
}
+/**
+ Compare two resource node and get the larger resource consumer
+
+ @param PciResNode1 resource node 1 want to be compared
+ @param PciResNode2 resource node 2 want to be compared
+
+ @return Larger resource consumer.
+**/
PCI_RESOURCE_NODE *
GetLargerConsumerDevice (
IN PCI_RESOURCE_NODE *PciResNode1,
IN PCI_RESOURCE_NODE *PciResNode2
)
-/**
-
-Routine Description:
-
- Get the larger resource consumer
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: PciResNode1 - add argument and description to function comment
-// TODO: PciResNode2 - add argument and description to function comment
{
if (!PciResNode2) {
return PciResNode1;
@@ -902,24 +818,18 @@ Returns:
}
+
+/**
+ Get the max resource consumer in the host resource pool
+
+ @param ResPool Pointer to resource pool node
+
+ @return the max resource consumer in the host resource pool
+**/
PCI_RESOURCE_NODE *
GetMaxResourceConsumerDevice (
IN PCI_RESOURCE_NODE *ResPool
)
-/**
-
-Routine Description:
-
- Get the max resource consumer in the host resource pool
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: ResPool - add argument and description to function comment
{
PCI_RESOURCE_NODE *Temp;
LIST_ENTRY *CurrentLink;
@@ -953,6 +863,20 @@ Returns:
return PciResNode;
}
+/**
+ Adjust host bridge allocation so as to reduce resource requirement
+
+ @param IoPool Pointer to instance of I/O resource Node
+ @param Mem32Pool Pointer to instance of 32-bit memory resource Node
+ @param PMem32Pool Pointer to instance of 32-bit Pmemory resource node
+ @param Mem64Pool Pointer to instance of 64-bit memory resource node
+ @param PMem64Pool Pointer to instance of 64-bit Pmemory resource node
+ @param IoResStatus Status of I/O resource Node
+ @param Mem32ResStatus Status of 32-bit memory resource Node
+ @param PMem32ResStatus Status of 32-bit Pmemory resource node
+ @param Mem64ResStatus Status of 64-bit memory resource node
+ @param PMem64ResStatus Status of 64-bit Pmemory resource node
+**/
EFI_STATUS
PciHostBridgeAdjustAllocation (
IN PCI_RESOURCE_NODE *IoPool,
@@ -966,32 +890,6 @@ PciHostBridgeAdjustAllocation (
IN UINT64 Mem64ResStatus,
IN UINT64 PMem64ResStatus
)
-/**
-
-Routine Description:
-
- Adjust host bridge allocation so as to reduce resource requirement
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: IoPool - add argument and description to function comment
-// TODO: Mem32Pool - add argument and description to function comment
-// TODO: PMem32Pool - add argument and description to function comment
-// TODO: Mem64Pool - add argument and description to function comment
-// TODO: PMem64Pool - add argument and description to function comment
-// TODO: IoResStatus - add argument and description to function comment
-// TODO: Mem32ResStatus - add argument and description to function comment
-// TODO: PMem32ResStatus - add argument and description to function comment
-// TODO: Mem64ResStatus - add argument and description to function comment
-// TODO: PMem64ResStatus - add argument and description to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_ABORTED - add return value to function comment
{
BOOLEAN AllocationAjusted;
PCI_RESOURCE_NODE *PciResNode;
@@ -1098,6 +996,18 @@ Returns:
}
}
+/**
+ Summary requests for all resource type, and contruct ACPI resource
+ requestor instance.
+
+ @param Bridge detecting bridge
+ @param IoNode Pointer to instance of I/O resource Node
+ @param Mem32Node Pointer to instance of 32-bit memory resource Node
+ @param PMem32Node Pointer to instance of 32-bit Pmemory resource node
+ @param Mem64Node Pointer to instance of 64-bit memory resource node
+ @param PMem64Node Pointer to instance of 64-bit Pmemory resource node
+ @param pConfig outof buffer holding new constructed APCI resource requestor
+**/
EFI_STATUS
ConstructAcpiResourceRequestor (
IN PCI_IO_DEVICE *Bridge,
@@ -1108,27 +1018,6 @@ ConstructAcpiResourceRequestor (
IN PCI_RESOURCE_NODE *PMem64Node,
OUT VOID **pConfig
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: Bridge - add argument and description to function comment
-// TODO: IoNode - add argument and description to function comment
-// TODO: Mem32Node - add argument and description to function comment
-// TODO: PMem32Node - add argument and description to function comment
-// TODO: Mem64Node - add argument and description to function comment
-// TODO: PMem64Node - add argument and description to function comment
-// TODO: pConfig - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
UINT8 NumConfig;
UINT8 Aperture;
@@ -1345,6 +1234,18 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Get resource base from a acpi configuration descriptor.
+
+ @param pConfig an acpi configuration descriptor.
+ @param IoBase output of I/O resource base address
+ @param Mem32Base output of 32-bit memory base address
+ @param PMem32Base output of 32-bit pmemory base address
+ @param Mem64Base output of 64-bit memory base address
+ @param PMem64Base output of 64-bit pmemory base address
+
+ @return EFI_SUCCESS Success operation
+**/
EFI_STATUS
GetResourceBase (
IN VOID *pConfig,
@@ -1354,24 +1255,6 @@ GetResourceBase (
OUT UINT64 *Mem64Base,
OUT UINT64 *PMem64Base
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: pConfig - add argument and description to function comment
-// TODO: IoBase - add argument and description to function comment
-// TODO: Mem32Base - add argument and description to function comment
-// TODO: PMem32Base - add argument and description to function comment
-// TODO: Mem64Base - add argument and description to function comment
-// TODO: PMem64Base - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
UINT8 *Temp;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
@@ -1444,23 +1327,19 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Enumerate pci bridge, allocate resource and determine attribute
+ for devices on this bridge
+
+ @param BridgeDev Pointer to instance of bridge device
+
+ @retval EFI_SUCCESS Success operation
+ @retval Others Fail to enumerate
+**/
EFI_STATUS
PciBridgeEnumerator (
IN PCI_IO_DEVICE *BridgeDev
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: BridgeDev - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
UINT8 SubBusNumber;
UINT8 StartBusNumber;
@@ -1508,23 +1387,18 @@ Returns:
}
+/**
+ Allocate all kinds of resource for bridge
+
+ @param Bridge Pointer to bridge instance
+
+ @retval EFI_SUCCESS Success operation.
+ @retval Others Fail to allocate resource for bridge
+**/
EFI_STATUS
PciBridgeResourceAllocator (
IN PCI_IO_DEVICE *Bridge
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: Bridge - add argument and description to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
PCI_RESOURCE_NODE *IoBridge;
PCI_RESOURCE_NODE *Mem32Bridge;
@@ -1667,6 +1541,18 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Get resource base address for a pci bridge device
+
+ @param Bridge Given Pci driver instance
+ @param IoBase output for base address of I/O type resource
+ @param Mem32Base output for base address of 32-bit memory type resource
+ @param PMem32Base output for base address of 32-bit Pmemory type resource
+ @param Mem64Base output for base address of 64-bit memory type resource
+ @param PMem64Base output for base address of 64-bit Pmemory type resource
+
+ @retval EFI_SUCCESS Succes to get resource base address
+**/
EFI_STATUS
GetResourceBaseFromBridge (
IN PCI_IO_DEVICE *Bridge,
@@ -1676,25 +1562,6 @@ GetResourceBaseFromBridge (
OUT UINT64 *Mem64Base,
OUT UINT64 *PMem64Base
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: Bridge - add argument and description to function comment
-// TODO: IoBase - add argument and description to function comment
-// TODO: Mem32Base - add argument and description to function comment
-// TODO: PMem32Base - add argument and description to function comment
-// TODO: Mem64Base - add argument and description to function comment
-// TODO: PMem64Base - add argument and description to function comment
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
if (!Bridge->Allocated) {
return EFI_OUT_OF_RESOURCES;
@@ -1761,26 +1628,73 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ 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.
+
+ @param[in] This The instance pointer of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
+ @param[in] Phase The phase during enumeration
+
+ @retval 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
+ @retval EFI_DEVICE_ERROR Programming failed due to a hardware error. This error is valid
+ for a Phase of EfiPciHostBridgeSetResources.
+ @retval EFI_INVALID_PARAMETER Invalid phase parameter
+ @retval 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.
+ @retval EFI_SUCCESS The notification was accepted without any errors.
+
+**/
EFI_STATUS
NotifyPhase (
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc,
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: PciResAlloc - add argument and description to function comment
-// TODO: Phase - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_HANDLE HostBridgeHandle;
EFI_HANDLE RootBridgeHandle;
@@ -1842,6 +1756,33 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ 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.
+
+ @param This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
+ @param RootBridgeHandle The associated PCI root bridge handle. Type EFI_HANDLE is defined in
+ InstallProtocolInterface() in the UEFI 2.0 Specification.
+ @param PciAddress The address of the PCI device on the PCI bus. This address can be passed to the
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL member functions to access the PCI
+ configuration space of the device. See Table 12-1 in the UEFI 2.0 Specification for
+ the definition of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS.
+ @param Phase The phase of the PCI device enumeration.
+
+ @retval EFI_SUCCESS The requested parameters were returned.
+ @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
+ @retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
+ EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
+ @retval 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.
+
+**/
EFI_STATUS
PreprocessController (
IN PCI_IO_DEVICE *Bridge,
@@ -1850,24 +1791,6 @@ PreprocessController (
IN UINT8 Func,
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: Bridge - add argument and description to function comment
-// TODO: Bus - add argument and description to function comment
-// TODO: Device - add argument and description to function comment
-// TODO: Func - add argument and description to function comment
-// TODO: Phase - add argument and description to function comment
-// TODO: EFI_UNSUPPORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS RootBridgePciAddress;
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc;
@@ -1949,6 +1872,19 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Hot plug request notify.
+
+ @param This - A pointer to the hot plug request protocol.
+ @param Operation - The operation.
+ @param Controller - A pointer to the controller.
+ @param RemainningDevicePath - A pointer to the device path.
+ @param NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
+ @param ChildHandleBuffer - A pointer to the array contain the child handle.
+
+ @retval EFI_NOT_FOUND Can not find bridge according to controller handle
+ @retval EFI_SUCCESS Success operating
+**/
EFI_STATUS
EFIAPI
PciHotPlugRequestNotify (
@@ -1959,31 +1895,6 @@ PciHotPlugRequestNotify (
IN OUT UINT8 *NumberOfChildren,
IN OUT EFI_HANDLE * ChildHandleBuffer
)
-/**
-
-Routine Description:
-
- Hot plug request notify.
-
-Arguments:
-
- This - A pointer to the hot plug request protocol.
- Operation - The operation.
- Controller - A pointer to the controller.
- RemainningDevicePath - A pointer to the device path.
- NumberOfChildren - A the number of child handle in the ChildHandleBuffer.
- ChildHandleBuffer - A pointer to the array contain the child handle.
-
-Returns:
-
- Status code.
-
-**/
-// TODO: RemainingDevicePath - add argument and description to function comment
-// TODO: EFI_NOT_FOUND - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
PCI_IO_DEVICE *Bridge;
PCI_IO_DEVICE *Temp;
@@ -2074,22 +1985,15 @@ Returns:
return EFI_SUCCESS;
}
+/**
+ Search hostbridge according to given handle
+
+ @return whether found
+**/
BOOLEAN
SearchHostBridgeHandle (
IN EFI_HANDLE RootBridgeHandle
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: RootBridgeHandle - add argument and description to function comment
{
EFI_HANDLE HostBridgeHandle;
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
@@ -2122,25 +2026,15 @@ Returns:
return FALSE;
}
+/**
+ Add host bridge handle to global variable for enumating.
+
+ @param HostBridgeHandle host bridge handle
+**/
EFI_STATUS
AddHostBridgeEnumerator (
IN EFI_HANDLE HostBridgeHandle
)
-/**
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
- None
-
-**/
-// TODO: HostBridgeHandle - add argument and description to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-// TODO: EFI_ABORTED - add return value to function comment
-// TODO: EFI_SUCCESS - add return value to function comment
{
UINTN Index;
@@ -2161,3 +2055,4 @@ Returns:
return EFI_SUCCESS;
}
+