//\r
// If Packages->GuidId is NULL, the caller of FramworkHii->NewPack is registering\r
// packages with at least 1 StringPack and 1 IfrPack. Therefore, Packages->GuidId is\r
- // not used as the name of the package list. A GUID is generated as a Package List\r
+ // not used as the name of the package list. Formset GUID is used as the Package List\r
// GUID.\r
//\r
ASSERT (StringPackageCount >=1 && IfrPackageCount == 1);\r
\r
//\r
// UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so\r
- // that Setup Utility can load the Buffer Storage using this protocol.\r
+ // that Setup Utility can load the Buffer Storage using this protocol. An UEFI VFR can only\r
+ // produce IFR package generated with Buffer Storage type and EFI Variable Storage.\r
+ // The default EFI_HII_CONFIG_ACCESS_PROTOCOL is used to Get/Set the Buffer Storage.\r
//\r
if (IfrPackageCount != 0) {\r
InstallDefaultConfigAccessProtocol (Packages, ThunkContext);\r
if (IfrPackageCount == 0) {\r
if (StringPackageCount != 0) {\r
//\r
- // Look for a Package List with only IFR Package with the same GUID name.\r
- // If found one, add the String Packages to it.\r
+ // Look for a Package List with only IFR Package with the same TAG GUID name.\r
+ // If found one, add the String Packages to the found Package List.\r
+ // This is needed because Framework HII Module may not register the String Package\r
+ // and IFR Package in one NewPack () call.\r
//\r
UpdatePackListWithOnlyIfrPack (\r
Private,\r
);\r
}\r
} else {\r
- CreateQuestionIdMap (ThunkContext);\r
- \r
if (StringPackageCount == 0) {\r
//\r
- // Register the Package List to UEFI HII first.\r
+ // Look for the String Package with the same TAG GUID name and add\r
+ // the found String Package to this Package List.\r
+ // This is needed because Framework HII Module may not register the String Package\r
+ // and IFR Package in one NewPack () call.\r
//\r
Status = FindStringPackAndUpdatePackListWithOnlyIfrPack (\r
Private,\r
goto Done;\r
}\r
}\r
+ \r
+ //\r
+ // Parse the Formset. Must be called after FindStringPackAndUpdatePackListWithOnlyIfrPack is called so\r
+ // that String Package is ready.\r
+ //\r
+ ThunkContext->FormSet = ParseFormSet (ThunkContext->UefiHiiHandle);\r
+ ASSERT (ThunkContext->FormSet != NULL);\r
+ \r
}\r
\r
Done:\r
}\r
\r
\r
+/**\r
+\r
+ Registers the various packages that are passed in a Package List.\r
+\r
+ @param This Pointer of Frameowk HII protocol instance.\r
+ @param Packages Pointer of HII packages.\r
+ @param Handle Handle value to be returned.\r
+\r
+ @retval EFI_SUCCESS Pacakges has added to HII database successfully.\r
+ @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
HiiNewPack (\r
IN EFI_HII_PACKAGES *Packages,\r
OUT FRAMEWORK_EFI_HII_HANDLE *Handle\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Extracts the various packs from a package list.\r
-\r
-Arguments:\r
-\r
- This - Pointer of HII protocol.\r
- Packages - Pointer of HII packages.\r
- Handle - Handle value to be returned.\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Pacakges has added to HII database successfully.\r
- EFI_INVALID_PARAMETER - Invalid parameter.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
HII_THUNK_PRIVATE_DATA *Private;\r
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
\r
//\r
- // We use a simple Global variable to inform NewPackNotify\r
+ // We use a simple Global variable to inform NewOrAddPackNotify()\r
// that the package list registered here is already registered\r
- // in the HII Thunk Layer. So NewPackNotify does not need to\r
- // call RegisterUefiHiiHandle () to registered it.\r
+ // in the HII Thunk Layer. So NewOrAddPackNotify () does not need to\r
+ // call registered the Package List again.\r
//\r
mInFrameworkHiiNewPack = TRUE;\r
\r
return Status;\r
}\r
\r
+/**\r
+\r
+ Remove a package from the HII database.\r
+\r
+ @param This Pointer of Frameowk HII protocol instance.\r
+ @param Handle Handle value to be removed.\r
+\r
+ @retval EFI_SUCCESS Pacakges has added to HII database successfully.\r
+ @retval EFI_INVALID_PARAMETER If Handle or Packages is NULL.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
HiiRemovePack (\r
IN EFI_HII_PROTOCOL *This,\r
IN FRAMEWORK_EFI_HII_HANDLE Handle\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Removes the various packs from a Handle\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
- HII_THUNK_PRIVATE_DATA *Private;\r
- HII_THUNK_CONTEXT *ThunkContext;\r
+ HII_THUNK_PRIVATE_DATA *Private;\r
+ HII_THUNK_CONTEXT *ThunkContext;\r
EFI_TPL OldTpl;\r
\r
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);\r
return Status;\r
}\r
\r
+/**\r
+ This notification function will be called when a Package List is registered\r
+ using UEFI HII interface. The Package List registered need to be recorded in\r
+ Framework Thunk module as Thunk Module may need to look for String Package in\r
+ the package registered.\r
+\r
+ If the Package List registered is not either Sting Package or IFR package, \r
+ then ASSERT. If the NotifyType is not ADD_PACK or NEW_PACK, then ASSERT.\r
+ Both cases means UEFI HII Database itself is buggy. \r
+\r
+ @param PackageType The Package Type.\r
+ @param PackageGuid The Package GUID.\r
+ @param Package The Package Header.\r
+ @param Handle The HII Handle of this Package List.\r
+ @param NotifyType The reason of the notification. \r
+\r
+ @retval EFI_SUCCESS The notification function is successful.\r
+ \r
+**/\r
EFI_STATUS\r
EFIAPI\r
NewOrAddPackNotify (\r
}\r
\r
//\r
- // We only create a ThunkContext if the Uefi Hii Handle is only already registered\r
- // by the HII Thunk Layer.\r
+ // We will create a ThunkContext to log the package list only if the\r
+ // package is not registered with by Framework HII Thunk module yet.\r
//\r
ThunkContext = UefiHiiHandleToThunkContext (Private, Handle);\r
if (ThunkContext == NULL) {\r
} \r
\r
if (PackageType == EFI_HII_PACKAGE_FORMS) {\r
- GetAttributesOfFirstFormSet (ThunkContext);\r
+ if (ThunkContext->FormSet != NULL) {\r
+ DestroyFormSet (ThunkContext->FormSet);\r
+ }\r
+\r
+ //\r
+ // Reparse the FormSet.\r
+ //\r
+ ThunkContext->FormSet = ParseFormSet (ThunkContext->UefiHiiHandle);\r
+ ASSERT (ThunkContext->FormSet != NULL);\r
}\r
\r
return Status; \r
}\r
\r
-//\r
-// Framework HII module may cache a GUID as the name of the package list.\r
-// Then search for the Framework HII handle database for the handle matching\r
-// this GUID\r
+/**\r
+ This notification function will be called when a Package List is removed\r
+ using UEFI HII interface. The Package List removed need to be removed from\r
+ Framework Thunk module too.\r
+\r
+ If the Package List registered is not Sting Package, \r
+ then ASSERT. If the NotifyType is not REMOVE_PACK, then ASSERT.\r
+ Both cases means UEFI HII Database itself is buggy. \r
+\r
+ @param PackageType The Package Type.\r
+ @param PackageGuid The Package GUID.\r
+ @param Package The Package Header.\r
+ @param Handle The HII Handle of this Package List.\r
+ @param NotifyType The reason of the notification. \r
\r
+ @retval EFI_SUCCESS The notification function is successful.\r
+ \r
+**/\r
EFI_STATUS\r
EFIAPI\r
RemovePackNotify (\r