Update the logic in browser core, use config routine protocol instead of config access protocol to get/set data with hii drivers.
Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14902 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -355,6 +355,9 @@ OutputConfigBody (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Length = TmpPtr - String;
|
Length = TmpPtr - String;
|
||||||
|
if (Length == 0) {
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
Result = AllocateCopyPool (Length * sizeof (CHAR16), String);
|
Result = AllocateCopyPool (Length * sizeof (CHAR16), String);
|
||||||
if (Result == NULL) {
|
if (Result == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
@ -1281,6 +1284,13 @@ IsThisVarstore (
|
|||||||
GuidStr = NULL;
|
GuidStr = NULL;
|
||||||
TempStr = NULL;
|
TempStr = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// If ConfigHdr has name field and varstore not has name, return FALSE.
|
||||||
|
//
|
||||||
|
if (Name == NULL && StrStr (ConfigHdr, L"NAME=&") == NULL) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
GenerateSubStr (L"GUID=", sizeof (EFI_GUID), (VOID *)VarstoreGuid, 1, &GuidStr);
|
GenerateSubStr (L"GUID=", sizeof (EFI_GUID), (VOID *)VarstoreGuid, 1, &GuidStr);
|
||||||
if (Name != NULL) {
|
if (Name != NULL) {
|
||||||
GenerateSubStr (L"NAME=", StrLen (Name) * sizeof (CHAR16), (VOID *) Name, 2, &NameStr);
|
GenerateSubStr (L"NAME=", StrLen (Name) * sizeof (CHAR16), (VOID *) Name, 2, &NameStr);
|
||||||
@ -1317,6 +1327,130 @@ Done:
|
|||||||
return RetVal;
|
return RetVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function parses Form Package to get the efi varstore info according to the request ConfigHdr.
|
||||||
|
|
||||||
|
@param DataBaseRecord The DataBaseRecord instance contains the found Hii handle and package.
|
||||||
|
@param ConfigHdr Request string ConfigHdr. If it is NULL,
|
||||||
|
the first found varstore will be as ConfigHdr.
|
||||||
|
@retval TRUE This hii package is the reqeust one.
|
||||||
|
@retval FALSE This hii package is not the reqeust one.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
IsThisPackageList (
|
||||||
|
IN HII_DATABASE_RECORD *DataBaseRecord,
|
||||||
|
IN EFI_STRING ConfigHdr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN IfrOffset;
|
||||||
|
UINTN PackageOffset;
|
||||||
|
EFI_IFR_OP_HEADER *IfrOpHdr;
|
||||||
|
CHAR16 *VarStoreName;
|
||||||
|
UINT8 *HiiFormPackage;
|
||||||
|
UINTN PackageSize;
|
||||||
|
EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
|
||||||
|
EFI_HII_PACKAGE_HEADER *PackageHeader;
|
||||||
|
EFI_IFR_VARSTORE *IfrVarStore;
|
||||||
|
EFI_IFR_VARSTORE_NAME_VALUE *IfrNameValueVarStore;
|
||||||
|
BOOLEAN FindVarstore;
|
||||||
|
|
||||||
|
HiiFormPackage = NULL;
|
||||||
|
VarStoreName = NULL;
|
||||||
|
Status = EFI_SUCCESS;
|
||||||
|
FindVarstore = FALSE;
|
||||||
|
|
||||||
|
Status = GetFormPackageData(DataBaseRecord, &HiiFormPackage, &PackageSize);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
IfrOffset = sizeof (EFI_HII_PACKAGE_HEADER);
|
||||||
|
PackageOffset = IfrOffset;
|
||||||
|
PackageHeader = (EFI_HII_PACKAGE_HEADER *) HiiFormPackage;
|
||||||
|
|
||||||
|
while (IfrOffset < PackageSize) {
|
||||||
|
//
|
||||||
|
// More than one form packages exist.
|
||||||
|
//
|
||||||
|
if (PackageOffset >= PackageHeader->Length) {
|
||||||
|
//
|
||||||
|
// Process the new form package.
|
||||||
|
//
|
||||||
|
PackageOffset = sizeof (EFI_HII_PACKAGE_HEADER);
|
||||||
|
IfrOffset += PackageOffset;
|
||||||
|
PackageHeader = (EFI_HII_PACKAGE_HEADER *) (HiiFormPackage + IfrOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
IfrOpHdr = (EFI_IFR_OP_HEADER *) (HiiFormPackage + IfrOffset);
|
||||||
|
IfrOffset += IfrOpHdr->Length;
|
||||||
|
PackageOffset += IfrOpHdr->Length;
|
||||||
|
|
||||||
|
switch (IfrOpHdr->OpCode) {
|
||||||
|
|
||||||
|
case EFI_IFR_VARSTORE_OP:
|
||||||
|
IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr;
|
||||||
|
|
||||||
|
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)IfrVarStore->Name) * sizeof (CHAR16));
|
||||||
|
if (VarStoreName == NULL) {
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
AsciiStrToUnicodeStr ((CHAR8 *)IfrVarStore->Name, VarStoreName);
|
||||||
|
|
||||||
|
if (IsThisVarstore((VOID *)&IfrVarStore->Guid, VarStoreName, ConfigHdr)) {
|
||||||
|
FindVarstore = TRUE;
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_VARSTORE_EFI_OP:
|
||||||
|
IfrEfiVarStore = (EFI_IFR_VARSTORE_EFI *) IfrOpHdr;
|
||||||
|
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name) * sizeof (CHAR16));
|
||||||
|
if (VarStoreName == NULL) {
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
AsciiStrToUnicodeStr ((CHAR8 *)IfrEfiVarStore->Name, VarStoreName);
|
||||||
|
|
||||||
|
if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName, ConfigHdr)) {
|
||||||
|
FindVarstore = TRUE;
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_VARSTORE_NAME_VALUE_OP:
|
||||||
|
IfrNameValueVarStore = (EFI_IFR_VARSTORE_NAME_VALUE *) IfrOpHdr;
|
||||||
|
|
||||||
|
if (IsThisVarstore (&IfrNameValueVarStore->Guid, NULL, ConfigHdr)) {
|
||||||
|
FindVarstore = TRUE;
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_FORM_OP:
|
||||||
|
case EFI_IFR_FORM_MAP_OP:
|
||||||
|
//
|
||||||
|
// No matched varstore is found and directly return.
|
||||||
|
//
|
||||||
|
goto Done;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Done:
|
||||||
|
if (HiiFormPackage != NULL) {
|
||||||
|
FreePool (HiiFormPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VarStoreName != NULL) {
|
||||||
|
FreePool (VarStoreName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FindVarstore;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether the this op code is required.
|
Check whether the this op code is required.
|
||||||
|
|
||||||
@ -2128,14 +2262,26 @@ ParseIfrData (
|
|||||||
//
|
//
|
||||||
// End Opcode is for Var question.
|
// End Opcode is for Var question.
|
||||||
//
|
//
|
||||||
if (BlockData != NULL && BlockData->Scope > 0) {
|
if (BlockData != NULL) {
|
||||||
BlockData->Scope--;
|
if (BlockData->Scope > 0) {
|
||||||
|
BlockData->Scope--;
|
||||||
|
}
|
||||||
|
if (BlockData->Scope == 0) {
|
||||||
|
BlockData = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (BlockData != NULL && BlockData->Scope > 0) {
|
if (BlockData != NULL) {
|
||||||
BlockData->Scope = (UINT8) (BlockData->Scope + IfrOpHdr->Scope);
|
if (BlockData->Scope > 0) {
|
||||||
|
BlockData->Scope = (UINT8) (BlockData->Scope + IfrOpHdr->Scope);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BlockData->Scope == 0) {
|
||||||
|
BlockData = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3200,10 +3346,11 @@ GetConfigRespFromEfiVarStore (
|
|||||||
UINT8 *VarStore;
|
UINT8 *VarStore;
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
BufferSize = 0;
|
BufferSize = 0;
|
||||||
VarStore = NULL;
|
VarStore = NULL;
|
||||||
VarStoreName = NULL;
|
VarStoreName = NULL;
|
||||||
|
*AccessProgress = Request;
|
||||||
|
|
||||||
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)EfiVarStoreInfo->Name) * sizeof (CHAR16));
|
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)EfiVarStoreInfo->Name) * sizeof (CHAR16));
|
||||||
if (VarStoreName == NULL) {
|
if (VarStoreName == NULL) {
|
||||||
@ -3537,6 +3684,7 @@ HiiConfigRoutingExtractConfig (
|
|||||||
BOOLEAN IsEfiVarStore;
|
BOOLEAN IsEfiVarStore;
|
||||||
EFI_IFR_VARSTORE_EFI *EfiVarStoreInfo;
|
EFI_IFR_VARSTORE_EFI *EfiVarStoreInfo;
|
||||||
EFI_STRING ErrorPtr;
|
EFI_STRING ErrorPtr;
|
||||||
|
UINTN DevicePathSize;
|
||||||
|
|
||||||
if (This == NULL || Progress == NULL || Results == NULL) {
|
if (This == NULL || Progress == NULL || Results == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
@ -3622,11 +3770,8 @@ HiiConfigRoutingExtractConfig (
|
|||||||
Database = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
|
Database = CR (Link, HII_DATABASE_RECORD, DatabaseEntry, HII_DATABASE_RECORD_SIGNATURE);
|
||||||
if ((DevicePathPkg = Database->PackageList->DevicePathPkg) != NULL) {
|
if ((DevicePathPkg = Database->PackageList->DevicePathPkg) != NULL) {
|
||||||
CurrentDevicePath = DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);
|
CurrentDevicePath = DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);
|
||||||
if (CompareMem (
|
DevicePathSize = GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) CurrentDevicePath);
|
||||||
DevicePath,
|
if ((CompareMem (DevicePath,CurrentDevicePath,DevicePathSize) == 0) && IsThisPackageList(Database, Request)) {
|
||||||
CurrentDevicePath,
|
|
||||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) CurrentDevicePath)
|
|
||||||
) == 0) {
|
|
||||||
DriverHandle = Database->DriverHandle;
|
DriverHandle = Database->DriverHandle;
|
||||||
HiiHandle = Database->Handle;
|
HiiHandle = Database->Handle;
|
||||||
break;
|
break;
|
||||||
@ -4060,6 +4205,7 @@ HiiConfigRoutingRouteConfig (
|
|||||||
EFI_STRING AccessProgress;
|
EFI_STRING AccessProgress;
|
||||||
EFI_IFR_VARSTORE_EFI *EfiVarStoreInfo;
|
EFI_IFR_VARSTORE_EFI *EfiVarStoreInfo;
|
||||||
BOOLEAN IsEfiVarstore;
|
BOOLEAN IsEfiVarstore;
|
||||||
|
UINTN DevicePathSize;
|
||||||
|
|
||||||
if (This == NULL || Progress == NULL) {
|
if (This == NULL || Progress == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
@ -4131,11 +4277,8 @@ HiiConfigRoutingRouteConfig (
|
|||||||
|
|
||||||
if ((DevicePathPkg = Database->PackageList->DevicePathPkg) != NULL) {
|
if ((DevicePathPkg = Database->PackageList->DevicePathPkg) != NULL) {
|
||||||
CurrentDevicePath = DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);
|
CurrentDevicePath = DevicePathPkg + sizeof (EFI_HII_PACKAGE_HEADER);
|
||||||
if (CompareMem (
|
DevicePathSize = GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) CurrentDevicePath);
|
||||||
DevicePath,
|
if ((CompareMem (DevicePath,CurrentDevicePath,DevicePathSize) == 0) && IsThisPackageList(Database, Configuration)) {
|
||||||
CurrentDevicePath,
|
|
||||||
GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) CurrentDevicePath)
|
|
||||||
) == 0) {
|
|
||||||
DriverHandle = Database->DriverHandle;
|
DriverHandle = Database->DriverHandle;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1499,7 +1499,6 @@ ProcessQuestionConfig (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR16 *ConfigResp;
|
CHAR16 *ConfigResp;
|
||||||
CHAR16 *Progress;
|
CHAR16 *Progress;
|
||||||
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
|
|
||||||
|
|
||||||
if (Question->QuestionConfig == 0) {
|
if (Question->QuestionConfig == 0) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -1516,12 +1515,8 @@ ProcessQuestionConfig (
|
|||||||
//
|
//
|
||||||
// Send config to Configuration Driver
|
// Send config to Configuration Driver
|
||||||
//
|
//
|
||||||
ConfigAccess = Selection->FormSet->ConfigAccess;
|
Status = mHiiConfigRouting->RouteConfig (
|
||||||
if (ConfigAccess == NULL) {
|
mHiiConfigRouting,
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
Status = ConfigAccess->RouteConfig (
|
|
||||||
ConfigAccess,
|
|
||||||
ConfigResp,
|
ConfigResp,
|
||||||
&Progress
|
&Progress
|
||||||
);
|
);
|
||||||
|
@ -1270,7 +1270,6 @@ GetQuestionValue (
|
|||||||
BOOLEAN IsString;
|
BOOLEAN IsString;
|
||||||
CHAR16 TemStr[5];
|
CHAR16 TemStr[5];
|
||||||
UINT8 DigitUint8;
|
UINT8 DigitUint8;
|
||||||
UINT8 *TemBuffer;
|
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
Value = NULL;
|
Value = NULL;
|
||||||
@ -1487,147 +1486,118 @@ GetQuestionValue (
|
|||||||
FreePool (Value);
|
FreePool (Value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Storage->Type == EFI_HII_VARSTORE_BUFFER || Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) {
|
//
|
||||||
//
|
// <ConfigRequest> ::= <ConfigHdr> + <BlockName> ||
|
||||||
// Request current settings from Configuration Driver
|
// <ConfigHdr> + "&" + <VariableName>
|
||||||
//
|
//
|
||||||
if (FormSet->ConfigAccess == NULL) {
|
if (IsBufferStorage) {
|
||||||
return EFI_NOT_FOUND;
|
Length = StrLen (Storage->ConfigHdr);
|
||||||
}
|
Length += StrLen (Question->BlockName);
|
||||||
|
} else {
|
||||||
|
Length = StrLen (Storage->ConfigHdr);
|
||||||
|
Length += StrLen (Question->VariableName) + 1;
|
||||||
|
}
|
||||||
|
ConfigRequest = AllocateZeroPool ((Length + 1) * sizeof (CHAR16));
|
||||||
|
ASSERT (ConfigRequest != NULL);
|
||||||
|
|
||||||
//
|
StrCpy (ConfigRequest, Storage->ConfigHdr);
|
||||||
// <ConfigRequest> ::= <ConfigHdr> + <BlockName> ||
|
if (IsBufferStorage) {
|
||||||
// <ConfigHdr> + "&" + <VariableName>
|
StrCat (ConfigRequest, Question->BlockName);
|
||||||
//
|
} else {
|
||||||
if (IsBufferStorage) {
|
StrCat (ConfigRequest, L"&");
|
||||||
Length = StrLen (Storage->ConfigHdr);
|
StrCat (ConfigRequest, Question->VariableName);
|
||||||
Length += StrLen (Question->BlockName);
|
}
|
||||||
} else {
|
|
||||||
Length = StrLen (Storage->ConfigHdr);
|
|
||||||
Length += StrLen (Question->VariableName) + 1;
|
|
||||||
}
|
|
||||||
ConfigRequest = AllocateZeroPool ((Length + 1) * sizeof (CHAR16));
|
|
||||||
ASSERT (ConfigRequest != NULL);
|
|
||||||
|
|
||||||
StrCpy (ConfigRequest, Storage->ConfigHdr);
|
//
|
||||||
if (IsBufferStorage) {
|
// Request current settings from Configuration Driver
|
||||||
StrCat (ConfigRequest, Question->BlockName);
|
//
|
||||||
} else {
|
Status = mHiiConfigRouting->ExtractConfig (
|
||||||
StrCat (ConfigRequest, L"&");
|
mHiiConfigRouting,
|
||||||
StrCat (ConfigRequest, Question->VariableName);
|
ConfigRequest,
|
||||||
}
|
&Progress,
|
||||||
|
&Result
|
||||||
|
);
|
||||||
|
FreePool (ConfigRequest);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
Status = FormSet->ConfigAccess->ExtractConfig (
|
//
|
||||||
FormSet->ConfigAccess,
|
// Skip <ConfigRequest>
|
||||||
ConfigRequest,
|
//
|
||||||
&Progress,
|
if (IsBufferStorage) {
|
||||||
&Result
|
Value = StrStr (Result, L"&VALUE");
|
||||||
);
|
if (Value == NULL) {
|
||||||
FreePool (ConfigRequest);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Skip <ConfigRequest>
|
|
||||||
//
|
|
||||||
if (IsBufferStorage) {
|
|
||||||
Value = StrStr (Result, L"&VALUE");
|
|
||||||
if (Value == NULL) {
|
|
||||||
FreePool (Result);
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Skip "&VALUE"
|
|
||||||
//
|
|
||||||
Value = Value + 6;
|
|
||||||
} else {
|
|
||||||
Value = Result + Length;
|
|
||||||
}
|
|
||||||
if (*Value != '=') {
|
|
||||||
FreePool (Result);
|
FreePool (Result);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Skip '=', point to value
|
// Skip "&VALUE"
|
||||||
//
|
//
|
||||||
Value = Value + 1;
|
Value = Value + 6;
|
||||||
|
} else {
|
||||||
|
Value = Result + Length;
|
||||||
|
}
|
||||||
|
if (*Value != '=') {
|
||||||
|
FreePool (Result);
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Skip '=', point to value
|
||||||
|
//
|
||||||
|
Value = Value + 1;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Suppress <AltResp> if any
|
// Suppress <AltResp> if any
|
||||||
//
|
//
|
||||||
StringPtr = Value;
|
StringPtr = Value;
|
||||||
while (*StringPtr != L'\0' && *StringPtr != L'&') {
|
while (*StringPtr != L'\0' && *StringPtr != L'&') {
|
||||||
StringPtr++;
|
StringPtr++;
|
||||||
}
|
}
|
||||||
*StringPtr = L'\0';
|
*StringPtr = L'\0';
|
||||||
|
|
||||||
LengthStr = StrLen (Value);
|
LengthStr = StrLen (Value);
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
if (!IsBufferStorage && IsString) {
|
if (!IsBufferStorage && IsString) {
|
||||||
//
|
//
|
||||||
// Convert Config String to Unicode String, e.g "0041004200430044" => "ABCD"
|
// Convert Config String to Unicode String, e.g "0041004200430044" => "ABCD"
|
||||||
// Add string tail char L'\0' into Length
|
// Add string tail char L'\0' into Length
|
||||||
//
|
//
|
||||||
Length = StorageWidth + sizeof (CHAR16);
|
Length = StorageWidth + sizeof (CHAR16);
|
||||||
if (Length < ((LengthStr / 4 + 1) * 2)) {
|
if (Length < ((LengthStr / 4 + 1) * 2)) {
|
||||||
Status = EFI_BUFFER_TOO_SMALL;
|
Status = EFI_BUFFER_TOO_SMALL;
|
||||||
} else {
|
|
||||||
StringPtr = (CHAR16 *) Dst;
|
|
||||||
ZeroMem (TemStr, sizeof (TemStr));
|
|
||||||
for (Index = 0; Index < LengthStr; Index += 4) {
|
|
||||||
StrnCpy (TemStr, Value + Index, 4);
|
|
||||||
StringPtr[Index/4] = (CHAR16) StrHexToUint64 (TemStr);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Add tailing L'\0' character
|
|
||||||
//
|
|
||||||
StringPtr[Index/4] = L'\0';
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (StorageWidth < ((LengthStr + 1) / 2)) {
|
StringPtr = (CHAR16 *) Dst;
|
||||||
Status = EFI_BUFFER_TOO_SMALL;
|
ZeroMem (TemStr, sizeof (TemStr));
|
||||||
} else {
|
for (Index = 0; Index < LengthStr; Index += 4) {
|
||||||
ZeroMem (TemStr, sizeof (TemStr));
|
StrnCpy (TemStr, Value + Index, 4);
|
||||||
for (Index = 0; Index < LengthStr; Index ++) {
|
StringPtr[Index/4] = (CHAR16) StrHexToUint64 (TemStr);
|
||||||
TemStr[0] = Value[LengthStr - Index - 1];
|
}
|
||||||
DigitUint8 = (UINT8) StrHexToUint64 (TemStr);
|
//
|
||||||
if ((Index & 1) == 0) {
|
// Add tailing L'\0' character
|
||||||
Dst [Index/2] = DigitUint8;
|
//
|
||||||
} else {
|
StringPtr[Index/4] = L'\0';
|
||||||
Dst [Index/2] = (UINT8) ((DigitUint8 << 4) + Dst [Index/2]);
|
}
|
||||||
}
|
} else {
|
||||||
|
if (StorageWidth < ((LengthStr + 1) / 2)) {
|
||||||
|
Status = EFI_BUFFER_TOO_SMALL;
|
||||||
|
} else {
|
||||||
|
ZeroMem (TemStr, sizeof (TemStr));
|
||||||
|
for (Index = 0; Index < LengthStr; Index ++) {
|
||||||
|
TemStr[0] = Value[LengthStr - Index - 1];
|
||||||
|
DigitUint8 = (UINT8) StrHexToUint64 (TemStr);
|
||||||
|
if ((Index & 1) == 0) {
|
||||||
|
Dst [Index/2] = DigitUint8;
|
||||||
|
} else {
|
||||||
|
Dst [Index/2] = (UINT8) ((DigitUint8 << 4) + Dst [Index/2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
FreePool (Result);
|
FreePool (Result);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
|
||||||
} else if (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
|
|
||||||
TemBuffer = NULL;
|
|
||||||
TemBuffer = AllocateZeroPool (Storage->Size);
|
|
||||||
if (TemBuffer == NULL) {
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
Length = Storage->Size;
|
|
||||||
Status = gRT->GetVariable (
|
|
||||||
Storage->Name,
|
|
||||||
&Storage->Guid,
|
|
||||||
NULL,
|
|
||||||
&Length,
|
|
||||||
TemBuffer
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (TemBuffer);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
CopyMem (Dst, TemBuffer + Question->VarStoreInfo.VarOffset, StorageWidth);
|
|
||||||
|
|
||||||
FreePool (TemBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1871,111 +1841,78 @@ SetQuestionValue (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (SetValueTo == GetSetValueWithHiiDriver) {
|
} else if (SetValueTo == GetSetValueWithHiiDriver) {
|
||||||
if (Storage->Type == EFI_HII_VARSTORE_BUFFER || Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) {
|
//
|
||||||
|
// <ConfigResp> ::= <ConfigHdr> + <BlockName> + "&VALUE=" + "<HexCh>StorageWidth * 2" ||
|
||||||
|
// <ConfigHdr> + "&" + <VariableName> + "=" + "<string>"
|
||||||
|
//
|
||||||
|
if (IsBufferStorage) {
|
||||||
|
Length = StrLen (Question->BlockName) + 7;
|
||||||
|
} else {
|
||||||
|
Length = StrLen (Question->VariableName) + 2;
|
||||||
|
}
|
||||||
|
if (!IsBufferStorage && IsString) {
|
||||||
|
Length += (StrLen ((CHAR16 *) Src) * 4);
|
||||||
|
} else {
|
||||||
|
Length += (StorageWidth * 2);
|
||||||
|
}
|
||||||
|
ConfigResp = AllocateZeroPool ((StrLen (Storage->ConfigHdr) + Length + 1) * sizeof (CHAR16));
|
||||||
|
ASSERT (ConfigResp != NULL);
|
||||||
|
|
||||||
|
StrCpy (ConfigResp, Storage->ConfigHdr);
|
||||||
|
if (IsBufferStorage) {
|
||||||
|
StrCat (ConfigResp, Question->BlockName);
|
||||||
|
StrCat (ConfigResp, L"&VALUE=");
|
||||||
|
} else {
|
||||||
|
StrCat (ConfigResp, L"&");
|
||||||
|
StrCat (ConfigResp, Question->VariableName);
|
||||||
|
StrCat (ConfigResp, L"=");
|
||||||
|
}
|
||||||
|
|
||||||
|
Value = ConfigResp + StrLen (ConfigResp);
|
||||||
|
|
||||||
|
if (!IsBufferStorage && IsString) {
|
||||||
//
|
//
|
||||||
// <ConfigResp> ::= <ConfigHdr> + <BlockName> + "&VALUE=" + "<HexCh>StorageWidth * 2" ||
|
// Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
|
||||||
// <ConfigHdr> + "&" + <VariableName> + "=" + "<string>"
|
|
||||||
//
|
//
|
||||||
if (IsBufferStorage) {
|
TemName = (CHAR16 *) Src;
|
||||||
Length = StrLen (Question->BlockName) + 7;
|
TemString = Value;
|
||||||
} else {
|
for (; *TemName != L'\0'; TemName++) {
|
||||||
Length = StrLen (Question->VariableName) + 2;
|
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemName, 4);
|
||||||
}
|
}
|
||||||
if (!IsBufferStorage && IsString) {
|
} else {
|
||||||
Length += (StrLen ((CHAR16 *) Src) * 4);
|
|
||||||
} else {
|
|
||||||
Length += (StorageWidth * 2);
|
|
||||||
}
|
|
||||||
ConfigResp = AllocateZeroPool ((StrLen (Storage->ConfigHdr) + Length + 1) * sizeof (CHAR16));
|
|
||||||
ASSERT (ConfigResp != NULL);
|
|
||||||
|
|
||||||
StrCpy (ConfigResp, Storage->ConfigHdr);
|
|
||||||
if (IsBufferStorage) {
|
|
||||||
StrCat (ConfigResp, Question->BlockName);
|
|
||||||
StrCat (ConfigResp, L"&VALUE=");
|
|
||||||
} else {
|
|
||||||
StrCat (ConfigResp, L"&");
|
|
||||||
StrCat (ConfigResp, Question->VariableName);
|
|
||||||
StrCat (ConfigResp, L"=");
|
|
||||||
}
|
|
||||||
|
|
||||||
Value = ConfigResp + StrLen (ConfigResp);
|
|
||||||
|
|
||||||
if (!IsBufferStorage && IsString) {
|
|
||||||
//
|
|
||||||
// Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
|
|
||||||
//
|
|
||||||
TemName = (CHAR16 *) Src;
|
|
||||||
TemString = Value;
|
|
||||||
for (; *TemName != L'\0'; TemName++) {
|
|
||||||
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemName, 4);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// Convert Buffer to Hex String
|
|
||||||
//
|
|
||||||
TemBuffer = Src + StorageWidth - 1;
|
|
||||||
TemString = Value;
|
|
||||||
for (Index = 0; Index < StorageWidth; Index ++, TemBuffer --) {
|
|
||||||
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert to lower char.
|
// Convert Buffer to Hex String
|
||||||
//
|
//
|
||||||
for (TemString = Value; *Value != L'\0'; Value++) {
|
TemBuffer = Src + StorageWidth - 1;
|
||||||
if (*Value >= L'A' && *Value <= L'Z') {
|
TemString = Value;
|
||||||
*Value = (CHAR16) (*Value - L'A' + L'a');
|
for (Index = 0; Index < StorageWidth; Index ++, TemBuffer --) {
|
||||||
}
|
TemString += UnicodeValueToString (TemString, PREFIX_ZERO | RADIX_HEX, *TemBuffer, 2);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Submit Question Value to Configuration Driver
|
|
||||||
//
|
|
||||||
if (FormSet->ConfigAccess != NULL) {
|
|
||||||
Status = FormSet->ConfigAccess->RouteConfig (
|
|
||||||
FormSet->ConfigAccess,
|
|
||||||
ConfigResp,
|
|
||||||
&Progress
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
|
|
||||||
} else if (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
|
|
||||||
TemBuffer = NULL;
|
|
||||||
TemBuffer = AllocateZeroPool(Storage->Size);
|
|
||||||
if (TemBuffer == NULL) {
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
Length = Storage->Size;
|
|
||||||
Status = gRT->GetVariable (
|
|
||||||
Storage->Name,
|
|
||||||
&Storage->Guid,
|
|
||||||
NULL,
|
|
||||||
&Length,
|
|
||||||
TemBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
CopyMem (TemBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
|
|
||||||
|
|
||||||
Status = gRT->SetVariable (
|
|
||||||
Storage->Name,
|
|
||||||
&Storage->Guid,
|
|
||||||
Storage->Attributes,
|
|
||||||
Storage->Size,
|
|
||||||
TemBuffer
|
|
||||||
);
|
|
||||||
FreePool (TemBuffer);
|
|
||||||
if (EFI_ERROR (Status)){
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert to lower char.
|
||||||
|
//
|
||||||
|
for (TemString = Value; *Value != L'\0'; Value++) {
|
||||||
|
if (*Value >= L'A' && *Value <= L'Z') {
|
||||||
|
*Value = (CHAR16) (*Value - L'A' + L'a');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Submit Question Value to Configuration Driver
|
||||||
|
//
|
||||||
|
Status = mHiiConfigRouting->RouteConfig (
|
||||||
|
mHiiConfigRouting,
|
||||||
|
ConfigResp,
|
||||||
|
&Progress
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
FreePool (ConfigResp);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
FreePool (ConfigResp);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sync storage, from editbuffer to buffer.
|
// Sync storage, from editbuffer to buffer.
|
||||||
//
|
//
|
||||||
@ -2522,8 +2459,6 @@ SubmitForm (
|
|||||||
EFI_STRING Progress;
|
EFI_STRING Progress;
|
||||||
BROWSER_STORAGE *Storage;
|
BROWSER_STORAGE *Storage;
|
||||||
FORMSET_STORAGE *FormSetStorage;
|
FORMSET_STORAGE *FormSetStorage;
|
||||||
UINTN BufferSize;
|
|
||||||
UINT8 *TmpBuf;
|
|
||||||
FORM_BROWSER_FORMSET *LocalFormSet;
|
FORM_BROWSER_FORMSET *LocalFormSet;
|
||||||
FORM_BROWSER_CONFIG_REQUEST *ConfigInfo;
|
FORM_BROWSER_CONFIG_REQUEST *ConfigInfo;
|
||||||
|
|
||||||
@ -2575,72 +2510,18 @@ SubmitForm (
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// 2. Set value to hii driver or efi variable.
|
// 2. Set value to hii config routine protocol.
|
||||||
//
|
//
|
||||||
if (Storage->Type == EFI_HII_VARSTORE_BUFFER ||
|
Status = mHiiConfigRouting->RouteConfig (
|
||||||
Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) {
|
mHiiConfigRouting,
|
||||||
//
|
ConfigResp,
|
||||||
// Send <ConfigResp> to Configuration Driver
|
&Progress
|
||||||
//
|
);
|
||||||
if (FormSet->ConfigAccess != NULL) {
|
if (EFI_ERROR (Status)) {
|
||||||
Status = FormSet->ConfigAccess->RouteConfig (
|
FreePool (ConfigResp);
|
||||||
FormSet->ConfigAccess,
|
return Status;
|
||||||
ConfigResp,
|
|
||||||
&Progress
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
|
|
||||||
TmpBuf = NULL;
|
|
||||||
TmpBuf = AllocateZeroPool(Storage->Size);
|
|
||||||
if (TmpBuf == NULL) {
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferSize = Storage->Size;
|
|
||||||
Status = gRT->GetVariable (
|
|
||||||
Storage->Name,
|
|
||||||
&Storage->Guid,
|
|
||||||
NULL,
|
|
||||||
&BufferSize,
|
|
||||||
TmpBuf
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (TmpBuf);
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
ASSERT (BufferSize == Storage->Size);
|
|
||||||
Status = mHiiConfigRouting->ConfigToBlock (
|
|
||||||
mHiiConfigRouting,
|
|
||||||
ConfigResp,
|
|
||||||
TmpBuf,
|
|
||||||
&BufferSize,
|
|
||||||
&Progress
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (TmpBuf);
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gRT->SetVariable (
|
|
||||||
Storage->Name,
|
|
||||||
&Storage->Guid,
|
|
||||||
Storage->Attributes,
|
|
||||||
Storage->Size,
|
|
||||||
TmpBuf
|
|
||||||
);
|
|
||||||
FreePool (TmpBuf);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (ConfigResp);
|
FreePool (ConfigResp);
|
||||||
//
|
//
|
||||||
// 3. Config success, update storage shadow Buffer, only update the data belong to this form.
|
// 3. Config success, update storage shadow Buffer, only update the data belong to this form.
|
||||||
@ -2681,69 +2562,19 @@ SubmitForm (
|
|||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Storage->Type == EFI_HII_VARSTORE_BUFFER ||
|
//
|
||||||
Storage->Type == EFI_HII_VARSTORE_NAME_VALUE) {
|
// 2. Send <ConfigResp> to Routine config Protocol.
|
||||||
|
//
|
||||||
//
|
Status = mHiiConfigRouting->RouteConfig (
|
||||||
// 2. Send <ConfigResp> to Configuration Driver
|
mHiiConfigRouting,
|
||||||
//
|
ConfigResp,
|
||||||
if (FormSet->ConfigAccess != NULL) {
|
&Progress
|
||||||
Status = FormSet->ConfigAccess->RouteConfig (
|
);
|
||||||
FormSet->ConfigAccess,
|
if (EFI_ERROR (Status)) {
|
||||||
ConfigResp,
|
FreePool (ConfigResp);
|
||||||
&Progress
|
return Status;
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
|
|
||||||
//
|
|
||||||
// 1&2. Set the edit data to the variable.
|
|
||||||
//
|
|
||||||
TmpBuf = NULL;
|
|
||||||
TmpBuf = AllocateZeroPool (Storage->Size);
|
|
||||||
if (TmpBuf == NULL) {
|
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
BufferSize = Storage->Size;
|
|
||||||
Status = gRT->GetVariable (
|
|
||||||
Storage->Name,
|
|
||||||
&Storage->Guid,
|
|
||||||
NULL,
|
|
||||||
&BufferSize,
|
|
||||||
TmpBuf
|
|
||||||
);
|
|
||||||
ASSERT (BufferSize == Storage->Size);
|
|
||||||
Status = mHiiConfigRouting->ConfigToBlock (
|
|
||||||
mHiiConfigRouting,
|
|
||||||
ConfigResp,
|
|
||||||
TmpBuf,
|
|
||||||
&BufferSize,
|
|
||||||
&Progress
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (TmpBuf);
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = gRT->SetVariable (
|
|
||||||
Storage->Name,
|
|
||||||
&Storage->Guid,
|
|
||||||
Storage->Attributes,
|
|
||||||
Storage->Size,
|
|
||||||
TmpBuf
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
FreePool (TmpBuf);
|
|
||||||
FreePool (ConfigResp);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
FreePool (TmpBuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreePool (ConfigResp);
|
FreePool (ConfigResp);
|
||||||
//
|
//
|
||||||
// 3. Config success, update storage shadow Buffer
|
// 3. Config success, update storage shadow Buffer
|
||||||
@ -2828,9 +2659,7 @@ GetDefaultValueFromAltCfg (
|
|||||||
Value = NULL;
|
Value = NULL;
|
||||||
Storage = Question->Storage;
|
Storage = Question->Storage;
|
||||||
|
|
||||||
if ((Storage == NULL) ||
|
if ((Storage == NULL) || (Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE)) {
|
||||||
(Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) ||
|
|
||||||
(Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER)) {
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2849,7 +2678,11 @@ GetDefaultValueFromAltCfg (
|
|||||||
Dst = (UINT8 *) &Question->HiiValue.Value;
|
Dst = (UINT8 *) &Question->HiiValue.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
IsBufferStorage = (BOOLEAN) ((Storage->Type == EFI_HII_VARSTORE_BUFFER) ? TRUE : FALSE);
|
if (Storage->Type == EFI_HII_VARSTORE_BUFFER || Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
|
||||||
|
IsBufferStorage = TRUE;
|
||||||
|
} else {
|
||||||
|
IsBufferStorage = FALSE;
|
||||||
|
}
|
||||||
IsString = (BOOLEAN) ((Question->HiiValue.Type == EFI_IFR_TYPE_STRING) ? TRUE : FALSE);
|
IsString = (BOOLEAN) ((Question->HiiValue.Type == EFI_IFR_TYPE_STRING) ? TRUE : FALSE);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -2874,8 +2707,8 @@ GetDefaultValueFromAltCfg (
|
|||||||
StrCat (ConfigRequest, Question->VariableName);
|
StrCat (ConfigRequest, Question->VariableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = FormSet->ConfigAccess->ExtractConfig (
|
Status = mHiiConfigRouting->ExtractConfig (
|
||||||
FormSet->ConfigAccess,
|
mHiiConfigRouting,
|
||||||
ConfigRequest,
|
ConfigRequest,
|
||||||
&Progress,
|
&Progress,
|
||||||
&Result
|
&Result
|
||||||
@ -2905,6 +2738,11 @@ GetDefaultValueFromAltCfg (
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ConfigResp == NULL) {
|
||||||
|
Status = EFI_NOT_FOUND;
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Skip <ConfigRequest>
|
// Skip <ConfigRequest>
|
||||||
//
|
//
|
||||||
@ -4257,26 +4095,6 @@ LoadStorage (
|
|||||||
ConfigRequestAdjust(Storage);
|
ConfigRequestAdjust(Storage);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gRT->GetVariable (
|
|
||||||
Storage->BrowserStorage->Name,
|
|
||||||
&Storage->BrowserStorage->Guid,
|
|
||||||
NULL,
|
|
||||||
(UINTN*)&Storage->BrowserStorage->Size,
|
|
||||||
Storage->BrowserStorage->EditBuffer
|
|
||||||
);
|
|
||||||
//
|
|
||||||
// If get variable fail, extract default from IFR binary
|
|
||||||
//
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD, FormSetLevel, GetDefaultForStorage, Storage->BrowserStorage, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
Storage->BrowserStorage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigRequest), Storage->ConfigRequest);
|
|
||||||
//
|
|
||||||
// Input NULL for ConfigRequest field means sync all fields from editbuffer to buffer.
|
|
||||||
//
|
|
||||||
SynchronizeStorage(FormSet, Storage->BrowserStorage, NULL, TRUE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EFI_HII_VARSTORE_BUFFER:
|
case EFI_HII_VARSTORE_BUFFER:
|
||||||
@ -4287,49 +4105,47 @@ LoadStorage (
|
|||||||
if (Storage->ElementCount == 0 || Storage->BrowserStorage->Initialized) {
|
if (Storage->ElementCount == 0 || Storage->BrowserStorage->Initialized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_NOT_FOUND;
|
|
||||||
if (FormSet->ConfigAccess != NULL) {
|
|
||||||
//
|
|
||||||
// Request current settings from Configuration Driver
|
|
||||||
//
|
|
||||||
Status = FormSet->ConfigAccess->ExtractConfig (
|
|
||||||
FormSet->ConfigAccess,
|
|
||||||
Storage->ConfigRequest,
|
|
||||||
&Progress,
|
|
||||||
&Result
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// Convert Result from <ConfigAltResp> to <ConfigResp>
|
|
||||||
//
|
|
||||||
StrPtr = StrStr (Result, L"&GUID=");
|
|
||||||
if (StrPtr != NULL) {
|
|
||||||
*StrPtr = L'\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = ConfigRespToStorage (Storage->BrowserStorage, Result);
|
|
||||||
FreePool (Result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// Base on the configRequest string to get default value.
|
|
||||||
//
|
|
||||||
GetDefaultForFormset (FormSet, Storage->BrowserStorage, Storage->ConfigRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
SynchronizeStorage(FormSet, Storage->BrowserStorage, Storage->ConfigRequest, TRUE);
|
|
||||||
|
|
||||||
Storage->BrowserStorage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigRequest), Storage->ConfigRequest);
|
|
||||||
Storage->BrowserStorage->Initialized = TRUE;
|
Storage->BrowserStorage->Initialized = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Request current settings from Configuration Driver
|
||||||
|
//
|
||||||
|
Status = mHiiConfigRouting->ExtractConfig (
|
||||||
|
mHiiConfigRouting,
|
||||||
|
Storage->ConfigRequest,
|
||||||
|
&Progress,
|
||||||
|
&Result
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// If get value fail, extract default from IFR binary
|
||||||
|
//
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD, FormSetLevel, GetDefaultForStorage, Storage->BrowserStorage, TRUE);
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Convert Result from <ConfigAltResp> to <ConfigResp>
|
||||||
|
//
|
||||||
|
StrPtr = StrStr (Result, L"&GUID=");
|
||||||
|
if (StrPtr != NULL) {
|
||||||
|
*StrPtr = L'\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ConfigRespToStorage (Storage->BrowserStorage, Result);
|
||||||
|
FreePool (Result);
|
||||||
|
}
|
||||||
|
|
||||||
|
Storage->BrowserStorage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigRequest), Storage->ConfigRequest);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Input NULL for ConfigRequest field means sync all fields from editbuffer to buffer.
|
||||||
|
//
|
||||||
|
SynchronizeStorage(FormSet, Storage->BrowserStorage, NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user