Re: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-19 Thread IanX Kuo
Hi Liming

The change "PATCH v6 1/3" is the same with "PATCH v3 1/3".

The difference between "v3 to v6" is on "PATCH v6 3/3"


Thanks,
Ian Kuo
-Original Message-
From: devel@edk2.groups.io  On Behalf Of gaoliming
Sent: Wednesday, October 20, 2021 9:50 AM
To: Kuo, IanX ; devel@edk2.groups.io
Cc: Chan, Amy ; Ni, Ray ; Wang, Jian J 

Subject: 回复: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add QuickSort 
function on BaseLib

What new change is made in new version patch?

Thanks
Liming
> -邮件原件-
> 发件人: Kuo, IanX 
> 发送时间: 2021年10月19日 10:09
> 收件人: devel@edk2.groups.io; Kuo, IanX ; Liming Gao 
> 
> 抄送: Chan, Amy ; Ni, Ray ; Wang, 
> Jian J 
> 主题: RE: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add 
> QuickSort function on BaseLib
> 
> @Liming Gao
> 
> Sorry to bother you. May I get your help for review by again ?
> 
> Thanks,
> Ian Kuo
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of IanX 
> Kuo
> Sent: Monday, October 18, 2021 12:21 PM
> To: devel@edk2.groups.io
> Cc: Chan, Amy ; Ni, Ray ; Kuo, 
> IanX ; Wang, Jian J ; 
> Liming Gao 
> Subject: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add 
> QuickSort function on BaseLib
> 
> From: IanX Kuo 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675
> 
> Use QuickSort instead of QuickSortWorker
> 
> Cc: Ray Ni 
> Cc: Jian J Wang 
> Cc: Liming Gao 
> Signed-off-by: IanX Kuo 
> ---
>  .../Library/BaseSortLib/BaseSortLib.c | 115 +
>  .../Library/UefiSortLib/UefiSortLib.c | 116 +-
>  2 files changed, 8 insertions(+), 223 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
> b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
> index a12c7bc0ec..0903943ee4 100644
> --- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
> +++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
> @@ -1,7 +1,7 @@
>  /** @file   Library used for sorting routines. -  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  **/@@ -13,114 +13,6 @@  #include 
>  #include 
> -/**-  Worker function for QuickSorting.  This function is identical 
> to
> PerformQuickSort,-  except that is uses the pre-allocated buffer so 
> the in place sorting does 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)
> elements- on return a buffer of
> sorted elements-  @param[in] Count   the number of
> elements in the buffer to sort-  @param[in] ElementSize Size of
> an element in bytes-  @param[in] CompareFunction The function to
> call to perform the comparison- of
> any 2 elements-  @param[in] Buffer  Buffer of size
> ElementSize for use in swapping-**/-VOID-EFIAPI-QuickSortWorker (-  IN
> OUT VOID   *BufferToSort,-  IN CONST
> UINTNCount,-  IN CONST UINTN
> ElementSize,-  IN   SORT_COMPARE
> CompareFunction,-  IN VOID
> *Buffer-  )-{-  VOID*Pivot;-  UINTN   LoopCount;-
> UINTN   NextSwapLocation;--  ASSERT(BufferToSort != NULL);-
> ASSERT(CompareFunction  != NULL);-  ASSERT(Buffer  != NULL);--  if
> ( Count < 2-|| ElementSize  < 1-   ){-return;-  }--
> NextSwapLocation = 0;--  //-  // pick a pivot (we choose last 
> element)-
> //-  Pivot = ((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 = 0-  ; LoopCount < Count
> -1-  ; LoopCount++- ){-//-// if the element is less than
> the pivot-//-if
> (CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)
> ),Pivot) <= 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,
> ElementSize);--  //-  // increment NextSwapLocation-  //-
> NextSwapLocation++;-}-  }-  //-  // swap pivot to it'

Re: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-18 Thread IanX Kuo
@Liming Gao

Sorry to bother you. May I get your help for review by again ?

Thanks,
Ian Kuo

-Original Message-
From: devel@edk2.groups.io  On Behalf Of IanX Kuo
Sent: Monday, October 18, 2021 12:21 PM
To: devel@edk2.groups.io
Cc: Chan, Amy ; Ni, Ray ; Kuo, IanX 
; Wang, Jian J ; Liming Gao 

Subject: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add QuickSort 
function on BaseLib

From: IanX Kuo 

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

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: IanX Kuo 
---
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 2 files changed, 8 insertions(+), 223 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
index a12c7bc0ec..0903943ee4 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file   Library used for sorting routines. -  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  **/@@ -13,114 +13,6 @@
 #include  #include  -/**-  
Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,-  except that is uses the pre-allocated buffer so the in 
place sorting does 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) elements- 
on return a buffer of sorted elements-  
@param[in] Count   the number of elements in the buffer to sort-  
@param[in] ElementSize Size of an element in bytes-  @param[in] 
CompareFunction The function to call to perform the comparison- 
of any 2 elements-  @param[in] Buffer  Buffer 
of size ElementSize for use in swapping-**/-VOID-EFIAPI-QuickSortWorker (-  IN 
OUT VOID   *BufferToSort,-  IN CONST UINTN  
  Count,-  IN CONST UINTNElementSize,-  IN  
 SORT_COMPARE CompareFunction,-  IN VOID
   *Buffer-  )-{-  VOID*Pivot;-  UINTN   LoopCount;-  UINTN 
  NextSwapLocation;--  ASSERT(BufferToSort != NULL);-  
ASSERT(CompareFunction  != NULL);-  ASSERT(Buffer  != NULL);--  if ( Count < 2- 
   || ElementSize  < 1-   ){-return;-  }--  NextSwapLocation = 0;--  //-  
// pick a pivot (we choose last element)-  //-  Pivot = 
((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 = 0-  ; LoopCount < Count -1-  ; LoopCount++- 
){-//-// if the element is less than the pivot-//-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, ElementSize);--  
//-  // increment NextSwapLocation-  //-  NextSwapLocation++;-
}-  }-  //-  // swap pivot to it's final position (NextSwapLocaiton)-  //-  
CopyMem (Buffer, Pivot, ElementSize);-  CopyMem (Pivot, 
(UINT8*)BufferToSort+(NextSwapLocation*ElementSize), ElementSize);-  CopyMem 
((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, ElementSize);--  
//-  // Now recurse on 2 paritial lists.  neither of these will have the 
'pivot' element-  // IE list is sorted left half, pivot element, sorted right 
half...-  //-  if (NextSwapLocation >= 2) {-QuickSortWorker(-  
BufferToSort,-  NextSwapLocation,-  ElementSize,-  
CompareFunction,-  Buffer);-  }--  if ((Count - NextSwapLocation - 1) >= 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 elements. @@ -156,12 +48,13 @@ 
PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);   ASSERT(Buffer != NULL); -  
QuickSortWorker(+  QuickSort ( BufferToSort, Count, ElementSize,
 CompareFunction,-  

Re: [edk2-devel] [PATCH v6 2/3] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-18 Thread IanX Kuo
@Yao, Jiewen and @Jiang, Guomin

Sorry to bother you. May I get your help for review-by ?

Thanks,
Ian Kuo
-Original Message-
From: devel@edk2.groups.io  On Behalf Of IanX Kuo
Sent: Monday, October 18, 2021 12:21 PM
To: devel@edk2.groups.io
Cc: Chan, Amy ; Ni, Ray ; Kuo, IanX 
; Yao, Jiewen ; Wang, Jian J 
; Lu, XiaoyuX ; Jiang, Guomin 

Subject: [edk2-devel] [PATCH v6 2/3] CryptoPkg/CryptLib: Add QuickSort function 
on BaseLib

From: IanX Kuo 

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

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/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..b10edaae5b 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. -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  **/@@ -22,91 +22,6 
@@ int
   IN  VOID  *Buffer2   ); -//-// Duplicated from EDKII BaseSortLib for qsort() 
wrapper-//-STATIC-VOID-QuickSortWorker (-  IN OUTVOID  
*BufferToSort,-  IN CONST  UINTN Count,-  IN CONST  UINTN 
ElementSize,-  INSORT_COMPARE  CompareFunction,-  INVOID
  *Buffer-  )-{-  VOID*Pivot;-  UINTN   LoopCount;-  UINTN   
NextSwapLocation;--  ASSERT(BufferToSort!= NULL);-  ASSERT(CompareFunction 
!= NULL);-  ASSERT(Buffer  != NULL);--  if (Count < 2 || ElementSize  < 
1) {-return;-  }--  NextSwapLocation = 0;--  //-  // Pick a pivot (we 
choose last element)-  //-  Pivot = ((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 = 0; 
LoopCount < Count - 1;  LoopCount++)-  {-//-// If the element is less 
than the pivot-//-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + 
((LoopCount) * ElementSize)), Pivot) <= 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, 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), Buffer, ElementSize);--  //-  // Now recurse 
on 2 partial lists.  Neither of these will have the 'pivot' 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 = malloc (width);   ASSERT (Buffer != NULL); -  //-  // Re-use 
PerformQuickSort() function Implementation in EDKII BaseSortLib.-  //-  
QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);+  QuickSort (base, (UINTN)num, (UINTN)width, 
(BASE_SORT_COMPARE)compare, Buffer);free (Buffer);   return;-- 
2.30.0.windows.1



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82206): https://edk2.groups.io/g/devel/message/82206
Mute This Topic: https://groups.io/mt/86406845/4830160
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [ianx@intel.com] 
-=-=-=-=-=-=




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82263): https://edk2.groups.io/g/devel/message/82263
Mute This Topic: https://groups.io/mt/86430914/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: IanX Kuo 
---
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 2 files changed, 8 insertions(+), 223 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
index a12c7bc0ec..0903943ee4 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
 CompareFunction,
-Buffer);
+Buffer
+);
 
   FreePool(Buffer);
   return;
diff --git a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c 
b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
index 46dc443638..29d8735c22 100644
--- a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
+++ b/MdeModulePkg/Library/UefiSortLib/U

[edk2-devel] [PATCH v6 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

Remove MdeModulePkg dependency

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: IanX Kuo 
---
 UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 3 ++-
 UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf| 2 --
 UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h | 1 -
 UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf| 2 --
 4 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c 
b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index c0077d6770..f4fcee39e9 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -282,6 +282,7 @@ CpuCacheInfoCollectCpuCacheInfoData (
   UINTN LocalCacheInfoCount;
   UINTN Index;
   UINTN NextIndex;
+  CPU_CACHE_INFOSortBuffer;
 
   //
   // Get number of Packages and Package ID.
@@ -369,7 +370,7 @@ CpuCacheInfoCollectCpuCacheInfoData (
 //
 // Sort LocalCacheInfo array by CPU package ID, core type, cache level and 
cache type.
 //
-PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof 
(*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), 
CpuCacheInfoCompare, (VOID*) &SortBuffer);
 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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82205): https://edk2.groups.io/g/devel/message/82205
Mute This Topic: https://groups.io/mt/86406844/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 2/3] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..b10edaae5b 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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, (BASE_SORT_COMPARE)compare, 
Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82206): https://edk2.groups.io/g/devel/message/82206
Mute This Topic: https://groups.io/mt/86406845/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 0/3] Add function QuickSort into MdePkg/BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

1. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
1-1: Drop cast (V2)

2. CryptLib/CryptLib: Remove duplicate QuickSortWorker
2-1: Drop cast (V3)
2-2: Add cast (BASE_SORT_COMPARE) to prevent incompatible types (V6)
'function': incompatible types - from 'int (__cdecl *)(const void *,const void 
*)' to 'BASE_SORT_COMPARE'

3. CpuCacheInfoLib: Remove MdeModulePkg dependency
3-1: Drop cast (V2)
3-2: Add runtime check (V2)
3-3: Drop assert check (V3)
3-4: Remove allocate pool (V4)
3-5: Rename QuickSortBuffer to SortBuffer (V5)
3-6: Add cast (VOID*) cast to prevent incompatible types (V6)

IanX Kuo (3):
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   3 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   1 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 7 files changed, 12 insertions(+), 319 deletions(-)

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82203): https://edk2.groups.io/g/devel/message/82203
Mute This Topic: https://groups.io/mt/86406842/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




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

2021-10-17 Thread IanX Kuo
Thanks for the comment.
It will be taken care by V5 patch.

Thanks,
Ian Kuo
-Original Message-
From: Ni, Ray  
Sent: Monday, October 18, 2021 11:42 AM
To: Kuo, IanX ; devel@edk2.groups.io
Cc: Chan, Amy ; Dong, Eric ; Kumar, 
Rahul1 
Subject: RE: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function 
on BaseLib

Ian,
Thanks for cleaning up the code to remove MdeModulePkg  dependency.

Minor comments below:

   UINTN NextIndex;
+  VOID  *QuickSortBuffer;

1.  Can you use local variable? "CPU_CACHE_INFOSortBuffer".


-PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof 
(*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));
+if (QuickSortBuffer == NULL) {
+  return EFI_OUT_OF_RESOURCES;
+}

2. With #1 change, you can avoid "calling AllocateZeroPool() and checking 
pointer".

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

3. Just pass "&SortBuffer" as the last parameter.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82202): https://edk2.groups.io/g/devel/message/82202
Mute This Topic: https://groups.io/mt/86381254/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

Remove MdeModulePkg dependency

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: IanX Kuo 
---
 UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 3 ++-
 UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf| 2 --
 UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h | 1 -
 UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf| 2 --
 4 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c 
b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index c0077d6770..7aea735381 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -282,6 +282,7 @@ CpuCacheInfoCollectCpuCacheInfoData (
   UINTN LocalCacheInfoCount;
   UINTN Index;
   UINTN NextIndex;
+  CPU_CACHE_INFOSortBuffer;
 
   //
   // Get number of Packages and Package ID.
@@ -369,7 +370,7 @@ CpuCacheInfoCollectCpuCacheInfoData (
 //
 // Sort LocalCacheInfo array by CPU package ID, core type, cache level and 
cache type.
 //
-PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof 
(*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), 
CpuCacheInfoCompare, &SortBuffer);
 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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82201): https://edk2.groups.io/g/devel/message/82201
