**/\r
UINTN\r
BmSizeOfKeyOption (\r
- EFI_BOOT_MANAGER_KEY_OPTION *KeyOption\r
+ IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption\r
)\r
{\r
return OFFSET_OF (EFI_BOOT_MANAGER_KEY_OPTION, Keys)\r
**/\r
BOOLEAN\r
BmIsKeyOptionValid (\r
- IN EFI_BOOT_MANAGER_KEY_OPTION *KeyOption,\r
- IN UINTN KeyOptionSize\r
+ IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption,\r
+ IN UINTN KeyOptionSize\r
)\r
{\r
UINT16 OptionName[BM_OPTION_NAME_LEN];\r
{\r
UINTN Index;\r
BM_COLLECT_KEY_OPTIONS_PARAM *Param;\r
- EFI_BOOT_MANAGER_KEY_OPTION *KeyOption;\r
+ VOID *KeyOption;\r
UINT16 OptionNumber;\r
UINTN KeyOptionSize;\r
\r
Param = (BM_COLLECT_KEY_OPTIONS_PARAM *) Context;\r
\r
if (BmIsKeyOptionVariable (Name, Guid, &OptionNumber)) {\r
- GetEfiGlobalVariable2 (Name, (VOID**) &KeyOption, &KeyOptionSize);\r
+ GetEfiGlobalVariable2 (Name, &KeyOption, &KeyOptionSize);\r
ASSERT (KeyOption != NULL);\r
- KeyOption->OptionNumber = OptionNumber;\r
if (BmIsKeyOptionValid (KeyOption, KeyOptionSize)) {\r
Param->KeyOptions = ReallocatePool (\r
Param->KeyOptionCount * sizeof (EFI_BOOT_MANAGER_KEY_OPTION),\r
// Insert the key option in order\r
//\r
for (Index = 0; Index < Param->KeyOptionCount; Index++) {\r
- if (KeyOption->OptionNumber < Param->KeyOptions[Index].OptionNumber) {\r
+ if (OptionNumber < Param->KeyOptions[Index].OptionNumber) {\r
break;\r
}\r
}\r
CopyMem (&Param->KeyOptions[Index + 1], &Param->KeyOptions[Index], (Param->KeyOptionCount - Index) * sizeof (EFI_BOOT_MANAGER_KEY_OPTION));\r
- CopyMem (&Param->KeyOptions[Index], KeyOption, BmSizeOfKeyOption (KeyOption));\r
+ CopyMem (&Param->KeyOptions[Index], KeyOption, KeyOptionSize);\r
+ Param->KeyOptions[Index].OptionNumber = OptionNumber;\r
Param->KeyOptionCount++;\r
}\r
FreePool (KeyOption);\r
EFI_EVENT Event;\r
UINT32 *BootOptionSupport;\r
\r
- Status = GetEfiGlobalVariable2 (EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, (VOID **) &BootOptionSupport, NULL);\r
- ASSERT (BootOptionSupport != NULL);\r
-\r
- if ((*BootOptionSupport & EFI_BOOT_OPTION_SUPPORT_KEY) != 0) {\r
- mBmHotkeySupportCount = ((*BootOptionSupport & EFI_BOOT_OPTION_SUPPORT_COUNT) >> LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT));\r
+ GetEfiGlobalVariable2 (EFI_BOOT_OPTION_SUPPORT_VARIABLE_NAME, (VOID **) &BootOptionSupport, NULL);\r
+ if (BootOptionSupport != NULL) {\r
+ if ((*BootOptionSupport & EFI_BOOT_OPTION_SUPPORT_KEY) != 0) {\r
+ mBmHotkeySupportCount = ((*BootOptionSupport & EFI_BOOT_OPTION_SUPPORT_COUNT) >> LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT));\r
+ }\r
+ FreePool (BootOptionSupport);\r
}\r
- FreePool (BootOptionSupport);\r
\r
if (mBmHotkeySupportCount == 0) {\r
DEBUG ((EFI_D_INFO, "Bds: BootOptionSupport NV variable forbids starting the hotkey service.\n"));\r