summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg
diff options
context:
space:
mode:
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-09 07:56:28 +0000
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>2009-04-09 07:56:28 +0000
commita9e7937ab0a43f8e0e4ee94f16fd047e6aefd3d5 (patch)
tree50a9b2f1254dd5facf77dc38e1428af9a5e35680 /IntelFrameworkModulePkg
parent298530bcaab4b58fa6e1cc8ce70ad0468a698f5d (diff)
downloadedk2-platforms-a9e7937ab0a43f8e0e4ee94f16fd047e6aefd3d5.tar.xz
EFI_KEY_OPTION definition verified with UEFI spec.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8046 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c44
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h7
2 files changed, 36 insertions, 15 deletions
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
index bfad7ce755..8843ec0b70 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
@@ -101,11 +101,11 @@ RegisterHotkey (
return EFI_INVALID_PARAMETER;
}
- KeyOptionSize = sizeof (EFI_KEY_OPTION) + GET_KEY_CODE_COUNT (KeyOption->KeyData.PackedValue) * sizeof (EFI_INPUT_KEY);
+ KeyOptionSize = sizeof (EFI_KEY_OPTION) + KeyOption->KeyData.Options.InputKeyCount * sizeof (EFI_INPUT_KEY);
UpdateBootOption = FALSE;
//
- // check whether HotKey conflict with keys used by Setup Browser
+ // Check whether HotKey conflict with keys used by Setup Browser
//
KeyOrder = BdsLibGetVariableAndSize (
VAR_KEY_ORDER,
@@ -143,7 +143,7 @@ RegisterHotkey (
}
if (KeyOption->KeyData.PackedValue == TempOption->KeyData.PackedValue) {
- if (GET_KEY_CODE_COUNT (KeyOption->KeyData.PackedValue) == 0 ||
+ if (KeyOption->KeyData.Options.InputKeyCount == 0 ||
CompareMem (
((UINT8 *) TempOption) + sizeof (EFI_KEY_OPTION),
((UINT8 *) KeyOption) + sizeof (EFI_KEY_OPTION),
@@ -348,7 +348,7 @@ HotkeyCallback (
HotkeyData = &Hotkey->KeyData[Hotkey->WaitingKey];
if ((KeyData->Key.ScanCode == HotkeyData->Key.ScanCode) &&
(KeyData->Key.UnicodeChar == HotkeyData->Key.UnicodeChar) &&
- ((HotkeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) ? (KeyData->KeyState.KeyShiftState == HotkeyData->KeyState.KeyShiftState) : 1)) {
+ ((HotkeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) ? (KeyData->KeyState.KeyShiftState == HotkeyData->KeyState.KeyShiftState) : TRUE)) {
//
// Receive an expecting key stroke
//
@@ -538,7 +538,7 @@ HotkeyInsertList (
BDS_HOTKEY_OPTION *HotkeyLeft;
BDS_HOTKEY_OPTION *HotkeyRight;
UINTN Index;
- UINT32 KeyOptions;
+ EFI_BOOT_KEY_DATA KeyOptions;
UINT32 KeyShiftStateLeft;
UINT32 KeyShiftStateRight;
EFI_INPUT_KEY *InputKey;
@@ -552,19 +552,33 @@ HotkeyInsertList (
HotkeyLeft->Signature = BDS_HOTKEY_OPTION_SIGNATURE;
HotkeyLeft->BootOptionNumber = KeyOption->BootOption;
- KeyOptions = KeyOption->KeyData.PackedValue;
+ KeyOptions = KeyOption->KeyData;
- HotkeyLeft->CodeCount = (UINT8) GET_KEY_CODE_COUNT (KeyOptions);
+ HotkeyLeft->CodeCount = (UINT8) KeyOptions.Options.InputKeyCount;
//
// Map key shift state from KeyOptions to EFI_KEY_DATA.KeyState
//
- KeyShiftStateRight = (KeyOptions & EFI_KEY_OPTION_SHIFT) |
- ((KeyOptions & EFI_KEY_OPTION_CONTROL) << 1) |
- ((KeyOptions & EFI_KEY_OPTION_ALT) << 2) |
- ((KeyOptions & EFI_KEY_OPTION_LOGO) << 3) |
- ((KeyOptions & (EFI_KEY_OPTION_MENU | EFI_KEY_OPTION_SYSREQ)) << 4) |
- EFI_SHIFT_STATE_VALID;
+ KeyShiftStateRight = EFI_SHIFT_STATE_VALID;
+ if (KeyOptions.Options.ShiftPressed) {
+ KeyShiftStateRight |= EFI_RIGHT_SHIFT_PRESSED;
+ }
+ if (KeyOptions.Options.ControlPressed) {
+ KeyShiftStateRight |= EFI_RIGHT_CONTROL_PRESSED;
+ }
+ if (KeyOptions.Options.AltPressed) {
+ KeyShiftStateRight |= EFI_RIGHT_ALT_PRESSED;
+ }
+ if (KeyOptions.Options.LogoPressed) {
+ KeyShiftStateRight |= EFI_RIGHT_LOGO_PRESSED;
+ }
+ if (KeyOptions.Options.MenuPressed) {
+ KeyShiftStateRight |= EFI_MENU_KEY_PRESSED;
+ }
+ if (KeyOptions.Options.SysReqPressed) {
+ KeyShiftStateRight |= EFI_SYS_REQ_PRESSED;
+ }
+
KeyShiftStateLeft = (KeyShiftStateRight & 0xffffff00) | ((KeyShiftStateRight & 0xff) << 1);
@@ -636,12 +650,14 @@ InitializeHotkeyService (
//
// Export our capability - EFI_BOOT_OPTION_SUPPORT_KEY and EFI_BOOT_OPTION_SUPPORT_APP
+ // with maximum number of key presses of 3
//
BootOptionSupport = EFI_BOOT_OPTION_SUPPORT_KEY | EFI_BOOT_OPTION_SUPPORT_APP;
+ SET_BOOT_OPTION_SUPPORT_KEY_COUNT (BootOptionSupport, 3);
Status = gRT->SetVariable (
L"BootOptionSupport",
&gEfiGlobalVariableGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof (UINT32),
&BootOptionSupport
);
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
index f2d1c60bf6..61b2e3969e 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
@@ -19,9 +19,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Bds.h"
#include "String.h"
-#define GET_KEY_CODE_COUNT(KeyOptions) (((KeyOptions) & EFI_KEY_CODE_COUNT) >> 8)
+#define GET_BOOT_OPTION_SUPPORT_KEY_COUNT(a) (((a) & EFI_BOOT_OPTION_SUPPORT_COUNT) >> 8)
+#define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) { \
+ (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << 8) & EFI_BOOT_OPTION_SUPPORT_COUNT); \
+ }
#define BDS_HOTKEY_OPTION_SIGNATURE SIGNATURE_32 ('B', 'd', 'K', 'O')
+
+
typedef struct {
UINTN Signature;
LIST_ENTRY Link;