mirror of https://github.com/acidanthera/audk.git
Update HiiConfigAccess.ExtractConfig interface to support NULL request string and ConfigHdr request string.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10180 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5bdfa4e58a
commit
59aefb7e0d
|
@ -147,6 +147,10 @@ GetStorageFromConfigString (
|
|||
FORMSET_STORAGE *Storage;
|
||||
CHAR16 *Name;
|
||||
|
||||
if (ConfigString == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
StorageList = GetFirstNode (&FormSet->StorageListHead);
|
||||
|
||||
while (!IsNull (&FormSet->StorageListHead, StorageList)) {
|
||||
|
@ -165,7 +169,7 @@ GetStorageFromConfigString (
|
|||
StorageList = GetNextNode (&FormSet->StorageListHead, StorageList);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -419,73 +423,194 @@ ThunkExtractConfig (
|
|||
OUT EFI_STRING *Results
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
CONFIG_ACCESS_PRIVATE *ConfigAccess;
|
||||
FORMSET_STORAGE *BufferStorage;
|
||||
VOID *Data;
|
||||
UINTN DataSize;
|
||||
EFI_STATUS Status;
|
||||
CONFIG_ACCESS_PRIVATE *ConfigAccess;
|
||||
FORMSET_STORAGE *BufferStorage;
|
||||
VOID *Data;
|
||||
UINTN DataSize;
|
||||
FORM_BROWSER_FORMSET *FormSetContext;
|
||||
CHAR16 *VarStoreName;
|
||||
EFI_STRING ConfigRequestHdr;
|
||||
EFI_STRING ConfigRequest;
|
||||
UINTN Size;
|
||||
BOOLEAN AllocatedRequest;
|
||||
LIST_ENTRY *StorageList;
|
||||
EFI_STRING SingleResult;
|
||||
EFI_STRING FinalResults;
|
||||
EFI_STRING StrPointer;
|
||||
|
||||
if (Request == NULL) {
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
*Progress = Request;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Data = NULL;
|
||||
StrPointer = NULL;
|
||||
SingleResult = NULL;
|
||||
FinalResults = NULL;
|
||||
ConfigAccess = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (This);
|
||||
FormSetContext = ConfigAccess->ThunkContext->FormSet;
|
||||
if (IsListEmpty (&FormSetContext->StorageListHead)) {
|
||||
//
|
||||
// No VarStorage does exist in this form.
|
||||
//
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
StorageList = GetFirstNode (&FormSetContext->StorageListHead);
|
||||
|
||||
Data = NULL;
|
||||
ConfigAccess = CONFIG_ACCESS_PRIVATE_FROM_PROTOCOL (This);
|
||||
|
||||
BufferStorage = GetStorageFromConfigString (ConfigAccess->ThunkContext->FormSet, Request);
|
||||
|
||||
if (BufferStorage == NULL) {
|
||||
*Progress = (EFI_STRING) Request;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {
|
||||
//
|
||||
// NvMapOverride is not used. Get the Storage data from EFI Variable or Framework Form Callback.
|
||||
//
|
||||
if (ConfigAccess->FormCallbackProtocol == NULL ||
|
||||
ConfigAccess->FormCallbackProtocol->NvRead == NULL) {
|
||||
Status = GetUefiVariable (
|
||||
BufferStorage,
|
||||
&Data,
|
||||
&DataSize
|
||||
);
|
||||
do {
|
||||
if (Request != NULL) {
|
||||
BufferStorage = GetStorageFromConfigString (ConfigAccess->ThunkContext->FormSet, Request);
|
||||
if (BufferStorage == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
} else {
|
||||
Status = CallFormCallBack (
|
||||
BufferStorage,
|
||||
ConfigAccess->FormCallbackProtocol,
|
||||
&Data,
|
||||
&DataSize
|
||||
);
|
||||
if (IsNull (&FormSetContext->StorageListHead, StorageList)) {
|
||||
//
|
||||
// No Storage to be extracted into the results.
|
||||
//
|
||||
break;
|
||||
}
|
||||
BufferStorage = FORMSET_STORAGE_FROM_LINK (StorageList);
|
||||
StorageList = GetNextNode (&FormSetContext->StorageListHead, StorageList);
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Use the NvMapOverride.
|
||||
//
|
||||
DataSize = BufferStorage->Size;
|
||||
Data = AllocateCopyPool (DataSize, ConfigAccess->ThunkContext->NvMapOverride);
|
||||
|
||||
if (Data != NULL) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
VarStoreName = NULL;
|
||||
ConfigRequestHdr = NULL;
|
||||
ConfigRequest = NULL;
|
||||
Size = 0;
|
||||
AllocatedRequest = FALSE;
|
||||
|
||||
if (ConfigAccess->ThunkContext->NvMapOverride == NULL) {
|
||||
//
|
||||
// NvMapOverride is not used. Get the Storage data from EFI Variable or Framework Form Callback.
|
||||
//
|
||||
if (ConfigAccess->FormCallbackProtocol == NULL ||
|
||||
ConfigAccess->FormCallbackProtocol->NvRead == NULL) {
|
||||
Status = GetUefiVariable (
|
||||
BufferStorage,
|
||||
&Data,
|
||||
&DataSize
|
||||
);
|
||||
} else {
|
||||
Status = CallFormCallBack (
|
||||
BufferStorage,
|
||||
ConfigAccess->FormCallbackProtocol,
|
||||
&Data,
|
||||
&DataSize
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Use the NvMapOverride.
|
||||
//
|
||||
DataSize = BufferStorage->Size;
|
||||
Data = AllocateCopyPool (DataSize, ConfigAccess->ThunkContext->NvMapOverride);
|
||||
|
||||
if (Data != NULL) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ConfigRequest = Request;
|
||||
if (Request == NULL || (StrStr (Request, L"OFFSET") == NULL)) {
|
||||
//
|
||||
// Request is without any request element, construct full request string.
|
||||
//
|
||||
|
||||
if ((BufferStorage->VarStoreId == FormSetContext->DefaultVarStoreId) && (FormSetContext->OriginalDefaultVarStoreName != NULL)) {
|
||||
VarStoreName = FormSetContext->OriginalDefaultVarStoreName;
|
||||
} else {
|
||||
VarStoreName = BufferStorage->Name;
|
||||
}
|
||||
|
||||
//
|
||||
// First Set ConfigRequestHdr string.
|
||||
//
|
||||
ConfigRequestHdr = HiiConstructConfigHdr (&BufferStorage->Guid, VarStoreName, ConfigAccess->ThunkContext->UefiHiiDriverHandle);
|
||||
ASSERT (ConfigRequestHdr != NULL);
|
||||
|
||||
//
|
||||
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||
//
|
||||
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
ASSERT (ConfigRequest != NULL);
|
||||
AllocatedRequest = TRUE;
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)DataSize);
|
||||
FreePool (ConfigRequestHdr);
|
||||
}
|
||||
Status = mHiiConfigRoutingProtocol->BlockToConfig (
|
||||
mHiiConfigRoutingProtocol,
|
||||
ConfigRequest,
|
||||
Data,
|
||||
DataSize,
|
||||
&SingleResult,
|
||||
Progress
|
||||
);
|
||||
//
|
||||
// Free the allocated config request string.
|
||||
//
|
||||
if (AllocatedRequest) {
|
||||
FreePool (ConfigRequest);
|
||||
ConfigRequest = NULL;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Free the allocated Data
|
||||
//
|
||||
if (Data != NULL) {
|
||||
FreePool (Data);
|
||||
}
|
||||
//
|
||||
// Directly return when meet with error
|
||||
//
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Merge result into the final results.
|
||||
//
|
||||
if (FinalResults == NULL) {
|
||||
FinalResults = SingleResult;
|
||||
SingleResult = NULL;
|
||||
} else {
|
||||
Size = StrLen (FinalResults);
|
||||
Size = Size + 1;
|
||||
Size = Size + StrLen (SingleResult) + 1;
|
||||
StrPointer = AllocateZeroPool (Size * sizeof (CHAR16));
|
||||
ASSERT (StrPointer != NULL);
|
||||
StrCpy (StrPointer, FinalResults);
|
||||
FreePool (FinalResults);
|
||||
FinalResults = StrPointer;
|
||||
StrPointer = StrPointer + StrLen (StrPointer);
|
||||
*StrPointer = L'&';
|
||||
StrCpy (StrPointer + 1, SingleResult);
|
||||
FreePool (SingleResult);
|
||||
}
|
||||
} while (Request == NULL);
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = mHiiConfigRoutingProtocol->BlockToConfig (
|
||||
mHiiConfigRoutingProtocol,
|
||||
Request,
|
||||
Data,
|
||||
DataSize,
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
*Results = FinalResults;
|
||||
} else {
|
||||
if (FinalResults != NULL) {
|
||||
FreePool (FinalResults);
|
||||
}
|
||||
}
|
||||
//
|
||||
// Set Progress string to the original request string.
|
||||
//
|
||||
if (Request == NULL) {
|
||||
*Progress = NULL;
|
||||
} else if (StrStr (Request, L"OFFSET") == NULL) {
|
||||
*Progress = Request + StrLen (Request);
|
||||
}
|
||||
|
||||
if (Data != NULL) {
|
||||
FreePool (Data);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@
|
|||
UefiLib
|
||||
PcdLib
|
||||
LanguageLib
|
||||
PrintLib
|
||||
|
||||
[Guids]
|
||||
gEfiIfrTianoGuid
|
||||
|
|
|
@ -48,6 +48,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Library/UefiLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/LanguageLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
|
||||
#include <Guid/MdeModuleHii.h>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The functions for Boot Maintainence Main menu.
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation. <BR>
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. <BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -184,25 +184,70 @@ BootMaintExtractConfig (
|
|||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
BMM_CALLBACK_DATA *Private;
|
||||
EFI_STRING ConfigRequestHdr;
|
||||
EFI_STRING ConfigRequest;
|
||||
BOOLEAN AllocatedRequest;
|
||||
UINTN Size;
|
||||
|
||||
if (Request == NULL) {
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Private = BMM_CALLBACK_DATA_FROM_THIS (This);
|
||||
*Progress = Request;
|
||||
if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mBootMaintGuid, mBootMaintStorageName)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ConfigRequestHdr = NULL;
|
||||
ConfigRequest = NULL;
|
||||
AllocatedRequest = FALSE;
|
||||
Size = 0;
|
||||
|
||||
Private = BMM_CALLBACK_DATA_FROM_THIS (This);
|
||||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
//
|
||||
BufferSize = sizeof (BMM_FAKE_NV_DATA);
|
||||
ConfigRequest = Request;
|
||||
if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
|
||||
//
|
||||
// Request has no request element, construct full request string.
|
||||
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||
//
|
||||
ConfigRequestHdr = HiiConstructConfigHdr (&mBootMaintGuid, mBootMaintStorageName, Private->BmmDriverHandle);
|
||||
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
ASSERT (ConfigRequest != NULL);
|
||||
AllocatedRequest = TRUE;
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||
FreePool (ConfigRequestHdr);
|
||||
}
|
||||
|
||||
Status = gHiiConfigRouting->BlockToConfig (
|
||||
gHiiConfigRouting,
|
||||
Request,
|
||||
ConfigRequest,
|
||||
(UINT8 *) &Private->BmmFakeNvData,
|
||||
BufferSize,
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
//
|
||||
// Free the allocated config request string.
|
||||
//
|
||||
if (AllocatedRequest) {
|
||||
FreePool (ConfigRequest);
|
||||
ConfigRequest = NULL;
|
||||
}
|
||||
//
|
||||
// Set Progress string to the original request string.
|
||||
//
|
||||
if (Request == NULL) {
|
||||
*Progress = NULL;
|
||||
} else if (StrStr (Request, L"OFFSET") == NULL) {
|
||||
*Progress = Request + StrLen (Request);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ HII_VENDOR_DEVICE_PATH mFrontPageHiiVendorDevicePath = {
|
|||
|
||||
@retval EFI_SUCCESS The Results is filled with the requested values.
|
||||
@retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
|
||||
@retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
|
||||
@retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
|
||||
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
||||
|
||||
**/
|
||||
|
@ -91,7 +91,7 @@ FakeExtractConfig (
|
|||
OUT EFI_STRING *Results
|
||||
)
|
||||
{
|
||||
if (Request == NULL || Progress == NULL || Results == NULL) {
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
*Progress = Request;
|
||||
|
@ -310,6 +310,7 @@ InitializeFrontPage (
|
|||
EFI_IFR_GUID_LABEL *StartLabel;
|
||||
EFI_IFR_GUID_LABEL *EndLabel;
|
||||
BOOLEAN FirstFlag;
|
||||
EFI_STRING_ID Temp;
|
||||
|
||||
if (InitializeHiiData) {
|
||||
//
|
||||
|
@ -424,11 +425,13 @@ InitializeFrontPage (
|
|||
GetNextLanguage (&LangCode, Lang);
|
||||
OptionCount ++;
|
||||
}
|
||||
gFrontPagePrivate.LanguageToken = AllocatePool (OptionCount * sizeof (EFI_STRING_ID));
|
||||
gFrontPagePrivate.LanguageToken = AllocatePool ((OptionCount + 1) * sizeof (EFI_STRING_ID));
|
||||
ASSERT (gFrontPagePrivate.LanguageToken != NULL);
|
||||
FirstFlag = TRUE;
|
||||
}
|
||||
|
||||
Status = gHiiString->NewString (gHiiString, HiiHandle, &Temp, "de-DE", L"Dedede", L"TEST", NULL);
|
||||
|
||||
OptionCount = 0;
|
||||
LangCode = LanguageString;
|
||||
while (*LangCode != 0) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
This is an example of how a driver might export data to the HII protocol to be
|
||||
later utilized by the Setup Protocol
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -380,9 +380,9 @@ ExtractConfig (
|
|||
UINTN ValueStrLen;
|
||||
CHAR16 BackupChar;
|
||||
CHAR16 *StrPointer;
|
||||
BOOLEAN AllocatedRequest;
|
||||
|
||||
|
||||
if (Progress == NULL || Results == NULL || Request == NULL) {
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
|
@ -392,6 +392,7 @@ ExtractConfig (
|
|||
ConfigRequest = NULL;
|
||||
Size = 0;
|
||||
*Progress = Request;
|
||||
AllocatedRequest = FALSE;
|
||||
|
||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||
HiiConfigRouting = PrivateData->HiiConfigRouting;
|
||||
|
@ -422,8 +423,9 @@ ExtractConfig (
|
|||
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||
//
|
||||
ConfigRequestHdr = HiiConstructConfigHdr (&mFormSetGuid, VariableName, PrivateData->DriverHandle[0]);
|
||||
Size = (StrLen (ConfigRequest) + 32 + 1) * sizeof (CHAR16);
|
||||
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
AllocatedRequest = TRUE;
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||
FreePool (ConfigRequestHdr);
|
||||
} else {
|
||||
|
@ -434,110 +436,140 @@ ExtractConfig (
|
|||
if (!HiiIsConfigHdrMatch (Request, &mFormSetGuid, NULL)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
ConfigRequest = Request;
|
||||
|
||||
//
|
||||
// Check if requesting Name/Value storage
|
||||
// Set Request to the unified request string.
|
||||
//
|
||||
ConfigRequest = Request;
|
||||
//
|
||||
// Check whether Request includes Request Element.
|
||||
//
|
||||
if (StrStr (Request, L"OFFSET") == NULL) {
|
||||
//
|
||||
// Update Name/Value storage Names
|
||||
// Check Request Element does exist in Reques String
|
||||
//
|
||||
Status = LoadNameValueNames (PrivateData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
StrPointer = StrStr (Request, L"PATH");
|
||||
if (StrPointer == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Allocate memory for <ConfigResp>, e.g. Name0=0x11, Name1=0x1234, Name2="ABCD"
|
||||
// <Request> ::=<ConfigHdr>&Name0&Name1&Name2
|
||||
// <ConfigResp>::=<ConfigHdr>&Name0=11&Name1=1234&Name2=0041004200430044
|
||||
//
|
||||
BufferSize = (StrLen (Request) +
|
||||
1 + sizeof (PrivateData->Configuration.NameValueVar0) * 2 +
|
||||
1 + sizeof (PrivateData->Configuration.NameValueVar1) * 2 +
|
||||
1 + sizeof (PrivateData->Configuration.NameValueVar2) * 2 + 1) * sizeof (CHAR16);
|
||||
*Results = AllocateZeroPool (BufferSize);
|
||||
ASSERT (*Results != NULL);
|
||||
StrCpy (*Results, Request);
|
||||
Value = *Results;
|
||||
|
||||
//
|
||||
// Append value of NameValueVar0, type is UINT8
|
||||
//
|
||||
if ((Value = StrStr (*Results, PrivateData->NameValueName[0])) != NULL) {
|
||||
Value += StrLen (PrivateData->NameValueName[0]);
|
||||
ValueStrLen = ((sizeof (PrivateData->Configuration.NameValueVar0) * 2) + 1);
|
||||
CopyMem (Value + ValueStrLen, Value, StrSize (Value));
|
||||
|
||||
BackupChar = Value[ValueStrLen];
|
||||
*Value++ = L'=';
|
||||
Value += UnicodeValueToString (
|
||||
Value,
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
PrivateData->Configuration.NameValueVar0,
|
||||
sizeof (PrivateData->Configuration.NameValueVar0) * 2
|
||||
);
|
||||
*Value = BackupChar;
|
||||
if (StrStr (StrPointer, L"&") == NULL) {
|
||||
Size = (StrLen (Request) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
AllocatedRequest = TRUE;
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", Request, (UINT64)BufferSize);
|
||||
}
|
||||
|
||||
//
|
||||
// Append value of NameValueVar1, type is UINT16
|
||||
//
|
||||
if ((Value = StrStr (*Results, PrivateData->NameValueName[1])) != NULL) {
|
||||
Value += StrLen (PrivateData->NameValueName[1]);
|
||||
ValueStrLen = ((sizeof (PrivateData->Configuration.NameValueVar1) * 2) + 1);
|
||||
CopyMem (Value + ValueStrLen, Value, StrSize (Value));
|
||||
|
||||
BackupChar = Value[ValueStrLen];
|
||||
*Value++ = L'=';
|
||||
Value += UnicodeValueToString (
|
||||
Value,
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
PrivateData->Configuration.NameValueVar1,
|
||||
sizeof (PrivateData->Configuration.NameValueVar1) * 2
|
||||
);
|
||||
*Value = BackupChar;
|
||||
}
|
||||
|
||||
//
|
||||
// Append value of NameValueVar2, type is CHAR16 *
|
||||
//
|
||||
if ((Value = StrStr (*Results, PrivateData->NameValueName[2])) != NULL) {
|
||||
Value += StrLen (PrivateData->NameValueName[2]);
|
||||
ValueStrLen = StrLen (PrivateData->Configuration.NameValueVar2) * 4 + 1;
|
||||
CopyMem (Value + ValueStrLen, Value, StrSize (Value));
|
||||
|
||||
*Value++ = L'=';
|
||||
//
|
||||
// Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
|
||||
//
|
||||
StrPointer = (CHAR16 *) PrivateData->Configuration.NameValueVar2;
|
||||
for (; *StrPointer != L'\0'; StrPointer++) {
|
||||
Value += UnicodeValueToString (Value, PREFIX_ZERO | RADIX_HEX, *StrPointer, 4);
|
||||
}
|
||||
}
|
||||
|
||||
Progress = (EFI_STRING *) Request + StrLen (Request);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
// Check if requesting Name/Value storage
|
||||
//
|
||||
Status = HiiConfigRouting->BlockToConfig (
|
||||
HiiConfigRouting,
|
||||
ConfigRequest,
|
||||
(UINT8 *) &PrivateData->Configuration,
|
||||
BufferSize,
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
if (StrStr (ConfigRequest, L"OFFSET") == NULL) {
|
||||
//
|
||||
// Update Name/Value storage Names
|
||||
//
|
||||
Status = LoadNameValueNames (PrivateData);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Request == NULL) {
|
||||
//
|
||||
// Allocate memory for <ConfigResp>, e.g. Name0=0x11, Name1=0x1234, Name2="ABCD"
|
||||
// <Request> ::=<ConfigHdr>&Name0&Name1&Name2
|
||||
// <ConfigResp>::=<ConfigHdr>&Name0=11&Name1=1234&Name2=0041004200430044
|
||||
//
|
||||
BufferSize = (StrLen (ConfigRequest) +
|
||||
1 + sizeof (PrivateData->Configuration.NameValueVar0) * 2 +
|
||||
1 + sizeof (PrivateData->Configuration.NameValueVar1) * 2 +
|
||||
1 + sizeof (PrivateData->Configuration.NameValueVar2) * 2 + 1) * sizeof (CHAR16);
|
||||
*Results = AllocateZeroPool (BufferSize);
|
||||
ASSERT (*Results != NULL);
|
||||
StrCpy (*Results, ConfigRequest);
|
||||
Value = *Results;
|
||||
|
||||
//
|
||||
// Append value of NameValueVar0, type is UINT8
|
||||
//
|
||||
if ((Value = StrStr (*Results, PrivateData->NameValueName[0])) != NULL) {
|
||||
Value += StrLen (PrivateData->NameValueName[0]);
|
||||
ValueStrLen = ((sizeof (PrivateData->Configuration.NameValueVar0) * 2) + 1);
|
||||
CopyMem (Value + ValueStrLen, Value, StrSize (Value));
|
||||
|
||||
BackupChar = Value[ValueStrLen];
|
||||
*Value++ = L'=';
|
||||
Value += UnicodeValueToString (
|
||||
Value,
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
PrivateData->Configuration.NameValueVar0,
|
||||
sizeof (PrivateData->Configuration.NameValueVar0) * 2
|
||||
);
|
||||
*Value = BackupChar;
|
||||
}
|
||||
|
||||
//
|
||||
// Append value of NameValueVar1, type is UINT16
|
||||
//
|
||||
if ((Value = StrStr (*Results, PrivateData->NameValueName[1])) != NULL) {
|
||||
Value += StrLen (PrivateData->NameValueName[1]);
|
||||
ValueStrLen = ((sizeof (PrivateData->Configuration.NameValueVar1) * 2) + 1);
|
||||
CopyMem (Value + ValueStrLen, Value, StrSize (Value));
|
||||
|
||||
BackupChar = Value[ValueStrLen];
|
||||
*Value++ = L'=';
|
||||
Value += UnicodeValueToString (
|
||||
Value,
|
||||
PREFIX_ZERO | RADIX_HEX,
|
||||
PrivateData->Configuration.NameValueVar1,
|
||||
sizeof (PrivateData->Configuration.NameValueVar1) * 2
|
||||
);
|
||||
*Value = BackupChar;
|
||||
}
|
||||
|
||||
//
|
||||
// Append value of NameValueVar2, type is CHAR16 *
|
||||
//
|
||||
if ((Value = StrStr (*Results, PrivateData->NameValueName[2])) != NULL) {
|
||||
Value += StrLen (PrivateData->NameValueName[2]);
|
||||
ValueStrLen = StrLen (PrivateData->Configuration.NameValueVar2) * 4 + 1;
|
||||
CopyMem (Value + ValueStrLen, Value, StrSize (Value));
|
||||
|
||||
*Value++ = L'=';
|
||||
//
|
||||
// Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
|
||||
//
|
||||
StrPointer = (CHAR16 *) PrivateData->Configuration.NameValueVar2;
|
||||
for (; *StrPointer != L'\0'; StrPointer++) {
|
||||
Value += UnicodeValueToString (Value, PREFIX_ZERO | RADIX_HEX, *StrPointer, 4);
|
||||
}
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
//
|
||||
Status = HiiConfigRouting->BlockToConfig (
|
||||
HiiConfigRouting,
|
||||
ConfigRequest,
|
||||
(UINT8 *) &PrivateData->Configuration,
|
||||
BufferSize,
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Free the allocated config request string.
|
||||
//
|
||||
if (AllocatedRequest) {
|
||||
FreePool (ConfigRequest);
|
||||
}
|
||||
//
|
||||
// Set Progress string to the original request string.
|
||||
//
|
||||
if (Request == NULL) {
|
||||
*Progress = NULL;
|
||||
} else if (StrStr (Request, L"OFFSET") == NULL) {
|
||||
*Progress = Request + StrLen (Request);
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Helper functions for configuring or getting the parameters relating to iSCSI.
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation.<BR>
|
||||
Copyright (c) 2004 - 2010, Intel Corporation.<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -360,11 +360,24 @@ IScsiFormExtractConfig (
|
|||
ISCSI_CONFIG_IFR_NVDATA *IfrNvData;
|
||||
ISCSI_FORM_CALLBACK_INFO *Private;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
EFI_STRING ConfigRequestHdr;
|
||||
EFI_STRING ConfigRequest;
|
||||
BOOLEAN AllocatedRequest;
|
||||
UINTN Size;
|
||||
|
||||
if (Request == NULL || Progress == NULL || Results == NULL) {
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*Progress = Request;
|
||||
if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mVendorGuid, mVendorStorageName)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ConfigRequestHdr = NULL;
|
||||
ConfigRequest = NULL;
|
||||
AllocatedRequest = FALSE;
|
||||
Size = 0;
|
||||
|
||||
if (!mIScsiDeviceListUpdated) {
|
||||
//
|
||||
|
@ -394,15 +407,47 @@ IScsiFormExtractConfig (
|
|||
//
|
||||
HiiConfigRouting = Private->ConfigRouting;
|
||||
BufferSize = sizeof (ISCSI_CONFIG_IFR_NVDATA);
|
||||
ConfigRequest = Request;
|
||||
if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
|
||||
//
|
||||
// Request has no request element, construct full request string.
|
||||
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||
//
|
||||
ConfigRequestHdr = HiiConstructConfigHdr (&mVendorGuid, mVendorStorageName, Private->DriverHandle);
|
||||
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
ASSERT (ConfigRequest != NULL);
|
||||
AllocatedRequest = TRUE;
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||
FreePool (ConfigRequestHdr);
|
||||
}
|
||||
Status = HiiConfigRouting->BlockToConfig (
|
||||
HiiConfigRouting,
|
||||
Request,
|
||||
ConfigRequest,
|
||||
(UINT8 *) IfrNvData,
|
||||
BufferSize,
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
FreePool (IfrNvData);
|
||||
//
|
||||
// Free the allocated config request string.
|
||||
//
|
||||
if (AllocatedRequest) {
|
||||
FreePool (ConfigRequest);
|
||||
ConfigRequest = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Set Progress string to the original request string.
|
||||
//
|
||||
if (Request == NULL) {
|
||||
*Progress = NULL;
|
||||
} else if (StrStr (Request, L"OFFSET") == NULL) {
|
||||
*Progress = Request + StrLen (Request);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -342,19 +342,32 @@ Ip4DeviceExtractConfig (
|
|||
NIC_IP4_CONFIG_INFO *IfrDeviceNvData;
|
||||
IP4_CONFIG_INSTANCE *Ip4ConfigInstance;
|
||||
IP4_CONFIG_IFR_NVDATA *IfrFormNvData;
|
||||
EFI_STRING ConfigRequestHdr;
|
||||
EFI_STRING ConfigRequest;
|
||||
EFI_STRING DeviceResult;
|
||||
EFI_STRING FormResult;
|
||||
CHAR16 *StrPointer;
|
||||
BOOLEAN AllocatedRequest;
|
||||
UINTN Size;
|
||||
UINTN BufferSize;
|
||||
|
||||
if (Request == NULL || Progress == NULL || Results == NULL) {
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*Progress = Request;
|
||||
|
||||
*Progress = Request;
|
||||
Size = 0;
|
||||
DeviceResult = NULL;
|
||||
FormResult = NULL;
|
||||
ConfigRequest = NULL;
|
||||
Status = EFI_SUCCESS;
|
||||
AllocatedRequest = FALSE;
|
||||
Ip4ConfigInstance = IP4_CONFIG_INSTANCE_FROM_CONFIG_ACCESS (This);
|
||||
|
||||
//
|
||||
// Check Request data in <ConfigHdr>.
|
||||
//
|
||||
if (HiiIsConfigHdrMatch (Request, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
|
||||
if ((Request == NULL) || HiiIsConfigHdrMatch (Request, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
|
||||
IfrDeviceNvData = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);
|
||||
if (IfrDeviceNvData == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
@ -367,21 +380,50 @@ Ip4DeviceExtractConfig (
|
|||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ConfigRequest = Request;
|
||||
if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
|
||||
//
|
||||
// Request has no request element, construct full request string.
|
||||
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||
//
|
||||
ConfigRequestHdr = HiiConstructConfigHdr (&gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE, Ip4ConfigInstance->ChildHandle);
|
||||
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
ASSERT (ConfigRequest != NULL);
|
||||
AllocatedRequest = TRUE;
|
||||
BufferSize = NIC_ITEM_CONFIG_SIZE;
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||
FreePool (ConfigRequestHdr);
|
||||
}
|
||||
|
||||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
//
|
||||
Status = gHiiConfigRouting->BlockToConfig (
|
||||
gHiiConfigRouting,
|
||||
Request,
|
||||
ConfigRequest,
|
||||
(UINT8 *) IfrDeviceNvData,
|
||||
NIC_ITEM_CONFIG_SIZE,
|
||||
Results,
|
||||
&DeviceResult,
|
||||
Progress
|
||||
);
|
||||
|
||||
FreePool (IfrDeviceNvData);
|
||||
//
|
||||
// Free the allocated config request string.
|
||||
//
|
||||
if (AllocatedRequest) {
|
||||
FreePool (ConfigRequest);
|
||||
ConfigRequest = NULL;
|
||||
}
|
||||
|
||||
} else if (HiiIsConfigHdrMatch (Request, &mNicIp4ConfigNvDataGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Failure;
|
||||
}
|
||||
}
|
||||
|
||||
if ((Request == NULL) || HiiIsConfigHdrMatch (Request, &mNicIp4ConfigNvDataGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
|
||||
|
||||
IfrFormNvData = AllocateZeroPool (NIC_ITEM_CONFIG_SIZE);
|
||||
if (IfrFormNvData == NULL) {
|
||||
|
@ -390,25 +432,80 @@ Ip4DeviceExtractConfig (
|
|||
|
||||
Ip4ConfigConvertDeviceConfigDataToIfrNvData (Ip4ConfigInstance, IfrFormNvData);
|
||||
|
||||
ConfigRequest = Request;
|
||||
if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
|
||||
//
|
||||
// Request has no request element, construct full request string.
|
||||
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||
//
|
||||
ConfigRequestHdr = HiiConstructConfigHdr (&mNicIp4ConfigNvDataGuid, EFI_NIC_IP4_CONFIG_VARIABLE, Ip4ConfigInstance->ChildHandle);
|
||||
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
ASSERT (ConfigRequest != NULL);
|
||||
AllocatedRequest = TRUE;
|
||||
BufferSize = sizeof (IP4_CONFIG_IFR_NVDATA);
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||
FreePool (ConfigRequestHdr);
|
||||
}
|
||||
|
||||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
//
|
||||
Status = gHiiConfigRouting->BlockToConfig (
|
||||
gHiiConfigRouting,
|
||||
Request,
|
||||
ConfigRequest,
|
||||
(UINT8 *) IfrFormNvData,
|
||||
sizeof (IP4_CONFIG_IFR_NVDATA),
|
||||
Results,
|
||||
&FormResult,
|
||||
Progress
|
||||
);
|
||||
|
||||
FreePool (IfrFormNvData);
|
||||
//
|
||||
// Free the allocated config request string.
|
||||
//
|
||||
if (AllocatedRequest) {
|
||||
FreePool (ConfigRequest);
|
||||
ConfigRequest = NULL;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Failure;
|
||||
}
|
||||
}
|
||||
|
||||
if (Request == NULL) {
|
||||
Size = StrLen (DeviceResult);
|
||||
Size = Size + 1;
|
||||
Size = Size + StrLen (FormResult) + 1;
|
||||
*Results = AllocateZeroPool (Size * sizeof (CHAR16));
|
||||
ASSERT (*Results != NULL);
|
||||
StrPointer = *Results;
|
||||
StrCpy (StrPointer, DeviceResult);
|
||||
StrPointer = StrPointer + StrLen (StrPointer);
|
||||
*StrPointer = L'&';
|
||||
StrCpy (StrPointer + 1, FormResult);
|
||||
FreePool (DeviceResult);
|
||||
FreePool (FormResult);
|
||||
} else if (HiiIsConfigHdrMatch (ConfigRequest, &gEfiNicIp4ConfigVariableGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
|
||||
*Results = DeviceResult;
|
||||
} else if (HiiIsConfigHdrMatch (ConfigRequest, &mNicIp4ConfigNvDataGuid, EFI_NIC_IP4_CONFIG_VARIABLE)) {
|
||||
*Results = FormResult;
|
||||
} else {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
Failure:
|
||||
//
|
||||
// Set Progress string to the original request string.
|
||||
//
|
||||
if (Request == NULL) {
|
||||
*Progress = NULL;
|
||||
} else if (StrStr (Request, L"OFFSET") == NULL) {
|
||||
*Progress = Request + StrLen (Request);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,14 +75,29 @@ VlanExtractConfig (
|
|||
OUT EFI_STRING *Results
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
VLAN_CONFIGURATION Configuration;
|
||||
EFI_STATUS Status;
|
||||
UINTN BufferSize;
|
||||
VLAN_CONFIGURATION Configuration;
|
||||
VLAN_CONFIG_PRIVATE_DATA *PrivateData;
|
||||
EFI_STRING ConfigRequestHdr;
|
||||
EFI_STRING ConfigRequest;
|
||||
BOOLEAN AllocatedRequest;
|
||||
UINTN Size;
|
||||
|
||||
if (Request == NULL) {
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*Progress = Request;
|
||||
if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mVlanFormSetGuid, mVlanStorageName)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ConfigRequestHdr = NULL;
|
||||
ConfigRequest = NULL;
|
||||
AllocatedRequest = FALSE;
|
||||
Size = 0;
|
||||
|
||||
//
|
||||
// Retrieve the pointer to the UEFI HII Config Routing Protocol
|
||||
//
|
||||
|
@ -94,16 +109,49 @@ VlanExtractConfig (
|
|||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
//
|
||||
PrivateData = VLAN_CONFIG_PRIVATE_DATA_FROM_THIS (This);
|
||||
ZeroMem (&Configuration, sizeof (VLAN_CONFIGURATION));
|
||||
BufferSize = sizeof (VLAN_CONFIG_PRIVATE_DATA);
|
||||
ConfigRequest = Request;
|
||||
if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
|
||||
//
|
||||
// Request has no request element, construct full request string.
|
||||
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||
//
|
||||
ConfigRequestHdr = HiiConstructConfigHdr (&mVlanFormSetGuid, mVlanStorageName, PrivateData->DriverHandle);
|
||||
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
ASSERT (ConfigRequest != NULL);
|
||||
AllocatedRequest = TRUE;
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||
FreePool (ConfigRequestHdr);
|
||||
}
|
||||
|
||||
Status = mHiiConfigRouting->BlockToConfig (
|
||||
mHiiConfigRouting,
|
||||
Request,
|
||||
ConfigRequest,
|
||||
(UINT8 *) &Configuration,
|
||||
BufferSize,
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
//
|
||||
// Free the allocated config request string.
|
||||
//
|
||||
if (AllocatedRequest) {
|
||||
FreePool (ConfigRequest);
|
||||
ConfigRequest = NULL;
|
||||
}
|
||||
//
|
||||
// Set Progress string to the original request string.
|
||||
//
|
||||
if (Request == NULL) {
|
||||
*Progress = NULL;
|
||||
} else if (StrStr (Request, L"OFFSET") == NULL) {
|
||||
*Progress = Request + StrLen (Request);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
4. It save all the mapping info in NV variables which will be consumed
|
||||
by platform override protocol driver to publish the platform override protocol.
|
||||
|
||||
Copyright (c) 2007 - 2009, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -1161,25 +1161,73 @@ PlatOverMngrExtractConfig (
|
|||
EFI_STATUS Status;
|
||||
EFI_CALLBACK_INFO *Private;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
EFI_STRING ConfigRequestHdr;
|
||||
EFI_STRING ConfigRequest;
|
||||
BOOLEAN AllocatedRequest;
|
||||
UINTN Size;
|
||||
UINTN BufferSize;
|
||||
|
||||
if (Progress == NULL || Results == NULL || Request == NULL) {
|
||||
if (Progress == NULL || Results == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
*Progress = Request;
|
||||
|
||||
*Progress = Request;
|
||||
if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mPlatformOverridesManagerGuid, mVariableName)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ConfigRequestHdr = NULL;
|
||||
ConfigRequest = NULL;
|
||||
Size = 0;
|
||||
AllocatedRequest = FALSE;
|
||||
|
||||
Private = EFI_CALLBACK_INFO_FROM_THIS (This);
|
||||
HiiConfigRouting = Private->HiiConfigRouting;
|
||||
ConfigRequest = Request;
|
||||
if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
|
||||
//
|
||||
// Request has no request element, construct full request string.
|
||||
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
|
||||
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
|
||||
//
|
||||
ConfigRequestHdr = HiiConstructConfigHdr (&mPlatformOverridesManagerGuid, mVariableName, Private->DriverHandle);
|
||||
Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
|
||||
ConfigRequest = AllocateZeroPool (Size);
|
||||
ASSERT (ConfigRequest != NULL);
|
||||
AllocatedRequest = TRUE;
|
||||
BufferSize = sizeof (PLAT_OVER_MNGR_DATA);
|
||||
UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
|
||||
FreePool (ConfigRequestHdr);
|
||||
}
|
||||
|
||||
//
|
||||
// Convert buffer data to <ConfigResp> by helper function BlockToConfig()
|
||||
//
|
||||
Status = HiiConfigRouting->BlockToConfig (
|
||||
HiiConfigRouting,
|
||||
Request,
|
||||
ConfigRequest,
|
||||
(UINT8 *) &Private->FakeNvData,
|
||||
sizeof (PLAT_OVER_MNGR_DATA),
|
||||
Results,
|
||||
Progress
|
||||
);
|
||||
|
||||
//
|
||||
// Free the allocated config request string.
|
||||
//
|
||||
if (AllocatedRequest) {
|
||||
FreePool (ConfigRequest);
|
||||
ConfigRequest = NULL;
|
||||
}
|
||||
//
|
||||
// Set Progress string to the original request string.
|
||||
//
|
||||
if (Request == NULL) {
|
||||
*Progress = NULL;
|
||||
} else if (StrStr (Request, L"OFFSET") == NULL) {
|
||||
*Progress = Request + StrLen (Request);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue