Sync BaseTools Branch (version r2149) to EDKII main trunk.
BaseTool Branch: https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/branches/Releases/BaseTools_r2100 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11640 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler main class and main function.
|
||||
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, 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
|
||||
@@ -383,7 +383,7 @@ CVfrCompiler::Usage (
|
||||
CONST CHAR8 *Help[] = {
|
||||
" ",
|
||||
"VfrCompile version " VFR_COMPILER_VERSION VFR_COMPILER_UPDATE_TIME,
|
||||
"Copyright (c) 2004-2010 Intel Corporation. All rights reserved.",
|
||||
"Copyright (c) 2004-2011 Intel Corporation. All rights reserved.",
|
||||
" ",
|
||||
"Usage: VfrCompile [options] VfrFile",
|
||||
" ",
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler internal defintions.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -23,7 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
#define PROGRAM_NAME "VfrCompile"
|
||||
#define VFR_COMPILER_VERSION " 1.95 (UEFI 2.1)"
|
||||
#define VFR_COMPILER_UPDATE_TIME " updated on 2009/05/20"
|
||||
#define VFR_COMPILER_UPDATE_TIME " updated on 2011/02/25"
|
||||
//
|
||||
// This is how we invoke the C preprocessor on the VFR source file
|
||||
// to resolve #defines, #includes, etc. To make C source files
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler error handler.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, 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
|
||||
@@ -34,6 +34,7 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
|
||||
{ VFR_RETURN_VARSTOREID_REDEFINED, ": varstore id already defined" },
|
||||
{ VFR_RETURN_UNDEFINED, ": undefined" },
|
||||
{ VFR_RETURN_VAR_NOTDEFINED_BY_QUESTION, ": some variable has not defined by a question"},
|
||||
{ VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR, ": Data Structure is defined by more than one varstores, it can't be referred as varstore, only varstore name could be used."},
|
||||
{ VFR_RETURN_GET_EFIVARSTORE_ERROR, ": get efi varstore error"},
|
||||
{ VFR_RETURN_EFIVARSTORE_USE_ERROR, ": can not use the efi varstore like this" },
|
||||
{ VFR_RETURN_EFIVARSTORE_SIZE_ERROR, ": unsupport efi varstore size should be <= 8 bytes" },
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler Error definition
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, 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
|
||||
@@ -32,6 +32,7 @@ typedef enum {
|
||||
VFR_RETURN_VARSTOREID_REDEFINED,
|
||||
VFR_RETURN_UNDEFINED,
|
||||
VFR_RETURN_VAR_NOTDEFINED_BY_QUESTION,
|
||||
VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR,
|
||||
VFR_RETURN_GET_EFIVARSTORE_ERROR,
|
||||
VFR_RETURN_EFIVARSTORE_USE_ERROR,
|
||||
VFR_RETURN_EFIVARSTORE_SIZE_ERROR,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
The definition of CFormPkg's member function
|
||||
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, 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
|
||||
@@ -1697,6 +1697,25 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrGuid : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_GUID *mGuid;
|
||||
|
||||
public:
|
||||
CIfrGuid (UINT8 Size) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mGuid, sizeof (EFI_IFR_GUID)+Size),
|
||||
CIfrOpHeader (EFI_IFR_GUID_OP, &mGuid->Header, sizeof (EFI_IFR_GUID)+Size) {
|
||||
memset (&mGuid->Guid, 0, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&mGuid->Guid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) {
|
||||
memcpy ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrDup : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_DUP *mDup;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*++
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, 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
|
||||
@@ -233,6 +233,11 @@ VfrParserStart (
|
||||
#token Refresh("refresh") "refresh"
|
||||
#token Interval("interval") "interval"
|
||||
#token VarstoreDevice("varstoredevice") "varstoredevice"
|
||||
#token GuidOp("guidop") "guidop"
|
||||
#token EndGuidOp("endguidop") "endguidop"
|
||||
#token DataType("datatype") "datatype"
|
||||
#token Data("data") "data"
|
||||
|
||||
//
|
||||
// Define the class and subclass tokens
|
||||
//
|
||||
@@ -559,10 +564,195 @@ vfrFormSetList :
|
||||
vfrStatementVarStoreNameValue |
|
||||
vfrStatementDefaultStore |
|
||||
vfrStatementDisableIfFormSet |
|
||||
vfrStatementSuppressIfFormSet
|
||||
vfrStatementSuppressIfFormSet |
|
||||
vfrStatementExtension
|
||||
)*
|
||||
;
|
||||
|
||||
vfrStatementExtension:
|
||||
<<
|
||||
EFI_GUID Guid;
|
||||
CIfrGuid *GuidObj = NULL;
|
||||
CHAR8 *TypeName = NULL;
|
||||
UINT32 TypeSize = 0;
|
||||
UINT8 *DataBuff = NULL;
|
||||
UINT32 Size = 0;
|
||||
UINT8 Idx = 0;
|
||||
UINT32 LineNum;
|
||||
BOOLEAN IsStruct = FALSE;
|
||||
UINT32 ArrayNum = 0;
|
||||
>>
|
||||
L:GuidOp
|
||||
Uuid "=" guidDefinition[Guid]
|
||||
{"," DataType "="
|
||||
(
|
||||
U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText());>>}
|
||||
<< TypeName = U64->getText(); LineNum = U64->getLine(); >>
|
||||
| U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText());>>}
|
||||
<< TypeName = U32->getText(); LineNum = U32->getLine(); >>
|
||||
| U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText());>>}
|
||||
<< TypeName = U16->getText(); LineNum = U16->getLine(); >>
|
||||
| U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText());>>}
|
||||
<< TypeName = U8->getText(); LineNum = U8->getLine(); >>
|
||||
| BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText());>>}
|
||||
<< TypeName = BL->getText(); LineNum = BL->getLine(); >>
|
||||
| SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText());>>}
|
||||
<< TypeName = SI->getText(); LineNum = SI->getLine(); >>
|
||||
| D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText());>>}
|
||||
<< TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>
|
||||
| T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText());>>}
|
||||
<< TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
|
||||
| TN:StringIdentifier {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}
|
||||
<< TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>
|
||||
)
|
||||
<<
|
||||
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &TypeSize), LineNum);
|
||||
if (ArrayNum > 0) {
|
||||
Size = TypeSize*ArrayNum;
|
||||
} else {
|
||||
Size = TypeSize;
|
||||
}
|
||||
if (Size > (128 - sizeof (EFI_IFR_GUID))) return;
|
||||
DataBuff = (UINT8 *)malloc(Size);
|
||||
for (Idx = 0; Idx < Size; Idx++) {
|
||||
DataBuff[Idx] = 0;
|
||||
}
|
||||
>>
|
||||
vfrExtensionData [DataBuff, Size, TypeName, TypeSize, IsStruct, ArrayNum]
|
||||
}
|
||||
<<
|
||||
{
|
||||
GuidObj = new CIfrGuid(Size);
|
||||
if (GuidObj != NULL) {
|
||||
GuidObj->SetLineNo(L->getLine());
|
||||
GuidObj->SetGuid (&Guid);
|
||||
}
|
||||
}
|
||||
if (TypeName != NULL) {
|
||||
GuidObj->SetData(DataBuff, Size);
|
||||
}
|
||||
>>
|
||||
{","
|
||||
(
|
||||
vfrStatementExtension
|
||||
)*
|
||||
E:EndGuidOp << GuidObj->SetScope(1); CRT_END_OP (E); >>
|
||||
}
|
||||
<<
|
||||
if (GuidObj != NULL) delete GuidObj;
|
||||
if (DataBuff != NULL) free(DataBuff);
|
||||
>>
|
||||
";"
|
||||
;
|
||||
|
||||
vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize, BOOLEAN IsStruct, UINT32 ArrayNum]:
|
||||
<<
|
||||
CHAR8 *TFName = NULL;
|
||||
UINT32 ArrayIdx = 0;
|
||||
UINT16 FieldOffset;
|
||||
UINT8 FieldType;
|
||||
UINT32 FieldSize;
|
||||
UINT64 Data_U64 = 0;
|
||||
UINT32 Data_U32 = 0;
|
||||
UINT16 Data_U16 = 0;
|
||||
UINT8 Data_U8 = 0;
|
||||
BOOLEAN Data_BL = 0;
|
||||
EFI_STRING_ID Data_SID = 0;
|
||||
BOOLEAN IsArray = FALSE;
|
||||
UINT8 *ByteOffset = NULL;
|
||||
>>
|
||||
(
|
||||
("," "data" {OpenBracket IDX1:Number CloseBracket <<IsArray = TRUE;>>}
|
||||
<<
|
||||
ArrayIdx = 0;
|
||||
if (IsArray == TRUE) {
|
||||
ArrayIdx = _STOU8(IDX1->getText());
|
||||
if (ArrayIdx >= ArrayNum) return;
|
||||
IsArray = FALSE;
|
||||
}
|
||||
ByteOffset = DataBuff + (ArrayIdx * TypeSize);
|
||||
if (IsStruct == TRUE) {
|
||||
_STRCAT(&TFName, TypeName);
|
||||
}
|
||||
>>
|
||||
("." FN:StringIdentifier
|
||||
<<
|
||||
if (IsStruct == TRUE) {
|
||||
_STRCAT(&TFName, ".");
|
||||
_STRCAT(&TFName, FN->getText());
|
||||
}
|
||||
>>
|
||||
{
|
||||
OpenBracket IDX2:Number CloseBracket
|
||||
<<
|
||||
if (IsStruct == TRUE) {
|
||||
_STRCAT(&TFName, "[");
|
||||
_STRCAT(&TFName, IDX2->getText());
|
||||
_STRCAT(&TFName, "]");
|
||||
}
|
||||
>>
|
||||
}
|
||||
)*
|
||||
"=" RD:Number
|
||||
<<
|
||||
if (IsStruct == FALSE) {
|
||||
if (strcmp ("UINT64", TypeName) == 0) {
|
||||
Data_U64 = _STOU64(RD->getText());
|
||||
memcpy (ByteOffset, &Data_U64, TypeSize);
|
||||
}else if (strcmp ("UINT32", TypeName) == 0) {
|
||||
Data_U32 = _STOU32(RD->getText());
|
||||
memcpy (ByteOffset, &Data_U32, TypeSize);
|
||||
}else if (strcmp ("UINT16", TypeName) == 0) {
|
||||
Data_U16 = _STOU16(RD->getText());
|
||||
memcpy (ByteOffset, &Data_U16, TypeSize);
|
||||
}else if (strcmp ("UINT8", TypeName) == 0) {
|
||||
Data_U8 = _STOU8(RD->getText());
|
||||
memcpy (ByteOffset, &Data_U8, TypeSize);
|
||||
}else if (strcmp ("BOOLEAN", TypeName)== 0) {
|
||||
Data_BL = _STOU8(RD->getText());
|
||||
memcpy (ByteOffset, &Data_BL, TypeSize);
|
||||
}else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {
|
||||
Data_SID = _STOSID(RD->getText());
|
||||
memcpy (ByteOffset, &Data_SID, TypeSize);
|
||||
}
|
||||
} else {
|
||||
gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset, FieldType, FieldSize);
|
||||
switch (FieldType) {
|
||||
case EFI_IFR_TYPE_NUM_SIZE_8:
|
||||
Data_U8 = _STOU8(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_U8, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_16:
|
||||
Data_U16 = _STOU16(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_U16, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_32:
|
||||
Data_U32 = _STOU32(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_U32, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_64:
|
||||
Data_U64 = _STOU64(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_U64, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_BOOLEAN:
|
||||
Data_BL = _STOU8(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_BL, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_STRING:
|
||||
Data_SID = _STOSID(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_SID, FieldSize);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (TFName != NULL) { delete TFName; TFName = NULL; }
|
||||
>>
|
||||
)*
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
vfrStatementDefaultStore :
|
||||
<< UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>
|
||||
D:DefaultStore N:StringIdentifier ","
|
||||
@@ -1060,7 +1250,8 @@ vfrFormDefinition :
|
||||
vfrStatementLabel |
|
||||
vfrStatementBanner |
|
||||
// Just for framework vfr compatibility
|
||||
vfrStatementInvalid
|
||||
vfrStatementInvalid |
|
||||
vfrStatementExtension
|
||||
)*
|
||||
E:EndForm <<
|
||||
if (mCompatibleMode) {
|
||||
@@ -1118,7 +1309,8 @@ vfrFormMapDefinition :
|
||||
vfrStatementQuestions |
|
||||
vfrStatementConditional |
|
||||
vfrStatementLabel |
|
||||
vfrStatementBanner
|
||||
vfrStatementBanner |
|
||||
vfrStatementExtension
|
||||
)*
|
||||
E:EndForm << CRT_END_OP (E); >>
|
||||
";"
|
||||
@@ -2146,7 +2338,8 @@ vfrStatementQuestionTag :
|
||||
vfrStatementNoSubmitIf |
|
||||
vfrStatementDisableIfQuest |
|
||||
vfrStatementRefresh |
|
||||
vfrStatementVarstoreDevice
|
||||
vfrStatementVarstoreDevice |
|
||||
vfrStatementExtension
|
||||
;
|
||||
|
||||
vfrStatementQuestionTagList :
|
||||
@@ -2175,6 +2368,7 @@ vfrStatementStatList :
|
||||
vfrStatementQuestions |
|
||||
vfrStatementConditionalNew |
|
||||
vfrStatementLabel |
|
||||
vfrStatementExtension |
|
||||
// Just for framework vfr compatibility
|
||||
vfrStatementInvalid
|
||||
;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Vfr common library functions.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, 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
|
||||
@@ -622,6 +622,9 @@ CVfrVarDataTypeDB::ExtractFieldNameAndArrary (
|
||||
if (*VarStr == ']') {
|
||||
VarStr++;
|
||||
}
|
||||
if (*VarStr == '.') {
|
||||
VarStr++;
|
||||
}
|
||||
return VFR_RETURN_SUCCESS;
|
||||
case ']':
|
||||
return VFR_RETURN_DATA_STRING_ERROR;
|
||||
@@ -1456,10 +1459,8 @@ CVfrDataStorage::DeclareNameVarStoreBegin (
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
if (GetVarStoreId (StoreName, &VarStoreId) == VFR_RETURN_SUCCESS) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
|
||||
VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_NAME);
|
||||
@@ -1531,10 +1532,8 @@ CVfrDataStorage::DeclareEfiVarStore (
|
||||
return VFR_RETURN_EFIVARSTORE_SIZE_ERROR;
|
||||
}
|
||||
|
||||
for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
if (GetVarStoreId (StoreName, &VarStoreId) == VFR_RETURN_SUCCESS) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
|
||||
VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_EFI);
|
||||
@@ -1560,11 +1559,16 @@ CVfrDataStorage::DeclareBufferVarStore (
|
||||
{
|
||||
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) == VFR_RETURN_SUCCESS) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
|
||||
CHECK_ERROR_RETURN(DataTypeDB->GetDataType (TypeName, &pDataType), VFR_RETURN_SUCCESS);
|
||||
|
||||
if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
|
||||
@@ -1590,12 +1594,51 @@ CVfrDataStorage::DeclareBufferVarStore (
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetVarStoreByDataType (
|
||||
IN CHAR8 *DataTypeName,
|
||||
OUT SVfrVarStorageNode **VarNode
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
SVfrVarStorageNode *MatchNode;
|
||||
|
||||
//
|
||||
// Framework VFR uses Data type name as varstore name, so don't need check again.
|
||||
//
|
||||
if (VfrCompatibleMode) {
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
}
|
||||
|
||||
MatchNode = NULL;
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mStorageInfo.mDataType->mTypeName, DataTypeName) == 0) {
|
||||
if (MatchNode == NULL) {
|
||||
MatchNode = pNode;
|
||||
} else {
|
||||
//
|
||||
// More than one varstores referred the same data structures.
|
||||
//
|
||||
return VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MatchNode == NULL) {
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
}
|
||||
|
||||
*VarNode = MatchNode;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetVarStoreId (
|
||||
IN CHAR8 *StoreName,
|
||||
OUT EFI_VARSTORE_ID *VarStoreId
|
||||
)
|
||||
{
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
SVfrVarStorageNode *pNode;
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
@@ -1623,8 +1666,18 @@ CVfrDataStorage::GetVarStoreId (
|
||||
}
|
||||
|
||||
mCurrVarStorageNode = NULL;
|
||||
*VarStoreId = EFI_VARSTORE_ID_INVALID;
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
*VarStoreId = EFI_VARSTORE_ID_INVALID;
|
||||
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
if (pNode != NULL) {
|
||||
mCurrVarStorageNode = pNode;
|
||||
*VarStoreId = pNode->mVarStoreId;
|
||||
}
|
||||
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
@@ -1634,6 +1687,7 @@ CVfrDataStorage::GetBufferVarStoreDataTypeName (
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
|
||||
if ((StoreName == NULL) || (DataTypeName == NULL)) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
@@ -1645,8 +1699,16 @@ CVfrDataStorage::GetBufferVarStoreDataTypeName (
|
||||
}
|
||||
}
|
||||
|
||||
ReturnCode = VFR_RETURN_UNDEFINED;
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
if (pNode == NULL) {
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
}
|
||||
|
||||
if (pNode == NULL) {
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
if (pNode->mStorageInfo.mDataType == NULL) {
|
||||
@@ -1664,6 +1726,7 @@ CVfrDataStorage::GetVarStoreType (
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
|
||||
if (StoreName == NULL) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
@@ -1691,7 +1754,16 @@ CVfrDataStorage::GetVarStoreType (
|
||||
}
|
||||
|
||||
VarStoreType = EFI_VFR_VARSTORE_INVALID;
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
if (pNode != NULL) {
|
||||
VarStoreType = pNode->mVarStoreType;
|
||||
}
|
||||
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
EFI_VFR_VARSTORE_TYPE
|
||||
@@ -1841,6 +1913,7 @@ CVfrDataStorage::BufferVarStoreRequestElementAdd (
|
||||
{
|
||||
SVfrVarStorageNode *pNode = NULL;
|
||||
EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue;
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
@@ -1848,8 +1921,16 @@ CVfrDataStorage::BufferVarStoreRequestElementAdd (
|
||||
}
|
||||
}
|
||||
|
||||
ReturnCode = VFR_RETURN_UNDEFINED;
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
if (pNode == NULL) {
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
}
|
||||
|
||||
if (pNode == NULL) {
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
gCVfrBufferConfig.Open ();
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Vfr common library functions.
|
||||
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, 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
|
||||
@@ -307,6 +307,7 @@ public:
|
||||
EFI_VFR_RETURN_CODE GetVarStoreType (IN CHAR8 *, OUT EFI_VFR_VARSTORE_TYPE &);
|
||||
EFI_VFR_VARSTORE_TYPE GetVarStoreType (IN EFI_VARSTORE_ID);
|
||||
EFI_VFR_RETURN_CODE GetVarStoreName (IN EFI_VARSTORE_ID, OUT CHAR8 **);
|
||||
EFI_VFR_RETURN_CODE GetVarStoreByDataType (IN CHAR8 *, OUT SVfrVarStorageNode **);
|
||||
|
||||
EFI_VFR_RETURN_CODE GetBufferVarStoreDataTypeName (IN CHAR8 *, OUT CHAR8 **);
|
||||
EFI_VFR_RETURN_CODE GetEfiVarStoreInfo (IN EFI_VARSTORE_INFO *);
|
||||
|
Reference in New Issue
Block a user