[edk2-platforms: PATCH 2/9] CometlakeOpenBoardPkg: Use same variable name for FspNvsHob.
Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3678
To simplify the implementation the variable Name/GUID has been changed to "FspNvsBuffer" and gFspNvsBufferVariableGuid regardless it stores the data from FSP_NON_VOLATILE_STORAGE_HOB2 or FSP_NON_VOLATILE_STORAGE_HOB. Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com> Cc: Deepika Kethi Reddy <deepika.kethi.reddy@intel.com> Cc: Kathappan Esakkithevar <kathappan.esakkithevar@intel.com> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> --- Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUp= dateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++++------------= ------------------------------------- Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc = | 3 +++ Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUp= dateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- 3 files changed, 19 insertions(+), 52 deletions(-) diff --git a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSil= iconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/CometlakeO= penBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUp= dateLib.c index 7dbdfa7c16..9e8606ada9 100644 --- a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPol= icyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPol= icyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -2,7 +2,7 @@ Implementation of Fsp Misc UPD Initialization.=0D =0D =0D - Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>=0D + Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D **/=0D =0D @@ -17,7 +17,6 @@ #include <FspmUpd.h>=0D #include <FspsUpd.h>=0D =0D -#include <Library/MemoryAllocationLib.h>=0D #include <Library/DebugLib.h>=0D #include <Library/DebugPrintErrorLevelLib.h>=0D #include <Library/PciLib.h>=0D @@ -44,55 +43,21 @@ PeiFspMiscUpdUpdatePreMem ( )=0D {=0D EFI_STATUS Status;=0D - EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariableServices;=0D - UINTN VariableSize;=0D - VOID *MemorySavedData;=0D -=0D - Status =3D PeiServicesLocatePpi (=0D - &gEfiPeiReadOnlyVariable2PpiGuid,=0D - 0,=0D - NULL,=0D - (VOID **) &VariableServices=0D - );=0D - if (EFI_ERROR (Status)) {=0D - ASSERT_EFI_ERROR (Status);=0D - return Status;=0D + UINTN FspNvsBufferSize;=0D + VOID *FspNvsBufferPtr;=0D +=0D + //=0D + // Initialize S3 Data variable (S3DataPtr). It may be used for warm and = fast boot paths.=0D + //=0D + FspNvsBufferPtr =3D NULL;=0D + FspNvsBufferSize =3D 0;=0D + Status =3D PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableG= uid, &FspNvsBufferPtr, &FspNvsBufferSize);=0D + if (Status =3D=3D EFI_SUCCESS) {=0D + DEBUG ((DEBUG_INFO, "Get L\"FspNvsBuffer\" gFspNvsBufferVariableGuid -= %r\n", Status));=0D + DEBUG ((DEBUG_INFO, "FspNvsBuffer Size - 0x%x\n", FspNvsBufferSize));= =0D + FspmUpd->FspmArchUpd.NvsBufferPtr =3D FspNvsBufferPtr;=0D }=0D =0D - VariableSize =3D 0;=0D - MemorySavedData =3D NULL;=0D - Status =3D VariableServices->GetVariable (=0D - VariableServices,=0D - L"MemoryConfig",=0D - &gFspNonVolatileStorageHobGuid,=0D - NULL,=0D - &VariableSize,=0D - MemorySavedData=0D - );=0D - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {=0D - MemorySavedData =3D AllocatePool (VariableSize);=0D - if (MemorySavedData =3D=3D NULL) {=0D - ASSERT (MemorySavedData !=3D NULL);=0D - return EFI_OUT_OF_RESOURCES;=0D - }=0D -=0D - DEBUG ((DEBUG_INFO, "VariableSize is 0x%x\n", VariableSize));=0D - Status =3D VariableServices->GetVariable (=0D - VariableServices,=0D - L"MemoryConfig",=0D - &gFspNonVolatileStorageHobGuid,=0D - NULL,=0D - &VariableSize,=0D - MemorySavedData=0D - );=0D - if (Status =3D=3D EFI_SUCCESS) {=0D - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData;=0D - } else {=0D - DEBUG ((DEBUG_ERROR, "Fail to retrieve Variable:\"MemoryConfig\" gMe= moryConfigVariableGuid, Status =3D %r\n", Status));=0D - ASSERT_EFI_ERROR (Status);=0D - }=0D - }=0D - FspmUpd->FspmArchUpd.NvsBufferPtr =3D MemorySavedData;=0D =0D return EFI_SUCCESS;=0D }=0D diff --git a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPk= g.dsc b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc index 44a1bd54d6..d63ff263c1 100644 --- a/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc +++ b/Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc @@ -142,6 +142,9 @@ #######################################=0D PlatformHookLib|$(PROJECT)/Library/BasePlatformHookLib/BasePlatformHookL= ib.inf=0D =0D +[LibraryClasses.Common.SEC]=0D + VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVaria= bleReadLibNull.inf=0D +=0D [LibraryClasses.IA32.SEC]=0D #######################################=0D # Platform Package=0D diff --git a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSil= iconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/Platform/Intel/Co= metlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSili= conPolicyUpdateLibFsp.inf index c842b7eef6..94776603c4 100644 --- a/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPol= icyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPol= icyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -2,7 +2,7 @@ # Provide FSP wrapper platform related function.=0D #=0D #=0D -# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>=0D +# Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>= =0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -82,7 +82,6 @@ PchInfoLib=0D PchHsioLib=0D PchPcieRpLib=0D - MemoryAllocationLib=0D DebugPrintErrorLevelLib=0D SiPolicyLib=0D PchGbeLib=0D @@ -132,7 +131,7 @@ gCometlakeOpenBoardPkgTokenSpaceGuid.PcdMrcSpdAddressTable3=0D =0D [Guids]=0D - gFspNonVolatileStorageHobGuid ## CONSUMES=0D + gFspNvsBufferVariableGuid ## CONSUMES=0D gTianoLogoGuid ## CONSUMES=0D gEfiMemoryOverwriteControlDataGuid=0D =0D --=20 2.28.0.windows.1
|
|
[edk2-platforms: PATCH 1/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3678
Implementation should search FSP_NON_VOLATILE_STORAGE_HOB2 firstly and only search FSP_NON_VOLATILE_STORAGE_HOB when former one is not found. Also added PeiGetLargeVariable () to support the scenarios where the variable data size is bigger than a single variable size limit. Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Eric Dong <eric.dong@intel.com> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> --- Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig= .c | 39 ++++++++++++++++++++++++++++----------- Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c = | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++- Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig= .inf | 5 ++++- Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h = | 33 ++++++++++++++++++++++++++++++++- Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf = | 4 +++- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec = | 1 + 6 files changed, 136 insertions(+), 15 deletions(-) diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/Save= MemoryConfig.c b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/= SaveMemoryConfig.c index 41ed2550bd..92a0fe56f5 100644 --- a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC= onfig.c +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC= onfig.c @@ -2,7 +2,7 @@ This is the driver that locates the MemoryConfigurationData HOB, if it=0D exists, and saves the data to nvRAM.=0D =0D -Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>=0D +Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -17,6 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Library/MemoryAllocationLib.h>=0D #include <Library/BaseMemoryLib.h>=0D #include <Protocol/VariableLock.h>=0D +#include <Guid/FspNonVolatileStorageHob2.h>=0D =0D /**=0D This is the standard EFI driver point that detects whether there is a=0D @@ -50,11 +51,27 @@ SaveMemoryConfigEntryPoint ( //=0D // Search for the Memory Configuration GUID HOB. If it is not present, = then=0D // there's nothing we can do. It may not exist on the update path.=0D + // Firstly check version2 FspNvsHob.=0D //=0D - GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid);=0D + GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHob2Guid);=0D if (GuidHob !=3D NULL) {=0D - HobData =3D GET_GUID_HOB_DATA (GuidHob);=0D - DataSize =3D GET_GUID_HOB_DATA_SIZE(GuidHob);=0D + HobData =3D (VOID *) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHo= b)->NvsDataPtr;=0D + DataSize =3D ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) GuidHob)->NvsD= ataLength;=0D + } else {=0D + //=0D + // Fall back to version1 FspNvsHob=0D + //=0D + GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid);=0D + if (GuidHob !=3D NULL) {=0D + HobData =3D GET_GUID_HOB_DATA (GuidHob);=0D + DataSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob);=0D + }=0D + }=0D +=0D + if (HobData !=3D NULL) {=0D + DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataLength:%d\n", DataSize));=0D + DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr : 0x%x\n", HobData));=0D +=0D if (DataSize > 0) {=0D //=0D // Use the HOB to save Memory Configuration Data=0D @@ -65,8 +82,8 @@ SaveMemoryConfigEntryPoint ( return EFI_UNSUPPORTED;=0D }=0D Status =3D gRT->GetVariable (=0D - L"MemoryConfig",=0D - &gFspNonVolatileStorageHobGuid,=0D + L"FspNvsBuffer",=0D + &gFspNvsBufferVariableGuid,=0D NULL,=0D &BufferSize,=0D VariableData=0D @@ -80,8 +97,8 @@ SaveMemoryConfigEntryPoint ( }=0D =0D Status =3D gRT->GetVariable (=0D - L"MemoryConfig",=0D - &gFspNonVolatileStorageHobGuid,=0D + L"FspNvsBuffer",=0D + &gFspNvsBufferVariableGuid,=0D NULL,=0D &BufferSize,=0D VariableData=0D @@ -90,8 +107,8 @@ SaveMemoryConfigEntryPoint ( =0D if ( (EFI_ERROR(Status)) || BufferSize !=3D DataSize || 0 !=3D Compa= reMem (HobData, VariableData, DataSize)) {=0D Status =3D gRT->SetVariable (=0D - L"MemoryConfig",=0D - &gFspNonVolatileStorageHobGuid,=0D + L"FspNvsBuffer",=0D + &gFspNvsBufferVariableGuid,=0D (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERV= ICE_ACCESS),=0D DataSize,=0D HobData=0D @@ -106,7 +123,7 @@ SaveMemoryConfigEntryPoint ( //=0D Status =3D gBS->LocateProtocol(&gEdkiiVariableLockProtocolGuid, NULL= , (VOID **)&VariableLock);=0D if (!EFI_ERROR(Status)) {=0D - Status =3D VariableLock->RequestToLock(VariableLock, L"MemoryConfi= g", &gFspNonVolatileStorageHobGuid);=0D + Status =3D VariableLock->RequestToLock(VariableLock, L"FspNvsBuffe= r", &gFspNvsBufferVariableGuid);=0D ASSERT_EFI_ERROR(Status);=0D }=0D =0D diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c b/Platfo= rm/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c index 96dfd588dc..9e92387761 100644 --- a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c +++ b/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c @@ -1,6 +1,6 @@ /** @file=0D =0D -Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>=0D +Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Library/DebugLib.h>=0D #include <Library/PeiServicesLib.h>=0D #include <Library/MemoryAllocationLib.h>=0D +#include <Library/LargeVariableReadLib.h>=0D #include <Ppi/ReadOnlyVariable2.h>=0D =0D /**=0D @@ -108,6 +109,72 @@ PeiGetVariable ( return Status;=0D }=0D =0D +/**=0D + Returns the status whether get the large variable success. When variable= size=0D + is bigger than single UEFI variable size limit, The variable will be sav= ed in=0D + multiple UEFI variables. This function retrieves such large variable thr= ough the=0D + ReadOnlyVariable2 PPI GetVariable().=0D + The returned buffer is allocated using AllocatePage() to support > 64KB = and this=0D + buffer cannot be Free().=0D +=0D + If Name is NULL, then ASSERT().=0D + If Guid is NULL, then ASSERT().=0D + If Value is NULL, then ASSERT().=0D +=0D + @param[in] Name The pointer to a Null-terminated Unicode string.=0D + @param[in] Guid The pointer to an EFI_GUID structure=0D + @param[out] Value The buffer point saved the variable info.=0D + @param[out] Size The buffer size of the variable.=0D +=0D + @return EFI_OUT_OF_RESOURCES Allocate buffer failed.=0D + @return EFI_SUCCESS Find the specified variable.=0D + @return Others Errors Return errors from call to gRT->GetVar= iable.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +PeiGetLargeVariable (=0D + IN CHAR16 *Name,=0D + IN EFI_GUID *Guid,=0D + OUT VOID **Value,=0D + OUT UINTN *Size OPTIONAL=0D + )=0D +{=0D + EFI_STATUS Status;=0D + UINTN VariableSize;=0D + VOID *VariableData;=0D +=0D + ASSERT (Name !=3D NULL);=0D + ASSERT (Guid !=3D NULL);=0D + ASSERT (Value !=3D NULL);=0D +=0D + VariableSize =3D 0;=0D + VariableData =3D NULL;=0D + Status =3D GetLargeVariable (Name, Guid, &VariableSize, NULL);=0D + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) {=0D + VariableData =3D AllocatePages (EFI_SIZE_TO_PAGES (VariableSize));=0D + if (VariableData =3D=3D NULL) {=0D + DEBUG ((DEBUG_ERROR, "Error: Cannot create VariableData, out of memo= ry!\n"));=0D + ASSERT (FALSE);=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D + Status =3D GetLargeVariable (Name, Guid, &VariableSize, VariableData);= =0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "Error: Unable to read UEFI variable Status: %r= \n", Status));=0D + ASSERT_EFI_ERROR (Status);=0D + return Status;=0D + }=0D + if (Value !=3D NULL) {=0D + *Value =3D VariableData;=0D + }=0D + if (Size !=3D NULL) {=0D + *Size =3D VariableSize;=0D + }=0D + return EFI_SUCCESS;=0D + }=0D + return Status;=0D +}=0D +=0D EFI_PEI_FILE_HANDLE=0D InternalGetFfsHandleFromAnyFv (=0D IN CONST EFI_GUID *NameGuid=0D diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/Save= MemoryConfig.inf b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfi= g/SaveMemoryConfig.inf index 0c8689a6f6..eac0880504 100644 --- a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC= onfig.inf +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC= onfig.inf @@ -1,7 +1,7 @@ ### @file=0D # Component information file for SaveMemoryConfig module=0D #=0D -# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>=0D +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -28,6 +28,7 @@ MdePkg/MdePkg.dec=0D MdeModulePkg/MdeModulePkg.dec=0D IntelFsp2Pkg/IntelFsp2Pkg.dec=0D + MinPlatformPkg/MinPlatformPkg.dec=0D =0D [Sources]=0D SaveMemoryConfig.c=0D @@ -39,6 +40,8 @@ =0D [Guids]=0D gFspNonVolatileStorageHobGuid ## CONSUMES=0D + gFspNonVolatileStorageHob2Guid ## CONSUMES=0D + gFspNvsBufferVariableGuid ## PRODUCES=0D =0D [Depex]=0D gEfiVariableArchProtocolGuid AND=0D diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h b/Platf= orm/Intel/MinPlatformPkg/Include/Library/PeiLib.h index d8b1a47c58..86ffb378ec 100644 --- a/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h +++ b/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h @@ -1,6 +1,6 @@ /** @file=0D =0D -Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>=0D +Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -38,6 +38,37 @@ PeiGetVariable ( OUT UINTN *Size=0D );=0D =0D +/**=0D + Returns the status whether get the large variable success. When variable= size=0D + is bigger than single UEFI variable size limit, The variable will be sav= ed in=0D + multiple UEFI variables. This function retrieves such large variable thr= ough the=0D + ReadOnlyVariable2 PPI GetVariable().=0D + The returned buffer is allocated using AllocatePage() to support > 64KB = and this=0D + buffer cannot be Free().=0D +=0D + If Name is NULL, then ASSERT().=0D + If Guid is NULL, then ASSERT().=0D + If Value is NULL, then ASSERT().=0D +=0D + @param[in] Name The pointer to a Null-terminated Unicode string.=0D + @param[in] Guid The pointer to an EFI_GUID structure=0D + @param[out] Value The buffer point saved the variable info.=0D + @param[out] Size The buffer size of the variable.=0D +=0D + @return EFI_OUT_OF_RESOURCES Allocate buffer failed.=0D + @return EFI_SUCCESS Find the specified variable.=0D + @return Others Errors Return errors from call to gRT->GetVar= iable.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +PeiGetLargeVariable (=0D + IN CHAR16 *Name,=0D + IN EFI_GUID *Guid,=0D + OUT VOID **Value,=0D + OUT UINTN *Size OPTIONAL=0D + );=0D +=0D /**=0D Finds the file in any FV and gets file Address and Size=0D =0D diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf b/Plat= form/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf index 7e740172a0..bd57cf7870 100644 --- a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf +++ b/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf @@ -1,7 +1,7 @@ ## @file=0D # Component information file for Board Init Test Library=0D #=0D -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>=0D +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR>=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -20,9 +20,11 @@ PeiServicesLib=0D MemoryAllocationLib=0D DebugLib=0D + LargeVariableReadLib=0D =0D [Packages]=0D MdePkg/MdePkg.dec=0D + MinPlatformPkg/MinPlatformPkg.dec=0D =0D [Sources]=0D PeiLib.c=0D diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/In= tel/MinPlatformPkg/MinPlatformPkg.dec index bcb42f0ef9..d6e80a66ce 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec @@ -50,6 +50,7 @@ gBdsEventBeforeConsoleAfterTrustedConsoleGuid =3D {0x51e49ff5, 0x28a9, = 0x4159, { 0xac, 0x8a, 0xb8, 0xc4, 0x88, 0xa7, 0xfd, 0xee}}=0D gBdsEventBeforeConsoleBeforeEndOfDxeGuid =3D {0xfcf26e41, 0xbda6, = 0x4633, { 0xb5, 0x73, 0xd4, 0xb8, 0x0e, 0x6d, 0xd0, 0x78}}=0D gBdsEventAfterConsoleReadyBeforeBootOptionGuid =3D {0x8eb3d5dc, 0xf4e7, = 0x4b57, { 0xa9, 0xe7, 0x27, 0x39, 0x10, 0xf2, 0x18, 0x9f}}=0D + gFspNvsBufferVariableGuid =3D {0x9c7715cd, 0x8d66, = 0x4d2a, { 0x90, 0x0d, 0x01, 0x45, 0x9a, 0x57, 0x59, 0x6b}}=0D =0D [LibraryClasses]=0D =0D --=20 2.28.0.windows.1
|
|
[edk2-platforms: PATCH 0/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2.
Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3678
Implementation should search FSP_NON_VOLATILE_STORAGE_HOB2 firstly and only search FSP_NON_VOLATILE_STORAGE_HOB when former one is not found. Also added PeiGetLargeVariable () to support the scenarios where the variable data size is bigger than a single variable size limit. Cc: Isaac Oram <isaac.w.oram@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Heng Luo <heng.luo@intel.com> Cc: Jeremy Soller <jeremy@system76.com> Cc: Benjamin Doron <benjamin.doron00@gmail.com> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com> Cc: Deepika Kethi Reddy <deepika.kethi.reddy@intel.com> Cc: Kathappan Esakkithevar <kathappan.esakkithevar@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Eric Dong <eric.dong@intel.com> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> Chasel Chiu (9): MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2. CometlakeOpenBoardPkg: Use same variable name for FspNvsHob. KabylakeOpenBoardPkg/AspireVn7Dash572G:Use same variable name for FspNvsHob KabylakeOpenBoardPkg/GalagoPro3: Use same variable name for FspNvsHob. KabylakeOpenBoardPkg/KabylakeRvp3: Use same variable name for FspNvsHob. TigerlakeOpenBoardPkg: Use same variable name for FspNvsHob. WhiskeylakeOpenBoardPkg: Use same variable name for FspNvsHob. WhitleyOpenBoardPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2. WhitleySiliconPkg: Use same variable name for FspNvsHob. Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++++------------------------------------------------- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 24 ++++++++++-------------- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c | 23 +++++++++-------------- Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 24 ++++++++++-------------- Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 25 ++++++++++--------------- Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c | 23 +++++++++-------------- Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c | 39 ++++++++++++++++++++++++++++----------- Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.c | 21 ++++++++++++++++++--- Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++--------------------------------------------------- Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c | 63 ++++++++++++--------------------------------------------------- Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.c | 29 +++++++++++++++++++++++------ Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.c | 35 +++++++++-------------------------- Platform/Intel/CometlakeOpenBoardPkg/CometlakeURvp/OpenBoardPkg.dsc | 3 +++ Platform/Intel/CometlakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 7 ++++--- Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf | 2 +- Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc | 3 +++ Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf | 2 +- Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf | 5 ++++- Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h | 33 ++++++++++++++++++++++++++++++++- Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf | 4 +++- Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec | 1 + Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf | 1 + Platform/Intel/TigerlakeOpenBoardPkg/TigerlakeURvp/OpenBoardPkg.dsc | 3 +++ Platform/Intel/WhiskeylakeOpenBoardPkg/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf | 4 ++-- Platform/Intel/WhiskeylakeOpenBoardPkg/UpXtreme/OpenBoardPkg.dsc | 3 +++ Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 3 +++ Platform/Intel/WhitleyOpenBoardPkg/Platform/Dxe/S3NvramSave/S3NvramSave.inf | 4 +++- Platform/Intel/WhitleyOpenBoardPkg/PlatformPkg.dsc | 1 + Silicon/Intel/WhitleySiliconPkg/Library/FspWrapperPlatformLib/FspWrapperPlatformLib.inf | 3 ++- 34 files changed, 310 insertions(+), 293 deletions(-) -- 2.28.0.windows.1
|
|
Event: TianoCore Community Meeting - APAC/NAMO - 10/07/2021
#cal-reminder
devel@edk2.groups.io Calendar <noreply@...>
Reminder: TianoCore Community Meeting - APAC/NAMO When: Where: Organizer: Soumya Guptha Description: Microsoft Teams meeting Join on your computer or mobile app Click here to join the meeting Join with a video conferencing device Video Conference ID: 119 132 712 6 Alternate VTC dialing instructions Or call in (audio only) +1 916-245-6934,,494156131# United States, Sacramento Phone Conference ID: 494 156 131# Find a local number | Reset PIN Learn More | Meeting options
|
|
回复: 回复: [edk2-devel] Python2.7 is not working with the EDK2 build system
gaoliming
Cole:
toggle quoted messageShow quoted text
Here is the error message https://edk2.groups.io/g/devel/message/80068?p=,,,20,0,0,0::recentpostdate%252Fsticky,,python,20,2,0,85296733 Yes, Python27 has been end of life. But, Edk2 has not announced to drop Python27 support. So, if someone meets with python27 issue, we need to response them. Now, I think we can give the proposal to drop Python27 support in Edk2 project. Thanks Liming
-----邮件原件-----
|
|
回复: [edk2-devel] [PATCH v7 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib
gaoliming
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 -----邮件原件-----does not need tofilled does not need to'pivot' elementreserved.<BR>
|
|
Event: TianoCore Community Meeting - APAC/NAMO - 10/07/2021
#cal-reminder
devel@edk2.groups.io Calendar <noreply@...>
Reminder: TianoCore Community Meeting - APAC/NAMO When: Where: Organizer: Soumya Guptha Description: Microsoft Teams meeting Join on your computer or mobile app Click here to join the meeting Join with a video conferencing device Video Conference ID: 119 132 712 6 Alternate VTC dialing instructions Or call in (audio only) +1 916-245-6934,,494156131# United States, Sacramento Phone Conference ID: 494 156 131# Find a local number | Reset PIN Learn More | Meeting options
|
|
回复: [edk2-devel] [PATCH v1 1/1] MdePkg: Fix ACPI memory aggregator/device type mismatch
gaoliming
Samer:
toggle quoted messageShow quoted text
Thanks for your information. I agree this change. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Thanks Liming
-----邮件原件-----
|
|
Re: [PATCH v1 1/1] MdePkg: Fix ACPI memory aggregator/device type mismatch
Samer El-Haj-Mahmoud
We did investigate this in the BZ, and the conclusion was it is safer to update the code to match the spec. The only OS implementation we have seen so far is in Linux, and it uses the spec defined values (although for limited usage). See https://bugzilla.tianocore.org/show_bug.cgi?id=3579
toggle quoted messageShow quoted text
-----Original Message-----
|
|
Re: [PATCH] UserAuthFeaturePkg/UserAuthenticationDxeSmm: The SMI to handle the user authentication should be unregister before booting to OS
Dandan Bi
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
toggle quoted messageShow quoted text
Thanks, Dandan
-----Original Message-----
|
|
Re: [PATCH] MdeModulePkg/Core/Dxe: Add lock protection in CoreLocateHandleBuffer()
Dandan Bi
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
toggle quoted messageShow quoted text
Thanks, Dandan
-----Original Message-----
|
|
回复: [edk2-devel] [PATCH v1 1/1] MdePkg: Fix ACPI memory aggregator/device type mismatch
gaoliming
Jones:
toggle quoted messageShow quoted text
Do you know what impact will be introduced by this change? Thanks Liming
-----邮件原件-----
|
|
Re: [PATCH V8 3/3] OvmfPkg: Enable TDX in ResetVector
Yao, Jiewen
I propose to submit independent patch with independent metadata (2 tables) – don’t complicate thing.
We can revisit to see if there is need to merge to 1 table or how to merge, as a separate/standalone patch.
Thank you Yao Jiewen
From: Singh, Brijesh <brijesh.singh@...>
Sent: Friday, October 1, 2021 1:40 AM To: Xu, Min M <min.m.xu@...>; devel@edk2.groups.io; kraxel@...; Yao, Jiewen <jiewen.yao@...> Cc: Ard Biesheuvel <ardb+tianocore@...>; Justen, Jordan L <jordan.l.justen@...>; Erdem Aktas <erdemaktas@...>; James Bottomley <jejb@...>; Lendacky, Thomas <Thomas.Lendacky@...> Subject: Re: [edk2-devel] [PATCH V8 3/3] OvmfPkg: Enable TDX in ResetVector
[AMD Official Use Only]
Yes, I will try to make it work for the unified Metadata. Let's do it indepent of SNP and TDX series. You can pick the generic patch from my series and add the additional fields we need for the TDX and submit it.
From: Xu, Min M <min.m.xu@...>
[AMD Official Use Only]
Hi, Brijesh In the current discussion there are 2 options for the metadata, a unified Metadata and 2 separate Metadata (SEV and TDX metadata). My understanding to your last mail is that you’re going to use the unified Metadata option, right?
As to the offset of metadata, absolute offset is a good idea. I will update it in my next version.
Thanks! Min From: devel@edk2.groups.io <devel@edk2.groups.io>
On Behalf Of Brijesh Singh via groups.io
[AMD Official Use Only]
May I ask to use the OvmfMetadata instead of the of TdxMetadata for the Guided structure name label (same as what I did in SNP series patch #4). If you can send the metadata introduction as a patch separately then add the TDX descriptor in TDX series. I can try to make it work for the SNP series and add SNP specific descriptors. Additionally, I think you want to provide an absolute offset for the start of the metadata instead relative value so that VMM can very easily reach to the start of metadata. e.g
+OvmfMetadataOffsetStart:
For SNP series, I will 3 section types #1 CPUID, # Secrets, and #3 SEC_MEM and will probably add a total of 3 more descriptors.
From: Xu, Min M <min.m.xu@...>
On September 28, 2021 12:43 PM, Gerd Hoffmann wrote:
|
|
[PATCH v7 1/1] MdePkg/BaseLib: Add QuickSort function on BaseLib
From: IanX Kuo <ianx.kuo@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3675 Add QuickSort function into BaseLib Cc: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: IanX Kuo <ianx.kuo@intel.com> --- 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/Base= Lib.h index 2452c1d92e..0ae0f4e6af 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -2856,6 +2856,55 @@ RemoveEntryList ( //=0D // Math Services=0D //=0D +/**=0D + Prototype for comparison function for any two element types.=0D +=0D + @param[in] Buffer1 The pointer to first buffer.=0D + @param[in] Buffer2 The pointer to second buffer.=0D +=0D + @retval 0 Buffer1 equal to Buffer2.=0D + @return <0 Buffer1 is less than Buffer2.=0D + @return >0 Buffer1 is greater than Buffer2.=0D +**/=0D +typedef=0D +INTN=0D +(EFIAPI *BASE_SORT_COMPARE)(=0D + IN CONST VOID *Buffer1,=0D + IN CONST VOID *Buffer2=0D + );=0D +=0D +/**=0D + This function is identical to perform QuickSort,=0D + except that is uses the pre-allocated buffer so the in place sorting doe= s not need to=0D + allocate and free buffers constantly.=0D +=0D + Each element must be equal sized.=0D +=0D + if BufferToSort is NULL, then ASSERT.=0D + if CompareFunction is NULL, then ASSERT.=0D + if BufferOneElement is NULL, then ASSERT.=0D + if ElementSize is < 1, then ASSERT.=0D +=0D + if Count is < 2 then perform no action.=0D +=0D + @param[in, out] BufferToSort on call a Buffer of (possibly sorted) ele= ments=0D + on return a buffer of sorted elements=0D + @param[in] Count the number of elements in the buffer to s= ort=0D + @param[in] ElementSize Size of an element in bytes=0D + @param[in] CompareFunction The function to call to perform the compa= rison=0D + of any 2 elements=0D + @param[out] BufferOneElement Caller provided buffer whose size equals = to ElementSize.=0D + It's used by QuickSort() for swapping in = sorting.=0D +**/=0D +VOID=0D +EFIAPI=0D +QuickSort (=0D + IN OUT VOID *BufferToSort,=0D + IN CONST UINTN Count,=0D + IN CONST UINTN ElementSize,=0D + IN BASE_SORT_COMPARE CompareFunction,=0D + OUT VOID *BufferOneElement=0D + );=0D =0D /**=0D Shifts a 64-bit integer left between 0 and 63 bits. The low bits are fil= led=0D diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/Ba= seLib.inf index 6efa5315b6..cebda3b210 100644 --- a/MdePkg/Library/BaseLib/BaseLib.inf +++ b/MdePkg/Library/BaseLib/BaseLib.inf @@ -32,6 +32,7 @@ SwapBytes16.c=0D LongJump.c=0D SetJump.c=0D + QuickSort.c=0D RShiftU64.c=0D RRotU64.c=0D RRotU32.c=0D diff --git a/MdePkg/Library/BaseLib/QuickSort.c b/MdePkg/Library/BaseLib/Qu= ickSort.c new file mode 100644 index 0000000000..a825c072b0 --- /dev/null +++ b/MdePkg/Library/BaseLib/QuickSort.c @@ -0,0 +1,116 @@ +/** @file=0D + Math worker functions.=0D +=0D + Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include "BaseLibInternals.h"=0D +=0D +/**=0D + This function is identical to perform QuickSort,=0D + except that is uses the pre-allocated buffer so the in place sorting doe= s not need to=0D + allocate and free buffers constantly.=0D +=0D + Each element must be equal sized.=0D +=0D + if BufferToSort is NULL, then ASSERT.=0D + if CompareFunction is NULL, then ASSERT.=0D + if BufferOneElement is NULL, then ASSERT.=0D + if ElementSize is < 1, then ASSERT.=0D +=0D + if Count is < 2 then perform no action.=0D +=0D + @param[in, out] BufferToSort on call a Buffer of (possibly sorted) ele= ments=0D + on return a buffer of sorted elements=0D + @param[in] Count the number of elements in the buffer to s= ort=0D + @param[in] ElementSize Size of an element in bytes=0D + @param[in] CompareFunction The function to call to perform the compa= rison=0D + of any 2 elements=0D + @param[out] BufferOneElement Caller provided buffer whose size equals = to ElementSize.=0D + It's used by QuickSort() for swapping in = sorting.=0D +**/=0D +VOID=0D +EFIAPI=0D +QuickSort (=0D + IN OUT VOID *BufferToSort,=0D + IN CONST UINTN Count,=0D + IN CONST UINTN ElementSize,=0D + IN BASE_SORT_COMPARE CompareFunction,=0D + OUT VOID *BufferOneElement=0D + )=0D +{=0D + VOID *Pivot;=0D + UINTN LoopCount;=0D + UINTN NextSwapLocation;=0D +=0D + ASSERT (BufferToSort !=3D NULL);=0D + ASSERT (CompareFunction !=3D NULL);=0D + ASSERT (BufferOneElement !=3D NULL);=0D + ASSERT (ElementSize >=3D 1);=0D +=0D + if (Count < 2) {=0D + return;=0D + }=0D +=0D + NextSwapLocation =3D 0;=0D +=0D + //=0D + // pick a pivot (we choose last element)=0D + //=0D + Pivot =3D ((UINT8*) BufferToSort + ((Count - 1) * ElementSize));=0D +=0D + //=0D + // Now get the pivot such that all on "left" are below it=0D + // and everything "right" are above it=0D + //=0D + for (LoopCount =3D 0; LoopCount < Count -1; LoopCount++) {=0D + //=0D + // if the element is less than or equal to the pivot=0D + //=0D + if (CompareFunction ((VOID*) ((UINT8*) BufferToSort + ((LoopCount) * E= lementSize)), Pivot) <=3D 0){=0D + //=0D + // swap=0D + //=0D + CopyMem (BufferOneElement, (UINT8*) BufferToSort + (NextSwapLocation= * ElementSize), ElementSize);=0D + CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), (= UINT8*) BufferToSort + ((LoopCount) * ElementSize), ElementSize);=0D + CopyMem ((UINT8*) BufferToSort + ((LoopCount)*ElementSize), BufferOn= eElement, ElementSize);=0D +=0D + //=0D + // increment NextSwapLocation=0D + //=0D + NextSwapLocation++;=0D + }=0D + }=0D + //=0D + // swap pivot to it's final position (NextSwapLocation)=0D + //=0D + CopyMem (BufferOneElement, Pivot, ElementSize);=0D + CopyMem (Pivot, (UINT8*) BufferToSort + (NextSwapLocation * ElementSize)= , ElementSize);=0D + CopyMem ((UINT8*) BufferToSort + (NextSwapLocation * ElementSize), Buffe= rOneElement, ElementSize);=0D +=0D + //=0D + // Now recurse on 2 partial lists. neither of these will have the 'pivo= t' element=0D + // IE list is sorted left half, pivot element, sorted right half...=0D + //=0D + if (NextSwapLocation >=3D 2) {=0D + QuickSort (=0D + BufferToSort,=0D + NextSwapLocation,=0D + ElementSize,=0D + CompareFunction,=0D + BufferOneElement=0D + );=0D + }=0D +=0D + if ((Count - NextSwapLocation - 1) >=3D 2) {=0D + QuickSort (=0D + (UINT8 *)BufferToSort + (NextSwapLocation + 1) * ElementSize,=0D + Count - NextSwapLocation - 1,=0D + ElementSize,=0D + CompareFunction,=0D + BufferOneElement=0D + );=0D + }=0D +}=0D diff --git a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf b/MdePkg/Librar= y/BaseLib/UnitTestHostBaseLib.inf index eae1a7158d..d09bd12bef 100644 --- a/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf +++ b/MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf @@ -1,7 +1,7 @@ ## @file=0D # Base Library implementation for use with host based unit tests.=0D #=0D -# Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.<BR>= =0D +# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR>= =0D # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>= =0D # Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>=0D # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All righ= ts reserved.<BR>=0D @@ -33,6 +33,7 @@ SwapBytes16.c=0D LongJump.c=0D SetJump.c=0D + QuickSort.c=0D RShiftU64.c=0D RRotU64.c=0D RRotU32.c=0D --=20 2.30.0.windows.1
|
|
[PATCH v7 0/1] Add function QuickSort into MdePkg/BaseLib
From: IanX Kuo <ianx.kuo@intel.com>
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
|
|
Re: Progress on getting Uncrustify working for EDK2?
Marvin, Good point. This would make the rule moot. So maybe just removing the requirement would be the easiest long term fix. Other embedded projects I know of do this too, and as you point out the compilers keep these APIs standard for folks the provide their own runtimes. Thanks, Andrew Fish
|
|
Re: Progress on getting Uncrustify working for EDK2?
Marvin Häuser <mhaeuser@...>
Hey Mike,
Hey Andrew, I'll just reply to both mails at once :) On 07/10/2021 19:36, Andrew Fish wrote: Thanks! I'd keep STATIC actually just for the sake of not doing no-op changes that do not really do anything and for consistency with CONST, but whatever works really.On Oct 7, 2021, at 1:19 PM, Michael D Kinney <michael.d.kinney@intel.com> wrote: Yes.Are referring to use of pre-initialized CONST variables declared within +1This issue is independent of CONST. I’m not sure a coding style tool is smart enough to catch this generically? You need an understanding of C types to know if the local variable assignment is going to trigger a memcpy(). I know there were stability concerns with intrinsics in the past, but memcpy() is in the standard, and the rest remained stable to my knowledge. Maybe it's time to fix the issues at the root? Works for us: https://github.com/acidanthera/OpenCorePkg/tree/master/Library/OcCompilerIntrinsicsLib Best regards, Marvin
|
|
Re: Progress on getting Uncrustify working for EDK2?
This issue is independent of CONST. I’m not sure a coding style tool is smart enough to catch this generically? You need an understanding of C types to know if the local variable assignment is going to trigger a memcpy(). What I’ve seen in the real world is the firmware compiles with -Os or LTO to fit int he ROM for DEBUG and RELEASE, and the optimizer optimizes away the call to memcpy. Then if you try to build NOOPT (or over ride the compiler flags on an individual driver/lib) you fail to link as only the NOOPT build injects the memcpy. Thus I think the best way to enforce this rule is to compile a project NOOPT. I’m trying to remember are there flags to built to tell it to compile and skip the FD construction? Maybe we should advocate platforms add a NOOPT build target that just compiles the code, but does not create the FD? Thanks, Andrew Fish
|
|
Re: Progress on getting Uncrustify working for EDK2?
Michael D Kinney
Hi Marvin,
toggle quoted messageShow quoted text
Some comments below. Mike
-----Original Message-----Debugging concerns are no longer relevant. The suggestion in the BZ below is to remove the STATIC macro and allow EDK II sources to add 'static' to any functions it makes sense to use on. https://bugzilla.tianocore.org/show_bug.cgi?id=1766 Are referring to use of pre-initialized CONST variables declared within a function? I think Bret brought this topic up when implementing some unit tests and the suggestion to pass ECCC was to promote them to pre-initialized CONST global variables. The challenges we have seen in the past with pre-initialized variables within a function is that they can cause compilers to inject use of memcpy() calls, especially if the variable being initialized on the stack is a structure. These cause build breaks today. By shadowing do you mean the declaration of the same variable name in multiple scoped within the same function? I agree that this can reduce duplication and sync issues. The uncrustify tool being discussed here could not help clean this up or enforce this type of rule. It is a good topic, but may need to be split out into its own thread.
|
|
Re: Progress on getting Uncrustify working for EDK2?
Michael D Kinney
Hi Leif,
toggle quoted messageShow quoted text
Thanks for the feedback. Adjusting the EDK II C Coding Style should absolutely be part of this discussion. We need to work towards specific proposals. Here are the current open bugs against the EDK II C Coding Style. Please update or add new for the changes you are suggesting. https://bugzilla.tianocore.org/buglist.cgi?bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=IN_PROGRESS&columnlist=product%2Ccomponent%2Cshort_desc%2Creporter&component=Documentation&f1=cf_documents&list_id=23944&o1=equals&product=EDK2&query_format=advanced&resolution=---&v1=EDK%20II%20C%20Coding%20Standards 2664 Discrepancies/inconsistencies in coding standards, style and examples 1698 Spurious rule about comment style in CCS 6.2.3 713 Update EDK II C Coding standard to state a stronger preference for 80 column line widths 714 Update EDK II C Coding Standards to allow multiple arguments per line in a function call 1766 Remove use of STATIC macros from EDK II C Coding Standard Specification 2391 Dangling word at end of Section 5.1.9 In-line assembler shall not be used 723 5.1.8 Typo provided should be proven 884 The cover.jpg file for the EDK II specs has the old style logo 839 Minor typographical errors Additional comments below. Thanks, Mike
-----Original Message----- Here is an example of a change that uncrustify did that I think you are suggesting is not required with support for multiple params per line. Correct? Before Uncristify ================= AsmCpuidEx ( CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_SUB_LEAF, &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx ); After Uncristify ================= AsmCpuidEx ( CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_SUB_LEAF, &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx ); Here is the BZ on the topic. https://bugzilla.tianocore.org/show_bug.cgi?id=714 I think you are suggesting that a 4th style may be allowed which would be to support arguments in the same line as the function name and additional arguments on additional lines. Do you want to update this BZ with your additional thoughts? I think this is related to the DEBUG() macro using double (( and double )) parens. I know one issue with function pointer typedefs is making sure the format is compatible with Doxygen document generation. https://github.com/tianocore/edk2/tree/master/BaseTools/Scripts/PackageDocumentTools
|
|