Align the overrider with UDK2014.SP1 core.
The override fixed Showing IPv4 and IPv6 string format as "EFI Network <MAC Address><IP version>" in Boot Manager Group under BIOS setup. This override will be removed after core fixing. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Shifei Lu <shifeix.a.lu@intel.com> Reviewed-by: Tim He <tim.he@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16675 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Misc BDS library function
|
||||
|
||||
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
|
||||
@@ -168,6 +168,7 @@ BdsLibGetFreeOptionNumber (
|
||||
if (OptionBuffer == NULL) {
|
||||
break;
|
||||
}
|
||||
FreePool(OptionBuffer);
|
||||
Index++;
|
||||
} while (TRUE);
|
||||
|
||||
@@ -217,6 +218,9 @@ BdsLibRegisterNewOption (
|
||||
UINT16 BootOrderEntry;
|
||||
UINTN OrderItemNum;
|
||||
|
||||
if (DevicePath == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
OptionPtr = NULL;
|
||||
OptionSize = 0;
|
||||
@@ -262,6 +266,7 @@ BdsLibRegisterNewOption (
|
||||
// Validate the variable.
|
||||
//
|
||||
if (!ValidateOption(OptionPtr, OptionSize)) {
|
||||
FreePool(OptionPtr);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -623,6 +628,7 @@ BdsLibVariableToOption (
|
||||
// Validate Boot#### variable data.
|
||||
//
|
||||
if (!ValidateOption(Variable, VariableSize)) {
|
||||
FreePool (Variable);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -671,6 +677,7 @@ BdsLibVariableToOption (
|
||||
//
|
||||
Option = AllocateZeroPool (sizeof (BDS_COMMON_OPTION));
|
||||
if (Option == NULL) {
|
||||
FreePool (Variable);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1419,22 +1426,26 @@ 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 | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
VariableSize,
|
||||
PreviousMemoryTypeInformation
|
||||
);
|
||||
Status = SetVariableAndReportStatusCodeOnError (
|
||||
EFI_MEMORY_TYPE_INFORMATION_VARIABLE_NAME,
|
||||
&gEfiMemoryTypeInformationGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
||||
VariableSize,
|
||||
PreviousMemoryTypeInformation
|
||||
);
|
||||
|
||||
//
|
||||
// If the Memory Type Information settings have been modified, then reset the platform
|
||||
// so the new Memory Type Information setting will be used to guarantee that an S4
|
||||
// entry/resume cycle will not fail.
|
||||
//
|
||||
if (MemoryTypeInformationModified && PcdGetBool (PcdResetOnMemoryTypeInformationChange)) {
|
||||
DEBUG ((EFI_D_INFO, "Memory Type Information settings change. Warm Reset!!!\n"));
|
||||
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// If the Memory Type Information settings have been modified, then reset the platform
|
||||
// so the new Memory Type Information setting will be used to guarantee that an S4
|
||||
// entry/resume cycle will not fail.
|
||||
//
|
||||
if (MemoryTypeInformationModified && PcdGetBool (PcdResetOnMemoryTypeInformationChange)) {
|
||||
DEBUG ((EFI_D_INFO, "Memory Type Information settings change. Warm Reset!!!\n"));
|
||||
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
|
||||
}
|
||||
} else {
|
||||
DEBUG ((EFI_D_ERROR, "Memory Type Information settings cannot be saved. OS S4 may fail!\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1482,3 +1493,89 @@ 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);
|
||||
if ((Data != NULL) && (DataSize != 0)) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user