Revision: 14778
          http://sourceforge.net/p/edk2/code/14778
Author:   vanjeff
Date:     2013-10-16 05:49:50 +0000 (Wed, 16 Oct 2013)
Log Message:
-----------
Sync patches r14006, r14034 and r14035 from main trunk.
1. Base on the value type to get the value for default opcode.
2. Base on the type field to generate numeric opcode.
3. Base on the type field to generate oneof opcode.

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/14006
    http://sourceforge.net/p/edk2/code/14034
    http://sourceforge.net/p/edk2/code/14035

Modified Paths:
--------------
    branches/UDK2010.SR1/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
    branches/UDK2010.SR1/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c

Modified: branches/UDK2010.SR1/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Library/UefiHiiLib/HiiLib.c       
2013-10-15 09:25:38 UTC (rev 14777)
+++ branches/UDK2010.SR1/MdeModulePkg/Library/UefiHiiLib/HiiLib.c       
2013-10-16 05:49:50 UTC (rev 14778)
@@ -1,7 +1,7 @@
 /** @file
   HII Library implementation that uses DXE protocols and services.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -3009,7 +3009,7 @@
   OpCode.DefaultId = DefaultId;
   CopyMem (&OpCode.Value, &Value, mHiiDefaultTypeToWidth[Type]);
 
-  return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_DEFAULT_OP, 
sizeof (OpCode));
+  return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_DEFAULT_OP, 
OFFSET_OF(EFI_IFR_DEFAULT, Value) + mHiiDefaultTypeToWidth[Type]);
 }
 
 /**
@@ -3380,9 +3380,11 @@
 {
   EFI_IFR_NUMERIC  OpCode;
   UINTN            Position;
+  UINTN            Length;
 
   ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | 
EFI_IFR_FLAG_RESET_REQUIRED))) == 0);
 
+  Length  = 0;
   ZeroMem (&OpCode, sizeof (OpCode));
   OpCode.Question.QuestionId             = QuestionId;
   OpCode.Question.VarStoreId             = VarStoreId;
@@ -3397,33 +3399,39 @@
     OpCode.data.u8.MinValue = (UINT8)Minimum;
     OpCode.data.u8.MaxValue = (UINT8)Maximum;
     OpCode.data.u8.Step     = (UINT8)Step;
+    Length                  = 3;
     break;
 
   case EFI_IFR_NUMERIC_SIZE_2:
     OpCode.data.u16.MinValue = (UINT16)Minimum;
     OpCode.data.u16.MaxValue = (UINT16)Maximum;
     OpCode.data.u16.Step     = (UINT16)Step;
+    Length                   = 6;
     break;
 
   case EFI_IFR_NUMERIC_SIZE_4:
     OpCode.data.u32.MinValue = (UINT32)Minimum;
     OpCode.data.u32.MaxValue = (UINT32)Maximum;
     OpCode.data.u32.Step     = (UINT32)Step;
+    Length                   = 12;
     break;
 
   case EFI_IFR_NUMERIC_SIZE_8:
     OpCode.data.u64.MinValue = Minimum;
     OpCode.data.u64.MaxValue = Maximum;
     OpCode.data.u64.Step     = Step;
+    Length                   = 24;
     break;
   }
 
+  Length += OFFSET_OF (EFI_IFR_NUMERIC, data);
+
   if (DefaultsOpCodeHandle == NULL) {
-    return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_NUMERIC_OP, 
sizeof (OpCode));
+    return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_NUMERIC_OP, 
Length);
   }
 
   Position = InternalHiiOpCodeHandlePosition (OpCodeHandle);
-  InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_NUMERIC_OP, 
sizeof (OpCode), 0, 1);
+  InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_NUMERIC_OP, 
Length, 0, 1);
   InternalHiiAppendOpCodes (OpCodeHandle, DefaultsOpCodeHandle);
   HiiCreateEndOpCode (OpCodeHandle);
   return InternalHiiOpCodeHandleBuffer (OpCodeHandle) + Position;
@@ -3536,6 +3544,7 @@
 {
   EFI_IFR_ONE_OF  OpCode;
   UINTN           Position;
+  UINTN           Length;
 
   ASSERT (OptionsOpCodeHandle != NULL);
   ASSERT ((QuestionFlags & (~(EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | 
EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY))) == 0);
@@ -3549,8 +3558,11 @@
   OpCode.Question.Flags                  = QuestionFlags;
   OpCode.Flags                           = OneOfFlags;
 
+  Length  = OFFSET_OF (EFI_IFR_ONE_OF, data);
+  Length += (1 << (OneOfFlags & EFI_IFR_NUMERIC_SIZE)) * 3;
+
   Position = InternalHiiOpCodeHandlePosition (OpCodeHandle);
-  InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_ONE_OF_OP, 
sizeof (OpCode), 0, 1);
+  InternalHiiCreateOpCodeExtended (OpCodeHandle, &OpCode, EFI_IFR_ONE_OF_OP, 
Length, 0, 1);
   InternalHiiAppendOpCodes (OpCodeHandle, OptionsOpCodeHandle);
   if (DefaultsOpCodeHandle != NULL) {
     InternalHiiAppendOpCodes (OpCodeHandle, DefaultsOpCodeHandle);

Modified: 
branches/UDK2010.SR1/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
===================================================================
--- branches/UDK2010.SR1/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c  
2013-10-15 09:25:38 UTC (rev 14777)
+++ branches/UDK2010.SR1/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c  
2013-10-16 05:49:50 UTC (rev 14778)
@@ -2054,7 +2054,7 @@
       //
       DefaultData.Type        = DefaultValueFromOpcode;
       DefaultData.DefaultId   = VarDefaultId;
-      CopyMem (&DefaultData.Value, &IfrDefault->Value, sizeof 
(EFI_IFR_TYPE_VALUE));
+      CopyMem (&DefaultData.Value, &IfrDefault->Value, 
IfrDefault->Header.Length - OFFSET_OF (EFI_IFR_DEFAULT, Value));
       
       // If the value field is expression, set the cleaned flag.
       if (IfrDefault->Type ==  EFI_IFR_TYPE_OTHER) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to