summaryrefslogtreecommitdiff
path: root/BaseTools/Source
diff options
context:
space:
mode:
authorGao, Liming <liming.gao@intel.com>2014-07-01 07:10:10 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-01 07:10:10 +0000
commite4ac870fe95adc7d178a79b73ad2792e0c8bfeb8 (patch)
tree7dc08edb8004fdb21d2450a88c1e7957246e8029 /BaseTools/Source
parent148af3872273ef476230db1d0df5ea00167853a1 (diff)
Sync BaseTool trunk (version r2670) into EDKII BaseTools.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gao, Liming <liming.gao@intel.com> Reviewed-by: Liu, Yingke D (yingke.d.liu@intel.com) git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15605 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source')
-rw-r--r--BaseTools/Source/C/Common/FirmwareVolumeBuffer.c170
-rw-r--r--BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h12
-rw-r--r--BaseTools/Source/C/GNUmakefile2
-rw-r--r--BaseTools/Source/C/Include/Common/BuildVersion.h2
-rw-r--r--BaseTools/Source/C/VfrCompile/GNUmakefile8
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrCompiler.cpp2
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrCompiler.h3
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrError.cpp1
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrError.h1
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrFormPkg.h10
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrSyntax.g503
-rw-r--r--BaseTools/Source/C/VolInfo/VolInfo.c93
-rw-r--r--BaseTools/Source/Python/Common/BuildVersion.py2
-rw-r--r--BaseTools/Source/Python/Common/Parsing.py37
-rw-r--r--BaseTools/Source/Python/Ecc/Configuration.py5
-rw-r--r--BaseTools/Source/Python/Ecc/Ecc.py142
-rw-r--r--BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py4
-rw-r--r--BaseTools/Source/Python/Ecc/config.ini4
-rw-r--r--BaseTools/Source/Python/GenFds/GenFds.py13
-rw-r--r--BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py4
-rw-r--r--BaseTools/Source/Python/UPT/BuildVersion.py2
-rw-r--r--BaseTools/Source/Python/UPT/Library/String.py28
-rw-r--r--BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py15
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py11
24 files changed, 699 insertions, 375 deletions
diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
index 92060e2ca..fa6ca6bd6 100644
--- a/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
+++ b/BaseTools/Source/C/Common/FirmwareVolumeBuffer.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2014, 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,37 @@ Abstract:
) \
)
+STATIC
+UINT32
+FvBufGetSecHdrLen(
+ IN EFI_COMMON_SECTION_HEADER *SectionHeader
+ )
+{
+ if (SectionHeader == NULL) {
+ return 0;
+ }
+ if (FvBufExpand3ByteSize(SectionHeader->Size) == 0xffffff) {
+ return sizeof(EFI_COMMON_SECTION_HEADER2);
+ }
+ return sizeof(EFI_COMMON_SECTION_HEADER);
+}
+
+STATIC
+UINT32
+FvBufGetSecFileLen (
+ IN EFI_COMMON_SECTION_HEADER *SectionHeader
+ )
+{
+ UINT32 Length;
+ if (SectionHeader == NULL) {
+ return 0;
+ }
+ Length = FvBufExpand3ByteSize(SectionHeader->Size);
+ if (Length == 0xffffff) {
+ Length = ((EFI_COMMON_SECTION_HEADER2 *)SectionHeader)->ExtendedSize;
+ }
+ return Length;
+}
//
// Local prototypes
@@ -92,7 +123,7 @@ Returns:
return Status;
}
- FileToRmLength = FvBufExpand3ByteSize (FileToRm->Size);
+ FileToRmLength = FvBufGetFfsFileSize (FileToRm);
CommonLibBinderSetMem (
FileToRm,
@@ -218,7 +249,7 @@ Returns:
EFI_FFS_FILE_STATE StateBackup;
UINT32 FileSize;
- FileSize = FvBufExpand3ByteSize (File->Size);
+ FileSize = FvBufGetFfsFileSize (File);
//
// Fill in checksums and state, they must be 0 for checksumming.
@@ -231,13 +262,13 @@ Returns:
File->IntegrityCheck.Checksum.Header =
FvBufCalculateChecksum8 (
(UINT8 *) File,
- sizeof (EFI_FFS_FILE_HEADER)
+ FvBufGetFfsHeaderSize (File)
);
if (File->Attributes & FFS_ATTRIB_CHECKSUM) {
File->IntegrityCheck.Checksum.File = FvBufCalculateChecksum8 (
- (VOID*)(File + 1),
- FileSize - sizeof (EFI_FFS_FILE_HEADER)
+ (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File)),
+ FileSize - FvBufGetFfsHeaderSize (File)
);
} else {
File->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
@@ -568,7 +599,7 @@ Returns:
}
FvbAttributes = hdr->Attributes;
- newSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size);
+ newSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
for(
offset = (UINTN)ALIGN_POINTER (hdr->HeaderLength, 8);
@@ -587,7 +618,7 @@ Returns:
// BUGBUG: Need to make sure that the new file does not already
// exist.
- fsize = FvBufExpand3ByteSize (fhdr->Size);
+ fsize = FvBufGetFfsFileSize (fhdr);
if (fsize == 0 || (offset + fsize > fvSize)) {
return EFI_VOLUME_CORRUPTED;
}
@@ -725,7 +756,7 @@ Returns:
}
erasedUint8 = (UINT8)((hdr->Attributes & EFI_FVB2_ERASE_POLARITY) ? 0xFF : 0);
- NewFileSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size);
+ NewFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
if (NewFileSize != (UINTN)ALIGN_POINTER (NewFileSize, 8)) {
return EFI_INVALID_PARAMETER;
@@ -739,7 +770,7 @@ Returns:
LastFileSize = 0;
do {
Status = FvBufFindNextFile (Fv, &Key, (VOID **)&LastFile);
- LastFileSize = FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)File)->Size);
+ LastFileSize = FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)File);
} while (!EFI_ERROR (Status));
//
@@ -812,6 +843,64 @@ Returns:
}
UINT32
+FvBufGetFfsFileSize (
+ IN EFI_FFS_FILE_HEADER *Ffs
+ )
+/*++
+
+Routine Description:
+
+ Get the FFS file size.
+
+Arguments:
+
+ Ffs - Pointer to FFS header
+
+Returns:
+
+ UINT32
+
+--*/
+{
+ if (Ffs == NULL) {
+ return 0;
+ }
+ if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
+ return ((EFI_FFS_FILE_HEADER2 *)Ffs)->ExtendedSize;
+ }
+ return FvBufExpand3ByteSize(Ffs->Size);
+}
+
+UINT32
+FvBufGetFfsHeaderSize (
+ IN EFI_FFS_FILE_HEADER *Ffs
+ )
+/*++
+
+Routine Description:
+
+ Get the FFS header size.
+
+Arguments:
+
+ Ffs - Pointer to FFS header
+
+Returns:
+
+ UINT32
+
+--*/
+{
+ if (Ffs == NULL) {
+ return 0;
+ }
+ if (Ffs->Attributes & FFS_ATTRIB_LARGE_FILE) {
+ return sizeof(EFI_FFS_FILE_HEADER2);
+ }
+ return sizeof(EFI_FFS_FILE_HEADER);
+}
+
+UINT32
FvBufExpand3ByteSize (
IN VOID* Size
)
@@ -897,7 +986,7 @@ Returns:
) {
fhdr = (EFI_FFS_FILE_HEADER*) ((UINT8*)hdr + *Key);
- fsize = FvBufExpand3ByteSize (fhdr->Size);
+ fsize = FvBufGetFfsFileSize (fhdr);
if (!EFI_TEST_FFS_ATTRIBUTES_BIT(
FvbAttributes,
@@ -1089,8 +1178,8 @@ Returns:
//
// Raw filetypes don't have sections, so we just return the raw data
//
- *RawData = (VOID*)(File + 1);
- *RawDataSize = FvBufExpand3ByteSize (File->Size) - sizeof (*File);
+ *RawData = (VOID*)((UINT8 *)File + FvBufGetFfsHeaderSize (File));
+ *RawDataSize = FvBufGetFfsFileSize (File) - FvBufGetFfsHeaderSize (File);
return EFI_SUCCESS;
}
@@ -1102,9 +1191,9 @@ Returns:
return Status;
}
- *RawData = (VOID*)(Section + 1);
+ *RawData = (VOID*)((UINT8 *)Section + FvBufGetSecHdrLen(Section));
*RawDataSize =
- FvBufExpand3ByteSize (Section->Size) - sizeof (*Section);
+ FvBufGetSecFileLen (Section) - FvBufGetSecHdrLen(Section);
return EFI_SUCCESS;
@@ -1144,16 +1233,28 @@ Returns:
UINT32 NewFileSize;
EFI_RAW_SECTION* NewSection;
UINT32 NewSectionSize;
+ UINT32 FfsHdrLen;
+ UINT32 SecHdrLen;
//
// The section size is the DataSize + the size of the section header
//
NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION) + (UINT32)RawDataSize;
+ SecHdrLen = sizeof (EFI_RAW_SECTION);
+ if (NewSectionSize >= MAX_SECTION_SIZE) {
+ NewSectionSize = (UINT32)sizeof (EFI_RAW_SECTION2) + (UINT32)RawDataSize;
+ SecHdrLen = sizeof (EFI_RAW_SECTION2);
+ }
//
// The file size is the size of the file header + the section size
//
NewFileSize = sizeof (EFI_FFS_FILE_HEADER) + NewSectionSize;
+ FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER);
+ if (NewFileSize >= MAX_FFS_SIZE) {
+ NewFileSize = sizeof (EFI_FFS_FILE_HEADER2) + NewSectionSize;
+ FfsHdrLen = sizeof (EFI_FFS_FILE_HEADER2);
+ }
//
// Try to allocate a buffer to build the new FFS file in
@@ -1167,24 +1268,35 @@ Returns:
//
// The NewSection follow right after the FFS file header
//
- NewSection = (EFI_RAW_SECTION*)(NewFile + 1);
- FvBufCompact3ByteSize (NewSection->Size, NewSectionSize);
+ NewSection = (EFI_RAW_SECTION*)((UINT8*)NewFile + FfsHdrLen);
+ if (NewSectionSize >= MAX_SECTION_SIZE) {
+ FvBufCompact3ByteSize (NewSection->Size, 0xffffff);
+ ((EFI_RAW_SECTION2 *)NewSection)->ExtendedSize = NewSectionSize;
+ } else {
+ FvBufCompact3ByteSize (NewSection->Size, NewSectionSize);
+ }
NewSection->Type = EFI_SECTION_RAW;
//
// Copy the actual file data into the buffer
//
- CommonLibBinderCopyMem (NewSection + 1, RawData, RawDataSize);
+ CommonLibBinderCopyMem ((UINT8 *)NewSection + SecHdrLen, RawData, RawDataSize);
//
// Initialize the FFS file header
//
CommonLibBinderCopyMem (&NewFile->Name, Filename, sizeof (EFI_GUID));
- FvBufCompact3ByteSize (NewFile->Size, NewFileSize);
- NewFile->Type = EFI_FV_FILETYPE_FREEFORM;
NewFile->Attributes = 0;
+ if (NewFileSize >= MAX_FFS_SIZE) {
+ FvBufCompact3ByteSize (NewFile->Size, 0x0);
+ ((EFI_FFS_FILE_HEADER2 *)NewFile)->ExtendedSize = NewFileSize;
+ NewFile->Attributes |= FFS_ATTRIB_LARGE_FILE;
+ } else {
+ FvBufCompact3ByteSize (NewFile->Size, NewFileSize);
+ }
+ NewFile->Type = EFI_FV_FILETYPE_FREEFORM;
NewFile->IntegrityCheck.Checksum.Header =
- FvBufCalculateChecksum8 ((UINT8*)NewFile, sizeof (*NewFile));
+ FvBufCalculateChecksum8 ((UINT8*)NewFile, FfsHdrLen);
NewFile->IntegrityCheck.Checksum.File = FFS_FIXED_CHECKSUM;
NewFile->State = (UINT8)~( EFI_FILE_HEADER_CONSTRUCTION |
EFI_FILE_HEADER_VALID |
@@ -1239,7 +1351,7 @@ Returns:
}
sectionHdr = (EFI_COMMON_SECTION_HEADER*)((UINT8*)SectionsStart + *Key);
- sectionSize = FvBufExpand3ByteSize (sectionHdr->Size);
+ sectionSize = FvBufGetSecFileLen (sectionHdr);
if (sectionSize < sizeof (EFI_COMMON_SECTION_HEADER)) {
return EFI_NOT_FOUND;
@@ -1287,10 +1399,10 @@ Returns:
UINTN TotalSectionsSize;
EFI_COMMON_SECTION_HEADER* NextSection;
- SectionStart = (VOID*)((UINTN)FfsFile + sizeof (EFI_FFS_FILE_HEADER));
+ SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
TotalSectionsSize =
- FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)FfsFile)->Size) -
- sizeof (EFI_FFS_FILE_HEADER);
+ FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
+ FvBufGetFfsHeaderSize(FfsFile);
Key = 0;
*Count = 0;
while (TRUE) {
@@ -1352,10 +1464,10 @@ Returns:
UINTN TotalSectionsSize;
EFI_COMMON_SECTION_HEADER* NextSection;
- SectionStart = (VOID*)((UINTN)FfsFile + sizeof (EFI_FFS_FILE_HEADER));
+ SectionStart = (VOID*)((UINTN)FfsFile + FvBufGetFfsHeaderSize(FfsFile));
TotalSectionsSize =
- FvBufExpand3ByteSize (((EFI_FFS_FILE_HEADER*)FfsFile)->Size) -
- sizeof (EFI_FFS_FILE_HEADER);
+ FvBufGetFfsFileSize ((EFI_FFS_FILE_HEADER*)FfsFile) -
+ FvBufGetFfsHeaderSize(FfsFile);
Key = 0;
while (TRUE) {
Status = FvBufFindNextSection (
@@ -1436,7 +1548,7 @@ Returns:
EndOfLastFile = (UINT8*)FvHdr + FvHdr->FvLength;
while (!EFI_ERROR (FvBufFindNextFile (Fv, &Key, (VOID **)&FileIt))) {
EndOfLastFile =
- (VOID*)((UINT8*)FileIt + FvBufExpand3ByteSize (FileIt->Size));
+ (VOID*)((UINT8*)FileIt + FvBufGetFfsFileSize (FileIt));
}
//
diff --git a/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h b/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h
index 12c64f617..49b380b96 100644
--- a/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h
+++ b/BaseTools/Source/C/Common/FirmwareVolumeBufferLib.h
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 1999 - 2008, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2014, 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
@@ -82,6 +82,16 @@ FvBufExpand3ByteSize (
IN VOID* Size
);
+UINT32
+FvBufGetFfsFileSize (
+ IN EFI_FFS_FILE_HEADER *Ffs
+ );
+
+UINT32
+FvBufGetFfsHeaderSize (
+ IN EFI_FFS_FILE_HEADER *Ffs
+ );
+
EFI_STATUS
FvBufExtend (
IN VOID **Fv,
diff --git a/BaseTools/Source/C/GNUmakefile b/BaseTools/Source/C/GNUmakefile
index 124517b6c..6aa37e49f 100644
--- a/BaseTools/Source/C/GNUmakefile
+++ b/BaseTools/Source/C/GNUmakefile
@@ -19,7 +19,7 @@ ifndef ARCH
#
uname_m = $(shell uname -m)
$(info Attempting to detect ARCH from 'uname -m': $(uname_m))
- ifeq ($(uname_m),x86_64)
+ ifneq (,$(strip $(filter $(uname_m), x86_64 amd64)))
ARCH=X64
endif
ifeq ($(patsubst i%86,IA32,$(uname_m)),IA32)
diff --git a/BaseTools/Source/C/Include/Common/BuildVersion.h b/BaseTools/Source/C/Include/Common/BuildVersion.h
index d3ad7c265..fb1960947 100644
--- a/BaseTools/Source/C/Include/Common/BuildVersion.h
+++ b/BaseTools/Source/C/Include/Common/BuildVersion.h
@@ -14,4 +14,4 @@
**/
-#define __BUILD_VERSION "Build 2649"
+#define __BUILD_VERSION "Build 2670"
diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile
index 82005e11f..e446d1462 100644
--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
+++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
@@ -53,10 +53,10 @@ VfrLexer.cpp VfrLexer.h: Pccts/dlg/dlg VfrParser.dlg
Pccts/dlg/dlg -C2 -i -CC -cl VfrLexer -o . VfrParser.dlg
Pccts/antlr/antlr:
- BIN_DIR='.' make -C Pccts/antlr
+ BIN_DIR='.' $(MAKE) -C Pccts/antlr
Pccts/dlg/dlg:
- BIN_DIR='.' make -C Pccts/dlg
+ BIN_DIR='.' $(MAKE) -C Pccts/dlg
ATokenBuffer.o: Pccts/h/ATokenBuffer.cpp
$(CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
@@ -73,7 +73,7 @@ VfrSyntax.o: VfrSyntax.cpp
clean: localClean
localClean:
- BIN_DIR='.' make -C Pccts/antlr clean
- BIN_DIR='.' make -C Pccts/dlg clean
+ BIN_DIR='.' $(MAKE) -C Pccts/antlr clean
+ BIN_DIR='.' $(MAKE) -C Pccts/dlg clean
rm -f $(EXTRA_CLEAN_OBJECTS)
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
index dd34a1b53..ee10605ed 100644
--- a/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.cpp
@@ -372,6 +372,8 @@ CVfrCompiler::CVfrCompiler (
mPreProcessCmd = (CHAR8 *) PREPROCESSOR_COMMAND;
mPreProcessOpt = (CHAR8 *) PREPROCESSOR_OPTIONS;
+ SET_RUN_STATUS (STATUS_STARTED);
+
OptionInitialization(Argc, Argv);
if ((IS_RUN_STATUS(STATUS_FAILED)) || (IS_RUN_STATUS(STATUS_DEAD))) {
diff --git a/BaseTools/Source/C/VfrCompile/VfrCompiler.h b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
index ea20bbc5d..3261e9ccd 100644
--- a/BaseTools/Source/C/VfrCompile/VfrCompiler.h
+++ b/BaseTools/Source/C/VfrCompile/VfrCompiler.h
@@ -60,7 +60,8 @@ typedef struct {
} OPTIONS;
typedef enum {
- STATUS_INITIALIZED = 1,
+ STATUS_STARTED = 0,
+ STATUS_INITIALIZED,
STATUS_PREPROCESSED,
STATUS_COMPILEED,
STATUS_GENBINARY,
diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Source/C/VfrCompile/VfrError.cpp
index 71305364f..ffed732a4 100644
--- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
@@ -51,6 +51,7 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
static SVFR_WARNING_HANDLE VFR_WARNING_HANDLE_TABLE [] = {
{ VFR_WARNING_DEFAULT_VALUE_REDEFINED, ": default value re-defined with different value"},
+ { VFR_WARNING_STRING_TO_UINT_OVERFLOW, ": String to UINT* Overflow"},
{ VFR_WARNING_CODEUNDEFINED, ": undefined Warning Code" }
};
diff --git a/BaseTools/Source/C/VfrCompile/VfrError.h b/BaseTools/Source/C/VfrCompile/VfrError.h
index 8e73e2e99..622cba6cb 100644
--- a/BaseTools/Source/C/VfrCompile/VfrError.h
+++ b/BaseTools/Source/C/VfrCompile/VfrError.h
@@ -49,6 +49,7 @@ typedef enum {
typedef enum {
VFR_WARNING_DEFAULT_VALUE_REDEFINED = 0,
+ VFR_WARNING_STRING_TO_UINT_OVERFLOW,
VFR_WARNING_CODEUNDEFINED
} EFI_VFR_WARNING_CODE;
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
index c69518af7..17471e628 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
@@ -2,7 +2,7 @@
The definition of CFormPkg's member function
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -1343,7 +1343,7 @@ public:
UpdateCIfrMinMaxStepData(&mNumeric->data);
}
- EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
+ EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags, BOOLEAN DisplaySettingsSpecified = FALSE) {
EFI_VFR_RETURN_CODE Ret;
Ret = CIfrQuestionHeader::SetFlags (HFlags);
@@ -1351,10 +1351,10 @@ public:
return Ret;
}
- if (LFlags & EFI_IFR_DISPLAY) {
- mNumeric->Flags = LFlags;
- } else {
+ if (DisplaySettingsSpecified == FALSE) {
mNumeric->Flags = LFlags | EFI_IFR_DISPLAY_UINT_DEC;
+ } else {
+ mNumeric->Flags = LFlags;
}
return VFR_RETURN_SUCCESS;
}
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index 6f15aaa45..a38f770e3 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -1,5 +1,5 @@
/*++
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, 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
@@ -295,7 +295,7 @@ pragmaPackStackDef :
"," ID:StringIdentifier << Identifier = ID->getText(); >>
}
{
- "," N:Number << PackAction |= VFR_PACK_ASSIGN; PackNumber = _STOU32(N->getText()); >>
+ "," N:Number << PackAction |= VFR_PACK_ASSIGN; PackNumber = _STOU32(N->getText(), N->getLine()); >>
}
<< gCVfrVarDataTypeDB.Pack (LineNum, PackAction, Identifier, PackNumber); >>
;
@@ -305,7 +305,7 @@ pragmaPackNumber :
UINT32 LineNum;
UINT32 PackNumber = DEFAULT_PACK_ALIGN;
>>
- N:Number << LineNum = N->getLine(); PackNumber = _STOU32(N->getText()); >>
+ N:Number << LineNum = N->getLine(); PackNumber = _STOU32(N->getText(), N->getLine()); >>
<< gCVfrVarDataTypeDB.Pack (LineNum, VFR_PACK_ASSIGN, NULL, PackNumber); >>
;
@@ -354,7 +354,7 @@ dataStructField64 :
D:"UINT64"
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
@@ -364,7 +364,7 @@ dataStructField32 :
D:"UINT32"
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
@@ -376,7 +376,7 @@ dataStructField16 :
("UINT16" | "CHAR16")
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), (CHAR8 *) "UINT16", ArrayNum), N); >>
;
@@ -386,7 +386,7 @@ dataStructField8 :
D:"UINT8"
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
@@ -396,7 +396,7 @@ dataStructFieldBool :
D:"BOOLEAN"
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
@@ -406,7 +406,7 @@ dataStructFieldString :
D:"EFI_STRING_ID"
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
@@ -416,7 +416,7 @@ dataStructFieldDate :
D:"EFI_HII_DATE"
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
@@ -426,7 +426,7 @@ dataStructFieldTime :
D:"EFI_HII_TIME"
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
@@ -436,7 +436,7 @@ dataStructFieldRef :
D:"EFI_HII_REF"
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
;
@@ -446,7 +446,7 @@ dataStructFieldUser :
T:StringIdentifier
N:StringIdentifier
{
- OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
+ OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText(), I->getLine()); >>
}
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), T->getText(), ArrayNum), T); >>
;
@@ -458,14 +458,14 @@ dataStructFieldUser :
guidSubDefinition [EFI_GUID &Guid] :
G4:Number "," G5:Number "," G6:Number "," G7:Number "," G8:Number "," G9:Number "," G10:Number "," G11:Number
<<
- Guid.Data4[0] = _STOU8(G4->getText());
- Guid.Data4[1] = _STOU8(G5->getText());
- Guid.Data4[2] = _STOU8(G6->getText());
- Guid.Data4[3] = _STOU8(G7->getText());
- Guid.Data4[4] = _STOU8(G8->getText());
- Guid.Data4[5] = _STOU8(G9->getText());
- Guid.Data4[6] = _STOU8(G10->getText());
- Guid.Data4[7] = _STOU8(G11->getText());
+ Guid.Data4[0] = _STOU8(G4->getText(), G4->getLine());
+ Guid.Data4[1] = _STOU8(G5->getText(), G5->getLine());
+ Guid.Data4[2] = _STOU8(G6->getText(), G6->getLine());
+ Guid.Data4[3] = _STOU8(G7->getText(), G7->getLine());
+ Guid.Data4[4] = _STOU8(G8->getText(), G8->getLine());
+ Guid.Data4[5] = _STOU8(G9->getText(), G9->getLine());
+ Guid.Data4[6] = _STOU8(G10->getText(), G10->getLine());
+ Guid.Data4[7] = _STOU8(G11->getText(), G11->getLine());
>>
;
@@ -473,9 +473,9 @@ guidDefinition [EFI_GUID &Guid] :
OpenBrace
G1:Number "," G2:Number "," G3:Number ","
<<
- Guid.Data1 = _STOU32 (G1->getText());
- Guid.Data2 = _STOU16 (G2->getText());
- Guid.Data3 = _STOU16 (G3->getText());
+ Guid.Data1 = _STOU32 (G1->getText(), G1->getLine());
+ Guid.Data2 = _STOU16 (G2->getText(), G2->getLine());
+ Guid.Data3 = _STOU16 (G3->getText(), G3->getLine());
>>
(
OpenBrace guidSubDefinition[Guid] CloseBrace
@@ -568,8 +568,8 @@ vfrFormSetDefinition :
if (mCompatibleMode) {
memcpy (&mFormsetGuid, &Guid, sizeof (EFI_GUID));
}
- FSObj->SetFormSetTitle (_STOSID(S1->getText()));
- FSObj->SetHelp (_STOSID(S2->getText()));
+ FSObj->SetFormSetTitle (_STOSID(S1->getText(), S1->getLine()));
+ FSObj->SetHelp (_STOSID(S2->getText(), S2->getLine()));
>>
{
FC:Class "=" classDefinition[C] "," << {CIfrClass CObj;SET_LINE_INFO (CObj, FC); CObj.SetClass(C);} >>
@@ -656,25 +656,25 @@ vfrStatementExtension:
Uuid "=" guidDefinition[Guid]
{"," DataType "="
(
- U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText());>>}
+ U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText(), AN1->getLine());>>}
<< TypeName = U64->getText(); LineNum = U64->getLine(); >>
- | U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText());>>}
+ | U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText(), AN2->getLine());>>}
<< TypeName = U32->getText(); LineNum = U32->getLine(); >>
- | U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText());>>}
+ | U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText(), AN3->getLine());>>}
<< TypeName = U16->getText(); LineNum = U16->getLine(); >>
- | U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText());>>}
+ | U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText(), AN4->getLine());>>}
<< TypeName = U8->getText(); LineNum = U8->getLine(); >>
- | BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText());>>}
+ | BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText(), AN5->getLine());>>}
<< TypeName = BL->getText(); LineNum = BL->getLine(); >>
- | SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText());>>}
+ | SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText(), AN6->getLine());>>}
<< TypeName = SI->getText(); LineNum = SI->getLine(); >>
- | D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText());>>}
+ | D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText(), AN7->getLine());>>}
<< TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>
- | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText());>>}
+ | T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText(), AN8->getLine());>>}
<< TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
- | R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}
+ | R:"EFI_HII_REF" {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText(), AN9->getLine());>>}
<< TypeName = R->getText(); LineNum = R->getLine(); IsStruct = TRUE;>>
- | TN:StringIdentifier {OpenBracket AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText());>>}
+ | TN:StringIdentifier {OpenBracket AN10:Number CloseBracket <<ArrayNum = _STOU32(AN10->getText(), AN10->getLine());>>}
<< TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>
)
<<
@@ -738,7 +738,7 @@ vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize,
<<
ArrayIdx = 0;
if (IsArray == TRUE) {
- ArrayIdx = _STOU8(IDX1->getText());
+ ArrayIdx = _STOU8(IDX1->getText(), IDX1->getLine());
if (ArrayIdx >= ArrayNum) return;
IsArray = FALSE;
}
@@ -769,49 +769,49 @@ vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize,
<<
if (IsStruct == FALSE) {
if (strcmp ("UINT64", TypeName) == 0) {
- Data_U64 = _STOU64(RD->getText());
+ Data_U64 = _STOU64(RD->getText(), RD->getLine());
memcpy (ByteOffset, &Data_U64, TypeSize);
}else if (strcmp ("UINT32", TypeName) == 0) {
- Data_U32 = _STOU32(RD->getText());
+ Data_U32 = _STOU32(RD->getText(), RD->getLine());
memcpy (ByteOffset, &Data_U32, TypeSize);
}else if (strcmp ("UINT16", TypeName) == 0) {
- Data_U16 = _STOU16(RD->getText());
+ Data_U16 = _STOU16(RD->getText(), RD->getLine());
memcpy (ByteOffset, &Data_U16, TypeSize);
}else if (strcmp ("UINT8", TypeName) == 0) {
- Data_U8 = _STOU8(RD->getText());
+ Data_U8 = _STOU8(RD->getText(), RD->getLine());
memcpy (ByteOffset, &Data_U8, TypeSize);
}else if (strcmp ("BOOLEAN", TypeName)== 0) {
- Data_BL = _STOU8(RD->getText());
+ Data_BL = _STOU8(RD->getText(), RD->getLine());
memcpy (ByteOffset, &Data_BL, TypeSize);
}else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {
- Data_SID = _STOSID(RD->getText());
+ Data_SID = _STOSID(RD->getText(), RD->getLine());
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());
+ Data_U8 = _STOU8(RD->getText(), RD->getLine());
memcpy (ByteOffset + FieldOffset, &Data_U8, FieldSize);
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
- Data_U16 = _STOU16(RD->getText());
+ Data_U16 = _STOU16(RD->getText(), RD->getLine());
memcpy (ByteOffset + FieldOffset, &Data_U16, FieldSize);
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
- Data_U32 = _STOU32(RD->getText());
+ Data_U32 = _STOU32(RD->getText(), RD->getLine());
memcpy (ByteOffset + FieldOffset, &Data_U32, FieldSize);
break;
case EFI_IFR_TYPE_NUM_SIZE_64:
- Data_U64 = _STOU64(RD->getText());
+ Data_U64 = _STOU64(RD->getText(), RD->getLine());
memcpy (ByteOffset + FieldOffset, &Data_U64, FieldSize);
break;
case EFI_IFR_TYPE_BOOLEAN:
- Data_BL = _STOU8(RD->getText());
+ Data_BL = _STOU8(RD->getText(), RD->getLine());
memcpy (ByteOffset + FieldOffset, &Data_BL, FieldSize);
break;
case EFI_IFR_TYPE_STRING:
- Data_SID = _STOSID(RD->getText());
+ Data_SID = _STOSID(RD->getText(), RD->getLine());
memcpy (ByteOffset + FieldOffset, &Data_SID, FieldSize);
break;
default:
@@ -830,17 +830,17 @@ vfrStatementDefaultStore :
D:DefaultStore N:StringIdentifier ","
Prompt "=" "STRING_TOKEN" "\(" S:Number "\)"
{
- "," Attribute "=" A:Number << DefaultId = _STOU16(A->getText()); >>
+ "," Attribute "=" A:Number << DefaultId = _STOU16(A->getText(), A->getLine()); >>
}
<<
if (mCVfrDefaultStore.DefaultIdRegistered (DefaultId) == FALSE) {
CIfrDefaultStore DSObj;
- _PCATCH(mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), N->getText(), _STOSID(S->getText()), DefaultId)), D->getLine();
+ _PCATCH(mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), N->getText(), _STOSID(S->getText(), S->getLine()), DefaultId)), D->getLine();
DSObj.SetLineNo(D->getLine());
- DSObj.SetDefaultName (_STOSID(S->getText()));
+ DSObj.SetDefaultName (_STOSID(S->getText(), S->getLine()));
DSObj.SetDefaultId (DefaultId);
} else {
- _PCATCH(mCVfrDefaultStore.ReRegisterDefaultStoreById (DefaultId, N->getText(), _STOSID(S->getText()))), D->getLine();
+ _PCATCH(mCVfrDefaultStore.ReRegisterDefaultStoreById (DefaultId, N->getText(), _STOSID(S->getText(), S->getLine()))), D->getLine();
}
>>
";"
@@ -870,14 +870,14 @@ vfrStatementVarStoreLinear :
)
{ Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR
if (mCompatibleMode) {
- VarStoreId = _STOU16(FID->getText());
+ VarStoreId = _STOU16(FID->getText(), FID->getLine());
}
>>
}
{
VarId "=" ID:Number "," <<
_PCATCH(
- (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
+ (INTN)(VarStoreId = _STOU16(ID->getText(), ID->getLine())) != 0,
(INTN)TRUE,
ID,
"varid 0 is not allowed."
@@ -936,7 +936,7 @@ vfrStatementVarStoreEfi :
{
VarId "=" ID:Number "," <<
_PCATCH(
- (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
+ (INTN)(VarStoreId = _STOU16(ID->getText(), ID->getLine())) != 0,
(INTN)TRUE,
ID,
"varid 0 is not allowed."
@@ -952,11 +952,11 @@ vfrStatementVarStoreEfi :
Name "=" "STRING_TOKEN" "\(" VN:Number "\)" ","
VarSize "=" N:Number "," <<
IsUEFI23EfiVarstore = FALSE;
- StoreName = gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText()));
+ StoreName = gCVfrStringDB.GetVarStoreNameFormStringId(_STOSID(VN->getText(), VN->getLine()));
if (StoreName == NULL) {
_PCATCH (VFR_RETURN_UNSUPPORTED, VN->getLine(), "Can't get varstore name for this StringId!");
}
- Size = _STOU32(N->getText());
+ Size = _STOU32(N->getText(), N->getLine());
switch (Size) {
case 1:
TypeName = (CHAR8 *) "UINT8";
@@ -1012,7 +1012,7 @@ vfrStatementVarStoreEfi :
;
vfrVarStoreEfiAttr [UINT32 & Attr] :
- N:Number << $Attr |= _STOU32(N->getText()); >>
+ N:Number << $Attr |= _STOU32(N->getText(), N->getLine()); >>
;
vfrStatementVarStoreNameValue :
@@ -1027,7 +1027,7 @@ vfrStatementVarStoreNameValue :
{
VarId "=" ID:Number "," <<
_PCATCH(
- (INTN)(VarStoreId = _STOU16(ID->getText())) != 0,
+ (INTN)(VarStoreId = _STOU16(ID->getText(), ID->getLine())) != 0,
(INTN)TRUE,
ID,
"varid 0 is not allowed."
@@ -1040,7 +1040,7 @@ vfrStatementVarStoreNameValue :
_PCATCH(mCVfrDataStorage.DeclareNameVarStoreBegin (SN->getText(), VarStoreId), SN);
Created = TRUE;
}
- _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText())), SN);
+ _PCATCH(mCVfrDataStorage.NameTableAddItem (_STOSID(N->getText(), N->getLine())), SN);
>>
)+
Uuid "=" guidDefinition[Guid] << _PCATCH(mCVfrDataStorage.DeclareNameVarStoreEnd (&Guid), SN); >>
@@ -1069,7 +1069,7 @@ validClassNames[UINT16 & Class] :
| ClassInputDevice << $Class |= EFI_INPUT_DEVICE_CLASS; >>
| ClassOnBoardDevice << $Class |= EFI_ON_BOARD_DEVICE_CLASS; >>
| ClassOtherDevice << $Class |= EFI_OTHER_DEVICE_CLASS; >>
- | N:Number << $Class |= _STOU16(N->getText()); >>
+ | N:Number << $Class |= _STOU16(N->getText(), N->getLine()); >>
;
subclassDefinition[UINT16 & SubClass] :
@@ -1078,7 +1078,7 @@ subclassDefinition[UINT16 & SubClass] :
| SubclassGeneralApplication << $SubClass |= EFI_GENERAL_APPLICATION_SUBCLASS; >>
| SubclassFrontPage << $SubClass |= EFI_FRONT_PAGE_SUBCLASS; >>
| SubclassSingleUse << $SubClass |= EFI_SINGLE_USE_SUBCLASS; >>
- | N:Number << $SubClass |= _STOU16(N->getText()); >>
+ | N:Number << $SubClass |= _STOU16(N->getText(), N->getLine()); >>
;
vfrStatementDisableIfFormSet :
@@ -1113,8 +1113,8 @@ vfrStatementSuppressIfFormSet :
// the syntax of question header and statement header
//
vfrStatementHeader[CIfrStatementHeader *SHObj] :
- Prompt "=" "STRING_TOKEN" "\(" S1:Number "\)" "," << $SHObj->SetPrompt (_STOSID(S1->getText())); >>
- Help "=" "STRING_TOKEN" "\(" S2:Number "\)" << $SHObj->SetHelp (_STOSID(S2->getText())); >>
+ Prompt "=" "STRING_TOKEN" "\(" S1:Number "\)" "," << $SHObj->SetPrompt (_STOSID(S1->getText(), S1->getLine())); >>
+ Help "=" "STRING_TOKEN" "\(" S2:Number "\)" << $SHObj->SetHelp (_STOSID(S2->getText(), S2->getLine())); >>
;
vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_NORMAL]:
@@ -1138,7 +1138,7 @@ vfrQuestionHeader[CIfrQuestionHeader & QHObj, EFI_QUESION_TYPE QType = QUESTION_
{ V:VarId "=" vfrStorageVarId[Info, VarIdStr] "," }
{
QuestionId "=" ID:Number "," <<
- QId = _STOQID(ID->getText());
+ QId = _STOQID(ID->getText(), ID->getLine());
_PCATCH(mCVfrQuestionDB.FindQuestion (QId), VFR_RETURN_UNDEFINED, ID, "has already been used please assign another number");
>>
}
@@ -1205,7 +1205,7 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
(
SN1:StringIdentifier << SName = SN1->getText(); _STRCAT(&VarIdStr, SN1->getText()); >>
OpenBracket I1:Number CloseBracket <<
- Idx = _STOU32(I1->getText());
+ Idx = _STOU32(I1->getText(), I1->getLine());
_STRCAT(&VarIdStr, "[");
_STRCAT(&VarIdStr, I1->getText());
_STRCAT(&VarIdStr, "]");
@@ -1267,7 +1267,7 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFl
SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>
{
OpenBracket I2:Number CloseBracket <<
- Idx = _STOU32(I2->getText());
+ Idx = _STOU32(I2->getText(), I2->getLine());
if (mCompatibleMode) Idx --;
if (Idx > 0) {
//
@@ -1347,7 +1347,7 @@ vfrQuestionDataFieldName [EFI_QUESTION_ID &QId, UINT32 &Mask, CHAR8 *&VarIdStr,
SF:StringIdentifier << _STRCAT (&VarIdStr, SF->getText()); >>
{
OpenBracket I2:Number CloseBracket <<
- Idx = _STOU32(I2->getText());
+ Idx = _STOU32(I2->getText(), I2->getLine());
if (mCompatibleMode) Idx --;
if (Idx > 0) {
//
@@ -1372,22 +1372,22 @@ vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :
N1:Number <<
switch ($Type) {
case EFI_IFR_TYPE_NUM_SIZE_8 :
- $Value.u8 = _STOU8(N1->getText());
+ $Value.u8 = _STOU8(N1->getText(), N1->getLine());
break;
case EFI_IFR_TYPE_NUM_SIZE_16 :
- $Value.u16 = _STOU16(N1->getText());
+ $Value.u16 = _STOU16(N1->getText(), N1->getLine());
break;
case EFI_IFR_TYPE_NUM_SIZE_32 :
- $Value.u32 = _STOU32(N1->getText());
+ $Value.u32 = _STOU32(N1->getText(), N1->getLine());
break;
case EFI_IFR_TYPE_NUM_SIZE_64 :
- $Value.u64 = _STOU64(N1->getText());
+ $Value.u64 = _STOU64(N1->getText(), N1->getLine());
break;
case EFI_IFR_TYPE_BOOLEAN :
- $Value.b = _STOU8(N1->getText());
+ $Value.b = _STOU8(N1->getText(), N1->getLine());
break;
case EFI_IFR_TYPE_STRING :
- $Value.string = _STOU16(N1->getText());
+ $Value.string = _STOU16(N1->getText(), N1->getLine());
break;
case EFI_IFR_TYPE_TIME :
case EFI_IFR_TYPE_DATE :
@@ -1398,14 +1398,14 @@ vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :
>>
| B1:True << $Value.b = TRUE; >>
| B2:False << $Value.b = FALSE; >>
- | O1:One << $Value.u8 = _STOU8(O1->getText()); >>
- | O2:Ones << $Value.u64 = _STOU64(O2->getText()); >>
- | Z:Zero << $Value.u8 = _STOU8(Z->getText()); >>
- | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time = _STOT(HOUR->getText(), MINUTE->getText(), SECOND->getText()); >>
- | YEAR:Number "/" MONTH:Number "/" DAY:Number << $Value.date = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText()); >>
+ | O1:One << $Value.u8 = _STOU8(O1->getText(), O1->getLine()); >>
+ | O2:Ones << $Value.u64 = _STOU64(O2->getText(), O2->getLine()); >>
+ | Z:Zero << $Value.u8 = _STOU8(Z->getText(), Z->getLine()); >>
+ | HOUR:Number ":" MINUTE:Number ":" SECOND:Number << $Value.time = _STOT(HOUR->getText(), MINUTE->getText(),SECOND->getText(), HOUR->getLine()); >>
+ | YEAR:Number "/" MONTH:Number "/" DAY:Number << $Value.date = _STOD(YEAR->getText(), MONTH->getText(), DAY->getText(), YEAR->getLine()); >>
| QI:Number";" FI:Number";" guidDefinition[Guid] ";" "STRING_TOKEN" "\(" DP:Number "\)"
- << $Value.ref = _STOR(QI->getText(), FI->getText(), &Guid, DP->getText()); >>
- | "STRING_TOKEN" "\(" S1:Number "\)" << $Value.string = _STOSID(S1->getText()); >>
+ << $Value.ref = _STOR(QI->getText(), FI->getText(), &Guid, DP->getText(), QI->getLine()); >>
+ | "STRING_TOKEN" "\(" S1:Number "\)" << $Value.string = _STOSID(S1->getText(), S1->getLine()); >>
;
//*****************************************************************************
@@ -1415,8 +1415,8 @@ vfrConstantValueField[UINT8 Type] > [EFI_IFR_TYPE_VALUE Value] :
vfrFormDefinition :
<< CIfrForm FObj; >>
F:Form << FObj.SetLineNo(F->getLine()); >>
- FormId "=" S1:Number "," << _PCATCH(FObj.SetFormId (_STOFID(S1->getText())), S1); >>
- Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";" << FObj.SetFormTitle (_STOSID(S2->getText())); >>
+ FormId "=" S1:Number "," << _PCATCH(FObj.SetFormId (_STOFID(S1->getText(), S1->getLine())), S1); >>
+ Title "=" "STRING_TOKEN" "\(" S2:Number "\)" ";" << FObj.SetFormTitle (_STOSID(S2->getText(), S2->getLine())); >>
(
vfrStatementImage |
vfrStatementLocked |
@@ -1460,10 +1460,10 @@ vfrFormMapDefinition :
EFI_GUID Guid;
>>
F:FormMap << FMapObj = new CIfrFormMap(); FMapObj->SetLineNo(F->getLine()); >>
- FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText())), S1); >>
+ FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText(), S1->getLine())), S1); >>
(
MapTitle "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"
- MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText()), &Guid); FormMapMethodNumber ++; >>
+ MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText(), S2->getLine()), &Guid); FormMapMethodNumber ++; >>
)* << if (FormMapMethodNumber == 0) {_PCATCH (VFR_RETURN_INVALID_PARAMETER, F->getLine(), "No MapMethod is set for FormMap!");} delete FMapObj;>>
(
vfrStatementImage |
@@ -1642,7 +1642,7 @@ vfrStatementWrite :
vfrStatementSubTitle :
<< CIfrSubtitle SObj; >>
L:Subtitle << SObj.SetLineNo(L->getLine()); >>
- Text "=" "STRING_TOKEN" "\(" S:Number "\)" << SObj.SetPrompt (_STOSID(S->getText())); >>
+ Text "=" "STRING_TOKEN" "\(" S:Number "\)" << SObj.SetPrompt (_STOSID(S->getText(), S->getLine())); >>
{
"," FLAGS "=" vfrSubtitleFlags[SObj]
}
@@ -1663,7 +1663,7 @@ vfrSubtitleFlags [CIfrSubtitle & SObj] :
;
subtitleFlagsField [UINT8 & Flags] :
- N:Number << $Flags |= _STOU8(N->getText()); >>
+ N:Number << $Flags |= _STOU8(N->getText(), N->getLine()); >>
| "HORIZONTAL" << $Flags |= 0x01; >>
;
@@ -1677,7 +1677,7 @@ vfrStatementStaticText :
Help "=" "STRING_TOKEN" "\(" S1:Number "\)" ","
Text "=" "STRING_TOKEN" "\(" S2:Number "\)"
{
- "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)" << TxtTwo = _STOSID(S3->getText()); >>
+ "," Text "=" "STRING_TOKEN" "\(" S3:Number "\)" << TxtTwo = _STOSID(S3->getText(), S3->getLine()); >>
}
{
"," F:FLAGS "=" staticTextFlagsField[Flags] ( "\|" staticTextFlagsField[Flags] )*
@@ -1689,16 +1689,16 @@ vfrStatementStaticText :
mCVfrQuestionDB.RegisterQuestion (NULL, NULL, QId);
AObj.SetLineNo (F->getLine());
AObj.SetQuestionId (QId);
- AObj.SetPrompt (_STOSID(S2->getText()));
- AObj.SetHelp (_STOSID(S1->getText()));
+ AObj.SetPrompt (_STOSID(S2->getText(), S2->getLine()));
+ AObj.SetHelp (_STOSID(S1->getText(), S1->getLine()));
_PCATCH(AObj.SetFlags (Flags), F->getLine());
AssignQuestionKey (AObj, KN);
CRT_END_OP (KN);
} else {
CIfrText TObj;
TObj.SetLineNo (T->getLine());
- TObj.SetHelp (_STOSID(S1->getText()));
- TObj.SetPrompt (_STOSID(S2->getText()));
+ TObj.SetHelp (_STOSID(S1->getText(), S1->getLine()));
+ TObj.SetPrompt (_STOSID(S2->getText(), S2->getLine()));
TObj.SetTextTwo (TxtTwo);
}
>>
@@ -1707,7 +1707,7 @@ vfrStatementStaticText :
;
staticTextFlagsField[UINT8 & HFlags] :
- N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
| questionheaderFlagsField[HFlags]
;
@@ -1741,9 +1741,9 @@ vfrStatementGoto :
Question "=" QN1:Number ","
<<
RefType = 4;
- DevPath = _STOSID(P->getText());
- FId = _STOFID(F1->getText());
- QId = _STOQID(QN1->getText());
+ DevPath = _STOSID(P->getText(), P->getLine());
+ FId = _STOFID(F1->getText(), F1->getLine());
+ QId = _STOQID(QN1->getText(), QN1->getLine());
>>
)
|
@@ -1753,13 +1753,13 @@ vfrStatementGoto :
Question "=" QN2:Number ","
<<
RefType = 3;
- FId = _STOFID(F2->getText());
- QId = _STOQID(QN2->getText());
+ FId = _STOFID(F2->getText(), F2->getLine());
+ QId = _STOQID(QN2->getText(), QN2->getLine());
>>
)
|
(
- FormId "=" F3:Number "," << RefType = 2; FId = _STOFID(F3->getText()); >>
+ FormId "=" F3:Number "," << RefType = 2; FId = _STOFID(F3->getText(), F3->getLine()); >>
Question "="
(
QN3:StringIdentifier "," <<
@@ -1768,14 +1768,14 @@ vfrStatementGoto :
_PCATCH(VFR_RETURN_UNDEFINED, QN3);
}
>>
- | QN4:Number "," << QId = _STOQID(QN4->getText()); >>
+ | QN4:Number "," << QId = _STOQID(QN4->getText(), QN4->getLine()); >>
)
)
|
(
F4:Number "," <<
RefType = 1;
- FId = _STOFID(F4->getText());
+ FId = _STOFID(F4->getText(), F4->getLine());
>>
)
}
@@ -1857,7 +1857,7 @@ vfrGotoFlags [CIfrQuestionHeader *QHObj, UINT32 LineNum] :
;
gotoFlagsField[UINT8 & HFlags] :
- N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
| questionheaderFlagsField[HFlags]
;
@@ -1989,9 +1989,9 @@ checkboxFlagsField[UINT8 & LFlags, UINT8 & HFlags] :
//
// set question flag
//
- $LFlags |= _STOU8(N->getText());
+ $LFlags |= _STOU8(N->getText(), N->getLine());
} else {
- _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());
+ _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine());
}
>>
| D:"DEFAULT" <<
@@ -2035,7 +2035,7 @@ vfrStatementAction :
L:Action << AObj.SetLineNo(L->getLine()); >>
vfrQuestionHeader[AObj] ","
{ F:FLAGS "=" vfrActionFlags[AObj, F->getLine()] "," }
- Config "=" "STRING_TOKEN" "\(" S:Number "\)" "," << AObj.SetQuestionConfig (_STOSID(S->getText())); >>
+ Config "=" "STRING_TOKEN" "\(" S:Number "\)" "," << AObj.SetQuestionConfig (_STOSID(S->getText(), S->getLine())); >>
vfrStatementQuestionTagList
E:EndAction << CRT_END_OP (E); >>
";"
@@ -2048,7 +2048,7 @@ vfrActionFlags[CIfrAction & AObj, UINT32 LineNum] :
;
actionFlagsField[UINT8 & HFlags] :
- N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
| questionheaderFlagsField[HFlags]
;
@@ -2095,8 +2095,8 @@ vfrStatementDate :
mCVfrQuestionDB.RegisterOldDateQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);
DObj.SetQuestionId (QId);
DObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_DATE_STORAGE_TIME);
- DObj.SetPrompt (_STOSID(YP->getText()));
- DObj.SetHelp (_STOSID(YH->getText()));
+ DObj.SetPrompt (_STOSID(YP->getText(), YP->getLine()));
+ DObj.SetHelp (_STOSID(YH->getText(), YH->getLine()));
if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
>>
<< {CIfrDefault DefaultObj(Size, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_DATE, Val); DefaultObj.SetLineNo(L->getLine());} >>
@@ -2115,19 +2115,19 @@ minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
"default" "=" N:Number "," <<
switch (KeyValue) {
case 0:
- D.Year = _STOU16(N->getText());
- if (D.Year < _STOU16 (MinN->getText()) || D.Year > _STOU16 (MaxN->getText())) {
+ D.Year = _STOU16(N->getText(), N->getLine());
+ if (D.Year < _STOU16 (MinN->getText(), MinN->getLine()) || D.Year > _STOU16 (MaxN->getText(), MaxN->getLine())) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");
}
break;
case 1:
- D.Month = _STOU8(N->getText());
+ D.Month = _STOU8(N->getText(), N->getLine());
if (D.Month < 1 || D.Month > 12) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");
}
break;
case 2:
- D.Day = _STOU8(N->getText());
+ D.Day = _STOU8(N->getText(), N->getLine());
if (D.Day < 1 || D.Day > 31) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");
}
@@ -2144,7 +2144,7 @@ vfrDateFlags [CIfrDate & DObj, UINT32 LineNum] :
;
dateFlagsField [UINT8 & Flags] :
- N:Number << $Flags |= _STOU8(N->getText()); >>
+ N:Number << $Flags |= _STOU8(N->getText(), N->getLine()); >>
| "YEAR_SUPPRESS" << $Flags |= 0x01; >>
| "MONTH_SUPPRESS" << $Flags |= 0x02; >>
| "DAY_SUPPRESS" << $Flags |= 0x04; >>
@@ -2168,35 +2168,35 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
Minimum "=" I:Number ","
<<
switch (_GET_CURRQEST_DATATYPE()) {
- case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_8 : MinU1 = _STOU8(I->getText()); break;
+ case EFI_IFR_TYPE_NUM_SIZE_64 : MinU8 = _STOU64(I->getText(), I->getLine()); break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 : MinU4 = _STOU32(I->getText(), I->getLine()); break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 : MinU2 = _STOU16(I->getText(), I->getLine()); break;
+ case EFI_IFR_TYPE_NUM_SIZE_8 : MinU1 = _STOU8(I->getText(), I->getLine()); break;
}
>>
Maximum "=" A:Number ","
<<
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_64 :
- MaxU8 = _STOU64(A->getText());
+ MaxU8 = _STOU64(A->getText(), A->getLine());
if (MaxU8 < MinU8) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_32 :
- MaxU4 = _STOU32(A->getText());
+ MaxU4 = _STOU32(A->getText(), A->getLine());
if (MaxU4 < MinU4) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_16 :
- MaxU2 = _STOU16(A->getText());
+ MaxU2 = _STOU16(A->getText(), A->getLine());
if (MaxU2 < MinU2) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_8 :
- MaxU1 = _STOU8(A->getText());
+ MaxU1 = _STOU8(A->getText(), A->getLine());
if (MaxU1 < MinU1) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
@@ -2207,10 +2207,10 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
STEP "=" S:Number ","
<<
switch (_GET_CURRQEST_DATATYPE()) {
- case EFI_IFR_TYPE_NUM_SIZE_64 : StepU8 = _STOU64(S->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_32 : StepU4 = _STOU32(S->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_16 : StepU2 = _STOU16(S->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_8 : StepU1 = _STOU8(S->getText()); break;
+ 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;
}
>>
}
@@ -2277,8 +2277,9 @@ vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
UINT8 HFlags = 0;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
BOOLEAN IsSetType = FALSE;
+ BOOLEAN IsDisplaySpecified = FALSE;
>>
- numericFlagsField[HFlags, LFlags, IsSetType] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType] )*
+ numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified ] )*
<<
//check data type flag
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
@@ -2297,19 +2298,19 @@ vfrNumericFlags [CIfrNumeric & NObj, UINT32 LineNum] :
} else if (IsSetType){
_GET_CURRQEST_VARTINFO().mVarType = LFlags & EFI_IFR_NUMERIC_SIZE;
}
- _PCATCH(NObj.SetFlags (HFlags, LFlags), LineNum);
+ _PCATCH(NObj.SetFlags (HFlags, LFlags, IsDisplaySpecified), LineNum);
>>
;
-numericFlagsField [UINT8 & HFlags, UINT8 & LFlags, BOOLEAN & IsSetType] :
- N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+numericFlagsField [UINT8 & HFlags, UINT8 & LFlags, BOOLEAN & IsSetType, BOOLEAN & IsDisplaySpecified] :
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
| "NUMERIC_SIZE_1" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_1; IsSetType = TRUE;>>
| "NUMERIC_SIZE_2" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_2; IsSetType = TRUE;>>
| "NUMERIC_SIZE_4" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_4; IsSetType = TRUE;>>
| "NUMERIC_SIZE_8" << $LFlags = ($LFlags & ~EFI_IFR_NUMERIC_SIZE) | EFI_IFR_NUMERIC_SIZE_8; IsSetType = TRUE;>>
- | "DISPLAY_INT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_INT_DEC; >>
- | "DISPLAY_UINT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_DEC; >>
- | "DISPLAY_UINT_HEX" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_HEX; >>
+ | "DISPLAY_INT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_INT_DEC; IsDisplaySpecified = TRUE;>>
+ | "DISPLAY_UINT_DEC" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_DEC; IsDisplaySpecified = TRUE;>>
+ | "DISPLAY_UINT_HEX" << $LFlags = ($LFlags & ~EFI_IFR_DISPLAY) | EFI_IFR_DISPLAY_UINT_HEX; IsDisplaySpecified = TRUE;>>
| questionheaderFlagsField[HFlags]
;
@@ -2366,8 +2367,9 @@ vfrOneofFlagsField [CIfrOneOf & OObj, UINT32 LineNum] :
UINT8 HFlags = 0;
EFI_VFR_VARSTORE_TYPE VarStoreType = EFI_VFR_VARSTORE_INVALID;
BOOLEAN IsSetType = FALSE;
+ BOOLEAN IsDisplaySpecified = FALSE;
>>
- numericFlagsField[HFlags, LFlags, IsSetType] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType] )*
+ numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified] ( "\|" numericFlagsField[HFlags, LFlags, IsSetType, IsDisplaySpecified] )*
<<
//check data type flag
if (_GET_CURRQEST_VARTINFO().mVarStoreId != EFI_VARSTORE_ID_INVALID) {
@@ -2410,8 +2412,8 @@ vfrStatementString :
}
MinSize "=" MIN:Number "," <<
VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
- StringMinSize = _STOU8(MIN->getText());
- if (_STOU64(MIN->getText()) > StringMinSize) {
+ StringMinSize = _STOU8(MIN->getText(), MIN->getLine());
+ if (_STOU64(MIN->getText(), MIN->getLine()) > StringMinSize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize takes only one byte, which can't be larger than 0xFF.");
} else if (VarArraySize != 0 && StringMinSize > VarArraySize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "String MinSize can't be larger than the max number of elements in string array.");
@@ -2419,8 +2421,8 @@ vfrStatementString :
SObj.SetMinSize (StringMinSize);
>>
MaxSize "=" MAX:Number "," <<
- StringMaxSize = _STOU8(MAX->getText());
- if (_STOU64(MAX->getText()) > StringMaxSize) {
+ StringMaxSize = _STOU8(MAX->getText(), MAX->getLine());
+ if (_STOU64(MAX->getText(), MAX->getLine()) > StringMaxSize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize takes only one byte, which can't be larger than 0xFF.");
} else if (VarArraySize != 0 && StringMaxSize > VarArraySize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "String MaxSize can't be larger than the max number of elements in string array.");
@@ -2444,7 +2446,7 @@ vfrStringFlagsField [CIfrString & SObj, UINT32 LineNum] :
;
stringFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
- N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
| "MULTI_LINE" << $LFlags = 0x01; >>
| questionheaderFlagsField[HFlags]
;
@@ -2464,8 +2466,8 @@ vfrStatementPassword :
}
MinSize "=" MIN:Number "," <<
VarArraySize = _GET_CURRQEST_ARRAY_SIZE();
- PasswordMinSize = _STOU16(MIN->getText());
- if (_STOU64(MIN->getText()) > PasswordMinSize) {
+ PasswordMinSize = _STOU16(MIN->getText(), MIN->getLine());
+ if (_STOU64(MIN->getText(), MIN->getLine()) > PasswordMinSize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize takes only two byte, which can't be larger than 0xFFFF.");
} else if (VarArraySize != 0 && PasswordMinSize > VarArraySize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, MIN->getLine(), "Password MinSize can't be larger than the max number of elements in password array.");
@@ -2473,8 +2475,8 @@ vfrStatementPassword :
PObj.SetMinSize (PasswordMinSize);
>>
MaxSize "=" MAX:Number "," <<
- PasswordMaxSize = _STOU16(MAX->getText());
- if (_STOU64(MAX->getText()) > PasswordMaxSize) {
+ PasswordMaxSize = _STOU16(MAX->getText(), MAX->getLine());
+ if (_STOU64(MAX->getText(), MAX->getLine()) > PasswordMaxSize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize takes only two byte, which can't be larger than 0xFFFF.");
} else if (VarArraySize != 0 && PasswordMaxSize > VarArraySize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, MAX->getLine(), "Password MaxSize can't be larger than the max number of elements in password array.");
@@ -2496,7 +2498,7 @@ vfrPasswordFlagsField [CIfrPassword & PObj, UINT32 LineNum] :
;
passwordFlagsField [UINT8 & HFlags] :
- N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
| questionheaderFlagsField[HFlags]
;
@@ -2513,12 +2515,12 @@ vfrStatementOrderedList :
>>
{
MaxContainers "=" M:Number "," <<
- if (_STOU64(M->getText()) > _STOU8(M->getText())) {
+ if (_STOU64(M->getText(), M->getLine()) > _STOU8(M->getText(), M->getLine())) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers takes only one byte, which can't be larger than 0xFF.");
- } else if (VarArraySize != 0 && _STOU8(M->getText()) > VarArraySize) {
+ } else if (VarArraySize != 0 && _STOU8(M->getText(), M->getLine()) > VarArraySize) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, M->getLine(), "OrderedList MaxContainers can't be larger than the max number of elements in array.");
}
- OLObj.SetMaxContainers (_STOU8(M->getText()));
+ OLObj.SetMaxContainers (_STOU8(M->getText(), M->getLine()));
>>
}
{ F:FLAGS "=" vfrOrderedListFlags[OLObj, F->getLine()] }
@@ -2537,7 +2539,7 @@ vfrOrderedListFlags [CIfrOrderedList & OLObj, UINT32 LineNum] :
;
orderedlistFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
- N:Number << _PCATCH(_STOU8(N->getText()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
+ N:Number << _PCATCH(_STOU8(N->getText(), N->getLine()) == 0 ? VFR_RETURN_SUCCESS : VFR_RETURN_UNSUPPORTED, N->getLine()); >>
| "UNIQUE" << $LFlags |= 0x01; >>
| "NOEMPTY" << $LFlags |= 0x02; >>
| questionheaderFlagsField[HFlags]
@@ -2586,8 +2588,8 @@ vfrStatementTime :
mCVfrQuestionDB.RegisterOldTimeQuestion (VarIdStr[0], VarIdStr[1], VarIdStr[2], QId);
TObj.SetQuestionId (QId);
TObj.SetFlags (EFI_IFR_QUESTION_FLAG_DEFAULT, QF_TIME_STORAGE_TIME);
- TObj.SetPrompt (_STOSID(HP->getText()));
- TObj.SetHelp (_STOSID(HH->getText()));
+ TObj.SetPrompt (_STOSID(HP->getText(), HP->getLine()));
+ TObj.SetHelp (_STOSID(HH->getText(), HH->getLine()));
if (VarIdStr[0] != NULL) { delete VarIdStr[0]; } if (VarIdStr[1] != NULL) { delete VarIdStr[1]; } if (VarIdStr[2] != NULL) { delete VarIdStr[2]; }
>>
<< {CIfrDefault DefaultObj(Size, EFI_HII_DEFAULT_CLASS_STANDARD, EFI_IFR_TYPE_TIME, Val); DefaultObj.SetLineNo(L->getLine());} >>
@@ -2606,19 +2608,19 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
"default" "=" N:Number "," <<
switch (KeyValue) {
case 0:
- T.Hour = _STOU8(N->getText());
+ T.Hour = _STOU8(N->getText(), N->getLine());
if (T.Hour > 23) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");
}
break;
case 1:
- T.Minute = _STOU8(N->getText());
+ T.Minute = _STOU8(N->getText(), N->getLine());
if (T.Minute > 59) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");
}
break;
case 2:
- T.Second = _STOU8(N->getText());
+ T.Second = _STOU8(N->getText(), N->getLine());
if (T.Second > 59) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");
}
@@ -2635,7 +2637,7 @@ vfrTimeFlags [CIfrTime & TObj, UINT32 LineNum] :
;
timeFlagsField [UINT8 & Flags] :
- N:Number << $Flags |= _STOU8(N->getText()); >>
+ N:Number << $Flags |= _STOU8(N->getText(), N->getLine()); >>
| "HOUR_SUPPRESS" << $Flags |= 0x01; >>
| "MINUTE_SUPPRESS" << $Flags |= 0x02; >>
| "SECOND_SUPPRESS" << $Flags |= 0x04; >>
@@ -2714,7 +2716,7 @@ vfrStatementInconsistentIfStat :
}
IIObj.SetLineNo(L->getLine());
>>
- Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText(), S->getLine())); >>
{ FLAGS "=" flagsField ( "\|" flagsField )* "," }
vfrStatementExpression[0]
E:EndIf << CRT_END_OP (E); >>
@@ -2796,7 +2798,7 @@ vfrStatementGrayOutIfStatOld :
vfrImageTag :
<< CIfrImage IObj; >>
- L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)" << IObj.SetImageId (_STOSID(S1->getText())); IObj.SetLineNo(L->getLine()); >>
+ L:Image "=" "IMAGE_TOKEN" "\(" S1:Number "\)" << IObj.SetImageId (_STOSID(S1->getText(), S1->getLine())); IObj.SetLineNo(L->getLine()); >>
;
vfrLockedTag :
@@ -2836,7 +2838,7 @@ vfrStatementLocked :
vfrStatementInconsistentIf :
<< CIfrInconsistentIf IIObj; >>
L:InconsistentIf << IIObj.SetLineNo(L->getLine()); >>
- Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText())); >>
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << IIObj.SetError (_STOSID(S->getText(), S->getLine())); >>
{ FLAGS "=" flagsField ( "\|" flagsField )* "," }
vfrStatementExpression[0]
E:EndIf << CRT_END_OP (E); >>
@@ -2845,7 +2847,7 @@ vfrStatementInconsistentIf :
vfrStatementNoSubmitIf :
<< CIfrNoSubmitIf NSIObj; >>
L:NoSubmitIf << NSIObj.SetLineNo(L->getLine()); >>
- Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << NSIObj.SetError (_STOSID(S->getText())); >>
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << NSIObj.SetError (_STOSID(S->getText(), S->getLine())); >>
{ FLAGS "=" flagsField ( "\|" flagsField )* "," }
vfrStatementExpression[0]
E:EndIf << CRT_END_OP (E); >>
@@ -2854,8 +2856,8 @@ vfrStatementNoSubmitIf :
vfrStatementWarningIf :
<< CIfrWarningIf WIObj; >>
L:WarningIf << WIObj.SetLineNo(L->getLine()); >>
- Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << WIObj.SetWarning (_STOSID(S->getText())); >>
- {Timeout "=" T:Number "," << WIObj.SetTimeOut (_STOU8(T->getText())); >>}
+ Prompt "=" "STRING_TOKEN" "\(" S:Number "\)" "," << WIObj.SetWarning (_STOSID(S->getText(), S->getLine())); >>
+ {Timeout "=" T:Number "," << WIObj.SetTimeOut (_STOU8(T->getText(), T->getLine())); >>}
vfrStatementExpression[0]
E:EndIf << CRT_END_OP (E); >>
;
@@ -2873,7 +2875,7 @@ vfrStatementDisableIfQuest :
vfrStatementRefresh :
<< CIfrRefresh RObj; >>
L:Refresh << RObj.SetLineNo(L->getLine()); >>
- Interval "=" I:Number << RObj.SetRefreshInterval (_STOU8(I->getText())); >>
+ Interval "=" I:Number << RObj.SetRefreshInterval (_STOU8(I->getText(), I->getLine())); >>
;
vfrStatementRefreshEvent :
@@ -2888,7 +2890,7 @@ vfrStatementRefreshEvent :
vfrStatementVarstoreDevice :
<< CIfrVarStoreDevice VDObj; >>
L:VarstoreDevice << VDObj.SetLineNo(L->getLine()); >>
- "=" "STRING_TOKEN" "\(" S:Number "\)" "," << VDObj.SetDevicePath (_STOSID(S->getText())); >>
+ "=" "STRING_TOKEN" "\(" S:Number "\)" "," << VDObj.SetDevicePath (_STOSID(S->getText(), S->getLine())); >>
;
vfrStatementSuppressIfQuest :
@@ -2941,7 +2943,7 @@ vfrStatementOneOfOption :
_PCATCH (ReturnCode, L->getLine());
}
>>
- Text "=" "STRING_TOKEN" "\(" S:Number "\)" "," << OOOObj.SetOption (_STOSID(S->getText())); >>
+ Text "=" "STRING_TOKEN" "\(" S:Number "\)" "," << OOOObj.SetOption (_STOSID(S->getText(), S->getLine())); >>
Value "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] >[Val] ","
<<
if (gCurrentMinMaxData != NULL) {
@@ -3007,7 +3009,7 @@ vfrStatementOneOfOption :
CIfrOptionKey IfrOptionKey (
gCurrentQuestion->QUESTION_ID(),
Val,
- _STOQID(KN->getText())
+ _STOQID(KN->getText(), KN->getLine())
);
SET_LINE_INFO (IfrOptionKey, KN);
>>
@@ -3029,7 +3031,7 @@ vfrOneOfOptionFlags [CIfrOneOfOption & OOOObj, UINT32 LineNum] :
;
oneofoptionFlagsField [UINT8 & HFlags, UINT8 & LFlags] :
- N:Number << $LFlags |= _STOU8(N->getText()); >>
+ N:Number << $LFlags |= _STOU8(N->getText(), N->getLine()); >>
| "OPTION_DEFAULT" << $LFlags |= 0x10; >>
| "OPTION_DEFAULT_MFG" << $LFlags |= 0x20; >>
| InteractiveFlag << $HFlags |= 0x04; >>
@@ -3055,7 +3057,7 @@ vfrStatementLabel :
{
CIfrLabel LObj2;
LObj2.SetLineNo(L->getLine());
- LObj2.SetNumber (_STOU16(N->getText()));
+ LObj2.SetNumber (_STOU16(N->getText(), N->getLine()));
}
>>
";"
@@ -3064,10 +3066,10 @@ vfrStatementLabel :
vfrStatementBanner :
<< CIfrBanner BObj; >>
B:Banner { "," } << BObj.SetLineNo(B->getLine()); >>
- Title "=" "STRING_TOKEN" "\(" S:Number "\)" "," << BObj.SetTitle (_STOSID(S->getText())); >>
+ Title "=" "STRING_TOKEN" "\(" S:Number "\)" "," << BObj.SetTitle (_STOSID(S->getText(), S->getLine())); >>
(
(
- Line L:Number "," << BObj.SetLine (_STOU16(L->getText())); >>
+ Line L:Number "," << BObj.SetLine (_STOU16(L->getText(), L->getLine())); >>
Align
(
Left << BObj.SetAlign (0); >>
@@ -3077,7 +3079,7 @@ vfrStatementBanner :
)
|
(
- Timeout "=" T:Number ";" << {CIfrTimeout TObj(_STOU16(T->getText()));} >>
+ Timeout "=" T:Number ";" << {CIfrTimeout TObj(_STOU16(T->getText(), T->getLine()));} >>
)
)
;
@@ -3423,7 +3425,7 @@ vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
_PCATCH (mCVfrDataStorage.DeclareEfiVarStore (
VarIdStr,
&mFormsetGuid,
- _STOSID(VN->getText()),
+ _STOSID(VN->getText(), VN->getLine()),
0x2, //default type is UINT16
FALSE
), VN);
@@ -3437,7 +3439,7 @@ vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
(
(
"=="
- V1:Number << ConstVal = _STOU16(V1->getText()); >>
+ V1:Number << ConstVal = _STOU16(V1->getText(), V1->getLine()); >>
<<
if (Mask == 0) {
CIfrEqIdVal EIVObj (L->getLine());
@@ -3453,25 +3455,25 @@ vareqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
(
"<="
- V2:Number << ConstVal = _STOU16(V2->getText()); >>
+ V2:Number << ConstVal = _STOU16(V2->getText(), V2->getLine()); >>
<< IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>
)
|
(
"<"
- V3:Number << ConstVal = _STOU16(V3->getText()); >>
+ V3:Number << ConstVal = _STOU16(V3->getText(), V3->getLine()); >>
<< IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>
)
|
(
">="
- V4:Number << ConstVal = _STOU16(V4->getText()); >>
+ V4:Number << ConstVal = _STOU16(V4->getText(), V4->getLine()); >>
<< IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>
)
|
(
">"
- V5:Number << ConstVal = _STOU16(V5->getText()); >>
+ V5:Number << ConstVal = _STOU16(V5->getText(), V5->getLine()); >>
<< IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
)
)
@@ -3490,7 +3492,7 @@ ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
(
(
"=="
- V1:Number << ConstVal = _STOU16(V1->getText()); >>
+ V1:Number << ConstVal = _STOU16(V1->getText(), V1->getLine()); >>
<<
if (Mask == 0) {
CIfrEqIdVal EIVObj (L->getLine());
@@ -3506,25 +3508,25 @@ ideqvalExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
|
(
"<="
- V2:Number << ConstVal = _STOU16(V2->getText()); >>
+ V2:Number << ConstVal = _STOU16(V2->getText(), V2->getLine()); >>
<< IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_EQUAL); >>
)
|
(
"<"
- V3:Number << ConstVal = _STOU16(V3->getText()); >>
+ V3:Number << ConstVal = _STOU16(V3->getText(), V3->getLine()); >>
<< IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, LESS_THAN); >>
)
|
(
">="
- V4:Number << ConstVal = _STOU16(V4->getText()); >>
+ V4:Number << ConstVal = _STOU16(V4->getText(), V4->getLine()); >>
<< IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_EQUAL); >>
)
|
(
">"
- V5:Number << ConstVal = _STOU16(V5->getText()); >>
+ V5:Number << ConstVal = _STOU16(V5->getText(), V5->getLine()); >>
<< IdEqValDoSpecial ($ExpOpCount, L->getLine(), QId, VarIdStr, Mask, ConstVal, GREATER_THAN); >>
)
)
@@ -3595,7 +3597,7 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
vfrQuestionDataFieldName[QId, Mask, VarIdStr, LineNo]
"=="
(
- V:Number << ValueList[ListLen] = _STOU16(V->getText()); ListLen++; >>
+ V:Number << ValueList[ListLen] = _STOU16(V->getText(), V->getLine()); ListLen++; >>
)+
<<
if (Mask != 0) {
@@ -3637,7 +3639,7 @@ questionref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
LineNo = QN->getLine();
mCVfrQuestionDB.GetQuestionId (QN->getText(), NULL, QId, BitMask);
>>
- | ID:Number << QId = _STOQID(ID->getText()); >>
+ | ID:Number << QId = _STOQID(ID->getText(), ID->getLine()); >>
)
"\)"
<<
@@ -3662,9 +3664,9 @@ stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
(
"STRING_TOKEN"
"\("
- S:Number << RefStringId = _STOSID(S->getText()); >>
+ S:Number << RefStringId = _STOSID(S->getText(), S->getLine()); >>
"\)"
- | I:Number << RefStringId = _STOSID(I->getText()); >>
+ | I:Number << RefStringId = _STOSID(I->getText(), I->getLine()); >>
)
"\)" << { CIfrStringRef1 SR1Obj(L->getLine()); _SAVE_OPHDR_COND (SR1Obj, ($ExpOpCount == 0), L->getLine()); SR1Obj.SetStringId (RefStringId); $ExpOpCount++; } >>
;
@@ -3767,7 +3769,7 @@ vfrExpressionConstant[UINT32 & RootLevel, UINT32 & ExpOpCount] :
| L5:Zero << CIfrZero ZObj(L5->getLine()); _SAVE_OPHDR_COND (ZObj, ($ExpOpCount == 0), L5->getLine()); $ExpOpCount++; >>
| L6:Undefined << CIfrUndefined UObj(L6->getLine()); _SAVE_OPHDR_COND (UObj, ($ExpOpCount == 0), L6->getLine()); $ExpOpCount++; >>
| L7:Version << CIfrVersion VObj(L7->getLine()); _SAVE_OPHDR_COND (VObj, ($ExpOpCount == 0), L7->getLine()); $ExpOpCount++; >>
- | V:Number << CIfrUint64 U64Obj(V->getLine()); U64Obj.SetValue (_STOU64(V->getText())); _SAVE_OPHDR_COND (U64Obj, ($ExpOpCount == 0), V->getLine()); $ExpOpCount++; >>
+ | V:Number << CIfrUint64 U64Obj(V->getLine()); U64Obj.SetValue (_STOU64(V->getText(), V->getLine())); _SAVE_OPHDR_COND (U64Obj, ($ExpOpCount == 0), V->getLine()); $ExpOpCount++; >>
;
vfrExpressionUnaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
@@ -3804,7 +3806,7 @@ question23refExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
L:QuestionRefVal
"\("
{
- DevicePath "=" "STRING_TOKEN" "\(" S:Number "\)" "," << Type = 0x2; DevPath = _STOSID(S->getText()); >>
+ DevicePath "=" "STRING_TOKEN" "\(" S:Number "\)" "," << Type = 0x2; DevPath = _STOSID(S->getText(), S->getLine()); >>
}
{
Uuid "=" guidDefinition[Guid] "," << Type = 0x3; >>
@@ -3837,7 +3839,7 @@ tostringExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
<< UINT8 Fmt = 0; >>
L:StringVal
{
- Format "=" F:Number "," << Fmt = _STOU8(F->getText()); >>
+ Format "=" F:Number "," << Fmt = _STOU8(F->getText(), F->getLine()); >>
}
"\(" vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount] "\)"
<< { CIfrToString TSObj(L->getLine()); TSObj.SetFormat (Fmt); $ExpOpCount++; } >>
@@ -4023,7 +4025,7 @@ vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:
;
spanFlags [UINT8 & Flags] :
- N:Number << $Flags |= _STOU8(N->getText()); >>
+ N:Number << $Flags |= _STOU8(N->getText(), N->getLine()); >>
| "LAST_NON_MATCH" << $Flags |= 0x00; >>
| "FIRST_NON_MATCH" << $Flags |= 0x01; >>
;
@@ -4091,17 +4093,17 @@ public:
CHAR8* TrimHex (IN CHAR8 *, OUT BOOLEAN *);
CHAR8* _U32TOS (IN UINT32);
- UINT8 _STOU8 (IN CHAR8 *);
- UINT16 _STOU16 (IN CHAR8 *);
- UINT32 _STOU32 (IN CHAR8 *);
- UINT64 _STOU64 (IN CHAR8 *);
- EFI_HII_DATE _STOD (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *);
- EFI_HII_TIME _STOT (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *);
- EFI_HII_REF _STOR (IN CHAR8 *, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *);
-
- EFI_STRING_ID _STOSID (IN CHAR8 *);
- EFI_FORM_ID _STOFID (IN CHAR8 *);
- EFI_QUESTION_ID _STOQID (IN CHAR8 *);
+ UINT8 _STOU8 (IN CHAR8 *, IN UINT32);
+ UINT16 _STOU16 (IN CHAR8 *, IN UINT32);
+ UINT32 _STOU32 (IN CHAR8 *, IN UINT32);
+ UINT64 _STOU64 (IN CHAR8 *, IN UINT32);
+ EFI_HII_DATE _STOD (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN UINT32);
+ EFI_HII_TIME _STOT (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN UINT32);
+ EFI_HII_REF _STOR (IN CHAR8 *, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *, IN UINT32);
+
+ EFI_STRING_ID _STOSID (IN CHAR8 *, IN UINT32);
+ EFI_FORM_ID _STOFID (IN CHAR8 *, IN UINT32);
+ EFI_QUESTION_ID _STOQID (IN CHAR8 *, IN UINT32);
VOID _STRCAT (IN OUT CHAR8 **, IN CONST CHAR8 *);
@@ -4335,18 +4337,21 @@ EfiVfrParser::_U32TOS (
UINT8
EfiVfrParser::_STOU8 (
- IN CHAR8*Str
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
)
{
BOOLEAN IsHex;
UINT8 Value;
CHAR8 c;
+ UINT8 PreviousValue;
+ CHAR8 *OrigString = Str;
+ CHAR8 ErrorMsg[100];
+
Str = TrimHex (Str, &IsHex);
for (Value = 0; (c = *Str) != '\0'; Str++) {
- //
- // BUG: does not handle overflow here
- //
+ PreviousValue = Value;
(IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
@@ -4358,6 +4363,10 @@ EfiVfrParser::_STOU8 (
if (c >= '0' && c <= '9') {
Value += (c - '0');
}
+ if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue))) {
+ sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT8", OrigString);
+ gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
+ }
}
return Value;
@@ -4365,18 +4374,21 @@ EfiVfrParser::_STOU8 (
UINT16
EfiVfrParser::_STOU16 (
- IN CHAR8*Str
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
)
{
BOOLEAN IsHex;
UINT16 Value;
CHAR8 c;
+ UINT16 PreviousValue;
+ CHAR8 *OrigString = Str;
+ CHAR8 ErrorMsg[100];
+
Str = TrimHex (Str, &IsHex);
for (Value = 0; (c = *Str) != '\0'; Str++) {
- //
- // BUG: does not handle overflow here
- //
+ PreviousValue = Value;
(IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
@@ -4388,6 +4400,10 @@ EfiVfrParser::_STOU16 (
if (c >= '0' && c <= '9') {
Value += (c - '0');
}
+ if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue))) {
+ sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT16", OrigString);
+ gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
+ }
}
return Value;
@@ -4395,18 +4411,21 @@ EfiVfrParser::_STOU16 (
UINT32
EfiVfrParser::_STOU32 (
- IN CHAR8*Str
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
)
{
BOOLEAN IsHex;
UINT32 Value;
CHAR8 c;
+ UINT32 PreviousValue;
+ CHAR8 *OrigString = Str;
+ CHAR8 ErrorMsg[100];
+
Str = TrimHex (Str, &IsHex);
for (Value = 0; (c = *Str) != '\0'; Str++) {
- //
- // BUG: does not handle overflow here
- //
+ PreviousValue = Value;
(IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
@@ -4418,6 +4437,10 @@ EfiVfrParser::_STOU32 (
if (c >= '0' && c <= '9') {
Value += (c - '0');
}
+ if((IsHex && ((Value/16) != PreviousValue)) || (!IsHex && ((Value/10) != PreviousValue ))) {
+ sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT32", OrigString);
+ gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
+ }
}
return Value;
@@ -4425,18 +4448,20 @@ EfiVfrParser::_STOU32 (
UINT64
EfiVfrParser::_STOU64 (
- IN CHAR8*Str
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
)
{
BOOLEAN IsHex;
UINT64 Value;
CHAR8 c;
+ UINT64 PreviousValue;
+ CHAR8 *OrigString = Str;
+ CHAR8 ErrorMsg[100];
Str = TrimHex (Str, &IsHex);
for (Value = 0; (c = *Str) != '\0'; Str++) {
- //
- // BUG: does not handle overflow here
- //
+ PreviousValue = Value;
(IsHex == TRUE) ? (Value <<= 4) : (Value *= 10);
if ((IsHex == TRUE) && (c >= 'a') && (c <= 'f')) {
@@ -4448,6 +4473,10 @@ EfiVfrParser::_STOU64 (
if (c >= '0' && c <= '9') {
Value += (c - '0');
}
+ if((IsHex && ((Value/16) != PreviousValue)) || ((!IsHex && (Value/10) != PreviousValue))) {
+ sprintf(ErrorMsg, "Overflow: Value %s is too large to store in a UINT64", OrigString);
+ gCVfrErrorHandle.HandleWarning (VFR_WARNING_STRING_TO_UINT_OVERFLOW, LineNum, ErrorMsg);
+ }
}
return Value;
@@ -4457,14 +4486,15 @@ EFI_HII_DATE
EfiVfrParser::_STOD (
IN CHAR8 *Year,
IN CHAR8 *Month,
- IN CHAR8 *Day
+ IN CHAR8 *Day,
+ IN UINT32 LineNum
)
{
EFI_HII_DATE Date;
- Date.Year = _STOU16 (Year);
- Date.Month = _STOU8 (Month);
- Date.Day = _STOU8 (Day);
+ Date.Year = _STOU16 (Year, LineNum);
+ Date.Month = _STOU8 (Month, LineNum);
+ Date.Day = _STOU8 (Day, LineNum);
return Date;
}
@@ -4473,40 +4503,44 @@ EFI_HII_TIME
EfiVfrParser::_STOT (
IN CHAR8 *Hour,
IN CHAR8 *Minute,
- IN CHAR8 *Second
+ IN CHAR8 *Second,
+ IN UINT32 LineNum
)
{
EFI_HII_TIME Time;
- Time.Hour = _STOU8 (Hour);
- Time.Minute = _STOU8 (Minute);
- Time.Second = _STOU8 (Second);
+ Time.Hour = _STOU8 (Hour, LineNum);
+ Time.Minute = _STOU8 (Minute, LineNum);
+ Time.Second = _STOU8 (Second, LineNum);
return Time;
}
EFI_STRING_ID
EfiVfrParser::_STOSID (
- IN CHAR8 *Str
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
)
{
- return (EFI_STRING_ID)_STOU16(Str);
+ return (EFI_STRING_ID)_STOU16(Str, LineNum);
}
EFI_FORM_ID
EfiVfrParser::_STOFID (
- IN CHAR8 *Str
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
)
{
- return (EFI_FORM_ID)_STOU16(Str);
+ return (EFI_FORM_ID)_STOU16(Str, LineNum);
}
EFI_QUESTION_ID
EfiVfrParser::_STOQID (
- IN CHAR8 *Str
+ IN CHAR8 *Str,
+ IN UINT32 LineNum
)
{
- return (EFI_QUESTION_ID)_STOU16(Str);
+ return (EFI_QUESTION_ID)_STOU16(Str, LineNum);
}
VOID
@@ -4542,16 +4576,17 @@ EfiVfrParser::_STOR (
IN CHAR8 *QuestionId,
IN CHAR8 *FormId,
IN EFI_GUID *FormSetGuid,
- IN CHAR8 *DevicePath
+ IN CHAR8 *DevicePath,
+ IN UINT32 LineNum
)
{
EFI_HII_REF Ref;
UINT32 Index;
memcpy (&Ref.FormSetGuid, FormSetGuid, sizeof (EFI_GUID));
- Ref.QuestionId = _STOQID (QuestionId);
- Ref.FormId = _STOFID (FormId);
- Ref.DevicePath = _STOSID (DevicePath);
+ Ref.QuestionId = _STOQID (QuestionId, LineNum);
+ Ref.FormId = _STOFID (FormId, LineNum);
+ Ref.DevicePath = _STOSID (DevicePath, LineNum);
return Ref;
}
@@ -4755,7 +4790,7 @@ EfiVfrParser::AssignQuestionKey (
return;
}
- KeyValue = _STOU16 (KeyTok->getText());
+ KeyValue = _STOU16 (KeyTok->getText(), KeyTok->getLine());
if (QHObj.FLAGS () & EFI_IFR_FLAG_CALLBACK) {
/*
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 0f54c2a42..21d70199c 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 1999 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2014, 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
@@ -975,22 +975,24 @@ Returns:
UINT32 FileLength;
UINT8 FileState;
UINT8 Checksum;
- EFI_FFS_FILE_HEADER BlankHeader;
+ EFI_FFS_FILE_HEADER2 BlankHeader;
EFI_STATUS Status;
UINT8 GuidBuffer[PRINTED_GUID_BUFFER_SIZE];
+ UINT32 HeaderSize;
#if (PI_SPECIFICATION_VERSION < 0x00010000)
UINT16 *Tail;
#endif
//
// Check if we have free space
//
+ HeaderSize = FvBufGetFfsHeaderSize(FileHeader);
if (ErasePolarity) {
- memset (&BlankHeader, -1, sizeof (EFI_FFS_FILE_HEADER));
+ memset (&BlankHeader, -1, HeaderSize);
} else {
- memset (&BlankHeader, 0, sizeof (EFI_FFS_FILE_HEADER));
+ memset (&BlankHeader, 0, HeaderSize);
}
- if (memcmp (&BlankHeader, FileHeader, sizeof (EFI_FFS_FILE_HEADER)) == 0) {
+ if (memcmp (&BlankHeader, FileHeader, HeaderSize) == 0) {
return EFI_SUCCESS;
}
//
@@ -1008,7 +1010,7 @@ Returns:
// PrintGuid (&FileHeader->Name);
// printf ("\n");
//
- FileLength = GetLength (FileHeader->Size);
+ FileLength = FvBufGetFfsFileSize (FileHeader);
printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage));
printf ("File Length: 0x%08X\n", (unsigned) FileLength);
printf ("File Attributes: 0x%02X\n", FileHeader->Attributes);
@@ -1031,7 +1033,7 @@ Returns:
case EFI_FILE_HEADER_VALID:
printf (" EFI_FILE_HEADER_VALID\n");
- Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
+ Checksum = CalculateSum8 ((UINT8 *) FileHeader, HeaderSize);
Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
Checksum = (UINT8) (Checksum - FileHeader->State);
if (Checksum != 0) {
@@ -1053,7 +1055,7 @@ Returns:
//
// Calculate header checksum
//
- Checksum = CalculateSum8 ((UINT8 *) FileHeader, sizeof (EFI_FFS_FILE_HEADER));
+ Checksum = CalculateSum8 ((UINT8 *) FileHeader, HeaderSize);
Checksum = (UINT8) (Checksum - FileHeader->IntegrityCheck.Checksum.File);
Checksum = (UINT8) (Checksum - FileHeader->State);
if (Checksum != 0) {
@@ -1061,13 +1063,13 @@ Returns:
return EFI_ABORTED;
}
- FileLength = GetLength (FileHeader->Size);
+ FileLength = FvBufGetFfsFileSize (FileHeader);
if (FileHeader->Attributes & FFS_ATTRIB_CHECKSUM) {
//
// Calculate file checksum
//
- Checksum = CalculateSum8 ((UINT8 *) (FileHeader + 1), FileLength - sizeof (EFI_FFS_FILE_HEADER));
+ Checksum = CalculateSum8 ((UINT8 *)FileHeader + HeaderSize, FileLength - HeaderSize);
Checksum = Checksum + FileHeader->IntegrityCheck.Checksum.File;
if (Checksum != 0) {
Error (NULL, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer);
@@ -1180,8 +1182,8 @@ Returns:
// All other files have sections
//
Status = ParseSection (
- (UINT8 *) ((UINTN) FileHeader + sizeof (EFI_FFS_FILE_HEADER)),
- GetLength (FileHeader->Size) - sizeof (EFI_FFS_FILE_HEADER)
+ (UINT8 *) ((UINTN) FileHeader + HeaderSize),
+ FvBufGetFfsFileSize (FileHeader) - HeaderSize
);
if (EFI_ERROR (Status)) {
//
@@ -1225,6 +1227,7 @@ Returns:
EFI_SECTION_TYPE Type;
UINT8 *Ptr;
UINT32 SectionLength;
+ UINT32 SectionHeaderLen;
CHAR8 *SectionName;
EFI_STATUS Status;
UINT32 ParsedLength;
@@ -1246,6 +1249,10 @@ Returns:
CHAR8 *ToolOutputFile;
CHAR8 *SystemCommandFormatString;
CHAR8 *SystemCommand;
+ EFI_GUID *EfiGuid;
+ UINT16 DataOffset;
+ UINT16 Attributes;
+ UINT32 RealHdrLen;
ParsedLength = 0;
while (ParsedLength < BufferLength) {
@@ -1264,6 +1271,12 @@ Returns:
continue;
}
+ //
+ // Get real section file size
+ //
+ SectionLength = GetSectionFileLength ((EFI_COMMON_SECTION_HEADER *) Ptr);
+ SectionHeaderLen = GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
+
SectionName = SectionNameToStr (Type);
printf ("------------------------------------------------------------\n");
printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength);
@@ -1283,7 +1296,7 @@ Returns:
break;
case EFI_SECTION_FIRMWARE_VOLUME_IMAGE:
- Status = PrintFvInfo (((EFI_FIRMWARE_VOLUME_IMAGE_SECTION*)Ptr) + 1, TRUE);
+ Status = PrintFvInfo (Ptr + SectionHeaderLen, TRUE);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 0003, "printing of FV section contents failed", NULL);
return EFI_SECTION_ERROR;
@@ -1304,15 +1317,22 @@ Returns:
break;
case EFI_SECTION_VERSION:
- printf (" Build Number: 0x%02X\n", ((EFI_VERSION_SECTION *) Ptr)->BuildNumber);
- printf (" Version Strg: %s\n", (char*) ((EFI_VERSION_SECTION *) Ptr)->VersionString);
+ printf (" Build Number: 0x%02X\n", *(UINT16 *)(Ptr + SectionHeaderLen));
+ printf (" Version Strg: %s\n", (char*) (Ptr + SectionHeaderLen + sizeof (UINT16)));
break;
case EFI_SECTION_COMPRESSION:
UncompressedBuffer = NULL;
- CompressedLength = SectionLength - sizeof (EFI_COMPRESSION_SECTION);
- UncompressedLength = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength;
- CompressionType = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType;
+ if (SectionHeaderLen == sizeof (EFI_COMMON_SECTION_HEADER)) {
+ RealHdrLen = sizeof(EFI_COMPRESSION_SECTION);
+ UncompressedLength = ((EFI_COMPRESSION_SECTION *)Ptr)->UncompressedLength;
+ CompressionType = ((EFI_COMPRESSION_SECTION *)Ptr)->CompressionType;
+ } else {
+ RealHdrLen = sizeof(EFI_COMPRESSION_SECTION2);
+ UncompressedLength = ((EFI_COMPRESSION_SECTION2 *)Ptr)->UncompressedLength;
+ CompressionType = ((EFI_COMPRESSION_SECTION2 *)Ptr)->CompressionType;
+ }
+ CompressedLength = SectionLength - RealHdrLen;
printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength);
if (CompressionType == EFI_NOT_COMPRESSED) {
@@ -1328,13 +1348,13 @@ Returns:
return EFI_SECTION_ERROR;
}
- UncompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION);
+ UncompressedBuffer = Ptr + RealHdrLen;
} else if (CompressionType == EFI_STANDARD_COMPRESSION) {
GetInfoFunction = EfiGetInfo;
DecompressFunction = EfiDecompress;
printf (" Compression Type: EFI_STANDARD_COMPRESSION\n");
- CompressedBuffer = Ptr + sizeof (EFI_COMPRESSION_SECTION);
+ CompressedBuffer = Ptr + RealHdrLen;
Status = GetInfoFunction (CompressedBuffer, CompressedLength, &DstSize, &ScratchSize);
if (EFI_ERROR (Status)) {
@@ -1387,16 +1407,25 @@ Returns:
break;
case EFI_SECTION_GUID_DEFINED:
+ if (SectionHeaderLen == sizeof(EFI_COMMON_SECTION_HEADER)) {
+ EfiGuid = &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid;
+ DataOffset = ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset;
+ Attributes = ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes;
+ } else {
+ EfiGuid = &((EFI_GUID_DEFINED_SECTION2 *) Ptr)->SectionDefinitionGuid;
+ DataOffset = ((EFI_GUID_DEFINED_SECTION2 *) Ptr)->DataOffset;
+ Attributes = ((EFI_GUID_DEFINED_SECTION2 *) Ptr)->Attributes;
+ }
printf (" SectionDefinitionGuid: ");
- PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid);
+ PrintGuid (EfiGuid);
printf ("\n");
- printf (" DataOffset: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset);
- printf (" Attributes: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes);
+ printf (" DataOffset: 0x%04X\n", (unsigned) DataOffset);
+ printf (" Attributes: 0x%04X\n", (unsigned) Attributes);
ExtractionTool =
LookupGuidedSectionToolPath (
mParsedGuidedSectionTools,
- &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid
+ EfiGuid
);
if (ExtractionTool != NULL) {
@@ -1427,8 +1456,8 @@ Returns:
Status =
PutFileImage (
ToolInputFile,
- (CHAR8*) SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset,
- BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset
+ (CHAR8*) SectionBuffer + DataOffset,
+ BufferLength - DataOffset
);
system (SystemCommand);
@@ -1461,7 +1490,7 @@ Returns:
// Check for CRC32 sections which we can handle internally if needed.
//
} else if (!CompareGuid (
- &((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid,
+ EfiGuid,
&gEfiCrc32GuidedSectionExtractionProtocolGuid
)
) {
@@ -1469,8 +1498,8 @@ Returns:
// CRC32 guided section
//
Status = ParseSection (
- SectionBuffer + ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset,
- BufferLength - ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset
+ SectionBuffer + DataOffset,
+ BufferLength - DataOffset
);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 0003, "parse of CRC32 GUIDED section failed", NULL);
@@ -1540,8 +1569,8 @@ Returns:
return EFI_SUCCESS;
}
- Ptr += sizeof (EFI_COMMON_SECTION_HEADER);
- SectionLength -= sizeof (EFI_COMMON_SECTION_HEADER);
+ Ptr += GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
+ SectionLength -= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);
while (SectionLength > 0) {
printf (" ");
switch (*Ptr) {
@@ -1809,7 +1838,7 @@ Returns:
//
// Copyright declaration
//
- fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
+ fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
//
// Details Option
diff --git a/BaseTools/Source/Python/Common/BuildVersion.py b/BaseTools/Source/Python/Common/BuildVersion.py
index bfd4d43bb..e178a4a61 100644
--- a/BaseTools/Source/Python/Common/BuildVersion.py
+++ b/BaseTools/Source/Python/Common/BuildVersion.py
@@ -13,4 +13,4 @@
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
-gBUILD_VERSION = "Build 2649"
+gBUILD_VERSION = "Build 2670"
diff --git a/BaseTools/Source/Python/Common/Parsing.py b/BaseTools/Source/Python/Common/Parsing.py
index 5bea6941f..584fc7f3c 100644
--- a/BaseTools/Source/Python/Common/Parsing.py
+++ b/BaseTools/Source/Python/Common/Parsing.py
@@ -1,7 +1,7 @@
## @file
# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process
#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2014, 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
@@ -877,3 +877,38 @@ def GenMetaDatSectionItem(Key, Value, List):
List[Key] = [Value]
else:
List[Key].append(Value)
+
+## IsValidWord
+#
+# Check whether the word is valid.
+# <Word> ::= (a-zA-Z0-9_)(a-zA-Z0-9_-){0,} Alphanumeric characters with
+# optional
+# dash "-" and/or underscore "_" characters. No whitespace
+# characters are permitted.
+#
+# @param Word: The word string need to be checked.
+#
+def IsValidWord(Word):
+ if not Word:
+ return False
+ #
+ # The first char should be alpha, _ or Digit.
+ #
+ if not Word[0].isalnum() and \
+ not Word[0] == '_' and \
+ not Word[0].isdigit():
+ return False
+
+ LastChar = ''
+ for Char in Word[1:]:
+ if (not Char.isalpha()) and \
+ (not Char.isdigit()) and \
+ Char != '-' and \
+ Char != '_' and \
+ Char != '.':
+ return False
+ if Char == '.' and LastChar == '.':
+ return False
+ LastChar = Char
+
+ return True
diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py
index 0ba8d732d..4f93d7966 100644
--- a/BaseTools/Source/Python/Ecc/Configuration.py
+++ b/BaseTools/Source/Python/Ecc/Configuration.py
@@ -1,7 +1,7 @@
## @file
# This file is used to define class Configuration
#
-# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2014, 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
@@ -247,6 +247,9 @@ class Configuration(object):
# A list for binary file ext name
self.BinaryExtList = []
+
+ # A list for only scanned folders
+ self.ScanOnlyDirList = []
self.ParseConfig()
diff --git a/BaseTools/Source/Python/Ecc/Ecc.py b/BaseTools/Source/Python/Ecc/Ecc.py
index b1a0ab827..b5d733e48 100644
--- a/BaseTools/Source/Python/Ecc/Ecc.py
+++ b/BaseTools/Source/Python/Ecc/Ecc.py
@@ -1,7 +1,7 @@
## @file
# This file is used to be the main entrance of ECC tool
#
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2009 - 2014, 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
@@ -59,6 +59,7 @@ class Ecc(object):
self.ScanSourceCode = True
self.ScanMetaData = True
self.MetaFile = ''
+ self.OnlyScan = None
# Parse the options and args
self.ParseOption()
@@ -113,8 +114,9 @@ class Ecc(object):
GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace)
# Build ECC database
- self.BuildDatabase()
-
+# self.BuildDatabase()
+ self.DetectOnlyScanDirs()
+
# Start to check
self.Check()
@@ -133,11 +135,30 @@ class Ecc(object):
return
self.ConfigFile = 'config.ini'
+
+ ## DetectOnlyScan
+ #
+ # Detect whether only scanned folders have been enabled
+ #
+ def DetectOnlyScanDirs(self):
+ if self.OnlyScan == True:
+ OnlyScanDirs = []
+ # Use regex here if multiple spaces or TAB exists in ScanOnlyDirList in config.ini file
+ for folder in re.finditer(r'\S+', EccGlobalData.gConfig.ScanOnlyDirList):
+ OnlyScanDirs.append(folder.group())
+ if len(OnlyScanDirs) != 0:
+ self.BuildDatabase(OnlyScanDirs)
+ else:
+ EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Use -f option need to fill specific folders in config.ini file")
+ else:
+ self.BuildDatabase()
+
+
## BuildDatabase
#
# Build the database for target
#
- def BuildDatabase(self):
+ def BuildDatabase(self, SpeciDirs = None):
# Clean report table
EccGlobalData.gDb.TblReport.Drop()
EccGlobalData.gDb.TblReport.Create()
@@ -146,10 +167,14 @@ class Ecc(object):
if self.IsInit:
if self.ScanMetaData:
EdkLogger.quiet("Building database for Meta Data File ...")
- self.BuildMetaDataFileDatabase()
+ self.BuildMetaDataFileDatabase(SpeciDirs)
if self.ScanSourceCode:
EdkLogger.quiet("Building database for Meta Data File Done!")
- c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
+ if SpeciDirs == None:
+ c.CollectSourceCodeDataIntoDB(EccGlobalData.gTarget)
+ else:
+ for specificDir in SpeciDirs:
+ c.CollectSourceCodeDataIntoDB(os.path.join(EccGlobalData.gTarget, specificDir))
EccGlobalData.gIdentifierTableList = GetTableList((MODEL_FILE_C, MODEL_FILE_H), 'Identifier', EccGlobalData.gDb)
EccGlobalData.gCFileList = GetFileList(MODEL_FILE_C, EccGlobalData.gDb)
@@ -159,59 +184,67 @@ class Ecc(object):
#
# Build the database for meta data files
#
- def BuildMetaDataFileDatabase(self):
+ def BuildMetaDataFileDatabase(self, SpecificDirs = None):
+ ScanFolders = []
+ if SpecificDirs == None:
+ ScanFolders.append(EccGlobalData.gTarget)
+ else:
+ for specificDir in SpecificDirs:
+ ScanFolders.append(os.path.join(EccGlobalData.gTarget, specificDir))
EdkLogger.quiet("Building database for meta data files ...")
Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+')
#SkipDirs = Read from config file
SkipDirs = EccGlobalData.gConfig.SkipDirList
SkipDirString = string.join(SkipDirs, '|')
- p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
- for Root, Dirs, Files in os.walk(EccGlobalData.gTarget):
- if p.match(Root.upper()):
- continue
- for Dir in Dirs:
- Dirname = os.path.join(Root, Dir)
- if os.path.islink(Dirname):
- Dirname = os.path.realpath(Dirname)
- if os.path.isdir(Dirname):
- # symlinks to directories are treated as directories
- Dirs.remove(Dir)
- Dirs.append(Dirname)
-
- for File in Files:
- if len(File) > 4 and File[-4:].upper() == ".DEC":
- Filename = os.path.normpath(os.path.join(Root, File))
- EdkLogger.quiet("Parsing %s" % Filename)
- Op.write("%s\r" % Filename)
- #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
- self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
- self.MetaFile.Start()
- continue
- if len(File) > 4 and File[-4:].upper() == ".DSC":
- Filename = os.path.normpath(os.path.join(Root, File))
- EdkLogger.quiet("Parsing %s" % Filename)
- Op.write("%s\r" % Filename)
- #Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
- self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
- # alwasy do post-process, in case of macros change
- self.MetaFile.DoPostProcess()
- self.MetaFile.Start()
- self.MetaFile._PostProcess()
- continue
- if len(File) > 4 and File[-4:].upper() == ".INF":
- Filename = os.path.normpath(os.path.join(Root, File))
- EdkLogger.quiet("Parsing %s" % Filename)
- Op.write("%s\r" % Filename)
- #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
- self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
- self.MetaFile.Start()
- continue
- if len(File) > 4 and File[-4:].upper() == ".FDF":
- Filename = os.path.normpath(os.path.join(Root, File))
- EdkLogger.quiet("Parsing %s" % Filename)
- Op.write("%s\r" % Filename)
- Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+# p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
+ p = re.compile(r'.*[\\/](?:%s^\S)[\\/]?.*' % SkipDirString)
+ for scanFolder in ScanFolders:
+ for Root, Dirs, Files in os.walk(scanFolder):
+ if p.match(Root.upper()):
continue
+ for Dir in Dirs:
+ Dirname = os.path.join(Root, Dir)
+ if os.path.islink(Dirname):
+ Dirname = os.path.realpath(Dirname)
+ if os.path.isdir(Dirname):
+ # symlinks to directories are treated as directories
+ Dirs.remove(Dir)
+ Dirs.append(Dirname)
+
+ for File in Files:
+ if len(File) > 4 and File[-4:].upper() == ".DEC":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = DecParser(Filename, MODEL_FILE_DEC, EccGlobalData.gDb.TblDec)
+ self.MetaFile.Start()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".DSC":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Dsc(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = DscParser(PathClass(Filename, Root), MODEL_FILE_DSC, MetaFileStorage(EccGlobalData.gDb.TblDsc.Cur, Filename, MODEL_FILE_DSC, True))
+ # alwasy do post-process, in case of macros change
+ self.MetaFile.DoPostProcess()
+ self.MetaFile.Start()
+ self.MetaFile._PostProcess()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".INF":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ self.MetaFile = InfParser(Filename, MODEL_FILE_INF, EccGlobalData.gDb.TblInf)
+ self.MetaFile.Start()
+ continue
+ if len(File) > 4 and File[-4:].upper() == ".FDF":
+ Filename = os.path.normpath(os.path.join(Root, File))
+ EdkLogger.quiet("Parsing %s" % Filename)
+ Op.write("%s\r" % Filename)
+ Fdf(Filename, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
+ continue
Op.close()
# Commit to database
@@ -321,6 +354,8 @@ class Ecc(object):
self.ScanSourceCode = False
if Options.sourcecode != None:
self.ScanMetaData = False
+ if Options.folders != None:
+ self.OnlyScan = True
## SetLogLevel
#
@@ -371,6 +406,7 @@ class Ecc(object):
"and warning messages, etc.")
Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
Parser.add_option("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.")
+ Parser.add_option("-f", "--folders", action="store_true", type=None, help="Only scanning specified folders which are recorded in config.ini file.")
(Opt, Args)=Parser.parse_args()
diff --git a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
index 6da2b6bab..405c5b5b0 100644
--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
@@ -1,7 +1,7 @@
## @file
# This file is used to parse meta files
#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2008 - 2014, 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
@@ -1054,7 +1054,7 @@ class DscParser(MetaFileParser):
## Override parent's method since we'll do all macro replacements in parser
def _GetMacros(self):
- Macros = {}
+ Macros = dict( [('ARCH','IA32'), ('FAMILY','MSFT'),('TOOL_CHAIN_TAG','VS2008x86'),('TARGET','DEBUG')])
Macros.update(self._FileLocalMacros)
Macros.update(self._GetApplicableSectionMacro())
Macros.update(GlobalData.gEdkGlobal)
diff --git a/BaseTools/Source/Python/Ecc/config.ini b/BaseTools/Source/Python/Ecc/config.ini
index c55276fce..436fe4b09 100644
--- a/BaseTools/Source/Python/Ecc/config.ini
+++ b/BaseTools/Source/Python/Ecc/config.ini
@@ -2,7 +2,7 @@
# This file is used to set configuration of ECC tool
# For the items listed below, 1 means valid, 0 means invalid
#
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2014, 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
@@ -255,3 +255,5 @@ MetaDataFileCheckModuleFileGuidDuplication = 1
# A list for binary file ext name
BinaryExtList = EXE, EFI, FV, ROM, DLL, COM, BMP, GIF, PYD, CMP, BIN, JPG, UNI, RAW, COM2, LIB, DEPEX, SYS, DB
+# A list for only scanning dirs, the dirs should be the top folder(s) under workspace
+ScanOnlyDirList = ScanFolder1 ScanFolder2
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index 058fa0c6a..c0762edf2 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -36,6 +36,7 @@ from Common import EdkLogger
from Common.String import *
from Common.Misc import DirCache,PathClass
from Common.Misc import SaveFileOnChange
+from Common.Misc import GuidStructureStringToGuidString
from Common.BuildVersion import gBUILD_VERSION
## Version and Copyright
@@ -511,11 +512,23 @@ class GenFds :
def GenerateGuidXRefFile(BuildDb, ArchList):
GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
GuidXRefFile = StringIO.StringIO('')
+ GuidDict = {}
for Arch in ArchList:
PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
for ModuleFile in PlatformDataBase.Modules:
Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+ for key, item in Module.Protocols.items():
+ GuidDict[key] = item
+ for key, item in Module.Guids.items():
+ GuidDict[key] = item
+ for key, item in Module.Ppis.items():
+ GuidDict[key] = item
+ # Append GUIDs, Protocols, and PPIs to the Xref file
+ GuidXRefFile.write("\n")
+ for key, item in GuidDict.items():
+ GuidXRefFile.write("%s %s\n" % (GuidStructureStringToGuidString(item).upper(), key))
+
if GuidXRefFile.getvalue():
SaveFileOnChange(GuidXRefFileName, GuidXRefFile.getvalue(), False)
GenFdsGlobalVariable.InfLogger("\nGUID cross reference file can be found at %s" % GuidXRefFileName)
diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
index b6227d24f..9cfdad317 100644
--- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
+++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py
@@ -53,7 +53,9 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath):
return None
if len(lines) == 0: return None
- if lines[0].strip().find("Archive member included because of file (symbol)") != -1:
+ firstline = lines[0].strip()
+ if (firstline.startswith("Archive member included ") and
+ firstline.endswith(" file (symbol)")):
return _parseForGCC(lines, efifilepath)
return _parseGeneral(lines, efifilepath)
diff --git a/BaseTools/Source/Python/UPT/BuildVersion.py b/BaseTools/Source/Python/UPT/BuildVersion.py
index 8b86b37e3..2cf0923cf 100644
--- a/BaseTools/Source/Python/UPT/BuildVersion.py
+++ b/BaseTools/Source/Python/UPT/BuildVersion.py
@@ -17,4 +17,4 @@
Build version information
'''
-gBUILD_VERSION = "Build 2649"
+gBUILD_VERSION = "Build 2670"
diff --git a/BaseTools/Source/Python/UPT/Library/String.py b/BaseTools/Source/Python/UPT/Library/String.py
index 0953e47cb..f709ff1bc 100644
--- a/BaseTools/Source/Python/UPT/Library/String.py
+++ b/BaseTools/Source/Python/UPT/Library/String.py
@@ -2,7 +2,7 @@
# This file is used to define common string related functions used in parsing
# process
#
-# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2014, 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
@@ -937,3 +937,29 @@ def SplitPcdEntry(String):
return ['', '', ''], False
return ['', '', ''], False
+
+## Check if two arches matched?
+#
+# @param Arch1
+# @param Arch2
+#
+def IsMatchArch(Arch1, Arch2):
+ if 'COMMON' in Arch1 or 'COMMON' in Arch2:
+ return True
+ if isinstance(Arch1, basestring) and isinstance(Arch2, basestring):
+ if Arch1 == Arch2:
+ return True
+
+ if isinstance(Arch1, basestring) and isinstance(Arch2, list):
+ return Arch1 in Arch2
+
+ if isinstance(Arch2, basestring) and isinstance(Arch1, list):
+ return Arch2 in Arch1
+
+ if isinstance(Arch1, list) and isinstance(Arch2, list):
+ for Item1 in Arch1:
+ for Item2 in Arch2:
+ if Item1 == Item2:
+ return True
+
+ return False
diff --git a/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py b/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
index a913a859f..9e141cabb 100644
--- a/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
+++ b/BaseTools/Source/Python/UPT/Xml/ModuleSurfaceAreaXml.py
@@ -1,7 +1,7 @@
## @file
# This file is used to parse a Module file of .PKG file
#
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2014, 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
@@ -20,6 +20,7 @@ from xml.dom import minidom
from Library.String import ConvertNEToNOTEQ
from Library.String import ConvertNOTEQToNE
from Library.String import GetStringOfList
+from Library.String import IsMatchArch
from Library.Xml.XmlRoutines import XmlElement
from Library.Xml.XmlRoutines import XmlAttribute
from Library.Xml.XmlRoutines import XmlNode
@@ -128,9 +129,11 @@ class BinaryFileXml(object):
pass
NodeList = []
FilenameList = BinaryFile.GetFileNameList()
+ SupportArch = None
for Filename in FilenameList:
Tmp = FilenameXml()
NodeList.append(Tmp.ToXml(Filename, 'Filename'))
+ SupportArch = Filename.SupArchList
if GlobalData.gIS_BINARY_INF:
AsBuildList = BinaryFile.GetAsBuiltList()
@@ -142,12 +145,14 @@ class BinaryFileXml(object):
AsBuiltNodeList = []
for Pcd in PatchPcdValueList:
- Tmp = PcdEntryXml()
- AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue'))
+ if IsMatchArch(Pcd.SupArchList, SupportArch):
+ Tmp = PcdEntryXml()
+ AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PatchPcdValue'))
for Pcd in PcdExList:
- Tmp = PcdEntryXml()
- AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue'))
+ if IsMatchArch(Pcd.SupArchList, SupportArch):
+ Tmp = PcdEntryXml()
+ AsBuiltNodeList.append(Tmp.ToXml4(Pcd, 'PcdExValue'))
GuiVerElemList = []
for LibGuidVer in LibGuidVerList:
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 3444e4f05..6ebb7ee87 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -37,6 +37,7 @@ from BuildClassObject import *
from WorkspaceCommon import GetDeclaredPcd
from Common.Misc import AnalyzeDscPcd
import re
+from Common.Parsing import IsValidWord
## Platform build information from DSC file
#
@@ -893,13 +894,23 @@ class DscBuildData(PlatformBuildClassObject):
VariableName, VariableGuid, VariableOffset, DefaultValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4)
ExceedMax = False
+ FormatCorrect = True
if VariableOffset.isdigit():
if int(VariableOffset,10) > 0xFFFF:
ExceedMax = True
elif re.match(r'[\t\s]*0[xX][a-fA-F0-9]+$',VariableOffset):
if int(VariableOffset,16) > 0xFFFF:
ExceedMax = True
+ # For Offset written in "A.B"
+ elif VariableOffset.find('.') > -1:
+ VariableOffsetList = VariableOffset.split(".")
+ if not (len(VariableOffsetList) == 2
+ and IsValidWord(VariableOffsetList[0])
+ and IsValidWord(VariableOffsetList[1])):
+ FormatCorrect = False
else:
+ FormatCorrect = False
+ if not FormatCorrect:
EdkLogger.error('Build', FORMAT_INVALID, "Invalid syntax or format of the variable offset value is incorrect for %s." % ".".join((TokenSpaceGuid,PcdCName)))
if ExceedMax: