]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/BdsDxe/Hotkey.c
Refine function comments for BdsDxe module.
[mirror_edk2.git] / MdeModulePkg / Universal / BdsDxe / Hotkey.c
index ea4bbf5578f23b2f710e1434f480397c867061d8..96ce6d7238fb5ea2c8071a4f572fbee3edbed245 100644 (file)
@@ -1,6 +1,8 @@
-/*++\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
@@ -9,18 +11,7 @@ http://opensource.org/licenses/bsd-license.php
 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
@@ -31,26 +22,21 @@ EFI_EVENT       mHotkeyEvent;
 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
@@ -80,28 +66,23 @@ Returns:
   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
@@ -123,7 +104,7 @@ Returns:
     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
@@ -131,7 +112,7 @@ Returns:
   //\r
 \r
   KeyOrder = BdsLibGetVariableAndSize (\r
-               VarKeyOrder,\r
+               VAR_KEY_ORDER,\r
                &gEfiGlobalVariableGuid,\r
                &KeyOrderSize\r
                );\r
@@ -165,8 +146,8 @@ Returns:
       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
@@ -230,7 +211,7 @@ Returns:
   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
@@ -243,26 +224,20 @@ Returns:
   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
@@ -287,7 +262,7 @@ Returns:
   // Adjust key order array\r
   //\r
   KeyOrder = BdsLibGetVariableAndSize (\r
-               VarKeyOrder,\r
+               VAR_KEY_ORDER,\r
                &gEfiGlobalVariableGuid,\r
                &KeyOrderSize\r
                );\r
@@ -315,7 +290,7 @@ Returns:
   }\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
@@ -327,27 +302,22 @@ Returns:
   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
@@ -357,7 +327,6 @@ Returns:
   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
@@ -432,18 +401,10 @@ Returns:
       //\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
@@ -465,26 +426,21 @@ Returns:
   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
@@ -522,26 +478,22 @@ Returns:
   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
@@ -575,25 +527,20 @@ Returns:
   }\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
@@ -612,7 +559,7 @@ Returns:
   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
@@ -673,25 +620,17 @@ Returns:
   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
@@ -718,7 +657,7 @@ Returns:
   // 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