]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/PcdTools/org/tianocore/pcd/entity/UsageInstance.java
Refine the code for PCD tools.
[mirror_edk2.git] / Tools / Source / PcdTools / org / tianocore / pcd / entity / UsageInstance.java
index a961d8807da552204800f87c4460763e0c41a894..e38bc91aedb8eb4314a8b6ea2e37dfb5952985a8 100644 (file)
@@ -4,26 +4,21 @@
   This class indicate an usage instance for a PCD token. This instance maybe a module\r
   or platform setting. When a module produce or cosume a PCD token, then this module\r
   is an usage instance for this PCD token.\r
   This class indicate an usage instance for a PCD token. This instance maybe a module\r
   or platform setting. When a module produce or cosume a PCD token, then this module\r
   is an usage instance for this PCD token.\r
\r
+\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
 Copyright (c) 2006, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
\r
+\r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-**/  \r
+**/\r
 package org.tianocore.pcd.entity;\r
 \r
 package org.tianocore.pcd.entity;\r
 \r
-\r
-import java.util.UUID;\r
-\r
-import org.tianocore.ModuleTypeDef;\r
 import org.tianocore.pcd.entity.CommonDefinition;\r
 import org.tianocore.pcd.entity.UsageIdentification;\r
 import org.tianocore.pcd.entity.CommonDefinition;\r
 import org.tianocore.pcd.entity.UsageIdentification;\r
-import org.tianocore.pcd.exception.EntityException;\r
 \r
 /**\r
   This class indicate an usage instance for a PCD token. This instance maybe a module\r
 \r
 /**\r
   This class indicate an usage instance for a PCD token. This instance maybe a module\r
@@ -38,29 +33,29 @@ public class UsageInstance {
 \r
     ///\r
     /// ModuleIdentification for Usage Instance\r
 \r
     ///\r
     /// ModuleIdentification for Usage Instance\r
-    /// \r
+    ///\r
     public UsageIdentification  usageId;\r
 \r
     ///\r
     /// Arch also is a key for a UsageInstance\r
     public UsageIdentification  usageId;\r
 \r
     ///\r
     /// Arch also is a key for a UsageInstance\r
-    /// \r
+    ///\r
     public String               arch;\r
 \r
     ///\r
     public String               arch;\r
 \r
     ///\r
-    /// The PCD type defined for module \r
-    /// \r
+    /// The PCD type defined for module\r
+    ///\r
     public Token.PCD_TYPE       modulePcdType;\r
 \r
     ///\r
     public Token.PCD_TYPE       modulePcdType;\r
 \r
     ///\r
-    /// The value of the PCD in this usage instance. \r
-    /// \r
+    /// The value of the PCD in this usage instance.\r
+    ///\r
     public String               datum;\r
 \r
     ///\r
     /// The maxDatumSize could be different for same PCD in different module\r
     /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule\r
     /// type.\r
     public String               datum;\r
 \r
     ///\r
     /// The maxDatumSize could be different for same PCD in different module\r
     /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule\r
     /// type.\r
-    /// \r
+    ///\r
     public int                  maxDatumSize;\r
 \r
     ///\r
     public int                  maxDatumSize;\r
 \r
     ///\r
@@ -70,14 +65,14 @@ public class UsageInstance {
 \r
     ///\r
     /// Auotgen string for C code file.\r
 \r
     ///\r
     /// Auotgen string for C code file.\r
-    /// \r
+    ///\r
     public String               cAutogenStr;\r
 \r
     /**\r
        Constructure function for UsageInstance\r
     public String               cAutogenStr;\r
 \r
     /**\r
        Constructure function for UsageInstance\r
-       \r
+\r
        @param parentToken         The token instance for this usgaInstance\r
        @param parentToken         The token instance for this usgaInstance\r
-       @param id                  The identification for usage instance\r
+       @param usageId             The identification for usage instance\r
        @param modulePcdType       The PCD type for this usage instance\r
        @param value               The value of this PCD in this usage instance\r
        @param maxDatumSize        The max datum size of this PCD in this usage\r
        @param modulePcdType       The PCD type for this usage instance\r
        @param value               The value of this PCD in this usage instance\r
        @param maxDatumSize        The max datum size of this PCD in this usage\r
@@ -97,9 +92,9 @@ public class UsageInstance {
 \r
     /**\r
        Get the primary key for usage instance array for every token.\r
 \r
     /**\r
        Get the primary key for usage instance array for every token.\r
-       \r
+\r
        @param   usageId       The identification of UsageInstance\r
        @param   usageId       The identification of UsageInstance\r
-       \r
+\r
        @retval  String        The primary key for this usage instance\r
     **/\r
     public static String getPrimaryKey(UsageIdentification usageId) {\r
        @retval  String        The primary key for this usage instance\r
     **/\r
     public static String getPrimaryKey(UsageIdentification usageId) {\r
@@ -108,7 +103,7 @@ public class UsageInstance {
 \r
     /**\r
        Get primary key string for this usage instance\r
 \r
     /**\r
        Get primary key string for this usage instance\r
-       \r
+\r
        @return String primary key string\r
     **/\r
     public String getPrimaryKey() {\r
        @return String primary key string\r
     **/\r
     public String getPrimaryKey() {\r
@@ -117,7 +112,7 @@ public class UsageInstance {
 \r
     /**\r
        Judget whether current module is PEI driver\r
 \r
     /**\r
        Judget whether current module is PEI driver\r
-       \r
+\r
        @return boolean whether current module is PEI driver\r
     **/\r
     public boolean isPeiPhaseComponent() {\r
        @return boolean whether current module is PEI driver\r
     **/\r
     public boolean isPeiPhaseComponent() {\r
@@ -132,7 +127,7 @@ public class UsageInstance {
 \r
     /**\r
        Judge whether current module is DXE driver.\r
 \r
     /**\r
        Judge whether current module is DXE driver.\r
-       \r
+\r
        @return boolean whether current module is DXE driver\r
     **/\r
     public boolean isDxePhaseComponent() {\r
        @return boolean whether current module is DXE driver\r
     **/\r
     public boolean isDxePhaseComponent() {\r
@@ -152,7 +147,7 @@ public class UsageInstance {
 \r
     /**\r
        Generate autogen string for header file and C code file.\r
 \r
     /**\r
        Generate autogen string for header file and C code file.\r
-       \r
+\r
        @param isBuildUsedLibrary  whether the autogen is for library.\r
     **/\r
     public void generateAutoGen(boolean isBuildUsedLibrary) {\r
        @param isBuildUsedLibrary  whether the autogen is for library.\r
     **/\r
     public void generateAutoGen(boolean isBuildUsedLibrary) {\r
@@ -167,12 +162,12 @@ public class UsageInstance {
         if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
             //\r
             // For DYNAMIC_EX type PCD, use original token number in SPD or FPD to generate autogen\r
         if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
             //\r
             // For DYNAMIC_EX type PCD, use original token number in SPD or FPD to generate autogen\r
-            // \r
+            //\r
             tokenNumberString =  Long.toString(parentToken.dynamicExTokenNumber, 16);\r
         } else {\r
             //\r
             // For Others type PCD, use autogenerated token number to generate autogen\r
             tokenNumberString =  Long.toString(parentToken.dynamicExTokenNumber, 16);\r
         } else {\r
             //\r
             // For Others type PCD, use autogenerated token number to generate autogen\r
-            // \r
+            //\r
             tokenNumberString = Long.toString(parentToken.tokenNumber, 16);\r
         }\r
 \r
             tokenNumberString = Long.toString(parentToken.tokenNumber, 16);\r
         }\r
 \r
@@ -180,7 +175,7 @@ public class UsageInstance {
 \r
         //\r
         // Judge the value of this PCD is byte array type\r
 \r
         //\r
         // Judge the value of this PCD is byte array type\r
-        // \r
+        //\r
         if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {\r
             if (datum.trim().charAt(0) == '{') {\r
                 isByteArray = true;\r
         if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {\r
             if (datum.trim().charAt(0) == '{') {\r
                 isByteArray = true;\r
@@ -189,7 +184,7 @@ public class UsageInstance {
 \r
         //\r
         // "ULL" should be added to value's tail for UINT64 value\r
 \r
         //\r
         // "ULL" should be added to value's tail for UINT64 value\r
-        // \r
+        //\r
         if (parentToken.datumType == Token.DATUM_TYPE.UINT64) {\r
             printDatum = this.datum + "ULL";\r
         } else {\r
         if (parentToken.datumType == Token.DATUM_TYPE.UINT64) {\r
             printDatum = this.datum + "ULL";\r
         } else {\r
@@ -198,20 +193,40 @@ public class UsageInstance {
 \r
         switch (modulePcdType) {\r
         case FEATURE_FLAG:\r
 \r
         switch (modulePcdType) {\r
         case FEATURE_FLAG:\r
-            hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \r
+            //\r
+            // Example autogen string for following generation:\r
+            // "extern const BOOLEAN _gPcd_FixedAtBuild_PcdSampleToken";\r
+            // \r
+            hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",\r
                                          parentToken.cName);\r
                                          parentToken.cName);\r
+            //\r
+            // Example autogen string for following generation:\r
+            // "#define _PCD_GET_MODE_8_PcdSampleToken _gPcd_FixedAtBuild_PcdSampleToken";\r
+            // \r
             hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
             hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
-                                         parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName,\r
                                          parentToken.cName);\r
                                          parentToken.cName,\r
                                          parentToken.cName);\r
+            //\r
+            // Example autogen string for following generation:\r
+            // "//#define _PCD_SET_MODE_8_PcdSampleToken ASSERT(FALSE) If is not allowed to set value...";\r
+            // \r
             hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) If is not allowed to set value for a FEATURE_FLAG PCD\r\n",\r
             hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) If is not allowed to set value for a FEATURE_FLAG PCD\r\n",\r
-                                         parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName);\r
 \r
             if (!isBuildUsedLibrary) {\r
                                          parentToken.cName);\r
 \r
             if (!isBuildUsedLibrary) {\r
-                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                             parentToken.cName, \r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_VALUE_PcdSampleToken 0x1000"\r
+                // \r
+                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n",\r
+                                             parentToken.cName,\r
                                              printDatum);\r
                                              printDatum);\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_PcdSampleToken = _PCD_VALUE_PcdSampleToken;"\r
+                // \r
                 cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
                 cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
@@ -219,47 +234,91 @@ public class UsageInstance {
             break;\r
         case FIXED_AT_BUILD:\r
             if (isByteArray) {\r
             break;\r
         case FIXED_AT_BUILD:\r
             if (isByteArray) {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "extern const BOOLEAN _gPcd_FixedAtBuild_PcdSampleToken";\r
+                // \r
                 hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",\r
                                              parentToken.cName);\r
                 hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",\r
                                              parentToken.cName);\r
-                hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  (VOID*)_gPcd_FixedAtBuild_%s\r\n", \r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_GET_MODE_8_PcdSampleToken (VOID*)_gPcd_FixedAtBuild_PcdSampleToken";\r
+                // \r
+                hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  (VOID*)_gPcd_FixedAtBuild_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             } else {\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             } else {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "extern const UINT8 _gPcd_FixedAtBuild_PcdSampleToken";\r
+                // \r
                 hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
                 hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
-                hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n", \r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_GET_MODE_8_PcdSampleToken _gPcd_FixedAtBuild_PcdSampleToken";\r
+                // \r
+                hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             }\r
 \r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             }\r
 \r
+            //\r
+            // Example autogen string for following generation:\r
+            // "//#define _PCD_SET_MODE_8_PcdSampleToken ASSERT(FALSE) If is not allowed to set value...";\r
+            // \r
             hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\r\n",\r
             hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\r\n",\r
-                                         parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName);\r
             if (!isBuildUsedLibrary) {\r
                 if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
                     if (isByteArray) {\r
                                          parentToken.cName);\r
             if (!isBuildUsedLibrary) {\r
                 if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
                     if (isByteArray) {\r
-                        hAutogenStr += String.format("#define _PCD_VALUE_%s   (VOID*)_gPcd_FixedAtBuild_%s\r\n", \r
-                                                     parentToken.cName, \r
+                        //\r
+                        // Example autogen string for following generation:\r
+                        // "#define _PCD_VALUE_PcdSampleToken (VOID*)_gPcd_FixedAtBuild_PcdSampleToken"\r
+                        // \r
+                        hAutogenStr += String.format("#define _PCD_VALUE_%s   (VOID*)_gPcd_FixedAtBuild_%s\r\n",\r
+                                                     parentToken.cName,\r
                                                      parentToken.cName);\r
                                                      parentToken.cName);\r
+                        //\r
+                        // Example autogen string for following generation:\r
+                        // "GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_PcdSampleToken[] = 'dfdf';"\r
+                        // \r
                         cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = %s;\r\n",\r
                                                      parentToken.cName,\r
                                                      printDatum);\r
                     } else {\r
                         cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = %s;\r\n",\r
                                                      parentToken.cName,\r
                                                      printDatum);\r
                     } else {\r
-                        hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                                     parentToken.cName, \r
+                        //\r
+                        // Example autogen string for following generation:\r
+                        // "#define _PCD_VALUE_PcdSampleToken 0x222"\r
+                        // \r
+                        hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n",\r
+                                                     parentToken.cName,\r
                                                      printDatum);\r
                                                      printDatum);\r
+                        //\r
+                        // Example autogen string for following generation:\r
+                        // "GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"\r
+                        // \r
                         cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                      Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                      parentToken.cName,\r
                                                      parentToken.cName);\r
                     }\r
                 } else {\r
                         cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                      Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                      parentToken.cName,\r
                                                      parentToken.cName);\r
                     }\r
                 } else {\r
-                    hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                                 parentToken.cName, \r
+                    //\r
+                    // Example autogen string for following generation:\r
+                    // "#define _PCD_VALUE_PcdSampleToken 0x222"\r
+                    // \r
+                    hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n",\r
+                                                 parentToken.cName,\r
                                                  printDatum);\r
                                                  printDatum);\r
+                    //\r
+                    // Example autogen string for following generation:\r
+                    // "GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"\r
+                    // \r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                  Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                  parentToken.cName,\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
                                                  Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                  parentToken.cName,\r
@@ -269,46 +328,82 @@ public class UsageInstance {
             break;\r
         case PATCHABLE_IN_MODULE:\r
             if (isByteArray) {\r
             break;\r
         case PATCHABLE_IN_MODULE:\r
             if (isByteArray) {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "extern UINT8 _gPcd_BinaryPatch_PcdSampleToken[];"\r
+                // \r
                 hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",\r
                                              parentToken.cName);\r
                 hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",\r
                                              parentToken.cName);\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_GET_MODE_8_PcdSampleToken  (VOID*)_gPcd_BinaryPatch_PcdSampleToken"\r
+                // \r
                 hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  (VOID*)_gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                 hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  (VOID*)_gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
-                                             parentToken.cName);  \r
+                                             parentToken.cName);\r
             } else {\r
             } else {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "extern UINT8 _gPcd_BinaryPatch_PcdSampleToken;"\r
+                // \r
                 hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
                 hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
                                              Token.getAutogendatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_GET_MODE_8_PcdSampleToken  _gPcd_BinaryPatch_PcdSampleToken"\r
+                // \r
                 hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                 hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
-                                             parentToken.cName);                \r
+                                             parentToken.cName);\r
             }\r
 \r
             //\r
             // Generate _PCD_SET_MODE_xx macro for using set BinaryPatch value via PcdSet macro\r
             }\r
 \r
             //\r
             // Generate _PCD_SET_MODE_xx macro for using set BinaryPatch value via PcdSet macro\r
-            // \r
+            //\r
             if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
             if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_SET_MODE_8_PcdSampleToken(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_PcdSampleToken, (Buffer), (SizeOfBuffer))"\r
+                // \r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_%s, (Buffer), (SizeOfBuffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             } else {\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_%s, (Buffer), (SizeOfBuffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             } else {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_SET_MODE_8_PcdSampleToken(Value) (_gPcd_BinaryPatch_PcdSampleToken = (Value))"\r
+                // \r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) (_gPcd_BinaryPatch_%s = (Value))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             }\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) (_gPcd_BinaryPatch_%s = (Value))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              parentToken.cName);\r
             }\r
-            \r
+\r
             if (!isBuildUsedLibrary) {\r
             if (!isBuildUsedLibrary) {\r
-                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                             parentToken.cName, \r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_VALUE_PcdSampleToken   0x111"\r
+                // \r
+                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n",\r
+                                             parentToken.cName,\r
                                              printDatum);\r
                 if (isByteArray) {\r
                                              printDatum);\r
                 if (isByteArray) {\r
+                    //\r
+                    // Example autogen string for following generation:\r
+                    // "GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"\r
+                    // \r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",\r
                                                  parentToken.cName,\r
                                                  parentToken.cName);\r
                 } else {\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",\r
                                                  parentToken.cName,\r
                                                  parentToken.cName);\r
                 } else {\r
+                    //\r
+                    // Example autogen string for following generation:\r
+                    // "GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_PcdSampleToken[] = _PCD_VALUE_PcdSampleToken;"\r
+                    // \r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",\r
                                                  Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                  parentToken.cName,\r
                     cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",\r
                                                  Token.getAutogendatumTypeString(parentToken.datumType),\r
                                                  parentToken.cName,\r
@@ -318,18 +413,30 @@ public class UsageInstance {
 \r
             break;\r
         case DYNAMIC:\r
 \r
             break;\r
         case DYNAMIC:\r
+            //\r
+            // Example autogen string for following generation:\r
+            // "#define _PCD_GET_MODE_8_PcdSampleToken  LibPcdGet%s(_PCD_TOKEN_PcdSampleToken)"\r
+            // \r
             hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  LibPcdGet%s(_PCD_TOKEN_%s)\r\n",\r
                                          Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName,\r
                                          Token.getAutogenLibrarydatumTypeString(parentToken.datumType),\r
                                          parentToken.cName);\r
             if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
             hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s  LibPcdGet%s(_PCD_TOKEN_%s)\r\n",\r
                                          Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName,\r
                                          Token.getAutogenLibrarydatumTypeString(parentToken.datumType),\r
                                          parentToken.cName);\r
             if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_SET_MODE_8_PcdSampleToken(SizeOfBuffer, Buffer)  LibPcdSet%s(_PCD_TOKEN_PcdSampleToken, (SizeOfBuffer), (Buffer))"\r
