MdeModulePkg HiiDataBase: Enable Firmware to retrieve the default setting

https://bugzilla.tianocore.org/show_bug.cgi?id=611
Update HiiDataBase to retrieve the default setting and patch IFR data

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Liming Gao 2017-12-22 11:51:45 +08:00
parent fef4cfa7ca
commit 8ddbd22716
3 changed files with 523 additions and 2 deletions

View File

@ -1,7 +1,7 @@
/** @file
Implementation for EFI_HII_DATABASE_PROTOCOL.
Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2007 - 2017, 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
@ -15,11 +15,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "HiiDatabase.h"
#define BASE_NUMBER 10
EFI_HII_PACKAGE_LIST_HEADER *gRTDatabaseInfoBuffer = NULL;
EFI_STRING gRTConfigRespBuffer = NULL;
UINTN gDatabaseInfoSize = 0;
UINTN gConfigRespSize = 0;
BOOLEAN gExportConfigResp = TRUE;
UINTN gNvDefaultStoreSize = 0;
SKU_ID gSkuId = 0xFFFFFFFFFFFFFFFF;
LIST_ENTRY gVarStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gVarStorageList);
/**
This function generates a HII_DATABASE_RECORD node and adds into hii database.
@ -531,6 +536,509 @@ RemoveGuidPackages (
return EFI_SUCCESS;
}
/**
Check the input question related to EFI variable
@param IfrQuestionHdr Point to Question header
@param EfiVarStoreList Point to EFI VarStore List
@param EfiVarStoreNumber The number of EFI VarStore
@retval Index The index of the found EFI varstore in EFI varstore list
EfiVarStoreNumber will return if no EFI varstore is found.
**/
UINTN
IsEfiVarStoreQuestion (
EFI_IFR_QUESTION_HEADER *IfrQuestionHdr,
EFI_IFR_VARSTORE_EFI **EfiVarStoreList,
UINTN EfiVarStoreNumber
)
{
UINTN Index;
for (Index = 0; Index < EfiVarStoreNumber; Index ++) {
if (IfrQuestionHdr->VarStoreId == EfiVarStoreList[Index]->VarStoreId) {
return Index;
}
}
return EfiVarStoreNumber;
}
/**
Find the matched variable from the input variable storage.
@param[in] VariableStorage Point to the variable storage header.
@param[in] VarGuid A unique identifier for the variable.
@param[in] VarAttribute The attributes bitmask for the variable.
@param[in] VarName A Null-terminated ascii string that is the name of the variable.
@return Pointer to the matched variable header or NULL if not found.
**/
VARIABLE_HEADER *
FindVariableData (
IN VARIABLE_STORE_HEADER *VariableStorage,
IN EFI_GUID *VarGuid,
IN UINT32 VarAttribute,
IN CHAR16 *VarName
)
{
VARIABLE_HEADER *VariableHeader;
VARIABLE_HEADER *VariableEnd;
VariableEnd = (VARIABLE_HEADER *) ((UINT8 *) VariableStorage + VariableStorage->Size);
VariableHeader = (VARIABLE_HEADER *) (VariableStorage + 1);
VariableHeader = (VARIABLE_HEADER *) HEADER_ALIGN (VariableHeader);
while (VariableHeader < VariableEnd) {
if (CompareGuid (&VariableHeader->VendorGuid, VarGuid) &&
VariableHeader->Attributes == VarAttribute &&
StrCmp (VarName, (CHAR16 *) (VariableHeader + 1)) == 0) {
return VariableHeader;
}
VariableHeader = (VARIABLE_HEADER *) ((UINT8 *) VariableHeader + sizeof (VARIABLE_HEADER) + VariableHeader->NameSize + VariableHeader->DataSize);
VariableHeader = (VARIABLE_HEADER *) HEADER_ALIGN (VariableHeader);
}
return NULL;
}
/**
Find question default value from PcdNvStoreDefaultValueBuffer
@param DefaultId Default store ID
@param EfiVarStore Point to EFI VarStore header
@param IfrQuestionHdr Point to Question header
@param ValueBuffer Point to Buffer includes the found default setting
@param Width Width of the default value
@param BitFieldQuestion Whether the Question is stored in Bit field.
@retval EFI_SUCCESS Question default value is found.
@retval EFI_NOT_FOUND Question default value is not found.
**/
EFI_STATUS
FindQuestionDefaultSetting (
IN UINT16 DefaultId,
IN EFI_IFR_VARSTORE_EFI *EfiVarStore,
IN EFI_IFR_QUESTION_HEADER *IfrQuestionHdr,
OUT VOID *ValueBuffer,
IN UINTN Width,
IN BOOLEAN BitFieldQuestion
)
{
VARIABLE_HEADER *VariableHeader;
VARIABLE_STORE_HEADER *VariableStorage;
LIST_ENTRY *Link;
VARSTORAGE_DEFAULT_DATA *Entry;
VARIABLE_STORE_HEADER *NvStoreBuffer;
UINT8 *DataBuffer;
UINT8 *BufferEnd;
BOOLEAN IsFound;
UINTN Index;
UINT32 BufferValue;
UINT32 BitFieldVal;
UINTN BitOffset;
UINTN ByteOffset;
UINTN BitWidth;
UINTN StartBit;
UINTN EndBit;
PCD_DEFAULT_DATA *DataHeader;
PCD_DEFAULT_INFO *DefaultInfo;
PCD_DATA_DELTA *DeltaData;
if (gSkuId == 0xFFFFFFFFFFFFFFFF) {
gSkuId = LibPcdGetSku ();
}
//
// Find the DefaultId setting from the full DefaultSetting
//
VariableStorage = NULL;
Link = gVarStorageList.ForwardLink;
while (Link != &gVarStorageList) {
Entry = BASE_CR (Link, VARSTORAGE_DEFAULT_DATA, Entry);
if (Entry->DefaultId == DefaultId) {
VariableStorage = Entry->VariableStorage;
break;
}
Link = Link->ForwardLink;
}
if (Link == &gVarStorageList) {
DataBuffer = (UINT8 *) PcdGetPtr (PcdNvStoreDefaultValueBuffer);
gNvDefaultStoreSize = ((PCD_NV_STORE_DEFAULT_BUFFER_HEADER *)DataBuffer)->Length;
//
// The first section data includes NV storage default setting.
//
DataHeader = (PCD_DEFAULT_DATA *) (DataBuffer + sizeof (PCD_NV_STORE_DEFAULT_BUFFER_HEADER));
NvStoreBuffer = (VARIABLE_STORE_HEADER *) ((UINT8 *) DataHeader + sizeof (DataHeader->DataSize) + DataHeader->HeaderSize);
VariableStorage = AllocatePool (NvStoreBuffer->Size);
ASSERT (VariableStorage != NULL);
CopyMem (VariableStorage, NvStoreBuffer, NvStoreBuffer->Size);
//
// Find the matched SkuId and DefaultId in the first section
//
IsFound = FALSE;
DefaultInfo = &(DataHeader->DefaultInfo[0]);
BufferEnd = (UINT8 *) DataHeader + sizeof (DataHeader->DataSize) + DataHeader->HeaderSize;
while ((UINT8 *) DefaultInfo < BufferEnd) {
if (DefaultInfo->DefaultId == DefaultId && DefaultInfo->SkuId == gSkuId) {
IsFound = TRUE;
break;
}
DefaultInfo ++;
}
//
// Find the matched SkuId and DefaultId in the remaining section
//
Index = sizeof (PCD_NV_STORE_DEFAULT_BUFFER_HEADER) + ((DataHeader->DataSize + 7) & (~7));
DataHeader = (PCD_DEFAULT_DATA *) (DataBuffer + Index);
while (!IsFound && Index < gNvDefaultStoreSize && DataHeader->DataSize != 0xFFFF) {
DefaultInfo = &(DataHeader->DefaultInfo[0]);
BufferEnd = (UINT8 *) DataHeader + sizeof (DataHeader->DataSize) + DataHeader->HeaderSize;
while ((UINT8 *) DefaultInfo < BufferEnd) {
if (DefaultInfo->DefaultId == DefaultId && DefaultInfo->SkuId == gSkuId) {
IsFound = TRUE;
break;
}
DefaultInfo ++;
}
if (IsFound) {
DeltaData = (PCD_DATA_DELTA *) BufferEnd;
BufferEnd = (UINT8 *) DataHeader + DataHeader->DataSize;
while ((UINT8 *) DeltaData < BufferEnd) {
*((UINT8 *) VariableStorage + DeltaData->Offset) = (UINT8) DeltaData->Value;
DeltaData ++;
}
break;
}
Index = (Index + DataHeader->DataSize + 7) & (~7);
DataHeader = (PCD_DEFAULT_DATA *) (DataBuffer + Index);
}
//
// Cache the found result in VarStorageList
//
if (!IsFound) {
FreePool (VariableStorage);
VariableStorage = NULL;
}
Entry = AllocatePool (sizeof (VARSTORAGE_DEFAULT_DATA));
Entry->DefaultId = DefaultId;
Entry->VariableStorage = VariableStorage;
InsertTailList (&gVarStorageList, &Entry->Entry);
}
//
// The matched variable storage is not found.
//
if (VariableStorage == NULL) {
return EFI_NOT_FOUND;
}
//
// Find the question default value from the variable storage
//
VariableHeader = FindVariableData (VariableStorage, &EfiVarStore->Guid, EfiVarStore->Attributes, (CHAR16 *) EfiVarStore->Name);
if (VariableHeader == NULL) {
return EFI_NOT_FOUND;
}
ByteOffset = IfrQuestionHdr->VarStoreInfo.VarOffset;
if (BitFieldQuestion) {
BitOffset = IfrQuestionHdr->VarStoreInfo.VarOffset;
ByteOffset = BitOffset / 8;
BitWidth = Width;
StartBit = BitOffset % 8;
EndBit = StartBit + BitWidth - 1;
Width = EndBit / 8 + 1;
}
if (VariableHeader->DataSize < ByteOffset + Width) {
return EFI_INVALID_PARAMETER;
}
//
// Copy the question value
//
if (ValueBuffer != NULL) {
if (BitFieldQuestion) {
CopyMem (&BufferValue, (UINT8 *) VariableHeader + sizeof (VARIABLE_HEADER) + VariableHeader->NameSize + ByteOffset, Width);
BitFieldVal = BitFieldRead32 (BufferValue, StartBit, EndBit);
CopyMem (ValueBuffer, &BitFieldVal, Width);
} else {
CopyMem (ValueBuffer, (UINT8 *) VariableHeader + sizeof (VARIABLE_HEADER) + VariableHeader->NameSize + IfrQuestionHdr->VarStoreInfo.VarOffset, Width);
}
}
return EFI_SUCCESS;
}
/**
Update IFR default setting in Form Package.
@param FormPackage Form Package to be updated
**/
VOID
UpdateDefaultSettingInFormPackage (
HII_IFR_PACKAGE_INSTANCE *FormPackage
)
{
UINTN IfrOffset;
UINTN PackageLength;
EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
EFI_IFR_OP_HEADER *IfrOpHdr;
EFI_IFR_ONE_OF_OPTION *IfrOneOfOption;
UINT8 IfrQuestionType;
UINT8 IfrScope;
EFI_IFR_QUESTION_HEADER *IfrQuestionHdr;
EFI_IFR_VARSTORE_EFI **EfiVarStoreList;
UINTN EfiVarStoreMaxNum;
UINTN EfiVarStoreNumber;
UINT16 *DefaultIdList;
UINTN DefaultIdNumber;
UINTN DefaultIdMaxNum;
UINTN Index;
UINTN EfiVarStoreIndex;
EFI_IFR_TYPE_VALUE IfrValue;
EFI_IFR_TYPE_VALUE IfrManufactValue;
BOOLEAN StandardDefaultIsSet;
BOOLEAN ManufactDefaultIsSet;
EFI_IFR_CHECKBOX *IfrCheckBox;
EFI_STATUS Status;
EFI_IFR_DEFAULT *IfrDefault;
UINTN Width;
EFI_IFR_QUESTION_HEADER VarStoreQuestionHeader;
BOOLEAN QuestionReferBitField;
//
// If no default setting, do nothing
//
if (gNvDefaultStoreSize == 0) {
gNvDefaultStoreSize = PcdGetSize (PcdNvStoreDefaultValueBuffer);
}
if (gNvDefaultStoreSize < sizeof (PCD_NV_STORE_DEFAULT_BUFFER_HEADER)) {
return;
}
ZeroMem (&VarStoreQuestionHeader, sizeof (VarStoreQuestionHeader));
PackageLength = FormPackage->FormPkgHdr.Length - sizeof (EFI_HII_PACKAGE_HEADER);
IfrOffset = 0;
IfrScope = 0;
IfrOpHdr = (EFI_IFR_OP_HEADER *) FormPackage->IfrData;
IfrQuestionHdr = NULL;
IfrQuestionType = 0;
EfiVarStoreMaxNum = 0;
EfiVarStoreNumber = 0;
DefaultIdMaxNum = 0;
DefaultIdNumber = 0;
EfiVarStoreList = NULL;
DefaultIdList = NULL;
StandardDefaultIsSet = FALSE;
ManufactDefaultIsSet = FALSE;
QuestionReferBitField = FALSE;
while (IfrOffset < PackageLength) {
switch (IfrOpHdr->OpCode) {
case EFI_IFR_VARSTORE_EFI_OP:
if (EfiVarStoreNumber >= EfiVarStoreMaxNum) {
//
// Reallocate EFI VarStore Buffer
//
EfiVarStoreList = ReallocatePool (EfiVarStoreMaxNum * sizeof (UINTN), (EfiVarStoreMaxNum + BASE_NUMBER) * sizeof (UINTN), EfiVarStoreList);
EfiVarStoreMaxNum = EfiVarStoreMaxNum + BASE_NUMBER;
}
IfrEfiVarStore = (EFI_IFR_VARSTORE_EFI *) IfrOpHdr;
//
// Convert VarStore Name from ASCII string to Unicode string.
//
EfiVarStoreList [EfiVarStoreNumber] = AllocatePool (IfrEfiVarStore->Header.Length + AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name));
CopyMem (EfiVarStoreList [EfiVarStoreNumber], IfrEfiVarStore, IfrEfiVarStore->Header.Length);
AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, (CHAR16 *) &(EfiVarStoreList [EfiVarStoreNumber]->Name[0]), AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name) * sizeof (CHAR16));
Status = FindQuestionDefaultSetting (EFI_HII_DEFAULT_CLASS_STANDARD, EfiVarStoreList[EfiVarStoreNumber], &VarStoreQuestionHeader, NULL, IfrEfiVarStore->Size, FALSE);
if (!EFI_ERROR (Status)) {
EfiVarStoreNumber ++;
} else {
FreePool (EfiVarStoreList [EfiVarStoreNumber]);
EfiVarStoreList [EfiVarStoreNumber] = NULL;
}
break;
case EFI_IFR_DEFAULTSTORE_OP:
if (DefaultIdNumber >= DefaultIdMaxNum) {
//
// Reallocate DefaultIdNumber
//
DefaultIdList = ReallocatePool (DefaultIdMaxNum * sizeof (UINT16), (DefaultIdMaxNum + BASE_NUMBER) * sizeof (UINT16), DefaultIdList);
DefaultIdMaxNum = DefaultIdMaxNum + BASE_NUMBER;
}
DefaultIdList[DefaultIdNumber ++] = ((EFI_IFR_DEFAULTSTORE *) IfrOpHdr)->DefaultId;
break;
case EFI_IFR_FORM_OP:
case EFI_IFR_FORM_MAP_OP:
//
// No EFI varstore is found and directly return.
//
if (EfiVarStoreNumber == 0 || DefaultIdNumber == 0) {
goto Done;
}
break;
case EFI_IFR_CHECKBOX_OP:
IfrScope = IfrOpHdr->Scope;
IfrQuestionType = IfrOpHdr->OpCode;
IfrQuestionHdr = (EFI_IFR_QUESTION_HEADER *) (IfrOpHdr + 1);
IfrCheckBox = (EFI_IFR_CHECKBOX *) (IfrOpHdr + 1);
EfiVarStoreIndex = IsEfiVarStoreQuestion (IfrQuestionHdr, EfiVarStoreList, EfiVarStoreNumber);
Width = sizeof (BOOLEAN);
if (EfiVarStoreIndex < EfiVarStoreNumber) {
for (Index = 0; Index < DefaultIdNumber; Index ++) {
if (DefaultIdList[Index] == EFI_HII_DEFAULT_CLASS_STANDARD) {
Status = FindQuestionDefaultSetting (DefaultIdList[Index], EfiVarStoreList[EfiVarStoreIndex], IfrQuestionHdr, &IfrValue, sizeof (BOOLEAN), QuestionReferBitField);
if (!EFI_ERROR (Status)) {
if (IfrValue.b) {
IfrCheckBox->Flags = IfrCheckBox->Flags | EFI_IFR_CHECKBOX_DEFAULT;
} else {
IfrCheckBox->Flags = IfrCheckBox->Flags & (~EFI_IFR_CHECKBOX_DEFAULT);
}
}
} else if (DefaultIdList[Index] == EFI_HII_DEFAULT_CLASS_MANUFACTURING) {
Status = FindQuestionDefaultSetting (DefaultIdList[Index], EfiVarStoreList[EfiVarStoreIndex], IfrQuestionHdr, &IfrValue, sizeof (BOOLEAN), QuestionReferBitField);
if (!EFI_ERROR (Status)) {
if (IfrValue.b) {
IfrCheckBox->Flags = IfrCheckBox->Flags | EFI_IFR_CHECKBOX_DEFAULT_MFG;
} else {
IfrCheckBox->Flags = IfrCheckBox->Flags & (~EFI_IFR_CHECKBOX_DEFAULT_MFG);
}
}
}
}
}
break;
case EFI_IFR_NUMERIC_OP:
IfrScope = IfrOpHdr->Scope;
IfrQuestionType = IfrOpHdr->OpCode;
IfrQuestionHdr = (EFI_IFR_QUESTION_HEADER *) (IfrOpHdr + 1);
if (QuestionReferBitField) {
Width = (UINTN) (((EFI_IFR_ONE_OF *) IfrOpHdr)->Flags & EDKII_IFR_NUMERIC_SIZE_BIT);
} else {
Width = (UINTN) ((UINT32) 1 << (((EFI_IFR_ONE_OF *) IfrOpHdr)->Flags & EFI_IFR_NUMERIC_SIZE));
}
break;
case EFI_IFR_ONE_OF_OP:
IfrScope = IfrOpHdr->Scope;
IfrQuestionType = IfrOpHdr->OpCode;
IfrQuestionHdr = (EFI_IFR_QUESTION_HEADER *) (IfrOpHdr + 1);
if (QuestionReferBitField) {
Width = (UINTN) (((EFI_IFR_ONE_OF *) IfrOpHdr)->Flags & EDKII_IFR_NUMERIC_SIZE_BIT);
} else {
Width = (UINTN) ((UINT32) 1 << (((EFI_IFR_ONE_OF *) IfrOpHdr)->Flags & EFI_IFR_NUMERIC_SIZE));
}
EfiVarStoreIndex = IsEfiVarStoreQuestion (IfrQuestionHdr, EfiVarStoreList, EfiVarStoreNumber);
StandardDefaultIsSet = FALSE;
ManufactDefaultIsSet = FALSE;
//
// Find Default and Manufacturing default for OneOf question
//
if (EfiVarStoreIndex < EfiVarStoreNumber) {
for (Index = 0; Index < DefaultIdNumber; Index ++) {
if (DefaultIdList[Index] == EFI_HII_DEFAULT_CLASS_STANDARD) {
Status = FindQuestionDefaultSetting (EFI_HII_DEFAULT_CLASS_STANDARD, EfiVarStoreList[EfiVarStoreIndex], IfrQuestionHdr, &IfrValue, Width, QuestionReferBitField);
if (!EFI_ERROR (Status)) {
StandardDefaultIsSet = TRUE;
}
} else if (DefaultIdList[Index] == EFI_HII_DEFAULT_CLASS_MANUFACTURING) {
Status = FindQuestionDefaultSetting (EFI_HII_DEFAULT_CLASS_MANUFACTURING, EfiVarStoreList[EfiVarStoreIndex], IfrQuestionHdr, &IfrManufactValue, Width, QuestionReferBitField);
if (!EFI_ERROR (Status)) {
ManufactDefaultIsSet = TRUE;
}
}
}
}
break;
case EFI_IFR_ORDERED_LIST_OP:
IfrScope = IfrOpHdr->Scope;
IfrQuestionType = IfrOpHdr->OpCode;
IfrQuestionHdr = (EFI_IFR_QUESTION_HEADER *) (IfrOpHdr + 1);
break;
case EFI_IFR_ONE_OF_OPTION_OP:
if (IfrQuestionHdr != NULL && IfrScope > 0) {
IfrOneOfOption = (EFI_IFR_ONE_OF_OPTION *) IfrOpHdr;
if (IfrQuestionType == EFI_IFR_ONE_OF_OP) {
Width = (UINTN) ((UINT32) 1 << (IfrOneOfOption->Flags & EFI_IFR_NUMERIC_SIZE));
if (StandardDefaultIsSet) {
if (CompareMem (&IfrOneOfOption->Value, &IfrValue, Width) == 0) {
IfrOneOfOption->Flags |= EFI_IFR_OPTION_DEFAULT;
} else {
IfrOneOfOption->Flags &= ~EFI_IFR_OPTION_DEFAULT;
}
}
if (ManufactDefaultIsSet) {
if (CompareMem (&IfrOneOfOption->Value, &IfrManufactValue, Width) == 0) {
IfrOneOfOption->Flags |= EFI_IFR_OPTION_DEFAULT_MFG;
} else {
IfrOneOfOption->Flags &= ~EFI_IFR_OPTION_DEFAULT_MFG;
}
}
}
}
break;
case EFI_IFR_DEFAULT_OP:
if (IfrQuestionHdr != NULL && IfrScope > 0) {
IfrDefault = (EFI_IFR_DEFAULT *) IfrOpHdr;
//
// Collect default value width
//
if (!QuestionReferBitField) {
Width = 0;
if (IfrDefault->Type == EFI_IFR_TYPE_NUM_SIZE_8 || IfrDefault->Type == EFI_IFR_TYPE_BOOLEAN) {
Width = 1;
} else if (IfrDefault->Type == EFI_IFR_TYPE_NUM_SIZE_16) {
Width = 2;
} else if (IfrDefault->Type == EFI_IFR_TYPE_NUM_SIZE_32) {
Width = 4;
} else if (IfrDefault->Type == EFI_IFR_TYPE_NUM_SIZE_64) {
Width = 8;
} else if (IfrDefault->Type == EFI_IFR_TYPE_BUFFER) {
Width = IfrDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value);
}
}
//
// Update the default value
//
if (Width > 0) {
EfiVarStoreIndex = IsEfiVarStoreQuestion (IfrQuestionHdr, EfiVarStoreList, EfiVarStoreNumber);
if (EfiVarStoreIndex < EfiVarStoreNumber) {
Status = FindQuestionDefaultSetting (IfrDefault->DefaultId, EfiVarStoreList[EfiVarStoreIndex], IfrQuestionHdr, &IfrDefault->Value, Width, QuestionReferBitField);
}
}
}
break;
case EFI_IFR_END_OP:
if (IfrQuestionHdr != NULL) {
if (IfrScope > 0) {
IfrScope --;
}
if (IfrScope == 0) {
IfrQuestionHdr = NULL;
QuestionReferBitField = FALSE;
}
}
break;
case EFI_IFR_GUID_OP:
if (CompareGuid ((EFI_GUID *)((UINT8 *)IfrOpHdr + sizeof (EFI_IFR_OP_HEADER)), &gEdkiiIfrBitVarstoreGuid)) {
QuestionReferBitField = TRUE;
}
break;
default:
break;
}
IfrOffset = IfrOffset + IfrOpHdr->Length;
IfrOpHdr = (EFI_IFR_OP_HEADER *) ((UINT8 *) IfrOpHdr + IfrOpHdr->Length);
if (IfrScope > 0) {
IfrScope += IfrOpHdr->Scope;
}
}
Done:
for (Index = 0; Index < EfiVarStoreNumber; Index ++) {
FreePool (EfiVarStoreList [Index]);
}
return;
}
/**
This function insert a Form package to a package list node.
@ -601,6 +1109,11 @@ InsertFormPackage (
InsertTailList (&PackageList->FormPkgHdr, &FormPackage->IfrEntry);
*Package = FormPackage;
//
// Update FormPackage with the default setting
//
UpdateDefaultSettingInFormPackage (FormPackage);
if (NotifyType == EFI_HII_DATABASE_NOTIFY_ADD_PACK) {
PackageList->PackageListHdr.PackageLength += FormPackage->FormPkgHdr.Length;
}

View File

@ -32,7 +32,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/HiiKeyBoardLayout.h>
#include <Guid/GlobalVariable.h>
#include <Guid/MdeModuleHii.h>
#include <Guid/VariableFormat.h>
#include <Guid/PcdDataBaseSignatureGuid.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
@ -65,6 +66,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
// BASE_CR (a, IFR_DEFAULT_VALUE_DATA, Entry) to get the whole structure.
typedef struct {
LIST_ENTRY Entry; // Link to VarStorage Default Data
UINT16 DefaultId;
VARIABLE_STORE_HEADER *VariableStorage;
} VARSTORAGE_DEFAULT_DATA;
typedef struct {
LIST_ENTRY Entry; // Link to VarStorage
EFI_GUID Guid;

View File

@ -79,6 +79,7 @@
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer ## CONSUMES
[Guids]
#