enhancement to tool to generate the comments along with offsets in the .h file.
authorMudusuru, Giri P <giri.p.mudusuru@intel.com>
Fri, 1 May 2015 23:09:53 +0000 (23:09 +0000)
committerjyao1 <jyao1@Edk2>
Fri, 1 May 2015 23:09:53 +0000 (23:09 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Mudusuru, Giri P" <giri.p.mudusuru@intel.com>
Reviewed-by: "Yao, Jiewen" <Jiewen.Yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17282 6f19259b-4bc3-4df7-8a09-765794883524

IntelFspPkg/Tools/GenCfgOpt.py

index 6b850f6..caeb175 100644 (file)
@@ -774,9 +774,10 @@ EndList
         TxtFd.close()\r
         return 0\r
 \r
-    def CreateField (self, Item, Name, Length, Offset, Struct):\r
+    def CreateField (self, Item, Name, Length, Offset, Struct, Help):\r
         PosName    = 28\r
         PosComment = 30\r
+        HelpLine=''\r
 \r
         IsArray = False\r
         if Length in [1,2,4,8]:\r
@@ -810,8 +811,10 @@ EndList
             Space2 = PosComment - len(Name)\r
         else:\r
             Space2 = 1\r
+        if Help != '':\r
+            HelpLine="   %s \n" % Help\r
 \r
-        return "  %s%s%s;%s/* Offset 0x%04X */\n" % (Type, ' ' * Space1, Name, ' ' * Space2, Offset)\r
+        return "/**Offset 0x%04X \n%s**/\n  %s%s%s;%s\n" % (Offset, HelpLine, Type, ' ' * Space1, Name, ' ' * Space2)\r
 \r
 \r
     def CreateHeaderFile (self, InputHeaderFile, IsInternal):\r
@@ -919,12 +922,12 @@ EndList
                         NextVisible = True\r
                         Name = "Reserved" + Region[0] + "pdSpace%d" % ResvIdx\r
                         ResvIdx = ResvIdx + 1\r
-                        HeaderFd.write(self.CreateField (Item, Name, Item["offset"] - ResvOffset, ResvOffset, ''))\r
+                        HeaderFd.write(self.CreateField (Item, Name, Item["offset"] - ResvOffset, ResvOffset, '', ''))\r
 \r
                 if  Offset < Item["offset"]:\r
                     if IsInternal or LastVisible:\r
                         Name = "Unused" + Region[0] + "pdSpace%d" % SpaceIdx\r
-                        LineBuffer.append(self.CreateField (Item, Name, Item["offset"] - Offset, Offset, ''))\r
+                        LineBuffer.append(self.CreateField (Item, Name, Item["offset"] - Offset, Offset, '',''))\r
                     SpaceIdx = SpaceIdx + 1\r
                     Offset   = Item["offset"]\r
 \r
@@ -940,7 +943,7 @@ EndList
                     for Each in LineBuffer:\r
                         HeaderFd.write (Each)\r
                     LineBuffer = []\r
-                    HeaderFd.write(self.CreateField (Item, Item["cname"], Item["length"], Item["offset"], Item['struct']))\r
+                    HeaderFd.write(self.CreateField (Item, Item["cname"], Item["length"], Item["offset"], Item['struct'], Item['help']))\r
 \r
             HeaderFd.write("} " + Region[0] + "PD_DATA_REGION;\n\n")\r
         HeaderFd.write("#pragma pack()\n\n")\r