]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java
In before, FixedPcdGetxx macro was defined as global variable, it is wrong. It should...
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / pcd / entity / UsageInstance.java
index 378f26f4b0af0fd79305c3f9b5477ca28ca586b5..20f0b9b14d75cfa4f1e22de6b1b71e762a59ea64 100644 (file)
@@ -19,7 +19,7 @@ package org.tianocore.build.pcd.entity;
 \r
 \r
 import java.util.UUID;\r
-\r
+import org.tianocore.ModuleTypeDef;\r
 import org.tianocore.build.autogen.CommonDefinition;\r
 import org.tianocore.build.pcd.action.ActionMessage;\r
 import org.tianocore.build.pcd.exception.EntityException;\r
@@ -30,288 +30,324 @@ import org.tianocore.build.pcd.exception.EntityException;
   is an usage instance for this PCD token.\r
 **/\r
 public class UsageInstance {\r
-  ///\r
-  /// The module type of usage instance.\r
-  /// \r
-  public enum MODULE_TYPE {SEC, PEI_CORE, PEIM, DXE_CORE, DXE_DRIVERS, OTHER_COMPONENTS}\r
-\r
-  ///\r
-  /// This parent that this usage instance belongs to.\r
-  ///\r
-  public Token            parentToken;\r
-\r
-  ///\r
-  /// The name of the module who contains this PCD.\r
-  ///\r
-  public String           moduleName;\r
-\r
-  ///\r
-  /// The GUID of the module who contains this PCD. \r
-  /// \r
-  public UUID             moduleGUID;\r
-\r
-  ///\r
-  /// The name of the package whose module contains this PCD.\r
-  ///\r
-  public String           packageName;\r
-\r
-  ///\r
-  /// The GUID of the package whose module contains this PCD.\r
-  /// \r
-  public UUID             packageGUID;\r
-\r
-  ///\r
-  /// The PCD type defined for module \r
-  /// \r
-  public Token.PCD_TYPE   modulePcdType;\r
-\r
-  ///\r
-  /// The arch string of module contains this PCD\r
-  ///\r
-  public String           arch;\r
-\r
-  ///\r
-  /// The version of module contains this PCD\r
-  /// \r
-  public String           version;\r
-\r
-  ///\r
-  /// The module type for this usage instance.\r
-  ///\r
-  public MODULE_TYPE      moduleType;\r
-\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
-  /// \r
-  public int              maxDatumSize;\r
-\r
-  ///\r
-  /// Autogen string for header file.\r
-  ///\r
-  public String           hAutogenStr;\r
-\r
-  ///\r
-  /// Auotgen string for C code file.\r
-  /// \r
-  public String           cAutogenStr;\r
-\r
-  /**\r
-     Constructure function\r
-     \r
-     @param parentToken         Member variable.\r
-     @param moduleName          Member variable.\r
-     @param moduleGUID          Member variable.\r
-     @param packageName         Member variable.\r
-     @param packageGUID         Member variable.\r
-     @param moduleType          Member variable.\r
-     @param modulePcdType       Member variable.\r
-     @param arch                Member variable.\r
-     @param version             Member variable.\r
-     @param value               Member variable.\r
-     @param maxDatumSize        Member variable.\r
-   */\r
-  public UsageInstance (Token             parentToken,\r
-                        String            moduleName,\r
-                        UUID              moduleGUID,\r
-                        String            packageName,\r
-                        UUID              packageGUID,\r
-                        MODULE_TYPE       moduleType,\r
-                        Token.PCD_TYPE    modulePcdType,\r
-                        String            arch,\r
-                        String            version,\r
-                        String            value,\r
-                        int               maxDatumSize) {\r
-      this.parentToken      = parentToken;\r
-      this.moduleName       = moduleName;\r
-      this.moduleGUID       = moduleGUID;\r
-      this.packageName      = packageName;\r
-      this.packageGUID      = packageGUID;\r
-      this.moduleType       = moduleType;\r
-      this.modulePcdType    = modulePcdType;\r
-      this.arch             = arch;\r
-      this.version          = version;\r
-      this.datum            = value;\r
-      this.maxDatumSize     = maxDatumSize;\r
-  }\r
-\r
-  /**\r
-     Get the primary key for usage instance array for every token.\r
-     \r
-     @param moduleName      the name of module\r
-     @param moduleGUID      the GUID name of module\r
-     @param packageName     the name of package who contains this module\r
-     @param packageGUID     the GUID name of package\r
-     @param arch            the archtecture string\r
-     @param version         the version of this module\r
-     \r
-     @return String         primary key\r
-   */\r
-  public static String getPrimaryKey(String moduleName,  \r
-                                     UUID   moduleGUID,  \r
-                                     String packageName,  \r
-                                     UUID   packageGUID,\r
-                                     String arch,\r
-                                     String version) {\r
-      //\r
-      // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in\r
-      // <ModuleSA> section, So currently no expect all paramter must be valid.\r
-      return (moduleName                                                              + "_" +\r
-              ((moduleGUID  != null) ? moduleGUID.toString() : "NullModuleGuid")      + "_" +\r
-              ((packageName != null) ? packageName : "NullPackageName")               + "_" +\r
-              ((packageGUID != null) ? packageGUID.toString() : "NullPackageGuid")    + "_" +\r
-              ((arch        != null) ? arch : "NullArch")                             + "_" +\r
-              ((version     != null) ? version : "NullVersion"));\r
-  }\r
-\r
-  /**\r
-     Get primary key string for this usage instance\r
-     \r
-     @return String primary key string\r
-  **/\r
-  public String getPrimaryKey() {\r
-      return UsageInstance.getPrimaryKey(moduleName, moduleGUID, packageName, packageGUID, arch, version);\r
-  }\r
-\r
-  /**\r
-     Judget whether current module is PEI driver\r
-     \r
-     @return boolean\r
-   */\r
-  public boolean isPeiPhaseComponent() {\r
-      if ((moduleType == MODULE_TYPE.PEI_CORE) ||\r
-          (moduleType == MODULE_TYPE.PEIM)) {\r
-          return true;\r
-      }\r
-      return false;\r
-  }\r
-\r
-  /**\r
-     Generate autogen string for header file and C code file.\r
-     \r
-     @throws EntityException Fail to generate.\r
-     \r
-     @param isBuildUsedLibrary  whether the autogen is for library.\r
-   */\r
-  public void generateAutoGen(boolean isBuildUsedLibrary) \r
-    throws EntityException {\r
-\r
-    hAutogenStr = "";\r
-    cAutogenStr = "";\r
-\r
-    hAutogenStr += String.format("#define _PCD_TOKEN_%s   0x%016x\r\n", \r
-                                 parentToken.cName, parentToken.tokenNumber);\r
-    switch(modulePcdType) {\r
-    case FEATURE_FLAG:\r
-      if(isBuildUsedLibrary) {\r
-          hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \r
-                                       parentToken.cName);\r
-          hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
-                                       parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                       parentToken.cName,\r
-                                       parentToken.cName);\r
-      } else {\r
-          hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                       parentToken.cName, \r
-                                       datum.toString());\r
-          hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \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
-          hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _PCD_VALUE_%s\r\n",\r
-                                       Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                       parentToken.cName,\r
-                                       parentToken.cName);\r
-      }\r
-      break;\r
-    case FIXED_AT_BUILD:\r
-      if(isBuildUsedLibrary) {\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_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
-                                     Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                     parentToken.cName,\r
-                                     parentToken.cName);\r
-      } else {\r
-        hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                     parentToken.cName, \r
-                                     datum.toString());\r
-        hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%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
-                                     parentToken.cName);\r
-        hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _PCD_VALUE_%s\r\n",\r
-                                     Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                     parentToken.cName,\r
-                                     parentToken.cName);\r
-      }\r
-      break;\r
-    case PATCHABLE_IN_MODULE:\r
-      if(isBuildUsedLibrary) {\r
-        hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
-                                     Token.getAutogendatumTypeString(parentToken.datumType),\r
-                                     parentToken.cName);\r
-        hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
-                                     Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                     parentToken.cName,\r
-                                     parentToken.cName);\r
-      } else {\r
-        hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
-                                     parentToken.cName, \r
-                                     datum.toString());\r
-        hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%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
-                                     parentToken.cName);\r
-        hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
-                                     Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
-                                     parentToken.cName,\r
-                                     parentToken.cName);\r
-      }\r
-\r
-      break;\r
-    case DYNAMIC:\r
-       hAutogenStr += String.format("#define _PCD_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
-       break;\r
-    case DYNAMIC_EX:\r
-      break;\r
+    ///\r
+    /// This parent that this usage instance belongs to.\r
+    ///\r
+    public Token            parentToken;\r
+\r
+    ///\r
+    /// The name of the module who contains this PCD.\r
+    ///\r
+    public String           moduleName;\r
+\r
+    ///\r
+    /// The GUID of the module who contains this PCD. \r
+    /// \r
+    public UUID             moduleGUID;\r
+\r
+    ///\r
+    /// The name of the package whose module contains this PCD.\r
+    ///\r
+    public String           packageName;\r
+\r
+    ///\r
+    /// The GUID of the package whose module contains this PCD.\r
+    /// \r
+    public UUID             packageGUID;\r
+\r
+    ///\r
+    /// The PCD type defined for module \r
+    /// \r
+    public Token.PCD_TYPE   modulePcdType;\r
+\r
+    ///\r
+    /// The arch string of module contains this PCD\r
+    ///\r
+    public String           arch;\r
+\r
+    ///\r
+    /// The version of module contains this PCD\r
+    /// \r
+    public String           version;\r
+\r
+    ///\r
+    /// The module type for this usage instance.\r
+    ///\r
+    public ModuleTypeDef.Enum    moduleType;\r
+\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
+    /// \r
+    public int              maxDatumSize;\r
+\r
+    ///\r
+    /// Autogen string for header file.\r
+    ///\r
+    public String           hAutogenStr;\r
+\r
+    ///\r
+    /// Auotgen string for C code file.\r
+    /// \r
+    public String           cAutogenStr;\r
+\r
+    /**\r
+       Constructure function\r
+       \r
+       @param parentToken         Member variable.\r
+       @param moduleName          Member variable.\r
+       @param moduleGUID          Member variable.\r
+       @param packageName         Member variable.\r
+       @param packageGUID         Member variable.\r
+       @param moduleType          Member variable.\r
+       @param modulePcdType       Member variable.\r
+       @param arch                Member variable.\r
+       @param version             Member variable.\r
+       @param value               Member variable.\r
+       @param maxDatumSize        Member variable.\r
+     */\r
+    public UsageInstance (Token             parentToken,\r
+                          String            moduleName,\r
+                          UUID              moduleGUID,\r
+                          String            packageName,\r
+                          UUID              packageGUID,\r
+                          ModuleTypeDef.Enum moduleType,\r
+                          Token.PCD_TYPE    modulePcdType,\r
+                          String            arch,\r
+                          String            version,\r
+                          String            value,\r
+                          int               maxDatumSize) {\r
+        this.parentToken      = parentToken;\r
+        this.moduleName       = moduleName;\r
+        this.moduleGUID       = moduleGUID;\r
+        this.packageName      = packageName;\r
+        this.packageGUID      = packageGUID;\r
+        this.moduleType       = moduleType;\r
+        this.modulePcdType    = modulePcdType;\r
+        this.arch             = arch;\r
+        this.version          = version;\r
+        this.datum            = value;\r
+        this.maxDatumSize     = maxDatumSize;\r
+    }\r
+\r
+    /**\r
+       Get the primary key for usage instance array for every token.\r
+       \r
+       @param moduleName      the name of module\r
+       @param moduleGUID      the GUID name of module\r
+       @param packageName     the name of package who contains this module\r
+       @param packageGUID     the GUID name of package\r
+       @param arch            the archtecture string\r
+       @param version         the version of this module\r
+       \r
+       @return String         primary key\r
+     */\r
+    public static String getPrimaryKey(String moduleName,  \r
+                                       UUID   moduleGUID,  \r
+                                       String packageName,  \r
+                                       UUID   packageGUID,\r
+                                       String arch,\r
+                                       String version) {\r
+        //\r
+        // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in\r
+        // <ModuleSA> section, So currently no expect all paramter must be valid.\r
+        return(moduleName                                                              + "_" +\r
+               ((moduleGUID  != null) ? moduleGUID.toString() : "NullModuleGuid")      + "_" +\r
+               ((packageName != null) ? packageName : "NullPackageName")               + "_" +\r
+               ((packageGUID != null) ? packageGUID.toString() : "NullPackageGuid")    + "_" +\r
+               ((arch        != null) ? arch : "NullArch")                             + "_" +\r
+               ((version     != null) ? version : "NullVersion"));\r
+    }\r
+\r
+    /**\r
+       Get primary key string for this usage instance\r
+       \r
+       @return String primary key string\r
+    **/\r
+    public String getPrimaryKey() {\r
+        return UsageInstance.getPrimaryKey(moduleName, moduleGUID, packageName, packageGUID, arch, version);\r
+    }\r
+\r
+    /**\r
+       Judget whether current module is PEI driver\r
+       \r
+       @return boolean\r
+     */\r
+    public boolean isPeiPhaseComponent() {\r
+        if ((moduleType == ModuleTypeDef.PEI_CORE) ||\r
+            (moduleType == ModuleTypeDef.PEIM)) {\r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
+\r
+    /**\r
+       Generate autogen string for header file and C code file.\r
+       \r
+       @throws EntityException Fail to generate.\r
+       \r
+       @param isBuildUsedLibrary  whether the autogen is for library.\r
+     */\r
+    public void generateAutoGen(boolean isBuildUsedLibrary) \r
+        throws EntityException {\r
+        String  guidStringCName  = null;\r
+        boolean isByteArray      = false;\r
+        String  printDatum       = null;\r
+\r
+        hAutogenStr = "";\r
+        cAutogenStr = "";\r
+\r
+        if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
+            hAutogenStr += String.format("#define _PCD_TOKEN_%s   0x%016x\r\n", \r
+                                         parentToken.cName, parentToken.dynamicExTokenNumber);\r
+        } else {\r
+            hAutogenStr += String.format("#define _PCD_TOKEN_%s   0x%016x\r\n", \r
+                                         parentToken.cName, parentToken.tokenNumber);\r
+        }\r
+\r
+        if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {\r
+            if (datum.trim().charAt(0) == '{') {\r
+                isByteArray = true;\r
+            }\r
+        }\r
+\r
+        if (parentToken.datumType == Token.DATUM_TYPE.UINT64) {\r
+            printDatum = this.datum + "ULL";\r
+        } else {\r
+            printDatum = this.datum;\r
+        }\r
+\r
+        switch (modulePcdType) {\r
+        case FEATURE_FLAG:\r
+            hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \r
+                                         parentToken.cName);\r
+            hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n",\r
+                                         parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         parentToken.cName,\r
+                                         parentToken.cName);\r
+\r
+            if (!isBuildUsedLibrary) {\r
+                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
+                                             parentToken.cName, \r
+                                             printDatum);\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
+            }\r
+            break;\r
+        case FIXED_AT_BUILD:\r
+            if (isByteArray) {\r
+                hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",\r
+                                             parentToken.cName);\r
+                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  &_gPcd_FixedAtBuild_%s\r\n", \r
+                                             Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                             parentToken.cName,\r
+                                             parentToken.cName);\r
+            } else {\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_MODE_%s_%s  _gPcd_FixedAtBuild_%s\r\n", \r
+                                             Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                             parentToken.cName,\r
+                                             parentToken.cName);\r
+            }\r
+\r
+            if (!isBuildUsedLibrary) {\r
+                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
+                                             parentToken.cName, \r
+                                             printDatum);\r
+                if (isByteArray) {\r
+                    cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = _PCD_VALUE_%s;\r\n",\r
+                                                 parentToken.cName,\r
+                                                 parentToken.cName);\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
+            }\r
+            break;\r
+        case PATCHABLE_IN_MODULE:\r
+            if (isByteArray) {\r
+                hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",\r
+                                             parentToken.cName);\r
+                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  &_gPcd_BinaryPatch_%s\r\n",\r
+                                             Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                             parentToken.cName,\r
+                                             parentToken.cName);  \r
+            } else {\r
+                hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
+                                             Token.getAutogendatumTypeString(parentToken.datumType),\r
+                                             parentToken.cName);\r
+                hAutogenStr += String.format("#define _PCD_MODE_%s_%s  _gPcd_BinaryPatch_%s\r\n",\r
+                                             Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                             parentToken.cName,\r
+                                             parentToken.cName);                \r
+            }\r
+\r
+            if (!isBuildUsedLibrary) {\r
+                hAutogenStr += String.format("#define _PCD_VALUE_%s   %s\r\n", \r
+                                             parentToken.cName, \r
+                                             printDatum);\r
+                if (isByteArray) {\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 %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",\r
+                                                 Token.getAutogendatumTypeString(parentToken.datumType),\r
+                                                 parentToken.cName,\r
+                                                 parentToken.cName);\r
+                }\r
+            }\r
+\r
+            break;\r
+        case DYNAMIC:\r
+            hAutogenStr += String.format("#define _PCD_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
+            break;\r
+        case DYNAMIC_EX:\r
+            guidStringCName = "_gPcd_TokenSpaceGuid_" +\r
+                              parentToken.tokenSpaceName.toString().replaceAll("-", "_");\r
+                                            \r
+            hAutogenStr += String.format("#define _PCD_MODE_%s_%s LibPcdGetEx%s(&%s, _PCD_TOKEN_%s)\r\n",\r
+                                         Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         parentToken.cName,\r
+                                         Token.getAutogenLibrarydatumTypeString(parentToken.datumType),\r
+                                         guidStringCName,\r
+                                         parentToken.cName);\r
+\r
+            break;\r
+        }\r
+    }\r
+\r
+    /**\r
+      Get the autogen string for header file.\r
+      \r
+      @return The string of header file.\r
+    **/\r
+    public String getHAutogenStr() {\r
+        return hAutogenStr;\r
+    }\r
+\r
+    /**\r
+      Get the autogen string for C code file.\r
+      \r
+      @return The string of C Code file.\r
+    **/\r
+    public String getCAutogenStr() {\r
+        return cAutogenStr;\r
     }\r
-  }\r
-\r
-  /**\r
-    Get the autogen string for header file.\r
-    \r
-    @return The string of header file.\r
-  **/\r
-  public String getHAutogenStr() {\r
-    return hAutogenStr;\r
-  }\r
-\r
-  /**\r
-    Get the autogen string for C code file.\r
-    \r
-    @return The string of C Code file.\r
-  **/\r
-  public String getCAutogenStr() {\r
-    return cAutogenStr;\r
-  }\r
 }\r
 \r