* [RFC patch 0/4] Support Bit fields in EFI Variable Storage
@ 2017-04-18 12:46 Dandan Bi
2017-04-18 12:46 ` [RFC patch 1/4] BaseTool/VfrCompiler: Support bit " Dandan Bi
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Dandan Bi @ 2017-04-18 12:46 UTC (permalink / raw)
To: edk2-devel; +Cc: Eric Dong, Liming Gao
Proposal:
In VFR file, the storage of some Question may use Bit field in an EFI VarStore. So we propose
to update VfrCompiler/SetupBrowser/HiiDatabase to support this usage model as edk2 implementation
enhancement. It will allow EFI varstore has Bit fields, and CheckBox/OneOf/Numeric VarId can refer
to Bit field. VFR syntax has no changes. VfrCompiler will create Question which refers to Bit field
with a specific GUID opcode. If SetupBrowser doesn't recognize the GUID opcode, it will skip those
Questions and show other Questions normally.
Detail changes:
Take the codes in edk2\MdeModulePkg\Universal\DriverSampleDxe as an example.
1.VfrCompiler:
(a) Enhance the VfrCompiler to parse the Data structure with Bit fields and
record the Offset/With(in bit level ) of the members(Bit Offset/ With).
Add data structure with bit fields in NvDataStructure.h file as below:
typedef struct {
UINT16 Field16;
UINT8 Field8;
UINT16 MyBits7 : 3; ///< Bits 2:0
UINT16 MyBits8 : 3; ///< Bits 5:3
UINT16 MyBits9 : 1; ///< Bits 6
} MY_BITS_VARSTORE_DATA;
(b) Keep the declaration of EFI VarStore with bit fields same with the normal EFI VarStore, no syntax change in .vfr file.
In vfr.vfr file, declare the efivarstore with bit fields same with the normal EFI VarStore
efivarstore MY_BITS_VARSTORE_DATA, // This is the data structure type
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
name = MyBitVar, // Define referenced name in vfr
guid = DRIVER_SAMPLE_FORMSET_GUID; // GUID of this buffer storage
So VfrCompiler need to detect whether the data structure of this EFI VarStore(MY_BITS_VARSTORE_DATA) contains bit field,
if yes, it's bit EFI VarStore, or it's normal EFI VarStore.
(c) For the Question which refer to Bit field of an EFI VarStore, VfrCompiler will generate a GUID opcode to cover this Question.
numeric varid = MyBitVar.MyBits7,
prompt = STRING_TOKEN(STR_BIT_NUMERIC_PROMPT),
help = STRING_TOKEN(STR_NUMERIC_HELP0),
minimum = 0,
maximum = 7,
step = 0,
default = 5, defaultstore = MyStandardDefault, // This is standard default value
default = 6, defaultstore = MyManufactureDefault, // This is manufacture default value
endnumeric;
VfrCompiler generate a GUID opcode with a specified GUID value to cover the numeric opcode
numeric varid = MyBitVar.MyBits7,
>0000024B: 5F 92 8B D6 DD 82 63 91 87 41 9B 27 20 A8 FD 60 A7 1D (Guid opcode)
>0000025D: 07 A6 2D 00 37 00 06 00 02 00 48 00 00 13 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 (numeric opcode)
prompt = STRING_TOKEN(0x002D),
help = STRING_TOKEN(0x0037),
minimum = 0,
maximum = 7,
step = 0,
default = 5, defaultstore = MyStandardDefault,
>00000283: 5B 09 00 00 02 05 00 00 00
default = 6, defaultstore = MyManufactureDefault,
>0000028C: 5B 09 01 00 02 06 00 00 00
endnumeric;
>00000295: 29 02 (end of numeric opcode)
>00000297: 29 02 (end of Guid opcode)
(d) Save Offset/ With info for Question CheckBox/OneOf/Numeric which refer to Bit EFI VarStore.
Record the Bit Offset/ With info, the max Bit Width is 32
CheckBox: Bit width should always be 1 bit(VfrCompiler should report error for other value).
Numeric/Oneof: Bit width can be saved in EFI_IFR_NUMERIC.Flags/EFI_IFR_ONE_OF.Flags.
Bit Offset can be saved in EFI_IFR_QUESTION_HEADER. VarStoreInfo. VarOffset
Data type will be EFI_IFR_TYPE_NUM_SIZE_32 for BIT Numeric/Oneof.
2.SetupBrowserDxe: Need to get/set question value for Bit Questions correctly
Parse the Ifr data, if the GUID opcode with specified GUID value, means the following Question's VarId refer to Bit field of an EFI VarStore.
Record the bit Offset/ With and the converted byte Offset/ With to generate the ConfigRequest string.
When get/set Question value or get question default value, need to set/get the value to/from specified bit offset and width.
3.HiiDatabaseDxe: Need to generate the ConfigAltResp for Bit Questions correctly
Parse the Ifr data, if the GUID opcode with specified GUID value, means the following Question's VarId refer to Bit field of an EFI VarStore.
Record the bit offset/ with and the converted byte Offset/ With.
When generating ConfigAltResp, need to merge the value of the same byte Offset/ With base on the bit Offset/ With.
These are the POC codes (verify platform: Nt32). Thanks for your comments.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Dandan Bi (4):
BaseTool/VfrCompiler: Support bit fields in EFI Variable Storage
MdeModulePkg/SetupBrowser: Handle questions with Bit VarStore
MdeModulePkg/HiiDatabase: Handle questions with Bit VarStore
MdeModulePkg/DriverSample: Add example questions with bit VarStore
BaseTools/Source/C/VfrCompile/VfrFormPkg.h | 14 +-
BaseTools/Source/C/VfrCompile/VfrSyntax.g | 505 +++++++++++++++++----
BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 406 ++++++++++++++++-
BaseTools/Source/C/VfrCompile/VfrUtilityLib.h | 25 +-
.../Universal/DriverSampleDxe/DriverSample.c | 56 +++
.../Universal/DriverSampleDxe/DriverSample.h | 1 +
.../Universal/DriverSampleDxe/NVDataStruc.h | 19 +
MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr | 65 +++
.../Universal/DriverSampleDxe/VfrStrings.uni | 12 +
.../Universal/HiiDatabaseDxe/ConfigRouting.c | 197 +++++++-
.../Universal/HiiDatabaseDxe/HiiDatabase.h | 3 +
MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 137 ++++--
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 106 ++++-
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 3 +
14 files changed, 1372 insertions(+), 177 deletions(-)
--
1.9.5.msysgit.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC patch 1/4] BaseTool/VfrCompiler: Support bit fields in EFI Variable Storage
2017-04-18 12:46 [RFC patch 0/4] Support Bit fields in EFI Variable Storage Dandan Bi
@ 2017-04-18 12:46 ` Dandan Bi
2017-04-18 12:46 ` [RFC patch 2/4] MdeModulePkg/SetupBrowser: Handle questions with Bit VarStore Dandan Bi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Dandan Bi @ 2017-04-18 12:46 UTC (permalink / raw)
To: edk2-devel; +Cc: Eric Dong, Liming Gao
Enhance VfrCompiler to parse following case:
1. EFI VarStore can contain bit fields in their structure.
2. For question Oneof/Checkbox/numeric, their storage can be
bit fields of an EFI VarStore.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
BaseTools/Source/C/VfrCompile/VfrFormPkg.h | 14 +-
BaseTools/Source/C/VfrCompile/VfrSyntax.g | 505 +++++++++++++++++++-----
BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 406 ++++++++++++++++++-
BaseTools/Source/C/VfrCompile/VfrUtilityLib.h | 25 +-
4 files changed, 825 insertions(+), 125 deletions(-)
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
index 17ab14c..18c2afb 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
@@ -1,10 +1,10 @@
/** @file
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
http://opensource.org/licenses/bsd-license.php
@@ -565,12 +565,16 @@ 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;
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
@@ -586,12 +590,16 @@ public:
break;
}
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;
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index 406dbc5..b13b6d0 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -344,11 +344,15 @@ vfrDataStructFields :
dataStructFieldBool |
dataStructFieldString |
dataStructFieldDate |
dataStructFieldTime |
dataStructFieldRef |
- dataStructFieldUser
+ dataStructFieldUser |
+ vfr64BitsStructField |
+ vfr32BitsStructField |
+ vfr16BitsStructField |
+ vfr8BitsStructField
)*
;
dataStructField64 :
<< UINT32 ArrayNum = 0; >>
@@ -450,10 +454,50 @@ dataStructFieldUser :
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), T->getText(), ArrayNum), T); >>
;
+vfr64BitsStructField:
+ << UINT32 Width = 0;>>
+ D:"UINT64"
+ N:StringIdentifier
+ {
+ ":" I:Number << Width = _STOU32(I->getText(), I->getLine());>>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (N->getText(), D->getText(), Width), N); >>
+ ;
+
+vfr32BitsStructField:
+ << UINT32 Width = 0;>>
+ D:"UINT32"
+ N:StringIdentifier
+ {
+ ":" I:Number << Width = _STOU32(I->getText(), I->getLine());>>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (N->getText(), D->getText(), Width), N); >>
+ ;
+
+vfr16BitsStructField:
+ << UINT32 Width = 0;>>
+ D:"UINT16"
+ N:StringIdentifier
+ {
+ ":" I:Number << Width = _STOU32(I->getText(), I->getLine());>>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (N->getText(), D->getText(), Width), N); >>
+ ;
+
+vfr8BitsStructField:
+ << UINT32 Width = 0;>>
+ D:"UINT8"
+ N:StringIdentifier
+ {
+ ":" I:Number << Width = _STOU32(I->getText(), I->getLine());>>
+ }
+ ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddBitField (N->getText(), D->getText(), Width), N); >>
+ ;
+
//*****************************************************************************
//
// the syntax of GUID definition
//
guidSubDefinition [EFI_GUID &Guid] :
@@ -921,10 +965,11 @@ vfrStatementVarStoreEfi :
UINT32 Size;
CHAR8 *TypeName;
UINT32 LineNum;
CHAR8 *StoreName = NULL;
BOOLEAN CustomizedName = FALSE;
+ BOOLEAN IsBitVarStore = FALSE;
>>
E:Efivarstore << VSEObj.SetLineNo(E->getLine()); >>
(
TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); CustomizedName = TRUE; >>
| U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
@@ -934,10 +979,11 @@ vfrStatementVarStoreEfi :
| U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
| D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
| T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
| R:"EFI_HII_REF" "," << TypeName = R->getText(); LineNum = R->getLine(); >>
)
+ << IsBitVarStore = gCVfrVarDataTypeDB.DataTypeHasBitField (TN->getText());>>
{
VarId "=" ID:Number "," <<
_PCATCH(
(INTN)(VarStoreId = _STOU16(ID->getText(), ID->getLine())) != 0,
(INTN)TRUE,
@@ -984,17 +1030,27 @@ vfrStatementVarStoreEfi :
>>
)
Uuid "=" guidDefinition[Guid] <<
if (IsUEFI23EfiVarstore) {
- _PCATCH(gCVfrDataStorage.DeclareBufferVarStore (
- StoreName,
- &Guid,
- &gCVfrVarDataTypeDB,
- TypeName,
- VarStoreId
- ), LineNum);
+ if (IsBitVarStore) {
+ _PCATCH(gCVfrDataStorage.DeclareBitsBufferVarStore (
+ StoreName,
+ &Guid,
+ &gCVfrVarDataTypeDB,
+ TypeName,
+ VarStoreId
+ ), LineNum);
+ } else {
+ _PCATCH(gCVfrDataStorage.DeclareBufferVarStore (
+ StoreName,
+ &Guid,
+ &gCVfrVarDataTypeDB,
+ TypeName,
+ VarStoreId
+ ), LineNum);
+ }
_PCATCH(gCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId, &Guid), SN);
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
} else {
_PCATCH(gCVfrDataStorage.DeclareBufferVarStore (
TN->getText(),
@@ -1129,10 +1185,11 @@ vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_
EFI_VARSTORE_INFO Info;
Info.mVarType = EFI_IFR_TYPE_OTHER;
Info.mVarTotalSize = 0;
Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ Info.mIsBitVar = FALSE;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
CHAR8 *QName = NULL;
CHAR8 *VarIdStr = NULL;
mUsedDefaultCount = 0;
>>
@@ -1185,10 +1242,62 @@ vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_
}
_SAVE_CURRQEST_VARINFO (Info);
>>
;
+ vfrQuestionBaseInfo[EFI_VARSTORE_INFO & Info, EFI_QUESTION_ID & QId,EFI_QUESION_TYPE QType = QUESTION_NORMAL]:
+ <<
+ CHAR8 *QName = NULL;
+ CHAR8 *VarIdStr = NULL;
+ mUsedDefaultCount = 0;
+ >>
+ {
+ Name "=" QN:StringIdentifier "," <<
+ QName = QN->getText();
+ _PCATCH(mCVfrQuestionDB.FindQuestion (QName), VFR_RETURN_UNDEFINED, QN, "has already been used please used anther name");
+ >>
+ }
+ { V:VarId "=" vfrStorageVarId[Info, VarIdStr] "," }
+ {
+ QuestionId "=" ID:Number "," <<
+ QId = _STOQID(ID->getText(), ID->getLine());
+ _PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "has already been used please assign another number");
+ >>
+ }
+ <<
+ switch (QType) {
+ case QUESTION_NORMAL:
+ mCVfrQuestionDB.RegisterQuestion (QName, VarIdStr, QId);
+ break;
+ case QUESTION_DATE:
+ mCVfrQuestionDB.RegisterNewDateQuestion (QName, VarIdStr, QId);
+ break;
+ case QUESTION_TIME:
+ mCVfrQuestionDB.RegisterNewTimeQuestion (QName, VarIdStr, QId);
+ break;
+ case QUESTION_REF:
+ //
+ // VarIdStr != NULL stand for question with storagae.
+ //
+ if (VarIdStr != NULL) {
+ mCVfrQuestionDB.RegisterRefQuestion (QName, VarIdStr, QId);
+ } else {
+ mCVfrQuestionDB.RegisterQuestion (QName, NULL, QId);
+ }
+ break;
+ default:
+ _PCATCH(VFR_RETURN_FATAL_ERROR);
+ }
+ >>
+ <<
+ if (VarIdStr != NULL) {
+ delete VarIdStr;
+ }
+ _SAVE_CURRQEST_VARINFO (Info);
+ >>
+ ;
+
questionheaderFlagsField[UINT8 & Flags] :
ReadOnlyFlag << $Flags |= 0x01; >>
| InteractiveFlag << $Flags |= 0x04; >>
| ResetRequiredFlag << $Flags |= 0x10; >>
| ReconnectRequiredFlag << $Flags |= 0x40; >>
@@ -1233,10 +1342,11 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
CHAR8 *SName = NULL;
CHAR8 *TName = NULL;
EFI_VFR_RETURN_CODE VfrReturnCode = VFR_RETURN_SUCCESS;
EFI_IFR_TYPE_VALUE Dummy = gZeroEfiIfrTypeValue;
EFI_GUID *VarGuid = NULL;
+ gNestStructureIsBitVar = FALSE;
>>
(
SN1:StringIdentifier << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>
OpenBracket I1:Number CloseBracket <<
Idx = _STOU32(I1->getText(), I1->getLine());
@@ -1282,21 +1392,21 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
VfrReturnCode = gCVfrDataStorage.GetVarStoreId(SName, &$Info.mVarStoreId, &mFormsetGuid);
}
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
_PCATCH(VfrReturnCode, SN2);
VarStoreType = gCVfrDataStorage.GetVarStoreType ($Info.mVarStoreId);
- if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
+ if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_BUFFER_BITS) {
_PCATCH(gCVfrDataStorage.GetBufferVarStoreDataTypeName(Info.mVarStoreId, &TName), SN2);
_STRCAT(&VarStr, TName);
}
}
>>
(
"." <<
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
- _PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);
+ _PCATCH((((VarStoreType != EFI_VFR_VARSTORE_BUFFER)&& (VarStoreType != EFI_VFR_VARSTORE_BUFFER_BITS))? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);
}
_STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");
>>
SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>
{
@@ -1321,11 +1431,31 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
switch (VarStoreType) {
case EFI_VFR_VARSTORE_EFI:
_PCATCH(gCVfrDataStorage.GetEfiVarStoreInfo (&$Info), SN2);
break;
case EFI_VFR_VARSTORE_BUFFER:
- _PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize), SN2->getLine(), VarStr);
+ _PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize, FALSE), SN2->getLine(), VarStr);
+ VarGuid = gCVfrDataStorage.GetVarStoreGuid($Info.mVarStoreId);
+ _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Register (
+ SName,
+ VarGuid,
+ NULL),
+ SN2->getLine());
+ _PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Write (
+ 'a',
+ SName,
+ VarGuid,
+ NULL,
+ $Info.mVarType,
+ $Info.mInfo.mVarOffset,
+ $Info.mVarTotalSize,
+ Dummy),
+ SN2->getLine());
+ _PCATCH(gCVfrDataStorage.AddBufferVarStoreFieldInfo(&$Info),SN2->getLine());
+ break;
+ case EFI_VFR_VARSTORE_BUFFER_BITS:
+ _PCATCH(gCVfrVarDataTypeDB.GetDataFieldInfo (VarStr, $Info.mInfo.mVarOffset, $Info.mVarType, $Info.mVarTotalSize, TRUE), SN2->getLine(), VarStr);
VarGuid = gCVfrDataStorage.GetVarStoreGuid($Info.mVarStoreId);
_PCATCH((EFI_VFR_RETURN_CODE)gCVfrBufferConfig.Register (
SName,
VarGuid,
NULL),
@@ -1338,11 +1468,12 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
$Info.mVarType,
$Info.mInfo.mVarOffset,
$Info.mVarTotalSize,
Dummy),
SN2->getLine());
- _PCATCH(gCVfrDataStorage.AddBufferVarStoreFieldInfo(&$Info ),SN2->getLine());
+ _PCATCH(gCVfrDataStorage.AddBufferVarStoreFieldInfo(&$Info),SN2->getLine());
+ Info.mIsBitVar = TRUE;
break;
case EFI_VFR_VARSTORE_NAME:
default: break;
}
@@ -1419,10 +1550,13 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN &ListType]
>>
{
"\-" << Negative = TRUE; >>
}
N1:Number <<
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $Value.u32 = _STOU32(N1->getText(), N1->getLine());
+ } else {
switch ($Type) {
case EFI_IFR_TYPE_NUM_SIZE_8 :
$Value.u8 = _STOU8(N1->getText(), N1->getLine());
if (IntDecStyle) {
if (Negative) {
@@ -1500,10 +1634,11 @@ vfrConstantValueField[UINT8 Type, EFI_IFR_TYPE_VALUE &Value, BOOLEAN &ListType]
case EFI_IFR_TYPE_DATE :
case EFI_IFR_TYPE_REF :
default :
break;
}
+ }
>>
| B1:True << $Value.b = TRUE; >>
| B2:False << $Value.b = FALSE; >>
| O1:One << $Value.u8 = _STOU8(O1->getText(), O1->getLine()); >>
| O2:Ones << $Value.u64 = _STOU64(O2->getText(), O2->getLine()); >>
@@ -1672,42 +1807,48 @@ vfrStatementDefault :
"=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","
<<
if (gCurrentMinMaxData != NULL && gCurrentMinMaxData->IsNumericOpcode()) {
//check default value is valid for Numeric Opcode
NumericQst = (CIfrNumeric *) gCurrentQuestion;
- if ((NumericQst->GetNumericFlags() & EFI_IFR_DISPLAY) == 0) {
+ if ((NumericQst->GetNumericFlags() & EFI_IFR_DISPLAY) == 0 && !(_GET_CURRQEST_VARTINFO().mIsBitVar)) {
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_8:
- if (((INT8) Val->u8 < (INT8) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE())) ||
- ((INT8) Val->u8 > (INT8) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE()))) {
+ if (((INT8) Val->u8 < (INT8) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE)) ||
+ ((INT8) Val->u8 > (INT8) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE))) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
- if (((INT16) Val->u16 < (INT16) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE())) ||
- ((INT16) Val->u16 > (INT16) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE()))) {
+ if (((INT16) Val->u16 < (INT16) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE)) ||
+ ((INT16) Val->u16 > (INT16) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE))) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
- if (((INT32) Val->u32 < (INT32) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE())) ||
- ((INT32) Val->u32 > (INT32) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE()))) {
+ if (((INT32) Val->u32 < (INT32) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE)) ||
+ ((INT32) Val->u32 > (INT32) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE))) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_64:
- if (((INT64) Val->u64 < (INT64) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE())) ||
- ((INT64) Val->u64 > (INT64) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE()))) {
+ if (((INT64) Val->u64 < (INT64) gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE)) ||
+ ((INT64) Val->u64 > (INT64) gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE))) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
break;
default:
break;
}
} else {
- if (Val->u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE()) || Val->u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE())) {
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ if (Val->u32 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), TRUE) || Val->u32 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), TRUE)) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ } else {
+ if (Val->u64 < gCurrentMinMaxData->GetMinData(_GET_CURRQEST_DATATYPE(), FALSE) || Val->u64 > gCurrentMinMaxData->GetMaxData(_GET_CURRQEST_DATATYPE(), FALSE)) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
}
}
}
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
_PCATCH (VFR_RETURN_FATAL_ERROR, D->getLine(), "Default data type error.");
@@ -1742,21 +1883,29 @@ vfrStatementDefault :
default:
break;
}
} else {
- _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size), D->getLine());
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ Size = sizeof (UINT32);
+ } else {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size), D->getLine());
+ }
}
Size += OFFSET_OF (EFI_IFR_DEFAULT, Value);
DObj = new CIfrDefault ((UINT8)Size);
DObj->SetLineNo(D->getLine());
if (ArrayType) {
DObj->SetType (EFI_IFR_TYPE_BUFFER);
} else if (gIsStringOp) {
DObj->SetType (EFI_IFR_TYPE_STRING);
} else {
- DObj->SetType (_GET_CURRQEST_DATATYPE());
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ DObj->SetType (EFI_IFR_TYPE_NUM_SIZE_32);
+ } else {
+ DObj->SetType (_GET_CURRQEST_DATATYPE());
+ }
}
DObj->SetValue(*Val);
>>
| << IsExp = TRUE; DObj2 = new CIfrDefault2; DObj2->SetLineNo(D->getLine()); DObj2->SetScope (1); >>
vfrStatementValue "," << CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
@@ -2159,39 +2308,70 @@ vfrStatementBooleanType :
// default value = TRUE, defaultstore = MyDefaultStore,
// endcheckbox;
//
vfrStatementCheckBox :
<<
- CIfrCheckBox CBObj;
+ CIfrCheckBox *CBObj = NULL;
EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
CHAR8 *VarStoreName = NULL;
UINT32 DataTypeSize;
EFI_GUID *VarStoreGuid = NULL;
+ CIfrGuid *GuidObj = NULL;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;;
+ EFI_VARSTORE_INFO Info;
+ Info.mVarType = EFI_IFR_TYPE_OTHER;
+ Info.mVarTotalSize = 0;
+ Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ Info.mIsBitVar = FALSE;
>>
- L:CheckBox << CBObj.SetLineNo(L->getLine()); >>
- vfrQuestionHeader[CBObj] "," << //check data type
+ L:CheckBox
+ vfrQuestionBaseInfo[Info, QId] <<
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar || gNestStructureIsBitVar) {
+ GuidObj = new CIfrGuid(0);
+ GuidObj->SetGuid (&gBitVarstoreGuid);
+ GuidObj->SetLineNo(L->getLine());
+ }
+ CBObj = new CIfrCheckBox;
+ CBObj->SetLineNo(L->getLine());
+ CBObj->SetQuestionId (QId);
+ CBObj->SetVarStoreInfo (&Info);
+ >>
+ vfrStatementHeader[CBObj]"," << //check data type
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
_GET_CURRQEST_VARTINFO().mVarType = EFI_IFR_TYPE_BOOLEAN;
}
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
- _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
- if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
- _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");
- } else if ((gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&
- (_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {
- _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");
+ //
+ // Check whether the question refers to a bit field, if yes. create a Guid to
+ // indicate the question refers to a bit field.
+ //
+ if (_GET_CURRQEST_VARTINFO ().mIsBitVar || gNestStructureIsBitVar) {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
+ if ((gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER_BITS) &&
+ (_GET_CURRQEST_VARSIZE() != 1)) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only occupy 1 bit in Bit Varstore");
+ }
+ } else {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "CheckBox varid is not the valid data type");
+ if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid doesn't support array");
+ } else if ((gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId) == EFI_VFR_VARSTORE_BUFFER) &&
+ (_GET_CURRQEST_VARSIZE() != sizeof (BOOLEAN))) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "CheckBox varid only support BOOLEAN data type");
+ }
}
}
>>
{
- F:FLAGS "=" vfrCheckBoxFlags[CBObj, F->getLine()] ","
+ F:FLAGS "=" vfrCheckBoxFlags[*CBObj, F->getLine()] ","
<<
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
_PCATCH(gCVfrDataStorage.GetVarStoreName (_GET_CURRQEST_VARTINFO().mVarStoreId, &VarStoreName), VFR_RETURN_SUCCESS, L, "Failed to retrieve varstore name");
VarStoreGuid = gCVfrDataStorage.GetVarStoreGuid(_GET_CURRQEST_VARTINFO().mVarStoreId);
Val.b = TRUE;
- if (CBObj.GetFlags () & 0x01) {
+ if (CBObj->GetFlags () & 0x01) {
CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_STANDARD, F);
_PCATCH(
gCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_STANDARD,
_GET_CURRQEST_VARTINFO(),
@@ -2203,11 +2383,11 @@ vfrStatementCheckBox :
VFR_RETURN_SUCCESS,
L,
"No standard default storage found"
);
}
- if (CBObj.GetFlags () & 0x02) {
+ if (CBObj->GetFlags () & 0x02) {
CheckDuplicateDefaultValue (EFI_HII_DEFAULT_CLASS_MANUFACTURING, F);
_PCATCH(
gCVfrDefaultStore.BufferVarStoreAltConfigAdd (
EFI_HII_DEFAULT_CLASS_MANUFACTURING,
_GET_CURRQEST_VARTINFO(),
@@ -2223,14 +2403,21 @@ vfrStatementCheckBox :
}
}
>>
}
{
- Key "=" KN:Number "," << AssignQuestionKey (CBObj, KN); >>
+ Key "=" KN:Number "," << AssignQuestionKey (*CBObj, KN); >>
}
vfrStatementQuestionOptionList
- E:EndCheckBox << CRT_END_OP (E); >>
+ E:EndCheckBox << CRT_END_OP (E);
+ if (GuidObj != NULL) {
+ GuidObj->SetScope(1);
+ CRT_END_OP (E);
+ delete GuidObj;
+ }
+ if (CBObj != NULL) delete CBObj;
+ >>
";"
;
vfrCheckBoxFlags [CIfrCheckBox & CBObj, UINT32 LineNum] :
<<
@@ -2436,10 +2623,13 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
}
I:Number "," <<
if (!IntDecStyle && MinNegative) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, I->getLine(), "\"-\" can't be used when not in int decimal type. ");
}
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ MinU4 = _STOU32(I->getText(), I->getLine());
+ } else {
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_64 :
MinU8 = _STOU64(I->getText(), I->getLine());
if (IntDecStyle) {
if (MinNegative) {
@@ -2506,20 +2696,23 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
if (MinNegative) {
MinU1 = ~MinU1 + 1;
}
break;
}
+ }
>>
Maximum "="
{
"\-" << MaxNegative = TRUE; >>
}
A:Number "," <<
if (!IntDecStyle && MaxNegative) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "\"-\" can't be used when not in int decimal type. ");
}
-
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ MaxU4 = _STOU32(A->getText(), A->getLine());
+ } else {
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_64 :
MaxU8 = _STOU64(A->getText(), A->getLine());
if (IntDecStyle) {
if (MaxNegative) {
@@ -2622,75 +2815,122 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
}
break;
}
+ }
>>
{
STEP "=" S:Number ","
<<
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ StepU4 = _STOU32(S->getText(), S->getLine());
+ } else {
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText(), S->getLine()); break;
case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText(), S->getLine()); break;
case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText(), S->getLine()); break;
case EFI_IFR_TYPE_NUM_SIZE_8 : StepU1 = _STOU8(S->getText(), S->getLine()); break;
}
+ }
>>
}
<<
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4);
+ } else {
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_64 : $MMSDObj.SetMinMaxStepData (MinU8, MaxU8, StepU8); break;
case EFI_IFR_TYPE_NUM_SIZE_32 : $MMSDObj.SetMinMaxStepData (MinU4, MaxU4, StepU4); break;
case EFI_IFR_TYPE_NUM_SIZE_16 : $MMSDObj.SetMinMaxStepData (MinU2, MaxU2, StepU2); break;
case EFI_IFR_TYPE_NUM_SIZE_8 : $MMSDObj.SetMinMaxStepData (MinU1, MaxU1, StepU1); break;
}
+ }
>>
;
vfrStatementNumeric :
<<
- CIfrNumeric NObj;
+ CIfrNumeric *NObj = NULL;
UINT32 DataTypeSize;
BOOLEAN IsSupported = TRUE;
UINT8 ShrinkSize = 0;
+ CIfrGuid *GuidObj = NULL;
+ UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;;
+ EFI_VARSTORE_INFO Info;
+ Info.mVarType = EFI_IFR_TYPE_OTHER;
+ Info.mVarTotalSize = 0;
+ Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ Info.mIsBitVar = FALSE;
>>
- L:Numeric << NObj.SetLineNo(L->getLine()); >>
- vfrQuestionHeader[NObj] "," << // check data type
+ L:Numeric << >>
+ vfrQuestionBaseInfo[Info, QId] <<
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar || gNestStructureIsBitVar) {
+ GuidObj = new CIfrGuid(0);
+ GuidObj->SetGuid (&gBitVarstoreGuid);
+ GuidObj->SetLineNo(L->getLine());
+ }
+ NObj = new CIfrNumeric;
+ NObj->SetLineNo(L->getLine());
+ NObj->SetQuestionId (QId);
+ NObj->SetVarStoreInfo (&Info);
+ >>
+ vfrStatementHeader[NObj]","
+ <<
+ // check data type
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
- _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");
- if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
- _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar || gNestStructureIsBitVar) {
+ LFlags|= (0X0F & (_GET_CURRQEST_VARSIZE()));
+ _PCATCH(NObj->SetFlags (NObj->FLAGS(), LFlags), L->getLine());
+ } else {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "Numeric varid is not the valid data type");
+ if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric varid doesn't support array");
+ }
+ _PCATCH(NObj->SetFlags (NObj->FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
}
- _PCATCH(NObj.SetFlags (NObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
}
>>
- { F:FLAGS "=" vfrNumericFlags[NObj, F->getLine()] "," }
+ { F:FLAGS "=" vfrNumericFlags[*NObj, F->getLine()] "," }
{
- Key "=" KN:Number "," << AssignQuestionKey (NObj, KN); >>
+ Key "=" KN:Number "," << AssignQuestionKey (*NObj, KN); >>
}
- vfrSetMinMaxStep[NObj] <<
- switch (_GET_CURRQEST_DATATYPE()) {
- //
- // Base on the type to know the actual used size,shrink the buffer
- // size allocate before.
- //
- case EFI_IFR_TYPE_NUM_SIZE_8: ShrinkSize = 21;break;
- case EFI_IFR_TYPE_NUM_SIZE_16:ShrinkSize = 18;break;
- case EFI_IFR_TYPE_NUM_SIZE_32:ShrinkSize = 12;break;
- case EFI_IFR_TYPE_NUM_SIZE_64:break;
- default:
- IsSupported = FALSE;
- break;
+ vfrSetMinMaxStep[*NObj] <<
+ if (!_GET_CURRQEST_VARTINFO().mIsBitVar && !gNestStructureIsBitVar) {
+ switch (_GET_CURRQEST_DATATYPE()) {
+ //
+ // Base on the type to know the actual used size,shrink the buffer
+ // size allocate before.
+ //
+ case EFI_IFR_TYPE_NUM_SIZE_8: ShrinkSize = 21;break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:ShrinkSize = 18;break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:ShrinkSize = 12;break;
+ case EFI_IFR_TYPE_NUM_SIZE_64:break;
+ default:
+ IsSupported = FALSE;
+ break;
+ }
+ } else {
+ ShrinkSize = 0;
}
- NObj.ShrinkBinSize (ShrinkSize);
+ NObj->ShrinkBinSize (ShrinkSize);
+
if (!IsSupported) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "Numeric question only support UINT8, UINT16, UINT32 and UINT64 data type.");
}
>>
vfrStatementQuestionOptionList
E:EndNumeric <<
- CRT_END_OP (E);
+ CRT_END_OP (E);
+ if (GuidObj != NULL) {
+ GuidObj->SetScope(1);
+ CRT_END_OP (E);
+ delete GuidObj;
+ }
+ if (NObj != NULL) delete NObj;
>>
";"
;
vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
@@ -2702,25 +2942,34 @@ vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
BOOLEAN IsDisplaySpecified = FALSE;
>>
numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified ] )*
<<
//check data type flag
- if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
- VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
- if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
- if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
- _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
+ if (!_GET_CURRQEST_VARTINFO().mIsBitVar && !gNestStructureIsBitVar) {
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
+ if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
+ if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
+ _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
+ }
+ } else {
+ // update data type for name/value store
+ UINT32 DataTypeSize;
+ _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
+ gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
+ _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
}
- } else {
- // update data type for name/value store
- UINT32 DataTypeSize;
+ } else if (IsSetType){
_GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
- gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
- _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
}
- } else if (IsSetType){
- _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
+ } else {
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
+ if (VarStoreType == EFI_VFR_VARSTORE_BUFFER_BITS) {
+ LFlags|= (0X0F & (_GET_CURRQEST_VARSIZE()));
+ }
+ }
}
_PCATCH(NObj.SetFlags (HFlags, LFlags, IsDisplaySpecified), LineNum);
>>
;
@@ -2736,30 +2985,57 @@ numericFlagsField [UINT8 & HFlags, UINT8 & LFlags, BOOLEAN & IsSetType, BOOLEAN
| questionheaderFlagsField[HFlags]
;
vfrStatementOneOf :
<<
- CIfrOneOf OObj;
+ CIfrOneOf *OObj = NULL;
UINT32 DataTypeSize;
BOOLEAN IsSupported = TRUE;
UINT8 ShrinkSize = 0;
+ CIfrGuid *GuidObj = NULL;
+ UINT8 LFlags = _GET_CURRQEST_DATATYPE() & EFI_IFR_NUMERIC_SIZE;
+ EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;;
+ EFI_VARSTORE_INFO Info;
+ Info.mVarType = EFI_IFR_TYPE_OTHER;
+ Info.mVarTotalSize = 0;
+ Info.mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
+ Info.mVarStoreId = EFI_VARSTORE_ID_INVALID;
+ Info.mIsBitVar = FALSE;
>>
- L:OneOf << OObj.SetLineNo(L->getLine()); >>
- vfrQuestionHeader[OObj] "," << //check data type
+ L:OneOf
+ vfrQuestionBaseInfo[Info, QId] <<
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar || gNestStructureIsBitVar) {
+ GuidObj = new CIfrGuid(0);
+ GuidObj->SetGuid (&gBitVarstoreGuid);
+ GuidObj->SetLineNo(L->getLine());
+ }
+ OObj = new CIfrOneOf;
+ OObj->SetLineNo(L->getLine());
+ OObj->SetQuestionId (QId);
+ OObj->SetVarStoreInfo (&Info);
+ >>
+ vfrStatementHeader[OObj]","
+ << //check data type
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
- _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");
- if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
- _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar || gNestStructureIsBitVar) {
+ LFlags|= (0X0F & (_GET_CURRQEST_VARSIZE()));
+ _PCATCH(OObj->SetFlags (OObj->FLAGS(), LFlags), L->getLine());
+ } else {
+ _PCATCH (gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize), L->getLine(), "OneOf varid is not the valid data type");
+ if (DataTypeSize != 0 && DataTypeSize != _GET_CURRQEST_VARSIZE()) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf varid doesn't support array");
+ }
+ _PCATCH(OObj->SetFlags (OObj->FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
}
- _PCATCH(OObj.SetFlags (OObj.FLAGS(), _GET_CURRQEST_DATATYPE()), L->getLine());
}
>>
- { F:FLAGS "=" vfrOneofFlagsField[OObj, F->getLine()] "," }
+ { F:FLAGS "=" vfrOneofFlagsField[*OObj, F->getLine()] "," }
{
- vfrSetMinMaxStep[OObj]
+ vfrSetMinMaxStep[*OObj]
}
<<
+ if (!_GET_CURRQEST_VARTINFO().mIsBitVar && !gNestStructureIsBitVar) {
switch (_GET_CURRQEST_DATATYPE()) {
//
// Base on the type to know the actual used size,shrink the buffer
// size allocate before.
//
@@ -2769,18 +3045,28 @@ vfrStatementOneOf :
case EFI_IFR_TYPE_NUM_SIZE_64:break;
default:
IsSupported = FALSE;
break;
}
- OObj.ShrinkBinSize (ShrinkSize);
+ } else {
+ ShrinkSize = 0;
+ }
+ OObj->ShrinkBinSize (ShrinkSize);
+
if (!IsSupported) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, L->getLine(), "OneOf question only support UINT8, UINT16, UINT32 and UINT64 data type.");
}
>>
vfrStatementQuestionOptionList
E:EndOneOf <<
- CRT_END_OP (E);
+ CRT_END_OP (E);
+ if (GuidObj != NULL) {
+ GuidObj->SetScope(1);
+ CRT_END_OP (E);
+ delete GuidObj;
+ }
+ if (OObj != NULL) delete OObj;
>>
";"
;
vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :
@@ -2792,25 +3078,34 @@ vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :
BOOLEAN IsDisplaySpecified = FALSE;
>>
numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified] )*
<<
//check data type flag
- if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
- VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
- if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
- if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
- _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
+ if (!_GET_CURRQEST_VARTINFO().mIsBitVar && !gNestStructureIsBitVar) {
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
+ if (VarStoreType == EFI_VFR_VARSTORE_BUFFER || VarStoreType == EFI_VFR_VARSTORE_EFI) {
+ if (_GET_CURRQEST_DATATYPE() != (LFlags & EFI_IFR_NUMERIC_SIZE)) {
+ _PCATCH(VFR_RETURN_INVALID_PARAMETER, LineNum, "Numeric Flag is not same to Numeric VarData type");
+ }
+ } else {
+ // update data type for Name/Value store
+ UINT32 DataTypeSize;
+ _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
+ gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
+ _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
}
- } else {
- // update data type for Name/Value store
- UINT32 DataTypeSize;
+ } else if (IsSetType){
_GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
- gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &DataTypeSize);
- _GET_CURRQEST_VARTINFO().mVarTotalSize = DataTypeSize;
}
- } else if (IsSetType){
- _GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
+ } else {
+ if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
+ VarStoreType = gCVfrDataStorage.GetVarStoreType (_GET_CURRQEST_VARTINFO().mVarStoreId);
+ if (VarStoreType == EFI_VFR_VARSTORE_BUFFER_BITS) {
+ LFlags|= (0X0F & (_GET_CURRQEST_VARSIZE()));
+ }
+ }
}
_PCATCH(OObj.SetFlags (HFlags, LFlags), LineNum);
>>
;
@@ -3363,10 +3658,13 @@ vfrStatementOneOfOption :
Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE(), *Val, ArrayType] ","
<<
if (gCurrentMinMaxData != NULL) {
//set min/max value for oneof opcode
UINT64 Step = gCurrentMinMaxData->GetStepData(_GET_CURRQEST_DATATYPE());
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ gCurrentMinMaxData->SetMinMaxStepData(Val->u32, Val->u32, (UINT32) Step);
+ } else {
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_64:
gCurrentMinMaxData->SetMinMaxStepData(Val->u64, Val->u64, Step);
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
@@ -3379,10 +3677,11 @@ vfrStatementOneOfOption :
gCurrentMinMaxData->SetMinMaxStepData(Val->u8, Val->u8, (UINT8) Step);
break;
default:
break;
}
+ }
}
if (_GET_CURRQEST_DATATYPE() == EFI_IFR_TYPE_OTHER) {
Size = sizeof (EFI_IFR_TYPE_VALUE);
} else if (ArrayType) {
switch (_GET_CURRQEST_DATATYPE()) {
@@ -3411,11 +3710,15 @@ vfrStatementOneOfOption :
break;
default:
break;
}
} else {
- ReturnCode = gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size);
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ Size = sizeof (UINT32);
+ } else {
+ ReturnCode = gCVfrVarDataTypeDB.GetDataTypeSize (_GET_CURRQEST_DATATYPE(), &Size);
+ }
}
if (ReturnCode != VFR_RETURN_SUCCESS) {
_PCATCH (ReturnCode, L->getLine());
}
@@ -3424,11 +3727,15 @@ vfrStatementOneOfOption :
OOOObj->SetLineNo(L->getLine());
OOOObj->SetOption (_STOSID(S->getText(), S->getLine()));
if (ArrayType) {
OOOObj->SetType (EFI_IFR_TYPE_BUFFER);
} else {
+ if (_GET_CURRQEST_VARTINFO().mIsBitVar) {
+ OOOObj->SetType ( EFI_IFR_TYPE_NUM_SIZE_32);
+ } else {
OOOObj->SetType (_GET_CURRQEST_DATATYPE());
+ }
}
OOOObj->SetValue (*Val);
>>
F:FLAGS "=" vfrOneOfOptionFlags[*OOOObj, F->getLine()]
<<
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 2f97975..d0b7d6c 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -1,10 +1,10 @@
/** @file
Vfr common library functions.
-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
http://opensource.org/licenses/bsd-license.php
@@ -575,10 +575,19 @@ CVfrVarDataTypeDB::RegisterNewType (
{
New->mNext = mDataTypeList;
mDataTypeList = New;
}
+VOID
+CVfrVarDataTypeDB::RegisterNewBitsType (
+ IN SVfrDataType *New
+ )
+{
+ New->mNext = mBitsTypeList;
+ mBitsTypeList = New;
+}
+
EFI_VFR_RETURN_CODE
CVfrVarDataTypeDB::ExtractStructTypeName (
IN CHAR8 *&VarStr,
OUT CHAR8 *TName
)
@@ -598,10 +607,28 @@ CVfrVarDataTypeDB::ExtractStructTypeName (
}
return VFR_RETURN_SUCCESS;
}
+BOOLEAN
+CVfrVarDataTypeDB::DataTypeHasBitField (
+ IN CHAR8 *TypeName
+ )
+{
+ SVfrDataType *pType = NULL;
+ SVfrDataField *pTmp;
+
+ GetDataType (TypeName, &pType);
+ for (pTmp = pType->mMembers; pTmp!= NULL; pTmp = pTmp->mNext) {
+ if (pTmp->mIsBitField) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
EFI_VFR_RETURN_CODE
CVfrVarDataTypeDB::ExtractFieldNameAndArrary (
IN CHAR8 *&VarStr,
IN CHAR8 *FName,
OUT UINT32 &ArrayIdx
@@ -695,11 +722,12 @@ CVfrVarDataTypeDB::GetTypeField (
EFI_VFR_RETURN_CODE
CVfrVarDataTypeDB::GetFieldOffset (
IN SVfrDataField *Field,
IN UINT32 ArrayIdx,
- OUT UINT32 &Offset
+ OUT UINT32 &Offset,
+ IN BOOLEAN IsBitField
)
{
if (Field == NULL) {
return VFR_RETURN_FATAL_ERROR;
}
@@ -727,12 +755,15 @@ CVfrVarDataTypeDB::GetFieldOffset (
//
// if ((ArrayIdx == INVALID_ARRAY_INDEX) && (Field->mArrayNum > 0)) {
// return VFR_RETURN_ERROR_ARRARY_NUM;
// }
//
-
- Offset = Field->mOffset + Field->mFieldType->mTotalSize * ((ArrayIdx == INVALID_ARRAY_INDEX) ? 0 : ArrayIdx);
+ if (IsBitField) {
+ Offset = Field->mOffset + Field->mFieldType->mTotalSize * ((ArrayIdx == INVALID_ARRAY_INDEX) ? 0 : ArrayIdx) * 8;
+ } else {
+ Offset = Field->mOffset + Field->mFieldType->mTotalSize * ((ArrayIdx == INVALID_ARRAY_INDEX) ? 0 : ArrayIdx);
+ }
return VFR_RETURN_SUCCESS;
}
UINT8
CVfrVarDataTypeDB::GetFieldWidth (
@@ -747,21 +778,26 @@ CVfrVarDataTypeDB::GetFieldWidth (
}
UINT32
CVfrVarDataTypeDB::GetFieldSize (
IN SVfrDataField *Field,
- IN UINT32 ArrayIdx
+ IN UINT32 ArrayIdx,
+ IN BOOLEAN IsBitField
)
{
if (Field == NULL) {
return VFR_RETURN_FATAL_ERROR;
}
if ((ArrayIdx == INVALID_ARRAY_INDEX) && (Field->mArrayNum != 0)) {
- return Field->mFieldType->mTotalSize * Field->mArrayNum;
+ return Field->mFieldType->mTotalSize * Field->mArrayNum;
} else {
- return Field->mFieldType->mTotalSize;
+ if (IsBitField) {
+ return Field->mBitWidth;
+ } else {
+ return Field->mFieldType->mTotalSize;
+ }
}
}
VOID
CVfrVarDataTypeDB::InternalTypesListInit (
@@ -786,22 +822,25 @@ CVfrVarDataTypeDB::InternalTypesListInit (
strcpy (pYearField->mFieldName, "Year");
GetDataType ((CHAR8 *)"UINT16", &pYearField->mFieldType);
pYearField->mOffset = 0;
pYearField->mNext = pMonthField;
pYearField->mArrayNum = 0;
+ pYearField->mIsBitField = FALSE;
strcpy (pMonthField->mFieldName, "Month");
GetDataType ((CHAR8 *)"UINT8", &pMonthField->mFieldType);
pMonthField->mOffset = 2;
pMonthField->mNext = pDayField;
pMonthField->mArrayNum = 0;
+ pMonthField->mIsBitField = FALSE;
strcpy (pDayField->mFieldName, "Day");
GetDataType ((CHAR8 *)"UINT8", &pDayField->mFieldType);
pDayField->mOffset = 3;
pDayField->mNext = NULL;
pDayField->mArrayNum = 0;
+ pDayField->mIsBitField = FALSE;
New->mMembers = pYearField;
} else if (strcmp (gInternalTypesTable[Index].mTypeName, "EFI_HII_TIME") == 0) {
SVfrDataField *pHoursField = new SVfrDataField;
SVfrDataField *pMinutesField = new SVfrDataField;
@@ -810,22 +849,25 @@ CVfrVarDataTypeDB::InternalTypesListInit (
strcpy (pHoursField->mFieldName, "Hours");
GetDataType ((CHAR8 *)"UINT8", &pHoursField->mFieldType);
pHoursField->mOffset = 0;
pHoursField->mNext = pMinutesField;
pHoursField->mArrayNum = 0;
+ pHoursField->mIsBitField = FALSE;
strcpy (pMinutesField->mFieldName, "Minutes");
GetDataType ((CHAR8 *)"UINT8", &pMinutesField->mFieldType);
pMinutesField->mOffset = 1;
pMinutesField->mNext = pSecondsField;
pMinutesField->mArrayNum = 0;
+ pMinutesField->mIsBitField = FALSE;
strcpy (pSecondsField->mFieldName, "Seconds");
GetDataType ((CHAR8 *)"UINT8", &pSecondsField->mFieldType);
pSecondsField->mOffset = 2;
pSecondsField->mNext = NULL;
pSecondsField->mArrayNum = 0;
+ pSecondsField->mIsBitField = FALSE;
New->mMembers = pHoursField;
} else if (strcmp (gInternalTypesTable[Index].mTypeName, "EFI_HII_REF") == 0) {
SVfrDataField *pQuestionIdField = new SVfrDataField;
SVfrDataField *pFormIdField = new SVfrDataField;
@@ -835,28 +877,32 @@ CVfrVarDataTypeDB::InternalTypesListInit (
strcpy (pQuestionIdField->mFieldName, "QuestionId");
GetDataType ((CHAR8 *)"UINT16", &pQuestionIdField->mFieldType);
pQuestionIdField->mOffset = 0;
pQuestionIdField->mNext = pFormIdField;
pQuestionIdField->mArrayNum = 0;
+ pQuestionIdField->mIsBitField = FALSE;
strcpy (pFormIdField->mFieldName, "FormId");
GetDataType ((CHAR8 *)"UINT16", &pFormIdField->mFieldType);
pFormIdField->mOffset = 2;
pFormIdField->mNext = pFormSetGuidField;
pFormIdField->mArrayNum = 0;
+ pFormIdField->mIsBitField = FALSE;
strcpy (pFormSetGuidField->mFieldName, "FormSetGuid");
GetDataType ((CHAR8 *)"EFI_GUID", &pFormSetGuidField->mFieldType);
pFormSetGuidField->mOffset = 4;
pFormSetGuidField->mNext = pDevicePathField;
pFormSetGuidField->mArrayNum = 0;
+ pFormSetGuidField->mIsBitField = FALSE;
strcpy (pDevicePathField->mFieldName, "DevicePath");
GetDataType ((CHAR8 *)"EFI_STRING_ID", &pDevicePathField->mFieldType);
pDevicePathField->mOffset = 20;
pDevicePathField->mNext = NULL;
pDevicePathField->mArrayNum = 0;
+ pDevicePathField->mIsBitField = FALSE;
New->mMembers = pQuestionIdField;
} else {
New->mMembers = NULL;
}
@@ -870,10 +916,11 @@ CVfrVarDataTypeDB::InternalTypesListInit (
CVfrVarDataTypeDB::CVfrVarDataTypeDB (
VOID
)
{
mDataTypeList = NULL;
+ mBitsTypeList = NULL;
mNewDataType = NULL;
mCurrDataField = NULL;
mPackAlign = DEFAULT_PACK_ALIGN;
mPackStack = NULL;
mFirstNewDataTypeName = NULL;
@@ -899,11 +946,22 @@ CVfrVarDataTypeDB::~CVfrVarDataTypeDB (
while(pType->mMembers != NULL) {
pField = pType->mMembers;
pType->mMembers = pType->mMembers->mNext;
delete pField;
}
- delete pType;
+ delete pType;
+ }
+
+ while (mBitsTypeList != NULL) {
+ pType = mBitsTypeList;
+ mBitsTypeList = mBitsTypeList->mNext;
+ while(pType->mMembers != NULL) {
+ pField = pType->mMembers;
+ pType->mMembers = pType->mMembers->mNext;
+ delete pField;
+ }
+ delete pType;
}
while (mPackStack != NULL) {
pPack = mPackStack;
mPackStack = mPackStack->mNext;
@@ -976,10 +1034,11 @@ CVfrVarDataTypeDB::DeclareDataTypeBegin (
pNewType->mType = EFI_IFR_TYPE_OTHER;
pNewType->mAlign = DEFAULT_ALIGN;
pNewType->mTotalSize = 0;
pNewType->mMembers = NULL;
pNewType->mNext = NULL;
+ pNewType->mHasBitField = FALSE;
mNewDataType = pNewType;
}
EFI_VFR_RETURN_CODE
@@ -1008,10 +1067,61 @@ CVfrVarDataTypeDB::SetNewTypeName (
strcpy(mNewDataType->mTypeName, TypeName);
return VFR_RETURN_SUCCESS;
}
EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::DataTypeAddBitField (
+ IN CHAR8 *FieldName,
+ IN CHAR8 *TypeName,
+ IN UINT8 Width
+ )
+{
+ SVfrDataField *pNewField = NULL;
+ SVfrDataType *pFieldType = NULL;
+ SVfrDataField *pTmp;
+ UINT32 Align;
+
+ CHECK_ERROR_RETURN (GetDataType (TypeName, &pFieldType), VFR_RETURN_SUCCESS);
+
+ if (strlen (FieldName) >= MAX_NAME_LEN) {
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
+
+ for (pTmp = mNewDataType->mMembers; pTmp != NULL; pTmp = pTmp->mNext) {
+ if (strcmp (pTmp->mFieldName, FieldName) == 0) {
+ return VFR_RETURN_REDEFINED;
+ }
+ }
+
+ if ((pNewField = new SVfrDataField) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ strcpy (pNewField->mFieldName, FieldName);
+ pNewField->mFieldType = pFieldType;
+ pNewField->mIsBitField = TRUE;
+ pNewField->mBitWidth = Width;
+
+ if (mNewDataType->mMembers == NULL) {
+ mNewDataType->mMembers = pNewField;
+ pNewField->mNext = NULL;
+ pNewField->mOffset = 0;
+ } else {
+ for (pTmp = mNewDataType->mMembers; pTmp->mNext != NULL; pTmp = pTmp->mNext)
+ ;
+ pTmp->mNext = pNewField;
+ pNewField->mNext = NULL;
+ }
+
+ mNewDataType->mAlign = MIN (mPackAlign, MAX (pFieldType->mAlign, mNewDataType->mAlign));
+
+ mNewDataType->mHasBitField = TRUE;
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
CVfrVarDataTypeDB::DataTypeAddField (
IN CHAR8 *FieldName,
IN CHAR8 *TypeName,
IN UINT32 ArrayNum
)
@@ -1039,10 +1149,11 @@ CVfrVarDataTypeDB::DataTypeAddField (
return VFR_RETURN_OUT_FOR_RESOURCES;
}
strcpy (pNewField->mFieldName, FieldName);
pNewField->mFieldType = pFieldType;
pNewField->mArrayNum = ArrayNum;
+ pNewField->mIsBitField = FALSE;
if ((mNewDataType->mTotalSize % Align) == 0) {
pNewField->mOffset = mNewDataType->mTotalSize;
} else {
pNewField->mOffset = mNewDataType->mTotalSize + ALIGN_STUFF(mNewDataType->mTotalSize, Align);
}
@@ -1061,20 +1172,117 @@ CVfrVarDataTypeDB::DataTypeAddField (
return VFR_RETURN_SUCCESS;
}
VOID
+CVfrVarDataTypeDB::ChangeFieldToBitRepresentation(
+ IN SVfrDataType *DataType
+ )
+{
+
+ SVfrDataField *pTmp;
+ SVfrDataField *pSTmp;
+ UINT32 Offset;
+ UINT8 Width;
+ UINT32 TotalSize;
+
+ Offset = 0;
+ Width = 0;
+ TotalSize = 0;
+
+
+ for (pTmp = DataType->mMembers; pTmp!= NULL; pTmp = pTmp->mNext) {
+ pTmp->mOffset = 0;
+ }
+
+ for (pTmp = DataType->mMembers; pTmp != NULL; pTmp = pTmp->mNext) {
+ if (pTmp->mIsBitField) {
+ pSTmp = pTmp;
+ while (pSTmp != NULL && pSTmp->mIsBitField) {
+ pSTmp->mOffset += Offset;
+ pTmp = pSTmp;
+ if ((pSTmp->mNext != NULL) &&!(pSTmp->mNext->mIsBitField)) {
+ //
+ // Currect field is bit field, but next field is not bit field
+ //
+ if (Width > 0){
+ TotalSize += pSTmp->mFieldType->mTotalSize;
+ Width += pSTmp->mBitWidth;
+ if (Width > pSTmp->mFieldType->mTotalSize * 8) {
+ Offset += pSTmp->mFieldType->mTotalSize * 8;
+ pSTmp->mOffset += Offset;
+ } else {
+ pSTmp->mOffset += (Width - pSTmp->mBitWidth);
+ }
+ Width = 0;
+ break;
+ }
+ Offset += pSTmp->mFieldType->mTotalSize * 8;
+ TotalSize += pSTmp->mFieldType->mTotalSize;
+ break;
+ } else if ((pSTmp->mNext != NULL) && strcmp (pSTmp->mFieldType->mTypeName,pSTmp->mNext->mFieldType->mTypeName) !=0) {
+ //
+ // Currect field is bit field, and next field is also bit field,
+ // but they have different type name.
+ //
+ if (Width > 0){
+ Width += pSTmp->mBitWidth;
+ if (Width > pSTmp->mFieldType->mTotalSize * 8) {
+ Offset += pSTmp->mFieldType->mTotalSize * 8;
+ pSTmp->mOffset += Offset;
+ } else {
+ pSTmp->mOffset += (Width - pSTmp->mBitWidth);
+ }
+ Width = 0;
+ }
+ Offset += pSTmp->mFieldType->mTotalSize * 8;
+ TotalSize += pSTmp->mFieldType->mTotalSize;
+ break;
+ }else {
+ pSTmp->mOffset += Width;
+ Width += pSTmp->mBitWidth;
+ if (Width > pSTmp->mFieldType->mTotalSize * 8) {
+ Offset += pSTmp->mFieldType->mTotalSize * 8;
+ TotalSize += pSTmp->mFieldType->mTotalSize;
+ Width = 0;
+ break;
+ }
+ }
+ if (pSTmp->mNext == NULL) {
+ Offset += pSTmp->mFieldType->mTotalSize * 8;
+ TotalSize += pSTmp->mFieldType->mTotalSize;
+ Width = 0;
+ break;
+ }
+ pSTmp = pSTmp->mNext;
+ }
+ } else {
+ pTmp->mOffset += Offset;
+ pTmp->mBitWidth = pTmp->mFieldType->mTotalSize * 8;
+ Offset += pTmp->mFieldType->mTotalSize * 8;
+ TotalSize += pTmp->mFieldType->mTotalSize;
+ }
+ }
+
+ DataType->mTotalSize = TotalSize;
+}
+
+VOID
CVfrVarDataTypeDB::DeclareDataTypeEnd (
VOID
)
{
if (mNewDataType->mTypeName[0] == '\0') {
return;
}
- if ((mNewDataType->mTotalSize % mNewDataType->mAlign) !=0) {
- mNewDataType->mTotalSize += ALIGN_STUFF (mNewDataType->mTotalSize, mNewDataType->mAlign);
+ if (mNewDataType->mHasBitField) {
+ ChangeFieldToBitRepresentation (mNewDataType);
+ } else {
+ if ((mNewDataType->mTotalSize % mNewDataType->mAlign) !=0) {
+ mNewDataType->mTotalSize += ALIGN_STUFF (mNewDataType->mTotalSize, mNewDataType->mAlign);
+ }
}
RegisterNewType (mNewDataType);
if (mFirstNewDataTypeName == NULL) {
mFirstNewDataTypeName = mNewDataType->mTypeName;
@@ -1170,43 +1378,104 @@ CVfrVarDataTypeDB::GetDataTypeSize (
EFI_VFR_RETURN_CODE
CVfrVarDataTypeDB::GetDataFieldInfo (
IN CHAR8 *VarStr,
OUT UINT16 &Offset,
OUT UINT8 &Type,
+ OUT UINT32 &Size,
+ IN BOOLEAN IsBitField
+ )
+{
+ CHAR8 TName[MAX_NAME_LEN], FName[MAX_NAME_LEN];
+ UINT32 ArrayIdx, Tmp;
+ SVfrDataType *pType = NULL;
+ SVfrDataField *pField = NULL;
+ BOOLEAN IsNestBitField;
+
+ Offset = 0;
+ Type = EFI_IFR_TYPE_OTHER;
+ Size = 0;
+
+ CHECK_ERROR_RETURN (ExtractStructTypeName (VarStr, TName), VFR_RETURN_SUCCESS);
+ CHECK_ERROR_RETURN (GetDataType (TName, &pType), VFR_RETURN_SUCCESS);
+
+ //
+ // if it is not struct data type
+ //
+ Type = pType->mType;
+ Size = pType->mTotalSize;
+
+ while (*VarStr != '\0') {
+ CHECK_ERROR_RETURN(ExtractFieldNameAndArrary(VarStr, FName, ArrayIdx), VFR_RETURN_SUCCESS);
+ CHECK_ERROR_RETURN(GetTypeField (FName, pType, pField), VFR_RETURN_SUCCESS);
+ pType = pField->mFieldType;
+ IsNestBitField = pField->mIsBitField;
+ gNestStructureIsBitVar = IsNestBitField;
+ if (!IsBitField && IsNestBitField) {
+ CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp, IsNestBitField), VFR_RETURN_SUCCESS);
+ Offset = (UINT16) (Offset * 8 + Tmp);
+ Size = GetFieldSize (pField, ArrayIdx, IsNestBitField);
+ } else {
+ CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp, IsBitField), VFR_RETURN_SUCCESS);
+ Offset = (UINT16) (Offset + Tmp);
+ Size = GetFieldSize (pField, ArrayIdx, IsBitField);
+ }
+ Type = GetFieldWidth (pField);
+ }
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
+CVfrVarDataTypeDB::GetDataFieldInfo (
+ IN CHAR8 *VarStr,
+ OUT UINT16 &Offset,
+ OUT UINT8 &Type,
OUT UINT32 &Size
)
{
CHAR8 TName[MAX_NAME_LEN], FName[MAX_NAME_LEN];
UINT32 ArrayIdx, Tmp;
SVfrDataType *pType = NULL;
SVfrDataField *pField = NULL;
+ BOOLEAN IsNestBitField;
+ BOOLEAN IsBitField;
Offset = 0;
Type = EFI_IFR_TYPE_OTHER;
Size = 0;
CHECK_ERROR_RETURN (ExtractStructTypeName (VarStr, TName), VFR_RETURN_SUCCESS);
CHECK_ERROR_RETURN (GetDataType (TName, &pType), VFR_RETURN_SUCCESS);
+ IsBitField = DataTypeHasBitField (TName);
+
//
// if it is not struct data type
//
Type = pType->mType;
Size = pType->mTotalSize;
while (*VarStr != '\0') {
- CHECK_ERROR_RETURN(ExtractFieldNameAndArrary(VarStr, FName, ArrayIdx), VFR_RETURN_SUCCESS);
+ CHECK_ERROR_RETURN(ExtractFieldNameAndArrary(VarStr, FName, ArrayIdx), VFR_RETURN_SUCCESS);
CHECK_ERROR_RETURN(GetTypeField (FName, pType, pField), VFR_RETURN_SUCCESS);
pType = pField->mFieldType;
- CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp), VFR_RETURN_SUCCESS);
- Offset = (UINT16) (Offset + Tmp);
+ IsNestBitField = pField->mIsBitField;
+ gNestStructureIsBitVar = IsNestBitField;
+ if (!IsBitField && IsNestBitField) {
+ CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp, IsNestBitField), VFR_RETURN_SUCCESS);
+ Offset = (UINT16) (Offset * 8 + Tmp);
+ Size = GetFieldSize (pField, ArrayIdx, IsNestBitField);
+ } else {
+ CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp, IsBitField), VFR_RETURN_SUCCESS);
+ Offset = (UINT16) (Offset + Tmp);
+ Size = GetFieldSize (pField, ArrayIdx, IsBitField);
+ }
Type = GetFieldWidth (pField);
- Size = GetFieldSize (pField, ArrayIdx);
}
return VFR_RETURN_SUCCESS;
}
+
EFI_VFR_RETURN_CODE
CVfrVarDataTypeDB::GetUserDefinedTypeNameList (
OUT CHAR8 ***NameList,
OUT UINT32 *ListSize
)
@@ -1347,10 +1616,11 @@ SVfrVarStorageNode::SVfrVarStorageNode (
SVfrVarStorageNode::SVfrVarStorageNode (
IN EFI_GUID *Guid,
IN CHAR8 *StoreName,
IN EFI_VARSTORE_ID VarStoreId,
IN SVfrDataType *DataType,
+ IN BOOLEAN BitsVarstore,
IN BOOLEAN Flag
)
{
if (Guid != NULL) {
mGuid = *Guid;
@@ -1363,11 +1633,15 @@ SVfrVarStorageNode::SVfrVarStorageNode (
} else {
mVarStoreName = NULL;
}
mNext = NULL;
mVarStoreId = VarStoreId;
- mVarStoreType = EFI_VFR_VARSTORE_BUFFER;
+ if (BitsVarstore) {
+ mVarStoreType = EFI_VFR_VARSTORE_BUFFER_BITS;
+ } else {
+ mVarStoreType = EFI_VFR_VARSTORE_BUFFER;
+ }
mStorageInfo.mDataType = DataType;
mAssignedFlag = Flag;
}
SVfrVarStorageNode::SVfrVarStorageNode (
@@ -1415,10 +1689,11 @@ CVfrDataStorage::CVfrDataStorage (
mFreeVarStoreIdBitMap[0] = 0x80000000;
mBufferVarStoreList = NULL;
mEfiVarStoreList = NULL;
mNameVarStoreList = NULL;
+ mBitsBufferStoreList = NULL;
mCurrVarStorageNode = NULL;
mNewVarStorageNode = NULL;
mBufferFieldInfoListHead = NULL;
mBufferFieldInfoListTail = NULL;
}
@@ -1442,10 +1717,15 @@ CVfrDataStorage::~CVfrDataStorage (
while (mNameVarStoreList != NULL) {
pNode = mNameVarStoreList;
mNameVarStoreList = mNameVarStoreList->mNext;
delete pNode;
}
+ while ( mBitsBufferStoreList != NULL) {
+ pNode = mBitsBufferStoreList;
+ mBitsBufferStoreList = mBitsBufferStoreList->mNext;
+ delete pNode;
+ }
if (mNewVarStorageNode != NULL) {
delete mNewVarStorageNode;
}
}
@@ -1661,11 +1941,11 @@ CVfrDataStorage::DeclareBufferVarStore (
return VFR_RETURN_VARSTOREID_REDEFINED;
}
MarkVarStoreIdUsed (VarStoreId);
}
- if ((pNew = new SVfrVarStorageNode (Guid, StoreName, VarStoreId, pDataType, Flag)) == NULL) {
+ if ((pNew = new SVfrVarStorageNode (Guid, StoreName, VarStoreId, pDataType, FALSE, Flag)) == NULL) {
return VFR_RETURN_OUT_FOR_RESOURCES;
}
pNew->mNext = mBufferVarStoreList;
mBufferVarStoreList = pNew;
@@ -1676,10 +1956,57 @@ CVfrDataStorage::DeclareBufferVarStore (
return VFR_RETURN_SUCCESS;
}
EFI_VFR_RETURN_CODE
+CVfrDataStorage::DeclareBitsBufferVarStore (
+ IN CHAR8 *StoreName,
+ IN EFI_GUID *Guid,
+ IN CVfrVarDataTypeDB *DataTypeDB,
+ IN CHAR8 *TypeName,
+ IN EFI_VARSTORE_ID VarStoreId,
+ IN BOOLEAN Flag
+ )
+{
+ SVfrVarStorageNode *pNew = NULL;
+ SVfrDataType *pDataType = NULL;
+ EFI_VARSTORE_ID TempVarStoreId;
+
+ if ((StoreName == NULL) || (Guid == NULL) || (DataTypeDB == NULL)) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ if (GetVarStoreId (StoreName, &TempVarStoreId, Guid) == VFR_RETURN_SUCCESS) {
+ return VFR_RETURN_REDEFINED;
+ }
+
+ CHECK_ERROR_RETURN(DataTypeDB->GetDataType (TypeName, &pDataType), VFR_RETURN_SUCCESS);
+
+ if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
+ VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_BUFFER);
+ } else {
+ if (ChekVarStoreIdFree (VarStoreId) == FALSE) {
+ return VFR_RETURN_VARSTOREID_REDEFINED;
+ }
+ MarkVarStoreIdUsed (VarStoreId);
+ }
+
+ if ((pNew = new SVfrVarStorageNode (Guid, StoreName, VarStoreId, pDataType, TRUE, Flag)) == NULL) {
+ return VFR_RETURN_OUT_FOR_RESOURCES;
+ }
+
+ pNew->mNext = mBitsBufferStoreList;
+ mBitsBufferStoreList = pNew;
+
+ if (gCVfrBufferConfig.Register(StoreName, Guid) != 0) {
+ return VFR_RETURN_FATAL_ERROR;
+ }
+
+ return VFR_RETURN_SUCCESS;
+}
+
+EFI_VFR_RETURN_CODE
CVfrDataStorage::GetVarStoreByDataType (
IN CHAR8 *DataTypeName,
OUT SVfrVarStorageNode **VarNode,
IN EFI_GUID *VarGuid
)
@@ -1813,10 +2140,18 @@ CVfrDataStorage::GetVarStoreId (
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
return ReturnCode;
}
}
}
+ for (pNode = mBitsBufferStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
+ if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
+ *VarStoreId = mCurrVarStorageNode->mVarStoreId;
+ return ReturnCode;
+ }
+ }
+ }
if (HasFoundOne) {
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
return VFR_RETURN_SUCCESS;
}
@@ -1852,10 +2187,17 @@ CVfrDataStorage::GetBufferVarStoreDataTypeName (
*DataTypeName = pNode->mStorageInfo.mDataType->mTypeName;
return VFR_RETURN_SUCCESS;
}
}
+ for (pNode = mBitsBufferStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ *DataTypeName = pNode->mStorageInfo.mDataType->mTypeName;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
return VFR_RETURN_UNDEFINED;
}
EFI_VFR_VARSTORE_TYPE
CVfrDataStorage::GetVarStoreType (
@@ -1890,10 +2232,17 @@ CVfrDataStorage::GetVarStoreType (
VarStoreType = pNode->mVarStoreType;
return VarStoreType;
}
}
+ for (pNode = mBitsBufferStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ VarStoreType = pNode->mVarStoreType;
+ return VarStoreType;
+ }
+ }
+
return VarStoreType;
}
EFI_GUID *
CVfrDataStorage::GetVarStoreGuid (
@@ -1928,10 +2277,17 @@ CVfrDataStorage::GetVarStoreGuid (
VarGuid = &pNode->mGuid;
return VarGuid;
}
}
+ for (pNode = mBitsBufferStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ VarGuid = &pNode->mGuid;
+ return VarGuid;
+ }
+ }
+
return VarGuid;
}
EFI_VFR_RETURN_CODE
CVfrDataStorage::GetVarStoreName (
@@ -1964,10 +2320,18 @@ CVfrDataStorage::GetVarStoreName (
*VarStoreName = pNode->mVarStoreName;
return VFR_RETURN_SUCCESS;
}
}
+ for (pNode = mBitsBufferStoreList; pNode != NULL; pNode = pNode->mNext) {
+ if (pNode->mVarStoreId == VarStoreId) {
+ *VarStoreName = pNode->mVarStoreName;
+ return VFR_RETURN_SUCCESS;
+ }
+ }
+
+
*VarStoreName = NULL;
return VFR_RETURN_UNDEFINED;
}
EFI_VFR_RETURN_CODE
@@ -2375,10 +2739,11 @@ EFI_VARSTORE_INFO::EFI_VARSTORE_INFO (
mVarStoreId = EFI_VARSTORE_ID_INVALID;
mInfo.mVarName = EFI_STRING_ID_INVALID;
mInfo.mVarOffset = EFI_VAROFFSET_INVALID;
mVarType = EFI_IFR_TYPE_OTHER;
mVarTotalSize = 0;
+ mIsBitVar = FALSE;
}
EFI_VARSTORE_INFO::EFI_VARSTORE_INFO (
IN EFI_VARSTORE_INFO &Info
)
@@ -2386,10 +2751,11 @@ EFI_VARSTORE_INFO::EFI_VARSTORE_INFO (
mVarStoreId = Info.mVarStoreId;
mInfo.mVarName = Info.mInfo.mVarName;
mInfo.mVarOffset = Info.mInfo.mVarOffset;
mVarType = Info.mVarType;
mVarTotalSize = Info.mVarTotalSize;
+ mIsBitVar = Info.mIsBitVar;
}
EFI_VARSTORE_INFO&
EFI_VARSTORE_INFO::operator= (
IN CONST EFI_VARSTORE_INFO &Info
@@ -2399,10 +2765,11 @@ EFI_VARSTORE_INFO::operator= (
mVarStoreId = Info.mVarStoreId;
mInfo.mVarName = Info.mInfo.mVarName;
mInfo.mVarOffset = Info.mInfo.mVarOffset;
mVarType = Info.mVarType;
mVarTotalSize = Info.mVarTotalSize;
+ mIsBitVar = Info.mIsBitVar;
}
return *this;
}
@@ -2413,11 +2780,12 @@ EFI_VARSTORE_INFO::operator == (
{
if ((mVarStoreId == Info->mVarStoreId) &&
(mInfo.mVarName == Info->mInfo.mVarName) &&
(mInfo.mVarOffset == Info->mInfo.mVarOffset) &&
(mVarType == Info->mVarType) &&
- (mVarTotalSize == Info->mVarTotalSize)) {
+ (mVarTotalSize == Info->mVarTotalSize) &&
+ (mIsBitVar == Info->mIsBitVar)) {
return TRUE;
}
return FALSE;
}
@@ -3715,11 +4083,13 @@ CVfrStringDB::GetUnicodeStringTextSize (
}
return StringSize;
}
-BOOLEAN VfrCompatibleMode = FALSE;
+BOOLEAN VfrCompatibleMode = FALSE;
+BOOLEAN gNestStructureIsBitVar = FALSE;
+EFI_GUID gBitVarstoreGuid = {0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60 ,0xA7 , 0x1D}};
CVfrVarDataTypeDB gCVfrVarDataTypeDB;
CVfrDefaultStore gCVfrDefaultStore;
CVfrDataStorage gCVfrDataStorage;
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
index 59509c3..2adfba7 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
@@ -1,10 +1,10 @@
/** @file
Vfr common library functions.
-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
http://opensource.org/licenses/bsd-license.php
@@ -20,10 +20,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Common/UefiBaseTypes.h"
#include "EfiVfr.h"
#include "VfrError.h"
extern BOOLEAN VfrCompatibleMode;
+extern EFI_GUID gBitVarstoreGuid;
+extern BOOLEAN gNestStructureIsBitVar;
#define MAX_NAME_LEN 64
#define MAX_STRING_LEN 0x100
#define DEFAULT_ALIGN 1
#define DEFAULT_PACK_ALIGN 0x8
@@ -114,18 +116,21 @@ struct SVfrDataType;
struct SVfrDataField {
CHAR8 mFieldName[MAX_NAME_LEN];
SVfrDataType *mFieldType;
UINT32 mOffset;
UINT32 mArrayNum;
+ BOOLEAN mIsBitField;
+ UINT8 mBitWidth;
SVfrDataField *mNext;
};
struct SVfrDataType {
CHAR8 mTypeName[MAX_NAME_LEN];
UINT8 mType;
UINT32 mAlign;
UINT32 mTotalSize;
+ BOOLEAN mHasBitField;
SVfrDataField *mMembers;
SVfrDataType *mNext;
};
#define VFR_PACK_ASSIGN 0x01
@@ -183,40 +188,46 @@ private:
public:
EFI_VFR_RETURN_CODE Pack (IN UINT32, IN UINT8, IN CHAR8 *Identifier = NULL, IN UINT32 Number = DEFAULT_PACK_ALIGN);
private:
SVfrDataType *mDataTypeList;
+ SVfrDataType *mBitsTypeList;
SVfrDataType *mNewDataType;
SVfrDataType *mCurrDataType;
SVfrDataField *mCurrDataField;
VOID InternalTypesListInit (VOID);
VOID RegisterNewType (IN SVfrDataType *);
+ VOID RegisterNewBitsType (IN SVfrDataType *);
EFI_VFR_RETURN_CODE ExtractStructTypeName (IN CHAR8 *&, OUT CHAR8 *);
EFI_VFR_RETURN_CODE GetTypeField (IN CONST CHAR8 *, IN SVfrDataType *, IN SVfrDataField *&);
- EFI_VFR_RETURN_CODE GetFieldOffset (IN SVfrDataField *, IN UINT32, OUT UINT32 &);
+ EFI_VFR_RETURN_CODE GetFieldOffset (IN SVfrDataField *, IN UINT32, OUT UINT32 &, IN BOOLEAN);
UINT8 GetFieldWidth (IN SVfrDataField *);
- UINT32 GetFieldSize (IN SVfrDataField *, IN UINT32);
+ UINT32 GetFieldSize (IN SVfrDataField *, IN UINT32, IN BOOLEAN);
public:
CVfrVarDataTypeDB (VOID);
~CVfrVarDataTypeDB (VOID);
VOID DeclareDataTypeBegin (VOID);
EFI_VFR_RETURN_CODE SetNewTypeName (IN CHAR8 *);
EFI_VFR_RETURN_CODE DataTypeAddField (IN CHAR8 *, IN CHAR8 *, IN UINT32);
+ EFI_VFR_RETURN_CODE DataTypeAddBitField (IN CHAR8 *, IN CHAR8 *, IN UINT8);
VOID DeclareDataTypeEnd (VOID);
+ VOID ChangeFieldToBitRepresentation( IN SVfrDataType *);
EFI_VFR_RETURN_CODE GetDataType (IN CHAR8 *, OUT SVfrDataType **);
EFI_VFR_RETURN_CODE GetDataTypeSize (IN CHAR8 *, OUT UINT32 *);
EFI_VFR_RETURN_CODE GetDataTypeSize (IN UINT8, OUT UINT32 *);
+ EFI_VFR_RETURN_CODE GetDataFieldInfo (IN CHAR8 *, OUT UINT16 &, OUT UINT8 &, OUT UINT32 &, IN BOOLEAN);
EFI_VFR_RETURN_CODE GetDataFieldInfo (IN CHAR8 *, OUT UINT16 &, OUT UINT8 &, OUT UINT32 &);
EFI_VFR_RETURN_CODE GetUserDefinedTypeNameList (OUT CHAR8 ***, OUT UINT32 *);
EFI_VFR_RETURN_CODE ExtractFieldNameAndArrary (IN CHAR8 *&, OUT CHAR8 *, OUT UINT32 &);
+ BOOLEAN DataTypeHasBitField (IN CHAR8 *);
BOOLEAN IsTypeNameDefined (IN CHAR8 *);
VOID Dump(IN FILE *);
//
@@ -236,11 +247,12 @@ extern CVfrVarDataTypeDB gCVfrVarDataTypeDB;
typedef enum {
EFI_VFR_VARSTORE_INVALID,
EFI_VFR_VARSTORE_BUFFER,
EFI_VFR_VARSTORE_EFI,
- EFI_VFR_VARSTORE_NAME
+ EFI_VFR_VARSTORE_NAME,
+ EFI_VFR_VARSTORE_BUFFER_BITS
} EFI_VFR_VARSTORE_TYPE;
struct SVfrVarStorageNode {
EFI_GUID mGuid;
CHAR8 *mVarStoreName;
@@ -266,11 +278,11 @@ struct SVfrVarStorageNode {
} mNameSpace;
} mStorageInfo;
public:
SVfrVarStorageNode (IN EFI_GUID *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN EFI_STRING_ID, IN UINT32, IN BOOLEAN Flag = TRUE);
- SVfrVarStorageNode (IN EFI_GUID *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN SVfrDataType *, IN BOOLEAN Flag = TRUE);
+ SVfrVarStorageNode (IN EFI_GUID *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN SVfrDataType *,IN BOOLEAN, IN BOOLEAN Flag = TRUE);
SVfrVarStorageNode (IN CHAR8 *, IN EFI_VARSTORE_ID);
~SVfrVarStorageNode (VOID);
private:
SVfrVarStorageNode (IN CONST SVfrVarStorageNode&); // Prevent copy-construction
@@ -283,10 +295,11 @@ struct EFI_VARSTORE_INFO {
EFI_STRING_ID mVarName;
UINT16 mVarOffset;
} mInfo;
UINT8 mVarType;
UINT32 mVarTotalSize;
+ BOOLEAN mIsBitVar;
EFI_VARSTORE_INFO (VOID);
EFI_VARSTORE_INFO (IN EFI_VARSTORE_INFO &);
EFI_VARSTORE_INFO& operator=(IN CONST EFI_VARSTORE_INFO &);
BOOLEAN operator == (IN EFI_VARSTORE_INFO *);
@@ -308,10 +321,11 @@ private:
UINT32 mFreeVarStoreIdBitMap[EFI_FREE_VARSTORE_ID_BITMAP_SIZE];
struct SVfrVarStorageNode *mBufferVarStoreList;
struct SVfrVarStorageNode *mEfiVarStoreList;
struct SVfrVarStorageNode *mNameVarStoreList;
+ struct SVfrVarStorageNode *mBitsBufferStoreList;
struct SVfrVarStorageNode *mCurrVarStorageNode;
struct SVfrVarStorageNode *mNewVarStorageNode;
BufferVarStoreFieldInfoNode *mBufferFieldInfoListHead;
BufferVarStoreFieldInfoNode *mBufferFieldInfoListTail;
@@ -342,10 +356,11 @@ public:
EFI_VFR_RETURN_CODE DeclareNameVarStoreEnd (EFI_GUID *);
EFI_VFR_RETURN_CODE DeclareEfiVarStore (IN CHAR8 *, IN EFI_GUID *, IN EFI_STRING_ID, IN UINT32, IN BOOLEAN Flag = TRUE);
EFI_VFR_RETURN_CODE DeclareBufferVarStore (IN CHAR8 *, IN EFI_GUID *, IN CVfrVarDataTypeDB *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN BOOLEAN Flag = TRUE);
+ EFI_VFR_RETURN_CODE DeclareBitsBufferVarStore (IN CHAR8 *, IN EFI_GUID *, IN CVfrVarDataTypeDB *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN BOOLEAN Flag = TRUE);
EFI_VFR_RETURN_CODE GetVarStoreId (IN CHAR8 *, OUT EFI_VARSTORE_ID *, IN EFI_GUID *VarGuid = NULL);
EFI_VFR_VARSTORE_TYPE GetVarStoreType (IN EFI_VARSTORE_ID);
EFI_GUID * GetVarStoreGuid (IN EFI_VARSTORE_ID);
EFI_VFR_RETURN_CODE GetVarStoreName (IN EFI_VARSTORE_ID, OUT CHAR8 **);
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFC patch 2/4] MdeModulePkg/SetupBrowser: Handle questions with Bit VarStore
2017-04-18 12:46 [RFC patch 0/4] Support Bit fields in EFI Variable Storage Dandan Bi
2017-04-18 12:46 ` [RFC patch 1/4] BaseTool/VfrCompiler: Support bit " Dandan Bi
@ 2017-04-18 12:46 ` Dandan Bi
2017-04-18 12:46 ` [RFC patch 3/4] MdeModulePkg/HiiDatabase: " Dandan Bi
2017-04-18 12:46 ` [RFC patch 4/4] MdeModulePkg/DriverSample: Add smaple questions with bit VarStore Dandan Bi
3 siblings, 0 replies; 5+ messages in thread
From: Dandan Bi @ 2017-04-18 12:46 UTC (permalink / raw)
To: edk2-devel; +Cc: Eric Dong, Liming Gao
For oneof/numeric/CheckBox(storage can be Bit EFI VarStore)
If we want question value can be updated and shown correctly
in UI page, we need do enhancements in following cases:
1. Parse the Ifr data to get the bit EFI VarStore info correctly.
2. Set/get value to/from bit EFI VarStore correctly.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 137 +++++++++++++++++-----
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 106 ++++++++++++++++-
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 3 +
3 files changed, 208 insertions(+), 38 deletions(-)
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index 6b3e5e0..ccd6790 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -15,10 +15,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Setup.h"
UINT16 mStatementIndex;
UINT16 mExpressionOpCodeIndex;
EFI_QUESTION_ID mUsedQuestionId;
+EFI_GUID mBitVarstoreGuid = {0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60 ,0xA7 , 0x1D}};
+BOOLEAN mQuestionReferBitVar = FALSE;
+
extern LIST_ENTRY gBrowserStorageList;
/**
Initialize Statement header members.
@param OpCodeData Pointer of the raw OpCode data.
@@ -559,10 +562,11 @@ CreateStorage (
}
BrowserStorage->HiiHandle = FormSet->HiiHandle;
BrowserStorage->Initialized = FALSE;
+ BrowserStorage->IsBitVarStore = FALSE;
}
Storage->BrowserStorage = BrowserStorage;
InitializeConfigHdr (FormSet, Storage);
Storage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigHdr), Storage->ConfigHdr);
@@ -1312,10 +1316,12 @@ ParseOpCodes (
BOOLEAN InUnknownScope;
UINT8 UnknownDepth;
FORMSET_DEFAULTSTORE *PreDefaultStore;
LIST_ENTRY *DefaultLink;
BOOLEAN HaveInserted;
+ UINT16 ByteWidth;
+ UINT16 BitWidth;
SuppressForQuestion = FALSE;
SuppressForOption = FALSE;
InScopeDisable = FALSE;
DepthOfDisable = 0;
@@ -1978,47 +1984,99 @@ ParseOpCodes (
ASSERT(CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_ONE_OF *) OpCodeData)->Flags;
Value = &CurrentStatement->HiiValue;
- switch (CurrentStatement->Flags & EFI_IFR_NUMERIC_SIZE) {
- case EFI_IFR_NUMERIC_SIZE_1:
- CurrentStatement->Minimum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue;
- CurrentStatement->Maximum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue;
- CurrentStatement->Step = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step;
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT8);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
- break;
+ if (mQuestionReferBitVar) {
+ mQuestionReferBitVar = FALSE;
+ CurrentStatement->StorageBitWidth = CurrentStatement->Flags & 0X0F;
+ CurrentStatement->Storage->IsBitVarStore = TRUE;
+ CurrentStatement->VarBitOffset = CurrentStatement->VarStoreInfo.VarOffset;
+ CurrentStatement->VarStoreInfo.VarOffset = CurrentStatement->VarBitOffset / 8;
+ BitWidth = CurrentStatement->VarBitOffset - (CurrentStatement->VarStoreInfo.VarOffset * 8) + CurrentStatement->StorageBitWidth;
+ ByteWidth = BitWidth / 8;
+ CurrentStatement->StorageWidth = (BitWidth % 8 == 0? ByteWidth: ByteWidth + 1);
+ CurrentStatement->Minimum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue;
+ CurrentStatement->Maximum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue;
+ CurrentStatement->Step = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step;
+ if (Operand == EFI_IFR_NUMERIC_OP) {
+ switch (CurrentStatement->StorageWidth) {
+ case 1:
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &= 0x30;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_8;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue = (UINT8)CurrentStatement->Minimum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue = (UINT8)CurrentStatement->Maximum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step = (UINT8)CurrentStatement->Step;
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
+ break;
+ case 2:
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &= 0x30;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_16;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue = (UINT16)CurrentStatement->Minimum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue = (UINT16)CurrentStatement->Maximum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step = (UINT16)CurrentStatement->Step;
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
+ break;
+ case 3:
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &= 0x30;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_32;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue = (UINT32)CurrentStatement->Minimum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue = (UINT32)CurrentStatement->Maximum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step = (UINT32)CurrentStatement->Step;
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
+ break;
+ case 4:
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &= 0x30;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_32;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue = (UINT32)CurrentStatement->Minimum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue = (UINT32)CurrentStatement->Maximum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step = (UINT32)CurrentStatement->Step;
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
+ break;
+ default:
+ break;
+ }
+ }
+ } else {
- case EFI_IFR_NUMERIC_SIZE_2:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue, sizeof (UINT16));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue, sizeof (UINT16));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step, sizeof (UINT16));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT16);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
- break;
+ switch (CurrentStatement->Flags & EFI_IFR_NUMERIC_SIZE) {
+ case EFI_IFR_NUMERIC_SIZE_1:
+ CurrentStatement->Minimum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue;
+ CurrentStatement->Maximum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue;
+ CurrentStatement->Step = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step;
+ CurrentStatement->StorageWidth = (UINT16) sizeof (UINT8);
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
+ break;
- case EFI_IFR_NUMERIC_SIZE_4:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue, sizeof (UINT32));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue, sizeof (UINT32));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step, sizeof (UINT32));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT32);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
- break;
+ case EFI_IFR_NUMERIC_SIZE_2:
+ CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue, sizeof (UINT16));
+ CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue, sizeof (UINT16));
+ CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step, sizeof (UINT16));
+ CurrentStatement->StorageWidth = (UINT16) sizeof (UINT16);
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
+ break;
- case EFI_IFR_NUMERIC_SIZE_8:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MinValue, sizeof (UINT64));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MaxValue, sizeof (UINT64));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.Step, sizeof (UINT64));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT64);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
- break;
+ case EFI_IFR_NUMERIC_SIZE_4:
+ CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue, sizeof (UINT32));
+ CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue, sizeof (UINT32));
+ CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step, sizeof (UINT32));
+ CurrentStatement->StorageWidth = (UINT16) sizeof (UINT32);
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
+ break;
- default:
- break;
- }
+ case EFI_IFR_NUMERIC_SIZE_8:
+ CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MinValue, sizeof (UINT64));
+ CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MaxValue, sizeof (UINT64));
+ CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.Step, sizeof (UINT64));
+ CurrentStatement->StorageWidth = (UINT16) sizeof (UINT64);
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
+ break;
+ default:
+ break;
+ }
+ }
InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
if ((Operand == EFI_IFR_ONE_OF_OP) && Scope != 0) {
SuppressForOption = TRUE;
}
@@ -2045,10 +2103,21 @@ ParseOpCodes (
CurrentStatement->Flags = ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags;
CurrentStatement->StorageWidth = (UINT16) sizeof (BOOLEAN);
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN;
+ if (mQuestionReferBitVar) {
+ mQuestionReferBitVar = FALSE;
+ CurrentStatement->StorageBitWidth = 1;
+ CurrentStatement->Storage->IsBitVarStore = TRUE;
+ CurrentStatement->VarBitOffset = CurrentStatement->VarStoreInfo.VarOffset;
+ CurrentStatement->VarStoreInfo.VarOffset = CurrentStatement->VarBitOffset / 8;
+ BitWidth = CurrentStatement->VarBitOffset - (CurrentStatement->VarStoreInfo.VarOffset * 8) + CurrentStatement->StorageBitWidth;
+ ByteWidth = BitWidth / 8;
+ CurrentStatement->StorageWidth = (BitWidth % 8 == 0? ByteWidth: ByteWidth + 1);
+ }
+
InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
break;
case EFI_IFR_STRING_OP:
@@ -2594,10 +2663,14 @@ ParseOpCodes (
//
// Vendor specific
//
case EFI_IFR_GUID_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
+ if (CompareGuid ((EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)), &mBitVarstoreGuid)) {
+ Scope = 0;
+ mQuestionReferBitVar = TRUE;
+ }
break;
//
// Scope End
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 83dc2b8..6b46581 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -1392,10 +1392,14 @@ BufferToValue (
UINTN Index;
UINT8 DigitUint8;
BOOLEAN IsString;
UINTN Length;
EFI_STATUS Status;
+ UINT8 *Buffer;
+ UINT32 Mask;
+ UINT32 PreBits;
+ UINT32 BufferValue;
IsString = (BOOLEAN) ((Question->HiiValue.Type == EFI_IFR_TYPE_STRING) ? TRUE : FALSE);
if (Question->Storage->Type == EFI_HII_VARSTORE_BUFFER ||
Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
IsBufferStorage = TRUE;
@@ -1413,11 +1417,17 @@ BufferToValue (
Dst = Question->BufferValue;
} else {
//
// Other type of Questions
//
- Dst = (UINT8 *) &Question->HiiValue.Value;
+ if (Question->Storage->IsBitVarStore) {
+ Buffer = (UINT8 *)AllocateZeroPool (Question->StorageWidth);
+ ASSERT (Buffer != NULL);
+ Dst = Buffer;
+ } else {
+ Dst = (UINT8 *) &Question->HiiValue.Value;
+ }
}
//
// Temp cut at the end of this section, end with '\0' or '&'.
//
@@ -1471,10 +1481,27 @@ BufferToValue (
}
}
*StringPtr = TempChar;
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;
+ Mask = (1 << Question->StorageBitWidth) - 1;
+ BufferValue = *(Buffer);
+ BufferValue |= *(Buffer + 1) << 8;
+ BufferValue |= *(Buffer + 2) << 16;
+ BufferValue |= *(Buffer + 3) << 24;
+ BufferValue >>= PreBits;
+ BufferValue &= Mask;
+
+ CopyMem ((UINT8 *) &Question->HiiValue.Value, (UINT8*)&BufferValue, Question->StorageWidth);
+
+ if (Buffer != NULL) {
+ FreePool (Buffer);
+ }
+ }
+
return Status;
}
/**
Get Question's current Value.
@@ -1509,10 +1536,13 @@ GetQuestionValue (
CHAR16 *Result;
CHAR16 *Value;
UINTN Length;
BOOLEAN IsBufferStorage;
UINTN MaxLen;
+ UINT32 PreBits;
+ UINT32 Mask;
+ UINT32 BufferValue;
Status = EFI_SUCCESS;
Value = NULL;
Result = NULL;
@@ -1676,16 +1706,40 @@ GetQuestionValue (
if (IsBufferStorage) {
if (GetValueFrom == GetSetValueWithEditBuffer) {
//
// Copy from storage Edit buffer
//
- CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;;
+ Mask = (1<< Question->StorageBitWidth) -1;
+ BufferValue = *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset);
+ BufferValue |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 1) << 8;
+ BufferValue |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 2) << 16;
+ BufferValue |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 3) << 24;
+ BufferValue >>= PreBits;
+ BufferValue &= Mask;
+ CopyMem (Dst, (UINT8*)&BufferValue, StorageWidth);
+ } else {
+ CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ }
} else {
//
// Copy from storage Edit buffer
//
- CopyMem (Dst, Storage->Buffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;;
+ Mask = (1<< Question->StorageBitWidth) -1;
+ BufferValue = *(Storage->Buffer + Question->VarStoreInfo.VarOffset);
+ BufferValue |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 1) << 8;
+ BufferValue |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 2) << 16;
+ BufferValue |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 3) << 24;
+ BufferValue >>= PreBits;
+ BufferValue &= Mask;
+ CopyMem (Dst, (UINT8*)&BufferValue, StorageWidth);
+ } else {
+ CopyMem (Dst, Storage->Buffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ }
}
} else {
Value = NULL;
Status = GetValueByName (Storage, Question->VariableName, &Value, GetValueFrom);
if (EFI_ERROR (Status)) {
@@ -1825,10 +1879,14 @@ SetQuestionValue (
CHAR16 *TemName;
CHAR16 *TemString;
UINTN Index;
NAME_VALUE_NODE *Node;
UINTN MaxLen;
+ UINT32 PreBits;
+ UINT32 Mask;
+ UINT32 Buffer;
+ UINT32 SrcValue;
Status = EFI_SUCCESS;
Node = NULL;
if (SetValueTo >= GetSetValueWithMax) {
@@ -1947,17 +2005,53 @@ SetQuestionValue (
if (SetValueTo == GetSetValueWithEditBuffer || SetValueTo == GetSetValueWithBuffer) {
if (IsBufferStorage) {
if (SetValueTo == GetSetValueWithEditBuffer) {
//
// Copy to storage edit buffer
- //
- CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
+ //
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;
+ SrcValue = (UINT32)(*Src);
+ SrcValue <<= PreBits;
+ Mask = (1<< Question->StorageBitWidth) -1;
+ Mask <<= PreBits;
+ Buffer = *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset);
+ Buffer |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 1) << 8;
+ Buffer |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 2) << 16;
+ Buffer |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 3) << 24;
+
+ Buffer = (Buffer & (~Mask)) | SrcValue;
+ *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset) = (UINT8) Buffer & 0xFF;
+ *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 1) = (UINT8) (Buffer >> 8);
+ *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 2) = (UINT8) (Buffer >> 16);
+ *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 3) = (UINT8) (Buffer >> 24);
+ } else {
+ CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
+ }
} else if (SetValueTo == GetSetValueWithBuffer) {
//
// Copy to storage edit buffer
//
- CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;
+ SrcValue = (UINT32)(*Src);
+ SrcValue <<= PreBits;
+ Mask = (1<< Question->StorageBitWidth) -1;
+ Mask <<= PreBits;
+ Buffer = *(Storage->Buffer + Question->VarStoreInfo.VarOffset);
+ Buffer |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 1) << 8;
+ Buffer |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 2) << 16;
+ Buffer |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 3) << 24;
+
+ Buffer = (Buffer & (~Mask)) | SrcValue;
+ *(Storage->Buffer + Question->VarStoreInfo.VarOffset) = (UINT8) Buffer & 0xFF;
+ *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 1) = (UINT8) (Buffer >> 8);
+ *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 2) = (UINT8) (Buffer >> 16);
+ *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 3) = (UINT8) (Buffer >> 24);
+ } else {
+ CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
+ }
}
} else {
if (IsString) {
//
// Allocate enough string buffer.
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index f1accdf..f919b76 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -137,10 +137,11 @@ typedef struct {
LIST_ENTRY Link;
UINT8 Type; // Storage type
BOOLEAN Initialized; // Whether this varstore is initialized, efi varstore not used.
+ BOOLEAN IsBitVarStore; // whether this is bit varstore.
EFI_HII_HANDLE HiiHandle; // HiiHandle for this varstore, efi varstore not used.
EFI_GUID Guid;
CHAR16 *Name; // For EFI_IFR_VARSTORE
@@ -327,10 +328,12 @@ struct _FORM_BROWSER_STATEMENT{
EFI_QUESTION_ID QuestionId; // The value of zero is reserved
EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no variable storage
BROWSER_STORAGE *Storage;
VAR_STORE_INFO VarStoreInfo;
UINT16 StorageWidth;
+ UINT16 StorageBitWidth;
+ UINT16 VarBitOffset;
UINT8 QuestionFlags;
CHAR16 *VariableName; // Name/Value or EFI Variable name
CHAR16 *BlockName; // Buffer storage block name: "OFFSET=...WIDTH=..."
EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFC patch 3/4] MdeModulePkg/HiiDatabase: Handle questions with Bit VarStore
2017-04-18 12:46 [RFC patch 0/4] Support Bit fields in EFI Variable Storage Dandan Bi
2017-04-18 12:46 ` [RFC patch 1/4] BaseTool/VfrCompiler: Support bit " Dandan Bi
2017-04-18 12:46 ` [RFC patch 2/4] MdeModulePkg/SetupBrowser: Handle questions with Bit VarStore Dandan Bi
@ 2017-04-18 12:46 ` Dandan Bi
2017-04-18 12:46 ` [RFC patch 4/4] MdeModulePkg/DriverSample: Add smaple questions with bit VarStore Dandan Bi
3 siblings, 0 replies; 5+ messages in thread
From: Dandan Bi @ 2017-04-18 12:46 UTC (permalink / raw)
To: edk2-devel; +Cc: Eric Dong, Liming Gao
For oneof/numeric/checkbox, their storage may be bit field.
When generating <ConfigAltResp> string to get default value
for these questions, we need to parse the Ifr data to get
the bit Varstore info,and then generating the correct
<ConfigAltResp> string.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
.../Universal/HiiDatabaseDxe/ConfigRouting.c | 197 +++++++++++++++++++--
.../Universal/HiiDatabaseDxe/HiiDatabase.h | 3 +
2 files changed, 186 insertions(+), 14 deletions(-)
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index c9ff1cf..5da0ba6 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -13,10 +13,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
extern HII_DATABASE_PRIVATE_DATA mPrivate;
+EFI_GUID mBitVarstoreGuid = {0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60 ,0xA7 , 0x1D}};
+BOOLEAN mNeedUpdateBlockData = FALSE;
+BOOLEAN mQuestionReferBitVar = FALSE;
/**
Calculate the number of Unicode characters of the incoming Configuration string,
not including NULL terminator.
@@ -1223,19 +1226,19 @@ InsertBlockData (
// Insert block data in its Offset and Width order.
//
for (Link = BlockLink->ForwardLink; Link != BlockLink; Link = Link->ForwardLink) {
BlockArray = BASE_CR (Link, IFR_BLOCK_DATA, Entry);
if (BlockArray->Offset == BlockSingleData->Offset) {
- if (BlockArray->Width > BlockSingleData->Width) {
+ if ((BlockArray->Width > BlockSingleData->Width) || (BlockSingleData->IsBitVar && BlockArray->Width == BlockSingleData->Width)) {
//
// Insert this block data in the front of block array
//
InsertTailList (Link, &BlockSingleData->Entry);
return;
}
- if (BlockArray->Width == BlockSingleData->Width) {
+ if ((!BlockSingleData->IsBitVar) && BlockArray->Width == BlockSingleData->Width) {
//
// The same block array has been added.
//
if (BlockSingleData != BlockArray) {
FreePool (BlockSingleData);
@@ -1991,17 +1994,21 @@ IsThisOpcodeRequired (
IN IFR_BLOCK_DATA *RequestBlockArray,
IN EFI_HII_HANDLE HiiHandle,
IN OUT IFR_VARSTORAGE_DATA *VarStorageData,
IN EFI_IFR_OP_HEADER *IfrOpHdr,
IN UINT16 VarWidth,
- OUT IFR_BLOCK_DATA **ReturnData
+ OUT IFR_BLOCK_DATA **ReturnData,
+ IN BOOLEAN IsBitVar
)
{
IFR_BLOCK_DATA *BlockData;
UINT16 VarOffset;
EFI_STRING_ID NameId;
EFI_IFR_QUESTION_HEADER *IfrQuestionHdr;
+ UINT16 BitOffset;
+ UINT16 BitWidth;
+ UINT16 BitVarWidth;
NameId = 0;
VarOffset = 0;
IfrQuestionHdr = (EFI_IFR_QUESTION_HEADER *)((CHAR8 *) IfrOpHdr + sizeof (EFI_IFR_OP_HEADER));
@@ -2016,11 +2023,19 @@ IsThisOpcodeRequired (
// This question is not in the requested string. Skip it.
//
return EFI_NOT_FOUND;
}
} else {
- VarOffset = IfrQuestionHdr->VarStoreInfo.VarOffset;
+ if (IsBitVar) {
+ BitOffset = IfrQuestionHdr->VarStoreInfo.VarOffset;
+ VarOffset = BitOffset / 8;
+ BitVarWidth = VarWidth;
+ BitWidth = BitOffset - (VarOffset * 8) + BitVarWidth;
+ VarWidth = (BitWidth % 8 == 0 ? BitWidth / 8: BitWidth / 8 + 1);
+ } else {
+ VarOffset = IfrQuestionHdr->VarStoreInfo.VarOffset;
+ }
//
// Check whether this question is in requested block array.
//
if (!BlockArrayCheck (RequestBlockArray, VarOffset, VarWidth, FALSE, HiiHandle)) {
@@ -2051,10 +2066,13 @@ IsThisOpcodeRequired (
BlockData->Width = VarWidth;
BlockData->QuestionId = IfrQuestionHdr->QuestionId;
BlockData->OpCode = IfrOpHdr->OpCode;
BlockData->Scope = IfrOpHdr->Scope;
+ BlockData->IsBitVar = IsBitVar;
+ BlockData->BitOffset = IfrQuestionHdr->VarStoreInfo.VarOffset;
+ BlockData->BitWidth = BitVarWidth;
InitializeListHead (&BlockData->DefaultValueEntry);
//
// Add Block Data into VarStorageData BlockEntry
//
InsertBlockData (&VarStorageData->BlockEntry, &BlockData);
@@ -2124,10 +2142,11 @@ ParseIfrData (
EFI_HII_PACKAGE_HEADER *PackageHeader;
EFI_VARSTORE_ID VarStoreId;
UINT16 SmallestDefaultId;
BOOLEAN SmallestIdFromFlag;
BOOLEAN FromOtherDefaultOpcode;
+ BOOLEAN IsBitVar;
Status = EFI_SUCCESS;
BlockData = NULL;
DefaultDataPtr = NULL;
FirstOneOfOption = FALSE;
@@ -2135,10 +2154,11 @@ ParseIfrData (
FirstOrderedList = FALSE;
VarStoreName = NULL;
ZeroMem (&DefaultData, sizeof (IFR_DEFAULT_DATA));
SmallestDefaultId = 0xFFFF;
FromOtherDefaultOpcode = FALSE;
+ IsBitVar = FALSE;
//
// Go through the form package to parse OpCode one by one.
//
PackageOffset = sizeof (EFI_HII_PACKAGE_HEADER);
@@ -2309,11 +2329,11 @@ ParseIfrData (
//
if (BlockData != NULL){
BlockData = NULL;
}
- Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData);
+ Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData, FALSE);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND){
//
//The opcode is not required,exit and parse other opcode.
//
@@ -2341,20 +2361,28 @@ ParseIfrData (
//
IfrOneOf = (EFI_IFR_ONE_OF *) IfrOpHdr;
if (IfrOneOf->Question.VarStoreId != VarStoreId) {
break;
}
- VarWidth = (UINT16) (1 << (IfrOneOf->Flags & EFI_IFR_NUMERIC_SIZE));
+
+ if (mQuestionReferBitVar) {
+ mQuestionReferBitVar = FALSE;
+ VarWidth = IfrOneOf->Flags & 0X0F;
+ IsBitVar = TRUE;
+ } else {
+ VarWidth = (UINT16) (1 << (IfrOneOf->Flags & EFI_IFR_NUMERIC_SIZE));
+ IsBitVar = FALSE;
+ }
//
// The BlockData may allocate by other opcode,need to clean.
//
if (BlockData != NULL){
BlockData = NULL;
}
- Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData);
+ Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData, IsBitVar);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND){
//
//The opcode is not required,exit and parse other opcode.
//
@@ -2439,11 +2467,11 @@ ParseIfrData (
//
if (BlockData != NULL){
BlockData = NULL;
}
- Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData);
+ Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData, FALSE);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND){
//
//The opcode is not required,exit and parse other opcode.
//
@@ -2484,11 +2512,19 @@ ParseIfrData (
//
if (BlockData != NULL){
BlockData = NULL;
}
- Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData);
+ if (mQuestionReferBitVar) {
+ mQuestionReferBitVar = FALSE;
+ VarWidth = 1;
+ IsBitVar = TRUE;
+ } else {
+ IsBitVar = FALSE;
+ }
+
+ Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData, IsBitVar);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND){
//
//The opcode is not required,exit and parse other opcode.
//
@@ -2612,11 +2648,11 @@ ParseIfrData (
if (BlockData != NULL){
BlockData = NULL;
}
VarWidth = (UINT16) sizeof (EFI_HII_DATE);
- Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData);
+ Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData, FALSE);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND){
//
//The opcode is not required,exit and parse other opcode.
//
@@ -2654,11 +2690,11 @@ ParseIfrData (
if (BlockData != NULL){
BlockData = NULL;
}
VarWidth = (UINT16) sizeof (EFI_HII_TIME);
- Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData);
+ Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData, FALSE);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND){
//
//The opcode is not required,exit and parse other opcode.
//
@@ -2696,11 +2732,11 @@ ParseIfrData (
if (BlockData != NULL){
BlockData = NULL;
}
VarWidth = (UINT16) (IfrString->MaxSize * sizeof (UINT16));
- Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData);
+ Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData, FALSE);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND){
//
//The opcode is not required,exit and parse other opcode.
//
@@ -2738,11 +2774,11 @@ ParseIfrData (
if (BlockData != NULL){
BlockData = NULL;
}
VarWidth = (UINT16) (IfrPassword->MaxSize * sizeof (UINT16));
- Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData);
+ Status = IsThisOpcodeRequired(RequestBlockArray, HiiHandle, VarStorageData, IfrOpHdr, VarWidth, &BlockData, FALSE);
if (EFI_ERROR (Status)) {
if (Status == EFI_NOT_FOUND){
//
//The opcode is not required,exit and parse other opcode.
//
@@ -2985,13 +3021,19 @@ ParseIfrData (
//
SmallestDefaultId = 0xFFFF;
FromOtherDefaultOpcode = FALSE;
}
}
+ mQuestionReferBitVar = FALSE;
break;
+ case EFI_IFR_GUID_OP:
+ if (CompareGuid ((EFI_GUID *)((UINT8*)IfrOpHdr + sizeof (EFI_IFR_OP_HEADER)), &mBitVarstoreGuid)) {
+ mQuestionReferBitVar = TRUE;
+ }
+
default:
if (BlockData != NULL) {
if (BlockData->Scope > 0) {
BlockData->Scope = (UINT8) (BlockData->Scope + IfrOpHdr->Scope);
}
@@ -3567,13 +3609,138 @@ GetStorageWidth (
return StorageWidth;
}
/**
+For some question (oneof/numeric/checkbox),their storage may be bit filed,
+their block data may have same OFFSET and WIDTH, this function merge the
+same block data to one.
+
+@param BlockLink The Link of the block data.
+
+**/
+VOID
+UpdateBlockDataArray(
+ IN LIST_ENTRY *BlockLink
+)
+{
+ LIST_ENTRY *Link;
+ LIST_ENTRY *TempLink;
+ LIST_ENTRY *ListEntry;
+ LIST_ENTRY *NextListEntry;
+ LIST_ENTRY *LinkDefault;
+ LIST_ENTRY *NextLinkDefault;
+ IFR_BLOCK_DATA *BlockData;
+ IFR_BLOCK_DATA *NextBlockeData;
+ IFR_DEFAULT_DATA *DefaultValueData;
+ IFR_DEFAULT_DATA *NextDefaultValueData;
+ UINT32 Value;
+ UINT32 Mask;
+ UINT32 PreBits;
+ UINT32 *DefaultValue;
+ UINT8 *BufferValue;
+ BOOLEAN BlockDataChanged;
+ BOOLEAN DefaultIdChanged;
+ BOOLEAN NextBlockChanged;
+
+ Value = 0;
+ Link = BlockLink->ForwardLink;
+ BlockDataChanged = TRUE;
+ DefaultIdChanged = FALSE;
+ NextBlockChanged = FALSE;
+
+ while (Link != BlockLink) {
+ BlockData = BASE_CR (Link, IFR_BLOCK_DATA, Entry);
+ TempLink = Link->ForwardLink;
+ if (!BlockData ->IsBitVar) {
+ Link = Link->ForwardLink;
+ continue;
+ }
+
+ while (TempLink != Link) {
+ NextBlockeData = BASE_CR (TempLink, IFR_BLOCK_DATA, Entry);
+ TempLink = TempLink->ForwardLink;
+ if (BlockData->Offset != NextBlockeData->Offset || BlockData->Width != NextBlockeData->Width) {
+ continue;
+ }
+ //
+ // They are the same blocks, merge them to one, and update the default value.
+ //
+ ListEntry = &BlockData->DefaultValueEntry;
+ for (LinkDefault = ListEntry->ForwardLink; LinkDefault != ListEntry; LinkDefault = LinkDefault->ForwardLink) {
+ DefaultValueData = BASE_CR (LinkDefault, IFR_DEFAULT_DATA, Entry);
+ NextListEntry = &NextBlockeData->DefaultValueEntry;
+ for (NextLinkDefault = NextListEntry->ForwardLink; NextLinkDefault != NextListEntry; NextLinkDefault = NextLinkDefault->ForwardLink) {
+ NextDefaultValueData = BASE_CR (NextLinkDefault, IFR_DEFAULT_DATA, Entry);
+ if (DefaultValueData->DefaultId != NextDefaultValueData->DefaultId) {
+ continue;
+ }
+ //
+ // The default value with same default id.
+ //
+ if (BlockDataChanged) {
+ Mask = (1 << BlockData->BitWidth) - 1;
+ PreBits = BlockData->BitOffset - BlockData->Offset * 8;
+ DefaultValue = (UINT32*)&(DefaultValueData->Value);
+ *DefaultValue <<= PreBits;
+ Mask <<= PreBits;
+ Value = (Value & (~Mask)) | *DefaultValue;
+ BlockDataChanged = FALSE;
+ } else if (!BlockDataChanged && !NextBlockChanged && DefaultIdChanged){
+ Mask = (1 << BlockData->BitWidth) - 1;
+ PreBits = BlockData->BitOffset - BlockData->Offset * 8;
+ DefaultValue = (UINT32*)&(DefaultValueData->Value);
+ *DefaultValue <<= PreBits;
+ Mask <<= PreBits;
+ Value = (Value & (~Mask)) | *DefaultValue;
+ DefaultIdChanged = FALSE;
+ } else if (!BlockDataChanged && NextBlockChanged) {
+ BufferValue = (UINT8*)&(DefaultValueData->Value);
+ Value = (UINTN)(*BufferValue);
+ }
+
+ Mask = (1 << NextBlockeData->BitWidth) - 1;
+ PreBits = NextBlockeData->BitOffset - NextBlockeData->Offset * 8;
+ DefaultValue = (UINT32*) & (NextDefaultValueData->Value);
+ *DefaultValue <<= PreBits;
+ Mask <<= PreBits;
+ Value = (Value & (~Mask)) | *DefaultValue;
+
+ CopyMem (&DefaultValueData->Value, &Value, sizeof (EFI_IFR_TYPE_VALUE));
+ }
+ DefaultIdChanged = TRUE;
+ }
+ RemoveEntryList (&NextBlockeData->Entry);
+ if (NextBlockeData->Name != NULL) {
+ FreePool (NextBlockeData->Name);
+ }
+ //
+ // Free default value link array
+ //
+ while (!IsListEmpty (&NextBlockeData->DefaultValueEntry)) {
+ DefaultValueData = BASE_CR (NextBlockeData->DefaultValueEntry.ForwardLink, IFR_DEFAULT_DATA, Entry);
+ RemoveEntryList (&DefaultValueData->Entry);
+ FreePool (DefaultValueData);
+ }
+ FreePool (NextBlockeData);
+
+ Link->ForwardLink = TempLink;
+ NextBlockChanged = TRUE;
+ }
+
+ Link = Link->ForwardLink;
+ BlockDataChanged = TRUE;
+ NextBlockChanged = FALSE;
+ DefaultIdChanged = FALSE;
+ }
+}
+
+/**
Generate ConfigAltResp string base on the varstore info.
- @param HiiHandle Hii Handle for this hii package.
+ Contributed-under: TianoCore Contribution Agreement 1.0
+Signed-off-by: Dandan Bi <dandan.bi@intel.com> Hii Handle for this hii package.
@param ConfigHdr The config header for this varstore.
@param VarStorageData The varstore info.
@param DefaultIdArray The Default id array.
@param DefaultAltCfgResp The DefaultAltCfgResp info may be return.
@@ -3610,10 +3777,12 @@ GenerateAltConfigResp (
//
// Add length for <ConfigHdr> + '\0'
//
Length = StrLen (ConfigHdr) + 1;
+ UpdateBlockDataArray (&VarStorageData->BlockEntry);
+
for (Link = DefaultIdArray->Entry.ForwardLink; Link != &DefaultIdArray->Entry; Link = Link->ForwardLink) {
DefaultId = BASE_CR (Link, IFR_DEFAULT_DATA, Entry);
//
// Add length for "&<ConfigHdr>&ALTCFG=XXXX"
// |1| StrLen (ConfigHdr) | 8 | 4 |
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index e6760c3..e9962be 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -75,15 +75,18 @@ typedef struct {
typedef struct {
LIST_ENTRY Entry; // Link to Block array
UINT16 Offset;
UINT16 Width;
+ UINT16 BitOffset;
+ UINT16 BitWidth;
EFI_QUESTION_ID QuestionId;
UINT8 OpCode;
UINT8 Scope;
LIST_ENTRY DefaultValueEntry; // Link to its default value array
CHAR16 *Name;
+ BOOLEAN IsBitVar;
} IFR_BLOCK_DATA;
//
// Get default value from IFR data.
//
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFC patch 4/4] MdeModulePkg/DriverSample: Add smaple questions with bit VarStore
2017-04-18 12:46 [RFC patch 0/4] Support Bit fields in EFI Variable Storage Dandan Bi
` (2 preceding siblings ...)
2017-04-18 12:46 ` [RFC patch 3/4] MdeModulePkg/HiiDatabase: " Dandan Bi
@ 2017-04-18 12:46 ` Dandan Bi
3 siblings, 0 replies; 5+ messages in thread
From: Dandan Bi @ 2017-04-18 12:46 UTC (permalink / raw)
To: edk2-devel; +Cc: Eric Dong, Liming Gao
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=Y, Size: 14586 bytes --]
1.Construct the EFI VarStore with: (a) bit fields (b) nested structure(
the nested structure contains bit fields).
2.Construct oneof/numeric/check to refer the bit fields of the
EFI VarStore.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
.../Universal/DriverSampleDxe/DriverSample.c | 56 +++++++++++++++++++
.../Universal/DriverSampleDxe/DriverSample.h | 1 +
.../Universal/DriverSampleDxe/NVDataStruc.h | 19 +++++++
MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr | 65 ++++++++++++++++++++++
.../Universal/DriverSampleDxe/VfrStrings.uni | 12 ++++
5 files changed, 153 insertions(+)
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index f103b9c..b226a65 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -18,10 +18,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define DISPLAY_ONLY_MY_ITEM 0x0002
CHAR16 VariableName[] = L"MyIfrNVData";
CHAR16 MyEfiVar[] = L"MyEfiVar";
+CHAR16 MyBitVar[] = L"MyBitVar";
EFI_HANDLE DriverHandle[2] = {NULL, NULL};
DRIVER_SAMPLE_PRIVATE_DATA *mPrivateData = NULL;
EFI_EVENT mEvent;
HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath0 = {
@@ -662,10 +663,14 @@ ExtractConfig (
// through hii database, not support in this path.
//
if (HiiIsConfigHdrMatch(Request, &gDriverSampleFormSetGuid, MyEfiVar)) {
return EFI_UNSUPPORTED;
}
+ if (HiiIsConfigHdrMatch(Request, &gDriverSampleFormSetGuid, MyBitVar)) {
+ return EFI_UNSUPPORTED;
+ }
+
//
// Set Request to the unified request string.
//
ConfigRequest = Request;
//
@@ -883,10 +888,13 @@ RouteConfig (
// through hii database, not support in this path.
//
if (HiiIsConfigHdrMatch(Configuration, &gDriverSampleFormSetGuid, MyEfiVar)) {
return EFI_UNSUPPORTED;
}
+ if (HiiIsConfigHdrMatch(Configuration, &gDriverSampleFormSetGuid, MyBitVar)) {
+ return EFI_UNSUPPORTED;
+ }
//
// Get Buffer Storage data from EFI variable
//
BufferSize = sizeof (DRIVER_SAMPLE_CONFIGURATION);
@@ -1683,10 +1691,11 @@ DriverSampleInit (
DRIVER_SAMPLE_CONFIGURATION *Configuration;
BOOLEAN ActionFlag;
EFI_STRING ConfigRequestHdr;
EFI_STRING NameRequestHdr;
MY_EFI_VARSTORE_DATA *VarStoreConfig;
+ MY_BITS_VARSTORE_DATA *BitsVarStoreConfig;
EFI_INPUT_KEY HotKey;
EDKII_FORM_BROWSER_EXTENSION_PROTOCOL *FormBrowserEx;
//
// Initialize the local variables.
@@ -1962,10 +1971,57 @@ DriverSampleInit (
return EFI_INVALID_PARAMETER;
}
}
FreePool (ConfigRequestHdr);
+ //
+ // Initialize Bits efi varstore configuration data
+ //
+ BitsVarStoreConfig = &mPrivateData->BitsVarStoreConfig;
+ ZeroMem (BitsVarStoreConfig, sizeof (MY_BITS_VARSTORE_DATA));
+
+ ConfigRequestHdr = HiiConstructConfigHdr (&gDriverSampleFormSetGuid, MyBitVar, DriverHandle[0]);
+ ASSERT (ConfigRequestHdr != NULL);
+
+ BufferSize = sizeof (MY_BITS_VARSTORE_DATA);
+ Status = gRT->GetVariable (MyBitVar, &gDriverSampleFormSetGuid, NULL, &BufferSize, BitsVarStoreConfig);
+ if (EFI_ERROR (Status)) {
+ //
+ // Store zero data to EFI variable Storage.
+ //
+ Status = gRT->SetVariable(
+ MyBitVar,
+ &gDriverSampleFormSetGuid,
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
+ sizeof (MY_BITS_VARSTORE_DATA),
+ BitsVarStoreConfig
+ );
+ if (EFI_ERROR (Status)) {
+ DriverSampleUnload (ImageHandle);
+ return Status;
+ }
+ //
+ // EFI variable for NV config doesn't exit, we should build this variable
+ // based on default values stored in IFR
+ //
+ ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ } else {
+ //
+ // EFI variable does exist and Validate Current Setting
+ //
+ ActionFlag = HiiValidateSettings (ConfigRequestHdr);
+ if (!ActionFlag) {
+ DriverSampleUnload (ImageHandle);
+ return EFI_INVALID_PARAMETER;
+ }
+ }
+ FreePool (ConfigRequestHdr);
+
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
EfiEventEmptyFunction,
NULL,
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
index 6c97239..6947cea 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.h
@@ -82,10 +82,11 @@ typedef struct {
EFI_HANDLE DriverHandle[2];
EFI_HII_HANDLE HiiHandle[2];
DRIVER_SAMPLE_CONFIGURATION Configuration;
MY_EFI_VARSTORE_DATA VarStoreConfig;
+ MY_BITS_VARSTORE_DATA BitsVarStoreConfig;
//
// Name/Value storage Name list
//
EFI_STRING_ID NameStringId[NAME_VALUE_NAME_NUMBER];
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
index 195cc8a..9b74dda 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
+++ b/MdeModulePkg/Universal/DriverSampleDxe/NVDataStruc.h
@@ -29,10 +29,11 @@ Revision History:
#include <Guid/HiiFormMapMethodGuid.h>
#include <Guid/DriverSampleHii.h>
#include <Guid/ZeroGuid.h>
#define CONFIGURATION_VARSTORE_ID 0x1234
+#define BITS_VARSTORE_ID 0x2345
#pragma pack(1)
typedef struct {
UINT16 MyStringData[40];
UINT16 SomethingHiddenForHtml;
@@ -77,10 +78,28 @@ typedef struct {
UINT16 Field16;
UINT8 OrderedList[3];
UINT16 SubmittedCallback;
} MY_EFI_VARSTORE_DATA;
+typedef struct {
+ UINT16 Field16;
+ UINT8 MyBits4 : 1; ///< Bits 0
+ UINT8 MyBits3 : 3; ///< Bits 3:1
+ UINT8 MyBits5 : 3; ///< Bits 6:4
+ UINT16 MyBits6 : 4; ///< Bits 3:0
+ UINT8 Field8;
+} MY_BITS_VARSTORE_DATA1;
+
+typedef struct {
+ UINT16 Field16;
+ MY_BITS_VARSTORE_DATA1 BitsData;
+ UINT8 Field8;
+ UINT16 MyBits7 : 3; ///< Bits 2:0
+ UINT16 MyBits8 : 3; ///< Bits 5:3
+ UINT16 MyBits9 : 1; ///< Bits 6
+} MY_BITS_VARSTORE_DATA;
+
//
// Labels definition
//
#define LABEL_UPDATE1 0x1234
#define LABEL_UPDATE2 0x2234
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
index 4bdaf76..cbc8f6d 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
+++ b/MdeModulePkg/Universal/DriverSampleDxe/Vfr.vfr
@@ -86,10 +86,18 @@ formset
attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
name = MyEfiVar,
guid = DRIVER_SAMPLE_FORMSET_GUID;
//
+ // Define a Buffer Storage (EFI_IFR_VARSTORE)
+ //
+ efivarstore MY_BITS_VARSTORE_DATA, // This is the data structure type
+ attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, // EFI variable attribures
+ name = MyBitVar, // Define referenced name in vfr
+ guid = DRIVER_SAMPLE_FORMSET_GUID; // GUID of this buffer storage
+
+ //
// Define a Name/Value Storage (EFI_IFR_VARSTORE_NAME_VALUE)
//
namevaluevarstore MyNameValueVar, // Define storage reference name in vfr
name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME0), // Define Name list of this storage, refer it by MyNameValueVar[0]
name = STRING_TOKEN(STR_NAME_VALUE_VAR_NAME1), // Define Name list of this storage, refer it by MyNameValueVar[1]
@@ -112,10 +120,67 @@ formset
subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT);
subtitle text = STRING_TOKEN(STR_SUBTITLE_TEXT2);
+ checkbox varid = MyBitVar.BitsData.MyBits4,
+ questionid = 0x6666,
+ prompt = STRING_TOKEN(STR_BIT_NEST_CHECK_BOX_PROMPT),
+ help = STRING_TOKEN(STR_CHECK_BOX_HELP),
+ flags = CHECKBOX_DEFAULT,
+ endcheckbox;
+
+ oneof varid = MyBitVar.BitsData.MyBits3,
+ prompt = STRING_TOKEN(STR_ONE_OF_BIT_NEST_PROMPT),
+ help = STRING_TOKEN(STR_ONE_OF_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0, flags = MANUFACTURING;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 1, flags = DEFAULT;
+ endoneof;
+
+ numeric varid = MyBitVar.BitsData.MyBits5,
+ prompt = STRING_TOKEN(STR_BIT_NEST_NUMERIC_PROMPT),
+ help = STRING_TOKEN(STR_NUMERIC_HELP0),
+ minimum = 0,
+ maximum = 7,
+ step = 0,
+ default = 5, defaultstore = MyStandardDefault, // This is standard default value
+ default = 6, defaultstore = MyManufactureDefault, // This is manufacture default value
+ endnumeric;
+
+ numeric varid = MyBitVar.BitsData.MyBits6,
+ prompt = STRING_TOKEN(STR_BIT_NEST_NUMERIC_PROMPT),
+ help = STRING_TOKEN(STR_NUMERIC_HELP0),
+ minimum = 0,
+ maximum = 15,
+ step = 0,
+ default = 11, defaultstore = MyStandardDefault, // This is standard default value
+ default = 12, defaultstore = MyManufactureDefault, // This is manufacture default value
+ endnumeric;
+
+ checkbox varid = MyBitVar.MyBits9,
+ prompt = STRING_TOKEN(STR_BIT_CHECK_BOX_PROMPT),
+ help = STRING_TOKEN(STR_CHECK_BOX_HELP),
+ flags = CHECKBOX_DEFAULT,
+ endcheckbox;
+
+ oneof varid = MyBitVar.MyBits8,
+ prompt = STRING_TOKEN(STR_ONE_OF_BIT_PROMPT),
+ help = STRING_TOKEN(STR_ONE_OF_HELP),
+ option text = STRING_TOKEN(STR_BOOT_ORDER1), value = 0, flags = MANUFACTURING;
+ option text = STRING_TOKEN(STR_BOOT_ORDER2), value = 1, flags = DEFAULT;
+ endoneof;
+
+ numeric varid = MyBitVar.MyBits7,
+ prompt = STRING_TOKEN(STR_BIT_NUMERIC_PROMPT),
+ help = STRING_TOKEN(STR_NUMERIC_HELP0),
+ minimum = 0,
+ maximum = 7,
+ step = 0,
+ default = 5, defaultstore = MyStandardDefault, // This is standard default value
+ default = 6, defaultstore = MyManufactureDefault, // This is manufacture default value
+ endnumeric;
+
//
// Define a display only text (EFI_IFR_TEXT)
//
text
help = STRING_TOKEN(STR_TEXT_HELP), // Help string
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
index 8d24a47..9a52c02 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
+++ b/MdeModulePkg/Universal/DriverSampleDxe/VfrStrings.uni
@@ -55,10 +55,14 @@
#language fr-FR "Please select the number"
#string STR_NUMERIC_NUM_HELP #language en-US "Check the input number, test the efi buffer varstore"
#language fr-FR "Check the input number, test the efi buffer varstore"
#string STR_ONE_OF_PROMPT #language en-US "My one-of prompt #1"
#language fr-FR "Mi uno- de guía # 1"
+#string STR_ONE_OF_BIT_PROMPT #language en-US "BIT one-of"
+ #language fr-FR "BIT one-of"
+#string STR_ONE_OF_BIT_NEST_PROMPT #language en-US "NEST_BIT one-of"
+ #language fr-FR "NEST_BIT one-of"
#string STR_ONE_OF_PROMPT_KEYWORD #language en-US "My Keyword Namespace Test"
#language fr-FR "My Keyword Namespace Test"
#language x-UEFI-ns "iSCSIBootEnable"
#string STR_CHECK_KEYWORD_SUPPORT #language en-US "Check iSCSI Boot Enable"
#language fr-FR "Check iSCSI Boot Enable"
@@ -78,12 +82,20 @@
#language fr-FR "Mi uno- del texto # 6"
#string STR_BOOT_ORDER1 #language en-US "SmallBootList"
#language fr-FR "Mi uno- del texto # 7"
#string STR_BOOT_ORDER2 #language en-US "LargeBootList"
#language fr-FR "Mi uno- del texto # 8"
+#string STR_BIT_NUMERIC_PROMPT #language en-US "BIT numeric"
+ #language fr-FR "BIT numeric"
+#string STR_BIT_NEST_NUMERIC_PROMPT #language en-US "NEST_BIT numeric"
+ #language fr-FR "NEST_BIT numeric"
#string STR_CHECK_BOX_PROMPT #language en-US "Activate this check box"
#language fr-FR "Active Las Armas Nucleares"
+#string STR_BIT_CHECK_BOX_PROMPT #language en-US "BIT check box"
+ #language fr-FR "BIT check box"
+#string STR_BIT_NEST_CHECK_BOX_PROMPT #language en-US "NEST_BIT check box"
+ #language fr-FR "NEST_BIT check box"
#string STR_CHECK_BOX_HELP #language en-US "This is the help message for the activation of check boxes. This is not to be confused with activating Czech boxes, since one can never tell what the ramifications are of activating foreign controlled boxes are."
#language fr-FR "Éste es el mensaje de la ayuda para la activación del armamento nuclear. Cuál es exactamente resistente calcular fuera sobre de eso?"
#string STR_CHECK_DYNAMIC_PROMPT #language en-US "Activate Dynamic check box"
#language fr-FR "Activate Dynamico check box"
#string STR_CHECK_DYNAMIC_HELP #language en-US "This is the help message for the activation of check boxes. This is not to be confused with activating Czech boxes, since one can never tell what the ramifications are of activating foreign controlled boxes are."
--
1.9.5.msysgit.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-04-18 12:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-18 12:46 [RFC patch 0/4] Support Bit fields in EFI Variable Storage Dandan Bi
2017-04-18 12:46 ` [RFC patch 1/4] BaseTool/VfrCompiler: Support bit " Dandan Bi
2017-04-18 12:46 ` [RFC patch 2/4] MdeModulePkg/SetupBrowser: Handle questions with Bit VarStore Dandan Bi
2017-04-18 12:46 ` [RFC patch 3/4] MdeModulePkg/HiiDatabase: " Dandan Bi
2017-04-18 12:46 ` [RFC patch 4/4] MdeModulePkg/DriverSample: Add smaple questions with bit VarStore Dandan Bi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox