Sync BaseTool trunk (version r2599) into EDKII BaseTools.
Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Heshen Chen <chen.heshen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14591 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
Vfr common library functions.
|
||||
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2013, 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
|
||||
@ -123,11 +123,13 @@ SConfigInfo::~SConfigInfo (
|
||||
|
||||
SConfigItem::SConfigItem (
|
||||
IN CHAR8 *Name,
|
||||
IN EFI_GUID *Guid,
|
||||
IN CHAR8 *Id
|
||||
)
|
||||
{
|
||||
mName = NULL;
|
||||
mId = 0;
|
||||
mGuid = NULL;
|
||||
mId = NULL;
|
||||
mInfoStrList = NULL;
|
||||
mNext = NULL;
|
||||
|
||||
@ -137,6 +139,12 @@ SConfigItem::SConfigItem (
|
||||
}
|
||||
}
|
||||
|
||||
if (Guid != NULL) {
|
||||
if ((mGuid = (EFI_GUID *) new CHAR8[sizeof (EFI_GUID)]) != NULL) {
|
||||
memcpy (mGuid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
}
|
||||
|
||||
if (Id != NULL) {
|
||||
if ((mId = new CHAR8[strlen (Id) + 1]) != NULL) {
|
||||
strcpy (mId, Id);
|
||||
@ -146,6 +154,7 @@ SConfigItem::SConfigItem (
|
||||
|
||||
SConfigItem::SConfigItem (
|
||||
IN CHAR8 *Name,
|
||||
IN EFI_GUID *Guid,
|
||||
IN CHAR8 *Id,
|
||||
IN UINT8 Type,
|
||||
IN UINT16 Offset,
|
||||
@ -154,6 +163,7 @@ SConfigItem::SConfigItem (
|
||||
)
|
||||
{
|
||||
mName = NULL;
|
||||
mGuid = NULL;
|
||||
mId = NULL;
|
||||
mInfoStrList = NULL;
|
||||
mNext = NULL;
|
||||
@ -164,6 +174,12 @@ SConfigItem::SConfigItem (
|
||||
}
|
||||
}
|
||||
|
||||
if (Guid != NULL) {
|
||||
if ((mGuid = (EFI_GUID *) new CHAR8[sizeof (EFI_GUID)]) != NULL) {
|
||||
memcpy (mGuid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
}
|
||||
|
||||
if (Id != NULL) {
|
||||
if ((mId = new CHAR8[strlen (Id) + 1]) != NULL) {
|
||||
strcpy (mId, Id);
|
||||
@ -180,6 +196,7 @@ SConfigItem::~SConfigItem (
|
||||
SConfigInfo *Info;
|
||||
|
||||
BUFFER_SAFE_FREE (mName);
|
||||
BUFFER_SAFE_FREE (mGuid);
|
||||
BUFFER_SAFE_FREE (mId);
|
||||
while (mInfoStrList != NULL) {
|
||||
Info = mInfoStrList;
|
||||
@ -192,18 +209,20 @@ SConfigItem::~SConfigItem (
|
||||
UINT8
|
||||
CVfrBufferConfig::Register (
|
||||
IN CHAR8 *Name,
|
||||
IN EFI_GUID *Guid,
|
||||
IN CHAR8 *Id
|
||||
)
|
||||
{
|
||||
SConfigItem *pNew;
|
||||
|
||||
if (Select (Name) == 0) {
|
||||
if (Select (Name, Guid) == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((pNew = new SConfigItem (Name, Id)) == NULL) {
|
||||
if ((pNew = new SConfigItem (Name, Guid, Id)) == NULL) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (mItemListHead == NULL) {
|
||||
mItemListHead = pNew;
|
||||
mItemListTail = pNew;
|
||||
@ -234,18 +253,19 @@ CVfrBufferConfig::Eof(
|
||||
|
||||
UINT8
|
||||
CVfrBufferConfig::Select (
|
||||
IN CHAR8 *Name,
|
||||
IN CHAR8 *Id
|
||||
IN CHAR8 *Name,
|
||||
IN EFI_GUID *Guid,
|
||||
IN CHAR8 *Id
|
||||
)
|
||||
{
|
||||
SConfigItem *p;
|
||||
|
||||
if (Name == NULL) {
|
||||
if (Name == NULL || Guid == NULL) {
|
||||
mItemListPos = mItemListHead;
|
||||
return 0;
|
||||
} else {
|
||||
for (p = mItemListHead; p != NULL; p = p->mNext) {
|
||||
if (strcmp (p->mName, Name) != 0) {
|
||||
if ((strcmp (p->mName, Name) != 0) || (memcmp (p->mGuid, Guid, sizeof (EFI_GUID)) != 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -269,6 +289,7 @@ UINT8
|
||||
CVfrBufferConfig::Write (
|
||||
IN CONST CHAR8 Mode,
|
||||
IN CHAR8 *Name,
|
||||
IN EFI_GUID *Guid,
|
||||
IN CHAR8 *Id,
|
||||
IN UINT8 Type,
|
||||
IN UINT16 Offset,
|
||||
@ -280,14 +301,14 @@ CVfrBufferConfig::Write (
|
||||
SConfigItem *pItem;
|
||||
SConfigInfo *pInfo;
|
||||
|
||||
if ((Ret = Select (Name)) != 0) {
|
||||
if ((Ret = Select (Name, Guid)) != 0) {
|
||||
return Ret;
|
||||
}
|
||||
|
||||
switch (Mode) {
|
||||
case 'a' : // add
|
||||
if (Select (Name, Id) != 0) {
|
||||
if ((pItem = new SConfigItem (Name, Id, Type, Offset, (UINT16) Width, Value)) == NULL) {
|
||||
if (Select (Name, Guid, Id) != 0) {
|
||||
if ((pItem = new SConfigItem (Name, Guid, Id, Type, Offset, (UINT16) Width, Value)) == NULL) {
|
||||
return 2;
|
||||
}
|
||||
if (mItemListHead == NULL) {
|
||||
@ -302,10 +323,6 @@ CVfrBufferConfig::Write (
|
||||
// tranverse the list to find out if there's already the value for the same offset
|
||||
for (pInfo = mItemListPos->mInfoStrList; pInfo != NULL; pInfo = pInfo->mNext) {
|
||||
if (pInfo->mOffset == Offset) {
|
||||
// check if the value and width are the same; return error if not
|
||||
if ((Id != NULL) && (pInfo->mWidth != Width || memcmp(pInfo->mValue, &Value, Width) != 0)) {
|
||||
return VFR_RETURN_DEFAULT_VALUE_REDEFINED;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -1578,7 +1595,7 @@ CVfrDataStorage::DeclareEfiVarStore (
|
||||
return VFR_RETURN_EFIVARSTORE_SIZE_ERROR;
|
||||
}
|
||||
|
||||
if (GetVarStoreId (StoreName, &VarStoreId) == VFR_RETURN_SUCCESS) {
|
||||
if (GetVarStoreId (StoreName, &VarStoreId, Guid) == VFR_RETURN_SUCCESS) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
|
||||
@ -1611,7 +1628,7 @@ CVfrDataStorage::DeclareBufferVarStore (
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
if (GetVarStoreId (StoreName, &TempVarStoreId) == VFR_RETURN_SUCCESS) {
|
||||
if (GetVarStoreId (StoreName, &TempVarStoreId, Guid) == VFR_RETURN_SUCCESS) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
|
||||
@ -1633,7 +1650,7 @@ CVfrDataStorage::DeclareBufferVarStore (
|
||||
pNew->mNext = mBufferVarStoreList;
|
||||
mBufferVarStoreList = pNew;
|
||||
|
||||
if (gCVfrBufferConfig.Register(StoreName) != 0) {
|
||||
if (gCVfrBufferConfig.Register(StoreName, Guid) != 0) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
@ -1643,7 +1660,8 @@ CVfrDataStorage::DeclareBufferVarStore (
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetVarStoreByDataType (
|
||||
IN CHAR8 *DataTypeName,
|
||||
OUT SVfrVarStorageNode **VarNode
|
||||
OUT SVfrVarStorageNode **VarNode,
|
||||
IN EFI_GUID *VarGuid
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
@ -1658,7 +1676,16 @@ CVfrDataStorage::GetVarStoreByDataType (
|
||||
|
||||
MatchNode = NULL;
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mStorageInfo.mDataType->mTypeName, DataTypeName) == 0) {
|
||||
if (strcmp (pNode->mStorageInfo.mDataType->mTypeName, DataTypeName) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((VarGuid != NULL)) {
|
||||
if (memcmp (VarGuid, &pNode->mGuid, sizeof (EFI_GUID)) == 0) {
|
||||
*VarNode = pNode;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
if (MatchNode == NULL) {
|
||||
MatchNode = pNode;
|
||||
} else {
|
||||
@ -1678,46 +1705,108 @@ CVfrDataStorage::GetVarStoreByDataType (
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VARSTORE_ID
|
||||
CVfrDataStorage::CheckGuidField (
|
||||
IN SVfrVarStorageNode *pNode,
|
||||
IN EFI_GUID *StoreGuid,
|
||||
IN BOOLEAN *HasFoundOne,
|
||||
OUT EFI_VFR_RETURN_CODE *ReturnCode
|
||||
)
|
||||
{
|
||||
if (StoreGuid != NULL) {
|
||||
//
|
||||
// If has guid info, compare the guid filed.
|
||||
//
|
||||
if (memcmp (StoreGuid, &pNode->mGuid, sizeof (EFI_GUID)) == 0) {
|
||||
//
|
||||
// Both name and guid are same, this this varstore.
|
||||
//
|
||||
mCurrVarStorageNode = pNode;
|
||||
*ReturnCode = VFR_RETURN_SUCCESS;
|
||||
return TRUE;
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// Not has Guid field, check whether this name is the only one.
|
||||
//
|
||||
if (*HasFoundOne) {
|
||||
//
|
||||
// The name has conflict, return name redefined.
|
||||
//
|
||||
*ReturnCode = VFR_RETURN_VARSTORE_NAME_REDEFINED_ERROR;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*HasFoundOne = TRUE;
|
||||
mCurrVarStorageNode = pNode;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
Base on the input store name and guid to find the varstore id.
|
||||
|
||||
If both name and guid are inputed, base on the name and guid to
|
||||
found the varstore. If only name inputed, base on the name to
|
||||
found the varstore and go on to check whether more than one varstore
|
||||
has the same name. If only has found one varstore, return this
|
||||
varstore; if more than one varstore has same name, return varstore
|
||||
name redefined error. If no varstore found by varstore name, call
|
||||
function GetVarStoreByDataType and use inputed varstore name as
|
||||
data type name to search.
|
||||
**/
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetVarStoreId (
|
||||
IN CHAR8 *StoreName,
|
||||
OUT EFI_VARSTORE_ID *VarStoreId
|
||||
OUT EFI_VARSTORE_ID *VarStoreId,
|
||||
IN EFI_GUID *StoreGuid
|
||||
)
|
||||
{
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
SVfrVarStorageNode *pNode;
|
||||
BOOLEAN HasFoundOne = FALSE;
|
||||
|
||||
mCurrVarStorageNode = NULL;
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
mCurrVarStorageNode = pNode;
|
||||
*VarStoreId = pNode->mVarStoreId;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
|
||||
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
|
||||
return ReturnCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
mCurrVarStorageNode = pNode;
|
||||
*VarStoreId = pNode->mVarStoreId;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
|
||||
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
|
||||
return ReturnCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
mCurrVarStorageNode = pNode;
|
||||
*VarStoreId = pNode->mVarStoreId;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
if (CheckGuidField(pNode, StoreGuid, &HasFoundOne, &ReturnCode)) {
|
||||
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
|
||||
return ReturnCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mCurrVarStorageNode = NULL;
|
||||
if (HasFoundOne) {
|
||||
*VarStoreId = mCurrVarStorageNode->mVarStoreId;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
*VarStoreId = EFI_VARSTORE_ID_INVALID;
|
||||
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode, StoreGuid);
|
||||
if (pNode != NULL) {
|
||||
mCurrVarStorageNode = pNode;
|
||||
*VarStoreId = pNode->mVarStoreId;
|
||||
@ -1728,88 +1817,24 @@ CVfrDataStorage::GetVarStoreId (
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetBufferVarStoreDataTypeName (
|
||||
IN CHAR8 *StoreName,
|
||||
IN EFI_VARSTORE_ID VarStoreId,
|
||||
OUT CHAR8 **DataTypeName
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
|
||||
if ((StoreName == NULL) || (DataTypeName == NULL)) {
|
||||
if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnCode = VFR_RETURN_UNDEFINED;
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
if (pNode == NULL) {
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
}
|
||||
|
||||
if (pNode == NULL) {
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
if (pNode->mStorageInfo.mDataType == NULL) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
*DataTypeName = pNode->mStorageInfo.mDataType->mTypeName;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetVarStoreType (
|
||||
IN CHAR8 *StoreName,
|
||||
OUT EFI_VFR_VARSTORE_TYPE &VarStoreType
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
|
||||
if (StoreName == NULL) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
VarStoreType = pNode->mVarStoreType;
|
||||
if (pNode->mVarStoreId == VarStoreId) {
|
||||
*DataTypeName = pNode->mStorageInfo.mDataType->mTypeName;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
VarStoreType = pNode->mVarStoreType;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
VarStoreType = pNode->mVarStoreType;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
VarStoreType = EFI_VFR_VARSTORE_INVALID;
|
||||
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
if (pNode != NULL) {
|
||||
VarStoreType = pNode->mVarStoreType;
|
||||
}
|
||||
|
||||
return ReturnCode;
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
}
|
||||
|
||||
EFI_VFR_VARSTORE_TYPE
|
||||
@ -1850,6 +1875,44 @@ CVfrDataStorage::GetVarStoreType (
|
||||
return VarStoreType;
|
||||
}
|
||||
|
||||
EFI_GUID *
|
||||
CVfrDataStorage::GetVarStoreGuid (
|
||||
IN EFI_VARSTORE_ID VarStoreId
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
EFI_GUID *VarGuid;
|
||||
|
||||
VarGuid = NULL;
|
||||
|
||||
if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
|
||||
return VarGuid;
|
||||
}
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (pNode->mVarStoreId == VarStoreId) {
|
||||
VarGuid = &pNode->mGuid;
|
||||
return VarGuid;
|
||||
}
|
||||
}
|
||||
|
||||
for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (pNode->mVarStoreId == VarStoreId) {
|
||||
VarGuid = &pNode->mGuid;
|
||||
return VarGuid;
|
||||
}
|
||||
}
|
||||
|
||||
for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (pNode->mVarStoreId == VarStoreId) {
|
||||
VarGuid = &pNode->mGuid;
|
||||
return VarGuid;
|
||||
}
|
||||
}
|
||||
|
||||
return VarGuid;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetVarStoreName (
|
||||
IN EFI_VARSTORE_ID VarStoreId,
|
||||
@ -1951,44 +2014,6 @@ CVfrDataStorage::GetNameVarStoreInfo (
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::BufferVarStoreRequestElementAdd (
|
||||
IN CHAR8 *StoreName,
|
||||
IN EFI_VARSTORE_INFO &Info
|
||||
)
|
||||
{
|
||||
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) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnCode = VFR_RETURN_UNDEFINED;
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
if (pNode == NULL) {
|
||||
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) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
gCVfrBufferConfig.Close ();
|
||||
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
SVfrDefaultStoreNode::SVfrDefaultStoreNode (
|
||||
IN EFI_IFR_DEFAULTSTORE *ObjBinAddr,
|
||||
IN CHAR8 *RefName,
|
||||
@ -2155,6 +2180,7 @@ CVfrDefaultStore::BufferVarStoreAltConfigAdd (
|
||||
IN EFI_VARSTORE_ID DefaultId,
|
||||
IN EFI_VARSTORE_INFO &Info,
|
||||
IN CHAR8 *VarStoreName,
|
||||
IN EFI_GUID *VarStoreGuid,
|
||||
IN UINT8 Type,
|
||||
IN EFI_IFR_TYPE_VALUE Value
|
||||
)
|
||||
@ -2180,8 +2206,8 @@ CVfrDefaultStore::BufferVarStoreAltConfigAdd (
|
||||
gCVfrBufferConfig.Open ();
|
||||
|
||||
sprintf (NewAltCfg, "%04x", pNode->mDefaultId);
|
||||
if ((Returnvalue = gCVfrBufferConfig.Select(VarStoreName)) == 0) {
|
||||
if ((Returnvalue = gCVfrBufferConfig.Write ('a', VarStoreName, NewAltCfg, Type, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value)) != 0) {
|
||||
if ((Returnvalue = gCVfrBufferConfig.Select(VarStoreName, VarStoreGuid)) == 0) {
|
||||
if ((Returnvalue = gCVfrBufferConfig.Write ('a', VarStoreName, VarStoreGuid, NewAltCfg, Type, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value)) != 0) {
|
||||
goto WriteError;
|
||||
}
|
||||
}
|
||||
@ -2592,26 +2618,46 @@ CVfrQuestionDB::RegisterNewDateQuestion (
|
||||
CHAR8 *VarIdStr[3] = {NULL, };
|
||||
CHAR8 Index;
|
||||
|
||||
if (BaseVarId == NULL) {
|
||||
if (BaseVarId == NULL && Name == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Len = strlen (BaseVarId);
|
||||
if (BaseVarId != NULL) {
|
||||
Len = strlen (BaseVarId);
|
||||
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".Year") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], BaseVarId);
|
||||
strcat (VarIdStr[0], ".Year");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".Month") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], BaseVarId);
|
||||
strcat (VarIdStr[1], ".Month");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".Day") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], BaseVarId);
|
||||
strcat (VarIdStr[2], ".Day");
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".Year") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], BaseVarId);
|
||||
strcat (VarIdStr[0], ".Year");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".Month") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], BaseVarId);
|
||||
strcat (VarIdStr[1], ".Month");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".Day") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], BaseVarId);
|
||||
strcat (VarIdStr[2], ".Day");
|
||||
}
|
||||
} else {
|
||||
Len = strlen (Name);
|
||||
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".Year") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], Name);
|
||||
strcat (VarIdStr[0], ".Year");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".Month") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], Name);
|
||||
strcat (VarIdStr[1], ".Month");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".Day") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], Name);
|
||||
strcat (VarIdStr[2], ".Day");
|
||||
}
|
||||
}
|
||||
|
||||
if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0], DATE_YEAR_BITMASK)) == NULL) {
|
||||
@ -2740,26 +2786,46 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
|
||||
CHAR8 *VarIdStr[3] = {NULL, };
|
||||
CHAR8 Index;
|
||||
|
||||
if (BaseVarId == NULL) {
|
||||
if (BaseVarId == NULL && Name == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Len = strlen (BaseVarId);
|
||||
if (BaseVarId != NULL) {
|
||||
Len = strlen (BaseVarId);
|
||||
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".Hour") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], BaseVarId);
|
||||
strcat (VarIdStr[0], ".Hour");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".Minute") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], BaseVarId);
|
||||
strcat (VarIdStr[1], ".Minute");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".Second") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], BaseVarId);
|
||||
strcat (VarIdStr[2], ".Second");
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".Hour") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], BaseVarId);
|
||||
strcat (VarIdStr[0], ".Hour");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".Minute") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], BaseVarId);
|
||||
strcat (VarIdStr[1], ".Minute");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".Second") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], BaseVarId);
|
||||
strcat (VarIdStr[2], ".Second");
|
||||
}
|
||||
} else {
|
||||
Len = strlen (Name);
|
||||
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".Hour") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], Name);
|
||||
strcat (VarIdStr[0], ".Hour");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".Minute") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], Name);
|
||||
strcat (VarIdStr[1], ".Minute");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".Second") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], Name);
|
||||
strcat (VarIdStr[2], ".Second");
|
||||
}
|
||||
}
|
||||
|
||||
if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0], TIME_HOUR_BITMASK)) == NULL) {
|
||||
@ -2828,31 +2894,56 @@ CVfrQuestionDB::RegisterRefQuestion (
|
||||
CHAR8 *VarIdStr[4] = {NULL, };
|
||||
CHAR8 Index;
|
||||
|
||||
if (BaseVarId == NULL) {
|
||||
if (BaseVarId == NULL && Name == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Len = strlen (BaseVarId);
|
||||
if (BaseVarId != NULL) {
|
||||
Len = strlen (BaseVarId);
|
||||
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".QuestionId") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], BaseVarId);
|
||||
strcat (VarIdStr[0], ".QuestionId");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".FormId") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], BaseVarId);
|
||||
strcat (VarIdStr[1], ".FormId");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".FormSetGuid") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], BaseVarId);
|
||||
strcat (VarIdStr[2], ".FormSetGuid");
|
||||
}
|
||||
VarIdStr[3] = new CHAR8[Len + strlen (".DevicePath") + 1];
|
||||
if (VarIdStr[3] != NULL) {
|
||||
strcpy (VarIdStr[3], BaseVarId);
|
||||
strcat (VarIdStr[3], ".DevicePath");
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".QuestionId") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], BaseVarId);
|
||||
strcat (VarIdStr[0], ".QuestionId");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".FormId") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], BaseVarId);
|
||||
strcat (VarIdStr[1], ".FormId");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".FormSetGuid") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], BaseVarId);
|
||||
strcat (VarIdStr[2], ".FormSetGuid");
|
||||
}
|
||||
VarIdStr[3] = new CHAR8[Len + strlen (".DevicePath") + 1];
|
||||
if (VarIdStr[3] != NULL) {
|
||||
strcpy (VarIdStr[3], BaseVarId);
|
||||
strcat (VarIdStr[3], ".DevicePath");
|
||||
}
|
||||
} else {
|
||||
Len = strlen (Name);
|
||||
|
||||
VarIdStr[0] = new CHAR8[Len + strlen (".QuestionId") + 1];
|
||||
if (VarIdStr[0] != NULL) {
|
||||
strcpy (VarIdStr[0], Name);
|
||||
strcat (VarIdStr[0], ".QuestionId");
|
||||
}
|
||||
VarIdStr[1] = new CHAR8[Len + strlen (".FormId") + 1];
|
||||
if (VarIdStr[1] != NULL) {
|
||||
strcpy (VarIdStr[1], Name);
|
||||
strcat (VarIdStr[1], ".FormId");
|
||||
}
|
||||
VarIdStr[2] = new CHAR8[Len + strlen (".FormSetGuid") + 1];
|
||||
if (VarIdStr[2] != NULL) {
|
||||
strcpy (VarIdStr[2], Name);
|
||||
strcat (VarIdStr[2], ".FormSetGuid");
|
||||
}
|
||||
VarIdStr[3] = new CHAR8[Len + strlen (".DevicePath") + 1];
|
||||
if (VarIdStr[3] != NULL) {
|
||||
strcpy (VarIdStr[3], Name);
|
||||
strcat (VarIdStr[3], ".DevicePath");
|
||||
}
|
||||
}
|
||||
|
||||
if ((pNode[0] = new SVfrQuestionNode (Name, VarIdStr[0])) == NULL) {
|
||||
|
Reference in New Issue
Block a user