/* This function is used to program the resource allocated for each resource node under specified bridge. */
EFI_STATUS ProgramResource(IN UINT64 Base, IN PCI_RESOURCE_NODE *Bridge)
/* This function is used to program the resource allocated for each resource node under specified bridge. */
EFI_STATUS ProgramResource(IN UINT64 Base, IN PCI_RESOURCE_NODE *Bridge)
{
  LIST_ENTRY         *CurrentLink;
  PCI_RESOURCE_NODE  *Node;
  EFI_STATUS         Status;
  if (Base == gAllOne) {
    return EFI_OUT_OF_RESOURCES;
  }
  CurrentLink = Bridge->ChildList.ForwardLink;
  while (CurrentLink != &Bridge->ChildList) {
    Node = RESOURCE_NODE_FROM_LINK (CurrentLink);
    if (!IS_PCI_BRIDGE (&(Node->PciDev->Pci))) {
      if (IS_CARDBUS_BRIDGE (&(Node->PciDev->Pci))) {
        ProgramP2C (Base, Node);
      } else {
        ProgramBar (Base, Node);
      }
    } else {
      Status = ProgramResource (Base + Node->Offset, Node);
      if (EFI_ERROR (Status)) {
        return Status;
      }
      ProgramPpbApperture (Base, Node);
    }
    CurrentLink = CurrentLink->ForwardLink;
  }
  return EFI_SUCCESS;
}