/* Create a PCI_CAP_DEV object from the PCI Segment:Bus:Device.Function quadruplet. The config space accessors are based upon PciSegmentLib. */
RETURN_STATUS EFIAPI PciCapPciSegmentDeviceInit(IN PCI_CAP_DOMAIN MaxDomain, IN UINT16 Segment, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Function, OUT PCI_CAP_DEV **PciDevice)
/* Create a PCI_CAP_DEV object from the PCI Segment:Bus:Device.Function quadruplet. The config space accessors are based upon PciSegmentLib. */
RETURN_STATUS EFIAPI PciCapPciSegmentDeviceInit(IN PCI_CAP_DOMAIN MaxDomain, IN UINT16 Segment, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Function, OUT PCI_CAP_DEV **PciDevice)
{
  SEGMENT_DEV  *SegmentDev;
  if ((Device > PCI_MAX_DEVICE) || (Function > PCI_MAX_FUNC)) {
    return RETURN_INVALID_PARAMETER;
  }
  SegmentDev = AllocatePool (sizeof *SegmentDev);
  if (SegmentDev == NULL) {
    return RETURN_OUT_OF_RESOURCES;
  }
  SegmentDev->Signature              = SEGMENT_DEV_SIG;
  SegmentDev->MaxDomain              = MaxDomain;
  SegmentDev->SegmentNr              = Segment;
  SegmentDev->BusNr                  = Bus;
  SegmentDev->DeviceNr               = Device;
  SegmentDev->FunctionNr             = Function;
  SegmentDev->BaseDevice.ReadConfig  = SegmentDevReadConfig;
  SegmentDev->BaseDevice.WriteConfig = SegmentDevWriteConfig;
  *PciDevice = &SegmentDev->BaseDevice;
  return RETURN_SUCCESS;
}