-/*++\r
+/** @file\r
+ Provides a way for 3rd party applications to register themselves for launch by the\r
+ Boot Manager based on hot key\r
\r
-Copyright (c) 2007 - 2008, Intel Corporation\r
+Copyright (c) 2007 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-Module Name:\r
-\r
- Hotkey.h\r
-\r
-Abstract:\r
-\r
- Provides a way for 3rd party applications to register themselves for launch by the\r
- Boot Manager based on hot key\r
-\r
-Revision History\r
-\r
---*/\r
+**/\r
\r
#include "Hotkey.h"\r
\r
VOID *mHotkeyRegistration;\r
\r
\r
-BOOLEAN\r
-IsKeyOptionValid (\r
- IN EFI_KEY_OPTION *KeyOption\r
-)\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Check if the Key Option is valid or not.\r
\r
-Arguments:\r
-\r
- KeyOption - The Hot Key Option to be checked.\r
\r
-Returns:\r
+ @param KeyOption The Hot Key Option to be checked.\r
\r
- TRUE - The Hot Key Option is valid.\r
- FALSE - The Hot Key Option is invalid.\r
+ @retval TRUE The Hot Key Option is valid.\r
+ @retval FALSE The Hot Key Option is invalid.\r
\r
---*/\r
+**/\r
+BOOLEAN\r
+IsKeyOptionValid (\r
+ IN EFI_KEY_OPTION *KeyOption\r
+)\r
{\r
UINT16 BootOptionName[10];\r
UINT8 *BootOptionVar;\r
return (BOOLEAN) ((KeyOption->BootOptionCrc == Crc) ? TRUE : FALSE);\r
}\r
\r
-EFI_STATUS\r
-RegisterHotkey (\r
- IN EFI_KEY_OPTION *KeyOption,\r
- OUT UINT16 *KeyOptionNumber\r
-)\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Create Key#### for the given hotkey.\r
\r
-Arguments:\r
\r
- KeyOption - The Hot Key Option to be added.\r
- KeyOptionNumber - The key option number for Key#### (optional).\r
+ @param KeyOption The Hot Key Option to be added.\r
+ @param KeyOptionNumber The key option number for Key#### (optional).\r
\r
-Returns:\r
+ @retval EFI_SUCCESS Register hotkey successfully.\r
+ @retval EFI_INVALID_PARAMETER The hotkey option is invalid.\r
\r
- EFI_SUCCESS - Register hotkey successfully.\r
- EFI_INVALID_PARAMETER - The hotkey option is invalid.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+RegisterHotkey (\r
+ IN EFI_KEY_OPTION *KeyOption,\r
+ OUT UINT16 *KeyOptionNumber\r
+)\r
{\r
UINT16 KeyOptionName[10];\r
UINT16 *KeyOrder;\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- KeyOptionSize = sizeof (EFI_KEY_OPTION) + GET_KEY_CODE_COUNT (KeyOption->KeyOptions.PackedValue) * sizeof (EFI_INPUT_KEY);\r
+ KeyOptionSize = sizeof (EFI_KEY_OPTION) + GET_KEY_CODE_COUNT (KeyOption->KeyData.PackedValue) * sizeof (EFI_INPUT_KEY);\r
UpdateBootOption = FALSE;\r
\r
//\r
//\r
\r
KeyOrder = BdsLibGetVariableAndSize (\r
- VarKeyOrder,\r
+ VAR_KEY_ORDER,\r
&gEfiGlobalVariableGuid,\r
&KeyOrderSize\r
);\r
return EFI_SUCCESS;\r
}\r
\r
- if (KeyOption->KeyOptions.PackedValue == TempOption->KeyOptions.PackedValue) {\r
- if (GET_KEY_CODE_COUNT (KeyOption->KeyOptions.PackedValue) == 0 ||\r
+ if (KeyOption->KeyData.PackedValue == TempOption->KeyData.PackedValue) {\r
+ if (GET_KEY_CODE_COUNT (KeyOption->KeyData.PackedValue) == 0 ||\r
CompareMem (\r
((UINT8 *) TempOption) + sizeof (EFI_KEY_OPTION),\r
((UINT8 *) KeyOption) + sizeof (EFI_KEY_OPTION),\r
NewKeyOrder[Index] = RegisterOptionNumber;\r
\r
Status = gRT->SetVariable (\r
- VarKeyOrder,\r
+ VAR_KEY_ORDER,\r
&gEfiGlobalVariableGuid,\r
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
KeyOrderSize,\r
return Status;\r
}\r
\r
-EFI_STATUS\r
-UnregisterHotkey (\r
- IN UINT16 KeyOptionNumber\r
-)\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Delete Key#### for the given Key Option number.\r
\r
-Arguments:\r
-\r
- KeyOptionNumber - Key option number for Key####\r
+ @param KeyOptionNumber Key option number for Key####\r
\r
-Returns:\r
+ @retval EFI_SUCCESS Unregister hotkey successfully.\r
+ @retval EFI_NOT_FOUND No Key#### is found for the given Key Option number.\r
\r
- EFI_SUCCESS - Unregister hotkey successfully.\r
- EFI_NOT_FOUND - No Key#### is found for the given Key Option number.\r
-\r
---*/\r
+**/\r
+EFI_STATUS\r
+UnregisterHotkey (\r
+ IN UINT16 KeyOptionNumber\r
+)\r
{\r
UINT16 KeyOption[10];\r
UINTN Index;\r
// Adjust key order array\r
//\r
KeyOrder = BdsLibGetVariableAndSize (\r
- VarKeyOrder,\r
+ VAR_KEY_ORDER,\r
&gEfiGlobalVariableGuid,\r
&KeyOrderSize\r
);\r
}\r
\r
Status = gRT->SetVariable (\r
- VarKeyOrder,\r
+ VAR_KEY_ORDER,\r
&gEfiGlobalVariableGuid,\r
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
KeyOrderSize,\r
return Status;\r
}\r
\r
-EFI_STATUS\r
-HotkeyCallback (\r
- IN EFI_KEY_DATA *KeyData\r
-)\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
This is the common notification function for HotKeys, it will be registered\r
with SimpleTextInEx protocol interface - RegisterKeyNotify() of ConIn handle.\r
\r
-Arguments:\r
-\r
- KeyData - A pointer to a buffer that is filled in with the keystroke\r
- information for the key that was pressed.\r
\r
-Returns:\r
+ @param KeyData A pointer to a buffer that is filled in with the keystroke\r
+ information for the key that was pressed.\r
\r
- EFI_SUCCESS - KeyData is successfully processed.\r
+ @retval EFI_SUCCESS KeyData is successfully processed.\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+HotkeyCallback (\r
+ IN EFI_KEY_DATA *KeyData\r
+)\r
{\r
BOOLEAN HotkeyCatched;\r
LIST_ENTRY BootLists;\r
BDS_COMMON_OPTION *BootOption;\r
UINTN ExitDataSize;\r
CHAR16 *ExitData;\r
- EFI_TPL OldTpl;\r
EFI_STATUS Status;\r
EFI_KEY_DATA *HotkeyData;\r
\r
//\r
gST->ConOut->Reset (gST->ConOut, FALSE);\r
\r
- //\r
- // BdsLibBootViaBootOption() is expected to be invoked at TPL level TPL_APPLICATION,\r
- // so raise the TPL to TPL_APPLICATION first, then restore it\r
- //\r
- OldTpl = gBS->RaiseTPL (TPL_APPLICATION);\r
-\r
mHotkeyCallbackPending = TRUE;\r
Status = BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);\r
mHotkeyCallbackPending = FALSE;\r
\r
- gBS->RestoreTPL (OldTpl);\r
-\r
if (EFI_ERROR (Status)) {\r
//\r
// Call platform action to indicate the boot fail\r
return Status;\r
}\r
\r
-EFI_STATUS\r
-HotkeyRegisterNotify (\r
- IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEx\r
-)\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Register the common HotKey notify function to given SimpleTextInEx protocol instance.\r
\r
-Arguments:\r
-\r
- SimpleTextInEx - Simple Text Input Ex protocol instance\r
\r
-Returns:\r
+ @param SimpleTextInEx Simple Text Input Ex protocol instance\r
\r
- EFI_SUCCESS - Register hotkey notification function successfully.\r
- EFI_OUT_OF_RESOURCES - Unable to allocate necessary data structures.\r
+ @retval EFI_SUCCESS Register hotkey notification function successfully.\r
+ @retval EFI_OUT_OF_RESOURCES Unable to allocate necessary data structures.\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+HotkeyRegisterNotify (\r
+ IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *SimpleTextInEx\r
+)\r
{\r
UINTN Index;\r
EFI_STATUS Status;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Callback function for SimpleTextInEx protocol install events\r
+\r
+\r
+ @param Event the event that is signaled.\r
+ @param Context not used here.\r
+\r
+ @return VOID\r
+\r
+**/\r
VOID\r
EFIAPI\r
HotkeyEvent (\r
IN EFI_EVENT Event,\r
IN VOID *Context\r
)\r
-/*++\r
-\r
-Routine Description:\r
- Callback function for SimpleTextInEx protocol install events\r
-\r
-Arguments:\r
-\r
- Standard event notification function arguments:\r
- Event - the event that is signaled.\r
- Context - not used here.\r
-\r
-Returns:\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINTN BufferSize;\r
}\r
}\r
\r
-EFI_STATUS\r
-HotkeyInsertList (\r
- IN EFI_KEY_OPTION *KeyOption\r
-)\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Insert Key Option to hotkey list.\r
\r
-Arguments:\r
-\r
- KeyOption - The Hot Key Option to be added to hotkey list.\r
\r
-Returns:\r
+ @param KeyOption The Hot Key Option to be added to hotkey list.\r
\r
- EFI_SUCCESS - Add to hotkey list success.\r
+ @retval EFI_SUCCESS Add to hotkey list success.\r
\r
---*/\r
+**/\r
+EFI_STATUS\r
+HotkeyInsertList (\r
+ IN EFI_KEY_OPTION *KeyOption\r
+)\r
{\r
BDS_HOTKEY_OPTION *HotkeyLeft;\r
BDS_HOTKEY_OPTION *HotkeyRight;\r
HotkeyLeft->Signature = BDS_HOTKEY_OPTION_SIGNATURE;\r
HotkeyLeft->BootOptionNumber = KeyOption->BootOption;\r
\r
- KeyOptions = KeyOption->KeyOptions.PackedValue;\r
+ KeyOptions = KeyOption->KeyData.PackedValue;\r
\r
HotkeyLeft->CodeCount = (UINT8) GET_KEY_CODE_COUNT (KeyOptions);\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+\r
+ Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.\r
+\r
+ @retval EFI_SUCCESS Hotkey services successfully initialized.\r
+ @retval EFI_NOT_FOUND Can not find the "KeyOrder" variable\r
+**/\r
EFI_STATUS\r
InitializeHotkeyService (\r
VOID\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.\r
-\r
-Arguments:\r
-\r
- None\r
-\r
-Returns:\r
-\r
- EFI_SUCCESS - Hotkey services successfully initialized.\r
-\r
---*/\r
{\r
EFI_STATUS Status;\r
UINT32 BootOptionSupport;\r
// Get valid Key Option List from private EFI variable "KeyOrder"\r
//\r
KeyOrder = BdsLibGetVariableAndSize (\r
- VarKeyOrder,\r
+ VAR_KEY_ORDER,\r
&gEfiGlobalVariableGuid,\r
&KeyOrderSize\r
);\r