mirror of https://github.com/acidanthera/audk.git
Add in code to convert the Default VarStore name to be L"Setup" based on Framework HII's assumption.
VARSTORE ID of 0 for Buffer Storage Type Storage is defined as invalid in UEFI 2.1 HII. VARSTORE ID 0 is the default VarStore ID for storage without explicit declaration in Framework HII 0.92. EDK II UEFI VFR compiler in compatible mode will assign 0x0001 as UEFI VARSTORE ID to this default storage id in Framework VFR without VARSTORE declaration. In addition, the Name of Default VarStore is assumed to be L"Setup" for those storage without explicit VARSTORE declaration in the formset by Framework HII. EDK II UEFI VFR compiler in compatible mode hard-coded L"Setup" as VARSTORE name. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7040 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
dfc1f033ea
commit
73d1dcbb46
|
@ -55,13 +55,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
|
||||
//
|
||||
// VARSTORE ID of 0 for Buffer Storage Type Storage is reserved in UEFI IFR form. But VARSTORE ID
|
||||
// 0 in Framework IFR is the default VarStore ID for storage without explicit declaration. So we have
|
||||
// to reseved 0x0001 in UEFI VARSTORE ID to represetn default storage id in Framework IFR.
|
||||
// Framework VFR has to be ported or pre-processed to change the default VARSTORE to a VARSTORE
|
||||
// with ID equal to 0x0001.
|
||||
// VARSTORE ID of 0 for Buffer Storage Type Storage is defined as invalid in UEFI 2.1 HII. VARSTORE ID
|
||||
// 0 is the default VarStore ID for storage without explicit declaration in Framework HII 0.92. EDK II UEFI VFR compiler
|
||||
// in compatible mode will assign 0x0001 as UEFI VARSTORE ID to this default storage id in Framework VFR without
|
||||
// VARSTORE declaration.
|
||||
//
|
||||
// In addition, the Name of Default VarStore is assumed to be L"Setup" for those storage without explicit VARSTORE declaration in the formset
|
||||
// by Framework HII. EDK II UEFI VFR compiler in compatible mode hard-coded L"Setup" as VARSTORE name.
|
||||
//
|
||||
#define FRAMEWORK_RESERVED_VARSTORE_ID 0x0001
|
||||
#define FRAMEWORK_RESERVED_VARSTORE_NAME L"Setup"
|
||||
|
||||
|
||||
#pragma pack (1)
|
||||
|
|
|
@ -12,18 +12,6 @@
|
|||
|
||||
**/
|
||||
|
||||
|
||||
#include <FrameworkDxe.h>
|
||||
|
||||
#include <Protocol/FrameworkHii.h>
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
#include "HiiDatabase.h"
|
||||
#include "UefiIfrParser.h"
|
||||
#include "UefiIfrDefault.h"
|
||||
|
@ -36,6 +24,8 @@ extern CONST EFI_HII_IMAGE_PROTOCOL *mHiiImageProtocol;
|
|||
extern CONST EFI_HII_STRING_PROTOCOL *mHiiStringProtocol;
|
||||
extern CONST EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRoutingProtocol;
|
||||
|
||||
CHAR16 FrameworkReservedVarstoreName[] = FRAMEWORK_RESERVED_VARSTORE_NAME;
|
||||
|
||||
/**
|
||||
Set the data position at Offset with Width in Node->Buffer based
|
||||
the value passed in.
|
||||
|
@ -452,7 +442,14 @@ UefiDefaultsToFwDefaults (
|
|||
|
||||
if (Node->DefaultId == DefaultId) {
|
||||
Size += Node->Size;
|
||||
Size += StrSize (Node->Name);
|
||||
if ((Node->StoreId == UefiFormSetDefaultVarStoreId) && (StrCmp (FrameworkReservedVarstoreName, Node->Name) != 0)) {
|
||||
// The name of default VARSTORE with a Explicit declaration statement will be updated to L"Setup" to make sure
|
||||
// the Framework HII Setup module will run correctly. Framework HII Setup module always assumed that default
|
||||
// VARSTORE to have L"Setup" as name, Formset GUID as GUID.
|
||||
Size += StrSize (FrameworkReservedVarstoreName);
|
||||
} else {
|
||||
Size += StrSize (Node->Name);
|
||||
}
|
||||
|
||||
Count++;
|
||||
}
|
||||
|
@ -481,7 +478,6 @@ UefiDefaultsToFwDefaults (
|
|||
Size = 0;
|
||||
if (Node->DefaultId == DefaultId) {
|
||||
Size += Node->Size;
|
||||
Size += StrSize (Node->Name);
|
||||
Size += sizeof (EFI_HII_VARIABLE_PACK);
|
||||
|
||||
//
|
||||
|
@ -489,20 +485,28 @@ UefiDefaultsToFwDefaults (
|
|||
// So the default storage of Var Store in VFR from a Framework module
|
||||
// should be translated to the default Varstore ID.
|
||||
//
|
||||
if (Node->StoreId == UefiFormSetDefaultVarStoreId) {
|
||||
if (Node->StoreId == UefiFormSetDefaultVarStoreId && (StrCmp (FrameworkReservedVarstoreName, Node->Name) != 0)) {
|
||||
// The name of default VARSTORE with a Explicit declaration statement will be updated to L"Setup" to make sure
|
||||
// the Framework HII Setup module will run correctly. Framework HII Setup module always assumed that default
|
||||
// VARSTORE to have L"Setup" as name, Formset GUID as GUID.
|
||||
Pack->VariableId = 0;
|
||||
Pack->VariableNameLength = (UINT32) StrSize (FrameworkReservedVarstoreName);
|
||||
CopyMem ((UINT8 *) Pack + sizeof (EFI_HII_VARIABLE_PACK), FrameworkReservedVarstoreName, StrSize (FrameworkReservedVarstoreName));
|
||||
DEBUG ((EFI_D_INFO, "VarstoreID: %x; Name: %s -> %s.\n", UefiFormSetDefaultVarStoreId, Node->Name, FrameworkReservedVarstoreName));
|
||||
} else {
|
||||
Pack->VariableId = Node->StoreId;
|
||||
Pack->VariableNameLength = (UINT32) StrSize (Node->Name);
|
||||
CopyMem ((UINT8 *) Pack + sizeof (EFI_HII_VARIABLE_PACK), Node->Name, StrSize (Node->Name));
|
||||
}
|
||||
|
||||
Size += Pack->VariableNameLength;
|
||||
//
|
||||
// Initialize EFI_HII_VARIABLE_PACK
|
||||
//
|
||||
Pack->Header.Type = 0;
|
||||
Pack->Header.Length = (UINT32) Size;
|
||||
Pack->VariableNameLength = (UINT32) StrSize (Node->Name);
|
||||
CopyMem (&Pack->VariableGuid, &Node->Guid, sizeof (EFI_GUID));
|
||||
|
||||
CopyMem ((UINT8 *) Pack + sizeof (EFI_HII_VARIABLE_PACK), Node->Name, StrSize (Node->Name));
|
||||
CopyMem ((UINT8 *) Pack + sizeof (EFI_HII_VARIABLE_PACK) + Pack->VariableNameLength, Node->Buffer, Node->Size);
|
||||
|
||||
Size += sizeof (EFI_HII_VARIABLE_PACK_LIST);
|
||||
|
|
|
@ -416,9 +416,12 @@ GetFormsetDefaultVarstoreId (
|
|||
while (!IsNull (&FormSet->StorageListHead, StorageList)) {
|
||||
Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
|
||||
|
||||
DEBUG ((EFI_D_INFO, "FormSet %g: Found Varstore ID %x\n", &FormSet->Guid, Storage->VarStoreId));
|
||||
DEBUG ((EFI_D_INFO, "FormSet %g: Found Varstore ID %x Name %s Size 0x%x\n", &FormSet->Guid, Storage->VarStoreId, Storage->Name, Storage->Size));
|
||||
|
||||
if (Storage->VarStoreId == FRAMEWORK_RESERVED_VARSTORE_ID) {
|
||||
//
|
||||
// 1) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID (0x01) is found, Var Store ID is used.
|
||||
//
|
||||
FormSet->DefaultVarStoreId = FRAMEWORK_RESERVED_VARSTORE_ID;
|
||||
break;
|
||||
}
|
||||
|
@ -427,6 +430,11 @@ GetFormsetDefaultVarstoreId (
|
|||
}
|
||||
|
||||
if (FormSet->DefaultVarStoreId != FRAMEWORK_RESERVED_VARSTORE_ID) {
|
||||
//
|
||||
//
|
||||
// 2) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID is not found, First Var Store ID is used
|
||||
// as the default Var Store ID.
|
||||
//
|
||||
StorageList = GetFirstNode (&FormSet->StorageListHead);
|
||||
if (!IsNull (&FormSet->StorageListHead, StorageList)) {
|
||||
Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
|
||||
|
|
Loading…
Reference in New Issue