EFI_GUID mLegacyBootOptionGuid = LEGACY_BOOT_OPTION_FORMSET_GUID;\r
CHAR16 mLegacyBootStorageName[] = L"LegacyBootData";\r
BBS_TYPE mBbsType[] = {BBS_FLOPPY, BBS_HARDDISK, BBS_CDROM, BBS_EMBED_NETWORK, BBS_BEV_DEVICE, BBS_UNKNOWN};\r
+BOOLEAN mFirstEnterLegacyForm = FALSE;\r
\r
\r
///\r
}\r
};\r
\r
+/**\r
+\r
+ Build the LegacyFDMenu LegacyHDMenu LegacyCDMenu according to LegacyBios.GetBbsInfo().\r
+\r
+**/\r
+VOID\r
+GetLegacyOptions (\r
+ VOID\r
+ );\r
+\r
+\r
+/**\r
+\r
+ Base on the L"LegacyDevOrder" variable to build the current order data.\r
+\r
+**/\r
+VOID\r
+GetLegacyOptionsOrder (\r
+ VOID\r
+ );\r
\r
/**\r
Re-order the Boot Option according to the DevOrder.\r
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
)\r
{\r
- if (Action != EFI_BROWSER_ACTION_CHANGED && Action != EFI_BROWSER_ACTION_CHANGING) {\r
+ if (Action != EFI_BROWSER_ACTION_CHANGED && Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_FORM_OPEN) {\r
//\r
- // Do nothing for other UEFI Action. Only do call back when data is changed.\r
+ // Do nothing for other UEFI Action. Only do call back when data is changed or the form is open.\r
//\r
return EFI_UNSUPPORTED;\r
}\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
+ if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {\r
+ if (QuestionId == FORM_FLOPPY_BOOT_ID) {\r
+ if (!mFirstEnterLegacyForm) {\r
+ //\r
+ // The leagcyBootMaintUiLib depends on the LegacyBootManagerLib to realize its functionality.\r
+ // We need to do the leagcy boot options related actions after the LegacyBootManagerLib has been initialized.\r
+ // Opening the legacy menus is the appropriate time that the LegacyBootManagerLib has already been initialized.\r
+ //\r
+ mFirstEnterLegacyForm = TRUE;\r
+ GetLegacyOptions ();\r
+ GetLegacyOptionsOrder ();\r
+ }\r
+ }\r
+ }\r
+\r
if (Action == EFI_BROWSER_ACTION_CHANGING) {\r
switch (QuestionId) {\r
case FORM_FLOPPY_BOOT_ID:\r
ASSERT (LegacyBootOptionData->HiiHandle != NULL);\r
\r
mLegacyBootOptionPrivate = LegacyBootOptionData;\r
-\r
- GetLegacyOptions ();\r
-\r
- GetLegacyOptionsOrder();\r
}\r
\r
return EFI_SUCCESS;\r