summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-08-27 10:09:34 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2012-08-27 10:09:34 +0000
commit3206b5e75d1c03830331a3d5a5a9f9e50e426a8e (patch)
tree4f001b7b44af8868e8fa0c86662d2be6fd7ebaaa /ShellPkg
parent933d80a1496ce5e3c3de62be0340cc1473f9b85b (diff)
downloadedk2-platforms-3206b5e75d1c03830331a3d5a5a9f9e50e426a8e.tar.xz
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
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
index fcf5b5014c..095a9460e6 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Bcfg.c
@@ -48,6 +48,16 @@ typedef struct {
} 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.
@@ -832,7 +842,7 @@ BcfgAddOptDebug1(
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Walker);
ShellStatus = SHELL_INVALID_PARAMETER;
}
- NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate;
+ NewKeyOption.KeyData = (UINT32)Intermediate;
Temp = StrStr(Walker, L" ");
if (Temp != NULL) {
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.
// 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) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellDebug1HiiHandle);
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
//
@@ -919,7 +929,7 @@ BcfgAddOptDebug1(
VariableName,
(EFI_GUID*)&gEfiGlobalVariableGuid,
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);
if (EFI_ERROR(Status)) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellDebug1HiiHandle, VariableName, Status);