/* This routine is used to check whether the pci device is present. */
EFI_STATUS PciDevicePresent(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OUT PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
/* This routine is used to check whether the pci device is present. */
EFI_STATUS PciDevicePresent(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OUT PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
{
  UINT64      Address;
  EFI_STATUS  Status;
  Address = EFI_PCI_ADDRESS (Bus, Device, Func, 0);
  Status = PciRootBridgeIo->Pci.Read (
                                  PciRootBridgeIo,
                                  EfiPciWidthUint32,
                                  Address,
                                  1,
                                  Pci
                                  );
  if (!EFI_ERROR (Status) && ((Pci->Hdr).VendorId != 0xffff)) {
    Status = PciRootBridgeIo->Pci.Read (
                                    PciRootBridgeIo,
                                    EfiPciWidthUint32,
                                    Address,
                                    sizeof (PCI_TYPE00) / sizeof (UINT32),
                                    Pci
                                    );
    return EFI_SUCCESS;
  }
  return EFI_NOT_FOUND;
}