From nobody Tue May 14 20:07:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81409+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81409+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1633322795; cv=none; d=zohomail.com; s=zohoarc; b=bcTxJHVEciixXbrT1ZRBxBGBaymPMTXHbza0KwQlPTantLqTCVupG6wsYh74hp6ETam7rE20c0p7/PHq3/Gja7ZdWhQtzVUJSVai1gQYOssWRoNCvcfnZJ5Ahz/+rk8g8w76JFGucSQbR9GDh6hS/TPCgGuaMRe+KcxxCZTQJbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633322795; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=nFUFgtsQMbxkNv8gW++cW+RjJ9XFWaXGvZukLYizbS4=; b=cfWss81Cll+qVGCG5kkCGidMK78eF6RNq4ZLZIa1/A5HDQSRUnpgM/4RDFVQP990gH8xNrGZSyD3wA1TLeezl1YJWR+tcD3JlvP2WKCQ7UPAZSynpHbKLm+BpyjWIMamS8LfmXxszlWR+pRkvjGj8emQcCAzZkhKmJ7GPDt5VgU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81409+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633322795858158.7646231421852; Sun, 3 Oct 2021 21:46:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id RH7SYY1788612xFlG8dBS5nb; Sun, 03 Oct 2021 21:46:35 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web09.5120.1633322794657795760 for ; Sun, 03 Oct 2021 21:46:35 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10126"; a="225602852" X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="225602852" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2021 21:46:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="621557259" X-Received: from ikuox-desk1.gar.corp.intel.com ([10.227.107.18]) by fmsmga001.fm.intel.com with ESMTP; 03 Oct 2021 21:46:31 -0700 From: "IanX Kuo" To: devel@edk2.groups.io Cc: amy.chan@intel.com, ray.ni@intel.com, IanX Kuo , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH v4 1/4] MdePkg/BaseLib: Add QuickSort function on BaseLib Date: Mon, 4 Oct 2021 12:46:24 +0800 Message-Id: <20211004044627.1810-2-ianx.kuo@intel.com> In-Reply-To: <20211004044627.1810-1-ianx.kuo@intel.com> References: <20211004044627.1810-1-ianx.kuo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ianx.kuo@intel.com X-Gm-Message-State: TfpX4LNSM85G4ZwCRvFEptiRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633322795; bh=frVxv92CU7mny3vWzwLFsQIG3u5UlWrfX9wnZkaCkHk=; h=Cc:Date:From:Reply-To:Subject:To; b=PxDhuCauSK2izkgCPaYNUozfp+rwdF5TCgMAG/Hztt4uZ+Al2FGgSx2i9bXmpm//2Zh 1P8ZDTPAiafrFa9gncUzPqhxV87dvbHKoc6SWbUgKGSgo6iW/5tkGfbcnHBCCV18D7s+4 ZsWWV4WsaY+ax9MVruLBgxkMOlMumC9wMME= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633322797417100005 Content-Type: text/plain; charset="utf-8" From: IanX Kuo REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3675 Add QuickSort function into BaseLib Cc: Ray Ni Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: IanX Kuo --- MdePkg/Include/Library/BaseLib.h | 49 ++++++++ MdePkg/Library/BaseLib/BaseLib.inf | 1 + MdePkg/Library/BaseLib/QuickSort.c | 117 ++++++++++++++++++ .../Library/BaseLib/UnitTestHostBaseLib.inf | 3 +- 4 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Library/BaseLib/QuickSort.c diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/Base= Lib.h index 2452c1d92e..2423169be4 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 #ifndef __BASE_LIB__ #define __BASE_LIB__ +#include =20 // // Definitions for architecture-specific types @@ -2856,6 +2857,54 @@ RemoveEntryList ( // // Math Services // +/** + Prototype for comparison function for any two element types. + + @param[in] Buffer1 The pointer to first buffer. + @param[in] Buffer2 The pointer to second buffer. + + @retval 0 Buffer1 equal to Buffer2. + @return <0 Buffer1 is less than Buffer2. + @return >0 Buffer1 is greater than Buffer2. +**/ +typedef +INTN +(EFIAPI *BASE_SORT_COMPARE)( + IN CONST VOID *Buffer1, + IN CONST VOID *Buffer2 + ); + +/** + Worker function for QuickSorting. This function is identical to perform= QuickSort, + except that is uses the pre-allocated buffer so the in place sorting doe= s not need to + allocate and free buffers constantly. + + Each element must be equal sized. + + if Count is < 2 then perform no action. + if Size is < 1 then perform no action. + + @param[in, out] BufferToSort on call a Buffer of (possibly sorted) ele= ments + on return a buffer of sorted elements + @param[in] Count the number of elements in the buffer to s= ort + @param[in] ElementSize Size of an element in bytes + @param[in] CompareFunction The function to call to perform the compa= rison + of any 2 elements + @param [in] BufferOneElement Caller provided buffer whose size equals = to ElementSize. + It's used by QuickSort() for swapping in = sorting. + + @retval EFI_SUCCESS The quick sort is finished. + @retval EFI_INVALID_PARAMETER When BufferToSort is NULL, CompareFunctio= n is NULL or Buffer is NULL +**/ +EFI_STATUS +EFIAPI +QuickSort ( + IN OUT VOID *BufferToSort, + IN CONST UINTN Count, + IN CONST UINTN ElementSize, + IN BASE_SORT_COMPARE CompareFunction, + IN VOID *BufferOneElement + ); =20 /** Shifts a 64-bit integer left between 0 and 63 bits. The low bits are fil= led diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/Ba= seLib.inf index 6efa5315b6..cebda3b210 100644 --- a/MdePkg/Library/BaseLib/BaseLib.inf +++ b/MdePkg/Library/BaseLib/BaseLib.inf @@ -32,6 +32,7 @@ SwapBytes16.c LongJump.c SetJump.c + QuickSort.c RShiftU64.c RRotU64.c RRotU32.c diff --git a/MdePkg/Library/BaseLib/QuickSort.c b/MdePkg/Library/BaseLib/Qu= ickSort.c new file mode 100644 index 0000000000..f95af9e238 --- /dev/null +++ b/MdePkg/Library/BaseLib/QuickSort.c @@ -0,0 +1,117 @@ +/** @file + Math worker functions. + + Copyright (c) 2021, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "BaseLibInternals.h" +#include + +/** + Worker function for QuickSorting. This function is identical to perform= QuickSort, + except that is uses the pre-allocated buffer so the in place sorting doe= s not need to + allocate and free buffers constantly. + + Each element must be equal sized. + + if Count is < 2 then perform no action. + if Size is < 1 then perform no action. + + @param[in, out] BufferToSort on call a Buffer of (possibly sorted) ele= ments + on return a buffer of sorted elements + @param[in] Count the number of elements in the buffer to s= ort + @param[in] ElementSize Size of an element in bytes + @param[in] CompareFunction The function to call to perform the compa= rison + of any 2 elements + @param [in] BufferOneElement Caller provided buffer whose size equals = to ElementSize. + It's used by QuickSort() for swapping in = sorting. + + @retval EFI_SUCCESS The quick sort is finished. + @retval EFI_INVALID_PARAMETER When BufferToSort is NULL, CompareFunctio= n is NULL, or BufferOneElement is NULL + +**/ +EFI_STATUS +EFIAPI +QuickSort ( + IN OUT VOID *BufferToSort, + IN CONST UINTN Count, + IN CONST UINTN ElementSize, + IN BASE_SORT_COMPARE CompareFunction, + IN VOID *BufferOneElement + ) +{ + VOID *Pivot; + UINTN LoopCount; + UINTN NextSwapLocation; + + if ((BufferToSort =3D=3D NULL) || (CompareFunction =3D=3D NULL) || (Buff= erOneElement =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + if (Count < 2 || ElementSize < 1) { + return EFI_SUCCESS; + } + + NextSwapLocation =3D 0; + + // + // pick a pivot (we choose last element) + // + Pivot =3D ((UINT8*) BufferToSort + ((Count - 1) * ElementSize)); + + // + // Now get the pivot such that all on "left" are below it + // and everything "right" are above it + // + for (LoopCount =3D 0; LoopCount < Count -1; LoopCount++) { + // + // if the element is less than the pivot + // + if (CompareFunction ((VOID*) ((UINT8*) BufferToSort + ((LoopCount) * E= lementSize)), Pivot) <=3D 0){ + // + // swap + // + CopyMem (BufferOneElement, (UINT8*) BufferToSort + (NextSwapLocation= * ElementSize), ElementSize); + CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), (= UINT8*) BufferToSort + ((LoopCount) * ElementSize), ElementSize); + CopyMem ((UINT8*) BufferToSort + ((LoopCount)*ElementSize), BufferOn= eElement, ElementSize); + + // + // increment NextSwapLocation + // + NextSwapLocation++; + } + } + // + // swap pivot to it's final position (NextSwapLocation) + // + CopyMem (BufferOneElement, Pivot, ElementSize); + CopyMem (Pivot, (UINT8*) BufferToSort + (NextSwapLocation * ElementSize)= , ElementSize); + CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), Buffe= rOneElement, ElementSize); + + // + // Now recurse on 2 partial lists. neither of these will have the 'pivo= t' element + // IE list is sorted left half, pivot element, sorted right half... + // + if (NextSwapLocation >=3D 2) { + QuickSort ( + BufferToSort, + NextSwapLocation, + ElementSize, + CompareFunction, + BufferOneElement + ); + } + + if ((Count - NextSwapLocation - 1) >=3D 2) { + QuickSort ( + (UINT8 *)BufferToSort + (NextSwapLocation + 1) * ElementSize, + Count - NextSwapLocation - 1, + ElementSize, + CompareFunction, + BufferOneElement + ); + } + return EFI_SUCCESS; +} diff --git a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf b/MdePkg/Librar= y/BaseLib/UnitTestHostBaseLib.inf index eae1a7158d..d09bd12bef 100644 --- a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf +++ b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf @@ -1,7 +1,7 @@ ## @file # Base Library implementation for use with host based unit tests. # -# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
@@ -33,6 +33,7 @@ SwapBytes16.c LongJump.c SetJump.c + QuickSort.c RShiftU64.c RRotU64.c RRotU32.c --=20 2.30.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81409): https://edk2.groups.io/g/devel/message/81409 Mute This Topic: https://groups.io/mt/86059686/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue May 14 20:07:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81410+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81410+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1633322798; cv=none; d=zohomail.com; s=zohoarc; b=i7DJZ7Ap8xMnwpubk7kOcQFYUY5v+Gn78WnFAfdcF3JhDVkBZ3Nng4VPH0M34LUsyiss5dLPnp5wraPaQOeJ5xhfGZouoNbvW4v8qTbZsaCkT4KovFhk35OLV1WTdL5c9iZ+n+AJKYVWrQHrCNvquWGNAK7VldbYmZRKP0+hqWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633322798; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=gmpP4vkeK07TFf2izT2rP6dKO9Q5UPHMJFzOD54P/qw=; b=HBl7zycSQWNr/SdlTC1B0mWbcFyyXWBXXU5EZ0J1rZVnBQzQsLrEu0HJBc+MxLmmBuCrSfaxAFuktdQJvyRuL5nlNmpMnaH+0Tv13vB6iiXot2LXlvyX6hGBYiyCB+vyqL+KVIJwy7Ev7imJ+qaGWd/GUDYT7JezQO7XLDSfthg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81410+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633322798696833.43103808571; Sun, 3 Oct 2021 21:46:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id RPe9YY1788612xC0GDAttUNo; Sun, 03 Oct 2021 21:46:38 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.5060.1633322796887645544 for ; Sun, 03 Oct 2021 21:46:37 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10126"; a="225602868" X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="225602868" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2021 21:46:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="621557264" X-Received: from ikuox-desk1.gar.corp.intel.com ([10.227.107.18]) by fmsmga001.fm.intel.com with ESMTP; 03 Oct 2021 21:46:33 -0700 From: "IanX Kuo" To: devel@edk2.groups.io Cc: amy.chan@intel.com, ray.ni@intel.com, IanX Kuo , Jian J Wang , Liming Gao Subject: [edk2-devel] [PATCH v4 2/4] MdeModulePkg/SortLib: Add QuickSort function on BaseLib Date: Mon, 4 Oct 2021 12:46:25 +0800 Message-Id: <20211004044627.1810-3-ianx.kuo@intel.com> In-Reply-To: <20211004044627.1810-1-ianx.kuo@intel.com> References: <20211004044627.1810-1-ianx.kuo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ianx.kuo@intel.com X-Gm-Message-State: jW5CuOxXBK6pyf1WDDE59X4Rx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633322798; bh=hyDxhTBjViZmBjVWMEEAHTDcCFLHnrjIYtjLfNg6LKI=; h=Cc:Date:From:Reply-To:Subject:To; b=HjWbgYaHL17ulPZvrIS5U84NwVQM4Yv+KeEgtQb7gjKVS6b9EolKpqbTMQ1PPqx+H1h G5D0foXFIQ2cbFFEMcyCWNrSMm418UwLYaf4D9bRSrQ8gDXEdXpZUHfWkPyAwX2k0W6Hw 9/HHqIfzI9QvtCxKbvfYUlQgXOgk98UZeDM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633322799751100011 Content-Type: text/plain; charset="utf-8" From: IanX Kuo REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3675 Use QuickSort instead of QuickSortWorker Cc: Ray Ni Cc: Jian J Wang Cc: Liming Gao Signed-off-by: IanX Kuo --- .../Library/BaseSortLib/BaseSortLib.c | 117 +---------------- .../Library/UefiSortLib/UefiSortLib.c | 118 +----------------- 2 files changed, 10 insertions(+), 225 deletions(-) diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c b/MdeModulePkg/= Library/BaseSortLib/BaseSortLib.c index a12c7bc0ec..b33339ac7c 100644 --- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c +++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c @@ -1,7 +1,7 @@ /** @file Library used for sorting routines. =20 - Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -13,114 +13,6 @@ #include #include =20 -/** - Worker function for QuickSorting. This function is identical to Perform= QuickSort, - except that is uses the pre-allocated buffer so the in place sorting doe= s not need to - allocate and free buffers constantly. - - Each element must be equal sized. - - if BufferToSort is NULL, then ASSERT. - if CompareFunction is NULL, then ASSERT. - if Buffer is NULL, then ASSERT. - - if Count is < 2 then perform no action. - if Size is < 1 then perform no action. - - @param[in, out] BufferToSort on call a Buffer of (possibly sorted) ele= ments - on return a buffer of sorted elements - @param[in] Count the number of elements in the buffer to s= ort - @param[in] ElementSize Size of an element in bytes - @param[in] CompareFunction The function to call to perform the compa= rison - of any 2 elements - @param[in] Buffer Buffer of size ElementSize for use in swa= pping -**/ -VOID -EFIAPI -QuickSortWorker ( - IN OUT VOID *BufferToSort, - IN CONST UINTN Count, - IN CONST UINTN ElementSize, - IN SORT_COMPARE CompareFunction, - IN VOID *Buffer - ) -{ - VOID *Pivot; - UINTN LoopCount; - UINTN NextSwapLocation; - - ASSERT(BufferToSort !=3D NULL); - ASSERT(CompareFunction !=3D NULL); - ASSERT(Buffer !=3D NULL); - - if ( Count < 2 - || ElementSize < 1 - ){ - return; - } - - NextSwapLocation =3D 0; - - // - // pick a pivot (we choose last element) - // - Pivot =3D ((UINT8*)BufferToSort+((Count-1)*ElementSize)); - - // - // Now get the pivot such that all on "left" are below it - // and everything "right" are above it - // - for ( LoopCount =3D 0 - ; LoopCount < Count -1 - ; LoopCount++ - ){ - // - // if the element is less than the pivot - // - if (CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementS= ize)),Pivot) <=3D 0){ - // - // swap - // - CopyMem (Buffer, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize)= , ElementSize); - CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), (UINT8= *)BufferToSort+((LoopCount)*ElementSize), ElementSize); - CopyMem ((UINT8*)BufferToSort+((LoopCount)*ElementSize), Buffer, Ele= mentSize); - - // - // increment NextSwapLocation - // - NextSwapLocation++; - } - } - // - // swap pivot to it's final position (NextSwapLocaiton) - // - CopyMem (Buffer, Pivot, ElementSize); - CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Ele= mentSize); - CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, El= ementSize); - - // - // Now recurse on 2 paritial lists. neither of these will have the 'piv= ot' element - // IE list is sorted left half, pivot element, sorted right half... - // - if (NextSwapLocation >=3D 2) { - QuickSortWorker( - BufferToSort, - NextSwapLocation, - ElementSize, - CompareFunction, - Buffer); - } - - if ((Count - NextSwapLocation - 1) >=3D 2) { - QuickSortWorker( - (UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize, - Count - NextSwapLocation - 1, - ElementSize, - CompareFunction, - Buffer); - } - return; -} /** Function to perform a Quick Sort alogrithm on a buffer of comparable ele= ments. =20 @@ -156,12 +48,13 @@ PerformQuickSort ( Buffer =3D AllocateZeroPool(ElementSize); ASSERT(Buffer !=3D NULL); =20 - QuickSortWorker( + QuickSort ( BufferToSort, Count, ElementSize, - CompareFunction, - Buffer); + (SORT_COMPARE) CompareFunction, + Buffer + ); =20 FreePool(Buffer); return; diff --git a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c b/MdeModulePkg/= Library/UefiSortLib/UefiSortLib.c index 46dc443638..151a5a9ac3 100644 --- a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c +++ b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c @@ -1,7 +1,7 @@ /** @file Library used for sorting routines. =20 - Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -29,115 +29,6 @@ STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollat= ion =3D NULL; } \ } =20 -/** - Worker function for QuickSorting. This function is identical to Perform= QuickSort, - except that is uses the pre-allocated buffer so the in place sorting doe= s not need to - allocate and free buffers constantly. - - Each element must be equal sized. - - if BufferToSort is NULL, then ASSERT. - if CompareFunction is NULL, then ASSERT. - if Buffer is NULL, then ASSERT. - - if Count is < 2 then perform no action. - if Size is < 1 then perform no action. - - @param[in, out] BufferToSort on call a Buffer of (possibly sorted) ele= ments - on return a buffer of sorted elements - @param[in] Count the number of elements in the buffer to s= ort - @param[in] ElementSize Size of an element in bytes - @param[in] CompareFunction The function to call to perform the compa= rison - of any 2 elements - @param[in] Buffer Buffer of size ElementSize for use in swa= pping -**/ -VOID -EFIAPI -QuickSortWorker ( - IN OUT VOID *BufferToSort, - IN CONST UINTN Count, - IN CONST UINTN ElementSize, - IN SORT_COMPARE CompareFunction, - IN VOID *Buffer - ) -{ - VOID *Pivot; - UINTN LoopCount; - UINTN NextSwapLocation; - - ASSERT(BufferToSort !=3D NULL); - ASSERT(CompareFunction !=3D NULL); - ASSERT(Buffer !=3D NULL); - - if ( Count < 2 - || ElementSize < 1 - ){ - return; - } - - NextSwapLocation =3D 0; - - // - // pick a pivot (we choose last element) - // - Pivot =3D ((UINT8*)BufferToSort+((Count-1)*ElementSize)); - - // - // Now get the pivot such that all on "left" are below it - // and everything "right" are above it - // - for ( LoopCount =3D 0 - ; LoopCount < Count -1 - ; LoopCount++ - ){ - // - // if the element is less than the pivot - // - if (CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementS= ize)),Pivot) <=3D 0){ - // - // swap - // - CopyMem (Buffer, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize)= , ElementSize); - CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), (UINT8= *)BufferToSort+((LoopCount)*ElementSize), ElementSize); - CopyMem ((UINT8*)BufferToSort+((LoopCount)*ElementSize), Buffer, Ele= mentSize); - - // - // increment NextSwapLocation - // - NextSwapLocation++; - } - } - // - // swap pivot to it's final position (NextSwapLocaiton) - // - CopyMem (Buffer, Pivot, ElementSize); - CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Ele= mentSize); - CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, El= ementSize); - - // - // Now recurse on 2 paritial lists. neither of these will have the 'piv= ot' element - // IE list is sorted left half, pivot element, sorted right half... - // - if (NextSwapLocation >=3D 2) { - QuickSortWorker( - BufferToSort, - NextSwapLocation, - ElementSize, - CompareFunction, - Buffer); - } - - if ((Count - NextSwapLocation - 1) >=3D 2) { - QuickSortWorker( - (UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize, - Count - NextSwapLocation - 1, - ElementSize, - CompareFunction, - Buffer); - } - - return; -} /** Function to perform a Quick Sort alogrithm on a buffer of comparable ele= ments. =20 @@ -173,12 +64,13 @@ PerformQuickSort ( Buffer =3D AllocateZeroPool(ElementSize); ASSERT(Buffer !=3D NULL); =20 - QuickSortWorker( + QuickSort ( BufferToSort, Count, ElementSize, - CompareFunction, - Buffer); + (SORT_COMPARE) CompareFunction, + Buffer + ); =20 FreePool(Buffer); return; --=20 2.30.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81410): https://edk2.groups.io/g/devel/message/81410 Mute This Topic: https://groups.io/mt/86059687/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue May 14 20:07:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81411+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81411+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1633322799; cv=none; d=zohomail.com; s=zohoarc; b=ZenIETQX5YCOdUi640jcHDkqL7J9Ue2Xhgci398JZGnZJDeEqxJ+1cl9fGAR3k5+Mt/OFeLZ34cNzoMjGC1Lh/8cDL+YSoPWg/wbQZr42o83a6ZQQOCYxSRmLYGy+j48LV/43j7Rx+61YF1gQ2qjVe9rxqI4ugASqANCVHhMww4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633322799; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=RG0vwTWfvIU1nICusI+xI9lMuhdt403m9svN51bsfUw=; b=jG0dT/EB5adFBi+YGF6Ej03rAehFE6KNzyeRWkoJsrak2irTyI4XDqK6Jej2RsRNF3/VlZ7eEBdPSFqal3ztM3fGJWt6SGt3FBG2n4t+taBzlcnepNA542MUErainqSHRLZ1eASVV3+vwK47iIyEg8kZY+TyPZQlHQ/xOSrcPVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81411+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1633322799047107.36876436647935; Sun, 3 Oct 2021 21:46:39 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bEUOYY1788612xOVRRmQVjlO; Sun, 03 Oct 2021 21:46:38 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.5062.1633322798134549616 for ; Sun, 03 Oct 2021 21:46:38 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10126"; a="225602893" X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="225602893" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2021 21:46:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="621557276" X-Received: from ikuox-desk1.gar.corp.intel.com ([10.227.107.18]) by fmsmga001.fm.intel.com with ESMTP; 03 Oct 2021 21:46:35 -0700 From: "IanX Kuo" To: devel@edk2.groups.io Cc: amy.chan@intel.com, ray.ni@intel.com, IanX Kuo , Jiewen Yao , Jian J Wang , Xiaoyu Lu , Guomin Jiang Subject: [edk2-devel] [PATCH v4 3/4] CryptoPkg/CryptLib: Add QuickSort function on BaseLib Date: Mon, 4 Oct 2021 12:46:26 +0800 Message-Id: <20211004044627.1810-4-ianx.kuo@intel.com> In-Reply-To: <20211004044627.1810-1-ianx.kuo@intel.com> References: <20211004044627.1810-1-ianx.kuo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ianx.kuo@intel.com X-Gm-Message-State: CzL1e7COGs9SbZc6HyBxgQG9x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633322798; bh=USKwG8LmUp0EF112OzISCjyEF2fuGqKS0ouGPJNdk5Y=; h=Cc:Date:From:Reply-To:Subject:To; b=xSMGOqdVnfEdNzhPSKdKeaB6BCED35u+DPpvkdbKe9ik97/fxLZQiVElFEFkdl4fgQD 0I1pWO9mwM6mg4W3i9KUtNkzC+eG3hMh2OtL5ruHhz/++yb9L382mUe1mVBWKDwPqIgoH dHk7O2Um/FbOb8fHSJ4fIW/U7+fTMpH1yiM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633322799760100012 Content-Type: text/plain; charset="utf-8" From: IanX Kuo REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3675 Use QuickSort instead of QuickSortWorker Cc: Ray Ni Cc: Jiewen Yao Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Guomin Jiang Signed-off-by: IanX Kuo --- .../Library/BaseCryptLib/SysCall/CrtWrapper.c | 92 +------------------ 1 file changed, 2 insertions(+), 90 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPk= g/Library/BaseCryptLib/SysCall/CrtWrapper.c index 42235ab96a..bdcd8ec278 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c @@ -2,7 +2,7 @@ C Run-Time Libraries (CRT) Wrapper Implementation for OpenSSL-based Cryptographic Library. =20 -Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -22,91 +22,6 @@ int IN VOID *Buffer2 ); =20 -// -// Duplicated from EDKII BaseSortLib for qsort() wrapper -// -STATIC -VOID -QuickSortWorker ( - IN OUT VOID *BufferToSort, - IN CONST UINTN Count, - IN CONST UINTN ElementSize, - IN SORT_COMPARE CompareFunction, - IN VOID *Buffer - ) -{ - VOID *Pivot; - UINTN LoopCount; - UINTN NextSwapLocation; - - ASSERT(BufferToSort !=3D NULL); - ASSERT(CompareFunction !=3D NULL); - ASSERT(Buffer !=3D NULL); - - if (Count < 2 || ElementSize < 1) { - return; - } - - NextSwapLocation =3D 0; - - // - // Pick a pivot (we choose last element) - // - Pivot =3D ((UINT8 *)BufferToSort + ((Count - 1) * ElementSize)); - - // - // Now get the pivot such that all on "left" are below it - // and everything "right" are above it - // - for (LoopCount =3D 0; LoopCount < Count - 1; LoopCount++) - { - // - // If the element is less than the pivot - // - if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * E= lementSize)), Pivot) <=3D 0) { - // - // Swap - // - CopyMem (Buffer, (UINT8 *)BufferToSort + (NextSwapLocation * Element= Size), ElementSize); - CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), (= UINT8 *)BufferToSort + ((LoopCount) * ElementSize), ElementSize); - CopyMem ((UINT8 *)BufferToSort + ((LoopCount) * ElementSize), Buffer= , ElementSize); - - // - // Increment NextSwapLocation - // - NextSwapLocation++; - } - } - // - // Swap pivot to its final position (NextSwapLocation) - // - CopyMem (Buffer, Pivot, ElementSize); - CopyMem (Pivot, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize)= , ElementSize); - CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), Buffe= r, ElementSize); - - // - // Now recurse on 2 partial lists. Neither of these will have the 'pivo= t' element. - // IE list is sorted left half, pivot element, sorted right half... - // - QuickSortWorker ( - BufferToSort, - NextSwapLocation, - ElementSize, - CompareFunction, - Buffer - ); - - QuickSortWorker ( - (UINT8 *)BufferToSort + (NextSwapLocation + 1) * ElementSize, - Count - NextSwapLocation - 1, - ElementSize, - CompareFunction, - Buffer - ); - - return; -} - //--------------------------------------------------------- // Standard C Run-time Library Interface Wrapper //--------------------------------------------------------- @@ -337,10 +252,7 @@ void qsort (void *base, size_t num, size_t width, int = (*compare)(const void *, c Buffer =3D malloc (width); ASSERT (Buffer !=3D NULL); =20 - // - // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLi= b. - // - QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, = Buffer); + QuickSort (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, Buffer= ); =20 free (Buffer); return; --=20 2.30.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81411): https://edk2.groups.io/g/devel/message/81411 Mute This Topic: https://groups.io/mt/86059688/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue May 14 20:07:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+81412+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81412+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1633322800; cv=none; d=zohomail.com; s=zohoarc; b=K8c0oAofqXEtFW6c+GVmK63GeRQ7EGaWLk/DwxkRNd/YYKWKWbTRnffZCRFqxYkI1o8c1oQeXZssFtNrbWyvjVOcgnpWAAfIIVNOgc46AcaiGIJmWoiSMTA2c+URcYm1k4ePOnFY52rHIQr7CqBC3pwYBv9VKSolWC5L76H/qTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633322800; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=50OyJgk83D7+V+Yr7D4Dq0xWjcDrU7ByqiEDXX1rRPc=; b=lHJOQJY/hc0QUsESxtHvb+c63U7IuXuAjJ1EZSR+V3QGpDnE92ZbSH71++e5GenreKPFBZQ4MO0IgCysWjEBEDIe4FLqiAbr6/9hIsg024h6VWqVhaTmbjDG38ltGG8jFpmBV/FWdZyhVU5dhGZxXhLqjZhBjSsNC50gOYN2RD4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+81412+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 163332280037371.59210964636645; Sun, 3 Oct 2021 21:46:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id cSKgYY1788612x9zDGHE6KTu; Sun, 03 Oct 2021 21:46:40 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.5092.1633322799374918231 for ; Sun, 03 Oct 2021 21:46:39 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10126"; a="225602905" X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="225602905" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2021 21:46:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,344,1624345200"; d="scan'208";a="621557285" X-Received: from ikuox-desk1.gar.corp.intel.com ([10.227.107.18]) by fmsmga001.fm.intel.com with ESMTP; 03 Oct 2021 21:46:37 -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: [edk2-devel] [PATCH v4 4/4] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib Date: Mon, 4 Oct 2021 12:46:27 +0800 Message-Id: <20211004044627.1810-5-ianx.kuo@intel.com> In-Reply-To: <20211004044627.1810-1-ianx.kuo@intel.com> References: <20211004044627.1810-1-ianx.kuo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ianx.kuo@intel.com X-Gm-Message-State: MbB2tWXBO4MWpwX8kUqjThSAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633322800; bh=6jl6tNyJeB3Wnm/nQgJ9pAy3rW71Eps0pmqQLAOfdtM=; h=Cc:Date:From:Reply-To:Subject:To; b=KNSbkW7akhjFlE25tt2oEiHRe2/2bMqZP0OwTC3sJ7Uw0o0KmjUtphsCT4hH967GlU/ Gvi2+A10TadveD+CE99ed+473N55ax7kSy0BI4rEDFxsRs/ZKa98lqChW8lIy2T951ADN qGjF7gJwN3me2L9u2cGEvnX/13XL2TesdQ8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633322801840100017 Content-Type: text/plain; charset="utf-8" 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 | 2 -- UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf | 2 -- 4 files changed, 4 insertions(+), 7 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; UINTN Index; UINTN NextIndex; + VOID *QuickSortBuffer; =20 // // Get number of Packages and Package ID. @@ -369,7 +370,9 @@ CpuCacheInfoCollectCpuCacheInfoData ( // // Sort LocalCacheInfo array by CPU package ID, core type, cache level= and cache type. // - PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalC= acheInfo), (SORT_COMPARE) CpuCacheInfoCompare); + QuickSortBuffer =3D AllocateZeroPool (sizeof (*LocalCacheInfo)); + ASSERT (QuickSortBuffer !=3D NULL); + QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInf= o), (BASE_SORT_COMPARE) CpuCacheInfoCompare, QuickSortBuffer); CopyMem (CacheInfo, LocalCacheInfo, sizeof (*CacheInfo) * LocalCacheIn= foCount); DEBUG_CODE ( CpuCacheInfoPrintCpuCacheInfoTable (CacheInfo, LocalCacheInfoCount); 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 @@ =20 [Packages] MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec UefiCpuPkg/UefiCpuPkg.dec =20 [LibraryClasses] @@ -34,7 +33,6 @@ BaseMemoryLib MemoryAllocationLib UefiBootServicesTableLib - SortLib =20 [Protocols] gEfiMpServiceProtocolGuid diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h b= /UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h index 26e1f46516..af60588e34 100644 --- a/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h @@ -13,11 +13,9 @@ #include #include #include -#include #include #include #include -#include #include =20 typedef union { 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 @@ =20 [Packages] MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec UefiCpuPkg/UefiCpuPkg.dec =20 [LibraryClasses] @@ -34,7 +33,6 @@ BaseMemoryLib MemoryAllocationLib PeiServicesTablePointerLib - SortLib =20 [Ppis] gEdkiiPeiMpServices2PpiGuid --=20 2.30.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#81412): https://edk2.groups.io/g/devel/message/81412 Mute This Topic: https://groups.io/mt/86059690/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-