]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Change Bcfg.c to use the new definition of EFI_KEY_OPTION.
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Aug 2012 05:05:24 +0000 (05:05 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 27 Aug 2012 05:05:24 +0000 (05:05 +0000)
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@13678 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellInstall1CommandsLib/Bcfg.c

index 1f1971286202ed58d5fcb654eb52b0ceed6aebcb..22f6c6f618cb46dc3d548aa721fd61b571ce611b 100644 (file)
@@ -47,6 +47,16 @@ typedef struct {
   CONST CHAR16          *OptData;\r
 } BGFG_OPERATION;\r
 \r
+/**\r
+  Get the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3.\r
+\r
+  @param   KeyOption  Pointer to the EFI_KEY_OPTION structure. \r
+\r
+  @return  Actual number of entries in EFI_KEY_OPTION.Keys.\r
+**/\r
+#define KEY_OPTION_INPUT_KEY_COUNT(KeyOption) \\r
+  (((KeyOption)->KeyData & EFI_KEY_OPTION_INPUT_KEY_COUNT_MASK) >> LowBitSet32 (EFI_KEY_OPTION_INPUT_KEY_COUNT_MASK))\r
+\r
 /**\r
   Update the optional data for a boot or driver option.\r
 \r
@@ -832,7 +842,7 @@ BcfgAddOptInstall1(
           ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellInstall1HiiHandle, Walker);\r
           ShellStatus = SHELL_INVALID_PARAMETER;\r
         }\r
-        NewKeyOption.KeyData.PackedValue = (UINT32)Intermediate;\r
+        NewKeyOption.KeyData = (UINT32)Intermediate;\r
         Temp = StrStr(Walker, L" ");\r
         if (Temp != NULL) {\r
           Walker = Temp;\r
@@ -847,13 +857,13 @@ BcfgAddOptInstall1(
         // Now we know how many EFI_INPUT_KEY structs we need to attach to the end of the EFI_KEY_OPTION struct.  \r
         // Re-allocate with the added information.\r
         //\r
-        KeyOptionBuffer = AllocateCopyPool(sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) * NewKeyOption.KeyData.Options.InputKeyCount), &NewKeyOption);\r
+        KeyOptionBuffer = AllocateCopyPool(sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) * KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption)), &NewKeyOption);\r
         if (KeyOptionBuffer == NULL) {\r
           ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellInstall1HiiHandle);\r
           ShellStatus = SHELL_OUT_OF_RESOURCES;\r
         }\r
       }\r
-      for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter < KeyOptionBuffer->KeyData.Options.InputKeyCount; LoopCounter++) {\r
+      for (LoopCounter = 0 ; ShellStatus == SHELL_SUCCESS && LoopCounter < KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption); LoopCounter++) {\r
         //\r
         // ScanCode\r
         //\r
@@ -919,7 +929,7 @@ BcfgAddOptInstall1(
           VariableName,\r
           (EFI_GUID*)&gEfiGlobalVariableGuid,\r
           EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,\r
-          sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) * NewKeyOption.KeyData.Options.InputKeyCount),\r
+          sizeof(EFI_KEY_OPTION) + (sizeof(EFI_KEY_DATA) * KEY_OPTION_INPUT_KEY_COUNT (&NewKeyOption)),\r
           KeyOptionBuffer);\r
         if (EFI_ERROR(Status)) {\r
           ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellInstall1HiiHandle, VariableName, Status);\r