Mute This Topic: https://groups.io/mt/86406552/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 2/3] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..33ff0fcdb6 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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, compare, Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82200): https://edk2.groups.io/g/devel/message/82200
Mute This Topic: https://groups.io/mt/86406551/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: IanX Kuo 
---
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 2 files changed, 8 insertions(+), 223 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
index a12c7bc0ec..0903943ee4 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
 CompareFunction,
-Buffer);
+Buffer
+);
 
   FreePool(Buffer);
   return;
diff --git a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c 
b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
index 46dc443638..29d8735c22 100644
--- a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
+++ b/MdeModulePkg/Library/UefiSortLib/U

[edk2-devel] [PATCH v5 0/3] Add function QuickSort into MdePkg/BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

1. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
1-1: Drop cast (V2)

2. CryptLib/CryptLib: Remove duplicate QuickSortWorker
2-1: Drop cast (V3)

3. CpuCacheInfoLib: Remove MdeModulePkg dependency
3-1: Drop cast (V2)
3-2: Add runtime check (V2)
3-3: Drop assert check (V3)
3-4: Remove allocate pool (V4)
3-5: Rename QuickSortBuffer to SortBuffer (V5)

IanX Kuo (3):
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   3 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   1 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 7 files changed, 12 insertions(+), 319 deletions(-)

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82198): https://edk2.groups.io/g/devel/message/82198
Mute This Topic: https://groups.io/mt/86406549/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

Remove MdeModulePkg dependency

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: IanX Kuo 
---
 UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 3 ++-
 UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf| 2 --
 UefiCpuPkg/Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h | 1 -
 UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf| 2 --
 4 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c 
b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index c0077d6770..d101f8a802 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -282,6 +282,7 @@ CpuCacheInfoCollectCpuCacheInfoData (
   UINTN LocalCacheInfoCount;
   UINTN Index;
   UINTN NextIndex;
+  CPU_CACHE_INFOQuickSortBuffer;
 
   //
   // Get number of Packages and Package ID.
@@ -369,7 +370,7 @@ CpuCacheInfoCollectCpuCacheInfoData (
 //
 // Sort LocalCacheInfo array by CPU package ID, core type, cache level and 
cache type.
 //
-PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof 
(*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82197): https://edk2.groups.io/g/devel/message/82197
Mute This Topic: https://groups.io/mt/86406509/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 2/3] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..33ff0fcdb6 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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, compare, Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82196): https://edk2.groups.io/g/devel/message/82196
Mute This Topic: https://groups.io/mt/86406508/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

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

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: IanX Kuo 
---
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 2 files changed, 8 insertions(+), 223 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
index a12c7bc0ec..0903943ee4 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
 CompareFunction,
-Buffer);
+Buffer
+);
 
   FreePool(Buffer);
   return;
diff --git a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c 
b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
index 46dc443638..29d8735c22 100644
--- a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
+++ b/MdeModulePkg/Library/UefiSortLib/U

[edk2-devel] [PATCH v4 0/3] Add function QuickSort into MdePkg/BaseLib

2021-10-17 Thread IanX Kuo
From: IanX Kuo 

1. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
1-1: Drop cast (V2)

2. CryptLib/CryptLib: Remove duplicate QuickSortWorker
2-1: Drop cast (V3)

3. CpuCacheInfoLib: Remove MdeModulePkg dependency
3-1: Drop cast (V2)
3-2: Add runtime check (V2)
3-3: Drop assert check (V3)
3-4: Remove allocate pool (V4)

IanX Kuo (3):
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   3 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   1 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 7 files changed, 12 insertions(+), 319 deletions(-)

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82194): https://edk2.groups.io/g/devel/message/82194
Mute This Topic: https://groups.io/mt/86406506/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-17 Thread IanX Kuo
@Liming Gao or @Wang, Jian J

Sorry to bother you.
May I get one of your help to review the code change from maintainer side ?

Thanks,
Ian Kuo

-Original Message-
From: Kuo, IanX  
Sent: Sunday, October 17, 2021 6:34 AM
To: devel@edk2.groups.io
Cc: Chan, Amy ; Ni, Ray ; Kuo, IanX 
; Wang, Jian J ; Liming Gao 

Subject: [PATCH v3 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

From: IanX Kuo 

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

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: IanX Kuo 
---
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 2 files changed, 8 insertions(+), 223 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
index a12c7bc0ec..0903943ee4 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file

   Library used for sorting routines.

 

-  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

 

 **/

@@ -13,114 +13,6 @@
 #include 

 #include 

 

-/**

-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,

-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements

- on return a buffer of sorted elements

-  @param[in] Count   the number of elements in the buffer to sort

-  @param[in] ElementSize Size of an element in bytes

-  @param[in] CompareFunction The function to call to perform the comparison

- of any 2 elements

-  @param[in] Buffer  Buffer of size ElementSize for use in swapping

-**/

-VOID

-EFIAPI

-QuickSortWorker (

-  IN OUT VOID   *BufferToSort,

-  IN CONST UINTNCount,

-  IN CONST UINTNElementSize,

-  IN   SORT_COMPARE CompareFunction,

-  IN VOID   *Buffer

-  )

-{

-  VOID*Pivot;

-  UINTN   LoopCount;

-  UINTN   NextSwapLocation;

-

-  ASSERT(BufferToSort != NULL);

-  ASSERT(CompareFunction  != NULL);

-  ASSERT(Buffer  != NULL);

-

-  if ( Count < 2

-|| ElementSize  < 1

-   ){

-return;

-  }

-

-  NextSwapLocation = 0;

-

-  //

-  // pick a pivot (we choose last element)

-  //

-  Pivot = ((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 = 0

-  ; LoopCount < Count -1

-  ; LoopCount++

- ){

-//

-// if the element is less than the pivot

-//

-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);

-

-  //

-  // increment NextSwapLocation

-  //

-  NextSwapLocation++;

-}

-  }

-  //

-  // swap pivot to it's final position (NextSwapLocaiton)

-  //

-  CopyMem (Buffer, Pivot, ElementSize);

-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);

-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);

-

-  //

-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element

-  // IE list is sorted left half, pivot element, sorted right half...

-  //

-  if (NextSwapLocation >= 2) {

-QuickSortWorker(

-  BufferToSort,

-  NextSwapLocation,

-  ElementSize,

-  CompareFunction,

-  Buffer);

-  }

-

-  if ((Count - NextSwapLocation - 1) >= 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 
elem

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

2021-10-17 Thread 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  
Sent: Sunday, October 17, 2021 6:34 AM
To: devel@edk2.groups.io
Cc: Chan, Amy ; Ni, Ray ; Kuo, IanX 
; Dong, Eric ; Kumar, Rahul1 

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

From: IanX Kuo 

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

Remove MdeModulePkg dependency

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: IanX Kuo 
---
 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 

 #include 

 #include 

-#include 

 #include 

 

 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82190): https://edk2.groups.io/g/devel/message/82190
Mute This Topic: https://groups.io/mt/86381254/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-16 Thread IanX Kuo
From: IanX Kuo 

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

Remove MdeModulePkg dependency

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: IanX Kuo 
---
 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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82184): https://edk2.groups.io/g/devel/message/82184
Mute This Topic: https://groups.io/mt/86381254/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 2/3] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-16 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..33ff0fcdb6 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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, compare, Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82183): https://edk2.groups.io/g/devel/message/82183
Mute This Topic: https://groups.io/mt/86381253/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-16 Thread IanX Kuo
From: IanX Kuo 

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

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: IanX Kuo 
---
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 2 files changed, 8 insertions(+), 223 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
index a12c7bc0ec..0903943ee4 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
 CompareFunction,
-Buffer);
+Buffer
+);
 
   FreePool(Buffer);
   return;
diff --git a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c 
b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
index 46dc443638..29d8735c22 100644
--- a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
+++ b/MdeModulePkg/Library/UefiSortLib/U

[edk2-devel] [PATCH v3 0/3] Add function QuickSort into MdePkg/BaseLib

2021-10-16 Thread IanX Kuo
From: IanX Kuo 

1. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
1-1: Drop cast (V2)

2. CryptLib/CryptLib: Remove duplicate QuickSortWorker
2-1: Drop cast (V3)

3. CpuCacheInfoLib: Remove MdeModulePkg dependency
3-1: Drop cast (V2)
3-2: Add runtime check (V2)
3-3: Drop assert check (V3)

IanX Kuo (3):
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   8 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   1 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 7 files changed, 17 insertions(+), 319 deletions(-)

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82181): https://edk2.groups.io/g/devel/message/82181
Mute This Topic: https://groups.io/mt/86381251/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-15 Thread IanX Kuo
@Marvin Häuser<mailto:mhaeu...@posteo.de>

Thank to catch it. I dropped it on my patch v2.
Compiler
Status
Linux GCC5 (gcc 10.2.0/9.3.0/8.4.0/7.5.0/5.5.0/5.4.0)
Pass
Windows CLANGPDB (clang 12.0.0), Linux CLANGPDB (clang 12.0.0)
Pass
Windows MSVC (VS2015/VS2017/VS2019)
Pass
Mac XCODE5 (clang 11.0.0)
Pass




Thanks,
Ian Kuo


-Original Message-
From: Marvin Häuser 
Sent: Saturday, October 16, 2021 3:11 AM
To: devel@edk2.groups.io; Kuo, IanX 
Cc: Chan, Amy ; Ni, Ray ; Wang, Jian J 
; Liming Gao 
Subject: Re: [edk2-devel] [PATCH v1 1/3] MdeModulePkg/SortLib: Add QuickSort 
function on BaseLib



Good day Ianx,



On 15.10.21 16:33, IanX Kuo wrote:

> From: IanX Kuo mailto:ianx@intel.com>>

>

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

>

> Use QuickSort instead of QuickSortWorker

>

> Cc: Ray Ni mailto:ray...@intel.com>>

> Cc: Jian J Wang mailto:jian.j.w...@intel.com>>

> Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>

> Signed-off-by: IanX Kuo mailto:ianx@intel.com>>

> ---

>   .../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..b9ac7c 100644

> --- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c

> +++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c

> @@ -1,7 +1,7 @@

>   /** @file

> Library used for sorting routines.

>

> -  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

>

>   **/

> @@ -13,114 +13,6 @@

>   #include 

>   #include 

>

> -/**

> -  Worker function for QuickSorting.  This function is identical to

> PerformQuickSort,

> -  except that is uses the pre-allocated buffer so the in place

> sorting does 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) 
> elements

> - on return a buffer of sorted elements

> -  @param[in] Count   the number of elements in the buffer to sort

> -  @param[in] ElementSize Size of an element in bytes

> -  @param[in] CompareFunction The function to call to perform the 
> comparison

> - of any 2 elements

> -  @param[in] Buffer  Buffer of size ElementSize for use in 
> swapping

> -**/

> -VOID

> -EFIAPI

> -QuickSortWorker (

> -  IN OUT VOID   *BufferToSort,

> -  IN CONST UINTNCount,

> -  IN CONST UINTNElementSize,

> -  IN   SORT_COMPARE CompareFunction,

> -  IN VOID   *Buffer

> -  )

> -{

> -  VOID*Pivot;

> -  UINTN   LoopCount;

> -  UINTN   NextSwapLocation;

> -

> -  ASSERT(BufferToSort != NULL);

> -  ASSERT(CompareFunction  != NULL);

> -  ASSERT(Buffer  != NULL);

> -

> -  if ( Count < 2

> -|| ElementSize  < 1

> -   ){

> -return;

> -  }

> -

> -  NextSwapLocation = 0;

> -

> -  //

> -  // pick a pivot (we choose last element)

> -  //

> -  Pivot = ((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 = 0

> -  ; LoopCount < Count -1

> -  ; LoopCount++

> - ){

> -//

> -// if the element is less than the pivot

> -//

> -if 
> (CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot)
>  <= 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, 
> ElementSize);

> -

> -  //

> -  // increment NextSwapLocation

> -  //


[edk2-devel] [PATCH v2 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-15 Thread IanX Kuo
From: IanX Kuo 

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

Remove MdeModulePkg dependency

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Signed-off-by: IanX Kuo 
---
 UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 9 -
 .../Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf   | 2 --
 .../Library/CpuCacheInfoLib/InternalCpuCacheInfoLib.h| 1 -
 .../Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf   | 2 --
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c 
b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index c0077d6770..45c2ca13dc 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,13 @@ 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));
+ASSERT (QuickSortBuffer != NULL);
+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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82171): https://edk2.groups.io/g/devel/message/82171
Mute This Topic: https://groups.io/mt/86362184/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 2/3] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-15 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..b10edaae5b 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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, (BASE_SORT_COMPARE)compare, 
Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82170): https://edk2.groups.io/g/devel/message/82170
Mute This Topic: https://groups.io/mt/86362182/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-15 Thread IanX Kuo
From: IanX Kuo 

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

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: IanX Kuo 
---
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 2 files changed, 8 insertions(+), 223 deletions(-)

diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c 
b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
index a12c7bc0ec..0903943ee4 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
 CompareFunction,
-Buffer);
+Buffer
+);
 
   FreePool(Buffer);
   return;
diff --git a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c 
b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
index 46dc443638..29d8735c22 100644
--- a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c
+++ b/MdeModulePkg/Library/UefiSortLib/U

[edk2-devel] [PATCH v2 0/3] Add function QuickSort into MdePkg/BaseLib

2021-10-15 Thread IanX Kuo
From: IanX Kuo 

1. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
1-1: Drop cast (V2)

2. CryptLib/CryptLib: Remove duplicate QuickSortWorker
3. CpuCacheInfoLib: Remove MdeModulePkg dependency
3-1: Drop cast (V2)
3-2: Add runtime check (V2)

