def SetInfVersion(self, InfVersion, Comments):
        #
        # Value has been set before.
        #
        if self.InfVersion != None:
            ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND\
                       %(DT.TAB_INF_DEFINES_INF_VERSION),
                       LineInfo=self.CurrentLine)
            return False
        #
        # The InfVersion should be 4 bytes hex string.
        #
        if (IsValidHex(InfVersion)):
            if (InfVersion < '0x00010005'):
                ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
                           ErrorCode=ToolError.EDK1_INF_ERROR,
                           LineInfo=self.CurrentLine)
        elif IsValidDecVersionVal(InfVersion):
            if (InfVersion < 65541):
                ErrorInInf(ST.ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF,
                           ErrorCode=ToolError.EDK1_INF_ERROR,
                           LineInfo=self.CurrentLine)
        else:
            ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID % (InfVersion),
                       LineInfo=self.CurrentLine)
            return False

        self.InfVersion = InfDefMember()
        self.InfVersion.SetValue(InfVersion)
        self.InfVersion.Comments = Comments
        return True
Esempio n. 2
0
 def SetPciRevision(self, PciRevision, Comments):
     #
     # Value has been set before.
     #
     if self.PciRevision is not None:
         ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_REVISION),
                    LineInfo=self.CurrentLine)
         return False          
     #
     # The PciRevision should be 4 bytes hex string.  
     #
     if (IsValidHex(PciRevision)):
         self.PciRevision = InfDefMember()
         self.PciRevision.SetValue(PciRevision)
         self.PciRevision.Comments = Comments
         return True
     else:
         ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciRevision),
                    LineInfo=self.CurrentLine)
         return False
Esempio n. 3
0
 def SetPciDeviceId(self, PciDeviceId, Comments):
     #
     # Value has been set before.
     #
     if self.PciDeviceId is not None:
         ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_DEVICE_ID),
                    LineInfo=self.CurrentLine)
         return False         
     #
     # The PciDeviceId should be hex string.  
     #
     if (IsValidHex(PciDeviceId)):
         self.PciDeviceId = InfDefMember()
         self.PciDeviceId.SetValue(PciDeviceId)
         self.PciDeviceId.Comments = Comments            
         return True
     else:
         ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%(PciDeviceId),
                    LineInfo=self.CurrentLine)
         return False
Esempio n. 4
0
 def SetPciClassCode(self, PciClassCode, Comments):
     #
     # Value has been set before.
     #
     if self.PciClassCode is not None:
         ErrorInInf(ST.ERR_INF_PARSER_DEFINE_ITEM_MORE_THAN_ONE_FOUND%(DT.TAB_INF_DEFINES_PCI_CLASS_CODE),
                    LineInfo=self.CurrentLine)
         return False        
     #
     # The PciClassCode should be 4 bytes hex string.  
     #
     if (IsValidHex(PciClassCode)):
         self.PciClassCode = InfDefMember()
         self.PciClassCode.SetValue(PciClassCode)
         self.PciClassCode.Comments = Comments
         return True
     else:
         ErrorInInf(ST.ERR_INF_PARSER_DEFINE_FROMAT_INVALID%\
                    (PciClassCode),
                    LineInfo=self.CurrentLine)
         return False