/* Get the number of CoreType of requested package. */
UINTN CpuCacheInfoGetNumberOfCoreTypePerPackage(IN CPUID_PROCESSOR_INFO *ProcessorInfo, IN UINTN NumberOfProcessors, IN UINTN Package)
/* Get the number of CoreType of requested package. */
UINTN CpuCacheInfoGetNumberOfCoreTypePerPackage(IN CPUID_PROCESSOR_INFO *ProcessorInfo, IN UINTN NumberOfProcessors, IN UINTN Package)
{
  UINTN  ProcessorIndex;
  UINT8  CoreType[MAX_UINT8];
  UINTN  CoreTypeIndex;
  UINTN  CoreTypeCount;
  UINT8  CurrentCoreType;
  CoreTypeCount = 0;
  for (ProcessorIndex = 0; ProcessorIndex < NumberOfProcessors; ProcessorIndex++) {
    CurrentCoreType = ProcessorInfo[ProcessorIndex].CoreType;
    if (ProcessorInfo[ProcessorIndex].Package != Package) {
      continue;
    }
    for (CoreTypeIndex = 0; CoreTypeIndex < CoreTypeCount; CoreTypeIndex++) {
      if (CurrentCoreType == CoreType[CoreTypeIndex]) {
        break;
      }
    }
    if (CoreTypeIndex == CoreTypeCount) {
      ASSERT (CoreTypeCount < MAX_UINT8);
      CoreType[CoreTypeCount++] = CurrentCoreType;
    }
  }
  return CoreTypeCount;
}