/* This internal function retrieves PCI CFG2 PPI from PPI database. */
EFI_PEI_PCI_CFG2_PPI* InternalGetPciCfg2Ppi(IN UINT64 Address)
/* This internal function retrieves PCI CFG2 PPI from PPI database. */
EFI_PEI_PCI_CFG2_PPI* InternalGetPciCfg2Ppi(IN UINT64 Address)
{
  EFI_STATUS            Status;
  UINTN                 Instance;
  EFI_PEI_PCI_CFG2_PPI  *PciCfg2Ppi;
  UINT64                SegmentNumber;
  Instance      = 0;
  PciCfg2Ppi    = NULL;
  SegmentNumber = BitFieldRead64 (Address, 32, 63);
  do {
    Status = PeiServicesLocatePpi (
               &gEfiPciCfg2PpiGuid,
               Instance,
               NULL,
               (VOID **)&PciCfg2Ppi
               );
    ASSERT_EFI_ERROR (Status);
    Instance++;
  } while (PciCfg2Ppi->Segment != SegmentNumber);
  return PciCfg2Ppi;
}