summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/UefiHiiLib
diff options
context:
space:
mode:
authorydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2013-01-06 06:07:38 +0000
committerydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524>2013-01-06 06:07:38 +0000
commitd5931219354333223ac45cb2e950e3e4b1fe6267 (patch)
tree1381904e99af81c978c525a50cf7d962f427982d /MdeModulePkg/Library/UefiHiiLib
parent335e2681334c87acc5d210801cfeb55b403d1a9e (diff)
downloadedk2-platforms-d5931219354333223ac45cb2e950e3e4b1fe6267.tar.xz
Base on the type field to generate numeric opcode.
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@14034 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library/UefiHiiLib')
-rw-r--r--MdeModulePkg/Library/UefiHiiLib/HiiLib.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
index a2d31e7fda..2135cf2b83 100644
--- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
+++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c
@@ -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
@@ -2959,9 +2959,11 @@ HiiCreateNumericOpCode (
{
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;
@@ -2976,33 +2978,39 @@ HiiCreateNumericOpCode (
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;