/** @file
The definition of CFormPkg's member function
Copyright (c) 2004 - 2012, 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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "stdio.h"
#include "VfrFormPkg.h"
/*
* The definition of CFormPkg's member function
*/
)
{
}
}
}
}
}
)
{
delete mKey;
}
mLen = 0;
mLineNo = 0;
delete mMsg;
}
}
)
{
}
)
{
}
CHAR8 *
)
{
return mKey;
}
)
{
mPkgLength = 0;
Node = new SBufferNode;
return ;
}
if (BufferStart == NULL) {
return;
}
}
{
while (mBufferNodeQueueHead != NULL) {
delete pBNode->mBufferStart;
delete pBNode;
}
}
while (PendingAssignList != NULL) {
delete pPNode;
}
}
CHAR8 *
)
{
return NULL;
}
} else {
Node = new SBufferNode;
return NULL;
}
delete Node;
return NULL;
} else {
}
if (mBufferNodeQueueTail == NULL) {
} else {
}
//
// Now try again.
//
}
mPkgLength += Len;
return BinBuffer;
}
inline
)
{
return mPkgLength;
}
)
{
mReadBufferOffset = 0;
}
)
{
mReadBufferOffset = 0;
}
)
{
return 0;
}
if (mReadBufferNode == NULL) {
return 0;
}
} else {
return Index;
} else {
mReadBufferOffset = 0;
}
}
}
return Size;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_OUT_FOR_RESOURCES;
}
return VFR_RETURN_SUCCESS;
}
)
{
}
} else {
return VFR_RETURN_SUCCESS;
}
Open ();
}
Close ();
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return Ret;
}
delete PkgHdr;
Open ();
}
Close ();
} else {
}
return VFR_RETURN_SUCCESS;
}
)
{
return;
}
}
}
}
)
{
return;
}
}
}
}
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return Ret;
}
//
// For framework vfr file, the extension framework header will be added.
//
if (VfrCompatibleMode) {
PkgLength = 3;
} else {
}
PkgLength = sizeof (EFI_HII_PACKAGE_HEADER);
Open ();
} else {
}
}
Close ();
} else {
_WRITE_PKG_END (pFile, BYTES_PRE_LINE, " ", PkgData->Buffer + PkgLength, PkgData->Size % BYTES_PRE_LINE);
} else {
}
}
delete PkgHdr;
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_OUT_FOR_RESOURCES;
}
return VFR_RETURN_SUCCESS;
}
)
{
return;
}
}
}
}
bool
)
{
return TRUE;
}
}
return FALSE;
}
)
{
}
}
}
)
{
//
// Declare all questions as Numeric in DisableIf True
//
// DisableIf
//TrueOpcode
// Declare Numeric qeustion for each undefined question.
//
// Register this question, assume it is normal question, not date or time question
//
if (ReturnCode != VFR_RETURN_SUCCESS) {
return ReturnCode;
}
#ifdef VFREXP_DEBUG
#endif
//
// Get Question Info, framework vfr VarName == StructName
//
if (ReturnCode != VFR_RETURN_SUCCESS) {
gCVfrErrorHandle.PrintMsg (pNode->mLineNo, pNode->mKey, "Error", "Var string is not the valid C variable");
return ReturnCode;
}
//
// Get VarStoreType
//
if (ReturnCode == VFR_RETURN_UNDEFINED) {
);
}
if (ReturnCode != VFR_RETURN_SUCCESS) {
return ReturnCode;
}
if (ReturnCode != VFR_RETURN_SUCCESS) {
return ReturnCode;
}
} else {
if (VarStoreType == EFI_VFR_VARSTORE_EFI) {
} else if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
//convert VarStr with store name to VarStr with structure name
if (ReturnCode == VFR_RETURN_SUCCESS) {
NewStr[0] = '\0';
ReturnCode = lCVfrVarDataTypeDB.GetDataFieldInfo (NewStr, Info.mInfo.mVarOffset, Info.mVarType, Info.mVarTotalSize);
delete NewStr;
}
} else {
}
}
if (ReturnCode != VFR_RETURN_SUCCESS) {
return ReturnCode;
}
//
// Numeric doesn't support BOOLEAN data type.
// BOOLEAN type has the same data size to UINT8.
//
}
//
// Use maximum value not to limit the vaild value for the undefined question.
//
case EFI_IFR_TYPE_NUM_SIZE_64:
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
break;
case EFI_IFR_TYPE_NUM_SIZE_8:
break;
default:
break;
}
//
// For undefined Efi VarStore type question
// Append the extended guided opcode to contain VarName
//
}
//
// End for Numeric
//
}
}
//
// End for DisableIf
//
return VFR_RETURN_SUCCESS;
}
)
{
mIfrBinBuf = NULL;
mBinBufLen = 0;
mLineNo = 0xFFFFFFFF;
mOffset = 0xFFFFFFFF;
}
SIfrRecord::~SIfrRecord (
)
{
if (mIfrBinBuf != NULL) {
//delete mIfrBinBuf;
mIfrBinBuf = NULL;
}
mLineNo = 0xFFFFFFFF;
mOffset = 0xFFFFFFFF;
mBinBufLen = 0;
}
)
{
}
)
{
while (mIfrRecordListHead != NULL) {
delete pNode;
}
}
)
{
if (RecordIdx == EFI_IFR_RECORDINFO_IDX_INVALUD) {
return NULL;
}
;
return pNode;
}
)
{
return EFI_IFR_RECORDINFO_IDX_INVALUD;
}
return EFI_IFR_RECORDINFO_IDX_INVALUD;
}
if (mIfrRecordListHead == NULL) {
} else {
}
mRecordCount++;
return mRecordCount;
}
)
{
return;
}
if (LineNo == 0) {
//
// Line number is not specified explicitly, try to use line number of previous opcode
//
}
}
}
)
{
}
return;
}
}
} else {
return;
}
}
}
return;
}
)
{
return;
}
return;
}
TotalSize = 0;
}
}
}
}
if (LineNo == 0) {
}
}
//
// for framework vfr file
// adjust opcode sequence for uefi IFR format
// adjust inconsistent and varstore into the right position.
//
)
{
switch (OpCode) {
case EFI_IFR_CHECKBOX_OP:
case EFI_IFR_NUMERIC_OP:
case EFI_IFR_PASSWORD_OP:
case EFI_IFR_ONE_OF_OP:
case EFI_IFR_ACTION_OP:
case EFI_IFR_STRING_OP:
case EFI_IFR_DATE_OP:
case EFI_IFR_TIME_OP:
case EFI_IFR_ORDERED_LIST_OP:
return TRUE;
default:
return FALSE;
}
}
)
{
switch (OpCode) {
case EFI_IFR_EQ_ID_VAL_OP:
case EFI_IFR_EQ_ID_ID_OP:
case EFI_IFR_QUESTION_REF1_OP:
return TRUE;
default:
return FALSE;
}
}
)
{
return QuestionHead->QuestionId;
}
)
{
//
// Init local variable
//
QuestionScope = 0;
//
// make sure the inconsistent opcode in question scope
//
if (QuestionScope > 0) {
QuestionScope --;
}
}
QuestionScope = 1;
}
//
// for the inconsistent opcode not in question scope, adjust it
//
//
// for inconsistent opcode not in question scope
//
//
// Count inconsistent opcode Scope
//
//
// Calculate Scope Number
//
StackCount --;
}
//
// by IdEqual opcode to get QuestionId
//
if (QuestionId == EFI_QUESTION_ID_INVALID &&
}
}
//
// report error; not found
//
break;
}
//
// extract inconsistent opcode list
// pNode is Incosistent opcode, tNode is End Opcode
//
//
// insert inconsistent opcode list into the right question scope by questionid
//
break;
}
}
//
// insert inconsistent opcode list and check LATE_CHECK flag
//
//
// if LATE_CHECK flag is set, change inconsistent to nosumbit
//
}
//
// skip the default storage for Date and Time
//
}
//
// reset pNode to head list, scan the whole list again.
//
QuestionScope = 0;
continue;
} else {
//
// not found matched question id, report error
//
sprintf (ErrorMsg, "QuestionId required by Inconsistent OpCode is not found. QuestionId is 0x%X", QuestionId);
break;
}
//
// for new added group of varstore opcode
//
break;
}
}
//
// invalid IfrCode, IfrCode end by EndOpCode
//
break;
}
//
// not new added varstore, which are not needed to be adjust.
//
continue;
} else {
//
// move new added varstore opcode to the position befor form opcode
// varstore opcode between pNode and tNode
//
//
// search form opcode from begin
//
break;
}
}
//
// Insert varstore opcode beform form opcode if form opcode is found
//
//
// reset pNode to head list, scan the whole list again.
//
QuestionScope = 0;
continue;
} else {
//
// not found form, continue scan IfrRecord list
//
continue;
}
}
}
//
// next node
//
}
//
// Update Ifr Opcode Offset
//
if (Status == VFR_RETURN_SUCCESS) {
OpcodeOffset = 0;
}
}
return Status;
}
)
{
//
// do nothing
//
if (!mDelayEmit || !gCreateOp) {
return;
}
//
// update data buffer to package data
//
}
//
// update bin buffer to package data buffer
//
if (mObjBinBuf != NULL) {
delete mObjBinBuf;
}
mDelayEmit = FALSE;
}
/*
* The definition of CIfrObj's member function
*/
static struct {
} gOpcodeSizesScopeTable[] = {
{ 0, 0 }, // EFI_IFR_INVALID - 0x00
{ sizeof (EFI_IFR_TEXT), 0 }, // EFI_IFR_TEXT_OP
{ sizeof (EFI_IFR_IMAGE), 0 }, // EFI_IFR_IMAGE_OP
{ sizeof (EFI_IFR_ONE_OF_OPTION), 0 }, // EFI_IFR_ONE_OF_OPTION_OP
{ sizeof (EFI_IFR_LOCKED), 0 }, // EFI_IFR_LOCKED_OP
{ sizeof (EFI_IFR_REF), 0 }, // EFI_IFR_REF_OP
{ sizeof (EFI_IFR_EQ_ID_VAL), 0 }, // EFI_IFR_EQ_ID_VAL_OP
{ sizeof (EFI_IFR_EQ_ID_ID), 0 }, // EFI_IFR_EQ_ID_ID_OP
{ sizeof (EFI_IFR_EQ_ID_VAL_LIST), 0 }, // EFI_IFR_EQ_ID_LIST_OP - 0x14
{ sizeof (EFI_IFR_AND), 0 }, // EFI_IFR_AND_OP
{ sizeof (EFI_IFR_OR), 0 }, // EFI_IFR_OR_OP
{ sizeof (EFI_IFR_NOT), 0 }, // EFI_IFR_NOT_OP
{ sizeof (EFI_IFR_REFRESH), 0 }, // EFI_IFR_REFRESH_OP
{ 0, 0 }, // 0x1F
{ sizeof (EFI_IFR_TO_LOWER), 0 }, // EFI_IFR_TO_LOWER_OP - 0x20
{ sizeof (EFI_IFR_TO_UPPER), 0 }, // EFI_IFR_TO_UPPER_OP - 0x21
{ sizeof (EFI_IFR_VARSTORE), 0 }, // EFI_IFR_VARSTORE_OP
{ sizeof (EFI_IFR_VARSTORE_NAME_VALUE), 0 }, // EFI_IFR_VARSTORE_NAME_VALUE_OP
{ sizeof (EFI_IFR_VARSTORE_EFI), 0 }, // EFI_IFR_VARSTORE_EFI_OP
{ sizeof (EFI_IFR_VERSION), 0 }, // EFI_IFR_VERSION_OP - 0x28
{ sizeof (EFI_IFR_END), 0 }, // EFI_IFR_END_OP
{ sizeof (EFI_IFR_MATCH), 0 }, // EFI_IFR_MATCH_OP - 0x2A
{ sizeof (EFI_IFR_GET), 0 }, // EFI_IFR_GET - 0x2B
{ sizeof (EFI_IFR_SET), 0 }, // EFI_IFR_SET - 0x2C
{ sizeof (EFI_IFR_READ), 0 }, // EFI_IFR_READ - 0x2D
{ sizeof (EFI_IFR_WRITE), 0 }, // EFI_IFR_WRITE - 0x2E
{ sizeof (EFI_IFR_EQUAL), 0 }, // EFI_IFR_EQUAL_OP - 0x2F
{ sizeof (EFI_IFR_NOT_EQUAL), 0 }, // EFI_IFR_NOT_EQUAL_OP
{ sizeof (EFI_IFR_GREATER_THAN), 0 }, // EFI_IFR_GREATER_THAN_OP
{ sizeof (EFI_IFR_GREATER_EQUAL), 0 }, // EFI_IFR_GREATER_EQUAL_OP
{ sizeof (EFI_IFR_LESS_THAN), 0 }, // EFI_IFR_LESS_THAN_OP
{ sizeof (EFI_IFR_LESS_EQUAL), 0 }, // EFI_IFR_LESS_EQUAL_OP - 0x34
{ sizeof (EFI_IFR_BITWISE_AND), 0 }, // EFI_IFR_BITWISE_AND_OP
{ sizeof (EFI_IFR_BITWISE_OR), 0 }, // EFI_IFR_BITWISE_OR_OP
{ sizeof (EFI_IFR_BITWISE_NOT), 0 }, // EFI_IFR_BITWISE_NOT_OP
{ sizeof (EFI_IFR_SHIFT_LEFT), 0 }, // EFI_IFR_SHIFT_LEFT_OP
{ sizeof (EFI_IFR_SHIFT_RIGHT), 0 }, // EFI_IFR_SHIFT_RIGHT_OP
{ sizeof (EFI_IFR_ADD), 0 }, // EFI_IFR_ADD_OP - 0x3A
{ sizeof (EFI_IFR_SUBTRACT), 0 }, // EFI_IFR_SUBTRACT_OP
{ sizeof (EFI_IFR_MULTIPLY), 0 }, // EFI_IFR_MULTIPLY_OP
{ sizeof (EFI_IFR_DIVIDE), 0 }, // EFI_IFR_DIVIDE_OP
{ sizeof (EFI_IFR_MODULO), 0 }, // EFI_IFR_MODULO_OP - 0x3E
{ sizeof (EFI_IFR_RULE_REF), 0 }, // EFI_IFR_RULE_REF_OP
{ sizeof (EFI_IFR_QUESTION_REF1), 0 }, // EFI_IFR_QUESTION_REF1_OP
{ sizeof (EFI_IFR_QUESTION_REF2), 0 }, // EFI_IFR_QUESTION_REF2_OP - 0x41
{ sizeof (EFI_IFR_UINT8), 0}, // EFI_IFR_UINT8
{ sizeof (EFI_IFR_UINT16), 0}, // EFI_IFR_UINT16
{ sizeof (EFI_IFR_UINT32), 0}, // EFI_IFR_UINT32
{ sizeof (EFI_IFR_UINT64), 0}, // EFI_IFR_UTNT64
{ sizeof (EFI_IFR_TRUE), 0 }, // EFI_IFR_TRUE_OP - 0x46
{ sizeof (EFI_IFR_FALSE), 0 }, // EFI_IFR_FALSE_OP
{ sizeof (EFI_IFR_TO_UINT), 0 }, // EFI_IFR_TO_UINT_OP
{ sizeof (EFI_IFR_TO_STRING), 0 }, // EFI_IFR_TO_STRING_OP
{ sizeof (EFI_IFR_TO_BOOLEAN), 0 }, // EFI_IFR_TO_BOOLEAN_OP
{ sizeof (EFI_IFR_MID), 0 }, // EFI_IFR_MID_OP
{ sizeof (EFI_IFR_FIND), 0 }, // EFI_IFR_FIND_OP
{ sizeof (EFI_IFR_TOKEN), 0 }, // EFI_IFR_TOKEN_OP
{ sizeof (EFI_IFR_STRING_REF1), 0 }, // EFI_IFR_STRING_REF1_OP - 0x4E
{ sizeof (EFI_IFR_STRING_REF2), 0 }, // EFI_IFR_STRING_REF2_OP
{ sizeof (EFI_IFR_CONDITIONAL), 0 }, // EFI_IFR_CONDITIONAL_OP
{ sizeof (EFI_IFR_QUESTION_REF3), 0 }, // EFI_IFR_QUESTION_REF3_OP
{ sizeof (EFI_IFR_ZERO), 0 }, // EFI_IFR_ZERO_OP
{ sizeof (EFI_IFR_ONE), 0 }, // EFI_IFR_ONE_OP
{ sizeof (EFI_IFR_ONES), 0 }, // EFI_IFR_ONES_OP
{ sizeof (EFI_IFR_UNDEFINED), 0 }, // EFI_IFR_UNDEFINED_OP
{ sizeof (EFI_IFR_LENGTH), 0 }, // EFI_IFR_LENGTH_OP
{ sizeof (EFI_IFR_DUP), 0 }, // EFI_IFR_DUP_OP - 0x57
{ sizeof (EFI_IFR_THIS), 0 }, // EFI_IFR_THIS_OP
{ sizeof (EFI_IFR_SPAN), 0 }, // EFI_IFR_SPAN_OP
{ sizeof (EFI_IFR_DEFAULT), 0 }, // EFI_IFR_DEFAULT_OP
{ sizeof (EFI_IFR_DEFAULTSTORE), 0 }, // EFI_IFR_DEFAULTSTORE_OP - 0x5C
{ sizeof (EFI_IFR_CATENATE), 0 }, // EFI_IFR_CATENATE_OP
{ sizeof (EFI_IFR_GUID), 0 }, // EFI_IFR_GUID_OP
{ sizeof (EFI_IFR_SECURITY), 0 }, // EFI_IFR_SECURITY_OP - 0x60
{ sizeof (EFI_IFR_MODAL), 0}, // EFI_IFR_MODAL_OP - 0x61
{ sizeof (EFI_IFR_REFRESH_ID), 0}, // EFI_IFR_REFRESH_ID_OP - 0x62
};
#ifdef CIFROBJ_DEUBG
static struct {
} gIfrObjPrintDebugTable[] = {
"EFI_IFR_INVALID", "EFI_IFR_FORM", "EFI_IFR_SUBTITLE", "EFI_IFR_TEXT", "EFI_IFR_IMAGE", "EFI_IFR_ONE_OF",
"EFI_IFR_CHECKBOX", "EFI_IFR_NUMERIC", "EFI_IFR_PASSWORD", "EFI_IFR_ONE_OF_OPTION", "EFI_IFR_SUPPRESS_IF", "EFI_IFR_LOCKED",
"EFI_IFR_ACTION", "EFI_IFR_RESET_BUTTON", "EFI_IFR_FORM_SET", "EFI_IFR_REF", "EFI_IFR_NO_SUBMIT_IF", "EFI_IFR_INCONSISTENT_IF",
"EFI_IFR_EQ_ID_VAL", "EFI_IFR_EQ_ID_ID", "EFI_IFR_EQ_ID_LIST", "EFI_IFR_AND", "EFI_IFR_OR", "EFI_IFR_NOT",
"EFI_IFR_RULE", "EFI_IFR_GRAY_OUT_IF", "EFI_IFR_DATE", "EFI_IFR_TIME", "EFI_IFR_STRING", "EFI_IFR_REFRESH",
"EFI_IFR_DISABLE_IF", "EFI_IFR_INVALID", "EFI_IFR_TO_LOWER", "EFI_IFR_TO_UPPER", "EFI_IFR_MAP", "EFI_IFR_ORDERED_LIST",
"EFI_IFR_VARSTORE", "EFI_IFR_VARSTORE_NAME_VALUE", "EFI_IFR_VARSTORE_EFI", "EFI_IFR_VARSTORE_DEVICE", "EFI_IFR_VERSION", "EFI_IFR_END",
"EFI_IFR_MATCH", "EFI_IFR_GET", "EFI_IFR_SET", "EFI_IFR_READ", "EFI_IFR_WRITE", "EFI_IFR_EQUAL",
"EFI_IFR_NOT_EQUAL", "EFI_IFR_GREATER_THAN", "EFI_IFR_GREATER_EQUAL", "EFI_IFR_LESS_THAN", "EFI_IFR_LESS_EQUAL", "EFI_IFR_BITWISE_AND",
"EFI_IFR_BITWISE_OR", "EFI_IFR_BITWISE_NOT", "EFI_IFR_SHIFT_LEFT", "EFI_IFR_SHIFT_RIGHT", "EFI_IFR_ADD", "EFI_IFR_SUBTRACT",
"EFI_IFR_MULTIPLY", "EFI_IFR_DIVIDE", "EFI_IFR_MODULO", "EFI_IFR_RULE_REF", "EFI_IFR_QUESTION_REF1", "EFI_IFR_QUESTION_REF2",
"EFI_IFR_UINT8", "EFI_IFR_UINT16", "EFI_IFR_UINT32", "EFI_IFR_UINT64", "EFI_IFR_TRUE", "EFI_IFR_FALSE",
"EFI_IFR_TO_UINT", "EFI_IFR_TO_STRING", "EFI_IFR_TO_BOOLEAN", "EFI_IFR_MID", "EFI_IFR_FIND", "EFI_IFR_TOKEN",
"EFI_IFR_STRING_REF1","EFI_IFR_STRING_REF2", "EFI_IFR_CONDITIONAL", "EFI_IFR_QUESTION_REF3", "EFI_IFR_ZERO", "EFI_IFR_ONE",
"EFI_IFR_ONES", "EFI_IFR_UNDEFINED", "EFI_IFR_LENGTH", "EFI_IFR_DUP", "EFI_IFR_THIS", "EFI_IFR_SPAN",
"EFI_IFR_VALUE", "EFI_IFR_DEFAULT", "EFI_IFR_DEFAULTSTORE", "EFI_IFR_FORM_MAP", "EFI_IFR_CATENATE", "EFI_IFR_GUID",
"EFI_IFR_SECURITY", "EFI_IFR_MODAL", "EFI_IFR_REFRESH_ID",
};
)
{
}
#else
#endif
)
{
mObjBinBuf = ((DelayEmit == FALSE) && (gCreateOp == TRUE)) ? gCFormPkg.IfrBinBufferGet (mObjBinLen) : new CHAR8[EFI_IFR_MAX_LENGTH];
mRecordIdx = (gCreateOp == TRUE) ? gCIfrRecordInfoDB.IfrRecordRegister (0xFFFFFFFF, mObjBinBuf, mObjBinLen, mPkgOffset) : EFI_IFR_RECORDINFO_IDX_INVALUD;
*IfrObj = mObjBinBuf;
}
}
)
{
}
}
/*
* The definition of CIfrObj's member function
*/
{
}
)
{
}