]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/OptRomInfStatement.py
BaseTools: Move OverrideAttribs to OptRomInfStatement.py
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / OptRomInfStatement.py
index 8f8761b20589280ab701daa46cd4cb2c637dac78..e416b838d1e45b354bbdd0a60f354d0ed96a7dd4 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process OptionROM generation from INF statement\r
 #\r
-#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 ##\r
 # Import Modules\r
 #\r
-import RuleSimpleFile\r
-import RuleComplexFile\r
-import Section\r
-import OptionRom\r
+from __future__ import absolute_import\r
+from . import RuleSimpleFile\r
+from . import RuleComplexFile\r
+from . import Section\r
 import Common.GlobalData as GlobalData\r
 \r
 from Common.DataType import *\r
-from Common.String import *\r
-from FfsInfStatement import FfsInfStatement\r
-from GenFdsGlobalVariable import GenFdsGlobalVariable\r
+from Common.StringUtils import *\r
+from .FfsInfStatement import FfsInfStatement\r
+from .GenFdsGlobalVariable import GenFdsGlobalVariable\r
 \r
-## \r
+##\r
 #\r
 #\r
 class OptRomInfStatement (FfsInfStatement):\r
@@ -45,9 +45,8 @@ class OptRomInfStatement (FfsInfStatement):
     #   @param  self        The object pointer\r
     #\r
     def __GetOptRomParams(self):\r
-        \r
         if self.OverrideAttribs is None:\r
-            self.OverrideAttribs = OptionRom.OverrideAttribs()\r
+            self.OverrideAttribs = OverrideAttribs()\r
 \r
         if self.OverrideAttribs.NeedCompress is None:\r
             self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('PCI_COMPRESS')\r
@@ -59,21 +58,21 @@ class OptRomInfStatement (FfsInfStatement):
 \r
         if self.OverrideAttribs.PciVendorId is None:\r
             self.OverrideAttribs.PciVendorId = self.OptRomDefs.get ('PCI_VENDOR_ID')\r
-        \r
+\r
         if self.OverrideAttribs.PciClassCode is None:\r
             self.OverrideAttribs.PciClassCode = self.OptRomDefs.get ('PCI_CLASS_CODE')\r
-            \r
+\r
         if self.OverrideAttribs.PciDeviceId is None:\r
             self.OverrideAttribs.PciDeviceId = self.OptRomDefs.get ('PCI_DEVICE_ID')\r
-            \r
+\r
         if self.OverrideAttribs.PciRevision is None:\r
             self.OverrideAttribs.PciRevision = self.OptRomDefs.get ('PCI_REVISION')\r
-        \r
-#        InfObj = GenFdsGlobalVariable.WorkSpace.BuildObject[self.PathClassObj, self.CurrentArch]  \r
+\r
+#        InfObj = GenFdsGlobalVariable.WorkSpace.BuildObject[self.PathClassObj, self.CurrentArch]\r
 #        RecordList = InfObj._RawData[MODEL_META_DATA_HEADER, InfObj._Arch, InfObj._Platform]\r
 #        for Record in RecordList:\r
 #            Record = ReplaceMacros(Record, GlobalData.gEdkGlobal, False)\r
-#            Name = Record[0]  \r
+#            Name = Record[0]\r
     ## GenFfs() method\r
     #\r
     #   Generate FFS\r
@@ -141,14 +140,26 @@ class OptRomInfStatement (FfsInfStatement):
 \r
         OutputFileList = []\r
         for Sect in Rule.SectionList:\r
-            if Sect.SectionType == 'PE32':\r
+            if Sect.SectionType == BINARY_FILE_TYPE_PE32:\r
                 if Sect.FileName is not None:\r
                     GenSecInputFile = self.__ExtendMacro__(Sect.FileName)\r
                     OutputFileList.append(GenSecInputFile)\r
                 else:\r
                     FileList, IsSect = Section.Section.GetFileList(self, '', Sect.FileExtension)\r
-                    OutputFileList.extend(FileList)    \r
-        \r
+                    OutputFileList.extend(FileList)\r
+\r
         return OutputFileList\r
 \r
-    
\ No newline at end of file
+class OverrideAttribs:\r
+\r
+    ## The constructor\r
+    #\r
+    #   @param  self        The object pointer\r
+    #\r
+    def __init__(self):\r
+\r
+        self.PciVendorId = None\r
+        self.PciClassCode = None\r
+        self.PciDeviceId = None\r
+        self.PciRevision = None\r
+        self.NeedCompress = None\r