IanX Kuo (3):
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 115 +
 .../Library/UefiSortLib/UefiSortLib.c | 116 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   9 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   1 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 7 files changed, 18 insertions(+), 319 deletions(-)

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82168): https://edk2.groups.io/g/devel/message/82168
Mute This Topic: https://groups.io/mt/86362180/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 2/3] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-15 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..b10edaae5b 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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, (BASE_SORT_COMPARE)compare, 
Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82139): https://edk2.groups.io/g/devel/message/82139
Mute This Topic: https://groups.io/mt/86340401/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-15 Thread IanX Kuo
From: IanX Kuo 

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

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/UefiCpuPkg/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;
 
   //
   // 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 
(*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));
+ASSERT (QuickSortBuffer != NULL);
+QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), 
(BASE_SORT_COMPARE) 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 
 #include 
 #include 
-#include 
 #include 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82140): https://edk2.groups.io/g/devel/message/82140
Mute This Topic: https://groups.io/mt/86340402/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-15 Thread IanX Kuo
From: IanX Kuo 

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

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..b9ac7c 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
-CompareFunction,
-Buffer);
+(SORT_COMPARE) CompareFunction,
+Buffer
+);
 
   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/

[edk2-devel] [PATCH v1 0/3] Add function QuickSort into MdePkg/BaseLib

2021-10-15 Thread IanX Kuo
From: IanX Kuo 

1. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
2. CryptLib/CryptLib: Remove duplicate QuickSortWorker
3. CpuCacheInfoLib: Remove MdeModulePkg dependency

IanX Kuo (3):
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 117 +
 .../Library/UefiSortLib/UefiSortLib.c | 118 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   5 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   1 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 7 files changed, 16 insertions(+), 321 deletions(-)

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82137): https://edk2.groups.io/g/devel/message/82137
Mute This Topic: https://groups.io/mt/86340399/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v9 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-11 Thread IanX Kuo
@Liming Gao and @Kinney, Michael D

May I get one of yours help for the reviewed from MdePkg maintainer side ?
Have any concern, please also share for me.

Thanks,
Ian Kuo

-Original Message-
From: Ni, Ray  
Sent: Tuesday, October 12, 2021 10:22 AM
To: Kuo, IanX ; devel@edk2.groups.io
Cc: Chan, Amy ; Kinney, Michael D 
; Liming Gao ; Liu, 
Zhiguang 
Subject: RE: [PATCH v9 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib

Reviewed-by: Ray Ni 

Ian, please take the approval from maintainers of MdePkg as the formal approval.

Thanks,
Ray

> -Original Message-
> From: Kuo, IanX 
> Sent: Tuesday, October 12, 2021 8:06 AM
> To: devel@edk2.groups.io
> Cc: Chan, Amy ; Ni, Ray ; Kuo, 
> IanX ; Kinney, Michael D 
> ; Liming Gao ; 
> Liu, Zhiguang 
> Subject: [PATCH v9 1/1] MdePkg/BaseLib: Add QuickSort function on 
> BaseLib
> 
> From: IanX Kuo 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675
> 
> 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| 116 ++
>  .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
>  4 files changed, 168 insertions(+), 1 deletion(-)  create mode 100644 
> MdePkg/Library/BaseLib/QuickSort.c
> 
> diff --git a/MdePkg/Include/Library/BaseLib.h 
> b/MdePkg/Include/Library/BaseLib.h
> index 2452c1d92e..0ae0f4e6af 100644
> --- a/MdePkg/Include/Library/BaseLib.h
> +++ b/MdePkg/Include/Library/BaseLib.h
> @@ -2856,6 +2856,55 @@ 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
> 
> +  );
> 
> +
> 
> +/**
> 
> +  This function is identical to perform QuickSort,
> 
> +  except that is uses the pre-allocated buffer so the in place 
> + sorting does 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 BufferOneElement is NULL, then ASSERT.
> 
> +  if ElementSize is < 1, then ASSERT.
> 
> +
> 
> +  if Count is < 2 then perform no action.
> 
> +
> 
> +  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) 
> elements
> 
> + on return a buffer of sorted 
> + elements
> 
> +  @param[in] Count   the number of elements in the buffer to sort
> 
> +  @param[in] ElementSize Size of an element in bytes
> 
> +  @param[in] CompareFunction The function to call to perform the 
> comparison
> 
> + of any 2 elements
> 
> +  @param[out] BufferOneElement   Caller provided buffer whose size equals to 
> ElementSize.
> 
> + It's used by QuickSort() for swapping in 
> sorting.
> 
> +**/
> 
> +VOID
> 
> +EFIAPI
> 
> +QuickSort (
> 
> +  IN OUT VOID   *BufferToSort,
> 
> +  IN CONST UINTNCount,
> 
> +  IN CONST UINTNElementSize,
> 
> +  IN   BASE_SORT_COMPARECompareFunction,
> 
> +  OUT VOID  *BufferOneElement
> 
> +  );
> 
> 
> 
>  /**
> 
>Shifts a 64-bit integer left between 0 and 63 bits. The low bits 
> are filled
> 
> diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
> b/MdePkg/Library/BaseLib/BaseLib.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/Mde

Re: [edk2-devel] [PATCH v7 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-11 Thread IanX Kuo
I send Patch v9, have anyone free can help me for the reviewed by.
Patch v8 is "move SORT_COMPARE definition from 
MdeModulePkg\Include\Library\SortLib.h to MdePkg\Include\Library\BaseLib.h, and 
then let SortLib.h include BaseLib.h."

Patch v9 is rollback to Patch v7.

Thanks,
Ian Kuo
-Original Message-
From: devel@edk2.groups.io  On Behalf Of gaoliming
Sent: Monday, October 11, 2021 9:21 AM
To: 'Marvin Häuser' ; devel@edk2.groups.io; Kinney, Michael 
D ; Kuo, IanX 
Cc: Chan, Amy ; Ni, Ray ; Liu, Zhiguang 

Subject: 回复: [edk2-devel] [PATCH v7 1/1] MdePkg/BaseLib: Add QuickSort function 
on BaseLib

Michael and Marvin:
  I understand your concern. I want to reduce the duplicated definition for the 
same function. I will not keep my idea if you are both OK to define 
BASE_SORT_COMPARE and SORT_COMPARE. 

Thanks
Liming
> -邮件原件-
> 发件人: Marvin Häuser 
> 发送时间: 2021年10月9日 0:09
> 收件人: devel@edk2.groups.io; michael.d.kin...@intel.com; 
> gaolim...@byosoft.com.cn; Kuo, IanX 
> 抄送: Chan, Amy ; Ni, Ray ; Liu, 
> Zhiguang 
> 主题: Re: [edk2-devel] [PATCH v7 1/1] MdePkg/BaseLib: Add QuickSort 
> function on BaseLib
> 
> Hey all,
> 
> I also don't think it makes much logical sense. They are distinct APIs 
> in separate libraries that happen to take a function with the same 
> prototype.
> 
> I think the patches look good now, thanks!
> 
> Best regards,
> Marvin
> 
> On 08/10/2021 17:46, Michael D Kinney wrote:
> > Hi Liming,
> >
> > In general it is not a good idea to include a library include file 
> > from another
> library include file.
> >
> > This becomes a hidden dependency.
> >
> > Mike
> >
> >> -Original Message-
> >> From: devel@edk2.groups.io  On Behalf Of
> gaoliming
> >> Sent: Thursday, October 7, 2021 7:16 PM
> >> To: devel@edk2.groups.io; Kuo, IanX 
> >> Cc: Chan, Amy ; Ni, Ray ; 
> >> Kinney,
> Michael D ; Liu,
> >> Zhiguang 
> >> Subject: 回复: [edk2-devel] [PATCH v7 1/1] MdePkg/BaseLib: Add
> QuickSort function on BaseLib
> >>
> >> Kuo:
> >>I suggest to move SORT_COMPARE definition from 
> >> MdeModulePkg\Include\Library\SortLib.h to
> MdePkg\Include\Library\BaseLib.h,
> >> and then let SortLib.h include BaseLib.h.
> >>
> >> Thanks
> >> Liming
> >>> -邮件原件-
> >>> 发件人: devel@edk2.groups.io  代表 IanX Kuo
> >>> 发送时间: 2021年10月8日 8:27
> >>> 收件人: devel@edk2.groups.io
> >>> 抄送: amy.c...@intel.com; ray...@intel.com; IanX Kuo 
> >>> ; Michael D Kinney 
> >>> ; Liming Gao 
> >>> ; Zhiguang Liu 
> >>> 主题: [edk2-devel] [PATCH v7 1/1] MdePkg/BaseLib: Add QuickSort
> function
> >>> on BaseLib
> >>>
> >>> From: IanX Kuo 
> >>>
> >>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675
> >>>
> >>> 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| 116
> >>> ++
> >>>   .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
> >>>   4 files changed, 168 insertions(+), 1 deletion(-)
> >>>   create mode 100644 MdePkg/Library/BaseLib/QuickSort.c
> >>>
> >>> diff --git a/MdePkg/Include/Library/BaseLib.h
> >>> b/MdePkg/Include/Library/BaseLib.h
> >>> index 2452c1d92e..0ae0f4e6af 100644
> >>> --- a/MdePkg/Include/Library/BaseLib.h
> >>> +++ b/MdePkg/Include/Library/BaseLib.h
> >>> @@ -2856,6 +2856,55 @@ 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

[edk2-devel] [PATCH v9 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-11 Thread IanX Kuo
From: IanX Kuo 

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

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| 116 ++
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 4 files changed, 168 insertions(+), 1 deletion(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 2452c1d92e..0ae0f4e6af 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -2856,6 +2856,55 @@ 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
+  );
+
+/**
+  This function is identical to perform QuickSort,
+  except that is uses the pre-allocated buffer so the in place sorting does 
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 BufferOneElement is NULL, then ASSERT.
+  if ElementSize is < 1, then ASSERT.
+
+  if Count is < 2 then perform no action.
+
+  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ of any 2 elements
+  @param[out] BufferOneElement   Caller provided buffer whose size equals to 
ElementSize.
+ It's used by QuickSort() for swapping in 
sorting.
+**/
+VOID
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  OUT VOID  *BufferOneElement
+  );
 
 /**
   Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.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/QuickSort.c
new file mode 100644
index 00..a825c072b0
--- /dev/null
+++ b/MdePkg/Library/BaseLib/QuickSort.c
@@ -0,0 +1,116 @@
+/** @file
+  Math worker functions.
+
+  Copyright (c) 2021, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+  This function is identical to perform QuickSort,
+  except that is uses the pre-allocated buffer so the in place sorting does 
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 BufferOneElement is NULL, then ASSERT.
+  if ElementSize is < 1, then ASSERT.
+
+  if Count is < 2 then perform no action.
+
+  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ of any 2 elements
+  @param[out] BufferOneElement   Caller provided buffer whose size equals to 
ElementSize.
+ It's used by QuickSort() for swapping in 
sorting.
+**/
+VOID
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  OUT VOID  *BufferOneElement
+  )
+{
+  VOID*Pivot;
+  UINTN   Loop

[edk2-devel] [PATCH v9 0/1] Add function QuickSort into MdePkg/BaseLib

2021-10-11 Thread IanX Kuo
From: IanX Kuo 

First change
1. MdePkg/BaseLib: Add QuickSort function

It need to seperate to second change
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
3. CryptLib/CryptLib: Remove duplicate QuickSortWorker
4. CpuCacheInfoLib: Remove MdeModulePkg dependenc

IanX Kuo (1):
  MdePkg/BaseLib: Add QuickSort function on BaseLib

 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 116 ++
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 4 files changed, 168 insertions(+), 1 deletion(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81783): https://edk2.groups.io/g/devel/message/81783
Mute This Topic: https://groups.io/mt/86251045/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v8 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-07 Thread IanX Kuo
From: IanX Kuo 

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

Add QuickSort function into BaseLib

Cc: Ray Ni 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Signed-off-by: IanX Kuo 
---
 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |   8 +-
 MdeModulePkg/Include/Library/SortLib.h|   4 +-
 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 116 ++
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 6 files changed, 172 insertions(+), 9 deletions(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..d279ae7852 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.
 
-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
 
 **/
@@ -15,12 +15,6 @@ FILE  *stderr = NULL;
 FILE  *stdin  = NULL;
 FILE  *stdout = NULL;
 
-typedef
-int
-(*SORT_COMPARE)(
-  IN  VOID  *Buffer1,
-  IN  VOID  *Buffer2
-  );
 
 //
 // Duplicated from EDKII BaseSortLib for qsort() wrapper
diff --git a/MdeModulePkg/Include/Library/SortLib.h 
b/MdeModulePkg/Include/Library/SortLib.h
index 70789709a7..a152016510 100644
--- a/MdeModulePkg/Include/Library/SortLib.h
+++ b/MdeModulePkg/Include/Library/SortLib.h
@@ -1,13 +1,15 @@
 /** @file
   Library used for sorting and comparison routines.
 
-  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
 
 **/
 #ifndef __SORT_LIB_H__
 #define __SORT_LIB_H__
 
+#include 
+
 /**
   Prototype for comparison function for any two element types.
 
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 2452c1d92e..8234478377 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -2856,6 +2856,55 @@ 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 *SORT_COMPARE)(
+  IN CONST VOID *Buffer1,
+  IN CONST VOID *Buffer2
+  );
+
+/**
+  This function is identical to perform QuickSort,
+  except that is uses the pre-allocated buffer so the in place sorting does 
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 BufferOneElement is NULL, then ASSERT.
+  if ElementSize is < 1, then ASSERT.
+
+  if Count is < 2 then perform no action.
+
+  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ of any 2 elements
+  @param[out] BufferOneElement   Caller provided buffer whose size equals to 
ElementSize.
+ It's used by QuickSort() for swapping in 
sorting.
+**/
+VOID
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   SORT_COMPARE CompareFunction,
+  OUT VOID  *BufferOneElement
+  );
 
 /**
   Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.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/QuickSort.c
new file mode 100644
index 00..1bdedf8e53
--- /dev/null
+++ b/MdePkg/Library/BaseLib/QuickSort.c
@@ -0,0 +1,116 @@
+/** @file
+  Math worker functions.
+
+  Copyright (c) 2021, 

[edk2-devel] [PATCH v8 0/1] Add function QuickSort into MdePkg/BaseLib

2021-10-07 Thread IanX Kuo
From: IanX Kuo 

First change
1. MdePkg/BaseLib: Add QuickSort function

It need to seperate to second change
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
3. CryptLib/CryptLib: Remove duplicate QuickSortWorker
4. CpuCacheInfoLib: Remove MdeModulePkg dependency

IanX Kuo (1):
  MdePkg/BaseLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |   8 +-
 MdeModulePkg/Include/Library/SortLib.h|   4 +-
 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 116 ++
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 6 files changed, 172 insertions(+), 9 deletions(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81654): https://edk2.groups.io/g/devel/message/81654
Mute This Topic: https://groups.io/mt/86164171/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v7 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-07 Thread IanX Kuo
From: IanX Kuo 

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

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| 116 ++
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 4 files changed, 168 insertions(+), 1 deletion(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 2452c1d92e..0ae0f4e6af 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -2856,6 +2856,55 @@ 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
+  );
+
+/**
+  This function is identical to perform QuickSort,
+  except that is uses the pre-allocated buffer so the in place sorting does 
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 BufferOneElement is NULL, then ASSERT.
+  if ElementSize is < 1, then ASSERT.
+
+  if Count is < 2 then perform no action.
+
+  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ of any 2 elements
+  @param[out] BufferOneElement   Caller provided buffer whose size equals to 
ElementSize.
+ It's used by QuickSort() for swapping in 
sorting.
+**/
+VOID
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  OUT VOID  *BufferOneElement
+  );
 
 /**
   Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.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/QuickSort.c
new file mode 100644
index 00..a825c072b0
--- /dev/null
+++ b/MdePkg/Library/BaseLib/QuickSort.c
@@ -0,0 +1,116 @@
+/** @file
+  Math worker functions.
+
+  Copyright (c) 2021, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+  This function is identical to perform QuickSort,
+  except that is uses the pre-allocated buffer so the in place sorting does 
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 BufferOneElement is NULL, then ASSERT.
+  if ElementSize is < 1, then ASSERT.
+
+  if Count is < 2 then perform no action.
+
+  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ of any 2 elements
+  @param[out] BufferOneElement   Caller provided buffer whose size equals to 
ElementSize.
+ It's used by QuickSort() for swapping in 
sorting.
+**/
+VOID
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  OUT VOID  *BufferOneElement
+  )
+{
+  VOID*Pivot;
+  UINTN   Loop

[edk2-devel] [PATCH v7 0/1] Add function QuickSort into MdePkg/BaseLib

2021-10-07 Thread IanX Kuo
From: IanX Kuo 

First change
1. MdePkg/BaseLib: Add QuickSort function

It need to seperate to second change
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker 3. 
CryptLib/CryptLib: Remove duplicate QuickSortWorker 4. CpuCacheInfoLib: Remove 
MdeModulePkg dependency

IanX Kuo (1):
  MdePkg/BaseLib: Add QuickSort function on BaseLib

 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 116 ++
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 4 files changed, 168 insertions(+), 1 deletion(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81614): https://edk2.groups.io/g/devel/message/81614
Mute This Topic: https://groups.io/mt/86159727/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v6 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-05 Thread IanX Kuo
From: IanX Kuo 

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

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| 116 ++
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 4 files changed, 168 insertions(+), 1 deletion(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 2452c1d92e..0ae0f4e6af 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -2856,6 +2856,55 @@ 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
+  );
+
+/**
+  This function is identical to perform QuickSort,
+  except that is uses the pre-allocated buffer so the in place sorting does 
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 BufferOneElement is NULL, then ASSERT.
+  if ElementSize is < 1, then ASSERT.
+
+  if Count is < 2 then perform no action.
+
+  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ of any 2 elements
+  @param[out] BufferOneElement   Caller provided buffer whose size equals to 
ElementSize.
+ It's used by QuickSort() for swapping in 
sorting.
+**/
+VOID
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  OUT VOID  *BufferOneElement
+  );
 
 /**
   Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.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/QuickSort.c
new file mode 100644
index 00..3aff18188b
--- /dev/null
+++ b/MdePkg/Library/BaseLib/QuickSort.c
@@ -0,0 +1,116 @@
+/** @file
+  Math worker functions.
+
+  Copyright (c) 2021, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "BaseLibInternals.h"
+
+/**
+  This function is identical to perform QuickSort,
+  except that is uses the pre-allocated buffer so the in place sorting does 
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 BufferOneElement is NULL, then ASSERT.
+  if ElementSize is < 1, then ASSERT.
+
+  if Count is < 2 then perform no action.
+
+  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ of any 2 elements
+  @param[out] BufferOneElement   Caller provided buffer whose size equals to 
ElementSize.
+ It's used by QuickSort() for swapping in 
sorting.
+**/
+VOID
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  OUT VOID  *BufferOneElement
+  )
+{
+  VOID*Pivot;
+  UINTN   Loop

[edk2-devel] [PATCH v6 0/1] Add function QuickSort into MdePkg/BaseLib

2021-10-05 Thread IanX Kuo
From: IanX Kuo 

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

First change
1. MdePkg/BaseLib: Add QuickSort function

It need to seperate to second change
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
3. CryptLib/CryptLib: Remove duplicate QuickSortWorker
4. CpuCacheInfoLib: Remove MdeModulePkg dependency

IanX Kuo (1):
  MdePkg/BaseLib: Add QuickSort function on BaseLib

 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 116 ++
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 4 files changed, 168 insertions(+), 1 deletion(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81530): https://edk2.groups.io/g/devel/message/81530
Mute This Topic: https://groups.io/mt/86108887/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v5 1/4] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-04 Thread IanX Kuo
Hi Marvin

Reply in mail

Thanks,
Ian Kuo

-Original Message-
From: Marvin Häuser  
Sent: Monday, October 4, 2021 8:56 PM
To: devel@edk2.groups.io; Kuo, IanX 
Cc: Chan, Amy ; Ni, Ray ; Kinney, Michael 
D ; Liming Gao ; Liu, 
Zhiguang 
Subject: Re: [edk2-devel] [PATCH v5 1/4] MdePkg/BaseLib: Add QuickSort function 
on BaseLib

Good day IanX,

On 04/10/2021 07:03, IanX Kuo wrote:
> From: IanX Kuo 
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675
>
> 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/BaseLib.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
>   
>   #ifndef __BASE_LIB__
>   #define __BASE_LIB__
> +#include 

Accidental change?
Ian: No,  Without it, it won't find type "EFI_STATUS" and will cause build 
error. Origin return type is "VOID" on function "VOID QuickSortWorker". 
And my change "EFI_STATUS QuickSort", so "EFI_STATUS" depends on 
"UefiBaseType.h"


>   
>   //
>   // 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.

"Worker" functions are usually private.
Ian: Thank for reply, will remove "Worker" in my next patch.

> This function is identical to perform QuickSort,
> +  except that is uses the pre-allocated buffer so the in place 
> + sorting does not need to  allocate and free buffers constantly.
> +
> +  Each element must be equal sized.
> +
> +  if Count is < 2 then perform no action.

This follows directly from the definition of sorting.

> +  if Size is < 1 then perform no action.

It would be perfectly valid to ASSERT on this in my opinion, so I would not 
hardcode the behaviour in the function spec.

> +
> +  @param[in, out] BufferToSort   on call a Buffer of (possibly sorted) 
> elements
> + on return a buffer of sorted elements
> +  @param[in] Count   the number of elements in the buffer to sort
> +  @param[in] ElementSize Size of an element in bytes
> +  @param[in] CompareFunction The function to call to perform the 
> comparison
> + of any 2 elements
> +  @param [in] BufferOneElement   Caller provided buffer whose size equals to 
> ElementSize.
> + It's used by QuickSort() for swapping in 
> sorting.

This is out, not in. Maybe add a note its content is undefined on return?
Ian: Got it, will change parameter type from "[in]" to "[out]" in my next patch.

> +
> +  @retval EFI_SUCCESSThe quick sort is finished.
> +  @retval EFI_INVALID_PARAMETER  When BufferToSort is NULL, 
> + CompareFunction is NULL or Buffer is NULL

These constraints are all caller constraints and not constraints on e.g. 
untrusted, external data. Hence, in my opinion it is perfectly valid to ASSERT 
them rather than runtime-check and emit status codes. This would mean the 
function could return VOID, there'd be no need to check status codes, and 
there'd be no need to worry about intermediate states (e.g. 
what is the content of BufferToSort when an error is returned?).
Ian: Got it, will change return type from "EFI_STATUS" to "VOID" in my next 
patch.

> +**/
> +EFI_STATUS
> +EFIAPI
> +QuickSort (
> +  IN OUT VOID   *BufferToSort,
> +  IN CONST UINTN

[edk2-devel] [PATCH v5 4/4] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/UefiCpuPkg/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;
 
   //
   // 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 
(*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));
+ASSERT (QuickSortBuffer != NULL);
+QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), 
(BASE_SORT_COMPARE) 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..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 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81417): https://edk2.groups.io/g/devel/message/81417
Mute This Topic: https://groups.io/mt/86059873/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 3/4] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index 42235ab96a..b10edaae5b 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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, (BASE_SORT_COMPARE)compare, 
Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81415): https://edk2.groups.io/g/devel/message/81415
Mute This Topic: https://groups.io/mt/86059871/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 2/4] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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..b9ac7c 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
-CompareFunction,
-Buffer);
+(SORT_COMPARE) CompareFunction,
+Buffer
+);
 
   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/

[edk2-devel] [PATCH v5 1/4] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/BaseLib.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
 
 #ifndef __BASE_LIB__
 #define __BASE_LIB__
+#include 
 
 //
 // 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 does 
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) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ 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_SUCCESSThe quick sort is finished.
+  @retval EFI_INVALID_PARAMETER  When BufferToSort is NULL, CompareFunction is 
NULL or Buffer is NULL
+**/
+EFI_STATUS
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  IN VOID   *BufferOneElement
+  );
 
 /**
   Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.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/QuickSort.c
new file mode 100644
index 00..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 does 
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) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ 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_SUCCESSThe quick sort is finished.
+  @retval EFI_INVALID_PARAMETER  When BufferToSort is NULL, CompareFunction is 
NULL, or BufferOneElement is NULL

[edk2-devel] [PATCH v5 0/4] Add function QuickSort into MdePkg/BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

1. MdePkg/BaseLib: Add QuickSort function
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
3. CryptLib/CryptLib: Remove duplicate QuickSortWorker
4. CpuCacheInfoLib: Remove MdeModulePkg dependency

IanX Kuo (4):
  MdePkg/BaseLib: Add QuickSort function on BaseLib
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 117 +
 .../Library/UefiSortLib/UefiSortLib.c | 118 +-
 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 117 +
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   5 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   2 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 11 files changed, 185 insertions(+), 323 deletions(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81413): https://edk2.groups.io/g/devel/message/81413
Mute This Topic: https://groups.io/mt/86059845/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 4/4] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/UefiCpuPkg/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;
 
   //
   // 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 
(*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));
+ASSERT (QuickSortBuffer != NULL);
+QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), 
(BASE_SORT_COMPARE) 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..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 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
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/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 3/4] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
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/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 2/4] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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..b9ac7c 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
-CompareFunction,
-Buffer);
+(SORT_COMPARE) CompareFunction,
+Buffer
+);
 
   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/

[edk2-devel] [PATCH v4 0/4] Add function QuickSort into MdePkg/BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

1. MdePkg/BaseLib: Add QuickSort function
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
3. CryptLib/CryptLib: Remove duplicate QuickSortWorker
4. CpuCacheInfoLib: Remove MdeModulePkg dependency

IanX Kuo (4):
  MdePkg/BaseLib: Add QuickSort function on BaseLib
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 117 +
 .../Library/UefiSortLib/UefiSortLib.c | 118 +-
 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 117 +
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   5 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   2 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 11 files changed, 185 insertions(+), 323 deletions(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81408): https://edk2.groups.io/g/devel/message/81408
Mute This Topic: https://groups.io/mt/86059685/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4 1/4] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/BaseLib.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
 
 #ifndef __BASE_LIB__
 #define __BASE_LIB__
+#include 
 
 //
 // 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 does 
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) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ 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_SUCCESSThe quick sort is finished.
+  @retval EFI_INVALID_PARAMETER  When BufferToSort is NULL, CompareFunction is 
NULL or Buffer is NULL
+**/
+EFI_STATUS
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  IN VOID   *BufferOneElement
+  );
 
 /**
   Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.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/QuickSort.c
new file mode 100644
index 00..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 does 
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) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ 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_SUCCESSThe quick sort is finished.
+  @retval EFI_INVALID_PARAMETER  When BufferToSort is NULL, CompareFunction is 
NULL, or BufferOneElement is NULL

[edk2-devel] [PATCH v3 2/4] MdeModulePkg/SortLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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..b9ac7c 100644
--- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
+++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c
@@ -1,7 +1,7 @@
 /** @file
   Library used for sorting routines.
 
-  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
 
 **/
@@ -13,114 +13,6 @@
 #include 
 #include 
 
