/* Get the total number of package and package ID in the platform. */
UINT32 CpuCacheInfoGetNumberOfPackages(IN CPUID_PROCESSOR_INFO *ProcessorInfo, IN UINTN NumberOfProcessors, IN OUT UINT32 *Package)
/* Get the total number of package and package ID in the platform. */
UINT32 CpuCacheInfoGetNumberOfPackages(IN CPUID_PROCESSOR_INFO *ProcessorInfo, IN UINTN NumberOfProcessors, IN OUT UINT32 *Package)
{
  UINTN   ProcessorIndex;
  UINT32  PackageIndex;
  UINT32  PackageCount;
  UINT32  CurrentPackage;
  PackageCount = 0;
  for (ProcessorIndex = 0; ProcessorIndex < NumberOfProcessors; ProcessorIndex++) {
    CurrentPackage = ProcessorInfo[ProcessorIndex].Package;
    for (PackageIndex = 0; PackageIndex < PackageCount; PackageIndex++) {
      if (CurrentPackage == Package[PackageIndex]) {
        break;
      }
    }
    if (PackageIndex == PackageCount) {
      ASSERT (PackageCount < MAX_NUM_OF_PACKAGE);
      Package[PackageCount++] = CurrentPackage;
    }
  }
  return PackageCount;
}