Revision: 15000
http://sourceforge.net/p/edk2/code/15000
Author: niruiyu
Date: 2013-12-18 05:51:22 +0000 (Wed, 18 Dec 2013)
Log Message:
-----------
Rollback the change to EFI_BOOT_KEY_DATA structure since UEFI Spec adds the
clarification that bitfields are ordered such that bit 0 is the least
significant bit.
Signed-off-by: Ruiyu Ni <[email protected]>
Modified Paths:
--------------
trunk/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
trunk/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
trunk/edk2/MdePkg/Include/Uefi/UefiSpec.h
trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
trunk/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c
Modified: trunk/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
2013-12-18 03:02:52 UTC (rev 14999)
+++ trunk/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c
2013-12-18 05:51:22 UTC (rev 15000)
@@ -2,7 +2,7 @@
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>
+Copyright (c) 2007 - 2013, 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
@@ -315,6 +315,7 @@
BDS_HOTKEY_OPTION *HotkeyLeft;
BDS_HOTKEY_OPTION *HotkeyRight;
UINTN Index;
+ EFI_BOOT_KEY_DATA KeyOptions;
UINT32 KeyShiftStateLeft;
UINT32 KeyShiftStateRight;
EFI_INPUT_KEY *InputKey;
@@ -327,28 +328,31 @@
HotkeyLeft->Signature = BDS_HOTKEY_OPTION_SIGNATURE;
HotkeyLeft->BootOptionNumber = KeyOption->BootOption;
- HotkeyLeft->CodeCount = (UINT8) KEY_OPTION_INPUT_KEY_COUNT (KeyOption);
+ KeyOptions = KeyOption->KeyData;
+
+ HotkeyLeft->CodeCount = (UINT8) KeyOptions.Options.InputKeyCount;
+
//
// Map key shift state from KeyOptions to EFI_KEY_DATA.KeyState
//
KeyShiftStateRight = EFI_SHIFT_STATE_VALID;
- if (KEY_OPTION_SHIFT_PRESSED (KeyOption)) {
+ if (KeyOptions.Options.ShiftPressed) {
KeyShiftStateRight |= EFI_RIGHT_SHIFT_PRESSED;
}
- if (KEY_OPTION_CONTROL_PRESSED (KeyOption)) {
+ if (KeyOptions.Options.ControlPressed) {
KeyShiftStateRight |= EFI_RIGHT_CONTROL_PRESSED;
}
- if (KEY_OPTION_ALT_PRESSED (KeyOption)) {
+ if (KeyOptions.Options.AltPressed) {
KeyShiftStateRight |= EFI_RIGHT_ALT_PRESSED;
}
- if (KEY_OPTION_LOGO_PRESSED (KeyOption)) {
+ if (KeyOptions.Options.LogoPressed) {
KeyShiftStateRight |= EFI_RIGHT_LOGO_PRESSED;
}
- if (KEY_OPTION_MENU_PRESSED (KeyOption)) {
+ if (KeyOptions.Options.MenuPressed) {
KeyShiftStateRight |= EFI_MENU_KEY_PRESSED;
}
- if (KEY_OPTION_SYS_REQ_PRESSED (KeyOption)) {
+ if (KeyOptions.Options.SysReqPressed) {
KeyShiftStateRight |= EFI_SYS_REQ_PRESSED;
}
Modified: trunk/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
2013-12-18 03:02:52 UTC (rev 14999)
+++ trunk/edk2/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.h
2013-12-18 05:51:22 UTC (rev 15000)
@@ -2,7 +2,7 @@
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>
+Copyright (c) 2007 - 2013, 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
@@ -25,84 +25,7 @@
#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;
Modified: trunk/edk2/MdePkg/Include/Uefi/UefiSpec.h
===================================================================
--- trunk/edk2/MdePkg/Include/Uefi/UefiSpec.h 2013-12-18 03:02:52 UTC (rev
14999)
+++ trunk/edk2/MdePkg/Include/Uefi/UefiSpec.h 2013-12-18 05:51:22 UTC (rev
15000)
@@ -2043,41 +2043,46 @@
///
/// EFI Boot Key Data
///
-typedef UINT32 EFI_BOOT_KEY_DATA;
-///
-/// Indicates the revision of the EFI_KEY_OPTION structure. This revision
level should be 0.
-///
-#define EFI_KEY_OPTION_REVISION_MASK 0x000000FF
-///
-/// Either the left or right Shift keys must be pressed (1) or must not be
pressed (0).
-///
-#define EFI_KEY_OPTION_SHIFT_PRESSED_MASK BIT8
-///
-/// Either the left or right Control keys must be pressed (1) or must not be
pressed (0).
-///
-#define EFI_KEY_OPTION_CONTROL_PRESSED_MASK BIT9
-///
-/// Either the left or right Alt keys must be pressed (1) or must not be
pressed (0).
-///
-#define EFI_KEY_OPTION_ALT_PRESSED_MASK BIT10
-///
-/// Either the left or right Logo keys must be pressed (1) or must not be
pressed (0).
-///
-#define EFI_KEY_OPTION_LOGO_PRESSED_MASK BIT11
-///
-/// The Menu key must be pressed (1) or must not be pressed (0).
-///
-#define EFI_KEY_OPTION_MENU_PRESSED_MASK BIT12
-///
-/// The SysReq key must be pressed (1) or must not be pressed (0).
-///
-#define EFI_KEY_OPTION_SYS_REQ_PRESSED_MASK BIT13
-///
-/// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If
-/// zero, then only the shift state is considered. If more than one, then the
boot option will
-/// only be launched if all of the specified keys are pressed with the same
shift state.
-///
-#define EFI_KEY_OPTION_INPUT_KEY_COUNT_MASK (BIT30 | BIT31)
+typedef union {
+ struct {
+ ///
+ /// Indicates the revision of the EFI_KEY_OPTION structure. This revision
level should be 0.
+ ///
+ UINT32 Revision : 8;
+ ///
+ /// Either the left or right Shift keys must be pressed (1) or must not be
pressed (0).
+ ///
+ UINT32 ShiftPressed : 1;
+ ///
+ /// Either the left or right Control keys must be pressed (1) or must not
be pressed (0).
+ ///
+ UINT32 ControlPressed : 1;
+ ///
+ /// Either the left or right Alt keys must be pressed (1) or must not be
pressed (0).
+ ///
+ UINT32 AltPressed : 1;
+ ///
+ /// Either the left or right Logo keys must be pressed (1) or must not be
pressed (0).
+ ///
+ UINT32 LogoPressed : 1;
+ ///
+ /// The Menu key must be pressed (1) or must not be pressed (0).
+ ///
+ UINT32 MenuPressed : 1;
+ ///
+ /// The SysReq key must be pressed (1) or must not be pressed (0).
+ ///
+ UINT32 SysReqPressed : 1;
+ UINT32 Reserved : 16;
+ ///
+ /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from
0-3. If
+ /// zero, then only the shift state is considered. If more than one, then
the boot option will
+ /// only be launched if all of the specified keys are pressed with the
same shift state.
+ ///
+ UINT32 InputKeyCount : 2;
+ } Options;
+ UINT32 PackedValue;
+} EFI_BOOT_KEY_DATA;
///
/// EFI Key Option.
Modified: trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
2013-12-18 03:02:52 UTC (rev 14999)
+++ trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
2013-12-18 05:51:22 UTC (rev 15000)
@@ -48,16 +48,6 @@
} BGFG_OPERATION;
/**
- 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))
-
-/**
Update the optional data for a boot or driver option.
If optional data exists it will be changed.
@@ -843,7 +833,7 @@
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM),
gShellDebug1HiiHandle, Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- NewKeyOption.KeyData = (UINT32)Intermediate;
+ NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate;
Temp = StrStr(Walker, L" ");
if (Temp != NULL) {
Walker = Temp;
@@ -858,13 +848,13 @@
// Now we know how many EFI_INPUT_KEY structs we need to attach to the
end of the EFI_KEY_OPTION struct.
// Re-allocate with the added information.
//
- KeyOptionBuffer = AllocateCopyPool(sizeof(EFI_KEY_OPTION) +
(sizeof(EFI_KEY_DATA) * KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption)),
&NewKeyOption);
+ KeyOptionBuffer = AllocateCopyPool(sizeof(EFI_KEY_OPTION) +
(sizeof(EFI_KEY_DATA) * NewKeyOption.KeyData.Options.InputKeyCount),
&NewKeyOption);
if (KeyOptionBuffer == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM),
gShellDebug1HiiHandle);
ShellStatus = SHELL_OUT_OF_RESOURCES;
}
}
- for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter <
KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption); LoopCounter++) {
+ for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter <
NewKeyOption.KeyData.Options.InputKeyCount; LoopCounter++) {
//
// ScanCode
//
@@ -930,7 +920,7 @@
VariableName,
(EFI_GUID*)&gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) *
KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption)),
+ sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) *
NewKeyOption.KeyData.Options.InputKeyCount),
KeyOptionBuffer);
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL),
gShellDebug1HiiHandle, VariableName, Status);
Modified: trunk/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c
2013-12-18 03:02:52 UTC (rev 14999)
+++ trunk/edk2/ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c
2013-12-18 05:51:22 UTC (rev 15000)
@@ -48,16 +48,6 @@
} BGFG_OPERATION;
/**
- 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))
-
-/**
Update the optional data for a boot or driver option.
If optional data exists it will be changed.
@@ -841,7 +831,7 @@
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM),
gShellInstall1HiiHandle, Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- NewKeyOption.KeyData = (UINT32)Intermediate;
+ NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate;
Temp = StrStr(Walker, L" ");
if (Temp != NULL) {
Walker = Temp;
@@ -856,13 +846,13 @@
// Now we know how many EFI_INPUT_KEY structs we need to attach to the
end of the EFI_KEY_OPTION struct.
// Re-allocate with the added information.
//
- KeyOptionBuffer = AllocateCopyPool(sizeof(EFI_KEY_OPTION) +
(sizeof(EFI_INPUT_KEY) * KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption)),
&NewKeyOption);
+ KeyOptionBuffer = AllocateCopyPool(sizeof(EFI_KEY_OPTION) +
(sizeof(EFI_INPUT_KEY) * NewKeyOption.KeyData.Options.InputKeyCount),
&NewKeyOption);
if (KeyOptionBuffer == NULL) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM),
gShellInstall1HiiHandle);
ShellStatus = SHELL_OUT_OF_RESOURCES;
}
}
- for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter <
KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption); LoopCounter++) {
+ for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter <
NewKeyOption.KeyData.Options.InputKeyCount; LoopCounter++) {
//
// ScanCode
//
@@ -928,7 +918,7 @@
VariableName,
(EFI_GUID*)&gEfiGlobalVariableGuid,
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
- sizeof(EFI_KEY_OPTION) + (sizeof(EFI_INPUT_KEY) *
KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption)),
+ sizeof(EFI_KEY_OPTION) + (sizeof(EFI_INPUT_KEY) *
NewKeyOption.KeyData.Options.InputKeyCount),
KeyOptionBuffer);
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL),
gShellInstall1HiiHandle, VariableName, Status);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits