mirror of https://github.com/acidanthera/audk.git
Change Bcfg.c to use the new definition of EFI_KEY_OPTION.
Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com> Reviewed-by: Eric Dong<eric.dong@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13681 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
933d80a149
commit
3206b5e75d
|
@ -47,6 +47,16 @@ typedef struct {
|
||||||
CONST CHAR16 *OptData;
|
CONST CHAR16 *OptData;
|
||||||
} BGFG_OPERATION;
|
} 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.
|
Update the optional data for a boot or driver option.
|
||||||
|
|
||||||
|
@ -832,7 +842,7 @@ BcfgAddOptDebug1(
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Walker);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Walker);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate;
|
NewKeyOption.KeyData = (UINT32)Intermediate;
|
||||||
Temp = StrStr(Walker, L" ");
|
Temp = StrStr(Walker, L" ");
|
||||||
if (Temp != NULL) {
|
if (Temp != NULL) {
|
||||||
Walker = Temp;
|
Walker = Temp;
|
||||||
|
@ -847,13 +857,13 @@ BcfgAddOptDebug1(
|
||||||
// Now we know how many EFI_INPUT_KEY structs we need to attach to the end of the EFI_KEY_OPTION struct.
|
// 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.
|
// Re-allocate with the added information.
|
||||||
//
|
//
|
||||||
KeyOptionBuffer = AllocateCopyPool(sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) * NewKeyOption.KeyData.Options.InputKeyCount), &NewKeyOption);
|
KeyOptionBuffer = AllocateCopyPool(sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) * KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption)), &NewKeyOption);
|
||||||
if (KeyOptionBuffer == NULL) {
|
if (KeyOptionBuffer == NULL) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellDebug1HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellDebug1HiiHandle);
|
||||||
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
ShellStatus = SHELL_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter < KeyOptionBuffer->KeyData.Options.InputKeyCount; LoopCounter++) {
|
for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter < KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption); LoopCounter++) {
|
||||||
//
|
//
|
||||||
// ScanCode
|
// ScanCode
|
||||||
//
|
//
|
||||||
|
@ -919,7 +929,7 @@ BcfgAddOptDebug1(
|
||||||
VariableName,
|
VariableName,
|
||||||
(EFI_GUID*)&gEfiGlobalVariableGuid,
|
(EFI_GUID*)&gEfiGlobalVariableGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) * NewKeyOption.KeyData.Options.InputKeyCount),
|
sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) * KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption)),
|
||||||
KeyOptionBuffer);
|
KeyOptionBuffer);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellDebug1HiiHandle, VariableName, Status);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellDebug1HiiHandle, VariableName, Status);
|
||||||
|
|
Loading…
Reference in New Issue