TianoCore EDK2 master
Loading...
Searching...
No Matches
BmHotkey.c File Reference
#include "InternalBm.h"

Go to the source code of this file.

Data Structures

struct  BM_COLLECT_KEY_OPTIONS_PARAM
 

Functions

UINTN BmSizeOfKeyOption (IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption)
 
BOOLEAN BmIsKeyOptionValid (IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption, IN UINTN KeyOptionSize)
 
BOOLEAN BmIsKeyOptionVariable (CHAR16 *Name, EFI_GUID *Guid, UINT16 *OptionNumber)
 
VOID BmCollectKeyOptions (CHAR16 *Name, EFI_GUID *Guid, VOID *Context)
 
EFI_BOOT_MANAGER_KEY_OPTIONBmGetKeyOptions (OUT UINTN *Count)
 
BOOLEAN BmBitSet (IN UINT32 Value, IN UINT32 Bit)
 
EFI_STATUS BmInitializeKeyFields (IN UINT32 Modifier, IN VA_LIST Args, OUT EFI_BOOT_MANAGER_KEY_OPTION *KeyOption)
 
VOID EFIAPI EfiBootManagerHotkeyBoot (VOID)
 
EFI_STATUS EFIAPI BmHotkeyCallback (IN EFI_KEY_DATA *KeyData)
 
EFI_HANDLEBmGetActiveConsoleIn (OUT UINTN *Count)
 
EFI_STATUS BmUnregisterHotkeyNotify (IN BM_HOTKEY *Hotkey)
 
EFI_STATUS BmRegisterHotkeyNotify (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TxtInEx, IN BM_HOTKEY *Hotkey)
 
VOID BmGenerateKeyShiftState (IN UINTN Depth, IN EFI_BOOT_MANAGER_KEY_OPTION *KeyOption, IN UINT32 KeyShiftState, IN UINT32 *KeyShiftStates, IN UINTN *KeyShiftStateCount)
 
EFI_STATUS BmProcessKeyOption (IN EFI_BOOT_MANAGER_KEY_OPTION *KeyOption)
 
