/* This function is used to remove the whole PCI devices on the specified bridge from the root bridge. */
VOID RemoveAllPciDeviceOnBridge(EFI_HANDLE RootBridgeHandle, PCI_IO_DEVICE *Bridge)
/* This function is used to remove the whole PCI devices on the specified bridge from the root bridge. */
VOID RemoveAllPciDeviceOnBridge(EFI_HANDLE RootBridgeHandle, PCI_IO_DEVICE *Bridge)
{
  LIST_ENTRY     *CurrentLink;
  PCI_IO_DEVICE  *Temp;
  while (!IsListEmpty (&Bridge->ChildList)) {
    CurrentLink = Bridge->ChildList.ForwardLink;
    Temp        = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
    if (Temp->Registered) {
      DeRegisterPciDevice (RootBridgeHandle, Temp->Handle);
    }
    RemoveEntryList (CurrentLink);
    if (!IsListEmpty (&Temp->ChildList)) {
      RemoveAllPciDeviceOnBridge (RootBridgeHandle, Temp);
    }
    FreePciDevice (Temp);
  }
}