+                // \r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer)  LibPcdSet%s(_PCD_TOKEN_%s, (SizeOfBuffer), (Buffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              Token.getAutogenLibrarydatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
             } else {\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer)  LibPcdSet%s(_PCD_TOKEN_%s, (SizeOfBuffer), (Buffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                                              Token.getAutogenLibrarydatumTypeString(parentToken.datumType),\r
                                              parentToken.cName);\r
             } else {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_SET_MODE_8_PcdSampleToken(Value)  LibPcdSet%s(_PCD_TOKEN_PcdSampleToken, (Value))"\r
+                // \r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value)  LibPcdSet%s(_PCD_TOKEN_%s, (Value))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value)  LibPcdSet%s(_PCD_TOKEN_%s, (Value))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
@@ -341,6 +448,10 @@ public class UsageInstance {
             guidStringCName = "_gPcd_TokenSpaceGuid_" +\r
                               parentToken.tokenSpaceName.toString().replaceAll("-", "_");\r
 \r
             guidStringCName = "_gPcd_TokenSpaceGuid_" +\r
                               parentToken.tokenSpaceName.toString().replaceAll("-", "_");\r
 \r
+            //\r
+            // Example autogen string for following generation:\r
+            // "#define _PCD_GET_MODE_8_PcdSampleToken LibPcdGetEx%s(&_gPcd_TokenSpaceGuid_00_00_00, _PCD_TOKEN_PcdSampleToken)"\r
+            // \r
             hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s LibPcdGetEx%s(&%s, _PCD_TOKEN_%s)\r\n",\r
                                          Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName,\r
             hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s LibPcdGetEx%s(&%s, _PCD_TOKEN_%s)\r\n",\r
                                          Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                          parentToken.cName,\r
@@ -349,6 +460,10 @@ public class UsageInstance {
                                          parentToken.cName);\r
 \r
             if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
                                          parentToken.cName);\r
 \r
             if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_SET_MODE_8_PcdSampleToken(SizeOfBuffer, Buffer) LibPcdSetEx%s(&_gPcd_TokenSpaceGuid_00_00_00, _PCD_TOKEN_PcdSampleToken, (SizeOfBuffer), (Buffer))"\r
+                // \r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, _PCD_TOKEN_%s, (SizeOfBuffer), (Buffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, _PCD_TOKEN_%s, (SizeOfBuffer), (Buffer))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
@@ -356,6 +471,10 @@ public class UsageInstance {
                                              guidStringCName,\r
                                              parentToken.cName);\r
             } else {\r
                                              guidStringCName,\r
                                              parentToken.cName);\r
             } else {\r
+                //\r
+                // Example autogen string for following generation:\r
+                // "#define _PCD_SET_MODE_8_PcdSampleToken(Value) LibPcdSetEx%s(&_gPcd_TokenSpaceGuid_00_00_00, _PCD_TOKEN_PcdSampleToken, (Value))"\r
+                //\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) LibPcdSetEx%s(&%s, _PCD_TOKEN_%s, (Value))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
                 hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(Value) LibPcdSetEx%s(&%s, _PCD_TOKEN_%s, (Value))\r\n",\r
                                              Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
                                              parentToken.cName,\r
@@ -370,7 +489,7 @@ public class UsageInstance {
 \r
     /**\r
       Get the autogen string for header file.\r
 \r
     /**\r
       Get the autogen string for header file.\r
-      \r
+\r
       @return The string of header file.\r
     **/\r
     public String getHAutogenStr() {\r
       @return The string of header file.\r
     **/\r
     public String getHAutogenStr() {\r
@@ -379,7 +498,7 @@ public class UsageInstance {
 \r
     /**\r
       Get the autogen string for C code file.\r
 \r
     /**\r
       Get the autogen string for C code file.\r
-      \r
+\r
       @return The string of C Code file.\r
     **/\r
     public String getCAutogenStr() {\r
       @return The string of C Code file.\r
     **/\r
     public String getCAutogenStr() {\r