summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-12-16 05:27:24 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-12-16 05:27:24 +0000
commit73d1dcbb46137ad9e5831991204656a9862cb176 (patch)
tree66cfffcac05a58fd47258d3b309f2c96d450c849
parentdfc1f033eadc0110006698797925f7060a251f10 (diff)
downloadedk2-73d1dcbb46137ad9e5831991204656a9862cb176.zip
edk2-73d1dcbb46137ad9e5831991204656a9862cb176.tar.gz
edk2-73d1dcbb46137ad9e5831991204656a9862cb176.tar.bz2
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
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h13
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c38
-rw-r--r--EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c10
3 files changed, 38 insertions, 23 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
index b2f35eb..64a6b3b 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h
@@ -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)
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c
index 34d6cba..4b19047 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c
@@ -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);
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c
index ca5ecbf..a18ef0a 100644
--- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c
+++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c
@@ -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);