/* Locate a capability instance in the parsed capabilities lists. */
RETURN_STATUS EFIAPI PciCapListFindCap(IN PCI_CAP_LIST *CapList, IN PCI_CAP_DOMAIN Domain, IN UINT16 CapId, IN UINT16 Instance, OUT PCI_CAP **Cap OPTIONAL)
/* Locate a capability instance in the parsed capabilities lists. */
RETURN_STATUS EFIAPI PciCapListFindCap(IN PCI_CAP_LIST *CapList, IN PCI_CAP_DOMAIN Domain, IN UINT16 CapId, IN UINT16 Instance, OUT PCI_CAP **Cap OPTIONAL)
{
  PCI_CAP_KEY               Key;
  ORDERED_COLLECTION_ENTRY  *PciCapEntry;
  Key.Domain   = Domain;
  Key.CapId    = CapId;
  Key.Instance = Instance;
  PciCapEntry = OrderedCollectionFind (CapList->Capabilities, &Key);
  if (PciCapEntry == NULL) {
    return RETURN_NOT_FOUND;
  }
  if (Cap != NULL) {
    *Cap = OrderedCollectionUserStruct (PciCapEntry);
  }
  return RETURN_SUCCESS;
}