BaseTool/VfrCompiler: Support Bit fields in EFI/Buffer VarStore
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=545 Enhance VfrCompiler to parse following case: 1. EFI/Buffer VarStore can contain bit fields in their structure. 2. For question Oneof/Checkbox/numeric, their storage can be bit fields of an EFI VarStore/Buffer VarStore. 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: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
The definition of CFormPkg's member function
|
||||
|
||||
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 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
|
||||
@@ -567,8 +567,12 @@ public:
|
||||
mMinMaxStepData->u8.Step = Step;
|
||||
}
|
||||
|
||||
UINT64 GetMinData (UINT8 VarType) {
|
||||
UINT64 GetMinData (UINT8 VarType, BOOLEAN IsBitVar) {
|
||||
UINT64 MinValue = 0;
|
||||
if (IsBitVar) {
|
||||
MinValue = mMinMaxStepData->u32.MinValue;
|
||||
return MinValue;
|
||||
}
|
||||
switch (VarType) {
|
||||
case EFI_IFR_TYPE_NUM_SIZE_64:
|
||||
MinValue = mMinMaxStepData->u64.MinValue;
|
||||
@@ -588,8 +592,12 @@ public:
|
||||
return MinValue;
|
||||
}
|
||||
|
||||
UINT64 GetMaxData (UINT8 VarType) {
|
||||
UINT64 GetMaxData (UINT8 VarType, BOOLEAN IsBitVar) {
|
||||
UINT64 MaxValue = 0;
|
||||
if (IsBitVar) {
|
||||
MaxValue = mMinMaxStepData->u32.MaxValue;
|
||||
return MaxValue;
|
||||
}
|
||||
switch (VarType) {
|
||||
case EFI_IFR_TYPE_NUM_SIZE_64:
|
||||
MaxValue = mMinMaxStepData->u64.MaxValue;
|
||||
@@ -609,8 +617,12 @@ public:
|
||||
return MaxValue;
|
||||
}
|
||||
|
||||
UINT64 GetStepData (UINT8 VarType) {
|
||||
UINT64 GetStepData (UINT8 VarType, BOOLEAN IsBitVar) {
|
||||
UINT64 MaxValue = 0;
|
||||
if (IsBitVar) {
|
||||
MaxValue = mMinMaxStepData->u32.Step;
|
||||
return MaxValue;
|
||||
}
|
||||
switch (VarType) {
|
||||
case EFI_IFR_TYPE_NUM_SIZE_64:
|
||||
MaxValue = mMinMaxStepData->u64.Step;
|
||||
@@ -1407,6 +1419,22 @@ public:
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE SetFlagsForBitField (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
|
||||
EFI_VFR_RETURN_CODE Ret;
|
||||
|
||||
Ret = CIfrQuestionHeader::SetFlags (HFlags);
|
||||
if (Ret != VFR_RETURN_SUCCESS) {
|
||||
return Ret;
|
||||
}
|
||||
|
||||
if (DisplaySettingsSpecified == FALSE) {
|
||||
mNumeric->Flags = LFlags | EDKII_IFR_DISPLAY_UINT_DEC_BIT;
|
||||
} else {
|
||||
mNumeric->Flags = LFlags;
|
||||
}
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
UINT8 GetNumericFlags () {
|
||||
return mNumeric->Flags;
|
||||
}
|
||||
@@ -1447,6 +1475,22 @@ public:
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE SetFlagsForBitField (IN UINT8 HFlags, IN UINT8 LFlags) {
|
||||
EFI_VFR_RETURN_CODE Ret;
|
||||
|
||||
Ret = CIfrQuestionHeader::SetFlags (HFlags);
|
||||
if (Ret != VFR_RETURN_SUCCESS) {
|
||||
return Ret;
|
||||
}
|
||||
|
||||
if (LFlags & EFI_IFR_DISPLAY) {
|
||||
mOneOf->Flags = LFlags;
|
||||
} else {
|
||||
mOneOf->Flags = LFlags | EDKII_IFR_DISPLAY_UINT_DEC_BIT;
|
||||
}
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
VOID ShrinkBinSize (IN UINT16 Size) {
|
||||
//
|
||||
// Update the buffer size which is truly be used later.
|
||||
|
Reference in New Issue
Block a user