- ## __GetVtf() method\r
- #\r
- # Get VTF section contents and store its data into VTF list of self.Profile\r
- #\r
- # @param self The object pointer\r
- # @retval True Successfully find a VTF\r
- # @retval False Not able to find a VTF\r
- #\r
- def __GetVtf(self):\r
- if not self.__GetNextToken():\r
- return False\r
-\r
- S = self.__Token.upper()\r
- if S.startswith("[") and not S.startswith("[VTF."):\r
- self.SectionParser(S)\r
- self.__UndoToken()\r
- return False\r
-\r
- self.__UndoToken()\r
- if not self.__IsToken("[VTF.", True):\r
- FileLineTuple = GetRealFileLine(self.FileName, self.CurrentLineNumber)\r
- #print 'Parsing String: %s in File %s, At line: %d, Offset Within Line: %d' \\r
- # % (self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine :], FileLineTuple[0], FileLineTuple[1], self.CurrentOffsetWithinLine)\r
- raise Warning("expected [VTF.]", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__SkipToToken("."):\r
- raise Warning("expected '.'", self.FileName, self.CurrentLineNumber)\r
-\r
- Arch = self.__SkippedChars.rstrip(".").upper()\r
- if Arch not in ("IA32", "X64", "IPF", "ARM", "AARCH64"):\r
- raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__GetNextWord():\r
- raise Warning("expected VTF name", self.FileName, self.CurrentLineNumber)\r
- Name = self.__Token.upper()\r
-\r
- VtfObj = Vtf.Vtf()\r
- VtfObj.UiName = Name\r
- VtfObj.KeyArch = Arch\r
-\r
- if self.__IsToken(","):\r
- if not self.__GetNextWord():\r
- raise Warning("expected Arch list", self.FileName, self.CurrentLineNumber)\r
- if self.__Token.upper() not in ("IA32", "X64", "IPF", "ARM", "AARCH64"):\r
- raise Warning("Unknown Arch '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
- VtfObj.ArchList = self.__Token.upper()\r
-\r
- if not self.__IsToken( "]"):\r
- raise Warning("expected ']'", self.FileName, self.CurrentLineNumber)\r
-\r
- if self.__IsKeyword("IA32_RST_BIN"):\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__GetNextToken():\r
- raise Warning("expected Reset file", self.FileName, self.CurrentLineNumber)\r
-\r
- VtfObj.ResetBin = self.__Token\r
- if VtfObj.ResetBin.replace('$(WORKSPACE)', '').find('$') == -1:\r
- #check for file path\r
- ErrorCode, ErrorInfo = PathClass(NormPath(VtfObj.ResetBin), GenFdsGlobalVariable.WorkSpaceDir).Validate()\r
- if ErrorCode != 0:\r
- EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)\r
-\r
- while self.__GetComponentStatement(VtfObj):\r
- pass\r
-\r
- self.Profile.VtfList.append(VtfObj)\r
- return True\r
-\r
- ## __GetComponentStatement() method\r
- #\r
- # Get components in VTF\r
- #\r
- # @param self The object pointer\r
- # @param VtfObj for whom component is got\r
- # @retval True Successfully find a component\r
- # @retval False Not able to find a component\r
- #\r
- def __GetComponentStatement(self, VtfObj):\r
- if not self.__IsKeyword("COMP_NAME"):\r
- return False\r
-\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__GetNextWord():\r
- raise Warning("expected Component Name", self.FileName, self.CurrentLineNumber)\r
-\r
- CompStatementObj = ComponentStatement.ComponentStatement()\r
- CompStatementObj.CompName = self.__Token\r
-\r
- if not self.__IsKeyword("COMP_LOC"):\r
- raise Warning("expected COMP_LOC", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- CompStatementObj.CompLoc = ""\r
- if self.__GetNextWord():\r
- CompStatementObj.CompLoc = self.__Token\r
- if self.__IsToken('|'):\r
- if not self.__GetNextWord():\r
- raise Warning("Expected Region Name", self.FileName, self.CurrentLineNumber)\r
-\r
- if self.__Token not in ("F", "N", "S"): #, "H", "L", "PH", "PL"): not support\r
- raise Warning("Unknown location type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
-\r
- CompStatementObj.FilePos = self.__Token\r
- else:\r
- self.CurrentLineNumber += 1\r
- self.CurrentOffsetWithinLine = 0\r
-\r
- if not self.__IsKeyword("COMP_TYPE"):\r
- raise Warning("expected COMP_TYPE", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__GetNextToken():\r
- raise Warning("expected Component type", self.FileName, self.CurrentLineNumber)\r
- if self.__Token not in ("FIT", "PAL_B", "PAL_A", "OEM"):\r
- if not self.__Token.startswith("0x") or len(self.__Token) < 3 or len(self.__Token) > 4 or \\r
- not self.__Token[2] in string.hexdigits or not self.__Token[-1] in string.hexdigits:\r
- raise Warning("Unknown location type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
- CompStatementObj.CompType = self.__Token\r
-\r
- if not self.__IsKeyword("COMP_VER"):\r
- raise Warning("expected COMP_VER", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__GetNextToken():\r
- raise Warning("expected Component version", self.FileName, self.CurrentLineNumber)\r
-\r
- Pattern = re.compile('-$|[0-9a-fA-F]{1,2}\.[0-9a-fA-F]{1,2}$', re.DOTALL)\r
- if Pattern.match(self.__Token) is None:\r
- raise Warning("Unknown version format '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
- CompStatementObj.CompVer = self.__Token\r
-\r
- if not self.__IsKeyword("COMP_CS"):\r
- raise Warning("expected COMP_CS", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__GetNextToken():\r
- raise Warning("expected Component CS", self.FileName, self.CurrentLineNumber)\r
- if self.__Token not in ("1", "0"):\r
- raise Warning("Unknown Component CS '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
- CompStatementObj.CompCs = self.__Token\r
-\r
-\r
- if not self.__IsKeyword("COMP_BIN"):\r
- raise Warning("expected COMP_BIN", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__GetNextToken():\r
- raise Warning("expected Component file", self.FileName, self.CurrentLineNumber)\r
-\r
- CompStatementObj.CompBin = self.__Token\r
- if CompStatementObj.CompBin != '-' and CompStatementObj.CompBin.replace('$(WORKSPACE)', '').find('$') == -1:\r
- #check for file path\r
- ErrorCode, ErrorInfo = PathClass(NormPath(CompStatementObj.CompBin), GenFdsGlobalVariable.WorkSpaceDir).Validate()\r
- if ErrorCode != 0:\r
- EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)\r
-\r
- if not self.__IsKeyword("COMP_SYM"):\r
- raise Warning("expected COMP_SYM", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__GetNextToken():\r
- raise Warning("expected Component symbol file", self.FileName, self.CurrentLineNumber)\r
-\r
- CompStatementObj.CompSym = self.__Token\r
- if CompStatementObj.CompSym != '-' and CompStatementObj.CompSym.replace('$(WORKSPACE)', '').find('$') == -1:\r
- #check for file path\r
- ErrorCode, ErrorInfo = PathClass(NormPath(CompStatementObj.CompSym), GenFdsGlobalVariable.WorkSpaceDir).Validate()\r
- if ErrorCode != 0:\r
- EdkLogger.error("GenFds", ErrorCode, ExtraData=ErrorInfo)\r
-\r
- if not self.__IsKeyword("COMP_SIZE"):\r
- raise Warning("expected COMP_SIZE", self.FileName, self.CurrentLineNumber)\r
-\r
- if not self.__IsToken("="):\r
- raise Warning("expected '='", self.FileName, self.CurrentLineNumber)\r
-\r
- if self.__IsToken("-"):\r
- CompStatementObj.CompSize = self.__Token\r
- elif self.__GetNextDecimalNumber():\r
- CompStatementObj.CompSize = self.__Token\r
- elif self.__GetNextHexNumber():\r
- CompStatementObj.CompSize = self.__Token\r
- else:\r
- raise Warning("Unknown size '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
-\r
- VtfObj.ComponentStatementList.append(CompStatementObj)\r
- return True\r
-\r
- ## __GetOptionRom() method\r