summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxieyuanh <yuanhao.xie@intel.com>2024-06-18 19:59:56 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-06-21 02:44:34 +0000
commitd512bd31293c7f2aeef9b60fb6f112d0e90adff3 (patch)
tree65618a3a68b1e7d752be5413b4052b101391c608
parent57a890fd03356350a1b7a2a0064c8118f44e9958 (diff)
downloadedk2-d512bd31293c7f2aeef9b60fb6f112d0e90adff3.zip
edk2-d512bd31293c7f2aeef9b60fb6f112d0e90adff3.tar.gz
edk2-d512bd31293c7f2aeef9b60fb6f112d0e90adff3.tar.bz2
UefiCpuPkg: Correct the count of different type of Cache.
This patch fixes an error in calculating cache sizes for cores from different Dies. The original code incorrectly cleared cache sizes for different core types during intermediate calculation steps, leading to mistakes in counting duplicate entries. This patch adds a check for cache size to distinguish between different cache types. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: xieyuanh <yuanhao.xie@intel.com>
-rw-r--r--UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index c797373..df07a10 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -348,7 +348,8 @@ CpuCacheInfoCollectCpuCacheInfoData (
if ((LocalCacheInfo[CacheInfoIndex].Package == ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].Package) &&
(LocalCacheInfo[CacheInfoIndex].CoreType == ProcessorInfo[Index / MAX_NUM_OF_CACHE_PARAMS_LEAF].CoreType) &&
(LocalCacheInfo[CacheInfoIndex].CacheLevel == CacheData[Index].CacheLevel) &&
- (LocalCacheInfo[CacheInfoIndex].CacheType == CacheData[Index].CacheType))
+ (LocalCacheInfo[CacheInfoIndex].CacheType == CacheData[Index].CacheType) &&
+ (LocalCacheInfo[CacheInfoIndex].CacheSizeinKB == CacheData[Index].CacheSizeinKB))
{
LocalCacheInfo[CacheInfoIndex].CacheCount++;
break;