]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Base on the type field to get the width of value field for option opcode.
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 6 Jan 2013 06:12:50 +0000 (06:12 +0000)
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 6 Jan 2013 06:12:50 +0000 (06:12 +0000)
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14036 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/UefiHiiLib/HiiLib.c
MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c

index 02887bf76c7bb155d0bf944d641ba3e3dbd93913..ba74d0f88f0a42bc08716e3274732e77af07d25c 100644 (file)
@@ -946,6 +946,7 @@ InternalHiiValidateCurrentSetting (
   UINT16                       Offset;\r
   UINT16                       Width;\r
   UINT64                       VarValue;\r
+  UINT64                       TmpValue;\r
   LIST_ENTRY                   *Link;\r
   UINT8                        *VarBuffer;\r
   UINTN                        MaxBufferSize;\r
@@ -1510,7 +1511,9 @@ InternalHiiValidateCurrentSetting (
             //\r
             // Check current value is the value of one of option.\r
             //\r
-            if (VarValue == IfrOneOfOption->Value.u64) {\r
+            TmpValue = 0;\r
+            CopyMem (&TmpValue, &IfrOneOfOption->Value, IfrOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));\r
+            if (VarValue == TmpValue) {\r
               //\r
               // The value is one of option value.\r
               // Set OpCode to Zero, don't need check again.\r
@@ -2628,7 +2631,7 @@ HiiCreateOneOfOptionOpCode (
   OpCode.Type   = Type;\r
   CopyMem (&OpCode.Value, &Value, mHiiDefaultTypeToWidth[Type]);\r
 \r
-  return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_ONE_OF_OPTION_OP, sizeof (OpCode));\r
+  return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_ONE_OF_OPTION_OP, OFFSET_OF(EFI_IFR_ONE_OF_OPTION, Value) + mHiiDefaultTypeToWidth[Type]);\r
 }\r
 \r
 /**\r
index ee5203459c101bc932eb41221f8f737348fa71c3..81cebdabcd51ba9e67bb84fb414bbb87abe42244 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Implementation of interfaces function for EFI_HII_CONFIG_ROUTING_PROTOCOL.\r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1861,7 +1861,7 @@ ParseIfrData (
         // Prepare new DefaultValue\r
         //\r
         DefaultData.Type  = DefaultValueFromFlag;\r
-        CopyMem (&DefaultData.Value.u64, &IfrOneOfOption->Value.u64, sizeof (UINT64));\r
+        CopyMem (&DefaultData.Value, &IfrOneOfOption->Value, IfrOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));\r
         if ((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT) == EFI_IFR_OPTION_DEFAULT) {\r
           DefaultData.DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
           InsertDefaultValue (BlockData, &DefaultData);\r
@@ -1886,7 +1886,7 @@ ParseIfrData (
         // Prepare new DefaultValue\r
         //        \r
         DefaultData.Type        = DefaultValueFromDefault;\r
-        CopyMem (&DefaultData.Value.u64, &IfrOneOfOption->Value.u64, sizeof (UINT64));      \r
+        CopyMem (&DefaultData.Value, &IfrOneOfOption->Value, IfrOneOfOption->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));\r
         for (LinkData = DefaultIdArray->Entry.ForwardLink; LinkData != &DefaultIdArray->Entry; LinkData = LinkData->ForwardLink) {\r
           DefaultDataPtr = BASE_CR (LinkData, IFR_DEFAULT_DATA, Entry); \r
           DefaultData.DefaultId   = DefaultDataPtr->DefaultId;\r
index 7493a943027ebea1eda4c6e7eb02ff7a96341d27..cc3823f0efd4573001697ad48bb5e9f2f8a11fbb 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Parser for IFR binary encoding.\r
 \r
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1809,7 +1809,7 @@ ParseOpCodes (
       CurrentOption->Flags = ((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Flags;\r
       CurrentOption->Value.Type = ((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Type;\r
       CopyMem (&CurrentOption->Text, &((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Option, sizeof (EFI_STRING_ID));\r
-      CopyMem (&CurrentOption->Value.Value, &((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Value, sizeof (EFI_IFR_TYPE_VALUE));\r
+      CopyMem (&CurrentOption->Value.Value, &((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Value, OpCodeLength - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));\r
       ExtendValueToU64 (&CurrentOption->Value);\r
 \r
       ConditionalExprCount = GetConditionalExpressionCount(ExpressOption);\r