mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/VarCheckHii: Enhance VarCheckHiiLib to support bit check
V3: (1) Reset QuestionStoredInBitField to FALSE at end opcode(EFI_IFR_END_OP) (2) Fix typo and format issues(line alignment for debug print message and value assignment...) V2: (1)Remove the VarOffsetBitLevel/StorageWidthBitLevel to reduce the final VarCheckBinSize and update the implementation accordingly. (2)Update the VAR_CHECK_HII_REVISION (3)Refine the Debug message and function comments,like update oneof", "checkbox", "numeric" to "OneOf", "CheckBox", "Numeric". VarCheckHiiLib check the value set to storage based on the possible value listed in the vfr file. Since we have enhanced vfr to support Question value stored in bit field, so now enhance VarCheckHiiLib to support bit field check. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
c9a7f34356
commit
8182e9f446
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Internal structure for Var Check Hii.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2017, 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
|
||||
|
@ -23,7 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
#pragma pack (1)
|
||||
|
||||
#define VAR_CHECK_HII_REVISION 0x0001
|
||||
#define VAR_CHECK_HII_REVISION 0x0002
|
||||
|
||||
typedef struct {
|
||||
UINT16 Revision;
|
||||
|
@ -42,6 +42,7 @@ typedef struct {
|
|||
UINT8 Length; // Length include this header
|
||||
UINT16 VarOffset;
|
||||
UINT8 StorageWidth;
|
||||
BOOLEAN BitFieldStore; // Whether the Question is stored in bit field, if TRUE, the VarOffset/StorageWidth will be saved as bit level, otherwise in byte level.
|
||||
} VAR_CHECK_HII_QUESTION_HEADER;
|
||||
|
||||
typedef struct {
|
||||
|
@ -49,6 +50,7 @@ typedef struct {
|
|||
UINT8 Length; // Length include this header
|
||||
UINT16 VarOffset;
|
||||
UINT8 StorageWidth;
|
||||
BOOLEAN BitFieldStore; // Whether the Question is stored in bit field, if TRUE, the VarOffset/StorageWidth will be saved as bit level, otherwise in byte level.
|
||||
//UINTx Data[]; // x = UINT8/UINT16/UINT32/UINT64;
|
||||
} VAR_CHECK_HII_QUESTION_ONEOF;
|
||||
|
||||
|
@ -57,6 +59,7 @@ typedef struct {
|
|||
UINT8 Length; // Length include this header
|
||||
UINT16 VarOffset;
|
||||
UINT8 StorageWidth;
|
||||
BOOLEAN BitFieldStore; // Whether the Question is stored in bit field, if TRUE, the VarOffset/StorageWidth will be saved as bit level, otherwise in byte level.
|
||||
} VAR_CHECK_HII_QUESTION_CHECKBOX;
|
||||
|
||||
typedef struct {
|
||||
|
@ -64,6 +67,7 @@ typedef struct {
|
|||
UINT8 Length; // Length include this header
|
||||
UINT16 VarOffset;
|
||||
UINT8 StorageWidth;
|
||||
BOOLEAN BitFieldStore; // Whether the Question is stored in bit field, if TRUE, the VarOffset/StorageWidth will be saved as bit level, otherwise in byte level.
|
||||
//UINTx Minimum; // x = UINT8/UINT16/UINT32/UINT64;
|
||||
//UINTx Maximum; // x = UINT8/UINT16/UINT32/UINT64;
|
||||
} VAR_CHECK_HII_QUESTION_NUMERIC;
|
||||
|
@ -73,6 +77,7 @@ typedef struct {
|
|||
UINT8 Length; // Length include this header
|
||||
UINT16 VarOffset;
|
||||
UINT8 StorageWidth;
|
||||
BOOLEAN BitFieldStore; // Whether the Question is stored in bit field, if TRUE, the VarOffset/StorageWidth will be saved as bit level, otherwise in byte level.
|
||||
UINT8 MaxContainers;
|
||||
//UINTx Data[]; // x = UINT8/UINT16/UINT32/UINT64;
|
||||
} VAR_CHECK_HII_QUESTION_ORDEREDLIST;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Include file for Var Check Hii handler and bin.
|
||||
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2017, 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
|
||||
|
@ -22,6 +22,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
#include <Guid/MdeModuleHii.h>
|
||||
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/FirmwareVolumeBlock.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Var Check Hii bin generation.
|
||||
|
||||
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2017, 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
|
||||
|
@ -120,8 +120,10 @@ DumpHiiPackage (
|
|||
EFI_IFR_OP_HEADER *IfrOpCodeHeader;
|
||||
EFI_IFR_VARSTORE *IfrVarStore;
|
||||
EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
|
||||
BOOLEAN QuestionStoredInBitField;
|
||||
|
||||
HiiPackageHeader = (EFI_HII_PACKAGE_HEADER *) HiiPackage;
|
||||
QuestionStoredInBitField = FALSE;
|
||||
|
||||
DEBUG ((DEBUG_INFO, " HiiPackageHeader->Type - 0x%02x (%a)\n", HiiPackageHeader->Type, HiiPackageTypeToStr ((UINT8) HiiPackageHeader->Type)));
|
||||
DEBUG ((DEBUG_INFO, " HiiPackageHeader->Length - 0x%06x\n", HiiPackageHeader->Length));
|
||||
|
@ -157,18 +159,24 @@ DumpHiiPackage (
|
|||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_GUID_OP:
|
||||
if (CompareGuid ((EFI_GUID *)((UINTN)IfrOpCodeHeader + sizeof (EFI_IFR_OP_HEADER)), &gEdkiiIfrBitVarstoreGuid)) {
|
||||
QuestionStoredInBitField = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_ONE_OF_OP:
|
||||
case EFI_IFR_CHECKBOX_OP:
|
||||
case EFI_IFR_NUMERIC_OP:
|
||||
case EFI_IFR_ORDERED_LIST_OP:
|
||||
DEBUG ((DEBUG_INFO, " IfrOpCodeHeader->OpCode - 0x%02x (%a)\n", IfrOpCodeHeader->OpCode, IfrOpCodeToStr (IfrOpCodeHeader->OpCode)));
|
||||
DEBUG ((DEBUG_INFO, " IfrOpCodeHeader->OpCode - 0x%02x (%a) (%a)\n", IfrOpCodeHeader->OpCode, IfrOpCodeToStr (IfrOpCodeHeader->OpCode), (QuestionStoredInBitField? "bit level": "byte level")));
|
||||
DEBUG ((DEBUG_INFO, " IfrOpCodeHeader->Length - 0x%02x\n", IfrOpCodeHeader->Length));
|
||||
DEBUG ((DEBUG_INFO, " IfrOpCodeHeader->Scope - 0x%02x\n", IfrOpCodeHeader->Scope));
|
||||
DEBUG ((DEBUG_INFO, " Prompt - 0x%04x\n", ((EFI_IFR_ONE_OF *) IfrOpCodeHeader)->Question.Header.Prompt));
|
||||
DEBUG ((DEBUG_INFO, " Help - 0x%04x\n", ((EFI_IFR_ONE_OF *) IfrOpCodeHeader)->Question.Header.Help));
|
||||
DEBUG ((DEBUG_INFO, " QuestionId - 0x%04x\n", ((EFI_IFR_ONE_OF *) IfrOpCodeHeader)->Question.QuestionId));
|
||||
DEBUG ((DEBUG_INFO, " VarStoreId - 0x%04x\n", ((EFI_IFR_ONE_OF *) IfrOpCodeHeader)->Question.VarStoreId));
|
||||
DEBUG ((DEBUG_INFO, " VarStoreInfo - 0x%04x\n", ((EFI_IFR_ONE_OF * )IfrOpCodeHeader)->Question.VarStoreInfo.VarOffset));
|
||||
DEBUG ((DEBUG_INFO, " VarStoreInfo - 0x%04x (%a)\n", ((EFI_IFR_ONE_OF * )IfrOpCodeHeader)->Question.VarStoreInfo.VarOffset, (QuestionStoredInBitField? "bit level": "byte level")));
|
||||
{
|
||||
EFI_IFR_ONE_OF *IfrOneOf;
|
||||
EFI_IFR_CHECKBOX *IfrCheckBox;
|
||||
|
@ -179,27 +187,36 @@ DumpHiiPackage (
|
|||
case EFI_IFR_ONE_OF_OP:
|
||||
IfrOneOf = (EFI_IFR_ONE_OF *) IfrOpCodeHeader;
|
||||
DEBUG ((DEBUG_INFO, " Flags - 0x%02x\n", IfrOneOf->Flags));
|
||||
switch (IfrOneOf->Flags & EFI_IFR_NUMERIC_SIZE) {
|
||||
case EFI_IFR_NUMERIC_SIZE_1:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%02x\n", IfrOneOf->data.u8.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%02x\n", IfrOneOf->data.u8.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%02x\n", IfrOneOf->data.u8.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_2:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%04x\n", IfrOneOf->data.u16.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%04x\n", IfrOneOf->data.u16.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%04x\n", IfrOneOf->data.u16.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_4:
|
||||
if (QuestionStoredInBitField) {
|
||||
//
|
||||
// For OneOf stored in bit field, the option value are saved as UINT32 type.
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%08x\n", IfrOneOf->data.u32.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%08x\n", IfrOneOf->data.u32.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%08x\n", IfrOneOf->data.u32.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_8:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%016lx\n", IfrOneOf->data.u64.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%016lx\n", IfrOneOf->data.u64.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%016lx\n", IfrOneOf->data.u64.Step));
|
||||
break;
|
||||
} else {
|
||||
switch (IfrOneOf->Flags & EFI_IFR_NUMERIC_SIZE) {
|
||||
case EFI_IFR_NUMERIC_SIZE_1:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%02x\n", IfrOneOf->data.u8.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%02x\n", IfrOneOf->data.u8.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%02x\n", IfrOneOf->data.u8.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_2:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%04x\n", IfrOneOf->data.u16.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%04x\n", IfrOneOf->data.u16.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%04x\n", IfrOneOf->data.u16.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_4:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%08x\n", IfrOneOf->data.u32.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%08x\n", IfrOneOf->data.u32.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%08x\n", IfrOneOf->data.u32.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_8:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%016lx\n", IfrOneOf->data.u64.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%016lx\n", IfrOneOf->data.u64.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%016lx\n", IfrOneOf->data.u64.Step));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EFI_IFR_CHECKBOX_OP:
|
||||
|
@ -209,27 +226,36 @@ DumpHiiPackage (
|
|||
case EFI_IFR_NUMERIC_OP:
|
||||
IfrNumeric = (EFI_IFR_NUMERIC *) IfrOpCodeHeader;
|
||||
DEBUG ((DEBUG_INFO, " Flags - 0x%02x\n", IfrNumeric->Flags));
|
||||
switch (IfrNumeric->Flags & EFI_IFR_NUMERIC_SIZE) {
|
||||
case EFI_IFR_NUMERIC_SIZE_1:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%02x\n", IfrNumeric->data.u8.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%02x\n", IfrNumeric->data.u8.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%02x\n", IfrNumeric->data.u8.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_2:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%04x\n", IfrNumeric->data.u16.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%04x\n", IfrNumeric->data.u16.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%04x\n", IfrNumeric->data.u16.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_4:
|
||||
if (QuestionStoredInBitField) {
|
||||
//
|
||||
// For Numeric stored in bit field, the MinValue,MaxValue and Step are saved as UINT32 type.
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%08x\n", IfrNumeric->data.u32.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%08x\n", IfrNumeric->data.u32.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%08x\n", IfrNumeric->data.u32.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_8:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%016lx\n", IfrNumeric->data.u64.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%016lx\n", IfrNumeric->data.u64.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%016lx\n", IfrNumeric->data.u64.Step));
|
||||
break;
|
||||
} else {
|
||||
switch (IfrNumeric->Flags & EFI_IFR_NUMERIC_SIZE) {
|
||||
case EFI_IFR_NUMERIC_SIZE_1:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%02x\n", IfrNumeric->data.u8.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%02x\n", IfrNumeric->data.u8.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%02x\n", IfrNumeric->data.u8.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_2:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%04x\n", IfrNumeric->data.u16.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%04x\n", IfrNumeric->data.u16.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%04x\n", IfrNumeric->data.u16.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_4:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%08x\n", IfrNumeric->data.u32.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%08x\n", IfrNumeric->data.u32.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%08x\n", IfrNumeric->data.u32.Step));
|
||||
break;
|
||||
case EFI_IFR_NUMERIC_SIZE_8:
|
||||
DEBUG ((DEBUG_INFO, " MinValue - 0x%016lx\n", IfrNumeric->data.u64.MinValue));
|
||||
DEBUG ((DEBUG_INFO, " MaxValue - 0x%016lx\n", IfrNumeric->data.u64.MaxValue));
|
||||
DEBUG ((DEBUG_INFO, " Step - 0x%016lx\n", IfrNumeric->data.u64.Step));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EFI_IFR_ORDERED_LIST_OP:
|
||||
|
@ -279,6 +305,7 @@ DumpHiiPackage (
|
|||
}
|
||||
|
||||
if (IfrOpCodeHeader->OpCode == EFI_IFR_END_OP) {
|
||||
QuestionStoredInBitField = FALSE;
|
||||
ASSERT (Scope > 0);
|
||||
Scope--;
|
||||
if (Scope == 0) {
|
||||
|
@ -488,6 +515,7 @@ MergeHiiQuestion (
|
|||
UINT8 *Ptr;
|
||||
UINT8 *Ptr1;
|
||||
UINT8 *Ptr2;
|
||||
UINT16 ArrayIndex;
|
||||
|
||||
//
|
||||
// Hii Question from Hii Database has high priority.
|
||||
|
@ -498,14 +526,20 @@ MergeHiiQuestion (
|
|||
return;
|
||||
}
|
||||
|
||||
HiiQuestion1 = HiiVariableNode->HiiQuestionArray[HiiQuestion->VarOffset];
|
||||
if (HiiQuestion->BitFieldStore) {
|
||||
ArrayIndex = HiiQuestion->VarOffset;
|
||||
} else {
|
||||
ArrayIndex = HiiQuestion->VarOffset * 8;
|
||||
}
|
||||
|
||||
HiiQuestion1 = HiiVariableNode->HiiQuestionArray[ArrayIndex];
|
||||
HiiQuestion2 = HiiQuestion;
|
||||
|
||||
ASSERT ((HiiQuestion1->OpCode == HiiQuestion2->OpCode) && (HiiQuestion1->StorageWidth == HiiQuestion2->StorageWidth));
|
||||
|
||||
switch (HiiQuestion1->OpCode) {
|
||||
case EFI_IFR_ONE_OF_OP:
|
||||
DEBUG ((DEBUG_INFO, "MergeHiiQuestion - EFI_IFR_ONE_OF_OP VarOffset = 0x%04x\n", HiiQuestion1->VarOffset));
|
||||
DEBUG ((DEBUG_INFO, "MergeHiiQuestion - EFI_IFR_ONE_OF_OP VarOffset = 0x%04x (%a)\n", HiiQuestion1->VarOffset, (HiiQuestion1->BitFieldStore? "bit level": "byte level")));
|
||||
//
|
||||
// Get the length of Hii Question 1.
|
||||
//
|
||||
|
@ -580,17 +614,17 @@ MergeHiiQuestion (
|
|||
Ptr2 += HiiQuestion2->StorageWidth;
|
||||
}
|
||||
|
||||
HiiVariableNode->HiiQuestionArray[HiiQuestion1->VarOffset] = NewHiiQuestion;
|
||||
HiiVariableNode->HiiQuestionArray[ArrayIndex] = NewHiiQuestion;
|
||||
InternalVarCheckFreePool (HiiQuestion1);
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_CHECKBOX_OP:
|
||||
DEBUG ((DEBUG_INFO, "MergeHiiQuestion - EFI_IFR_CHECKBOX_OP VarOffset = 0x%04x\n", HiiQuestion1->VarOffset));
|
||||
DEBUG ((DEBUG_INFO, "MergeHiiQuestion - EFI_IFR_CHECKBOX_OP VarOffset = 0x%04x (%a)\n", HiiQuestion1->VarOffset, (HiiQuestion1->BitFieldStore? "bit level": "byte level")));
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_OP:
|
||||
DEBUG ((DEBUG_INFO, "MergeHiiQuestion - EFI_IFR_NUMERIC_OP VarOffset = 0x%04x\n", HiiQuestion1->VarOffset));
|
||||
DEBUG ((DEBUG_INFO, "MergeHiiQuestion - EFI_IFR_NUMERIC_OP VarOffset = 0x%04x (%a)\n", HiiQuestion1->VarOffset, (HiiQuestion1->BitFieldStore? "bit level": "byte level")));
|
||||
//
|
||||
// Get minimum and maximum of Hii Question 1.
|
||||
//
|
||||
|
@ -705,7 +739,7 @@ MergeHiiQuestion (
|
|||
Ptr2 += HiiQuestion2->StorageWidth;
|
||||
}
|
||||
|
||||
HiiVariableNode->HiiQuestionArray[HiiQuestion1->VarOffset] = NewHiiQuestion;
|
||||
HiiVariableNode->HiiQuestionArray[ArrayIndex] = NewHiiQuestion;
|
||||
InternalVarCheckFreePool (HiiQuestion1);
|
||||
}
|
||||
break;
|
||||
|
@ -831,13 +865,15 @@ GetOneOfOption (
|
|||
Parse Hii Question Oneof.
|
||||
|
||||
@param[in] IfrOpCodeHeader Pointer to Ifr OpCode header.
|
||||
@param[in] StoredInBitField Whether the OneOf is stored in bit field Storage.
|
||||
|
||||
return Pointer to Hii Question.
|
||||
|
||||
**/
|
||||
VAR_CHECK_HII_QUESTION_HEADER *
|
||||
ParseHiiQuestionOneOf (
|
||||
IN EFI_IFR_OP_HEADER *IfrOpCodeHeader
|
||||
IN EFI_IFR_OP_HEADER *IfrOpCodeHeader,
|
||||
IN BOOLEAN StoredInBitField
|
||||
)
|
||||
{
|
||||
EFI_IFR_ONE_OF *IfrOneOf;
|
||||
|
@ -846,10 +882,21 @@ ParseHiiQuestionOneOf (
|
|||
UINT8 Width;
|
||||
UINTN OptionCount;
|
||||
UINT8 OptionWidth;
|
||||
UINT8 BitWidth;
|
||||
|
||||
IfrOneOf = (EFI_IFR_ONE_OF *) IfrOpCodeHeader;
|
||||
BitWidth = 0;
|
||||
|
||||
Width = (UINT8) (1 << (IfrOneOf->Flags & EFI_IFR_NUMERIC_SIZE));
|
||||
if (StoredInBitField) {
|
||||
//
|
||||
// When OneOf stored in bit field, the bit width is saved in the lower six bits of the flag.
|
||||
// And the options in the OneOf is saved as UINT32 type.
|
||||
//
|
||||
BitWidth = IfrOneOf->Flags & EDKII_IFR_NUMERIC_SIZE_BIT;
|
||||
Width = sizeof (UINT32);
|
||||
} else {
|
||||
Width = (UINT8) (1 << (IfrOneOf->Flags & EFI_IFR_NUMERIC_SIZE));
|
||||
}
|
||||
|
||||
GetOneOfOption (IfrOpCodeHeader, &OptionCount, &OptionWidth, NULL);
|
||||
ASSERT (Width == OptionWidth);
|
||||
|
@ -858,10 +905,15 @@ ParseHiiQuestionOneOf (
|
|||
|
||||
OneOf = InternalVarCheckAllocateZeroPool (Length);
|
||||
ASSERT (OneOf != NULL);
|
||||
OneOf->OpCode = EFI_IFR_ONE_OF_OP;
|
||||
OneOf->Length = (UINT8) Length;
|
||||
OneOf->VarOffset = IfrOneOf->Question.VarStoreInfo.VarOffset;
|
||||
OneOf->StorageWidth = Width;
|
||||
OneOf->OpCode = EFI_IFR_ONE_OF_OP;
|
||||
OneOf->Length = (UINT8) Length;
|
||||
OneOf->VarOffset = IfrOneOf->Question.VarStoreInfo.VarOffset;
|
||||
OneOf->BitFieldStore = StoredInBitField;
|
||||
if (StoredInBitField) {
|
||||
OneOf->StorageWidth = BitWidth;
|
||||
} else {
|
||||
OneOf->StorageWidth = Width;
|
||||
}
|
||||
|
||||
GetOneOfOption (IfrOpCodeHeader, &OptionCount, &OptionWidth, OneOf + 1);
|
||||
|
||||
|
@ -872,13 +924,15 @@ ParseHiiQuestionOneOf (
|
|||
Parse Hii Question CheckBox.
|
||||
|
||||
@param[in] IfrOpCodeHeader Pointer to Ifr OpCode header.
|
||||
@param[in] StoredInBitField Whether the CheckBox is stored in bit field Storage.
|
||||
|
||||
return Pointer to Hii Question.
|
||||
|
||||
**/
|
||||
VAR_CHECK_HII_QUESTION_HEADER *
|
||||
ParseHiiQuestionCheckBox (
|
||||
IN EFI_IFR_OP_HEADER *IfrOpCodeHeader
|
||||
IN EFI_IFR_OP_HEADER *IfrOpCodeHeader,
|
||||
IN BOOLEAN StoredInBitField
|
||||
)
|
||||
{
|
||||
EFI_IFR_CHECKBOX *IfrCheckBox;
|
||||
|
@ -888,10 +942,15 @@ ParseHiiQuestionCheckBox (
|
|||
|
||||
CheckBox = InternalVarCheckAllocateZeroPool (sizeof (*CheckBox));
|
||||
ASSERT (CheckBox != NULL);
|
||||
CheckBox->OpCode = EFI_IFR_CHECKBOX_OP;
|
||||
CheckBox->Length = (UINT8) sizeof (*CheckBox);;
|
||||
CheckBox->VarOffset = IfrCheckBox->Question.VarStoreInfo.VarOffset;
|
||||
CheckBox->StorageWidth = (UINT8) sizeof (BOOLEAN);
|
||||
CheckBox->OpCode = EFI_IFR_CHECKBOX_OP;
|
||||
CheckBox->Length = (UINT8) sizeof (*CheckBox);;
|
||||
CheckBox->VarOffset = IfrCheckBox->Question.VarStoreInfo.VarOffset;
|
||||
CheckBox->BitFieldStore = StoredInBitField;
|
||||
if (StoredInBitField) {
|
||||
CheckBox->StorageWidth = 1;
|
||||
} else {
|
||||
CheckBox->StorageWidth = (UINT8) sizeof (BOOLEAN);
|
||||
}
|
||||
|
||||
return (VAR_CHECK_HII_QUESTION_HEADER *) CheckBox;
|
||||
}
|
||||
|
@ -900,30 +959,48 @@ ParseHiiQuestionCheckBox (
|
|||
Parse Hii Question Numeric.
|
||||
|
||||
@param[in] IfrOpCodeHeader Pointer to Ifr OpCode header.
|
||||
@param[in] StoredInBitField Whether the Numeric is stored in bit field Storage.
|
||||
|
||||
return Pointer to Hii Question.
|
||||
|
||||
**/
|
||||
VAR_CHECK_HII_QUESTION_HEADER *
|
||||
ParseHiiQuestionNumeric (
|
||||
IN EFI_IFR_OP_HEADER *IfrOpCodeHeader
|
||||
IN EFI_IFR_OP_HEADER *IfrOpCodeHeader,
|
||||
IN BOOLEAN StoredInBitField
|
||||
)
|
||||
{
|
||||
EFI_IFR_NUMERIC *IfrNumeric;
|
||||
VAR_CHECK_HII_QUESTION_NUMERIC *Numeric;
|
||||
UINT8 Width;
|
||||
UINT8 BitWidth;
|
||||
|
||||
IfrNumeric = (EFI_IFR_NUMERIC *) IfrOpCodeHeader;
|
||||
BitWidth = 0;
|
||||
|
||||
Numeric = InternalVarCheckAllocateZeroPool (sizeof (VAR_CHECK_HII_QUESTION_NUMERIC) + 2 * sizeof (UINT64));
|
||||
ASSERT (Numeric != NULL);
|
||||
|
||||
Width = (UINT8) (1 << (IfrNumeric->Flags & EFI_IFR_NUMERIC_SIZE));
|
||||
if (StoredInBitField) {
|
||||
//
|
||||
// When Numeric stored in bit field, the bit field width is saved in the lower six bits of the flag.
|
||||
// And the Minimum Maximum of Numeric is saved as UINT32 type.
|
||||
//
|
||||
BitWidth = IfrNumeric->Flags & EDKII_IFR_NUMERIC_SIZE_BIT;
|
||||
Width = sizeof (UINT32);
|
||||
} else {
|
||||
Width = (UINT8) (1 << (IfrNumeric->Flags & EFI_IFR_NUMERIC_SIZE));
|
||||
}
|
||||
|
||||
Numeric->OpCode = EFI_IFR_NUMERIC_OP;
|
||||
Numeric->Length = (UINT8) (sizeof (VAR_CHECK_HII_QUESTION_NUMERIC) + 2 * Width);
|
||||
Numeric->VarOffset = IfrNumeric->Question.VarStoreInfo.VarOffset;
|
||||
Numeric->StorageWidth = Width;
|
||||
Numeric->OpCode = EFI_IFR_NUMERIC_OP;
|
||||
Numeric->Length = (UINT8) (sizeof (VAR_CHECK_HII_QUESTION_NUMERIC) + 2 * Width);
|
||||
Numeric->VarOffset = IfrNumeric->Question.VarStoreInfo.VarOffset;
|
||||
Numeric->BitFieldStore = StoredInBitField;
|
||||
if (StoredInBitField) {
|
||||
Numeric->StorageWidth = BitWidth;
|
||||
} else {
|
||||
Numeric->StorageWidth = Width;
|
||||
}
|
||||
|
||||
CopyMem (Numeric + 1, &IfrNumeric->data, Width * 2);
|
||||
|
||||
|
@ -962,6 +1039,7 @@ ParseHiiQuestionOrderedList (
|
|||
OrderedList->VarOffset = IfrOrderedList->Question.VarStoreInfo.VarOffset;
|
||||
OrderedList->StorageWidth = OptionWidth;
|
||||
OrderedList->MaxContainers = IfrOrderedList->MaxContainers;
|
||||
OrderedList->BitFieldStore = FALSE;
|
||||
|
||||
GetOneOfOption (IfrOpCodeHeader, &OptionCount, &OptionWidth, OrderedList + 1);
|
||||
|
||||
|
@ -974,28 +1052,34 @@ ParseHiiQuestionOrderedList (
|
|||
@param[in] HiiVariableNode Pointer to Hii Variable node.
|
||||
@param[in] IfrOpCodeHeader Pointer to Ifr OpCode header.
|
||||
@param[in] FromFv Hii Question from FV.
|
||||
@param[in] StoredInBitField Whether the Question is stored in bit field Storage.
|
||||
|
||||
**/
|
||||
VOID
|
||||
ParseHiiQuestion (
|
||||
IN VAR_CHECK_HII_VARIABLE_NODE *HiiVariableNode,
|
||||
IN EFI_IFR_OP_HEADER *IfrOpCodeHeader,
|
||||
IN BOOLEAN FromFv
|
||||
IN BOOLEAN FromFv,
|
||||
IN BOOLEAN StoredInBitField
|
||||
)
|
||||
{
|
||||
VAR_CHECK_HII_QUESTION_HEADER *HiiQuestion;
|
||||
UINT16 ArrayIndex;
|
||||
|
||||
//
|
||||
// Currently only OneOf, CheckBox and Numeric can be stored in bit field.
|
||||
//
|
||||
switch (IfrOpCodeHeader->OpCode) {
|
||||
case EFI_IFR_ONE_OF_OP:
|
||||
HiiQuestion = ParseHiiQuestionOneOf (IfrOpCodeHeader);
|
||||
HiiQuestion = ParseHiiQuestionOneOf (IfrOpCodeHeader, StoredInBitField);
|
||||
break;
|
||||
|
||||
case EFI_IFR_CHECKBOX_OP:
|
||||
HiiQuestion = ParseHiiQuestionCheckBox (IfrOpCodeHeader);
|
||||
HiiQuestion = ParseHiiQuestionCheckBox (IfrOpCodeHeader, StoredInBitField);
|
||||
break;
|
||||
|
||||
case EFI_IFR_NUMERIC_OP:
|
||||
HiiQuestion = ParseHiiQuestionNumeric (IfrOpCodeHeader);
|
||||
HiiQuestion = ParseHiiQuestionNumeric (IfrOpCodeHeader, StoredInBitField);
|
||||
break;
|
||||
|
||||
case EFI_IFR_ORDERED_LIST_OP:
|
||||
|
@ -1008,10 +1092,15 @@ ParseHiiQuestion (
|
|||
break;
|
||||
}
|
||||
|
||||
if (HiiVariableNode->HiiQuestionArray[HiiQuestion->VarOffset] != NULL) {
|
||||
if (StoredInBitField) {
|
||||
ArrayIndex = HiiQuestion->VarOffset;
|
||||
} else {
|
||||
ArrayIndex = HiiQuestion->VarOffset * 8;
|
||||
}
|
||||
if (HiiVariableNode->HiiQuestionArray[ArrayIndex] != NULL) {
|
||||
MergeHiiQuestion (HiiVariableNode, HiiQuestion, FromFv);
|
||||
} else {
|
||||
HiiVariableNode->HiiQuestionArray[HiiQuestion->VarOffset] = HiiQuestion;
|
||||
HiiVariableNode->HiiQuestionArray[ArrayIndex] = HiiQuestion;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1255,7 @@ CreateHiiVariableNode (
|
|||
// The variable store identifier, which is unique within the current form set.
|
||||
//
|
||||
HiiVariableNode->VarStoreId = IfrEfiVarStore->VarStoreId;
|
||||
HiiVariableNode->HiiQuestionArray = InternalVarCheckAllocateZeroPool (IfrEfiVarStore->Size * sizeof (VAR_CHECK_HII_QUESTION_HEADER *));
|
||||
HiiVariableNode->HiiQuestionArray = InternalVarCheckAllocateZeroPool (IfrEfiVarStore->Size * 8 * sizeof (VAR_CHECK_HII_QUESTION_HEADER *));
|
||||
|
||||
InsertTailList (&mVarCheckHiiList, &HiiVariableNode->Link);
|
||||
} else {
|
||||
|
@ -1239,6 +1328,7 @@ VarCheckParseHiiPackage (
|
|||
EFI_HII_PACKAGE_HEADER *HiiPackageHeader;
|
||||
EFI_IFR_OP_HEADER *IfrOpCodeHeader;
|
||||
VAR_CHECK_HII_VARIABLE_NODE *HiiVariableNode;
|
||||
BOOLEAN QuestionStoredInBitField;
|
||||
|
||||
//
|
||||
// Parse and create Hii Variable node list for this Hii Package.
|
||||
|
@ -1247,12 +1337,24 @@ VarCheckParseHiiPackage (
|
|||
|
||||
HiiPackageHeader = (EFI_HII_PACKAGE_HEADER *) HiiPackage;
|
||||
|
||||
QuestionStoredInBitField = FALSE;
|
||||
|
||||
switch (HiiPackageHeader->Type) {
|
||||
case EFI_HII_PACKAGE_FORMS:
|
||||
IfrOpCodeHeader = (EFI_IFR_OP_HEADER *) (HiiPackageHeader + 1);
|
||||
|
||||
while ((UINTN) IfrOpCodeHeader < (UINTN) HiiPackageHeader + HiiPackageHeader->Length) {
|
||||
switch (IfrOpCodeHeader->OpCode) {
|
||||
case EFI_IFR_GUID_OP:
|
||||
if (CompareGuid ((EFI_GUID *)((UINTN)IfrOpCodeHeader + sizeof (EFI_IFR_OP_HEADER)), &gEdkiiIfrBitVarstoreGuid)) {
|
||||
QuestionStoredInBitField = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IFR_END_OP:
|
||||
QuestionStoredInBitField = FALSE;
|
||||
break;
|
||||
|
||||
case EFI_IFR_ONE_OF_OP:
|
||||
case EFI_IFR_CHECKBOX_OP:
|
||||
case EFI_IFR_NUMERIC_OP:
|
||||
|
@ -1270,7 +1372,7 @@ VarCheckParseHiiPackage (
|
|||
//
|
||||
// Normal IFR
|
||||
//
|
||||
ParseHiiQuestion (HiiVariableNode, IfrOpCodeHeader, FromFv);
|
||||
ParseHiiQuestion (HiiVariableNode, IfrOpCodeHeader, FromFv, QuestionStoredInBitField);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
|
@ -1341,7 +1443,7 @@ DestroyHiiVariableNode (
|
|||
//
|
||||
// Free the allocated buffer.
|
||||
//
|
||||
for (Index = 0; Index < HiiVariableNode->HiiVariable->Size; Index++) {
|
||||
for (Index = 0; Index < HiiVariableNode->HiiVariable->Size * (UINTN) 8; Index++) {
|
||||
if (HiiVariableNode->HiiQuestionArray[Index] != NULL) {
|
||||
InternalVarCheckFreePool (HiiVariableNode->HiiQuestionArray[Index]);
|
||||
}
|
||||
|
@ -1389,7 +1491,7 @@ BuildVarCheckHiiBin (
|
|||
HiiVariableNode = VAR_CHECK_HII_VARIABLE_FROM_LINK (HiiVariableLink);
|
||||
HiiVariableLength = HiiVariableNode->HiiVariable->HeaderLength;
|
||||
|
||||
for (Index = 0; Index < HiiVariableNode->HiiVariable->Size; Index++) {
|
||||
for (Index = 0; Index < HiiVariableNode->HiiVariable->Size * (UINTN) 8; Index++) {
|
||||
if (HiiVariableNode->HiiQuestionArray[Index] != NULL) {
|
||||
//
|
||||
// For Hii Question header align.
|
||||
|
@ -1434,7 +1536,7 @@ BuildVarCheckHiiBin (
|
|||
CopyMem (Ptr, HiiVariableNode->HiiVariable, HiiVariableNode->HiiVariable->HeaderLength);
|
||||
Ptr += HiiVariableNode->HiiVariable->HeaderLength;
|
||||
|
||||
for (Index = 0; Index < HiiVariableNode->HiiVariable->Size; Index++) {
|
||||
for (Index = 0; Index < HiiVariableNode->HiiVariable->Size * (UINTN) 8; Index++) {
|
||||
if (HiiVariableNode->HiiQuestionArray[Index] != NULL) {
|
||||
//
|
||||
// For Hii Question header align.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# NULL class library to register var check HII handler.
|
||||
#
|
||||
# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions
|
||||
|
@ -46,6 +46,9 @@
|
|||
PcdLib
|
||||
VarCheckLib
|
||||
|
||||
[Guids]
|
||||
gEdkiiIfrBitVarstoreGuid ## SOMETIMES_CONSUMES ## GUID
|
||||
|
||||
[Protocols]
|
||||
gEfiFirmwareVolume2ProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiFirmwareVolumeBlock2ProtocolGuid ## SOMETIMES_CONSUMES
|
||||
|
|
|
@ -93,28 +93,61 @@ VarCheckHiiQuestion (
|
|||
UINT8 *Ptr;
|
||||
UINT8 Index;
|
||||
UINT8 MaxContainers;
|
||||
UINT8 StartBit;
|
||||
UINT8 EndBit;
|
||||
UINT8 TotalBits;
|
||||
UINT16 VarOffsetByteLevel;
|
||||
UINT8 StorageWidthByteLevel;
|
||||
|
||||
if (((UINT32) HiiQuestion->VarOffset + HiiQuestion->StorageWidth) > DataSize) {
|
||||
DEBUG ((DEBUG_INFO , "VarCheckHiiQuestion fail: (VarOffset(0x%04x) + StorageWidth(0x%02x)) > Size(0x%x)\n", HiiQuestion->VarOffset, HiiQuestion->StorageWidth, DataSize));
|
||||
if (HiiQuestion->BitFieldStore) {
|
||||
VarOffsetByteLevel = HiiQuestion->VarOffset / 8;
|
||||
TotalBits = HiiQuestion->VarOffset % 8 + HiiQuestion->StorageWidth;
|
||||
StorageWidthByteLevel = (TotalBits % 8 == 0 ? TotalBits / 8: TotalBits / 8 + 1);
|
||||
} else {
|
||||
VarOffsetByteLevel = HiiQuestion->VarOffset;
|
||||
StorageWidthByteLevel = HiiQuestion->StorageWidth;
|
||||
}
|
||||
|
||||
if (((UINT32) VarOffsetByteLevel + StorageWidthByteLevel) > DataSize) {
|
||||
DEBUG ((DEBUG_INFO , "VarCheckHiiQuestion fail: (VarOffset(0x%04x) + StorageWidth(0x%02x)) > Size(0x%x)\n", VarOffsetByteLevel, StorageWidthByteLevel, DataSize));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
OneData = 0;
|
||||
CopyMem (&OneData, (UINT8 *) Data + HiiQuestion->VarOffset, HiiQuestion->StorageWidth);
|
||||
CopyMem (&OneData, (UINT8 *) Data + VarOffsetByteLevel, StorageWidthByteLevel);
|
||||
if (HiiQuestion->BitFieldStore) {
|
||||
//
|
||||
// Get the value from the bit field.
|
||||
//
|
||||
StartBit = HiiQuestion->VarOffset % 8;
|
||||
EndBit = StartBit + HiiQuestion->StorageWidth - 1;
|
||||
OneData = BitFieldRead64 (OneData, StartBit, EndBit);
|
||||
}
|
||||
|
||||
switch (HiiQuestion->OpCode) {
|
||||
case EFI_IFR_ONE_OF_OP:
|
||||
Ptr = (UINT8 *) ((VAR_CHECK_HII_QUESTION_ONEOF *) HiiQuestion + 1);
|
||||
while ((UINTN) Ptr < (UINTN) HiiQuestion + HiiQuestion->Length) {
|
||||
OneValue = 0;
|
||||
CopyMem (&OneValue, Ptr, HiiQuestion->StorageWidth);
|
||||
if (HiiQuestion->BitFieldStore) {
|
||||
//
|
||||
// For OneOf stored in bit field, the value of options are saved as UINT32 type.
|
||||
//
|
||||
CopyMem (&OneValue, Ptr, sizeof (UINT32));
|
||||
} else {
|
||||
CopyMem (&OneValue, Ptr, HiiQuestion->StorageWidth);
|
||||
}
|
||||
if (OneData == OneValue) {
|
||||
//
|
||||
// Match
|
||||
//
|
||||
break;
|
||||
}
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
if (HiiQuestion->BitFieldStore) {
|
||||
Ptr += sizeof (UINT32);
|
||||
} else {
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
}
|
||||
}
|
||||
if ((UINTN) Ptr >= ((UINTN) HiiQuestion + HiiQuestion->Length)) {
|
||||
//
|
||||
|
@ -138,10 +171,20 @@ VarCheckHiiQuestion (
|
|||
Minimum = 0;
|
||||
Maximum = 0;
|
||||
Ptr = (UINT8 *) ((VAR_CHECK_HII_QUESTION_NUMERIC *) HiiQuestion + 1);
|
||||
CopyMem (&Minimum, Ptr, HiiQuestion->StorageWidth);
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
CopyMem (&Maximum, Ptr, HiiQuestion->StorageWidth);
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
if (HiiQuestion->BitFieldStore) {
|
||||
//
|
||||
// For Numeric stored in bit field, the value of Maximum/Minimum are saved as UINT32 type.
|
||||
//
|
||||
CopyMem (&Minimum, Ptr, sizeof (UINT32));
|
||||
Ptr += sizeof (UINT32);
|
||||
CopyMem (&Maximum, Ptr, sizeof (UINT32));
|
||||
Ptr += sizeof (UINT32);
|
||||
} else {
|
||||
CopyMem (&Minimum, Ptr, HiiQuestion->StorageWidth);
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
CopyMem (&Maximum, Ptr, HiiQuestion->StorageWidth);
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
}
|
||||
|
||||
//
|
||||
// No need to check Step, because it is ONLY for UI.
|
||||
|
@ -344,35 +387,47 @@ DumpHiiQuestion (
|
|||
UINT8 *Ptr;
|
||||
|
||||
DEBUG ((DEBUG_INFO, " VAR_CHECK_HII_QUESTION_HEADER\n"));
|
||||
DEBUG ((DEBUG_INFO, " OpCode - 0x%02x (%a)\n", HiiQuestion->OpCode, HiiOpCodeToStr (HiiQuestion->OpCode)));
|
||||
DEBUG ((DEBUG_INFO, " OpCode - 0x%02x (%a) (%a)\n", HiiQuestion->OpCode, HiiOpCodeToStr (HiiQuestion->OpCode), (HiiQuestion->BitFieldStore? "bit level": "byte level")));
|
||||
DEBUG ((DEBUG_INFO, " Length - 0x%02x\n", HiiQuestion->Length));
|
||||
DEBUG ((DEBUG_INFO, " VarOffset - 0x%04x\n", HiiQuestion->VarOffset));
|
||||
DEBUG ((DEBUG_INFO, " StorageWidth - 0x%02x\n", HiiQuestion->StorageWidth));
|
||||
DEBUG ((DEBUG_INFO, " VarOffset - 0x%04x (%a)\n", HiiQuestion->VarOffset, (HiiQuestion->BitFieldStore? "bit level": "byte level")));
|
||||
DEBUG ((DEBUG_INFO, " StorageWidth - 0x%02x (%a)\n", HiiQuestion->StorageWidth, (HiiQuestion->BitFieldStore? "bit level": "byte level")));
|
||||
|
||||
switch (HiiQuestion->OpCode) {
|
||||
case EFI_IFR_ONE_OF_OP:
|
||||
Ptr = (UINT8 *) ((VAR_CHECK_HII_QUESTION_ONEOF *) HiiQuestion + 1);
|
||||
while ((UINTN) Ptr < ((UINTN) HiiQuestion + HiiQuestion->Length)) {
|
||||
OneValue = 0;
|
||||
CopyMem (&OneValue, Ptr, HiiQuestion->StorageWidth);
|
||||
switch (HiiQuestion->StorageWidth) {
|
||||
case sizeof (UINT8):
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%02x\n", OneValue));
|
||||
break;
|
||||
case sizeof (UINT16):
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%04x\n", OneValue));
|
||||
break;
|
||||
case sizeof (UINT32):
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%08x\n", OneValue));
|
||||
break;
|
||||
case sizeof (UINT64):
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%016lx\n", OneValue));
|
||||
break;
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
break;
|
||||
if (HiiQuestion->BitFieldStore) {
|
||||
//
|
||||
// For OneOf stored in bit field, the value of options are saved as UINT32 type.
|
||||
//
|
||||
CopyMem (&OneValue, Ptr, sizeof (UINT32));
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%08x\n", OneValue));
|
||||
} else {
|
||||
CopyMem (&OneValue, Ptr, HiiQuestion->StorageWidth);
|
||||
switch (HiiQuestion->StorageWidth) {
|
||||
case sizeof (UINT8):
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%02x\n", OneValue));
|
||||
break;
|
||||
case sizeof (UINT16):
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%04x\n", OneValue));
|
||||
break;
|
||||
case sizeof (UINT32):
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%08x\n", OneValue));
|
||||
break;
|
||||
case sizeof (UINT64):
|
||||
DEBUG ((DEBUG_INFO, " OneOfOption - 0x%016lx\n", OneValue));
|
||||
break;
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (HiiQuestion->BitFieldStore) {
|
||||
Ptr += sizeof (UINT32);
|
||||
} else {
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
}
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -383,31 +438,44 @@ DumpHiiQuestion (
|
|||
Minimum = 0;
|
||||
Maximum = 0;
|
||||
Ptr = (UINT8 *) ((VAR_CHECK_HII_QUESTION_NUMERIC *) HiiQuestion + 1);
|
||||
CopyMem (&Minimum, Ptr, HiiQuestion->StorageWidth);
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
CopyMem (&Maximum, Ptr, HiiQuestion->StorageWidth);
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
if(HiiQuestion->BitFieldStore) {
|
||||
//
|
||||
// For Numeric stored in bit field, the value of Maximum/Minimum are saved as UINT32 type.
|
||||
//
|
||||
CopyMem (&Minimum, Ptr, sizeof (UINT32));
|
||||
Ptr += sizeof (UINT32);
|
||||
CopyMem (&Maximum, Ptr, sizeof (UINT32));
|
||||
Ptr += sizeof (UINT32);
|
||||
|
||||
switch (HiiQuestion->StorageWidth) {
|
||||
case sizeof (UINT8):
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%02x\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%02x\n", Maximum));
|
||||
break;
|
||||
case sizeof (UINT16):
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%04x\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%04x\n", Maximum));
|
||||
break;
|
||||
case sizeof (UINT32):
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%08x\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%08x\n", Maximum));
|
||||
break;
|
||||
case sizeof (UINT64):
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%016lx\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%016lx\n", Maximum));
|
||||
break;
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
break;
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%08x\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%08x\n", Maximum));
|
||||
} else {
|
||||
CopyMem (&Minimum, Ptr, HiiQuestion->StorageWidth);
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
CopyMem (&Maximum, Ptr, HiiQuestion->StorageWidth);
|
||||
Ptr += HiiQuestion->StorageWidth;
|
||||
|
||||
switch (HiiQuestion->StorageWidth) {
|
||||
case sizeof (UINT8):
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%02x\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%02x\n", Maximum));
|
||||
break;
|
||||
case sizeof (UINT16):
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%04x\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%04x\n", Maximum));
|
||||
break;
|
||||
case sizeof (UINT32):
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%08x\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%08x\n", Maximum));
|
||||
break;
|
||||
case sizeof (UINT64):
|
||||
DEBUG ((DEBUG_INFO, " Minimum - 0x%016lx\n", Minimum));
|
||||
DEBUG ((DEBUG_INFO, " Maximum - 0x%016lx\n", Maximum));
|
||||
break;
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue