> On Sep 15, 2021, at 6:26 PM, gaoliming <[email protected]> wrote:
> 
> Ray:
>  SortLib has been added since 2015. I would suggest to still keep this 
> library class. To resolve the package dependency, my proposal is to move the 
> library class header file SortLib.h from MdeModulePkg to MdePkg, and still 
> keep the library instance in MdeModulePkg. This proposal has no impact on the 
> existing platform. 
>  

If we add QuickSort() API to the BaseLib can we not just port the existing 
MdeModulePkg/SortLib to use QuickSort() in the implementation? Or is there some 
other way to add the new thing in a backward compatible way.

Thanks,

Andrew Fish

> Thanks
> Liming
> 发件人: [email protected] <mailto:[email protected]> <[email protected] 
> <mailto:[email protected]>> 代表 Ni, Ray
> 发送时间: 2021年9月14日 14:15
> 收件人: Kinney, Michael D <[email protected] 
> <mailto:[email protected]>>; Gao, Liming <[email protected] 
> <mailto:[email protected]>>; Liu, Zhiguang <[email protected] 
> <mailto:[email protected]>>; Wang, Jian J <[email protected] 
> <mailto:[email protected]>>; Gao, Zhichao <[email protected] 
> <mailto:[email protected]>>
> 抄送: [email protected] <mailto:[email protected]>; Chan, Amy 
> <[email protected] <mailto:[email protected]>>
> 主题: [edk2-devel] RFC: Add BaseLib/QuickSort in MdePkg
>  
> Hi package maintainers of MdePkg, MdeModulePkg and ShellPkg, community,
>  
> A commit (UefiCpuPkg/CpuCacheInfoLib: Sort CpuCacheInfo array 
> <https://github.com/tianocore/edk2/commit/4de77ae9890d241271f543e9195ab3516f3abec6>)
>  to UefiCpuPkg let
> UefiCpuPkg depend on MdeModulePkg because the SortLib class and instances are 
> all in MdeModulePkg.
>  
> UefiCpuPkg depending on MdeModulePkg breaks the rule that “UefiCpuPkg should 
> ONLY depend on MdePkg”.
>  
> To address this issue, there are two approaches:
> Duplicate the sort logic in UefiCpuPkg to not depend on MdeModulePkg/SortLib
> Add QuickSort() API to BaseLib in MdePkg.
>  
> Approach #2 (MdePkg/BaseLib/QuickSort) makes more sense because quick sort is 
> a standard algorithm.
> We encourage consumers to update their code to use the quick sort in MdePkg 
> and gradually deprecate today’s MdeModulePkg/SortLib.
>  
> If you don’t have concerns, I plan to:
> “Add QuickSort() to BaseLib” and update all existing consumers to use this 
> API instead.
> VOID
> EFIAPI
> QuickSort (
>   IN OUT VOID                   *BufferToSort,
>   IN CONST UINTN                Count,
>   IN CONST UINTN                ElementSize,
>   IN       SORT_COMPARE         CompareFunction
>   );
>  
> “Add new ShellPkg/SortCompareLib”
> Background: ShellPkg requires to sort devicepath/string so 3 APIs in 
> UefiSortLib (DevicePathCompare, StringNoCaseCompare, StringCompare) are 
> provided for Shell usage. we can move the 3 APIs to the SortCompareLib and 
> update Shell code to use BaseLib/QuickSort directly, with the sort compare 
> function from SortCompareLib.
>  
> Any concerns?
>  
> Thanks,
> Ray
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#80745): https://edk2.groups.io/g/devel/message/80745
Mute This Topic: https://groups.io/mt/85643723/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to