1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
/** @file
Provides a way for 3rd party applications to register themselves for launch by the
Boot Manager based on hot key
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _HOTKEY_H_
#define _HOTKEY_H_
#include "Bds.h"
#include "String.h"
#define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) { \
(a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_BOOT_OPTION_SUPPORT_COUNT); \
}
#define BDS_HOTKEY_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'K', 'O')
/**
Get the revision of the EFI_KEY_OPTION structure.
@param KeyOption Pointer to the EFI_KEY_OPTION structure.
@return Revision.
**/
#define KEY_OPTION_REVISION(KeyOption) ((KeyOption)->KeyData & EFI_KEY_OPTION_REVISION_MASK)
/**
Get the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3.
@param KeyOption Pointer to the EFI_KEY_OPTION structure.
@return Actual number of entries in EFI_KEY_OPTION.Keys.
**/
#define KEY_OPTION_INPUT_KEY_COUNT(KeyOption) (((KeyOption)->KeyData & EFI_KEY_OPTION_INPUT_KEY_COUNT_MASK) >> LowBitSet32 (EFI_KEY_OPTION_INPUT_KEY_COUNT_MASK))
/**
Return whether the Shift key needs pressed.
@param KeyOption Pointer to the EFI_KEY_OPTION structure.
@retval TRUE Shift key needs pressed.
@retval FALSE Shift key needn't pressed.
**/
#define KEY_OPTION_SHIFT_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_SHIFT_PRESSED_MASK) != 0)
/**
Return whether the Control key needs pressed.
@param KeyOption Pointer to the EFI_KEY_OPTION structure.
@retval TRUE Control key needs pressed.
@retval FALSE Control key needn't pressed.
**/
#define KEY_OPTION_CONTROL_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_CONTROL_PRESSED_MASK) != 0)
/**
Return whether the Alt key needs pressed.
@param KeyOption Pointer to the EFI_KEY_OPTION structure.
@retval TRUE Alt key needs pressed.
@retval FALSE Alt key needn't pressed.
**/
#define KEY_OPTION_ALT_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_ALT_PRESSED_MASK) != 0)
/**
Return whether the Logo key needs pressed.
@param KeyOption Pointer to the EFI_KEY_OPTION structure.
@retval TRUE Logo key needs pressed.
@retval FALSE Logo key needn't pressed.
**/
#define KEY_OPTION_LOGO_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_LOGO_PRESSED_MASK) != 0)
/**
Return whether the Menu key needs pressed.
@param KeyOption Pointer to the EFI_KEY_OPTION structure.
@retval TRUE Menu key needs pressed.
@retval FALSE Menu key needn't pressed.
**/
#define KEY_OPTION_MENU_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_MENU_PRESSED_MASK) != 0)
/**
Return whether the SysReq key needs pressed.
@param KeyOption Pointer to the EFI_KEY_OPTION structure.
@retval TRUE SysReq key needs pressed.
@retval FALSE SysReq key needn't pressed.
**/
#define KEY_OPTION_SYS_REQ_PRESSED(KeyOption) (BOOLEAN) (((KeyOption)->KeyData & EFI_KEY_OPTION_SYS_REQ_PRESSED_MASK) != 0)
typedef struct {
UINTN Signature;
LIST_ENTRY Link;
VOID *NotifyHandle;
UINT16 BootOptionNumber;
UINT8 CodeCount;
UINT8 WaitingKey;
EFI_KEY_DATA KeyData[3];
} BDS_HOTKEY_OPTION;
#define BDS_HOTKEY_OPTION_FROM_LINK(a) CR (a, BDS_HOTKEY_OPTION, Link, BDS_HOTKEY_OPTION_SIGNATURE)
/**
Process all the "Key####" variables, associate Hotkeys with corresponding Boot Options.
@param VOID
@retval EFI_SUCCESS Hotkey services successfully initialized.
**/
EFI_STATUS
InitializeHotkeyService (
VOID
);
/**
Try to boot the boot option triggered by hotkey.
@retval EFI_SUCCESS There is HotkeyBootOption & it is processed
@retval EFI_NOT_FOUND There is no HotkeyBootOption
**/
EFI_STATUS
HotkeyBoot (
VOID
);
#endif
|