|
From: <lg...@us...> - 2011-03-02 02:16:57
|
Revision: 2124
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2124&view=rev
Author: lgao4
Date: 2011-03-02 02:16:51 +0000 (Wed, 02 Mar 2011)
Log Message:
-----------
Update VfrCompiler to support question VarStorageId defined by DataType and VarStore name both.
Modified Paths:
--------------
trunk/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
trunk/BaseTools/Source/C/VfrCompile/VfrCompiler.h
trunk/BaseTools/Source/C/VfrCompile/VfrError.cpp
trunk/BaseTools/Source/C/VfrCompile/VfrError.h
trunk/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
trunk/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
Modified: trunk/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
===================================================================
--- trunk/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp 2011-02-28 17:04:19 UTC (rev 2123)
+++ trunk/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp 2011-03-02 02:16:51 UTC (rev 2124)
@@ -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 @@
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",
" ",
Modified: trunk/BaseTools/Source/C/VfrCompile/VfrCompiler.h
===================================================================
--- trunk/BaseTools/Source/C/VfrCompile/VfrCompiler.h 2011-02-28 17:04:19 UTC (rev 2123)
+++ trunk/BaseTools/Source/C/VfrCompile/VfrCompiler.h 2011-03-02 02:16:51 UTC (rev 2124)
@@ -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 @@
#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
Modified: trunk/BaseTools/Source/C/VfrCompile/VfrError.cpp
===================================================================
--- trunk/BaseTools/Source/C/VfrCompile/VfrError.cpp 2011-02-28 17:04:19 UTC (rev 2123)
+++ trunk/BaseTools/Source/C/VfrCompile/VfrError.cpp 2011-03-02 02:16:51 UTC (rev 2124)
@@ -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 @@
{ 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" },
Modified: trunk/BaseTools/Source/C/VfrCompile/VfrError.h
===================================================================
--- trunk/BaseTools/Source/C/VfrCompile/VfrError.h 2011-02-28 17:04:19 UTC (rev 2123)
+++ trunk/BaseTools/Source/C/VfrCompile/VfrError.h 2011-03-02 02:16:51 UTC (rev 2124)
@@ -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 @@
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,
Modified: trunk/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
===================================================================
--- trunk/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp 2011-02-28 17:04:19 UTC (rev 2123)
+++ trunk/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp 2011-03-02 02:16:51 UTC (rev 2124)
@@ -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
@@ -1456,10 +1456,8 @@
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 +1529,8 @@
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 +1556,16 @@
{
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) {
@@ -1591,11 +1592,50 @@
}
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 +1663,18 @@
}
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 +1684,7 @@
)
{
SVfrVarStorageNode *pNode;
+ EFI_VFR_RETURN_CODE ReturnCode;
if ((StoreName == NULL) || (DataTypeName == NULL)) {
return VFR_RETURN_FATAL_ERROR;
@@ -1645,10 +1696,18 @@
}
}
+ 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) {
return VFR_RETURN_FATAL_ERROR;
}
@@ -1664,6 +1723,7 @@
)
{
SVfrVarStorageNode *pNode;
+ EFI_VFR_RETURN_CODE ReturnCode;
if (StoreName == NULL) {
return VFR_RETURN_FATAL_ERROR;
@@ -1691,7 +1751,16 @@
}
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 +1910,7 @@
{
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,10 +1918,18 @@
}
}
+ 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 ();
Value.u8 = 0;
if (gCVfrBufferConfig.Write ('a', StoreName, NULL, EFI_IFR_TYPE_NUM_SIZE_8, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value) != 0) {
Modified: trunk/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
===================================================================
--- trunk/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h 2011-02-28 17:04:19 UTC (rev 2123)
+++ trunk/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h 2011-03-02 02:16:51 UTC (rev 2124)
@@ -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 @@
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 *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|