VOID EFIAPI BmTxtInExCallback (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS BmFreeKeyOptions (IN EFI_BOOT_MANAGER_KEY_OPTION *KeyOptions, IN UINTN KeyOptionCount)
 
EFI_STATUS EFIAPI EfiBootManagerRegisterContinueKeyOption (IN UINT32 Modifier,...)
 
VOID EFIAPI BmStopHotkeyService (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI EfiBootManagerStartHotkeyService (IN EFI_EVENT *HotkeyTriggered)
 
EFI_STATUS EFIAPI EfiBootManagerAddKeyOptionVariable (OUT EFI_BOOT_MANAGER_KEY_OPTION *AddedOption OPTIONAL, IN UINT16 BootOptionNumber, IN UINT32 Modifier,...)
 
EFI_STATUS EFIAPI EfiBootManagerDeleteKeyOptionVariable (IN EFI_BOOT_MANAGER_KEY_OPTION *DeletedOption OPTIONAL, IN UINT32 Modifier,...)
 

Variables

EFI_LOCK mBmHotkeyLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY)
 
LIST_ENTRY mBmHotkeyList = INITIALIZE_LIST_HEAD_VARIABLE (mBmHotkeyList)
 
EFI_EVENT mBmHotkeyTriggered = NULL
 
BOOLEAN mBmHotkeyServiceStarted = FALSE
 
UINTN mBmHotkeySupportCount = 0
 
EFI_BOOT_MANAGER_LOAD_OPTION mBmHotkeyBootOption = { LoadOptionNumberUnassigned }
 
EFI_BOOT_MANAGER_KEY_OPTIONmBmContinueKeyOption = NULL
 
VOID * mBmTxtInExRegistration = NULL
 

Detailed Description

Hotkey library functions.

Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file BmHotkey.c.

Function Documentation

◆ BmBitSet()

BOOLEAN BmBitSet ( IN UINT32  Value,
IN UINT32  Bit 
)

Check whether the bit is set in the value.

Parameters
ValueThe value need to be check.
BitThe bit filed need to be check.
Return values
TRUEThe bit is set.
FALSEThe bit is not set.

Definition at line 232 of file BmHotkey.c.

◆ BmCollectKeyOptions()

VOID BmCollectKeyOptions ( CHAR16 *  Name,
EFI_GUID Guid,
VOID *  Context 
)

Visitor function to collect the key options from NV storage.

Parameters
NameVariable name.
GuidVariable GUID.
ContextThe same context passed to BmForEachVariable.

Definition at line 150 of file BmHotkey.c.

◆ BmFreeKeyOptions()

EFI_STATUS BmFreeKeyOptions ( IN EFI_BOOT_MANAGER_KEY_OPTION KeyOptions,
IN UINTN  KeyOptionCount 
)

Free the key options returned from BmGetKeyOptions.

Parameters
KeyOptionsPointer to the key options.
KeyOptionCountNumber of the key options.
Return values
EFI_SUCCESSThe key options are freed.
EFI_NOT_FOUNDKeyOptions is NULL.

Definition at line 787 of file BmHotkey.c.

◆ BmGenerateKeyShiftState()

VOID BmGenerateKeyShiftState ( IN UINTN  Depth,
IN EFI_BOOT_MANAGER_KEY_OPTION KeyOption,
IN UINT32  KeyShiftState,
IN UINT32 *  KeyShiftStates,
IN UINTN KeyShiftStateCount 
)

Generate key shift state base on the input key option info.

Parameters
DepthWhich key is checked.
KeyOptionInput key option info.
KeyShiftStateInput key shift state.
KeyShiftStatesReturn possible key shift state array.
KeyShiftStateCountPossible key shift state count.

Definition at line 591 of file BmHotkey.c.

◆ BmGetActiveConsoleIn()

EFI_HANDLE * BmGetActiveConsoleIn ( OUT UINTN Count)

Return the active Simple Text Input Ex handle array. If the SystemTable.ConsoleInHandle is NULL, the function returns all founded Simple Text Input Ex handles. Otherwise, it just returns the ConsoleInHandle.

Parameters
CountReturn the handle count.
Return values
Theactive console handles.

Definition at line 450 of file BmHotkey.c.

◆ BmGetKeyOptions()

EFI_BOOT_MANAGER_KEY_OPTION * BmGetKeyOptions ( OUT UINTN Count)

Return the array of key options.

Parameters
CountReturn the number of key options.
Return values
NULLNo key option.
OtherPointer to the key options.

Definition at line 202 of file BmHotkey.c.

◆ BmHotkeyCallback()

EFI_STATUS EFIAPI BmHotkeyCallback ( IN EFI_KEY_DATA KeyData)

This is the common notification function for HotKeys, it will be registered with SimpleTextInEx protocol interface - RegisterKeyNotify() of ConIn handle.

Parameters
KeyDataA pointer to a buffer that is filled in with the keystroke information for the key that was pressed.
Return values
EFI_SUCCESSKeyData is successfully processed.
Returns
EFI_NOT_FOUND Fail to find boot option variable.

Definition at line 351 of file BmHotkey.c.

◆ BmInitializeKeyFields()

EFI_STATUS BmInitializeKeyFields ( IN UINT32  Modifier,
IN VA_LIST  Args,
OUT EFI_BOOT_MANAGER_KEY_OPTION KeyOption 
)

Initialize the KeyData and Key[] in the EFI_BOOT_MANAGER_KEY_OPTION.

Parameters
ModifierInput key info.
ArgsVa_list info.
KeyOptionKey info which need to update.
Return values
EFI_SUCCESSSucceed to initialize the KeyData and Key[].
Returns
EFI_INVALID_PARAMETER Input parameter error.

Definition at line 251 of file BmHotkey.c.

◆ BmIsKeyOptionValid()

BOOLEAN BmIsKeyOptionValid ( IN CONST EFI_BOOT_MANAGER_KEY_OPTION KeyOption,
IN UINTN  KeyOptionSize 
)

Check whether the input key option is valid.

Parameters
KeyOptionKey option.
KeyOptionSizeSize of the key option.
Return values
TRUEInput key option is valid.
FALSEInput key option is not valid.

Definition at line 56 of file BmHotkey.c.

◆ BmIsKeyOptionVariable()

BOOLEAN BmIsKeyOptionVariable ( CHAR16 *  Name,
EFI_GUID Guid,
UINT16 *  OptionNumber 
)

Check whether the input variable is an key option variable.

Parameters
NameInput variable name.
GuidInput variable guid.
OptionNumberThe option number of this key option variable.
Return values
TRUEInput variable is a key option variable.
FALSEInput variable is not a key option variable.

Definition at line 107 of file BmHotkey.c.

◆ BmProcessKeyOption()

EFI_STATUS BmProcessKeyOption ( IN EFI_BOOT_MANAGER_KEY_OPTION KeyOption)

Add it to hot key database, register it to existing TxtInEx. New TxtInEx will be automatically registered with all the hot key in dababase

Parameters
KeyOptionInput key option info.

Definition at line 660 of file BmHotkey.c.

◆ BmRegisterHotkeyNotify()

EFI_STATUS BmRegisterHotkeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL TxtInEx,
IN BM_HOTKEY Hotkey 
)

Register hotkey notify list.

Parameters
TxtInExPointer to EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL protocol.
HotkeyHotkey list.
Return values
EFI_SUCCESSRegister hotkey notify success.
OthersRegister hotkey notify failed.

Definition at line 544 of file BmHotkey.c.

◆ BmSizeOfKeyOption()

UINTN BmSizeOfKeyOption ( IN CONST EFI_BOOT_MANAGER_KEY_OPTION KeyOption)

Return the buffer size of the EFI_BOOT_MANAGER_KEY_OPTION data.

Parameters
KeyOptionThe input key option info.
Return values
Thebuffer size of the key option data.

Definition at line 37 of file BmHotkey.c.

◆ BmStopHotkeyService()

