/* Compare a standalone PCI_CAP_KEY against a PCI_CAP containing an embedded PCI_CAP_KEY. */
STATIC INTN EFIAPI ComparePciCapKey(IN CONST VOID *PciCapKey, IN CONST VOID *PciCap)
/* Compare a standalone PCI_CAP_KEY against a PCI_CAP containing an embedded PCI_CAP_KEY. */
STATIC INTN EFIAPI ComparePciCapKey(IN CONST VOID *PciCapKey, IN CONST VOID *PciCap)
{
  CONST PCI_CAP_KEY  *Key1;
  CONST PCI_CAP_KEY  *Key2;
  Key1 = PciCapKey;
  Key2 = &((CONST PCI_CAP *)PciCap)->Key;
  if (Key1->Domain < Key2->Domain) {
    return -1;
  }
  if (Key1->Domain > Key2->Domain) {
    return 1;
  }
  if (Key1->CapId < Key2->CapId) {
    return -1;
  }
  if (Key1->CapId > Key2->CapId) {
    return 1;
  }
  if (Key1->Instance < Key2->Instance) {
    return -1;
  }
  if (Key1->Instance > Key2->Instance) {
    return 1;
  }
  return 0;
}