/* Calculate the MaxSizeHint member for a PCI_CAP object. */
STATIC VOID CalculatePciCapMaxSizeHint(IN OUT PCI_CAP *PciCap, IN PCI_CAP *NextPciCap OPTIONAL)
/* Calculate the MaxSizeHint member for a PCI_CAP object. */
STATIC VOID CalculatePciCapMaxSizeHint(IN OUT PCI_CAP *PciCap, IN PCI_CAP *NextPciCap OPTIONAL)
{
  UINT16  ConfigSpaceSize;
  ConfigSpaceSize = (PciCap->Key.Domain == PciCapNormal ?
                     PCI_MAX_CONFIG_OFFSET : PCI_EXP_MAX_CONFIG_OFFSET);
  ASSERT (NextPciCap == NULL || PciCap->Offset < NextPciCap->Offset);
  ASSERT (PciCap->Offset < ConfigSpaceSize);
  if ((NextPciCap == NULL) || (NextPciCap->Offset >= ConfigSpaceSize)) {
    PciCap->MaxSizeHint = ConfigSpaceSize - PciCap->Offset;
    return;
  }
  PciCap->MaxSizeHint = NextPciCap->Offset - PciCap->Offset;
}