-/**
-  Worker function for QuickSorting.  This function is identical to 
PerformQuickSort,
-  except that is uses the pre-allocated buffer so the in place sorting does 
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) elements
- on return a buffer of sorted elements
-  @param[in] Count   the number of elements in the buffer to sort
-  @param[in] ElementSize Size of an element in bytes
-  @param[in] CompareFunction The function to call to perform the comparison
- of any 2 elements
-  @param[in] Buffer  Buffer of size ElementSize for use in swapping
-**/
-VOID
-EFIAPI
-QuickSortWorker (
-  IN OUT VOID   *BufferToSort,
-  IN CONST UINTNCount,
-  IN CONST UINTNElementSize,
-  IN   SORT_COMPARE CompareFunction,
-  IN VOID   *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort != NULL);
-  ASSERT(CompareFunction  != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if ( Count < 2
-|| ElementSize  < 1
-   ){
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0
-  ; LoopCount < Count -1
-  ; LoopCount++
- ){
-//
-// if the element is less than the pivot
-//
-if 
(CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) 
<= 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, 
ElementSize);
-
-  //
-  // increment NextSwapLocation
-  //
-  NextSwapLocation++;
-}
-  }
-  //
-  // swap pivot to it's final position (NextSwapLocaiton)
-  //
-  CopyMem (Buffer, Pivot, ElementSize);
-  CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), 
ElementSize);
-  CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 paritial lists.  neither of these will have the 'pivot' 
element
-  // IE list is sorted left half, pivot element, sorted right half...
-  //
-  if (NextSwapLocation >= 2) {
-QuickSortWorker(
-  BufferToSort,
-  NextSwapLocation,
-  ElementSize,
-  CompareFunction,
-  Buffer);
-  }
-
-  if ((Count - NextSwapLocation - 1) >= 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 
elements.
 
@@ -156,12 +48,13 @@ PerformQuickSort (
   Buffer = AllocateZeroPool(ElementSize);
   ASSERT(Buffer != NULL);
 
-  QuickSortWorker(
+  QuickSort (
 BufferToSort,
 Count,
 ElementSize,
-CompareFunction,
-Buffer);
+(SORT_COMPARE) CompareFunction,
+Buffer
+);
 
   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/

[edk2-devel] [PATCH v3 1/4] MdePkg/BaseLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/BaseLib.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
 
 #ifndef __BASE_LIB__
 #define __BASE_LIB__
+#include 
 
 //
 // 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 does 
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) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ 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_SUCCESSThe quick sort is finished.
+  @retval EFI_INVALID_PARAMETER  When BufferToSort is NULL, CompareFunction is 
NULL or Buffer is NULL
+**/
+EFI_STATUS
+EFIAPI
+QuickSort (
+  IN OUT VOID   *BufferToSort,
+  IN CONST UINTNCount,
+  IN CONST UINTNElementSize,
+  IN   BASE_SORT_COMPARECompareFunction,
+  IN VOID   *BufferOneElement
+  );
 
 /**
   Shifts a 64-bit integer left between 0 and 63 bits. The low bits are filled
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.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/QuickSort.c
new file mode 100644
index 00..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 does 
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) elements
+ on return a buffer of sorted elements
+  @param[in] Count   the number of elements in the buffer to sort
+  @param[in] ElementSize Size of an element in bytes
+  @param[in] CompareFunction The function to call to perform the comparison
+ 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_SUCCESSThe quick sort is finished.
+  @retval EFI_INVALID_PARAMETER  When BufferToSort is NULL, CompareFunction is 
NULL, or BufferOneElement is NULL

[edk2-devel] [PATCH v3 4/4] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/UefiCpuPkg/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;
 
   //
   // 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 
(*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));
+ASSERT (QuickSortBuffer != NULL);
+QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), 
(BASE_SORT_COMPARE) 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..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 
 
 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81407): https://edk2.groups.io/g/devel/message/81407
Mute This Topic: https://groups.io/mt/86057883/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 3/4] CryptoPkg/CryptLib: Add QuickSort function on BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

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/CryptoPkg/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.
 
-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
 
 **/
@@ -22,91 +22,6 @@ int
   IN  VOID  *Buffer2
   );
 
-//
-// Duplicated from EDKII BaseSortLib for qsort() wrapper
-//
-STATIC
-VOID
-QuickSortWorker (
-  IN OUTVOID  *BufferToSort,
-  IN CONST  UINTN Count,
-  IN CONST  UINTN ElementSize,
-  INSORT_COMPARE  CompareFunction,
-  INVOID  *Buffer
-  )
-{
-  VOID*Pivot;
-  UINTN   LoopCount;
-  UINTN   NextSwapLocation;
-
-  ASSERT(BufferToSort!= NULL);
-  ASSERT(CompareFunction != NULL);
-  ASSERT(Buffer  != NULL);
-
-  if (Count < 2 || ElementSize  < 1) {
-return;
-  }
-
-  NextSwapLocation = 0;
-
-  //
-  // Pick a pivot (we choose last element)
-  //
-  Pivot = ((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 = 0; LoopCount < Count - 1;  LoopCount++)
-  {
-//
-// If the element is less than the pivot
-//
-if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * 
ElementSize)), Pivot) <= 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, 
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), Buffer, 
ElementSize);
-
-  //
-  // Now recurse on 2 partial lists.  Neither of these will have the 'pivot' 
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 = malloc (width);
   ASSERT (Buffer != NULL);
 
-  //
-  // Re-use PerformQuickSort() function Implementation in EDKII BaseSortLib.
-  //
-  QuickSortWorker (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, 
Buffer);
+  QuickSort (base, (UINTN)num, (UINTN)width, (SORT_COMPARE)compare, Buffer);
 
   free (Buffer);
   return;
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81405): https://edk2.groups.io/g/devel/message/81405
Mute This Topic: https://groups.io/mt/86057881/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 0/4] Add function QuickSort into MdePkg/BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

1. MdePkg/BaseLib: Add QuickSort function
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
3. CryptLib/CryptLib: Remove duplicate QuickSortWorker
4. CpuCacheInfoLib: Remove MdeModulePkg dependency


IanX Kuo (4):
  MdePkg/BaseLib: Add QuickSort function on BaseLib
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 117 +
 .../Library/UefiSortLib/UefiSortLib.c | 118 +-
 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 117 +
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   5 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   2 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 11 files changed, 185 insertions(+), 323 deletions(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81404): https://edk2.groups.io/g/devel/message/81404
Mute This Topic: https://groups.io/mt/86057880/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 0/4] Add function QuickSort into MdePkg/BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

1. MdePkg/BaseLib: Add QuickSort function
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
3. CryptLib/CryptLib: Remove duplicate QuickSortWorker
4. CpuCacheInfoLib: Remove MdeModulePkg dependency


IanX Kuo (4):
  MdePkg/BaseLib: Add QuickSort function on BaseLib
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 117 +
 .../Library/UefiSortLib/UefiSortLib.c | 118 +-
 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 117 +
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   5 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   2 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 11 files changed, 185 insertions(+), 323 deletions(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81402): https://edk2.groups.io/g/devel/message/81402
Mute This Topic: https://groups.io/mt/86057728/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 0/4] Add function QuickSort into MdePkg/BaseLib

2021-10-03 Thread IanX Kuo
From: IanX Kuo 

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

1. MdePkg/BaseLib: Add QuickSort function
2. MdeModulePkg/SortLib: Use QuickSort instead of QuickSortWorker
3. CryptLib/CryptLib: Remove duplicate QuickSortWorker
4. CpuCacheInfoLib: Remove MdeModulePkg dependency

IanX Kuo (4):
  MdePkg/BaseLib: Add QuickSort function on BaseLib
  MdeModulePkg/SortLib: Add QuickSort function on BaseLib
  CryptoPkg/CryptLib: Add QuickSort function on BaseLib
  UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

 .../Library/BaseCryptLib/SysCall/CrtWrapper.c |  92 +-
 .../Library/BaseSortLib/BaseSortLib.c | 117 +
 .../Library/UefiSortLib/UefiSortLib.c | 118 +-
 MdePkg/Include/Library/BaseLib.h  |  49 
 MdePkg/Library/BaseLib/BaseLib.inf|   1 +
 MdePkg/Library/BaseLib/QuickSort.c| 117 +
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |   3 +-
 .../Library/CpuCacheInfoLib/CpuCacheInfoLib.c |   5 +-
 .../CpuCacheInfoLib/DxeCpuCacheInfoLib.inf|   2 -
 .../CpuCacheInfoLib/InternalCpuCacheInfoLib.h |   2 -
 .../CpuCacheInfoLib/PeiCpuCacheInfoLib.inf|   2 -
 11 files changed, 185 insertions(+), 323 deletions(-)
 create mode 100644 MdePkg/Library/BaseLib/QuickSort.c

-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#81401): https://edk2.groups.io/g/devel/message/81401
Mute This Topic: https://groups.io/mt/86057204/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3] MinPlatformPkg/Fsp: Rebase fail when python tools path exist whitespace REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3412

2021-05-24 Thread IanX Kuo
From: IanX Kuo 

(a) C:\Users\\AppData\Local\Program\Python\Python38
(b) C:\Python38
(c) C:\Program Files\Python38
Issue only happens on (a) and (c).
(a) happen on  have whitespace. Ex: Tony Chen
(c) happen on "Program Files" have whitespace.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Signed-off-by: IanX Kuo 
---
 .../Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py| 6 +++---
 .../MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py 
b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
index 406e5ec130..f3cba2651a 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
@@ -1,6 +1,6 @@
 ## @ RebaseAndPatchFspBinBaseAddress.py
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 
@@ -93,13 +93,13 @@ fspTBaseAddress = flashBase + fspTBaseOffset
 # Re-base FSP bin file to new address and save it as fspBinFileRebased using 
SplitFspBin.py
 #
 rebaseArguments = fspBinFilePath + " -c s m t -b " + 
str(hex(fspSBaseAddress).rstrip("L")) + " " + 
str(hex(fspMBaseAddress).rstrip("L")) + " " + 
str(hex(fspTBaseAddress).rstrip("L")) + " -o" + fspBinPath + " -n " + 
fspBinFileRebased
-os.system(pythontool + " " + splitFspBinPath + " rebase -f" + rebaseArguments)
+os.system('"' + pythontool + '"' + " " + splitFspBinPath + " rebase -f" + 
rebaseArguments)
 
 #
 # Split FSP bin to FSP-S/M/T segments
 #
 splitArguments = fspBinPath + os.sep + fspBinFileRebased + " -o " + fspBinPath 
+ " -n Fsp_Rebased.fd"
-os.system(pythontool + " " + splitFspBinPath + " split -f" + splitArguments)
+os.system('"' + pythontool + '"' + " " + splitFspBinPath + " split -f" + 
splitArguments)
 
 #
 # Patch dsc file with the re-based FSP-S/M/T address, so internally build will 
use the same.
diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py 
b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
index fb4cf4f9b7..b7e4bcf5f9 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
@@ -1,6 +1,6 @@
 ## @ RebaseFspBinBaseAddress.py
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 
@@ -87,12 +87,12 @@ fspTBaseAddress = flashBase + fspTBaseOffset
 # Re-base FSP bin file to new address and save it as fspBinFileRebased using 
SplitFspBin.py
 #
 rebaseArguments = fspBinFilePath + " -c s m t -b " + 
str(hex(fspSBaseAddress).rstrip("L")) + " " + 
str(hex(fspMBaseAddress).rstrip("L")) + " " + 
str(hex(fspTBaseAddress).rstrip("L")) + " -o" + fspBinPath + " -n " + 
fspBinFileRebased
-os.system(pythontool + " " + splitFspBinPath + " rebase -f" + rebaseArguments)
+os.system('"' + pythontool + '"' + " " + splitFspBinPath + " rebase -f" + 
rebaseArguments)
 
 #
 # Split FSP bin to FSP-S/M/T segments
 #
 splitArguments = fspBinPath + os.sep + fspBinFileRebased + " -o " + fspBinPath 
+ " -n Fsp_Rebased.fd"
-os.system(pythontool + " " + splitFspBinPath + " split -f" + splitArguments)
+os.system('"' + pythontool + '"' + " " + splitFspBinPath + " split -f" + 
splitArguments)
 
 exit(0)
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75504): https://edk2.groups.io/g/devel/message/75504
Mute This Topic: https://groups.io/mt/83047301/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2] MinPlatformPkg/Fsp: Rebase fail when python tools path exist whitespace

2021-05-23 Thread IanX Kuo
From: IanX Kuo 

(a) C:\Users\\AppData\Local\Program\Python\Python38
(b) C:\Python38
(c) C:\Program Files\Python38
Issue only happens on (a) and (c).
(a) happen on  have whitespace. Ex: Tony Chen
(c) happen on "Program Files" have whitespace.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Signed-off-by: IanX Kuo 
---
 .../Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py| 6 +-
 .../MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py 
b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
index 406e5ec130..a3d5263ad0 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
@@ -70,12 +70,16 @@ for line in flashmap.split("\n"):
 file.close()
 
 #
-# Get FSP-M Size, in order to calculate the FSP-T Base. Used SplitFspBin.py 
script 
+# Get FSP-M Size, in order to calculate the FSP-T Base. Used SplitFspBin.py 
script
 # to dump the header, and get the ImageSize in FSP-M section
 #
 pythontool = 'python'
 if 'PYTHON_HOME' in os.environ:
 pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python'
+else:
+pythontool = sys.executable
+pythontool = "\"" + pythontool + "\""
+
 Process = subprocess.Popen([pythontool, splitFspBinPath, 
"info","-f",fspBinFilePath], stdout=subprocess.PIPE)
 Output = Process.communicate()[0]
 FsptInfo = Output.rsplit(b"FSP_M", 1);
diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py 
b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
index fb4cf4f9b7..50e442a500 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
@@ -70,6 +70,8 @@ if 'PYTHON_HOME' in os.environ:
 pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python'
 else:
 pythontool = sys.executable
+pythontool = "\"" + pythontool + "\""
+
 Process = subprocess.Popen([pythontool, splitFspBinPath, 
"info","-f",fspBinFilePath], stdout=subprocess.PIPE)
 Output = Process.communicate()[0]
 FsptInfo = Output.rsplit(b"FSP_M", 1);
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75471): https://edk2.groups.io/g/devel/message/75471
Mute This Topic: https://groups.io/mt/83041135/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1] MinPlatformPkg/Fsp: Rebase fail when python tools path exist whitespace

2021-05-23 Thread IanX Kuo
From: IanX Kuo 

(a) C:\Users\\AppData\Local\Program\Python\Python38
(b) C:\Python38
(c) C:\Program Files\Python38
Issue only happens on (a) and (c).
(a) happen on  have whitespace. Ex: Tony Chen
(c) happen on "Program Files" have whitespace.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Signed-off-by: IanX Kuo 
---
 .../Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py| 6 +-
 .../MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py 
b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
index 406e5ec130..de2d49d55e 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseAndPatchFspBinBaseAddress.py
@@ -1,6 +1,6 @@
 ## @ RebaseAndPatchFspBinBaseAddress.py
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 
@@ -76,6 +76,10 @@ file.close()
 pythontool = 'python'
 if 'PYTHON_HOME' in os.environ:
 pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python'
