1 /** @file
2   Provides a way for 3rd party applications to register themselves for launch by the
3   Boot Manager based on hot key
4 
5 Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution.  The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef _HOTKEY_H_
17 #define _HOTKEY_H_
18 
19 #include "Bds.h"
20 #include "String.h"
21 
22 #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) {  \
23       (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_BOOT_OPTION_SUPPORT_COUNT); \
24       }
25 
26 #define BDS_HOTKEY_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'K', 'O')
27 
28 
29 typedef struct {
30   UINTN                     Signature;
31   LIST_ENTRY                Link;
32 
33   VOID                      *NotifyHandle;
34   UINT16                    BootOptionNumber;
35   UINT8                     CodeCount;
36   UINT8                     WaitingKey;
37   EFI_KEY_DATA              KeyData[3];
38 } BDS_HOTKEY_OPTION;
39 
40 #define BDS_HOTKEY_OPTION_FROM_LINK(a) CR (a, BDS_HOTKEY_OPTION, Link, BDS_HOTKEY_OPTION_SIGNATURE)
41 
42 /**
43 
44   Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.
45 
46 
47   @param VOID
48 
49   @retval  EFI_SUCCESS    Hotkey services successfully initialized.
50 
51 **/
52 EFI_STATUS
53 InitializeHotkeyService (
54   VOID
55   );
56 
57 /**
58   Try to boot the boot option triggered by hotkey.
59   @retval  EFI_SUCCESS             There is HotkeyBootOption & it is processed
60   @retval  EFI_NOT_FOUND           There is no HotkeyBootOption
61 **/
62 EFI_STATUS
63 HotkeyBoot (
64   VOID
65   );
66 
67 #endif
68