IntelFrameworkModulePkg/LegacyUi: Get legacy options when open legacy form

The LegacyBootMaintUiLib depends on the LegacyBootManagerLib to realize its
functionality, the LegacyBootManagerLib may initialize after
LegacyBootMaintUiLib, so the functionality of LegacyBootMaintUiLib may
be incorrect. Now we fix this issue by executing the related codes when
opening the legacy forminstead in its the constructor function. Because
when opening the legacy form, the LegacyBootManagerLib must have been
initialized.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Dandan Bi 2016-07-07 10:58:14 +08:00 committed by Star Zeng
parent 984cb6462a
commit 1c03582b07
1 changed files with 38 additions and 6 deletions

View File

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