From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.10228.1634308437665760576 for ; Fri, 15 Oct 2021 07:34:00 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: ianx.kuo@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10137"; a="228203320" X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="228203320" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 07:33:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,375,1624345200"; d="scan'208";a="481712690" Received: from ikuox-desk1.gar.corp.intel.com ([10.227.107.18]) by orsmga007.jf.intel.com with ESMTP; 15 Oct 2021 07:33:56 -0700 From: "IanX Kuo" To: devel@edk2.groups.io Cc: amy.chan@intel.com, ray.ni@intel.com, IanX Kuo , Eric Dong , Rahul Kumar Subject: [PATCH v1 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib Date: Fri, 15 Oct 2021 22:33:46 +0800 Message-Id: <20211015143346.31-4-ianx.kuo@intel.com> X-Mailer: git-send-email 2.30.0.windows.1 In-Reply-To: <20211015143346.31-1-ianx.kuo@intel.com> References: <20211015143346.31-1-ianx.kuo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: IanX Kuo REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3675 Remove MdeModulePkg dependency Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Signed-off-by: IanX Kuo --- UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 5 ++++- UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf | 2 -- UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h | 1 - UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c b/UefiCpu= Pkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c index c0077d6770..b5ed05bd43 100644 --- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c @@ -282,6 +282,7 @@ CpuCacheInfoCollectCpuCacheInfoData ( UINTN LocalCacheInfoCount;=0D UINTN Index;=0D UINTN NextIndex;=0D + VOID *QuickSortBuffer;=0D =0D //=0D // Get number of Packages and Package ID.=0D @@ -369,7 +370,9 @@ CpuCacheInfoCollectCpuCacheInfoData ( //=0D // Sort LocalCacheInfo array by CPU package ID, core type, cache level= and cache type.=0D //=0D - PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalC= acheInfo), (SORT_COMPARE) CpuCacheInfoCompare);=0D + QuickSortBuffer =3D AllocateZeroPool (sizeof (*LocalCacheInfo));=0D + ASSERT (QuickSortBuffer !=3D NULL);=0D + QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInf= o), (BASE_SORT_COMPARE) CpuCacheInfoCompare, QuickSortBuffer);=0D CopyMem (CacheInfo, LocalCacheInfo, sizeof (*CacheInfo) * LocalCacheIn= foCount);=0D DEBUG_CODE (=0D CpuCacheInfoPrintCpuCacheInfoTable (CacheInfo, LocalCacheInfoCount);= =0D diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf b/Ue= fiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf index c3d3f1e799..fdd79970f9 100644 --- a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf @@ -25,7 +25,6 @@ =0D [Packages]=0D MdePkg/MdePkg.dec=0D - MdeModulePkg/MdeModulePkg.dec=0D UefiCpuPkg/UefiCpuPkg.dec=0D =0D [LibraryClasses]=0D @@ -34,7 +33,6 @@ BaseMemoryLib=0D MemoryAllocationLib=0D UefiBootServicesTableLib=0D - SortLib=0D =0D [Protocols]=0D gEfiMpServiceProtocolGuid=0D 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 =0D #include =0D #include =0D -#include =0D #include =0D =0D typedef union {=0D diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf b/Ue= fiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf index 0864497849..c643fc89be 100644 --- a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf @@ -25,7 +25,6 @@ =0D [Packages]=0D MdePkg/MdePkg.dec=0D - MdeModulePkg/MdeModulePkg.dec=0D UefiCpuPkg/UefiCpuPkg.dec=0D =0D [LibraryClasses]=0D @@ -34,7 +33,6 @@ BaseMemoryLib=0D MemoryAllocationLib=0D PeiServicesTablePointerLib=0D - SortLib=0D =0D [Ppis]=0D gEdkiiPeiMpServices2PpiGuid=0D --=20 2.30.0.windows.1