From: ydong10 Date: Wed, 30 May 2012 07:36:00 +0000 (+0000) Subject: Add new interface GetVariable2 and GetEfiGlobalVariable2 to return more info. Also... X-Git-Tag: edk2-stable201903~13369 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=bf4a3dbd4751b6411bdfc98bf3ac2c4f928bdfdf Add new interface GetVariable2 and GetEfiGlobalVariable2 to return more info. Also replace old interface with new one. Signed-off-by: Eric Dong Reviewed-by: Liming Gao git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13375 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c index ae2124522f..3b14c75df5 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/Strings.c @@ -1,7 +1,7 @@ /** @file This file implements the protocol functions related to string package. -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -349,7 +349,7 @@ HiiThunkGetString ( // // Get the current platform language setting // - PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &PlatformLanguage, NULL); // // Get the best matching language from SupportedLanguages diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c index 1c0c6dc646..91dc6def4e 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -1513,8 +1513,8 @@ BdsLibEnumerateAllBootOption ( // device from the boot order variable // if (mEnumBootDevice) { - LastLang = GetVariable (LAST_ENUM_LANGUAGE_VARIABLE_NAME, &gLastEnumLangGuid); - PlatLang = GetEfiGlobalVariable (L"PlatformLang"); + GetVariable2 (LAST_ENUM_LANGUAGE_VARIABLE_NAME, &gLastEnumLangGuid, &LastLang, NULL); + GetEfiGlobalVariable2 (L"PlatformLang", &PlatLang, NULL); ASSERT (PlatLang != NULL); if ((LastLang != NULL) && (AsciiStrCmp (LastLang, PlatLang) == 0)) { Status = BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder"); diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c index 6cb9d6b7ab..0dddba7077 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c @@ -1,7 +1,7 @@ /** @file The platform device manager reference implementation -Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -2167,7 +2167,7 @@ DriverHealthSelectBestLanguage ( CHAR8 *LanguageVariable; CHAR8 *BestLanguage; - LanguageVariable = GetEfiGlobalVariable (Iso639Language ? L"Lang" : L"PlatformLang"); + GetEfiGlobalVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", &LanguageVariable, NULL); BestLanguage = GetBestLanguage( SupportedLanguages, diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index 53dcf82ea9..30e43e81c7 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -232,7 +232,7 @@ FrontPageCallback ( Index++; } - PlatformSupportedLanguages = GetEfiGlobalVariable (L"PlatformLangCodes"); + GetEfiGlobalVariable2 (L"PlatformLangCodes", &PlatformSupportedLanguages, NULL); if (PlatformSupportedLanguages == NULL) { PlatformSupportedLanguages = AllocateCopyPool ( AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)), @@ -430,7 +430,7 @@ InitializeFrontPage ( Lang = AllocatePool (AsciiStrSize (LanguageString)); ASSERT (Lang != NULL); - CurrentLang = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &CurrentLang, NULL); // // Select the best language in LanguageString as the default one. // diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiString.c b/MdeModulePkg/Library/UefiHiiLib/HiiString.c index 6b1ec2d703..4cc7b802c6 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiString.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiString.c @@ -1,7 +1,7 @@ /** @file HII Library implementation that uses DXE protocols and services. - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -250,7 +250,7 @@ HiiGetString ( // // Get the current platform language setting // - PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &PlatformLanguage, NULL); // // If Languag is NULL, then set it to an empty string, so it will be diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c index 6a65731aca..008e746b33 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c @@ -2,7 +2,7 @@ Produces Simple Text Input Protocol, Simple Text Input Extended Protocol and Simple Text Output Protocol upon Serial IO Protocol. -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -358,7 +358,7 @@ IsTerminalInConsoleVariable ( // // Get global variable and its size according to the name given. // - Variable = GetEfiGlobalVariable (VariableName); + GetEfiGlobalVariable2 (VariableName, &Variable, NULL); if (Variable == NULL) { return FALSE; } @@ -1431,7 +1431,7 @@ TerminalUpdateConsoleDevVariable ( // // Get global variable and its size according to the name given. // - Variable = GetEfiGlobalVariable (VariableName); + GetEfiGlobalVariable2 (VariableName, &Variable, NULL); if (Variable == NULL) { return; } @@ -1500,7 +1500,7 @@ TerminalRemoveConsoleDevVariable ( // // Get global variable and its size according to the name given. // - Variable = GetEfiGlobalVariable (VariableName); + GetEfiGlobalVariable2 (VariableName, &Variable, NULL); if (Variable == NULL) { return ; } diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c index 66fc6b9781..93857bd11b 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c @@ -2368,7 +2368,7 @@ HiiStringIdToImage ( if (Language == NULL) { Language = ""; } - CurrentLanguage = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &CurrentLanguage, NULL); BestLanguage = GetBestLanguage ( SupportedLanguages, FALSE, diff --git a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c index f283db019d..27ee99219b 100644 --- a/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c +++ b/MdeModulePkg/Universal/Network/Ip4ConfigDxe/NicIp4Variable.c @@ -1,7 +1,7 @@ /** @file Routines used to operate the Ip4 configure variable. -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at
@@ -91,7 +91,7 @@ Ip4ConfigReadVariable ( { NIC_IP4_CONFIG_INFO *NicConfig; - NicConfig = GetVariable (Instance->MacString, &gEfiNicIp4ConfigVariableGuid); + GetVariable2 (Instance->MacString, &gEfiNicIp4ConfigVariableGuid, &NicConfig, NULL); if (NicConfig != NULL) { Ip4ConfigFixRouteTablePointer (&NicConfig->Ip4Info); } @@ -255,7 +255,7 @@ Check: continue; } - NicConfig = GetVariable (VariableName, &gEfiNicIp4ConfigVariableGuid); + GetVariable2 (VariableName, &gEfiNicIp4ConfigVariableGuid, &NicConfig, NULL); if (NicConfig == NULL) { break; } diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c index ab8a000f13..1c2b02f5a9 100644 --- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c +++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c @@ -13,7 +13,7 @@ 4. It save all the mapping info in NV variables which will be consumed by platform override protocol driver to publish the platform override protocol. -Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -185,7 +185,7 @@ GetComponentNameWorker ( // // Find the best matching language. // - Language = GetEfiGlobalVariable (VariableName); + GetEfiGlobalVariable2 (VariableName, &Language, NULL); BestLanguage = GetBestLanguage ( ComponentName->SupportedLanguages, (BOOLEAN) (ProtocolGuid == &gEfiComponentNameProtocolGuid), diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h index df7e7d5379..4ce8dc6c05 100644 --- a/MdePkg/Include/Library/UefiLib.h +++ b/MdePkg/Include/Library/UefiLib.h @@ -12,7 +12,7 @@ of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is defined, then debug and assert related macros wrapped by it are the NULL implementations. -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License that accompanies this distribution. The full text of the license may be found at @@ -629,8 +629,11 @@ FreeUnicodeStringTable ( IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable ); +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES /** + [ATTENTION] This function will be deprecated for security reason. + Returns a pointer to an allocated buffer that contains the contents of a variable retrieved through the UEFI Runtime Service GetVariable(). The returned buffer is allocated using AllocatePool(). The caller is responsible @@ -655,6 +658,8 @@ GetVariable ( ); /** + [ATTENTION] This function will be deprecated for security reason. + Returns a pointer to an allocated buffer that contains the contents of a variable retrieved through the UEFI Runtime Service GetVariable(). This function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. @@ -675,7 +680,64 @@ EFIAPI GetEfiGlobalVariable ( IN CONST CHAR16 *Name ); +#endif + + +/** + Returns the status whether get the variable success. The function retrieves + variable through the UEFI Runtime Service GetVariable(). The + returned buffer is allocated using AllocatePool(). The caller is responsible + for freeing this buffer with FreePool(). + + If Name is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + If Value is NULL, then ASSERT(). + + @param[in] Name The pointer to a Null-terminated Unicode string. + @param[in] Guid The pointer to an EFI_GUID structure + @param[out] Value The buffer point saved the variable info. + @param[out] Size The buffer size of the variable. + + @return EFI_OUT_OF_RESOURCES Allocate buffer failed. + @return EFI_SUCCESS Find the specified variable. + @return Others Errors Return errors from call to gRT->GetVariable. + +**/ +EFI_STATUS +EFIAPI +GetVariable2 ( + IN CONST CHAR16 *Name, + IN CONST EFI_GUID *Guid, + OUT VOID **Value, + OUT UINTN *Size OPTIONAL + ); + +/** + Returns a pointer to an allocated buffer that contains the contents of a + variable retrieved through the UEFI Runtime Service GetVariable(). This + function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. + The returned buffer is allocated using AllocatePool(). The caller is + responsible for freeing this buffer with FreePool(). + + If Name is NULL, then ASSERT(). + If Value is NULL, then ASSERT(). + @param[in] Name The pointer to a Null-terminated Unicode string. + @param[out] Value The buffer point saved the variable info. + @param[out] Size The buffer size of the variable. + + @return EFI_OUT_OF_RESOURCES Allocate buffer failed. + @return EFI_SUCCESS Find the specified variable. + @return Others Errors Return errors from call to gRT->GetVariable. + +**/ +EFI_STATUS +EFIAPI +GetEfiGlobalVariable2 ( + IN CONST CHAR16 *Name, + OUT VOID **Value, + OUT UINTN *Size OPTIONAL + ); /** Returns a pointer to an allocated buffer that contains the best matching language diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c index 96dccb1477..112766ad86 100644 --- a/MdePkg/Library/UefiLib/UefiLib.c +++ b/MdePkg/Library/UefiLib/UefiLib.c @@ -5,7 +5,7 @@ EFI Driver Model related protocols, manage Unicode string tables for UEFI Drivers, and print messages on the console output and standard error devices. - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1212,7 +1212,11 @@ FreeUnicodeStringTable ( return EFI_SUCCESS; } +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES + /** + [ATTENTION] This function will be deprecated for security reason. + Returns a pointer to an allocated buffer that contains the contents of a variable retrieved through the UEFI Runtime Service GetVariable(). The returned buffer is allocated using AllocatePool(). The caller is responsible @@ -1273,8 +1277,9 @@ GetVariable ( return Value; } - /** + [ATTENTION] This function will be deprecated for security reason. + Returns a pointer to an allocated buffer that contains the contents of a variable retrieved through the UEFI Runtime Service GetVariable(). This function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. @@ -1298,7 +1303,110 @@ GetEfiGlobalVariable ( { return GetVariable (Name, &gEfiGlobalVariableGuid); } +#endif + +/** + Returns the status whether get the variable success. The function retrieves + variable through the UEFI Runtime Service GetVariable(). The + returned buffer is allocated using AllocatePool(). The caller is responsible + for freeing this buffer with FreePool(). + + If Name is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + If Value is NULL, then ASSERT(). + + @param[in] Name The pointer to a Null-terminated Unicode string. + @param[in] Guid The pointer to an EFI_GUID structure + @param[out] Value The buffer point saved the variable info. + @param[out] Size The buffer size of the variable. + + @return EFI_OUT_OF_RESOURCES Allocate buffer failed. + @return EFI_SUCCESS Find the specified variable. + @return Others Errors Return errors from call to gRT->GetVariable. + +**/ +EFI_STATUS +EFIAPI +GetVariable2 ( + IN CONST CHAR16 *Name, + IN CONST EFI_GUID *Guid, + OUT VOID **Value, + OUT UINTN *Size OPTIONAL + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + + ASSERT (Name != NULL && Guid != NULL && Value != NULL); + + // + // Try to get the variable size. + // + BufferSize = 0; + *Value = NULL; + if (Size != NULL) { + *Size = 0; + } + + Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); + if (Status != EFI_BUFFER_TOO_SMALL) { + return Status; + } + + // + // Allocate buffer to get the variable. + // + *Value = AllocatePool (BufferSize); + ASSERT (*Value != NULL); + if (*Value == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // Get the variable data. + // + Status = gRT->GetVariable ((CHAR16 *) Name, (EFI_GUID *) Guid, NULL, &BufferSize, *Value); + if (EFI_ERROR (Status)) { + FreePool(*Value); + *Value = NULL; + } + + if (Size != NULL) { + *Size = BufferSize; + } + + return Status; +} +/** + Returns a pointer to an allocated buffer that contains the contents of a + variable retrieved through the UEFI Runtime Service GetVariable(). This + function always uses the EFI_GLOBAL_VARIABLE GUID to retrieve variables. + The returned buffer is allocated using AllocatePool(). The caller is + responsible for freeing this buffer with FreePool(). + + If Name is NULL, then ASSERT(). + If Value is NULL, then ASSERT(). + + @param[in] Name The pointer to a Null-terminated Unicode string. + @param[out] Value The buffer point saved the variable info. + @param[out] Size The buffer size of the variable. + + @return EFI_OUT_OF_RESOURCES Allocate buffer failed. + @return EFI_SUCCESS Find the specified variable. + @return Others Errors Return errors from call to gRT->GetVariable. + +**/ +EFI_STATUS +EFIAPI +GetEfiGlobalVariable2 ( + IN CONST CHAR16 *Name, + OUT VOID **Value, + OUT UINTN *Size OPTIONAL + ) +{ + return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size); +} /** Returns a pointer to an allocated buffer that contains the best matching language diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c index ac0e577f5e..479eb143d8 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c @@ -1,7 +1,7 @@ /** @file Dhcp6 support functions implementation. - Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -41,7 +41,7 @@ Dhcp6GenerateClientId ( // Attempt to get client Id from variable to keep it constant. // See details in section-9 of rfc-3315. // - Duid = GetVariable (L"ClientId", &gEfiDhcp6ServiceBindingProtocolGuid); + GetVariable2 (L"ClientId", &gEfiDhcp6ServiceBindingProtocolGuid, &Duid, NULL); if (Duid != NULL) { return Duid; } diff --git a/NetworkPkg/IScsiDxe/IScsiMisc.c b/NetworkPkg/IScsiDxe/IScsiMisc.c index f3ecdb5f6a..46e97a9fcd 100644 --- a/NetworkPkg/IScsiDxe/IScsiMisc.c +++ b/NetworkPkg/IScsiDxe/IScsiMisc.c @@ -1,7 +1,7 @@ /** @file Miscellaneous routines for iSCSI driver. -Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1076,10 +1076,12 @@ IScsiGetConfigData ( (UINTN) AttemptConfigOrder[Index] ); - AttemptConfigData = (ISCSI_ATTEMPT_CONFIG_NVDATA *) GetVariable ( - mPrivate->PortString, - &gEfiIScsiInitiatorNameProtocolGuid - ); + GetVariable2 ( + mPrivate->PortString, + &gEfiIScsiInitiatorNameProtocolGuid, + &AttemptConfigData, + NULL + ); if (AttemptConfigData == NULL) { continue; diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c index 5be7444b31..1968d07ec2 100644 --- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c +++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -43,7 +43,7 @@ CurrentLanguageMatch ( return; } - CurrentLang = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &CurrentLang, NULL); DefaultLang = (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang); BestLanguage = GetBestLanguage ( Languages, diff --git a/PerformancePkg/Dp_App/DpUtilities.c b/PerformancePkg/Dp_App/DpUtilities.c index f60006125f..0d4e17acc1 100644 --- a/PerformancePkg/Dp_App/DpUtilities.c +++ b/PerformancePkg/Dp_App/DpUtilities.c @@ -270,7 +270,7 @@ GetNameFromHandle ( // // Get the current platform language setting // - PlatformLanguage = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &PlatformLanguage, NULL); Status = ComponentName2->GetDriverName ( ComponentName2, PlatformLanguage != NULL ? PlatformLanguage : "en-US", diff --git a/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c b/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c index f7fe594060..b5b51b4ed2 100644 --- a/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c +++ b/SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c @@ -1,7 +1,7 @@ /** @file Implement defer image load services for user identification in UEFI2.2. -Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -532,7 +532,7 @@ IsBootOption ( // Try to find the DevicePath in BootOption // UnicodeSPrint (StrTemp, sizeof (StrTemp), L"Boot%04x", Index); - OptionBuffer = GetEfiGlobalVariable (StrTemp); + GetEfiGlobalVariable2 (StrTemp, &OptionBuffer, NULL); if (OptionBuffer == NULL) { continue; } diff --git a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c index 843ca2a92c..ec18a1b523 100644 --- a/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c +++ b/SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c @@ -1065,7 +1065,7 @@ VerifyCertUefiGuid ( // // Get KEK database variable. // - KekList = GetEfiGlobalVariable (EFI_KEY_EXCHANGE_KEY_NAME); + GetEfiGlobalVariable2 (EFI_KEY_EXCHANGE_KEY_NAME, &KekList, NULL); if (KekList == NULL) { return EFI_SECURITY_VIOLATION; } @@ -1260,7 +1260,7 @@ DxeImageVerificationHandler ( return EFI_ACCESS_DENIED; } - SecureBootEnable = GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid); + GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, &SecureBootEnable, NULL); // // Skip verification if SecureBootEnable variable doesn't exist. // @@ -1278,7 +1278,7 @@ DxeImageVerificationHandler ( FreePool (SecureBootEnable); - SetupMode = GetEfiGlobalVariable (EFI_SETUP_MODE_NAME); + GetEfiGlobalVariable2 (EFI_SETUP_MODE_NAME, &SetupMode, NULL); // // SetupMode doesn't exist means no AuthVar driver is dispatched, @@ -1544,7 +1544,7 @@ VariableWriteCallBack ( // If this library is built-in, it means firmware has capability to perform // driver signing verification. // - SecureBootModePtr = GetEfiGlobalVariable (EFI_SECURE_BOOT_MODE_NAME); + GetEfiGlobalVariable2 (EFI_SECURE_BOOT_MODE_NAME, &SecureBootModePtr, NULL); if (SecureBootModePtr == NULL) { SecureBootMode = SECURE_BOOT_MODE_DISABLE; // diff --git a/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c b/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c index d73f77eeec..8585c72712 100644 --- a/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c +++ b/SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyAccessPolicy.c @@ -410,7 +410,7 @@ DisplayLoadPermit( // Get driver device path. // UnicodeSPrint (VarName, sizeof (VarName), L"Driver%04x", Order[Index]); - Var = GetEfiGlobalVariable (VarName); + GetEfiGlobalVariable2 (VarName, &Var, NULL); if (Var == NULL) { continue; } @@ -655,7 +655,7 @@ AddToForbidLoad ( // Get loadable driver device path. // UnicodeSPrint (VarName, sizeof (VarName), L"Driver%04x", DriverIndex); - Var = GetEfiGlobalVariable (VarName); + GetEfiGlobalVariable2 (VarName, &Var, NULL); if (Var == NULL) { return; } diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c index f740c0ae75..0dc9c2b22d 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c @@ -215,7 +215,7 @@ DeleteVariable ( UINTN DataSize; UINT32 Attr; - Variable = GetVariable (VariableName, VendorGuid); + GetVariable2 (VariableName, VendorGuid, &Variable, NULL); if (Variable == NULL) { return EFI_SUCCESS; } @@ -2064,7 +2064,7 @@ SecureBootExtractConfigFromVariable ( // // Get the SecureBootEnable Variable // - SecureBootEnable = GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid); + GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, &SecureBootEnable, NULL); // // If the SecureBootEnable Variable doesn't exist, hide the SecureBoot Enable/Disable @@ -2088,7 +2088,7 @@ SecureBootExtractConfigFromVariable ( // // If there is no PK then the Delete Pk button will be gray. // - SetupMode = GetVariable (EFI_SETUP_MODE_NAME, &gEfiGlobalVariableGuid); + GetVariable2 (EFI_SETUP_MODE_NAME, &gEfiGlobalVariableGuid, &SetupMode, NULL); if (SetupMode == NULL || (*SetupMode) == 1) { ConfigData->HasPk = FALSE; } else { @@ -2098,7 +2098,7 @@ SecureBootExtractConfigFromVariable ( // // Get the SecureBootMode from CustomMode variable. // - SecureBootMode = GetVariable (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid); + GetVariable2 (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid, &SecureBootMode, NULL); if (SecureBootMode == NULL) { ConfigData->SecureBootMode = STANDARD_SECURE_BOOT_MODE; } else { @@ -2298,6 +2298,9 @@ SecureBootCallback ( UINTN BufferSize; SECUREBOOT_CONFIGURATION *IfrNvData; UINT16 LabelId; + UINT8 *SecureBootEnable; + + SecureBootEnable = NULL; if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; @@ -2326,7 +2329,8 @@ SecureBootCallback ( switch (QuestionId) { case KEY_SECURE_BOOT_ENABLE: - if (NULL != GetVariable (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid)) { + GetVariable2 (EFI_SECURE_BOOT_ENABLE_NAME, &gEfiSecureBootEnableDisableGuid, &SecureBootEnable, NULL); + if (NULL != SecureBootEnable) { if (EFI_ERROR (SaveSecureBootVariable (Value->u8))) { CreatePopUp ( EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, @@ -2513,7 +2517,8 @@ SecureBootCallback ( break; case KEY_SECURE_BOOT_MODE: - if (NULL != GetVariable (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid)) { + GetVariable2 (EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid, &SecureBootEnable, NULL); + if (NULL != SecureBootEnable) { Status = gRT->SetVariable ( EFI_CUSTOM_MODE_NAME, &gEfiCustomModeEnableGuid, diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c index 64addad4a9..600f2ee9ae 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c @@ -2,7 +2,7 @@ This driver parses the mSmbiosMiscDataTable structure and reports any generated data. - Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -45,7 +45,7 @@ CurrentLanguageMatch ( return; } - CurrentLang = GetEfiGlobalVariable (L"PlatformLang"); + GetEfiGlobalVariable2 (L"PlatformLang", &CurrentLang, NULL); DefaultLang = (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang); BestLanguage = GetBestLanguage ( Languages,