diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-12-16 13:09:12 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-12-16 13:09:12 +0000 |
commit | dee207ee012fdd6b9fad5240327904a6eb4ff317 (patch) | |
tree | 593990c28d072f8a9baca89c9eaf37fd8954ca82 | |
parent | 509bc208d835762c31987b00fab708c1d2ff2c5d (diff) | |
download | edk2-platforms-dee207ee012fdd6b9fad5240327904a6eb4ff317.tar.xz |
1) Keep the original Varstore Name when replacing it with L"Setup" to allow Framework HII module get variable which is saved by UEFI Setup Browser.
2) Fix a bug in UefiDefaultsToFwDefaults to correctly update the VariablePackList on output.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7045 6f19259b-4bc3-4df7-8a09-765794883524
5 files changed, 42 insertions, 26 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c index 738020aafe..6be0496c61 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/ConfigAccess.c @@ -150,13 +150,20 @@ GetStorageFromConfigString ( {
LIST_ENTRY *StorageList;
FORMSET_STORAGE *Storage;
+ CHAR16 *Name;
StorageList = GetFirstNode (&FormSet->StorageListHead);
while (!IsNull (&FormSet->StorageListHead, StorageList)) {
Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
- if (IsConfigHdrMatch (ConfigString, &Storage->Guid, Storage->Name)) {
+ if ((Storage->VarStoreId == FormSet->DefaultVarStoreId) && (FormSet->OriginalDefaultVarStoreName != NULL)) {
+ Name = FormSet->OriginalDefaultVarStoreName;
+ } else {
+ Name = Storage->Name;
+ }
+
+ if (IsConfigHdrMatch (ConfigString, &Storage->Guid, Name)) {
return Storage;
}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c index 4b190477f1..e1924791af 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrDefault.c @@ -24,8 +24,6 @@ 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.
@@ -442,14 +440,7 @@ UefiDefaultsToFwDefaults ( if (Node->DefaultId == DefaultId) {
Size += Node->Size;
- 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);
- }
+ Size += StrSize (Node->Name);
Count++;
}
@@ -480,26 +471,20 @@ UefiDefaultsToFwDefaults ( Size += Node->Size;
Size += sizeof (EFI_HII_VARIABLE_PACK);
- //
- // In UEFI, 0 is defined to be invalid for EFI_IFR_VARSTORE.VarStoreId.
- // 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 && (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->VariableNameLength = (UINT32) StrSize (Node->Name);
+
+ if (Node->StoreId == UefiFormSetDefaultVarStoreId) {
+ //
+ // The default VARSTORE in VFR from a Framework module has Varstore ID of 0.
+ //
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));
}
+ CopyMem ((UINT8 *) Pack + sizeof (EFI_HII_VARIABLE_PACK), Node->Name, StrSize (Node->Name));
Size += Pack->VariableNameLength;
+
//
// Initialize EFI_HII_VARIABLE_PACK
//
@@ -518,6 +503,9 @@ UefiDefaultsToFwDefaults ( Index++;
if (Index < Count) {
PackList->NextVariablePack = (EFI_HII_VARIABLE_PACK_LIST *)((UINT8 *) PackList + Size);
+
+ PackList = PackList->NextVariablePack;
+ Pack = (EFI_HII_VARIABLE_PACK *) (PackList + 1);
}
}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.c index 32c40f8a14..050c3c29b8 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.c @@ -403,6 +403,10 @@ DestroyFormSet ( }
DestoryOneOfOptionMap (&FormSet->OneOfOptionMapListHead);
+
+ if (FormSet->OriginalDefaultVarStoreName != NULL) {
+ FreePool (FormSet->OriginalDefaultVarStoreName);
+ }
FreePool (FormSet);
}
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.h index 4ca4c5e3bd..07265b34e4 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.h +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/UefiIfrParser.h @@ -323,6 +323,7 @@ typedef struct { // by priority rules defined in GetFormsetDefaultVarstoreId (). See the function description for details.
//
EFI_VARSTORE_ID DefaultVarStoreId;
+ CHAR16 *OriginalDefaultVarStoreName;
UINTN NumberOfStatement;
diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c index a18ef0aa09..0ad0668f72 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c @@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/DebugLib.h>
CONST EFI_GUID gZeroGuid = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
+CONST CHAR16 FrameworkReservedVarstoreName[] = FRAMEWORK_RESERVED_VARSTORE_NAME;
+
/**
Find the corressponding UEFI HII Handle from a Framework HII Handle given.
@@ -406,10 +408,12 @@ GetFormsetDefaultVarstoreId ( {
LIST_ENTRY *StorageList;
FORMSET_STORAGE *Storage;
+ FORMSET_STORAGE *DefaultStorage;
//
// VarStoreId 0 is invalid in UEFI IFR.
//
+ DefaultStorage= NULL;
FormSet->DefaultVarStoreId = 0;
StorageList = GetFirstNode (&FormSet->StorageListHead);
@@ -423,6 +427,7 @@ GetFormsetDefaultVarstoreId ( // 1) If VarStore ID of FRAMEWORK_RESERVED_VARSTORE_ID (0x01) is found, Var Store ID is used.
//
FormSet->DefaultVarStoreId = FRAMEWORK_RESERVED_VARSTORE_ID;
+ DefaultStorage = Storage;
break;
}
@@ -439,6 +444,7 @@ GetFormsetDefaultVarstoreId ( if (!IsNull (&FormSet->StorageListHead, StorageList)) {
Storage = FORMSET_STORAGE_FROM_LINK (StorageList);
FormSet->DefaultVarStoreId = Storage->VarStoreId;
+ DefaultStorage = Storage;
}
}
@@ -447,7 +453,17 @@ GetFormsetDefaultVarstoreId ( if (FormSet->DefaultVarStoreId == 0) {
DEBUG ((EFI_D_INFO, "FormSet %g: No Varstore Found\n", &FormSet->Guid));
} else {
- DEBUG ((EFI_D_INFO, "FormSet %g: Default Varstore ID is %x\n", &FormSet->Guid, FormSet->DefaultVarStoreId));
+ // 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.
+
+ DEBUG ((EFI_D_INFO, "FormSet %g: Default Varstore ID (0x%x) N(%s) G(%g)\n", &FormSet->Guid, FormSet->DefaultVarStoreId, DefaultStorage->Name, &DefaultStorage->Guid));
+
+ if (StrCmp (DefaultStorage->Name, FrameworkReservedVarstoreName) != 0) {
+ DEBUG ((EFI_D_INFO, " : Name is updated from %s to %s.\n", DefaultStorage->Name, FrameworkReservedVarstoreName));
+ FormSet->OriginalDefaultVarStoreName = DefaultStorage->Name;
+ DefaultStorage->Name = AllocateCopyPool (StrSize (FrameworkReservedVarstoreName), FrameworkReservedVarstoreName);
+ }
}
DEBUG_CODE_END ();
|