+else:
+pythontool = sys.executable
+pythontool = "\"" + pythontool + "\""
+
 Process = subprocess.Popen([pythontool, splitFspBinPath, 
"info","-f",fspBinFilePath], stdout=subprocess.PIPE)
 Output = Process.communicate()[0]
 FsptInfo = Output.rsplit(b"FSP_M", 1);
diff --git a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py 
b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
index fb4cf4f9b7..d9adb78ca2 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
@@ -1,6 +1,6 @@
 ## @ RebaseFspBinBaseAddress.py
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 
@@ -70,6 +70,8 @@ if 'PYTHON_HOME' in os.environ:
 pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python'
 else:
 pythontool = sys.executable
+pythontool = "\"" + pythontool + "\""
+
 Process = subprocess.Popen([pythontool, splitFspBinPath, 
"info","-f",fspBinFilePath], stdout=subprocess.PIPE)
 Output = Process.communicate()[0]
 FsptInfo = Output.rsplit(b"FSP_M", 1);
-- 
2.30.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75470): https://edk2.groups.io/g/devel/message/75470
Mute This Topic: https://groups.io/mt/83040666/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5] ShellPkg/Pci: Add valid check for PCI extended config space parser

2021-03-22 Thread IanX Kuo
From: VincentX Ke 

[edk2-devel] [PATCH v5]
From: VincentX Ke 

Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)

No need to print PCIe details while CapabilityId is 0x.
Limit the NextCapabilityOffset to PCI/PCIe configuration space.

Cc: Ray Ni 
Cc: Zhichao Gao 
Signed-off-by: VincentX Ke 
Change-Id: I951d0a040154873e6459730e76eccca36c31f6c2
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index a2f04d8db5..1e5dc75e27 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2038,12 +2038,14 @@ LocatePciCapability (
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   );
 
@@ -2921,6 +2923,7 @@ ShellCommandRunPci (
 PciExplainPciExpress (
   (PCI_CAPABILITY_PCIEXP *) ((UINT8 *) &ConfigSpace + 
PcieCapabilityPtr),
   ExtendedConfigSpace,
+  ExtendedConfigSize,
   ExtendedCapability
   );
   }
