mirror of https://github.com/acidanthera/audk.git
Change the EFI_BOOT_KEY_DATA definition to use macro instead of bit fields.
Change the BDS module in IntelFrameworkModulePkg to use the new EFI_BOOT_KEY_DATA definition. Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com> Reviewed-by: Eric Dong<eric.dong@intel.com> Reviewed-by: Kinney Michael D<michael.d.kinney@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13659 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b92b1209f7
commit
53cdd43979
|
@ -101,7 +101,7 @@ RegisterHotkey (
|
|||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
KeyOptionSize = sizeof (EFI_KEY_OPTION) + KeyOption->KeyData.Options.InputKeyCount * sizeof (EFI_INPUT_KEY);
|
||||
KeyOptionSize = sizeof (EFI_KEY_OPTION) + KEY_OPTION_INPUT_KEY_COUNT (KeyOption) * sizeof (EFI_INPUT_KEY);
|
||||
UpdateBootOption = FALSE;
|
||||
|
||||
//
|
||||
|
@ -143,9 +143,8 @@ RegisterHotkey (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (KeyOption->KeyData.PackedValue == TempOption->KeyData.PackedValue) {
|
||||
if (KeyOption->KeyData.Options.InputKeyCount == 0 ||
|
||||
CompareMem (
|
||||
if (KeyOption->KeyData == TempOption->KeyData) {
|
||||
if (CompareMem (
|
||||
((UINT8 *) TempOption) + sizeof (EFI_KEY_OPTION),
|
||||
((UINT8 *) KeyOption) + sizeof (EFI_KEY_OPTION),
|
||||
KeyOptionSize - sizeof (EFI_KEY_OPTION)
|
||||
|
@ -551,7 +550,6 @@ HotkeyInsertList (
|
|||
BDS_HOTKEY_OPTION *HotkeyLeft;
|
||||
BDS_HOTKEY_OPTION *HotkeyRight;
|
||||
UINTN Index;
|
||||
EFI_BOOT_KEY_DATA KeyOptions;
|
||||
UINT32 KeyShiftStateLeft;
|
||||
UINT32 KeyShiftStateRight;
|
||||
EFI_INPUT_KEY *InputKey;
|
||||
|
@ -564,35 +562,31 @@ HotkeyInsertList (
|
|||
|
||||
HotkeyLeft->Signature = BDS_HOTKEY_OPTION_SIGNATURE;
|
||||
HotkeyLeft->BootOptionNumber = KeyOption->BootOption;
|
||||
|
||||
KeyOptions = KeyOption->KeyData;
|
||||
|
||||
HotkeyLeft->CodeCount = (UINT8) KeyOptions.Options.InputKeyCount;
|
||||
HotkeyLeft->CodeCount = (UINT8) KEY_OPTION_INPUT_KEY_COUNT (KeyOption);
|
||||
|
||||
//
|
||||
// Map key shift state from KeyOptions to EFI_KEY_DATA.KeyState
|
||||
//
|
||||
KeyShiftStateRight = EFI_SHIFT_STATE_VALID;
|
||||
if (KeyOptions.Options.ShiftPressed) {
|
||||
if (KEY_OPTION_SHIFT_PRESSED (KeyOption)) {
|
||||
KeyShiftStateRight |= EFI_RIGHT_SHIFT_PRESSED;
|
||||
}
|
||||
if (KeyOptions.Options.ControlPressed) {
|
||||
if (KEY_OPTION_CONTROL_PRESSED (KeyOption)) {
|
||||
KeyShiftStateRight |= EFI_RIGHT_CONTROL_PRESSED;
|
||||
}
|
||||
if (KeyOptions.Options.AltPressed) {
|
||||
if (KEY_OPTION_ALT_PRESSED (KeyOption)) {
|
||||
KeyShiftStateRight |= EFI_RIGHT_ALT_PRESSED;
|
||||
}
|
||||
if (KeyOptions.Options.LogoPressed) {
|
||||
if (KEY_OPTION_LOGO_PRESSED (KeyOption)) {
|
||||
KeyShiftStateRight |= EFI_RIGHT_LOGO_PRESSED;
|
||||
}
|
||||
if (KeyOptions.Options.MenuPressed) {
|
||||
if (KEY_OPTION_MENU_PRESSED (KeyOption)) {
|
||||
KeyShiftStateRight |= EFI_MENU_KEY_PRESSED;
|
||||
}
|
||||
if (KeyOptions.Options.SysReqPressed) {
|
||||
if (KEY_OPTION_SYS_REQ_PRESSED (KeyOption)) {
|
||||
KeyShiftStateRight |= EFI_SYS_REQ_PRESSED;
|
||||
}
|
||||
|
||||
|
||||
KeyShiftStateLeft = (KeyShiftStateRight & 0xffffff00) | ((KeyShiftStateRight & 0xff) << 1);
|
||||
|
||||
InputKey = (EFI_INPUT_KEY *) (((UINT8 *) KeyOption) + sizeof (EFI_KEY_OPTION));
|
||||
|
|
|
@ -19,13 +19,89 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include "Bds.h"
|
||||
#include "String.h"
|
||||
|
||||
#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); \
|
||||
(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;
|
||||
|
|
|
@ -2011,50 +2011,46 @@ EFI_STATUS
|
|||
///
|
||||
/// EFI Boot Key Data
|
||||
///
|
||||
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;
|
||||
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)
|
||||
|
||||
///
|
||||
/// EFI Key Option.
|
||||
///
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
///
|
||||
/// Specifies options about how the key will be processed.
|
||||
|
@ -2078,6 +2074,7 @@ typedef struct {
|
|||
///
|
||||
//EFI_INPUT_KEY Keys[];
|
||||
} EFI_KEY_OPTION;
|
||||
#pragma pack()
|
||||
|
||||
//
|
||||
// EFI File location to boot from on removable media devices
|
||||
|
|
Loading…
Reference in New Issue