/* Check whether an entry could be used to allocate space. */
EFI_STATUS CoreAllocateSpaceCheckEntry(IN UINTN Operation, IN EFI_GCD_MAP_ENTRY *Entry, IN EFI_GCD_MEMORY_TYPE GcdMemoryType, IN EFI_GCD_IO_TYPE GcdIoType)
/* Check whether an entry could be used to allocate space. */
EFI_STATUS CoreAllocateSpaceCheckEntry(IN UINTN Operation, IN EFI_GCD_MAP_ENTRY *Entry, IN EFI_GCD_MEMORY_TYPE GcdMemoryType, IN EFI_GCD_IO_TYPE GcdIoType)
{
  if (Entry->ImageHandle != NULL) {
    return EFI_NOT_FOUND;
  }
  switch (Operation) {
    case GCD_ALLOCATE_MEMORY_OPERATION:
      if (Entry->GcdMemoryType != GcdMemoryType) {
        return EFI_NOT_FOUND;
      }
      break;
    case GCD_ALLOCATE_IO_OPERATION:
      if (Entry->GcdIoType != GcdIoType) {
        return EFI_NOT_FOUND;
      }
      break;
    default:
      return EFI_UNSUPPORTED;
  }
  return EFI_SUCCESS;
}