mirror of https://github.com/acidanthera/audk.git
The hotkey callback in BDS module should defer loading the boot option until the TPL drops to TPL_APPLICATION after the keyboard driver is enhanced to call hotkey callback in timer handler whose TPL is higher than TPL_APPLICATION.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11573 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a176509a7f
commit
d394581d11
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
FrontPage routines to handle the callbacks and browser calls
|
FrontPage routines to handle the callbacks and browser calls
|
||||||
|
|
||||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include "Bds.h"
|
#include "Bds.h"
|
||||||
#include "FrontPage.h"
|
#include "FrontPage.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
|
#include "Hotkey.h"
|
||||||
|
|
||||||
EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;
|
EFI_GUID mFrontPageGuid = FRONT_PAGE_FORMSET_GUID;
|
||||||
|
|
||||||
|
@ -971,8 +972,10 @@ PlatformBdsEnterFrontPage (
|
||||||
gConnectAllHappened = TRUE;
|
gConnectAllHappened = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HotkeyBoot ();
|
||||||
if (TimeoutDefault != 0xffff) {
|
if (TimeoutDefault != 0xffff) {
|
||||||
Status = ShowProgress (TimeoutDefault);
|
Status = ShowProgress (TimeoutDefault);
|
||||||
|
HotkeyBoot ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure screen is clear when switch Console from Graphics mode to Text mode
|
// Ensure screen is clear when switch Console from Graphics mode to Text mode
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Provides a way for 3rd party applications to register themselves for launch by the
|
Provides a way for 3rd party applications to register themselves for launch by the
|
||||||
Boot Manager based on hot key
|
Boot Manager based on hot key
|
||||||
|
|
||||||
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
|
||||||
LIST_ENTRY mHotkeyList = INITIALIZE_LIST_HEAD_VARIABLE (mHotkeyList);
|
LIST_ENTRY mHotkeyList = INITIALIZE_LIST_HEAD_VARIABLE (mHotkeyList);
|
||||||
BOOLEAN mHotkeyCallbackPending = FALSE;
|
BDS_COMMON_OPTION *mHotkeyBootOption = NULL;
|
||||||
EFI_EVENT mHotkeyEvent;
|
EFI_EVENT mHotkeyEvent;
|
||||||
VOID *mHotkeyRegistration;
|
VOID *mHotkeyRegistration;
|
||||||
|
|
||||||
|
@ -300,6 +300,50 @@ UnregisterHotkey (
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Try to boot the boot option triggered by hotkey.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
HotkeyBoot (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN ExitDataSize;
|
||||||
|
CHAR16 *ExitData;
|
||||||
|
|
||||||
|
if (mHotkeyBootOption != NULL) {
|
||||||
|
BdsLibConnectDevicePath (mHotkeyBootOption->DevicePath);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clear the screen before launch this BootOption
|
||||||
|
//
|
||||||
|
gST->ConOut->Reset (gST->ConOut, FALSE);
|
||||||
|
|
||||||
|
Status = BdsLibBootViaBootOption (mHotkeyBootOption, mHotkeyBootOption->DevicePath, &ExitDataSize, &ExitData);
|
||||||
|
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
//
|
||||||
|
// Call platform action to indicate the boot fail
|
||||||
|
//
|
||||||
|
mHotkeyBootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
|
||||||
|
PlatformBdsBootFail (mHotkeyBootOption, Status, ExitData, ExitDataSize);
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Call platform action to indicate the boot success
|
||||||
|
//
|
||||||
|
mHotkeyBootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
|
||||||
|
PlatformBdsBootSuccess (mHotkeyBootOption);
|
||||||
|
}
|
||||||
|
FreePool (mHotkeyBootOption->Description);
|
||||||
|
FreePool (mHotkeyBootOption->DevicePath);
|
||||||
|
FreePool (mHotkeyBootOption->LoadOptions);
|
||||||
|
FreePool (mHotkeyBootOption);
|
||||||
|
|
||||||
|
mHotkeyBootOption = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
This is the common notification function for HotKeys, it will be registered
|
This is the common notification function for HotKeys, it will be registered
|
||||||
|
@ -322,24 +366,22 @@ HotkeyCallback (
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
BDS_HOTKEY_OPTION *Hotkey;
|
BDS_HOTKEY_OPTION *Hotkey;
|
||||||
UINT16 Buffer[10];
|
UINT16 Buffer[10];
|
||||||
BDS_COMMON_OPTION *BootOption;
|
|
||||||
UINTN ExitDataSize;
|
|
||||||
CHAR16 *ExitData;
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_KEY_DATA *HotkeyData;
|
EFI_KEY_DATA *HotkeyData;
|
||||||
|
|
||||||
if (mHotkeyCallbackPending) {
|
if (mHotkeyBootOption != NULL) {
|
||||||
//
|
//
|
||||||
// When responsing to a Hotkey, ignore sequential hotkey stroke until
|
// Do not process sequential hotkey stroke until the current boot option returns
|
||||||
// the current Boot#### load option returned
|
|
||||||
//
|
//
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
Link = GetFirstNode (&mHotkeyList);
|
|
||||||
|
|
||||||
while (!IsNull (&mHotkeyList, Link)) {
|
for ( Link = GetFirstNode (&mHotkeyList)
|
||||||
|
; !IsNull (&mHotkeyList, Link)
|
||||||
|
; Link = GetNextNode (&mHotkeyList, Link)
|
||||||
|
) {
|
||||||
HotkeyCatched = FALSE;
|
HotkeyCatched = FALSE;
|
||||||
Hotkey = BDS_HOTKEY_OPTION_FROM_LINK (Link);
|
Hotkey = BDS_HOTKEY_OPTION_FROM_LINK (Link);
|
||||||
|
|
||||||
|
@ -350,11 +392,10 @@ HotkeyCallback (
|
||||||
HotkeyData = &Hotkey->KeyData[Hotkey->WaitingKey];
|
HotkeyData = &Hotkey->KeyData[Hotkey->WaitingKey];
|
||||||
if ((KeyData->Key.ScanCode == HotkeyData->Key.ScanCode) &&
|
if ((KeyData->Key.ScanCode == HotkeyData->Key.ScanCode) &&
|
||||||
(KeyData->Key.UnicodeChar == HotkeyData->Key.UnicodeChar) &&
|
(KeyData->Key.UnicodeChar == HotkeyData->Key.UnicodeChar) &&
|
||||||
(((HotkeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) ? (KeyData->KeyState.KeyShiftState == HotkeyData->KeyState.KeyShiftState) : TRUE)) {
|
(((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) ?
|
||||||
//
|
(KeyData->KeyState.KeyShiftState == HotkeyData->KeyState.KeyShiftState) : TRUE
|
||||||
// Receive an expecting key stroke
|
)
|
||||||
//
|
) {
|
||||||
if (Hotkey->CodeCount > 1) {
|
|
||||||
//
|
//
|
||||||
// For hotkey of key combination, transit to next waiting state
|
// For hotkey of key combination, transit to next waiting state
|
||||||
//
|
//
|
||||||
|
@ -366,12 +407,6 @@ HotkeyCallback (
|
||||||
//
|
//
|
||||||
HotkeyCatched = TRUE;
|
HotkeyCatched = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// For hotkey of single key stroke
|
|
||||||
//
|
|
||||||
HotkeyCatched = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// Receive an unexpected key stroke, reset to initial waiting state
|
// Receive an unexpected key stroke, reset to initial waiting state
|
||||||
|
@ -391,38 +426,8 @@ HotkeyCallback (
|
||||||
InitializeListHead (&BootLists);
|
InitializeListHead (&BootLists);
|
||||||
|
|
||||||
UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", Hotkey->BootOptionNumber);
|
UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", Hotkey->BootOptionNumber);
|
||||||
BootOption = BdsLibVariableToOption (&BootLists, Buffer);
|
mHotkeyBootOption = BdsLibVariableToOption (&BootLists, Buffer);
|
||||||
if (BootOption == NULL) {
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
}
|
||||||
BootOption->BootCurrent = Hotkey->BootOptionNumber;
|
|
||||||
BdsLibConnectDevicePath (BootOption->DevicePath);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Clear the screen before launch this BootOption
|
|
||||||
//
|
|
||||||
gST->ConOut->Reset (gST->ConOut, FALSE);
|
|
||||||
|
|
||||||
mHotkeyCallbackPending = TRUE;
|
|
||||||
Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);
|
|
||||||
mHotkeyCallbackPending = FALSE;
|
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// Call platform action to indicate the boot fail
|
|
||||||
//
|
|
||||||
BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_FAILED));
|
|
||||||
PlatformBdsBootFail (BootOption, Status, ExitData, ExitDataSize);
|
|
||||||
} else {
|
|
||||||
//
|
|
||||||
// Call platform action to indicate the boot success
|
|
||||||
//
|
|
||||||
BootOption->StatusString = GetStringById (STRING_TOKEN (STR_BOOT_SUCCEEDED));
|
|
||||||
PlatformBdsBootSuccess (BootOption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Link = GetNextNode (&mHotkeyList, Link);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
Provides a way for 3rd party applications to register themselves for launch by the
|
Provides a way for 3rd party applications to register themselves for launch by the
|
||||||
Boot Manager based on hot key
|
Boot Manager based on hot key
|
||||||
|
|
||||||
Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -92,4 +92,12 @@ InitializeHotkeyService (
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Try to boot the boot option triggered by hotkey.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
HotkeyBoot (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue