]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
Correct a typo: Change the type of the 4th parameter of EFI_DRIVER_HEALTH_PROTOCOL...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / Hotkey.h
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 - 2012, 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 Get the revision of the EFI_KEY_OPTION structure.
30
31 @param KeyOption Pointer to the EFI_KEY_OPTION structure.
32
33 @return Revision.
34 **/
35 #define KEY_OPTION_REVISION(KeyOption) ((KeyOption)->KeyData & EFI_KEY_OPTION_REVISION_MASK)
36
37 /**
38 Get the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3.
39
40 @param KeyOption Pointer to the EFI_KEY_OPTION structure.
41
42 @return Actual number of entries in EFI_KEY_OPTION.Keys.
43 **/
44 #define KEY_OPTION_INPUT_KEY_COUNT(KeyOption) (((KeyOption)->KeyData & EFI_KEY_OPTION_INPUT_KEY_COUNT_MASK) >> LowBitSet32 (EFI_KEY_OPTION_INPUT_KEY_COUNT_MASK))
45
46 /**
47 Return whether the Shift key needs pressed.
48
49 @param KeyOption Pointer to the EFI_KEY_OPTION structure.
50
51 @retval TRUE Shift key needs pressed.
52 @retval FALSE Shift key needn't pressed.
53 **/
54 #define KEY_OPTION_SHIFT_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_SHIFT_PRESSED_MASK) != 0)
55
56 /**
57 Return whether the Control key needs pressed.
58
59 @param KeyOption Pointer to the EFI_KEY_OPTION structure.
60
61 @retval TRUE Control key needs pressed.
62 @retval FALSE Control key needn't pressed.
63 **/
64 #define KEY_OPTION_CONTROL_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_CONTROL_PRESSED_MASK) != 0)
65
66 /**
67 Return whether the Alt key needs pressed.
68
69 @param KeyOption Pointer to the EFI_KEY_OPTION structure.
70
71 @retval TRUE Alt key needs pressed.
72 @retval FALSE Alt key needn't pressed.
73 **/
74 #define KEY_OPTION_ALT_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_ALT_PRESSED_MASK) != 0)
75
76 /**
77 Return whether the Logo key needs pressed.
78
79 @param KeyOption Pointer to the EFI_KEY_OPTION structure.
80
81 @retval TRUE Logo key needs pressed.
82 @retval FALSE Logo key needn't pressed.
83 **/
84 #define KEY_OPTION_LOGO_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_LOGO_PRESSED_MASK) != 0)
85
86 /**
87 Return whether the Menu key needs pressed.
88
89 @param KeyOption Pointer to the EFI_KEY_OPTION structure.
90
91 @retval TRUE Menu key needs pressed.
92 @retval FALSE Menu key needn't pressed.
93 **/
94 #define KEY_OPTION_MENU_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_MENU_PRESSED_MASK) != 0)
95
96 /**
97 Return whether the SysReq key needs pressed.
98
99 @param KeyOption Pointer to the EFI_KEY_OPTION structure.
100
101 @retval TRUE SysReq key needs pressed.
102 @retval FALSE SysReq key needn't pressed.
103 **/
104 #define KEY_OPTION_SYS_REQ_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_SYS_REQ_PRESSED_MASK) != 0)
105
106 typedef struct {
107 UINTN Signature;
108 LIST_ENTRY Link;
109
110 VOID *NotifyHandle;
111 UINT16 BootOptionNumber;
112 UINT8 CodeCount;
113 UINT8 WaitingKey;
114 EFI_KEY_DATA KeyData[3];
115 } BDS_HOTKEY_OPTION;
116
117 #define BDS_HOTKEY_OPTION_FROM_LINK(a) CR (a, BDS_HOTKEY_OPTION, Link, BDS_HOTKEY_OPTION_SIGNATURE)
118
119 /**
120
121 Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.
122
123
124 @param VOID
125
126 @retval EFI_SUCCESS Hotkey services successfully initialized.
127
128 **/
129 EFI_STATUS
130 InitializeHotkeyService (
131 VOID
132 );
133
134 /**
135 Try to boot the boot option triggered by hotkey.
136 @retval EFI_SUCCESS There is HotkeyBootOption & it is processed
137 @retval EFI_NOT_FOUND There is no HotkeyBootOption
138 **/
139 EFI_STATUS
140 HotkeyBoot (
141 VOID
142 );
143
144 #endif