@@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   )
 {
@@ -5786,7 +5791,7 @@ PciExplainPciExpress (
   }
 
   ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
-  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
+  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && 
ExtHdr->CapabilityId != 0x) {
 //
 // Process this item
 //
@@ -5800,7 +5805,8 @@ PciExplainPciExpress (
 //
 // Advance to the next item if it exists
 //
-if (ExtHdr->NextCapabilityOffset != 0) {
+if (ExtHdr->NextCapabilityOffset != 0 &&
+   (ExtHdr->NextCapabilityOffset <= (UINT32) (ExtendedConfigSize + 
EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR {
   ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + 
ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
 } else {
   break;
-- 
2.18.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#73069): https://edk2.groups.io/g/devel/message/73069
Mute This Topic: https://groups.io/mt/81519102/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v4] ShellPkg/Pci: Add valid check for PCI extended config space parser

2021-03-17 Thread IanX Kuo
From: VincentX Ke 

Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)

No need to print PCIe details while CapabilityId is 0x.
Limit the NextCapabilityOffset to PCI/PCIe configuration space.

Signed-off-by: VincentX Ke 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index a2f04d8db5..1e5dc75e27 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2038,12 +2038,14 @@ LocatePciCapability (
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   );
 
@@ -2921,6 +2923,7 @@ ShellCommandRunPci (
 PciExplainPciExpress (
   (PCI_CAPABILITY_PCIEXP *) ((UINT8 *) &ConfigSpace + 
PcieCapabilityPtr),
   ExtendedConfigSpace,
+  ExtendedConfigSize,
   ExtendedCapability
   );
   }
@@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   )
 {
@@ -5786,7 +5791,7 @@ PciExplainPciExpress (
   }
 
   ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
-  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
+  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && 
ExtHdr->CapabilityId != 0x) {
 //
 // Process this item
 //
@@ -5800,7 +5805,8 @@ PciExplainPciExpress (
 //
 // Advance to the next item if it exists
 //
-if (ExtHdr->NextCapabilityOffset != 0) {
+if (ExtHdr->NextCapabilityOffset != 0 &&
+   (ExtHdr->NextCapabilityOffset <= (UINT32) (ExtendedConfigSize + 
EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR {
   ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + 
ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
 } else {
   break;
-- 
2.18.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72997): https://edk2.groups.io/g/devel/message/72997
Mute This Topic: https://groups.io/mt/81421888/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH] ShellPkg/Pci: Add valid check for PCI extended config space parser

2021-03-17 Thread IanX Kuo
Hi Laszlo

Thanks for the remind. I will take care the date and Patch v4 in our next patch.

Thanks,
Ian Kuo
-Original Message-
From: Laszlo Ersek  
Sent: Thursday, March 18, 2021 5:01 AM
To: devel@edk2.groups.io; Kuo, IanX 
Cc: Ke, VincentX 
Subject: Re: [edk2-devel] [PATCH] ShellPkg/Pci: Add valid check for PCI 
extended config space parser

Vincent, Ian:

something is seriously broken in your email setup. I have seen three messages 
from you guys on the list, and each one of those is "from the future". Here are 
the Date headers from the messages:

- Date: Thu,  8 Apr 2021 05:50:21 +0800
  https://edk2.groups.io/g/devel/message/72748

- Date: Sat, 10 Apr 2021 01:34:45 +0800
  https://edk2.groups.io/g/devel/message/72862

- Date: Sat, 10 Apr 2021 22:15:09 +0800
  https://edk2.groups.io/g/devel/message/72953

Please fix your clock setup, and post a new version.

This is why I am asking: the git-am manual says,

   --ignore-date
   By default the command records the date from the e-mail
   message as the commit author date, and uses the time of
   commit creation as the committer date. [...]

When we merge a patch using a github.com Pull Request, the "mergify bot"
preserves the Author Date field. That's a good thing in itself, but it means 
that the edk2 commit history would have a patch from the future -- a patch 
committed in March, but "authored" in April. That's bogus.

Whoever actually applies the patch (probably the ShellPkg maintainer) can work 
around the issue, by specifying the "--ignore-date" flag for "git-am". But 
that's easy to forget, and not the right thing anyway.

So please just fix your broken clock, and post a new version.

Also: you should have used v1, v2, v3 in the subject prefixes (just pass -v1, 
-v2, -v3 to git-format-patch). The next version that you post should be marked 
"v4".

Thanks
Laszlo


On 04/10/21 16:15, IanX Kuo wrote:
> From: VincentX Ke 
> 
> Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)
> 
> No need to print PCIe details while CapabilityId is 0x.
> Limit the NextCapabilityOffset to PCI configuration space.
> 
> Signed-off-by: VincentX Ke 
> ---
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> index a2f04d8db5..1e5dc75e27 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
> @@ -2038,12 +2038,14 @@ LocatePciCapability (
>  
>@param[in] PciExpressCap   PCI Express capability buffer.
>@param[in] ExtendedConfigSpace PCI Express extended configuration space.
> +  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
>@param[in] ExtendedCapability  PCI Express extended capability ID to 
> explain.
>  **/
>  VOID
>  PciExplainPciExpress (
>IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
>IN  UINT8  *ExtendedConfigSpace,
> +  IN  UINTN  ExtendedConfigSize,
>IN CONST UINT16ExtendedCapability
>);
>  
> @@ -2921,6 +2923,7 @@ ShellCommandRunPci (
>  PciExplainPciExpress (
>(PCI_CAPABILITY_PCIEXP *) ((UINT8 *) &ConfigSpace + 
> PcieCapabilityPtr),
>ExtendedConfigSpace,
> +  ExtendedConfigSize,
>ExtendedCapability
>);
>}
> @@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
>  
>@param[in] PciExpressCap   PCI Express capability buffer.
>@param[in] ExtendedConfigSpace PCI Express extended configuration space.
> +  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
>@param[in] ExtendedCapability  PCI Express extended capability ID to 
> explain.
>  **/
>  VOID
>  PciExplainPciExpress (
>IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
>IN  UINT8  *ExtendedConfigSpace,
> +  IN  UINTN  ExtendedConfigSize,
>IN CONST UINT16ExtendedCapability
>)
>  {
> @@ -5786,7 +5791,7 @@ PciExplainPciExpress (
>}
>  
>ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
> -  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) 
> {
> +  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 
> + && ExtHdr->CapabilityId != 0x) {
>  //
>  // Process this item
>  //
> @@ -5800,7 +5805,8 @@ PciExplainPciExpress (
>  //

[edk2-devel] [PATCH] ShellPkg/Pci: Add valid check for PCI extended config space parser

2021-03-16 Thread IanX Kuo
From: VincentX Ke 

Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)

No need to print PCIe details while CapabilityId is 0x.
Limit the NextCapabilityOffset to PCI configuration space.

Signed-off-by: VincentX Ke 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index a2f04d8db5..1e5dc75e27 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2038,12 +2038,14 @@ LocatePciCapability (
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   );
 
@@ -2921,6 +2923,7 @@ ShellCommandRunPci (
 PciExplainPciExpress (
   (PCI_CAPABILITY_PCIEXP *) ((UINT8 *) &ConfigSpace + 
PcieCapabilityPtr),
   ExtendedConfigSpace,
+  ExtendedConfigSize,
   ExtendedCapability
   );
   }
@@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   )
 {
@@ -5786,7 +5791,7 @@ PciExplainPciExpress (
   }
 
   ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
-  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
+  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && 
ExtHdr->CapabilityId != 0x) {
 //
 // Process this item
 //
@@ -5800,7 +5805,8 @@ PciExplainPciExpress (
 //
 // Advance to the next item if it exists
 //
-if (ExtHdr->NextCapabilityOffset != 0) {
+if (ExtHdr->NextCapabilityOffset != 0 &&
+   (ExtHdr->NextCapabilityOffset <= (UINT32) (ExtendedConfigSize + 
EFI_PCIE_CAPABILITY_BASE_OFFSET - sizeof (PCI_EXP_EXT_HDR {
   ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + 
ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
 } else {
   break;
-- 
2.18.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72953): https://edk2.groups.io/g/devel/message/72953
Mute This Topic: https://groups.io/mt/81397147/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] ShellPkg/Library: Fix bug in Pci.c

2021-03-16 Thread IanX Kuo
From: VincentX Ke 

Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)

No need to print PCIe details while CapabilityId is 0x.
Limit the NextCapabilityOffset value to AllocatePool() memory.

Signed-off-by: VincentX Ke 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index a2f04d8db5..9ebf1c26ef 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -2038,12 +2038,14 @@ LocatePciCapability (
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   );
 
@@ -2921,6 +2923,7 @@ ShellCommandRunPci (
 PciExplainPciExpress (
   (PCI_CAPABILITY_PCIEXP *) ((UINT8 *) &ConfigSpace + 
PcieCapabilityPtr),
   ExtendedConfigSpace,
+  ExtendedConfigSize,
   ExtendedCapability
   );
   }
@@ -5698,12 +5701,14 @@ PrintPciExtendedCapabilityDetails(
 
   @param[in] PciExpressCap   PCI Express capability buffer.
   @param[in] ExtendedConfigSpace PCI Express extended configuration space.
+  @param[in] ExtendedConfigSize  PCI Express extended configuration size.
   @param[in] ExtendedCapability  PCI Express extended capability ID to explain.
 **/
 VOID
 PciExplainPciExpress (
   IN  PCI_CAPABILITY_PCIEXP  *PciExpressCap,
   IN  UINT8  *ExtendedConfigSpace,
+  IN  UINTN  ExtendedConfigSize,
   IN CONST UINT16ExtendedCapability
   )
 {
@@ -5786,7 +5791,7 @@ PciExplainPciExpress (
   }
 
   ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
-  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
+  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && 
ExtHdr->CapabilityId != 0x) {
 //
 // Process this item
 //
@@ -5800,7 +5805,7 @@ PciExplainPciExpress (
 //
 // Advance to the next item if it exists
 //
-if (ExtHdr->NextCapabilityOffset != 0) {
+if (ExtHdr->NextCapabilityOffset != 0 && (ExtHdr->NextCapabilityOffset <= 
(UINT32)(ExtendedConfigSize - sizeof (PCI_EXP_EXT_HDR {
   ExtHdr = (PCI_EXP_EXT_HDR*)(ExtendedConfigSpace + 
ExtHdr->NextCapabilityOffset - EFI_PCIE_CAPABILITY_BASE_OFFSET);
 } else {
   break;
-- 
2.18.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72862): https://edk2.groups.io/g/devel/message/72862
Mute This Topic: https://groups.io/mt/81372175/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] ShellPkg/Library: Error handle while CapabilityId is 0xFFFF

2021-03-14 Thread IanX Kuo
From: VincentX Ke 

Bugzilla: 3262 (https://bugzilla.tianocore.org/show_bug.cgi?id=3262)

Adding error handle while CapabilityId is 0x

Signed-off-by: VincentX Ke 
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
index a2f04d8db5..cd295bb79b 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
@@ -5786,7 +5786,7 @@ PciExplainPciExpress (
   }
 
   ExtHdr = (PCI_EXP_EXT_HDR*)ExtendedConfigSpace;
-  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) {
+  while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0 && 
ExtHdr->CapabilityId != 0x) {
 //
 // Process this item
 //
-- 
2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72748): https://edk2.groups.io/g/devel/message/72748
Mute This Topic: https://groups.io/mt/81324192/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms] [PATCH v8 6/6] Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib

2020-07-21 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  1 +
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 3 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda272..112ddff7d9 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -92,6 +92,7 @@
   #
   
FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   
ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
index efdeb6a91c..48cbe0dfbe 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,28 +356,6 @@ Done:
   return EFI_SUCCESS;
 }
 
-VOID
-ReportCpuHob (
-  VOID
-  )
-{
-  UINT8 PhysicalAddressBits;
-  UINT32RegEax;
-
-  AsmCpuid (0x8000, &RegEax, NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, &RegEax, NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8) RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  ///
-  /// Create a CPU hand-off information
-  ///
-  BuildCpuHob (PhysicalAddressBits, 16);
-}
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6d5..8e828ff2ac 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62968): https://edk2.groups.io/g/devel/message/62968
Mute This Topic: https://groups.io/mt/75699351/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v8 3/6] Platform/Intel/KabylakeOpenBoardPkg: Add ReportCpuHobLib

2020-07-21 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc  | 6 --
 .../KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc  | 6 --
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc 
b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 6e35495aaf..54f10ff07c 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the GalagoPro3 board.
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -160,6 +161,7 @@
   
DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Platform Package
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index 2a086cd9f7..bba3510cc6 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the KabylakeRvp3 board.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -212,6 +213,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Board Package
-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62965): https://edk2.groups.io/g/devel/message/62965
Mute This Topic: https://groups.io/mt/75699345/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v8 5/6] Platform/Intel/WhiskeylakeOpenBoardPkg: Add ReportCpuHobLib

2020-07-21 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc | 4 +++-
 .../WhiskeylakeURvp/OpenBoardPkg.dsc| 6 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
index fdf85b4385..1e6bd7fd5a 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
@@ -172,6 +173,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Board Package
diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 11dffb085a..502e015eb9 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the WhiskeylakeURvp board.
 #
-#  Copyright (c) 2019, Intel Corporation. All rights reserved.
+#  Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -172,6 +173,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Board Package
-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62967): https://edk2.groups.io/g/devel/message/62967
Mute This Topic: https://groups.io/mt/75699349/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v8 4/6] Platform/Intel/SimicsOpenBoardPkg: Add ReportCpuHobLib

2020-07-21 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 8a82600912..a2d35582e7 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the X58Ich10 board.
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -144,6 +145,7 @@
 !endif
   
TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
 
-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62966): https://edk2.groups.io/g/devel/message/62966
Mute This Topic: https://groups.io/mt/75699346/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v8 2/6] Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib

2020-07-21 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
index 136e530997..6a5c993b85 100644
@@ -172,6 +173,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Board Package
-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62964): https://edk2.groups.io/g/devel/message/62964
Mute This Topic: https://groups.io/mt/75699343/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v8 0/6] Create a Library instance of ReportCpuHobLib

2020-07-21 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 

IanX Kuo (6):
  Platform/Intel/MinPlatformPkg: Fix build error
  Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib
  Platform/Intel/KabylakeOpenBoardPkg: Add ReportCpuHobLib
  Platform/Intel/SimicsOpenBoardPkg: Add ReportCpuHobLib
  Platform/Intel/WhiskeylakeOpenBoardPkg: Add ReportCpuHobLib
  Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib

 .../CometlakeURvp/OpenBoardPkg.dsc|  4 ++-
 .../GalagoPro3/OpenBoardPkg.dsc   |  6 +++--
 .../KabylakeRvp3/OpenBoardPkg.dsc |  6 +++--
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  1 +
 .../Library/ReportCpuHobLib/ReportCpuHobLib.c |  3 ++-
 .../ReportCpuHobLib/ReportCpuHobLib.inf   |  2 +-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 .../BoardX58Ich10/OpenBoardPkg.dsc|  6 +++--
 .../UpXtreme/OpenBoardPkg.dsc |  4 ++-
 .../WhiskeylakeURvp/OpenBoardPkg.dsc  |  6 +++--
 11 files changed, 30 insertions(+), 36 deletions(-)

-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62962): https://edk2.groups.io/g/devel/message/62962
Mute This Topic: https://groups.io/mt/75699338/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v8 1/6] Platform/Intel/MinPlatformPkg: Fix build error

2020-07-21 Thread IanX Kuo
1. Fix ReportCpuHobLib build error
2. Change MODULE from BASE to PEIM

Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c | 3 ++-
 .../PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
index aa2565343c..7eb29152f8 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
@@ -6,7 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include 
+#include 
+#include 
 #include 
 
 VOID
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
index a1830d4320..df1d780ece 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
@@ -12,7 +12,7 @@
   BASE_NAME  = ReportCpuHobLib
   FILE_GUID  = F19AA754-CE24-448D-B755-1F939B00C25D
   VERSION_STRING = 1.0
-  MODULE_TYPE= BASE
+  MODULE_TYPE= PEIM
   LIBRARY_CLASS  = ReportCpuHobLib
 
 [LibraryClasses]
-- 
2.27.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62963): https://edk2.groups.io/g/devel/message/62963
Mute This Topic: https://groups.io/mt/75699341/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v7 6/6] Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I1c14aece3b229c194960e91dc9505dd8120bbe30
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 3 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda2..b62351da 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -92,6 +92,7 @@
   #
   
FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   
ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
index efdeb6a9..48cbe0df 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,28 +356,6 @@ Done:
   return EFI_SUCCESS;
 }
 
-VOID
-ReportCpuHob (
-  VOID
-  )
-{
-  UINT8 PhysicalAddressBits;
-  UINT32RegEax;
-
-  AsmCpuid (0x8000, &RegEax, NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, &RegEax, NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8) RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  ///
-  /// Create a CPU hand-off information
-  ///
-  BuildCpuHob (PhysicalAddressBits, 16);
-}
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6..8e828ff2 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62956): https://edk2.groups.io/g/devel/message/62956
Mute This Topic: https://groups.io/mt/75698482/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v7 3/6] Platform/Intel/KabylakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: Ic312ec307b3bcd84051e48505038d9ca47d467e2
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc  | 6 --
 .../KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc  | 6 --
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc 
b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 6e35495a..54f10ff0 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the GalagoPro3 board.
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -38,7 +38,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -160,6 +161,7 @@
   
DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Platform Package
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index 2a086cd9..bba3510c 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the KabylakeRvp3 board.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -37,7 +37,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -212,6 +213,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Board Package
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62953): https://edk2.groups.io/g/devel/message/62953
Mute This Topic: https://groups.io/mt/75698475/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v7 4/6] Platform/Intel/SimicsOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I673f8fcd2d97bbd60229a60f53875e92826a7179
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 8a826009..a2d35582 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the X58Ich10 board.
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -42,7 +42,8 @@
   DEFINE NETWORK_ISCSI_ENABLE   = FALSE
   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
 
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include $(PROJECT)/OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -144,6 +145,7 @@
 !endif
   
TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
 
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62954): https://edk2.groups.io/g/devel/message/62954
Mute This Topic: https://groups.io/mt/75698478/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v7 5/6] Platform/Intel/WhiskeylakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I999b29c30993c397f918a1f7b4ea19c61c0a460d
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc | 4 +++-
 .../WhiskeylakeURvp/OpenBoardPkg.dsc| 6 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
index fdf85b43..1e6bd7fd 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -172,6 +173,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Board Package
diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 11dffb08..502e015e 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the WhiskeylakeURvp board.
 #
-#  Copyright (c) 2019, Intel Corporation. All rights reserved.
+#  Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -172,6 +173,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Board Package
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62955): https://edk2.groups.io/g/devel/message/62955
Mute This Topic: https://groups.io/mt/75698479/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v7 2/6] Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I1097057046aa021dc2ff193fea335790513c10c4
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
index 136e5309..6a5c993b 100644
--- a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -172,6 +173,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
   ###
   # Board Package
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62952): https://edk2.groups.io/g/devel/message/62952
Mute This Topic: https://groups.io/mt/75698470/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v7 0/6] Create a Library instance of ReportCpuHobLib

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 

IanX Kuo (6):
  Platform/Intel/MinPlatformPkg: Fix build error
  Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/KabylakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/SimicsOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/WhiskeylakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

 .../CometlakeURvp/OpenBoardPkg.dsc|  4 ++-
 .../GalagoPro3/OpenBoardPkg.dsc   |  6 +++--
 .../KabylakeRvp3/OpenBoardPkg.dsc |  6 +++--
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../Library/ReportCpuHobLib/ReportCpuHobLib.c |  3 ++-
 .../ReportCpuHobLib/ReportCpuHobLib.inf   |  2 +-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 .../BoardX58Ich10/OpenBoardPkg.dsc|  6 +++--
 .../UpXtreme/OpenBoardPkg.dsc |  4 ++-
 .../WhiskeylakeURvp/OpenBoardPkg.dsc  |  6 +++--
 11 files changed, 31 insertions(+), 37 deletions(-)

-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62950): https://edk2.groups.io/g/devel/message/62950
Mute This Topic: https://groups.io/mt/75698465/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v7 1/6] Platform/Intel/MinPlatformPkg: Fix build error

2020-07-20 Thread IanX Kuo
1. Fix ReportCpuHobLib build error
2. Change MODULE from BASE to PEIM

Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I0cd6ba4eb7231a3a84f080fdce85bbe74eb29eeb
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c | 3 ++-
 .../PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
index aa256534..7eb29152 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
@@ -6,7 +6,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include 
+#include 
+#include 
 #include 
 
 VOID
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
index a1830d43..df1d780e 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
@@ -12,7 +12,7 @@
   BASE_NAME  = ReportCpuHobLib
   FILE_GUID  = F19AA754-CE24-448D-B755-1F939B00C25D
   VERSION_STRING = 1.0
-  MODULE_TYPE= BASE
+  MODULE_TYPE= PEIM
   LIBRARY_CLASS  = ReportCpuHobLib
 
 [LibraryClasses]
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62951): https://edk2.groups.io/g/devel/message/62951
Mute This Topic: https://groups.io/mt/75698469/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



回覆: [edk2-devel] [edk2-platforms] [PATCH v6 1/6] Platform/Intel/MinPlatformPkg: Fix build error

2020-07-20 Thread IanX Kuo
Hi Liming

Ok, I will have PATCH v7 to specific it to PEIM.

Thanks,
Ian Kuo

寄件者: Gao, Liming 
寄件日期: 2020年7月21日 上午 10:12
收件者: devel@edk2.groups.io ; Chiu, Chasel 
; Kuo, IanX 
副本: Lu, James ; Kumar, Chandana C 
; Prabhala, Varalakshmi A 
; Chaganty, Rangasai V 

主旨: RE: [edk2-devel] [edk2-platforms] [PATCH v6 1/6] 
Platform/Intel/MinPlatformPkg: Fix build error

I suggest to include  instead of . If so, other Pi definitions 
are not required to be included.

ReportCpuHobLib module type should be PEIM. Hob can be produced only in PEI 
phase.

Thanks
Liming
-Original Message-
From: devel@edk2.groups.io  On Behalf Of Chiu, Chasel
Sent: 2020年7月21日 8:58
To: Kuo, IanX ; devel@edk2.groups.io
Cc: Lu, James ; Kumar, Chandana C 
; Prabhala, Varalakshmi A 
; Chaganty, Rangasai V 

Subject: Re: [edk2-devel] [edk2-platforms] [PATCH v6 1/6] 
Platform/Intel/MinPlatformPkg: Fix build error


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Kuo, IanX 
> Sent: Tuesday, July 21, 2020 8:35 AM
> To: devel@edk2.groups.io
> Cc: Lu, James ; Kumar, Chandana C
> ; Prabhala, Varalakshmi A
> ; Kuo, IanX ;
> Chaganty, Rangasai V ; Chiu, Chasel
> 
> Subject: [edk2-platforms] [PATCH v6 1/6]
> Platform/Intel/MinPlatformPkg: Fix build error
>
> Fix ReportCpuHobLib build error
>
> Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
> PA bits reported can be overridden by Library instance in Platform.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2674
>
> Change-Id: I0cd6ba4eb7231a3a84f080fdce85bbe74eb29eeb
> Signed-off-by: IanX Kuo 
> Cc: Sai Chaganty 
> Cc: Chasel Chiu 
> ---
>  .../PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c   | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git
> a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/R
> e
> portCpuHobLib.c
> b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/R
> e
> portCpuHobLib.c
> index aa256534..83fc5249 100644
> ---
> a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/R
> e
> portCpuHobLib.c
> +++
> b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/R
> e
> portCpuHobLib.c
> @@ -6,7 +6,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>
>
>  **/
>
>
>
> -#include 
>
> +#include 
>
> +#include 
>
> +#include 
>
> +#include 
>
>  #include 
>
>
>
>  VOID
>
> --
> 2.26.2.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62940): https://edk2.groups.io/g/devel/message/62940
Mute This Topic: https://groups.io/mt/75697067/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v6 6/6] Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I1c14aece3b229c194960e91dc9505dd8120bbe30
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 3 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda2..b62351da 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -92,6 +92,7 @@
   #
   
FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   
ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
index efdeb6a9..48cbe0df 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,28 +356,6 @@ Done:
   return EFI_SUCCESS;
 }
 
-VOID
-ReportCpuHob (
-  VOID
-  )
-{
-  UINT8 PhysicalAddressBits;
-  UINT32RegEax;
-
-  AsmCpuid (0x8000, &RegEax, NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, &RegEax, NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8) RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  ///
-  /// Create a CPU hand-off information
-  ///
-  BuildCpuHob (PhysicalAddressBits, 16);
-}
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6..8e828ff2 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62921): https://edk2.groups.io/g/devel/message/62921
Mute This Topic: https://groups.io/mt/75695077/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v6 4/6] Platform/Intel/SimicsOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I673f8fcd2d97bbd60229a60f53875e92826a7179
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 8a826009..68a8f844 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the X58Ich10 board.
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -42,7 +42,8 @@
   DEFINE NETWORK_ISCSI_ENABLE   = FALSE
   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
 
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include $(PROJECT)/OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -117,6 +118,7 @@
   LogoLib|$(BOARD_PKG)/Library/DxeLogoLib/DxeLogoLib.inf
   NvVarsFileLib|$(BOARD_PKG)/Library/NvVarsFileLib/NvVarsFileLib.inf
   ReportFvLib|$(BOARD_PKG)/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
SerializeVariablesLib|$(BOARD_PKG)/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   
SiliconPolicyInitLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyInitLib/SiliconPolicyInitLib.inf
   
SiliconPolicyUpdateLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyUpdateLib/SiliconPolicyUpdateLib.inf
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62919): https://edk2.groups.io/g/devel/message/62919
Mute This Topic: https://groups.io/mt/75695070/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v6 5/6] Platform/Intel/WhiskeylakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I999b29c30993c397f918a1f7b4ea19c61c0a460d
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc | 4 +++-
 .../WhiskeylakeURvp/OpenBoardPkg.dsc| 6 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
index fdf85b43..f78dba87 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -121,6 +122,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 11dffb08..9ee4030a 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the WhiskeylakeURvp board.
 #
-#  Copyright (c) 2019, Intel Corporation. All rights reserved.
+#  Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -121,6 +122,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62920): https://edk2.groups.io/g/devel/message/62920
Mute This Topic: https://groups.io/mt/75695075/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v6 3/6] Platform/Intel/KabylakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: Ic312ec307b3bcd84051e48505038d9ca47d467e2
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc  | 6 --
 .../KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc  | 6 --
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc 
b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
index 6e35495a..55ff33ec 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the GalagoPro3 board.
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -38,7 +38,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -119,6 +120,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
index 2a086cd9..0d6d5f21 100644
--- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the KabylakeRvp3 board.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -37,7 +37,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -161,6 +162,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62918): https://edk2.groups.io/g/devel/message/62918
Mute This Topic: https://groups.io/mt/75695066/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v6 1/6] Platform/Intel/MinPlatformPkg: Fix build error

2020-07-20 Thread IanX Kuo
Fix ReportCpuHobLib build error

Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I0cd6ba4eb7231a3a84f080fdce85bbe74eb29eeb
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c   | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
index aa256534..83fc5249 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
@@ -6,7 +6,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 
 VOID
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62916): https://edk2.groups.io/g/devel/message/62916
Mute This Topic: https://groups.io/mt/75695055/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v6 2/6] Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

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

Change-Id: I1097057046aa021dc2ff193fea335790513c10c4
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
index 136e5309..74943352 100644
--- a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -121,6 +122,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62917): https://edk2.groups.io/g/devel/message/62917
Mute This Topic: https://groups.io/mt/75695061/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms] [PATCH v6 0/6] Create a Library instance of ReportCpuHobLib

2020-07-20 Thread IanX Kuo
Create a Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overridden by Library instance in Platform.

Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 

IanX Kuo (6):
  Platform/Intel/MinPlatformPkg: Fix build error
  Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/KabylakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/SimicsOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/WhiskeylakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

 .../CometlakeURvp/OpenBoardPkg.dsc|  4 ++-
 .../GalagoPro3/OpenBoardPkg.dsc   |  6 +++--
 .../KabylakeRvp3/OpenBoardPkg.dsc |  6 +++--
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../Library/ReportCpuHobLib/ReportCpuHobLib.c |  5 +++-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 .../BoardX58Ich10/OpenBoardPkg.dsc|  6 +++--
 .../UpXtreme/OpenBoardPkg.dsc |  4 ++-
 .../WhiskeylakeURvp/OpenBoardPkg.dsc  |  6 +++--
 10 files changed, 32 insertions(+), 36 deletions(-)

-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62915): https://edk2.groups.io/g/devel/message/62915
Mute This Topic: https://groups.io/mt/75695050/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



回覆: [edk2-devel] [PATCH v4 0/6] *** SUBJECT HERE ***

2020-07-20 Thread IanX Kuo
Hi Liming

I thought devel@edk2.groups.io not to receive my path, so send many times.
I will send v6 version patch soon to fix spelling error. We can review v6 
version patch directly.

Thanks,
Ian Kuo

寄件者: Gao, Liming 
寄件日期: 2020年7月21日 上午 08:14
收件者: devel@edk2.groups.io ; Kuo, IanX 
主旨: RE: [edk2-devel] [PATCH v4 0/6] *** SUBJECT HERE ***

Ian:
  You send the patch v2, v3, v4, v5. Do we only need to review v5 version patch?

Thanks
Liming
-Original Message-
From: devel@edk2.groups.io  On Behalf Of IanX Kuo
Sent: 2020年7月20日 16:55
To: devel@edk2.groups.io
Cc: Kuo, IanX 
Subject: [edk2-devel] [PATCH v4 0/6] *** SUBJECT HERE ***

*** BLURB HERE ***

IanX Kuo (6):
  Platform/Intel/MinPlatformPkg: Fix build error
  Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/KabylakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/SimicsOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/WhiskeylakeOpenBoardPkg: Add ReportCpuHobLib.
  Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

 .../CometlakeURvp/OpenBoardPkg.dsc|  4 ++-
 .../GalagoPro3/OpenBoardPkg.dsc   |  6 +++--
 .../KabylakeRvp3/OpenBoardPkg.dsc |  6 +++--
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../Library/ReportCpuHobLib/ReportCpuHobLib.c |  5 +++-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 .../BoardX58Ich10/OpenBoardPkg.dsc|  6 +++--
 .../UpXtreme/OpenBoardPkg.dsc |  4 ++-
 .../WhiskeylakeURvp/OpenBoardPkg.dsc  |  6 +++--
 10 files changed, 32 insertions(+), 36 deletions(-)

--
2.26.2.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62912): https://edk2.groups.io/g/devel/message/62912
Mute This Topic: https://groups.io/mt/75694817/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v2 6/6] Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I1c14aece3b229c194960e91dc9505dd8120bbe30
Signed-off-by: IanX Kuo 
---
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 3 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda2..b62351da 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -92,6 +92,7 @@
   #
   
FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   
ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
index efdeb6a9..48cbe0df 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,28 +356,6 @@ Done:
   return EFI_SUCCESS;
 }
 
-VOID
-ReportCpuHob (
-  VOID
-  )
-{
-  UINT8 PhysicalAddressBits;
-  UINT32RegEax;
-
-  AsmCpuid (0x8000, &RegEax, NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, &RegEax, NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8) RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  ///
-  /// Create a CPU hand-off information
-  ///
-  BuildCpuHob (PhysicalAddressBits, 16);
-}
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6..8e828ff2 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62890): https://edk2.groups.io/g/devel/message/62890
Mute This Topic: https://groups.io/mt/75694148/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 2/6] Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I1097057046aa021dc2ff193fea335790513c10c4
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
index 136e5309..74943352 100644
--- a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -121,6 +122,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62902): https://edk2.groups.io/g/devel/message/62902
Mute This Topic: https://groups.io/mt/75694163/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 5/6] Platform/Intel/WhiskeylakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I999b29c30993c397f918a1f7b4ea19c61c0a460d
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc | 4 +++-
 .../WhiskeylakeURvp/OpenBoardPkg.dsc| 6 --
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
index fdf85b43..f78dba87 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -121,6 +122,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 11dffb08..9ee4030a 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the WhiskeylakeURvp board.
 #
-#  Copyright (c) 2019, Intel Corporation. All rights reserved.
+#  Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -121,6 +122,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62906): https://edk2.groups.io/g/devel/message/62906
Mute This Topic: https://groups.io/mt/75694166/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v3 6/6] Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I1c14aece3b229c194960e91dc9505dd8120bbe30
Signed-off-by: IanX Kuo 
---
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 3 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda2..b62351da 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -92,6 +92,7 @@
   #
   
FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   
ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
index efdeb6a9..48cbe0df 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,28 +356,6 @@ Done:
   return EFI_SUCCESS;
 }
 
-VOID
-ReportCpuHob (
-  VOID
-  )
-{
-  UINT8 PhysicalAddressBits;
-  UINT32RegEax;
-
-  AsmCpuid (0x8000, &RegEax, NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, &RegEax, NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8) RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  ///
-  /// Create a CPU hand-off information
-  ///
-  BuildCpuHob (PhysicalAddressBits, 16);
-}
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6..8e828ff2 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62886): https://edk2.groups.io/g/devel/message/62886
Mute This Topic: https://groups.io/mt/75694144/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v4 4/6] Platform/Intel/SimicsOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I673f8fcd2d97bbd60229a60f53875e92826a7179
Signed-off-by: IanX Kuo 
---
 .../Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 8a826009..68a8f844 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the X58Ich10 board.
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -42,7 +42,8 @@
   DEFINE NETWORK_ISCSI_ENABLE   = FALSE
   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
 
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include $(PROJECT)/OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -117,6 +118,7 @@
   LogoLib|$(BOARD_PKG)/Library/DxeLogoLib/DxeLogoLib.inf
   NvVarsFileLib|$(BOARD_PKG)/Library/NvVarsFileLib/NvVarsFileLib.inf
   ReportFvLib|$(BOARD_PKG)/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
SerializeVariablesLib|$(BOARD_PKG)/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   
SiliconPolicyInitLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyInitLib/SiliconPolicyInitLib.inf
   
SiliconPolicyUpdateLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyUpdateLib/SiliconPolicyUpdateLib.inf
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62898): https://edk2.groups.io/g/devel/message/62898
Mute This Topic: https://groups.io/mt/75694133/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v4 2/6] Platform/Intel/CometlakeOpenBoardPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I1097057046aa021dc2ff193fea335790513c10c4
Signed-off-by: IanX Kuo 
---
 .../CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
index 136e5309..74943352 100644
--- a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc
@@ -39,7 +39,8 @@
   #
   # Include PCD configuration for this board.
   #
-  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc

+  !include AdvancedFeaturePkg/Include/AdvancedFeaturesPcd.dsc
+
   !include OpenBoardPkgPcd.dsc
   !include AdvancedFeaturePkg/Include/AdvancedFeatures.dsc
 
@@ -121,6 +122,7 @@
   PeiLib|$(PLATFORM_PACKAGE)/Library/PeiLib/PeiLib.inf
   
PlatformBootManagerLib|$(PLATFORM_PACKAGE)/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
   
ReportFvLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLibNull/TestPointCheckLibNull.inf
 
   ###
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62901): https://edk2.groups.io/g/devel/message/62901
Mute This Topic: https://groups.io/mt/75694145/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v4 6/6] Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I1c14aece3b229c194960e91dc9505dd8120bbe30
Signed-off-by: IanX Kuo 
---
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 3 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda2..b62351da 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -92,6 +92,7 @@
   #
   
FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   
ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
index efdeb6a9..48cbe0df 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,28 +356,6 @@ Done:
   return EFI_SUCCESS;
 }
 
-VOID
-ReportCpuHob (
-  VOID
-  )
-{
-  UINT8 PhysicalAddressBits;
-  UINT32RegEax;
-
-  AsmCpuid (0x8000, &RegEax, NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, &RegEax, NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8) RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  ///
-  /// Create a CPU hand-off information
-  ///
-  BuildCpuHob (PhysicalAddressBits, 16);
-}
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6..8e828ff2 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62884): https://edk2.groups.io/g/devel/message/62884
Mute This Topic: https://groups.io/mt/75694142/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v4 6/6] Platform/Intel/MinPlatformPkg: Add ReportCpuHobLib.

2020-07-20 Thread IanX Kuo
Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I1c14aece3b229c194960e91dc9505dd8120bbe30
Signed-off-by: IanX Kuo 
---
 .../Intel/MinPlatformPkg/MinPlatformPkg.dsc   |  3 ++-
 .../PlatformInitPei/PlatformInitPreMem.c  | 25 ++-
 .../PlatformInitPei/PlatformInitPreMem.inf|  3 ++-
 3 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 13a0fda2..b62351da 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  Platform description.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -92,6 +92,7 @@
   #
   
FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPlatformLib/PeiFspWrapperPlatformLib.inf
   
ReportFvLib|MinPlatformPkg/PlatformInit/Library/PeiReportFvLib/PeiReportFvLib.inf
+  
ReportCpuHobLib|MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.inf
   
TestPointCheckLib|MinPlatformPkg/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
   TestPointLib|MinPlatformPkg/Test/Library/TestPointLib/PeiTestPointLib.inf
   
SetCacheMtrrLib|MinPlatformPkg/Library/SetCacheMtrrLib/SetCacheMtrrLibNull.inf
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
index efdeb6a9..48cbe0df 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
@@ -1,7 +1,7 @@
 /** @file
   Source code file for Platform Init Pre-Memory PEI module
 
-Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -355,28 +356,6 @@ Done:
   return EFI_SUCCESS;
 }
 
-VOID
-ReportCpuHob (
-  VOID
-  )
-{
-  UINT8 PhysicalAddressBits;
-  UINT32RegEax;
-
-  AsmCpuid (0x8000, &RegEax, NULL, NULL, NULL);
-  if (RegEax >= 0x8008) {
-AsmCpuid (0x8008, &RegEax, NULL, NULL, NULL);
-PhysicalAddressBits = (UINT8) RegEax;
-  } else {
-PhysicalAddressBits = 36;
-  }
-
-  ///
-  /// Create a CPU hand-off information
-  ///
-  BuildCpuHob (PhysicalAddressBits, 16);
-}
-
 /**
   Install Firmware Volume Hob's once there is main memory
 
diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
index 7ee18eb6..8e828ff2 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
@@ -1,7 +1,7 @@
 ### @file
 # Component information file for the Platform Init Pre-Memory PEI module.
 #
-# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -28,6 +28,7 @@
   TestPointCheckLib
   TimerLib
   SetCacheMtrrLib
+  ReportCpuHobLib
 
 [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62894): https://edk2.groups.io/g/devel/message/62894
Mute This Topic: https://groups.io/mt/75694142/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v5 1/6] Platform/Intel/MinPlatformPkg: Fix build error

2020-07-20 Thread IanX Kuo
Fix ReportCpuHobLib build error

Create an Library instance of ReportCpuHobLib from PlatformInitPei driver.
PA bits reported can be overriden using Library instance in Platform.

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

Change-Id: I0cd6ba4eb7231a3a84f080fdce85bbe74eb29eeb
Signed-off-by: IanX Kuo 
Cc: Sai Chaganty 
Cc: Chasel Chiu 
---
 .../PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c   | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
index aa256534..83fc5249 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/Library/ReportCpuHobLib/ReportCpuHobLib.c
@@ -6,7 +6,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 
 VOID
-- 
2.26.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#62905): https://edk2.groups.io/g/devel/message/62905
Mute This Topic: https://groups.io/mt/75694165/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



  1   2   >