From 474fb76f1d40c71acedac52f70daa232b86b3118 Mon Sep 17 00:00:00 2001 From: Guo Dong Date: Mon, 1 May 2023 14:42:27 -0700 Subject: [PATCH] feat: Update the lite variable usage Since lite variable API change, this patch Update the caller to align with variable library. Signed-off-by: Guo Dong --- .../Library/MmcTuningLib/MmcTuningLib.c | 6 +++--- BootloaderCommonPkg/Library/ShellLib/CmdMmcDll.c | 4 ++-- PayloadPkg/OsLoader/BootParameters.c | 4 ++-- PayloadPkg/OsLoader/KeyManagement.c | 10 +++++----- .../Library/Stage2BoardInitLib/SeedSupport.c | 4 ++-- .../Library/Stage2BoardInitLib/Stage2BoardInitLib.c | 4 ++-- .../Include/Library/StageCommonBoardInitLib.h | 4 ++-- .../Library/Stage2BoardInitLib/MiscInit.c | 8 ++++---- .../StageCommonBoardInitLib/StageCommonBoardInitLib.c | 8 ++++---- .../IdavilleBoardPkg/Library/TmeVarLib/TmeVarLib.c | 6 +++--- .../Library/TmeVarLib/TmeVarLibInternal.h | 4 ++-- .../Library/Stage1BBoardInitLib/Stage1BBoardInitLib.c | 8 ++++---- .../Library/Stage2BoardInitLib/Stage2BoardInitLib.c | 8 ++++---- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/BootloaderCommonPkg/Library/MmcTuningLib/MmcTuningLib.c b/BootloaderCommonPkg/Library/MmcTuningLib/MmcTuningLib.c index 8fc84ebe..4c6281a6 100644 --- a/BootloaderCommonPkg/Library/MmcTuningLib/MmcTuningLib.c +++ b/BootloaderCommonPkg/Library/MmcTuningLib/MmcTuningLib.c @@ -1,7 +1,7 @@ /** @file This file provides some helper functions which are specific for EMMC device. - Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -957,7 +957,7 @@ MmcTuning ( // VariableLen = sizeof (EmmcTuningData); ZeroMem (&EmmcTuningData, VariableLen); - Status = GetVariable ("MMCDLL", NULL, &VariableLen, &EmmcTuningData); + Status = GetVariable (L"MMCDLL", NULL, NULL, &VariableLen, &EmmcTuningData); if (!EFI_ERROR (Status)) { if ((FeatureCfg & FEATURE_MMC_FORCE_TUNING) == 0) { DEBUG ((DEBUG_INFO, "Found eMMC tunning data, re-tuning is not required.\n")); @@ -992,7 +992,7 @@ MmcTuning ( DEBUG ((DEBUG_ERROR, "ERRORL: MMC serial number invalid, status = %r\n", Status)); } - Status = SetVariable ("MMCDLL", 0, sizeof(EMMC_TUNING_DATA), &EmmcTuningData); + Status = SetVariable (L"MMCDLL", NULL, 0, sizeof(EMMC_TUNING_DATA), &EmmcTuningData); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "MMC DLL data save error, status = %r\n", Status)); } diff --git a/BootloaderCommonPkg/Library/ShellLib/CmdMmcDll.c b/BootloaderCommonPkg/Library/ShellLib/CmdMmcDll.c index abdb6b80..71c6de18 100644 --- a/BootloaderCommonPkg/Library/ShellLib/CmdMmcDll.c +++ b/BootloaderCommonPkg/Library/ShellLib/CmdMmcDll.c @@ -1,7 +1,7 @@ /** @file Shell command `mmcdll` to display system performance data. - Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -113,7 +113,7 @@ ShellCommandMmcDllFunc ( MmcInitialize (EmmcHcPciBase, DevInitAll); MmcTuning (EmmcHcPciBase); VariableLen = sizeof (EmmcTuningData); - Status = GetVariable ("MMCDLL", NULL, &VariableLen, &EmmcTuningData); + Status = GetVariable (L"MMCDLL", NULL, NULL, &VariableLen, &EmmcTuningData); if (EFI_ERROR (Status)) { ShellPrint (L"MMC traing fails, not found MMCDLL variable.\n"); return EFI_DEVICE_ERROR; diff --git a/PayloadPkg/OsLoader/BootParameters.c b/PayloadPkg/OsLoader/BootParameters.c index 1d697be2..cdaa7e7b 100644 --- a/PayloadPkg/OsLoader/BootParameters.c +++ b/PayloadPkg/OsLoader/BootParameters.c @@ -1,13 +1,13 @@ /** @file - Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include "OsLoader.h" -CONST CHAR8 *mMmcDllStr = "MMCDLL"; +CONST CHAR16 *mMmcDllStr = L"MMCDLL"; CONST CHAR8 *mAppendCmdLineParams = NULL; diff --git a/PayloadPkg/OsLoader/KeyManagement.c b/PayloadPkg/OsLoader/KeyManagement.c index b7b2d592..1e5d164a 100644 --- a/PayloadPkg/OsLoader/KeyManagement.c +++ b/PayloadPkg/OsLoader/KeyManagement.c @@ -1,14 +1,14 @@ /** @file - Copyright (c) 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include "OsLoader.h" -extern CONST CHAR8 *mMmcDllStr; -UINT8 mRpmbKeyCount = 0; +extern CONST CHAR16 *mMmcDllStr; +UINT8 mRpmbKeyCount = 0; /** Check the eMMC storage serial number validity. @@ -42,7 +42,7 @@ EmmcSerialNumCheck ( // Get serial number from SPI flash VariableLen = sizeof (EmmcTuningData); - Status = GetVariable ((CHAR8 *)mMmcDllStr, NULL, &VariableLen, (void *)&EmmcTuningData); + Status = GetVariable ((CHAR16 *)mMmcDllStr, NULL, NULL, &VariableLen, (void *)&EmmcTuningData); if (EFI_ERROR (Status)) { return EFI_NOT_FOUND; } @@ -52,7 +52,7 @@ EmmcSerialNumCheck ( AsciiStrCpyS (EmmcTuningData.SerialNumber, sizeof(EmmcTuningData.SerialNumber), LoaderPlatformInfo->SerialNumber); // Save new serial number into SPI flash - Status = SetVariable ((CHAR8 *)mMmcDllStr, 0, sizeof (EMMC_TUNING_DATA), (VOID *)&EmmcTuningData); + Status = SetVariable ((CHAR16 *)mMmcDllStr, NULL, 0, sizeof (EMMC_TUNING_DATA), (VOID *)&EmmcTuningData); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "MMC serial number save to flash unsuccessful, Status = %r\n", Status)); return EFI_DEVICE_ERROR; diff --git a/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/SeedSupport.c b/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/SeedSupport.c index a742484c..1b8ae81b 100644 --- a/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/SeedSupport.c +++ b/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/SeedSupport.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -251,7 +251,7 @@ GenerateSeeds ( // Get EmmcTuningData.SerialNumber from SPI using variable service VariableLen = sizeof (EmmcTuningData); - Status = GetVariable ("MMCDLL", NULL, &VariableLen, (void *)&EmmcTuningData); + Status = GetVariable (L"MMCDLL", NULL, NULL, &VariableLen, (void *)&EmmcTuningData); if ((Status != EFI_SUCCESS) || (AsciiStrnCmp (EmmcTuningData.SerialNumber, "badbadbadbadba", sizeof (EmmcTuningData.SerialNumber)) == 0)) { RpmbSerialNumberValid = FALSE; } else { diff --git a/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c b/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c index 69397a1d..11b87b46 100644 --- a/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c +++ b/Platform/ApollolakeBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2017-2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2017-2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -1552,7 +1552,7 @@ UpdateLoaderPlatformInfo ( EmmcTuningData.Hs400DataValid = 0; VariableLen = sizeof (EmmcTuningData); - Status = GetVariable ("MMCDLL", NULL, &VariableLen, &EmmcTuningData); + Status = GetVariable (L"MMCDLL", NULL, NULL, &VariableLen, &EmmcTuningData); if (EFI_ERROR (Status)) { AsciiStrCpyS (EmmcTuningData.SerialNumber, sizeof(EmmcTuningData.SerialNumber), "badbadbadbadba"); } diff --git a/Platform/IdavilleBoardPkg/Include/Library/StageCommonBoardInitLib.h b/Platform/IdavilleBoardPkg/Include/Library/StageCommonBoardInitLib.h index 54d55248..3261c74c 100644 --- a/Platform/IdavilleBoardPkg/Include/Library/StageCommonBoardInitLib.h +++ b/Platform/IdavilleBoardPkg/Include/Library/StageCommonBoardInitLib.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2021, Intel Corporation. All rights reserved.
+ Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -10,7 +10,7 @@ #include -#define VAR_NAME_VAR_STS "VarSts" +#define VAR_NAME_VAR_STS L"VarSts" #define VAR_LENGTH_VAR_STS 16 #define INITIAL_CODE_REGION_LENGTH ALIGN_UP (FixedPcdGet32(PcdStage1ASize), SIZE_64KB) diff --git a/Platform/IdavilleBoardPkg/Library/Stage2BoardInitLib/MiscInit.c b/Platform/IdavilleBoardPkg/Library/Stage2BoardInitLib/MiscInit.c index 016fce1f..9b1ff3c9 100644 --- a/Platform/IdavilleBoardPkg/Library/Stage2BoardInitLib/MiscInit.c +++ b/Platform/IdavilleBoardPkg/Library/Stage2BoardInitLib/MiscInit.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.
+ Copyright (c) 2020 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -343,11 +343,11 @@ DEBUG_CODE_BEGIN (); ZeroMem (Buffer, sizeof (Buffer)); VariableLen = VAR_LENGTH_VAR_STS; - Status = GetVariable (VAR_NAME_VAR_STS, NULL, &VariableLen, Buffer); + Status = GetVariable (VAR_NAME_VAR_STS, NULL, NULL, &VariableLen, Buffer); if (!EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "GetVariable: %a %a(%d)\n", VAR_NAME_VAR_STS, Buffer, VariableLen)); + DEBUG ((DEBUG_INFO, "GetVariable: %s %a(%d)\n", VAR_NAME_VAR_STS, Buffer, VariableLen)); } else { - DEBUG ((DEBUG_INFO, "No %a found!\n", VAR_NAME_VAR_STS)); + DEBUG ((DEBUG_INFO, "No %s found!\n", VAR_NAME_VAR_STS)); } Status = GetComponentInfo (FLASH_MAP_SIG_UEFIVARIABLE, &Address, &VarSize); diff --git a/Platform/IdavilleBoardPkg/Library/StageCommonBoardInitLib/StageCommonBoardInitLib.c b/Platform/IdavilleBoardPkg/Library/StageCommonBoardInitLib/StageCommonBoardInitLib.c index 5787e7cd..6bc37dcb 100644 --- a/Platform/IdavilleBoardPkg/Library/StageCommonBoardInitLib/StageCommonBoardInitLib.c +++ b/Platform/IdavilleBoardPkg/Library/StageCommonBoardInitLib/StageCommonBoardInitLib.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2021, Intel Corporation. All rights reserved.
+ Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -41,13 +41,13 @@ DEBUG_CODE_BEGIN (); CHAR8 Buffer[VAR_LENGTH_VAR_STS + 1]; VariableLen = VAR_LENGTH_VAR_STS; - Status = GetVariable (VAR_NAME_VAR_STS, NULL, &VariableLen, Buffer); + Status = GetVariable (VAR_NAME_VAR_STS, NULL, NULL, &VariableLen, Buffer); if (!EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "VariableInitialize: %a %a(%d)\n", VAR_NAME_VAR_STS, Buffer, VariableLen)); + DEBUG ((DEBUG_INFO, "VariableInitialize: %s %a(%d)\n", VAR_NAME_VAR_STS, Buffer, VariableLen)); } else if (Status == EFI_NOT_FOUND) { Status = AsciiStrCpyS (Buffer, VAR_LENGTH_VAR_STS, "Initialized!\0"); if (!EFI_ERROR (Status)) { - Status = SetVariable (VAR_NAME_VAR_STS, 0, AsciiStrLen (Buffer), Buffer); + Status = SetVariable (VAR_NAME_VAR_STS, NULL, 0, AsciiStrLen (Buffer), Buffer); } } } diff --git a/Platform/IdavilleBoardPkg/Library/TmeVarLib/TmeVarLib.c b/Platform/IdavilleBoardPkg/Library/TmeVarLib/TmeVarLib.c index 0c401ee7..33a7d574 100644 --- a/Platform/IdavilleBoardPkg/Library/TmeVarLib/TmeVarLib.c +++ b/Platform/IdavilleBoardPkg/Library/TmeVarLib/TmeVarLib.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2021 Intel Corporation. All rights reserved.
+ Copyright (c) 2021 - 2023 Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -73,7 +73,7 @@ GetTmeVar ( // read the TME keys // DEBUG ((DEBUG_INFO, "reading the keys from the TME NVRAM variable...\n")); - Status = GetVariable (TME_KEY_VAR, 0, &TmeKeyVarSize, TmeKeyData); + Status = GetVariable (TME_KEY_VAR, NULL, NULL, &TmeKeyVarSize, TmeKeyData); DEBUG ((DEBUG_INFO, "GetTmeVar Exit\n")); @@ -135,7 +135,7 @@ SetTmeVar ( TmeKeyData.TmeKey[0].Key1 = pTmeStatusHobData->TME_Key1; DEBUG ((DEBUG_INFO, "Writing the keys to the TME NVRAM variable...\n")); - Status = SetVariable (TME_KEY_VAR, 0, sizeof(TME_KEY), &TmeKeyData); + Status = SetVariable (TME_KEY_VAR, NULL, 0, sizeof(TME_KEY), &TmeKeyData); } } else { DEBUG ((DEBUG_INFO, "FSP HOB List not found.\n")); diff --git a/Platform/IdavilleBoardPkg/Library/TmeVarLib/TmeVarLibInternal.h b/Platform/IdavilleBoardPkg/Library/TmeVarLib/TmeVarLibInternal.h index 490368ba..5e06c89f 100644 --- a/Platform/IdavilleBoardPkg/Library/TmeVarLib/TmeVarLibInternal.h +++ b/Platform/IdavilleBoardPkg/Library/TmeVarLib/TmeVarLibInternal.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2021, Intel Corporation. All rights reserved.
+ Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -8,7 +8,7 @@ #ifndef _TME_VAR_LIB_INTERNAL_H_ #define _TME_VAR_LIB_INTERNAL_H_ -#define TME_KEY_VAR "TME_KEYS" +#define TME_KEY_VAR L"TME_KEYS" typedef struct { UINT64 TME_Key0; diff --git a/Platform/QemuBoardPkg/Library/Stage1BBoardInitLib/Stage1BBoardInitLib.c b/Platform/QemuBoardPkg/Library/Stage1BBoardInitLib/Stage1BBoardInitLib.c index fea3ea50..06ac8681 100644 --- a/Platform/QemuBoardPkg/Library/Stage1BBoardInitLib/Stage1BBoardInitLib.c +++ b/Platform/QemuBoardPkg/Library/Stage1BBoardInitLib/Stage1BBoardInitLib.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -92,18 +92,18 @@ TestVariableService ( Data = 0; DataSize = sizeof(Data); - Status = GetVariable ("VARTST0", NULL, &DataSize, &Data); + Status = GetVariable (L"VARTST0", NULL, NULL, &DataSize, &Data); if (!EFI_ERROR(Status) && (Data == 0x55667788) && (sizeof(Data) == DataSize)) { return EFI_SUCCESS; } Data = 0x11223344; - Status = SetVariable ("VARTST0", 0, sizeof(Data), &Data); + Status = SetVariable (L"VARTST0", NULL, 0, sizeof(Data), &Data); Data = 0; DataSize = sizeof(Data); if (!EFI_ERROR(Status)) { - Status = GetVariable ("VARTST0", NULL, &DataSize, &Data); + Status = GetVariable (L"VARTST0", NULL, NULL, &DataSize, &Data); } if (!EFI_ERROR(Status) && (Data == 0x11223344) && (sizeof(Data) == DataSize)) { diff --git a/Platform/QemuBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c b/Platform/QemuBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c index b375c136..14d37c5c 100644 --- a/Platform/QemuBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c +++ b/Platform/QemuBoardPkg/Library/Stage2BoardInitLib/Stage2BoardInitLib.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+ Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -60,7 +60,7 @@ TestVariableService ( DEBUG ((DEBUG_INFO, "Test variable services\n")); DataSize = sizeof(Data); - Status = GetVariable ("VARTST0", NULL, &DataSize, &Data); + Status = GetVariable (L"VARTST0", NULL, NULL, &DataSize, &Data); if (!EFI_ERROR(Status) && (Data == 0x55667788) && (sizeof(Data) == DataSize)) { return EFI_SUCCESS; } @@ -70,12 +70,12 @@ TestVariableService ( } Data = 0x55667788; - Status = SetVariable ("VARTST0", 0, sizeof(Data), &Data); + Status = SetVariable (L"VARTST0", NULL, 0, sizeof(Data), &Data); Data = 0; DataSize = sizeof(Data); if (!EFI_ERROR(Status)) { - Status = GetVariable ("VARTST0", NULL, &DataSize, &Data); + Status = GetVariable (L"VARTST0", NULL, NULL, &DataSize, &Data); } if (!EFI_ERROR(Status) && (Data == 0x55667788) && (sizeof(Data) == DataSize)) {