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 <guo.dong@intel.com>
This commit is contained in:
Guo Dong 2023-05-01 14:42:27 -07:00 committed by Guo Dong
parent 25c804da79
commit 474fb76f1d
13 changed files with 39 additions and 39 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
This file provides some helper functions which are specific for EMMC device. This file provides some helper functions which are specific for EMMC device.
Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR> Copyright (c) 2015 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -957,7 +957,7 @@ MmcTuning (
// //
VariableLen = sizeof (EmmcTuningData); VariableLen = sizeof (EmmcTuningData);
ZeroMem (&EmmcTuningData, VariableLen); ZeroMem (&EmmcTuningData, VariableLen);
Status = GetVariable ("MMCDLL", NULL, &VariableLen, &EmmcTuningData); Status = GetVariable (L"MMCDLL", NULL, NULL, &VariableLen, &EmmcTuningData);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
if ((FeatureCfg & FEATURE_MMC_FORCE_TUNING) == 0) { if ((FeatureCfg & FEATURE_MMC_FORCE_TUNING) == 0) {
DEBUG ((DEBUG_INFO, "Found eMMC tunning data, re-tuning is not required.\n")); 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)); 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)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "MMC DLL data save error, status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "MMC DLL data save error, status = %r\n", Status));
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Shell command `mmcdll` to display system performance data. Shell command `mmcdll` to display system performance data.
Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -113,7 +113,7 @@ ShellCommandMmcDllFunc (
MmcInitialize (EmmcHcPciBase, DevInitAll); MmcInitialize (EmmcHcPciBase, DevInitAll);
MmcTuning (EmmcHcPciBase); MmcTuning (EmmcHcPciBase);
VariableLen = sizeof (EmmcTuningData); VariableLen = sizeof (EmmcTuningData);
Status = GetVariable ("MMCDLL", NULL, &VariableLen, &EmmcTuningData); Status = GetVariable (L"MMCDLL", NULL, NULL, &VariableLen, &EmmcTuningData);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
ShellPrint (L"MMC traing fails, not found MMCDLL variable.\n"); ShellPrint (L"MMC traing fails, not found MMCDLL variable.\n");
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;

View File

@ -1,13 +1,13 @@
/** @file /** @file
Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
#include "OsLoader.h" #include "OsLoader.h"
CONST CHAR8 *mMmcDllStr = "MMCDLL"; CONST CHAR16 *mMmcDllStr = L"MMCDLL";
CONST CHAR8 *mAppendCmdLineParams = NULL; CONST CHAR8 *mAppendCmdLineParams = NULL;

View File

@ -1,14 +1,14 @@
/** @file /** @file
Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
#include "OsLoader.h" #include "OsLoader.h"
extern CONST CHAR8 *mMmcDllStr; extern CONST CHAR16 *mMmcDllStr;
UINT8 mRpmbKeyCount = 0; UINT8 mRpmbKeyCount = 0;
/** /**
Check the eMMC storage serial number validity. Check the eMMC storage serial number validity.
@ -42,7 +42,7 @@ EmmcSerialNumCheck (
// Get serial number from SPI flash // Get serial number from SPI flash
VariableLen = sizeof (EmmcTuningData); VariableLen = sizeof (EmmcTuningData);
Status = GetVariable ((CHAR8 *)mMmcDllStr, NULL, &VariableLen, (void *)&EmmcTuningData); Status = GetVariable ((CHAR16 *)mMmcDllStr, NULL, NULL, &VariableLen, (void *)&EmmcTuningData);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
@ -52,7 +52,7 @@ EmmcSerialNumCheck (
AsciiStrCpyS (EmmcTuningData.SerialNumber, sizeof(EmmcTuningData.SerialNumber), LoaderPlatformInfo->SerialNumber); AsciiStrCpyS (EmmcTuningData.SerialNumber, sizeof(EmmcTuningData.SerialNumber), LoaderPlatformInfo->SerialNumber);
// Save new serial number into SPI flash // 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)) { if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "MMC serial number save to flash unsuccessful, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "MMC serial number save to flash unsuccessful, Status = %r\n", Status));
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -251,7 +251,7 @@ GenerateSeeds (
// Get EmmcTuningData.SerialNumber from SPI using variable service // Get EmmcTuningData.SerialNumber from SPI using variable service
VariableLen = sizeof (EmmcTuningData); 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)) { if ((Status != EFI_SUCCESS) || (AsciiStrnCmp (EmmcTuningData.SerialNumber, "badbadbadbadba", sizeof (EmmcTuningData.SerialNumber)) == 0)) {
RpmbSerialNumberValid = FALSE; RpmbSerialNumberValid = FALSE;
} else { } else {

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2017-2019, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017-2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -1552,7 +1552,7 @@ UpdateLoaderPlatformInfo (
EmmcTuningData.Hs400DataValid = 0; EmmcTuningData.Hs400DataValid = 0;
VariableLen = sizeof (EmmcTuningData); VariableLen = sizeof (EmmcTuningData);
Status = GetVariable ("MMCDLL", NULL, &VariableLen, &EmmcTuningData); Status = GetVariable (L"MMCDLL", NULL, NULL, &VariableLen, &EmmcTuningData);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
AsciiStrCpyS (EmmcTuningData.SerialNumber, sizeof(EmmcTuningData.SerialNumber), "badbadbadbadba"); AsciiStrCpyS (EmmcTuningData.SerialNumber, sizeof(EmmcTuningData.SerialNumber), "badbadbadbadba");
} }

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -10,7 +10,7 @@
#include <Library/VariableLib.h> #include <Library/VariableLib.h>
#define VAR_NAME_VAR_STS "VarSts" #define VAR_NAME_VAR_STS L"VarSts"
#define VAR_LENGTH_VAR_STS 16 #define VAR_LENGTH_VAR_STS 16
#define INITIAL_CODE_REGION_LENGTH ALIGN_UP (FixedPcdGet32(PcdStage1ASize), SIZE_64KB) #define INITIAL_CODE_REGION_LENGTH ALIGN_UP (FixedPcdGet32(PcdStage1ASize), SIZE_64KB)

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR> Copyright (c) 2020 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -343,11 +343,11 @@ DEBUG_CODE_BEGIN ();
ZeroMem (Buffer, sizeof (Buffer)); ZeroMem (Buffer, sizeof (Buffer));
VariableLen = VAR_LENGTH_VAR_STS; 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)) { 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 { } 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); Status = GetComponentInfo (FLASH_MAP_SIG_UEFIVARIABLE, &Address, &VarSize);

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -41,13 +41,13 @@ DEBUG_CODE_BEGIN ();
CHAR8 Buffer[VAR_LENGTH_VAR_STS + 1]; CHAR8 Buffer[VAR_LENGTH_VAR_STS + 1];
VariableLen = VAR_LENGTH_VAR_STS; 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)) { 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) { } else if (Status == EFI_NOT_FOUND) {
Status = AsciiStrCpyS (Buffer, VAR_LENGTH_VAR_STS, "Initialized!\0"); Status = AsciiStrCpyS (Buffer, VAR_LENGTH_VAR_STS, "Initialized!\0");
if (!EFI_ERROR (Status)) { 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);
} }
} }
} }

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2021 Intel Corporation. All rights reserved.<BR> Copyright (c) 2021 - 2023 Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -73,7 +73,7 @@ GetTmeVar (
// read the TME keys // read the TME keys
// //
DEBUG ((DEBUG_INFO, "reading the keys from the TME NVRAM variable...\n")); 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")); DEBUG ((DEBUG_INFO, "GetTmeVar Exit\n"));
@ -135,7 +135,7 @@ SetTmeVar (
TmeKeyData.TmeKey[0].Key1 = pTmeStatusHobData->TME_Key1; TmeKeyData.TmeKey[0].Key1 = pTmeStatusHobData->TME_Key1;
DEBUG ((DEBUG_INFO, "Writing the keys to the TME NVRAM variable...\n")); 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 { } else {
DEBUG ((DEBUG_INFO, "FSP HOB List not found.\n")); DEBUG ((DEBUG_INFO, "FSP HOB List not found.\n"));

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2021, Intel Corporation. All rights reserved.<BR> Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -8,7 +8,7 @@
#ifndef _TME_VAR_LIB_INTERNAL_H_ #ifndef _TME_VAR_LIB_INTERNAL_H_
#define _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 { typedef struct {
UINT64 TME_Key0; UINT64 TME_Key0;

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -92,18 +92,18 @@ TestVariableService (
Data = 0; Data = 0;
DataSize = sizeof(Data); 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)) { if (!EFI_ERROR(Status) && (Data == 0x55667788) && (sizeof(Data) == DataSize)) {
return EFI_SUCCESS; return EFI_SUCCESS;
} }
Data = 0x11223344; Data = 0x11223344;
Status = SetVariable ("VARTST0", 0, sizeof(Data), &Data); Status = SetVariable (L"VARTST0", NULL, 0, sizeof(Data), &Data);
Data = 0; Data = 0;
DataSize = sizeof(Data); DataSize = sizeof(Data);
if (!EFI_ERROR(Status)) { 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)) { if (!EFI_ERROR(Status) && (Data == 0x11223344) && (sizeof(Data) == DataSize)) {

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.<BR> Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -60,7 +60,7 @@ TestVariableService (
DEBUG ((DEBUG_INFO, "Test variable services\n")); DEBUG ((DEBUG_INFO, "Test variable services\n"));
DataSize = sizeof(Data); 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)) { if (!EFI_ERROR(Status) && (Data == 0x55667788) && (sizeof(Data) == DataSize)) {
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -70,12 +70,12 @@ TestVariableService (
} }
Data = 0x55667788; Data = 0x55667788;
Status = SetVariable ("VARTST0", 0, sizeof(Data), &Data); Status = SetVariable (L"VARTST0", NULL, 0, sizeof(Data), &Data);
Data = 0; Data = 0;
DataSize = sizeof(Data); DataSize = sizeof(Data);
if (!EFI_ERROR(Status)) { 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)) { if (!EFI_ERROR(Status) && (Data == 0x55667788) && (sizeof(Data) == DataSize)) {