Re: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib


IanX Kuo
 

@Dong, Eric, @Ni, Ray or @Kumar, Rahul1

Sorry to bother you.
May I get one of your approval for this patch ?

Thanks,
Ian Kuo

-----Original Message-----
From: Kuo, IanX <ianx.kuo@intel.com>
Sent: Sunday, October 17, 2021 6:34 AM
To: devel@edk2.groups.io
Cc: Chan, Amy <amy.chan@intel.com>; Ni, Ray <ray.ni@intel.com>; Kuo, IanX <ianx.kuo@intel.com>; Dong, Eric <eric.dong@intel.com>; Kumar, Rahul1 <rahul1.kumar@intel.com>
Subject: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

From: IanX Kuo <ianx.kuo@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675

Remove MdeModulePkg dependency

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: IanX Kuo <ianx.kuo@intel.com>
---
UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 8 +++++++-
UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf | 2 --
.../Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h | 1 -
UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf | 2 --
4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index c0077d6770..c7c72f68eb 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -282,6 +282,7 @@ CpuCacheInfoCollectCpuCacheInfoData (
UINTN LocalCacheInfoCount;

UINTN Index;

UINTN NextIndex;

+ VOID *QuickSortBuffer;



//

// Get number of Packages and Package ID.

@@ -369,7 +370,12 @@ CpuCacheInfoCollectCpuCacheInfoData (
//

// Sort LocalCacheInfo array by CPU package ID, core type, cache level and cache type.

//

- PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);

+ QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));

+ if (QuickSortBuffer == NULL) {

+ return EFI_OUT_OF_RESOURCES;

+ }

+

+ QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), CpuCacheInfoCompare, QuickSortBuffer);

CopyMem (CacheInfo, LocalCacheInfo, sizeof (*CacheInfo) * LocalCacheInfoCount);

DEBUG_CODE (

CpuCacheInfoPrintCpuCacheInfoTable (CacheInfo, LocalCacheInfoCount);

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf b/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
index c3d3f1e799..fdd79970f9 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
@@ -25,7 +25,6 @@


[Packages]

MdePkg/MdePkg.dec

- MdeModulePkg/MdeModulePkg.dec

UefiCpuPkg/UefiCpuPkg.dec



[LibraryClasses]

@@ -34,7 +33,6 @@
BaseMemoryLib

MemoryAllocationLib

UefiBootServicesTableLib

- SortLib



[Protocols]

gEfiMpServiceProtocolGuid

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h b/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h
index 26e1f46516..829a9f43ce 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h
@@ -17,7 +17,6 @@
#include <Library/DebugLib.h>

#include <Library/BaseMemoryLib.h>

#include <Library/MemoryAllocationLib.h>

-#include <Library/SortLib.h>

#include <Library/CpuCacheInfoLib.h>



typedef union {

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf b/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
index 0864497849..c643fc89be 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
@@ -25,7 +25,6 @@


[Packages]

MdePkg/MdePkg.dec

- MdeModulePkg/MdeModulePkg.dec

UefiCpuPkg/UefiCpuPkg.dec



[LibraryClasses]

@@ -34,7 +33,6 @@
BaseMemoryLib

MemoryAllocationLib

PeiServicesTablePointerLib

- SortLib



[Ppis]

gEdkiiPeiMpServices2PpiGuid

--
2.30.0.windows.1

Join devel@edk2.groups.io to automatically receive all group messages.