mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-24 06:04:52 +02:00
Bug fix for "Tiano BIOS needs to implement an automatic reboot when BIOS settings are changed"
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1913 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
99125b466d
commit
9e0e49fc76
@ -1230,6 +1230,7 @@ Returns:
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
BM_MENU_ENTRY *NewMenuEntry;
|
BM_MENU_ENTRY *NewMenuEntry;
|
||||||
BM_FILE_CONTEXT *NewFileContext;
|
BM_FILE_CONTEXT *NewFileContext;
|
||||||
|
BOOLEAN BootMaintMenuResetRequired;
|
||||||
|
|
||||||
Location = NULL;
|
Location = NULL;
|
||||||
Index = 0;
|
Index = 0;
|
||||||
@ -1247,6 +1248,7 @@ Returns:
|
|||||||
while (1) {
|
while (1) {
|
||||||
UpdatePageId (CallbackData, FORM_MAIN_ID);
|
UpdatePageId (CallbackData, FORM_MAIN_ID);
|
||||||
|
|
||||||
|
BootMaintMenuResetRequired = FALSE;
|
||||||
Status = FormConfig->SendForm (
|
Status = FormConfig->SendForm (
|
||||||
FormConfig,
|
FormConfig,
|
||||||
TRUE,
|
TRUE,
|
||||||
@ -1256,9 +1258,13 @@ Returns:
|
|||||||
NULL,
|
NULL,
|
||||||
(UINT8 *) CallbackData->BmmFakeNvData,
|
(UINT8 *) CallbackData->BmmFakeNvData,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
&BootMaintMenuResetRequired
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (BootMaintMenuResetRequired) {
|
||||||
|
EnableResetRequired ();
|
||||||
|
}
|
||||||
|
|
||||||
ReclaimStringDepository ();
|
ReclaimStringDepository ();
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1267,6 +1273,7 @@ Returns:
|
|||||||
if (INACTIVE_STATE != CallbackData->FeCurrentState) {
|
if (INACTIVE_STATE != CallbackData->FeCurrentState) {
|
||||||
UpdateFileExplorer (CallbackData, 0);
|
UpdateFileExplorer (CallbackData, 0);
|
||||||
|
|
||||||
|
BootMaintMenuResetRequired = FALSE;
|
||||||
Status = FormConfig->SendForm (
|
Status = FormConfig->SendForm (
|
||||||
FormConfig,
|
FormConfig,
|
||||||
TRUE,
|
TRUE,
|
||||||
@ -1276,9 +1283,13 @@ Returns:
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
&BootMaintMenuResetRequired
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (BootMaintMenuResetRequired) {
|
||||||
|
EnableResetRequired ();
|
||||||
|
}
|
||||||
|
|
||||||
CallbackData->FeCurrentState = INACTIVE_STATE;
|
CallbackData->FeCurrentState = INACTIVE_STATE;
|
||||||
CallbackData->FeDisplayContext = UNKNOWN_CONTEXT;
|
CallbackData->FeDisplayContext = UNKNOWN_CONTEXT;
|
||||||
ReclaimStringDepository ();
|
ReclaimStringDepository ();
|
||||||
|
@ -139,6 +139,7 @@ Returns:
|
|||||||
UINT8 *Location;
|
UINT8 *Location;
|
||||||
EFI_GUID BmGuid;
|
EFI_GUID BmGuid;
|
||||||
LIST_ENTRY BdsBootOptionList;
|
LIST_ENTRY BdsBootOptionList;
|
||||||
|
BOOLEAN BootMngrMenuResetRequired;
|
||||||
|
|
||||||
gOption = NULL;
|
gOption = NULL;
|
||||||
InitializeListHead (&BdsBootOptionList);
|
InitializeListHead (&BdsBootOptionList);
|
||||||
@ -299,13 +300,34 @@ Returns:
|
|||||||
|
|
||||||
ASSERT (gBrowser);
|
ASSERT (gBrowser);
|
||||||
|
|
||||||
gBrowser->SendForm (gBrowser, TRUE, &gBootManagerHandle, 1, NULL, NULL, NULL, NULL, NULL);
|
BootMngrMenuResetRequired = FALSE;
|
||||||
|
gBrowser->SendForm (
|
||||||
|
gBrowser,
|
||||||
|
TRUE,
|
||||||
|
&gBootManagerHandle,
|
||||||
|
1,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
&BootMngrMenuResetRequired
|
||||||
|
);
|
||||||
|
|
||||||
|
if (BootMngrMenuResetRequired) {
|
||||||
|
EnableResetRequired ();
|
||||||
|
}
|
||||||
|
|
||||||
Hii->ResetStrings (Hii, gBootManagerHandle);
|
Hii->ResetStrings (Hii, gBootManagerHandle);
|
||||||
|
|
||||||
if (gOption == NULL) {
|
if (gOption == NULL) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//Will leave browser, check any reset required change is applied? if yes, reset system
|
||||||
|
//
|
||||||
|
SetupResetReminder ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// BugBug: This code looks repeated from the BDS. Need to save code space.
|
// BugBug: This code looks repeated from the BDS. Need to save code space.
|
||||||
//
|
//
|
||||||
|
@ -197,6 +197,7 @@ Returns:
|
|||||||
UINTN VideoOptionSize;
|
UINTN VideoOptionSize;
|
||||||
EFI_HII_HANDLE *HiiHandles;
|
EFI_HII_HANDLE *HiiHandles;
|
||||||
UINT16 HandleBufferLength;
|
UINT16 HandleBufferLength;
|
||||||
|
BOOLEAN BootDeviceMngrMenuResetRequired;
|
||||||
|
|
||||||
IfrOptionList = NULL;
|
IfrOptionList = NULL;
|
||||||
VideoOption = NULL;
|
VideoOption = NULL;
|
||||||
@ -435,6 +436,7 @@ Returns:
|
|||||||
gBS->FreePool (IfrOptionList);
|
gBS->FreePool (IfrOptionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BootDeviceMngrMenuResetRequired = FALSE;
|
||||||
Status = gBrowser->SendForm (
|
Status = gBrowser->SendForm (
|
||||||
gBrowser,
|
gBrowser,
|
||||||
TRUE, // Use the database
|
TRUE, // Use the database
|
||||||
@ -444,9 +446,13 @@ Returns:
|
|||||||
FPCallbackInfo.CallbackHandle,
|
FPCallbackInfo.CallbackHandle,
|
||||||
(UINT8 *) &FPCallbackInfo.Data,
|
(UINT8 *) &FPCallbackInfo.Data,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
&BootDeviceMngrMenuResetRequired
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (BootDeviceMngrMenuResetRequired) {
|
||||||
|
EnableResetRequired ();
|
||||||
|
}
|
||||||
|
|
||||||
Hii->ResetStrings (Hii, FPCallbackInfo.DevMgrHiiHandle);
|
Hii->ResetStrings (Hii, FPCallbackInfo.DevMgrHiiHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -454,6 +460,7 @@ Returns:
|
|||||||
// a target to display
|
// a target to display
|
||||||
//
|
//
|
||||||
if (gCallbackKey != 0 && gCallbackKey < 0x2000) {
|
if (gCallbackKey != 0 && gCallbackKey < 0x2000) {
|
||||||
|
BootDeviceMngrMenuResetRequired = FALSE;
|
||||||
Status = gBrowser->SendForm (
|
Status = gBrowser->SendForm (
|
||||||
gBrowser,
|
gBrowser,
|
||||||
TRUE, // Use the database
|
TRUE, // Use the database
|
||||||
@ -463,9 +470,12 @@ Returns:
|
|||||||
NULL, // This is the handle that the interface to the callback was installed on
|
NULL, // This is the handle that the interface to the callback was installed on
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
&BootDeviceMngrMenuResetRequired
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (BootDeviceMngrMenuResetRequired) {
|
||||||
|
EnableResetRequired ();
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Force return to Device Manager
|
// Force return to Device Manager
|
||||||
//
|
//
|
||||||
|
@ -417,6 +417,7 @@ Returns:
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT8 FakeNvRamMap[1];
|
UINT8 FakeNvRamMap[1];
|
||||||
|
BOOLEAN FrontPageMenuResetRequired;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Begin waiting for USER INPUT
|
// Begin waiting for USER INPUT
|
||||||
@ -427,6 +428,7 @@ Returns:
|
|||||||
);
|
);
|
||||||
|
|
||||||
FakeNvRamMap[0] = (UINT8) mLastSelection;
|
FakeNvRamMap[0] = (UINT8) mLastSelection;
|
||||||
|
FrontPageMenuResetRequired = FALSE;
|
||||||
Status = gBrowser->SendForm (
|
Status = gBrowser->SendForm (
|
||||||
gBrowser,
|
gBrowser,
|
||||||
TRUE, // Use the database
|
TRUE, // Use the database
|
||||||
@ -436,8 +438,14 @@ Returns:
|
|||||||
FrontPageCallbackHandle, // This is the handle that the interface to the callback was installed on
|
FrontPageCallbackHandle, // This is the handle that the interface to the callback was installed on
|
||||||
FakeNvRamMap,
|
FakeNvRamMap,
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
&FrontPageMenuResetRequired
|
||||||
);
|
);
|
||||||
|
//
|
||||||
|
// Check whether user change any option setting which needs a reset to be effective
|
||||||
|
//
|
||||||
|
if (FrontPageMenuResetRequired) {
|
||||||
|
EnableResetRequired ();
|
||||||
|
}
|
||||||
|
|
||||||
Hii->ResetStrings (Hii, gFrontPageHandle);
|
Hii->ResetStrings (Hii, gFrontPageHandle);
|
||||||
|
|
||||||
@ -877,6 +885,11 @@ Returns:
|
|||||||
|
|
||||||
} while ((Status == EFI_SUCCESS) && (gCallbackKey != 1));
|
} while ((Status == EFI_SUCCESS) && (gCallbackKey != 1));
|
||||||
|
|
||||||
|
//
|
||||||
|
//Will leave browser, check any reset required change is applied? if yes, reset system
|
||||||
|
//
|
||||||
|
SetupResetReminder ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Automatically load current entry
|
// Automatically load current entry
|
||||||
// Note: The following lines of code only execute when Auto boot
|
// Note: The following lines of code only execute when Auto boot
|
||||||
|
@ -59,6 +59,11 @@ extern EFI_HANDLE mBdsImageHandle;
|
|||||||
#define MIN_ALIGNMENT_SIZE 4
|
#define MIN_ALIGNMENT_SIZE 4
|
||||||
#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
|
#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define maximum characters for boot option variable "BootXXXX"
|
||||||
|
//
|
||||||
|
#define BOOT_OPTION_MAX_CHAR 10
|
||||||
|
|
||||||
//
|
//
|
||||||
// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.
|
// This data structure is the part of BDS_CONNECT_ENTRY that we can hard code.
|
||||||
//
|
//
|
||||||
@ -329,4 +334,49 @@ BdsRefreshBbsTableForBoot (
|
|||||||
IN BDS_COMMON_OPTION *Entry
|
IN BDS_COMMON_OPTION *Entry
|
||||||
);
|
);
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
BdsDeleteBootOption (
|
||||||
|
IN UINTN OptionNumber,
|
||||||
|
IN OUT UINT16 *BootOrder,
|
||||||
|
IN OUT UINTN *BootOrderSize
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
//The interface functions relate with Setup Browser Reset Reminder feature
|
||||||
|
//
|
||||||
|
VOID
|
||||||
|
EnableResetReminderFeature (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DisableResetReminderFeature (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EnableResetRequired (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DisableResetRequired (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsResetReminderFeatureEnable (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsResetRequired (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetupResetReminder (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
#endif // _BDS_LIB_H_
|
#endif // _BDS_LIB_H_
|
||||||
|
@ -19,6 +19,9 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
|
#define MAX_STRING_LEN 200
|
||||||
|
static BOOLEAN mFeaturerSwitch = TRUE;
|
||||||
|
static BOOLEAN mResetRequired = FALSE;
|
||||||
extern UINT16 gPlatformBootTimeOutDefault;
|
extern UINT16 gPlatformBootTimeOutDefault;
|
||||||
|
|
||||||
UINT16
|
UINT16
|
||||||
@ -762,3 +765,218 @@ Returns:
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.
|
||||||
|
// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if
|
||||||
|
// user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
|
||||||
|
//
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EnableResetReminderFeature (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Enable the setup browser reset reminder feature.
|
||||||
|
This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
mFeaturerSwitch = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DisableResetReminderFeature (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Disable the setup browser reset reminder feature.
|
||||||
|
This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
mFeaturerSwitch = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EnableResetRequired (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Record the info that a reset is required.
|
||||||
|
A module boolean variable is used to record whether a reset is required.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
mResetRequired = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DisableResetRequired (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Record the info that no reset is required.
|
||||||
|
A module boolean variable is used to record whether a reset is required.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
mResetRequired = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsResetReminderFeatureEnable (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Check whether platform policy enable the reset reminder feature. The default is enabled.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
return mFeaturerSwitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
IsResetRequired (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Check if user changed any option setting which needs a system reset to be effective.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
return mResetRequired;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetupResetReminder (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
|
||||||
|
Check whether a reset is needed, and finish the reset reminder feature.
|
||||||
|
If a reset is needed, Popup a menu to notice user, and finish the feature
|
||||||
|
according to the user selection.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
VOID
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_FORM_BROWSER_PROTOCOL *Browser;
|
||||||
|
EFI_INPUT_KEY Key;
|
||||||
|
CHAR16 *StringBuffer1;
|
||||||
|
CHAR16 *StringBuffer2;
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
//check any reset required change is applied? if yes, reset system
|
||||||
|
//
|
||||||
|
if (IsResetReminderFeatureEnable ()) {
|
||||||
|
if (IsResetRequired ()) {
|
||||||
|
|
||||||
|
Status = gBS->LocateProtocol (
|
||||||
|
&gEfiFormBrowserProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&Browser
|
||||||
|
);
|
||||||
|
|
||||||
|
StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
|
||||||
|
ASSERT (StringBuffer1 != NULL);
|
||||||
|
StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
|
||||||
|
ASSERT (StringBuffer2 != NULL);
|
||||||
|
StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now ? ");
|
||||||
|
StrCpy (StringBuffer2, L"Enter (YES) / Esc (NO)");
|
||||||
|
//
|
||||||
|
// Popup a menu to notice user
|
||||||
|
//
|
||||||
|
do {
|
||||||
|
Browser->CreatePopUp (2, TRUE, 0, NULL, &Key, StringBuffer1, StringBuffer2);
|
||||||
|
} while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));
|
||||||
|
|
||||||
|
gBS->FreePool (StringBuffer1);
|
||||||
|
gBS->FreePool (StringBuffer2);
|
||||||
|
//
|
||||||
|
// If the user hits the YES Response key, reset
|
||||||
|
//
|
||||||
|
if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN)) {
|
||||||
|
gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
|
||||||
|
}
|
||||||
|
gST->ConOut->ClearScreen (gST->ConOut);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user