From 25918452ed5e9d12ea56b3bb2193df9ab96666b1 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Wed, 23 May 2012 08:27:14 +0000 Subject: Sync BaseTools Trunk (version r2524) to EDKII main trunk. Signed-off-by: Liming Gao Reviewed-by: Liu Yingke Reviewed-by: Yurui Zeng git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13353 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/GenFds/FdfParser.py | 29 ++++++++++++++++----------- BaseTools/Source/Python/GenFds/GuidSection.py | 7 +++++-- 2 files changed, 22 insertions(+), 14 deletions(-) (limited to 'BaseTools/Source/Python/GenFds') diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index dc5c4fa034..c9c620d853 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -2867,6 +2867,7 @@ class FdfParser: GuidSectionObj.SectionType = "GUIDED" GuidSectionObj.ProcessRequired = AttribDict["PROCESSING_REQUIRED"] GuidSectionObj.AuthStatusValid = AttribDict["AUTH_STATUS_VALID"] + GuidSectionObj.ExtraHeaderSize = AttribDict["EXTRA_HEADER_SIZE"] # Recursive sections... while True: IsLeafSection = self.__GetLeafSection(GuidSectionObj) @@ -2894,23 +2895,26 @@ class FdfParser: AttribDict = {} AttribDict["PROCESSING_REQUIRED"] = "NONE" AttribDict["AUTH_STATUS_VALID"] = "NONE" - if self.__IsKeyword("PROCESSING_REQUIRED") or self.__IsKeyword("AUTH_STATUS_VALID"): + AttribDict["EXTRA_HEADER_SIZE"] = -1 + while self.__IsKeyword("PROCESSING_REQUIRED") or self.__IsKeyword("AUTH_STATUS_VALID") \ + or self.__IsKeyword("EXTRA_HEADER_SIZE"): AttribKey = self.__Token if not self.__IsToken("="): raise Warning("expected '='", self.FileName, self.CurrentLineNumber) - if not self.__GetNextToken() or self.__Token.upper() not in ("TRUE", "FALSE", "1", "0"): - raise Warning("expected TRUE/FALSE (1/0)", self.FileName, self.CurrentLineNumber) - AttribDict[AttribKey] = self.__Token - - if self.__IsKeyword("PROCESSING_REQUIRED") or self.__IsKeyword("AUTH_STATUS_VALID"): - AttribKey = self.__Token - - if not self.__IsToken("="): - raise Warning("expected '='") - - if not self.__GetNextToken() or self.__Token.upper() not in ("TRUE", "FALSE", "1", "0"): + if not self.__GetNextToken(): + raise Warning("expected TRUE(1)/FALSE(0)/Number", self.FileName, self.CurrentLineNumber) + elif AttribKey == "EXTRA_HEADER_SIZE": + Base = 10 + if self.__Token[0:2].upper() == "0X": + Base = 16 + try: + AttribDict[AttribKey] = int(self.__Token, Base) + continue + except ValueError: + raise Warning("expected Number", self.FileName, self.CurrentLineNumber) + elif self.__Token.upper() not in ("TRUE", "FALSE", "1", "0"): raise Warning("expected TRUE/FALSE (1/0)", self.FileName, self.CurrentLineNumber) AttribDict[AttribKey] = self.__Token @@ -3712,6 +3716,7 @@ class FdfParser: GuidSectionObj.SectionType = "GUIDED" GuidSectionObj.ProcessRequired = AttribDict["PROCESSING_REQUIRED"] GuidSectionObj.AuthStatusValid = AttribDict["AUTH_STATUS_VALID"] + GuidSectionObj.ExtraHeaderSize = AttribDict["EXTRA_HEADER_SIZE"] # Efi sections... while True: diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Source/Python/GenFds/GuidSection.py index bd95f56720..36ad4f58ef 100644 --- a/BaseTools/Source/Python/GenFds/GuidSection.py +++ b/BaseTools/Source/Python/GenFds/GuidSection.py @@ -193,7 +193,10 @@ class GuidSection(GuidSectionClassObject) : Attribute = [] HeaderLength = None - if self.ProcessRequired == "NONE": + if self.ExtraHeaderSize != -1: + HeaderLength = str(self.ExtraHeaderSize) + + if self.ProcessRequired == "NONE" and HeaderLength == None: if TempFileSize > InputFileSize and TempFileSize % 4 == 0: FileHandleIn.seek(0) BufferIn = FileHandleIn.read() @@ -218,7 +221,7 @@ class GuidSection(GuidSectionClassObject) : if self.ProcessRequired in ("TRUE", "1"): if 'PROCESSING_REQUIRED' not in Attribute: Attribute.append('PROCESSING_REQUIRED') - HeaderLength = None + if self.AuthStatusValid in ("TRUE", "1"): Attribute.append('AUTH_STATUS_VALID') GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'], -- cgit v1.2.3