//\r
LIST_ENTRY gPciDevicePool;\r
\r
+/**\r
+ Initialize the gPciDevicePool\r
+**/\r
EFI_STATUS\r
InitializePciDevicePool (\r
VOID\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
- Initialize the gPciDevicePool\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
{\r
InitializeListHead (&gPciDevicePool);\r
\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-InsertRootBridge (\r
- PCI_IO_DEVICE *RootBridge\r
- )\r
/**\r
-\r
-Routine Description:\r
-\r
Insert a root bridge into PCI device pool\r
\r
-Arguments:\r
-\r
- RootBridge - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
+ @param RootBridge - A pointer to the PCI_IO_DEVICE.\r
\r
**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
+EFI_STATUS\r
+InsertRootBridge (\r
+ PCI_IO_DEVICE *RootBridge\r
+ )\r
{\r
\r
InsertTailList (&gPciDevicePool, &(RootBridge->Link));\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-InsertPciDevice (\r
- PCI_IO_DEVICE *Bridge,\r
- PCI_IO_DEVICE *PciDeviceNode\r
- )\r
/**\r
-\r
-Routine Description:\r
-\r
This function is used to insert a PCI device node under\r
a bridge\r
\r
-Arguments:\r
- Bridge - A pointer to the PCI_IO_DEVICE.\r
- PciDeviceNode - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
+ @param Bridge A pointer to the PCI_IO_DEVICE.\r
+ @param PciDeviceNode A pointer to the PCI_IO_DEVICE.\r
\r
**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
+EFI_STATUS\r
+InsertPciDevice (\r
+ PCI_IO_DEVICE *Bridge,\r
+ PCI_IO_DEVICE *PciDeviceNode\r
+ )\r
{\r
\r
InsertTailList (&Bridge->ChildList, &(PciDeviceNode->Link));\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Destroy root bridge and remove it from deivce tree.\r
+ \r
+ @param RootBridge The bridge want to be removed\r
+ \r
+**/\r
EFI_STATUS\r
DestroyRootBridge (\r
IN PCI_IO_DEVICE *RootBridge\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
-\r
-Arguments:\r
-\r
- RootBridge - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
{\r
DestroyPciDeviceTree (RootBridge);\r
\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-FreePciDevice (\r
- IN PCI_IO_DEVICE *PciIoDevice\r
- )\r
/**\r
-\r
-Routine Description:\r
-\r
Destroy a pci device node.\r
Also all direct or indirect allocated resource for this node will be freed.\r
\r
-Arguments:\r
-\r
- PciIoDevice - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
+ @param PciIoDevice A pointer to the PCI_IO_DEVICE.\r
\r
**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
+EFI_STATUS\r
+FreePciDevice (\r
+ IN PCI_IO_DEVICE *PciIoDevice\r
+ )\r
{\r
\r
//\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-DestroyPciDeviceTree (\r
- IN PCI_IO_DEVICE *Bridge\r
- )\r
/**\r
-\r
-Routine Description:\r
-\r
Destroy all the pci device node under the bridge.\r
Bridge itself is not included.\r
\r
-Arguments:\r
-\r
- Bridge - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
+ @param Bridge A pointer to the PCI_IO_DEVICE.\r
\r
**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
+EFI_STATUS\r
+DestroyPciDeviceTree (\r
+ IN PCI_IO_DEVICE *Bridge\r
+ )\r
{\r
LIST_ENTRY *CurrentLink;\r
PCI_IO_DEVICE *Temp;\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-DestroyRootBridgeByHandle (\r
- EFI_HANDLE Controller\r
- )\r
/**\r
-\r
-Routine Description:\r
-\r
Destroy all device nodes under the root bridge\r
specified by Controller.\r
The root bridge itself is also included.\r
\r
-Arguments:\r
-\r
- Controller - An efi handle.\r
-\r
-Returns:\r
-\r
- None\r
+ @param Controller An efi handle.\r
\r
**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-// TODO: EFI_NOT_FOUND - add return value to function comment\r
+EFI_STATUS\r
+DestroyRootBridgeByHandle (\r
+ EFI_HANDLE Controller\r
+ )\r
{\r
\r
LIST_ENTRY *CurrentLink;\r
return EFI_NOT_FOUND;\r
}\r
\r
-EFI_STATUS\r
-RegisterPciDevice (\r
- IN EFI_HANDLE Controller,\r
- IN PCI_IO_DEVICE *PciIoDevice,\r
- OUT EFI_HANDLE *Handle OPTIONAL\r
- )\r
/**\r
-\r
-Routine Description:\r
-\r
This function registers the PCI IO device. It creates a handle for this PCI IO device\r
(if the handle does not exist), attaches appropriate protocols onto the handle, does\r
necessary initialization, and sets up parent/child relationship with its bus controller.\r
\r
-Arguments:\r
-\r
- Controller - An EFI handle for the PCI bus controller.\r
- PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r
- Handle - A pointer to hold the EFI handle for the PCI IO device.\r
-\r
-Returns:\r
+ @param Controller - An EFI handle for the PCI bus controller.\r
+ @param PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r
+ @param Handle - A pointer to hold the EFI handle for the PCI IO device.\r
\r
- EFI_SUCCESS - The PCI device is successfully registered.\r
- Others - An error occurred when registering the PCI device.\r
+ @retval EFI_SUCCESS - The PCI device is successfully registered.\r
+ @retval Others - An error occurred when registering the PCI device.\r
\r
**/\r
+EFI_STATUS\r
+RegisterPciDevice (\r
+ IN EFI_HANDLE Controller,\r
+ IN PCI_IO_DEVICE *PciIoDevice,\r
+ OUT EFI_HANDLE *Handle OPTIONAL\r
+ )\r
{\r
EFI_STATUS Status;\r
VOID *PlatformOpRomBuffer;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ This function is used to remove the whole PCI devices from the bridge.\r
+\r
+ @param RootBridgeHandle An efi handle.\r
+ @param Bridge A pointer to the PCI_IO_DEVICE.\r
+\r
+ @retval EFI_SUCCESS\r
+**/\r
EFI_STATUS\r
RemoveAllPciDeviceOnBridge (\r
EFI_HANDLE RootBridgeHandle,\r
PCI_IO_DEVICE *Bridge\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
- This function is used to remove the whole PCI devices from the bridge.\r
-\r
-Arguments:\r
\r
- RootBridgeHandle - An efi handle.\r
- Bridge - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
{\r
\r
LIST_ENTRY *CurrentLink;\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-DeRegisterPciDevice (\r
- IN EFI_HANDLE Controller,\r
- IN EFI_HANDLE Handle\r
- )\r
/**\r
\r
-Routine Description:\r
-\r
This function is used to de-register the PCI device from the EFI,\r
That includes un-installing PciIo protocol from the specified PCI\r
device handle.\r
\r
-Arguments:\r
-\r
- Controller - An efi handle.\r
- Handle - An efi handle.\r
-\r
-Returns:\r
-\r
- None\r
+ @param Controller - controller handle\r
+ @param Handle - device handle\r
\r
+ @return Status of de-register pci device\r
**/\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
+EFI_STATUS\r
+DeRegisterPciDevice (\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_HANDLE Handle\r
+ )\r
+\r
{\r
EFI_PCI_IO_PROTOCOL *PciIo;\r
EFI_STATUS Status;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge\r
+\r
+ @param Controller An efi handle.\r
+ @param RootBridge A pointer to the PCI_IO_DEVICE.\r
+ @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.\r
+ @param NumberOfChildren Children number.\r
+ @param ChildHandleBuffer A pointer to the child handle buffer.\r
+\r
+ @retval EFI_NOT_READY Device is not allocated\r
+ @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.\r
+ @retval EFI_NOT_FOUND Can not find the specific device\r
+ @retval EFI_SUCCESS Success to start Pci device on bridge\r
+\r
+**/\r
EFI_STATUS\r
StartPciDevicesOnBridge (\r
IN EFI_HANDLE Controller,\r
IN OUT UINT8 *NumberOfChildren,\r
IN OUT EFI_HANDLE *ChildHandleBuffer\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
- Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge\r
-\r
-Arguments:\r
-\r
- Controller - An efi handle.\r
- RootBridge - A pointer to the PCI_IO_DEVICE.\r
- RemainingDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCOL.\r
- NumberOfChildren - Children number.\r
- ChildHandleBuffer - A pointer to the child handle buffer.\r
\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
-// TODO: EFI_NOT_READY - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-// TODO: EFI_UNSUPPORTED - add return value to function comment\r
-// TODO: EFI_NOT_FOUND - add return value to function comment\r
{\r
PCI_IO_DEVICE *PciIoDevice;\r
EFI_DEV_PATH_PTR Node;\r
return EFI_NOT_FOUND;\r
}\r
\r
-EFI_STATUS\r
-StartPciDevices (\r
- IN EFI_HANDLE Controller\r
- )\r
/**\r
-\r
-Routine Description:\r
-\r
Start to manage all the PCI devices it found previously under \r
the entire host bridge.\r
\r
-Arguments:\r
- Controller - root bridge handle.\r
-\r
-Returns:\r
-\r
- None\r
+ @param Controller - root bridge handle.\r
\r
**/\r
+EFI_STATUS\r
+StartPciDevices (\r
+ IN EFI_HANDLE Controller\r
+ )\r
+\r
{\r
PCI_IO_DEVICE *RootBridge;\r
EFI_HANDLE ThisHostBridge;\r
return EFI_SUCCESS;\r
}\r
\r
-PCI_IO_DEVICE *\r
-CreateRootBridge (\r
- IN EFI_HANDLE RootBridgeHandle\r
- )\r
/**\r
+ Create root bridge device\r
\r
-Routine Description:\r
-\r
-\r
-Arguments:\r
- RootBridgeHandle - An efi handle.\r
-\r
-Returns:\r
-\r
- None\r
+ @param RootBridgeHandle - Parent bridge handle.\r
\r
+ @return pointer to new root bridge \r
**/\r
+PCI_IO_DEVICE *\r
+CreateRootBridge (\r
+ IN EFI_HANDLE RootBridgeHandle\r
+ )\r
{\r
\r
EFI_STATUS Status;\r
return Dev;\r
}\r
\r
-PCI_IO_DEVICE *\r
-GetRootBridgeByHandle (\r
- EFI_HANDLE RootBridgeHandle\r
- )\r
/**\r
+ Get root bridge device instance by specific handle\r
\r
-Routine Description:\r
-\r
-\r
-Arguments:\r
-\r
- RootBridgeHandle - An efi handle.\r
-\r
-Returns:\r
-\r
- None\r
+ @param RootBridgeHandle Given root bridge handle\r
\r
+ @return root bridge device instance\r
**/\r
+PCI_IO_DEVICE *\r
+GetRootBridgeByHandle (\r
+ EFI_HANDLE RootBridgeHandle\r
+ )\r
{\r
PCI_IO_DEVICE *RootBridgeDev;\r
LIST_ENTRY *CurrentLink;\r
return NULL;\r
}\r
\r
+/**\r
+ Judege whether Pci device existed\r
+ \r
+ @param Bridge Parent bridege instance \r
+ @param PciIoDevice Device instance\r
+ \r
+ @return whether Pci device existed\r
+**/\r
BOOLEAN\r
PciDeviceExisted (\r
IN PCI_IO_DEVICE *Bridge,\r
IN PCI_IO_DEVICE *PciIoDevice\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
- Bridge - A pointer to the PCI_IO_DEVICE.\r
- PciIoDevice - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
{\r
\r
PCI_IO_DEVICE *Temp;\r
return FALSE;\r
}\r
\r
+/**\r
+ Active VGA device\r
+ \r
+ @param VgaDevice device instance for VGA\r
+ \r
+ @return device instance\r
+**/\r
PCI_IO_DEVICE *\r
ActiveVGADeviceOnTheSameSegment (\r
IN PCI_IO_DEVICE *VgaDevice\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
- VgaDevice - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
{\r
LIST_ENTRY *CurrentLink;\r
PCI_IO_DEVICE *Temp;\r
return NULL;\r
}\r
\r
+/**\r
+ Active VGA device on root bridge\r
+ \r
+ @param RootBridge Root bridge device instance\r
+ \r
+ @return VGA device instance\r
+**/\r
PCI_IO_DEVICE *\r
ActiveVGADeviceOnTheRootBridge (\r
IN PCI_IO_DEVICE *RootBridge\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
- RootBridge - A pointer to the PCI_IO_DEVICE.\r
-\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
{\r
LIST_ENTRY *CurrentLink;\r
PCI_IO_DEVICE *Temp;\r
return NULL;\r
}\r
\r
+/**\r
+ Get HPC PCI address according to its device path\r
+ @param PciRootBridgeIo Root bridege Io instance\r
+ @param HpcDevicePath Given searching device path\r
+ @param PciAddress Buffer holding searched result\r
+ \r
+ @retval EFI_NOT_FOUND Can not find the specific device path.\r
+ @retval EFI_SUCCESS Success to get the device path\r
+**/\r
EFI_STATUS\r
GetHpcPciAddress (\r
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r
IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,\r
OUT UINT64 *PciAddress\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
- PciRootBridgeIo - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
- HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCL.\r
- PciAddress - A pointer to the pci address.\r
-\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
-// TODO: EFI_NOT_FOUND - add return value to function comment\r
-// TODO: EFI_NOT_FOUND - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-// TODO: EFI_NOT_FOUND - add return value to function comment\r
{\r
EFI_DEVICE_PATH_PROTOCOL *CurrentDevicePath;\r
EFI_DEV_PATH_PTR Node;\r
return EFI_NOT_FOUND;\r
}\r
\r
+/**\r
+ Get HPC PCI address according to its device path\r
+ @param RootBridge Root bridege Io instance\r
+ @param RemainingDevicePath Given searching device path\r
+ @param PciAddress Buffer holding searched result\r
+ \r
+ @retval EFI_NOT_FOUND Can not find the specific device path.\r
+**/\r
EFI_STATUS\r
GetHpcPciAddressFromRootBridge (\r
IN PCI_IO_DEVICE *RootBridge,\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,\r
OUT UINT64 *PciAddress\r
)\r
-/**\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
- PciRootBridgeIo - A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
- HpcDevicePath - A pointer to the EFI_DEVICE_PATH_PROTOCL.\r
- PciAddress - A pointer to the pci address.\r
-\r
-Returns:\r
-\r
- None\r
-\r
-**/\r
-// TODO: RootBridge - add argument and description to function comment\r
-// TODO: RemainingDevicePath - add argument and description to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-// TODO: EFI_NOT_FOUND - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
{\r
EFI_DEV_PATH_PTR Node;\r
PCI_IO_DEVICE *Temp;\r
return EFI_SUCCESS;\r
\r
}\r
+\r