mirror of https://github.com/acidanthera/audk.git
Report the setting variable failure to platform through the status code when core cannot handle the error.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15385 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5456c26c2f
commit
69fc8f080e
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
BDS Lib functions which relate with create or process the boot option.
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -82,6 +82,10 @@ BdsDeleteBootOption (
|
|||
0,
|
||||
NULL
|
||||
);
|
||||
//
|
||||
// Deleting variable with existing variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// adjust boot order array
|
||||
|
@ -626,6 +630,10 @@ BdsDeleteAllInvalidLegacyBootOptions (
|
|||
BootOrderSize,
|
||||
BootOrder
|
||||
);
|
||||
//
|
||||
// Shrinking variable with existing variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (BootOrder != NULL) {
|
||||
FreePool (BootOrder);
|
||||
}
|
||||
|
@ -857,11 +865,10 @@ BdsAddNonExistingLegacyBootOptions (
|
|||
&BootOrder,
|
||||
&BootOrderSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
if (!EFI_ERROR (Status)) {
|
||||
BbsIndex = Index;
|
||||
OptionNumber = BootOrder[BootOrderSize / sizeof (UINT16) - 1];
|
||||
}
|
||||
BbsIndex = Index;
|
||||
OptionNumber = BootOrder[BootOrderSize / sizeof (UINT16) - 1];
|
||||
}
|
||||
|
||||
ASSERT (BbsIndex == Index);
|
||||
|
@ -2265,7 +2272,7 @@ BdsLibBootViaBootOption (
|
|||
// In this case, "BootCurrent" is not created.
|
||||
// Only create the BootCurrent variable when it points to a valid Boot#### variable.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
SetVariableAndReportStatusCodeOnError (
|
||||
L"BootCurrent",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
|
@ -2463,13 +2470,14 @@ Done:
|
|||
|
||||
//
|
||||
// Clear Boot Current
|
||||
// Deleting variable with current implementation shouldn't fail.
|
||||
//
|
||||
gRT->SetVariable (
|
||||
L"BootCurrent",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
0,
|
||||
&Option->BootCurrent
|
||||
NULL
|
||||
);
|
||||
|
||||
return Status;
|
||||
|
@ -2580,6 +2588,7 @@ BdsExpandPartitionPartialDevicePathToFull (
|
|||
FreePool (TempNewDevicePath);
|
||||
//
|
||||
// Save the matching Device Path so we don't need to do a connect all next time
|
||||
// Failure to set the variable only impacts the performance when next time expanding the short-form device path.
|
||||
//
|
||||
Status = gRT->SetVariable (
|
||||
HD_BOOT_DEVICE_PATH_VARIABLE_NAME,
|
||||
|
@ -2678,6 +2687,7 @@ BdsExpandPartitionPartialDevicePathToFull (
|
|||
|
||||
//
|
||||
// Save the matching Device Path so we don't need to do a connect all next time
|
||||
// Failure to set the variable only impacts the performance when next time expanding the short-form device path.
|
||||
//
|
||||
Status = gRT->SetVariable (
|
||||
HD_BOOT_DEVICE_PATH_VARIABLE_NAME,
|
||||
|
@ -2887,6 +2897,10 @@ BdsLibDeleteOptionFromHandle (
|
|||
BootOrderSize,
|
||||
BootOrder
|
||||
);
|
||||
//
|
||||
// Shrinking variable with existing variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FreePool (BootOrder);
|
||||
|
||||
|
@ -2985,6 +2999,10 @@ BdsDeleteAllInvalidEfiBootOption (
|
|||
NULL
|
||||
);
|
||||
//
|
||||
// Deleting variable with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
//
|
||||
// Mark this boot option in boot order as deleted
|
||||
//
|
||||
BootOrder[Index] = 0xffff;
|
||||
|
@ -3012,6 +3030,10 @@ BdsDeleteAllInvalidEfiBootOption (
|
|||
Index2 * sizeof (UINT16),
|
||||
BootOrder
|
||||
);
|
||||
//
|
||||
// Shrinking variable with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FreePool (BootOrder);
|
||||
|
||||
|
@ -3135,7 +3157,9 @@ BdsLibEnumerateAllBootOption (
|
|||
AsciiStrSize (PlatLang),
|
||||
PlatLang
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
//
|
||||
// Failure to set the variable only impacts the performance next time enumerating the boot options.
|
||||
//
|
||||
|
||||
if (LastLang != NULL) {
|
||||
FreePool (LastLang);
|
||||
|
@ -3478,6 +3502,7 @@ BdsLibBootNext (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT16 *BootNext;
|
||||
UINTN BootNextSize;
|
||||
CHAR16 Buffer[20];
|
||||
|
@ -3502,13 +3527,17 @@ BdsLibBootNext (
|
|||
// Clear the boot next variable first
|
||||
//
|
||||
if (BootNext != NULL) {
|
||||
gRT->SetVariable (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
0,
|
||||
BootNext
|
||||
);
|
||||
Status = gRT->SetVariable (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
//
|
||||
// Deleting variable with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Start to build the boot option and try to boot
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
BDS Lib functions which contain all the code to connect console device
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -285,17 +285,16 @@ BdsLibUpdateConsoleVariable (
|
|||
// Finally, Update the variable of the default console by NewDevicePath
|
||||
//
|
||||
DevicePathSize = GetDevicePathSize (NewDevicePath);
|
||||
Status = gRT->SetVariable (
|
||||
ConVarName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
Attributes,
|
||||
DevicePathSize,
|
||||
NewDevicePath
|
||||
);
|
||||
Status = SetVariableAndReportStatusCodeOnError (
|
||||
ConVarName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
Attributes,
|
||||
DevicePathSize,
|
||||
NewDevicePath
|
||||
);
|
||||
if ((DevicePathSize == 0) && (Status == EFI_NOT_FOUND)) {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
if (VarConsole == NewDevicePath) {
|
||||
if (VarConsole != NULL) {
|
||||
|
|
|
@ -1419,13 +1419,13 @@ BdsSetMemoryTypeInformationVariable (
|
|||
// Or create the variable in first boot.
|
||||
//
|
||||
if (MemoryTypeInformationModified || !MemoryTypeInformationVariableExists) {
|
||||
Status = gRT->SetVariable (
|
||||
EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,
|
||||
&gEfiMemoryTypeInformationGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableSize,
|
||||
PreviousMemoryTypeInformation
|
||||
);
|
||||
Status = SetVariableAndReportStatusCodeOnError (
|
||||
EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,
|
||||
&gEfiMemoryTypeInformationGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableSize,
|
||||
PreviousMemoryTypeInformation
|
||||
);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
|
@ -1486,3 +1486,87 @@ BdsLibUserIdentify (
|
|||
return Manager->Identify (Manager, User);
|
||||
}
|
||||
|
||||
/**
|
||||
Set the variable and report the error through status code upon failure.
|
||||
|
||||
@param VariableName A Null-terminated string that is the name of the vendor's variable.
|
||||
Each VariableName is unique for each VendorGuid. VariableName must
|
||||
contain 1 or more characters. If VariableName is an empty string,
|
||||
then EFI_INVALID_PARAMETER is returned.
|
||||
@param VendorGuid A unique identifier for the vendor.
|
||||
@param Attributes Attributes bitmask to set for the variable.
|
||||
@param DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,
|
||||
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
|
||||
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
|
||||
causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
|
||||
set, then a SetVariable() call with a DataSize of zero will not cause any change to
|
||||
the variable value (the timestamp associated with the variable may be updated however
|
||||
even if no new data value is provided,see the description of the
|
||||
EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
|
||||
be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
|
||||
@param Data The contents for the variable.
|
||||
|
||||
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
|
||||
defined by the Attributes.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
|
||||
DataSize exceeds the maximum allowed.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is an empty string.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
||||
@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
|
||||
@retval EFI_WRITE_PROTECTED The variable in question is read-only.
|
||||
@retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
|
||||
@retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
|
||||
or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
|
||||
does NOT pass the validation check carried out by the firmware.
|
||||
|
||||
@retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetVariableAndReportStatusCodeOnError (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EDKII_SET_VARIABLE_STATUS *SetVariableStatus;
|
||||
UINTN NameSize;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
Attributes,
|
||||
DataSize,
|
||||
Data
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
NameSize = StrSize (VariableName);
|
||||
SetVariableStatus = AllocatePool (sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize);
|
||||
if (SetVariableStatus != NULL) {
|
||||
CopyGuid (&SetVariableStatus->Guid, VendorGuid);
|
||||
SetVariableStatus->NameSize = NameSize;
|
||||
SetVariableStatus->DataSize = DataSize;
|
||||
SetVariableStatus->SetStatus = Status;
|
||||
SetVariableStatus->Attributes = Attributes;
|
||||
CopyMem (SetVariableStatus + 1, VariableName, NameSize);
|
||||
CopyMem (((UINT8 *) (SetVariableStatus + 1)) + NameSize, Data, DataSize);
|
||||
|
||||
REPORT_STATUS_CODE_EX (
|
||||
EFI_ERROR_CODE,
|
||||
PcdGet32 (PcdErrorCodeSetVariable),
|
||||
0,
|
||||
NULL,
|
||||
&gEdkiiStatusCodeDataTypeVariableGuid,
|
||||
SetVariableStatus,
|
||||
sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize
|
||||
);
|
||||
|
||||
FreePool (SetVariableStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# 2) BDS boot device connect interface;
|
||||
# 3) BDS Misc interfaces for mainting boot variable, ouput string, etc.
|
||||
#
|
||||
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
|
@ -79,6 +79,7 @@
|
|||
gHdBootDevicePathVariablGuid ## SOMETIMES_PRODUCES ## Variable:L"HDDP" (The device path of Boot file on Hard device.)
|
||||
gBdsLibStringPackageGuid ## PRODUCES ## GUID (HII String PackageList Guid)
|
||||
gEfiLegacyDevOrderVariableGuid ## CONSUMES ## GUID
|
||||
gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES
|
||||
|
||||
[Protocols]
|
||||
gEfiSimpleFileSystemProtocolGuid # PROTOCOL CONSUMES
|
||||
|
@ -111,4 +112,5 @@
|
|||
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
BDS library definition, include the file and data structure
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -51,6 +51,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Guid/HdBootVariable.h>
|
||||
#include <Guid/LastEnumLang.h>
|
||||
#include <Guid/LegacyDevOrder.h>
|
||||
#include <Guid/StatusCodeDataTypeVariable.h>
|
||||
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
|
@ -147,4 +148,48 @@ ValidateOption (
|
|||
UINTN VariableSize
|
||||
);
|
||||
|
||||
/**
|
||||
Set the variable and report the error through status code upon failure.
|
||||
|
||||
@param VariableName A Null-terminated string that is the name of the vendor's variable.
|
||||
Each VariableName is unique for each VendorGuid. VariableName must
|
||||
contain 1 or more characters. If VariableName is an empty string,
|
||||
then EFI_INVALID_PARAMETER is returned.
|
||||
@param VendorGuid A unique identifier for the vendor.
|
||||
@param Attributes Attributes bitmask to set for the variable.
|
||||
@param DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,
|
||||
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
|
||||
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
|
||||
causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
|
||||
set, then a SetVariable() call with a DataSize of zero will not cause any change to
|
||||
the variable value (the timestamp associated with the variable may be updated however
|
||||
even if no new data value is provided,see the description of the
|
||||
EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
|
||||
be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
|
||||
@param Data The contents for the variable.
|
||||
|
||||
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
|
||||
defined by the Attributes.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
|
||||
DataSize exceeds the maximum allowed.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is an empty string.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
||||
@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
|
||||
@retval EFI_WRITE_PROTECTED The variable in question is read-only.
|
||||
@retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
|
||||
@retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
|
||||
or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
|
||||
does NOT pass the validation check carried out by the firmware.
|
||||
|
||||
@retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetVariableAndReportStatusCodeOnError (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *Data
|
||||
);
|
||||
|
||||
#endif // _BDS_LIB_H_
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Head file for BDS Architectural Protocol implementation
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Guid/MdeModuleHii.h>
|
||||
#include <Guid/FileSystemVolumeLabelInfo.h>
|
||||
#include <Guid/HiiPlatformSetupFormset.h>
|
||||
#include <Guid/StatusCodeDataTypeVariable.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <IndustryStandard/SmBios.h>
|
||||
#include <Protocol/LoadFile.h>
|
||||
|
@ -189,4 +190,48 @@ BdsProcessCapsules (
|
|||
EFI_BOOT_MODE BootMode
|
||||
);
|
||||
|
||||
/**
|
||||
Set the variable and report the error through status code upon failure.
|
||||
|
||||
@param VariableName A Null-terminated string that is the name of the vendor's variable.
|
||||
Each VariableName is unique for each VendorGuid. VariableName must
|
||||
contain 1 or more characters. If VariableName is an empty string,
|
||||
then EFI_INVALID_PARAMETER is returned.
|
||||
@param VendorGuid A unique identifier for the vendor.
|
||||
@param Attributes Attributes bitmask to set for the variable.
|
||||
@param DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,
|
||||
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
|
||||
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
|
||||
causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
|
||||
set, then a SetVariable() call with a DataSize of zero will not cause any change to
|
||||
the variable value (the timestamp associated with the variable may be updated however
|
||||
even if no new data value is provided,see the description of the
|
||||
EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
|
||||
be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
|
||||
@param Data The contents for the variable.
|
||||
|
||||
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
|
||||
defined by the Attributes.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
|
||||
DataSize exceeds the maximum allowed.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is an empty string.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
||||
@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
|
||||
@retval EFI_WRITE_PROTECTED The variable in question is read-only.
|
||||
@retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
|
||||
@retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
|
||||
or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
|
||||
does NOT pass the validation check carried out by the firmware.
|
||||
|
||||
@retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsDxeSetVariableAndReportStatusCodeOnError (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *Data
|
||||
);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# BDSDxe also maintain the UI for "Boot Manager, Boot Maintaince Manager, Device Manager" which
|
||||
# is used for user to configure boot option or maintain hardware device.
|
||||
#
|
||||
# Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
|
@ -142,6 +142,7 @@
|
|||
gDriverHealthFormSetGuid ## SOMETIMES_PRODUCES ## DriverHealth HII Package
|
||||
gConnectConInEventGuid ## CONSUMES ## GUID (Connect ConIn Event)
|
||||
gEfiFmpCapsuleGuid ## CONSUMES ## GUID (FMP Capsule)
|
||||
gEdkiiStatusCodeDataTypeVariableGuid ## SOMETIMES_CONSUMES
|
||||
|
||||
[Protocols]
|
||||
gEfiSimpleFileSystemProtocolGuid ## PROTOCOL CONSUMES
|
||||
|
@ -188,6 +189,7 @@
|
|||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be invoked
|
||||
to enter BDS phase.
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -164,13 +164,17 @@ BdsBootDeviceSelect (
|
|||
//
|
||||
// Clear the this variable so it's only exist in this time boot
|
||||
//
|
||||
gRT->SetVariable (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
0,
|
||||
mBootNext
|
||||
);
|
||||
Status = gRT->SetVariable (
|
||||
L"BootNext",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
//
|
||||
// Deleting variable with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Add the boot next boot option
|
||||
|
@ -368,6 +372,9 @@ BdsFormalizeConsoleVariable (
|
|||
0,
|
||||
NULL
|
||||
);
|
||||
//
|
||||
// Deleting variable with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
}
|
||||
|
@ -406,14 +413,13 @@ BdsFormalizeEfiGlobalVariable (
|
|||
OsIndicationSupport = EFI_OS_INDICATIONS_BOOT_TO_FW_UI \
|
||||
| EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
L"OsIndicationsSupported",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof(UINT64),
|
||||
&OsIndicationSupport
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
BdsDxeSetVariableAndReportStatusCodeOnError (
|
||||
L"OsIndicationsSupported",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof(UINT64),
|
||||
&OsIndicationSupport
|
||||
);
|
||||
|
||||
//
|
||||
// If OsIndications is invalid, remove it.
|
||||
|
@ -442,10 +448,13 @@ BdsFormalizeEfiGlobalVariable (
|
|||
Status = gRT->SetVariable (
|
||||
L"OsIndications",
|
||||
&gEfiGlobalVariableGuid,
|
||||
Attributes,
|
||||
0,
|
||||
&OsIndication
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
//
|
||||
// Deleting variable with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
}
|
||||
|
@ -481,16 +490,19 @@ BdsAllocateMemoryForPerformanceData (
|
|||
//
|
||||
// Save the pointer to variable for use in S3 resume.
|
||||
//
|
||||
Status = gRT->SetVariable (
|
||||
L"PerfDataMemAddr",
|
||||
&gPerformanceProtocolGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof (EFI_PHYSICAL_ADDRESS),
|
||||
&AcpiLowMemoryBase
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
BdsDxeSetVariableAndReportStatusCodeOnError (
|
||||
L"PerfDataMemAddr",
|
||||
&gPerformanceProtocolGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof (EFI_PHYSICAL_ADDRESS),
|
||||
&AcpiLowMemoryBase
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "[Bds] PerfDataMemAddr (%08x) cannot be saved to NV storage.\n", AcpiLowMemoryBase));
|
||||
}
|
||||
//
|
||||
// Mark L"PerfDataMemAddr" variable to read-only if the Variable Lock protocol exists
|
||||
// Still lock it even the variable cannot be saved to prevent it's set by 3rd party code.
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
@ -594,14 +606,13 @@ BdsEntry (
|
|||
// If time out value equal 0xFFFF, no need set to 0xFFFF to variable area because UEFI specification
|
||||
// define same behavior between no value or 0xFFFF value for L"Timeout".
|
||||
//
|
||||
Status = gRT->SetVariable (
|
||||
BdsDxeSetVariableAndReportStatusCodeOnError (
|
||||
L"Timeout",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof (UINT16),
|
||||
&BootTimeOut
|
||||
);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -655,3 +666,89 @@ BdsEntry (
|
|||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the variable and report the error through status code upon failure.
|
||||
|
||||
@param VariableName A Null-terminated string that is the name of the vendor's variable.
|
||||
Each VariableName is unique for each VendorGuid. VariableName must
|
||||
contain 1 or more characters. If VariableName is an empty string,
|
||||
then EFI_INVALID_PARAMETER is returned.
|
||||
@param VendorGuid A unique identifier for the vendor.
|
||||
@param Attributes Attributes bitmask to set for the variable.
|
||||
@param DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,
|
||||
EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
|
||||
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
|
||||
causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
|
||||
set, then a SetVariable() call with a DataSize of zero will not cause any change to
|
||||
the variable value (the timestamp associated with the variable may be updated however
|
||||
even if no new data value is provided,see the description of the
|
||||
EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
|
||||
be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
|
||||
@param Data The contents for the variable.
|
||||
|
||||
@retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
|
||||
defined by the Attributes.
|
||||
@retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
|
||||
DataSize exceeds the maximum allowed.
|
||||
@retval EFI_INVALID_PARAMETER VariableName is an empty string.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
|
||||
@retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
|
||||
@retval EFI_WRITE_PROTECTED The variable in question is read-only.
|
||||
@retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
|
||||
@retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
|
||||
or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
|
||||
does NOT pass the validation check carried out by the firmware.
|
||||
|
||||
@retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
BdsDxeSetVariableAndReportStatusCodeOnError (
|
||||
IN CHAR16 *VariableName,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
IN UINT32 Attributes,
|
||||
IN UINTN DataSize,
|
||||
IN VOID *Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EDKII_SET_VARIABLE_STATUS *SetVariableStatus;
|
||||
UINTN NameSize;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
VariableName,
|
||||
VendorGuid,
|
||||
Attributes,
|
||||
DataSize,
|
||||
Data
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
NameSize = StrSize (VariableName);
|
||||
SetVariableStatus = AllocatePool (sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize);
|
||||
if (SetVariableStatus != NULL) {
|
||||
CopyGuid (&SetVariableStatus->Guid, VendorGuid);
|
||||
SetVariableStatus->NameSize = NameSize;
|
||||
SetVariableStatus->DataSize = DataSize;
|
||||
SetVariableStatus->SetStatus = Status;
|
||||
SetVariableStatus->Attributes = Attributes;
|
||||
CopyMem (SetVariableStatus + 1, VariableName, NameSize);
|
||||
CopyMem (((UINT8 *) (SetVariableStatus + 1)) + NameSize, Data, DataSize);
|
||||
|
||||
REPORT_STATUS_CODE_EX (
|
||||
EFI_ERROR_CODE,
|
||||
PcdGet32 (PcdErrorCodeSetVariable),
|
||||
0,
|
||||
NULL,
|
||||
&gEdkiiStatusCodeDataTypeVariableGuid,
|
||||
SetVariableStatus,
|
||||
sizeof (EDKII_SET_VARIABLE_STATUS) + NameSize + DataSize
|
||||
);
|
||||
|
||||
FreePool (SetVariableStatus);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
and manage the legacy boot option, all legacy boot option is getting from
|
||||
the legacy BBS table.
|
||||
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -143,6 +143,9 @@ OrderLegacyBootOption4SameType (
|
|||
BootOrderSize,
|
||||
BootOrder
|
||||
);
|
||||
//
|
||||
// Changing content without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FreePool (NewBootOption);
|
||||
|
@ -171,6 +174,7 @@ GroupMultipleLegacyBootOption4SameType (
|
|||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Index;
|
||||
UINTN DeviceIndex;
|
||||
UINTN DeviceTypeIndex[7];
|
||||
|
@ -233,13 +237,17 @@ GroupMultipleLegacyBootOption4SameType (
|
|||
FreePool (BootOption);
|
||||
}
|
||||
|
||||
gRT->SetVariable (
|
||||
L"BootOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
BootOrderSize,
|
||||
BootOrder
|
||||
);
|
||||
Status = gRT->SetVariable (
|
||||
L"BootOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
BootOrderSize,
|
||||
BootOrder
|
||||
);
|
||||
//
|
||||
// Changing content without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
FreePool (BootOrder);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Utility routines used by boot maintenance modules.
|
||||
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -178,7 +178,10 @@ EfiLibDeleteVariable (
|
|||
0,
|
||||
NULL
|
||||
);
|
||||
ASSERT (!EFI_ERROR (Status));
|
||||
//
|
||||
// Deleting variable with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
FreePool (VarBuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The functions for Boot Maintainence Main menu.
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -672,14 +672,13 @@ ApplyChangeHandler (
|
|||
break;
|
||||
|
||||
case FORM_TIME_OUT_ID:
|
||||
Status = gRT->SetVariable (
|
||||
L"Timeout",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof (UINT16),
|
||||
&(CurrentFakeNVMap->BootTimeOut)
|
||||
);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
BdsDxeSetVariableAndReportStatusCodeOnError (
|
||||
L"Timeout",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
sizeof (UINT16),
|
||||
&(CurrentFakeNVMap->BootTimeOut)
|
||||
);
|
||||
|
||||
Private->BmmOldFakeNVData.BootTimeOut = CurrentFakeNVMap->BootTimeOut;
|
||||
break;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Variable operation that will be used by bootmaint
|
||||
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -165,9 +165,10 @@ Var_ChangeBootOrder (
|
|||
BootOrderListSize * sizeof (UINT16),
|
||||
BootOrderList
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Changing variable without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -303,9 +304,10 @@ Var_ChangeDriverOrder (
|
|||
DriverOrderListSize * sizeof (UINT16),
|
||||
DriverOrderList
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Changing variable without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -338,7 +340,10 @@ Var_UpdateAllConsoleOption (
|
|||
GetDevicePathSize (OutDevicePath),
|
||||
OutDevicePath
|
||||
);
|
||||
ASSERT (!EFI_ERROR (Status));
|
||||
//
|
||||
// Changing variable without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
if (InpDevicePath != NULL) {
|
||||
|
@ -350,7 +355,10 @@ Var_UpdateAllConsoleOption (
|
|||
GetDevicePathSize (InpDevicePath),
|
||||
InpDevicePath
|
||||
);
|
||||
ASSERT (!EFI_ERROR (Status));
|
||||
//
|
||||
// Changing variable without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
if (ErrDevicePath != NULL) {
|
||||
|
@ -362,7 +370,10 @@ Var_UpdateAllConsoleOption (
|
|||
GetDevicePathSize (ErrDevicePath),
|
||||
ErrDevicePath
|
||||
);
|
||||
ASSERT (!EFI_ERROR (Status));
|
||||
//
|
||||
// Changing variable without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -667,38 +678,40 @@ Var_UpdateDriverOption (
|
|||
BufferSize,
|
||||
Buffer
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
DriverOrderList = BdsLibGetVariableAndSize (
|
||||
L"DriverOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
&DriverOrderListSize
|
||||
);
|
||||
NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));
|
||||
ASSERT (NewDriverOrderList != NULL);
|
||||
if (DriverOrderList != NULL) {
|
||||
CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
|
||||
EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
|
||||
}
|
||||
NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
|
||||
if (!EFI_ERROR (Status)) {
|
||||
DriverOrderList = BdsLibGetVariableAndSize (
|
||||
L"DriverOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
&DriverOrderListSize
|
||||
);
|
||||
NewDriverOrderList = AllocateZeroPool (DriverOrderListSize + sizeof (UINT16));
|
||||
ASSERT (NewDriverOrderList != NULL);
|
||||
if (DriverOrderList != NULL) {
|
||||
CopyMem (NewDriverOrderList, DriverOrderList, DriverOrderListSize);
|
||||
EfiLibDeleteVariable (L"DriverOrder", &gEfiGlobalVariableGuid);
|
||||
}
|
||||
NewDriverOrderList[DriverOrderListSize / sizeof (UINT16)] = Index;
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
L"DriverOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
DriverOrderListSize + sizeof (UINT16),
|
||||
NewDriverOrderList
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (DriverOrderList != NULL) {
|
||||
FreePool (DriverOrderList);
|
||||
}
|
||||
DriverOrderList = NULL;
|
||||
FreePool (NewDriverOrderList);
|
||||
InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
|
||||
DriverOptionMenu.MenuNumber++;
|
||||
Status = gRT->SetVariable (
|
||||
L"DriverOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
DriverOrderListSize + sizeof (UINT16),
|
||||
NewDriverOrderList
|
||||
);
|
||||
if (DriverOrderList != NULL) {
|
||||
FreePool (DriverOrderList);
|
||||
}
|
||||
DriverOrderList = NULL;
|
||||
FreePool (NewDriverOrderList);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
InsertTailList (&DriverOptionMenu.Head, &NewMenuEntry->Link);
|
||||
DriverOptionMenu.MenuNumber++;
|
||||
|
||||
*DescriptionData = 0x0000;
|
||||
*OptionalData = 0x0000;
|
||||
*DescriptionData = 0x0000;
|
||||
*OptionalData = 0x0000;
|
||||
}
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -835,39 +848,41 @@ Var_UpdateBootOption (
|
|||
BufferSize,
|
||||
Buffer
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
||||
BootOrderList = BdsLibGetVariableAndSize (
|
||||
BootOrderList = BdsLibGetVariableAndSize (
|
||||
L"BootOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
&BootOrderListSize
|
||||
);
|
||||
ASSERT (BootOrderList != NULL);
|
||||
NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));
|
||||
ASSERT (NewBootOrderList != NULL);
|
||||
CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
|
||||
NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;
|
||||
|
||||
if (BootOrderList != NULL) {
|
||||
FreePool (BootOrderList);
|
||||
}
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
L"BootOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
&BootOrderListSize
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
BootOrderListSize + sizeof (UINT16),
|
||||
NewBootOrderList
|
||||
);
|
||||
ASSERT (BootOrderList != NULL);
|
||||
NewBootOrderList = AllocateZeroPool (BootOrderListSize + sizeof (UINT16));
|
||||
ASSERT (NewBootOrderList != NULL);
|
||||
CopyMem (NewBootOrderList, BootOrderList, BootOrderListSize);
|
||||
NewBootOrderList[BootOrderListSize / sizeof (UINT16)] = Index;
|
||||
if (!EFI_ERROR (Status)) {
|
||||
|
||||
if (BootOrderList != NULL) {
|
||||
FreePool (BootOrderList);
|
||||
FreePool (NewBootOrderList);
|
||||
NewBootOrderList = NULL;
|
||||
InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
|
||||
BootOptionMenu.MenuNumber++;
|
||||
|
||||
NvRamMap->DescriptionData[0] = 0x0000;
|
||||
NvRamMap->OptionalData[0] = 0x0000;
|
||||
}
|
||||
}
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
L"BootOrder",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||
BootOrderListSize + sizeof (UINT16),
|
||||
NewBootOrderList
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FreePool (NewBootOrderList);
|
||||
NewBootOrderList = NULL;
|
||||
InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
|
||||
BootOptionMenu.MenuNumber++;
|
||||
|
||||
NvRamMap->DescriptionData[0] = 0x0000;
|
||||
NvRamMap->OptionalData[0] = 0x0000;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -987,6 +1002,10 @@ Var_UpdateBootOrder (
|
|||
BootOrderListSize,
|
||||
BootOrderList
|
||||
);
|
||||
//
|
||||
// Changing the content without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
FreePool (BootOrderList);
|
||||
|
||||
GroupMultipleLegacyBootOption4SameType ();
|
||||
|
@ -1058,10 +1077,11 @@ Var_UpdateDriverOrder (
|
|||
DriverOrderListSize,
|
||||
NewDriverOrderList
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Changing the content without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
BOpt_FreeMenu (&DriverOptionMenu);
|
||||
BOpt_GetDriverOptions (CallbackData);
|
||||
return EFI_SUCCESS;
|
||||
|
@ -1258,6 +1278,10 @@ Var_UpdateBBSOption (
|
|||
OptionSize,
|
||||
BootOptionVar
|
||||
);
|
||||
//
|
||||
// Changing the content without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FreePool (BootOptionVar);
|
||||
}
|
||||
|
@ -1281,6 +1305,10 @@ Var_UpdateBBSOption (
|
|||
OptionSize,
|
||||
BootOptionVar
|
||||
);
|
||||
//
|
||||
// Changing the content without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FreePool (BootOptionVar);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
FrontPage routines to handle the callbacks and browser calls
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -182,7 +182,6 @@ FrontPageCallback (
|
|||
CHAR8 *LangCode;
|
||||
CHAR8 *Lang;
|
||||
UINTN Index;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
|
||||
//
|
||||
|
@ -226,14 +225,13 @@ FrontPageCallback (
|
|||
}
|
||||
|
||||
if (Index == Value->u8) {
|
||||
Status = gRT->SetVariable (
|
||||
BdsDxeSetVariableAndReportStatusCodeOnError (
|
||||
L"PlatformLang",
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
AsciiStrSize (Lang),
|
||||
Lang
|
||||
);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
} else {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
@ -1095,6 +1093,9 @@ PlatformBdsEnterFrontPage (
|
|||
sizeof(UINT64),
|
||||
&OsIndication
|
||||
);
|
||||
//
|
||||
// Changing the content without increasing its size with current variable implementation shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Provides a way for 3rd party applications to register themselves for launch by the
|
||||
Boot Manager based on hot key
|
||||
|
||||
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -550,6 +550,9 @@ InitializeHotkeyService (
|
|||
sizeof (UINT32),
|
||||
&BootOptionSupport
|
||||
);
|
||||
//
|
||||
// Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
KeyOptionNumbers = HotkeyGetOptionNumbers (&KeyOptionCount);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Language settings
|
||||
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
|
@ -425,7 +425,7 @@ InitializeLangVariable (
|
|||
// The default language code should be one of the supported language codes.
|
||||
//
|
||||
ASSERT (IsLangInSupportedLangCodes (SupportedLang, DefaultLang, Iso639Language));
|
||||
Status = gRT->SetVariable (
|
||||
BdsDxeSetVariableAndReportStatusCodeOnError (
|
||||
LangName,
|
||||
&gEfiGlobalVariableGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
|
@ -471,6 +471,10 @@ InitializeLanguage (
|
|||
AsciiStrSize (LangCodes),
|
||||
LangCodes
|
||||
);
|
||||
//
|
||||
// Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
Status = gRT->SetVariable (
|
||||
|
@ -480,6 +484,10 @@ InitializeLanguage (
|
|||
AsciiStrSize (PlatformLangCodes),
|
||||
PlatformLangCodes
|
||||
);
|
||||
//
|
||||
// Platform needs to make sure setting volatile variable before calling 3rd party code shouldn't fail.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
if (!FeaturePcdGet (PcdUefiVariableDefaultLangDeprecate)) {
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/** @file
|
||||
This file defines the GUID and data structure used to pass variable setting
|
||||
failure information to the Status Code Protocol.
|
||||
|
||||
Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _STATUS_CODE_DATA_TYPE_VARIABLE_H_
|
||||
#define _STATUS_CODE_DATA_TYPE_VARIABLE_H_
|
||||
|
||||
///
|
||||
/// The Global ID used to identify a structure of type EDKII_SET_VARIABLE_STATUS.
|
||||
/// The status code value is PcdGet32 (PcdErrorCodeSetVariable).
|
||||
///
|
||||
#define EDKII_STATUS_CODE_DATA_TYPE_VARIABLE_GUID \
|
||||
{ \
|
||||
0xf6ee6dbb, 0xd67f, 0x4ea0, { 0x8b, 0x96, 0x6a, 0x71, 0xb1, 0x9d, 0x84, 0xad } \
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID Guid;
|
||||
UINTN NameSize;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS SetStatus;
|
||||
UINT32 Attributes;
|
||||
// CHAR16 Name[];
|
||||
// UINT8 Data[];
|
||||
} EDKII_SET_VARIABLE_STATUS;
|
||||
|
||||
extern EFI_GUID gEdkiiStatusCodeDataTypeVariableGuid;
|
||||
|
||||
#endif // _STATUS_CODE_DATA_TYPE_VARIABLE_H_
|
|
@ -270,6 +270,9 @@
|
|||
## Include/Guid/ConnectConInEvent.h
|
||||
gConnectConInEventGuid = { 0xdb4e8151, 0x57ed, 0x4bed, { 0x88, 0x33, 0x67, 0x51, 0xb5, 0xd1, 0xa8, 0xd7 }}
|
||||
|
||||
## Include/Guid/StatusCodeDataTypeVariable.h
|
||||
gEdkiiStatusCodeDataTypeVariableGuid = { 0xf6ee6dbb, 0xd67f, 0x4ea0, { 0x8b, 0x96, 0x6a, 0x71, 0xb1, 0x9d, 0x84, 0xad }}
|
||||
|
||||
[Ppis]
|
||||
## Include/Ppi/AtaController.h
|
||||
gPeiAtaControllerPpiGuid = { 0xa45e60d1, 0xc719, 0x44aa, { 0xb0, 0x7a, 0xaa, 0x77, 0x7f, 0x85, 0x90, 0x6d }}
|
||||
|
@ -603,6 +606,10 @@
|
|||
# PROGRESS_CODE_S3_SUSPEND_END = (EFI_SOFTWARE_SMM_DRIVER | (EFI_OEM_SPECIFIC | 0x00000001)) = 0x03078001
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeS3SuspendEnd|0x03078001|UINT32|0x30001033
|
||||
|
||||
## Error Code for SetVariable failure.
|
||||
# EDKII_ERROR_CODE_SET_VARIABLE = (EFI_SOFTWARE_DXE_BS_DRIVER | (EFI_OEM_SPECIFIC | 0x00000002)) = 0x03058002
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable|0x03058002|UINT32|0x30001040
|
||||
|
||||
[PcdsFixedAtBuild,PcdsPatchableInModule]
|
||||
## VPD type PCD allow developer point an absoluted physical address PcdVpdBaseAddress
|
||||
# to store PCD value.
|
||||
|
|
Loading…
Reference in New Issue