VOID EFIAPI BmStopHotkeyService ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Stop the hotkey processing.

Parameters
EventEvent pointer related to hotkey service.
ContextContext pass to this function.

Definition at line 850 of file BmHotkey.c.

◆ BmTxtInExCallback()

VOID EFIAPI BmTxtInExCallback ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Callback function for SimpleTextInEx protocol install events

Parameters
Eventthe event that is signaled.
Contextnot used here.

Definition at line 731 of file BmHotkey.c.

◆ BmUnregisterHotkeyNotify()

EFI_STATUS BmUnregisterHotkeyNotify ( IN BM_HOTKEY Hotkey)

Unregister hotkey notify list.

Parameters
HotkeyHotkey list.
Return values
EFI_SUCCESSUnregister hotkey notify success.
OthersUnregister hotkey notify failed.

Definition at line 497 of file BmHotkey.c.

◆ EfiBootManagerAddKeyOptionVariable()

EFI_STATUS EFIAPI EfiBootManagerAddKeyOptionVariable ( OUT EFI_BOOT_MANAGER_KEY_OPTION *AddedOption  OPTIONAL,
IN UINT16  BootOptionNumber,
IN UINT32  Modifier,
  ... 
)

Add the key option. It adds the key option variable and the key option takes affect immediately.

Parameters
AddedOptionReturn the added key option.
BootOptionNumberThe boot option number for the key option.
ModifierKey shift state.
...Parameter list of pointer of EFI_INPUT_KEY.
Return values
EFI_SUCCESSThe key option is added.
EFI_ALREADY_STARTEDThe hot key is already used by certain key option.

Definition at line 972 of file BmHotkey.c.

◆ EfiBootManagerDeleteKeyOptionVariable()

EFI_STATUS EFIAPI EfiBootManagerDeleteKeyOptionVariable ( IN EFI_BOOT_MANAGER_KEY_OPTION *DeletedOption  OPTIONAL,
IN UINT32  Modifier,
  ... 
)

Delete the Key Option variable and unregister the hot key

Parameters
DeletedOptionReturn the deleted key options.
ModifierKey shift state.
...Parameter list of pointer of EFI_INPUT_KEY.
Return values
EFI_SUCCESSThe key option is deleted.
EFI_NOT_FOUNDThe key option cannot be found.

Definition at line 1089 of file BmHotkey.c.

◆ EfiBootManagerHotkeyBoot()

VOID EFIAPI EfiBootManagerHotkeyBoot ( VOID  )

Try to boot the boot option triggered by hot key.

Definition at line 328 of file BmHotkey.c.

◆ EfiBootManagerRegisterContinueKeyOption()

EFI_STATUS EFIAPI EfiBootManagerRegisterContinueKeyOption ( IN UINT32  Modifier,
  ... 
)

Register the key option to exit the waiting of the Boot Manager timeout. Platform should ensure that the continue key option isn't conflict with other boot key options.

Parameters
ModifierKey shift state.
...Parameter list of pointer of EFI_INPUT_KEY.
Return values
EFI_SUCCESSSuccessfully register the continue key option.
EFI_ALREADY_STARTEDThe continue key option is already registered.

Definition at line 813 of file BmHotkey.c.

◆ EfiBootManagerStartHotkeyService()

EFI_STATUS EFIAPI EfiBootManagerStartHotkeyService ( IN EFI_EVENT HotkeyTriggered)

Start the hot key service so that the key press can trigger the boot option.

Parameters
HotkeyTriggeredReturn the waitable event and it will be signaled when a valid hot key is pressed.
Return values
EFI_SUCCESSThe hot key service is started.

Definition at line 882 of file BmHotkey.c.

Variable Documentation

◆ mBmContinueKeyOption

EFI_BOOT_MANAGER_KEY_OPTION* mBmContinueKeyOption = NULL

Definition at line 26 of file BmHotkey.c.

◆ mBmHotkeyBootOption

EFI_BOOT_MANAGER_LOAD_OPTION mBmHotkeyBootOption = { LoadOptionNumberUnassigned }

Definition at line 24 of file BmHotkey.c.

◆ mBmHotkeyList

LIST_ENTRY mBmHotkeyList = INITIALIZE_LIST_HEAD_VARIABLE (mBmHotkeyList)

Definition at line 16 of file BmHotkey.c.

◆ mBmHotkeyLock

EFI_LOCK mBmHotkeyLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY)

Definition at line 15 of file BmHotkey.c.

◆ mBmHotkeyServiceStarted

BOOLEAN mBmHotkeyServiceStarted = FALSE

Definition at line 18 of file BmHotkey.c.

◆ mBmHotkeySupportCount

UINTN mBmHotkeySupportCount = 0

Definition at line 19 of file BmHotkey.c.

◆ mBmHotkeyTriggered

EFI_EVENT mBmHotkeyTriggered = NULL

Definition at line 17 of file BmHotkey.c.

◆ mBmTxtInExRegistration

VOID* mBmTxtInExRegistration = NULL

Definition at line 27 of file BmHotkey.c.