/* Find the corresponding resource node for the Device in child list of BridgeResource. */
UINTN FindResourceNode(IN PCI_IO_DEVICE *Device, IN PCI_RESOURCE_NODE *BridgeResource, OUT PCI_RESOURCE_NODE **DeviceResources OPTIONAL)
/* Find the corresponding resource node for the Device in child list of BridgeResource. */
UINTN FindResourceNode(IN PCI_IO_DEVICE *Device, IN PCI_RESOURCE_NODE *BridgeResource, OUT PCI_RESOURCE_NODE **DeviceResources OPTIONAL)
{
  LIST_ENTRY         *Link;
  PCI_RESOURCE_NODE  *Resource;
  UINTN              Count;
  Count = 0;
  for ( Link = BridgeResource->ChildList.ForwardLink
        ; Link != &BridgeResource->ChildList
        ; Link = Link->ForwardLink
        )
  {
    Resource = RESOURCE_NODE_FROM_LINK (Link);
    if (Resource->PciDev == Device) {
      if (DeviceResources != NULL) {
        DeviceResources[Count] = Resource;
      }
      Count++;
    }
  }
  return Count;
}