]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Change the macro for dynamicEx type PCD and modify autogen tools to auto generate...
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 17 Jun 2006 09:57:06 +0000 (09:57 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 17 Jun 2006 09:57:06 +0000 (09:57 +0000)
1) PcdGet8/PcdGet32/... to get a value of DynamicEx PCD, same as PcdSetxx
2) PcdGet8Ex/PcdGet32Ex to get a value of DynamicEx PCD, same as PcdSetxxEx.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@549 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Include/Library/PcdLib.h
Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java
Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java

index c4e5502a0d065fff9c328aabd7a5c2430fa1dfb3..2cc0dbb4b61750b0020b3ecb78e97ba0ce211dde 100644 (file)
@@ -77,12 +77,12 @@ Module Name: PcdLib.h
 //\r
 // Dynamic Ex is to support binary distribution\r
 //\r
 //\r
 // Dynamic Ex is to support binary distribution\r
 //\r
-#define PcdGetEx8(Guid, TokenName)     LibPcdGetEx8 (Guid, _PCD_TOKEN_##TokenName)\r
-#define PcdGetEx16(Guid, TokenName)    LibPcdGetEx16 (Guid, _PCD_TOKEN_##TokenName)\r
-#define PcdGetEx32(Guid, TokenName)    LibPcdGetEx32 (Guid, _PCD_TOKEN_##TokenName)\r
-#define PcdGetEx64(Guid, TokenName)    LibPcdGetEx64 (Guid, _PCD_TOKEN_##TokenName)\r
-#define PcdGetExPtr(Guid, TokenName)   LibPcdGetExPtr (Guid, _PCD_TOKEN_##TokenName)\r
-#define PcdGetExBool(Guid, TokenName)  LibPcdGetExBool (Guid, _PCD_TOKEN_##TokenName)\r
+#define PcdGetEx8(TokenName)     LibPcdGetEx8 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)\r
+#define PcdGetEx16(TokenName)    LibPcdGetEx16 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)\r
+#define PcdGetEx32(TokenName)    LibPcdGetEx32 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)\r
+#define PcdGetEx64(TokenName)    LibPcdGetEx64 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)\r
+#define PcdGetExPtr(TokenName)   LibPcdGetExPtr (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)\r
+#define PcdGetExBool(TokenName)  LibPcdGetExBool (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)\r
 \r
 \r
 //\r
 \r
 \r
 //\r
@@ -99,12 +99,12 @@ Module Name: PcdLib.h
 //\r
 // Dynamic Set Ex\r
 //\r
 //\r
 // Dynamic Set Ex\r
 //\r
-#define PcdSetEx8(Guid, TokenName, Value)      LibPcdSetEx8   (Guid, _PCD_TOKEN_##TokenName, Value)\r
-#define PcdSetEx16(Guid, TokenName, Value)     LibPcdSetEx16  (Guid, _PCD_TOKEN_##TokenName, Value)\r
-#define PcdSetEx32(Guid, TokenName, Value)     LibPcdSetEx32  (Guid, _PCD_TOKEN_##TokenName, Value)\r
-#define PcdSetEx64(Guid, TokenName, Value)     LibPcdSetEx64  (Guid, _PCD_TOKEN_##TokenName, Value)\r
-#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer)    LibPcdSetExPtr (Guid, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)\r
-#define PcdSetExBool(Guid, TokenName, Value)   LibPcdSetExBool(Guid, _PCD_TOKEN_##TokenName, Value)\r
+#define PcdSetEx8(TokenName, Value)      LibPcdSetEx8   (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)\r
+#define PcdSetEx16(TokenName, Value)     LibPcdSetEx16  (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)\r
+#define PcdSetEx32(TokenName, Value)     LibPcdSetEx32  (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)\r
+#define PcdSetEx64(TokenName, Value)     LibPcdSetEx64  (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)\r
+#define PcdSetExPtr(TokenName, SizeOfBuffer, Buffer)    LibPcdSetExPtr (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)\r
+#define PcdSetExBool(TokenName, Value)   LibPcdSetExBool(&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)\r
 \r
 \r
 /**\r
 \r
 \r
 /**\r
index 0ba5ec4a7f3c9958d8b722c1f9aad102013434f5..d6b0c9c9c540d0d2e8358a46b78f3070337aae94 100644 (file)
@@ -2117,6 +2117,8 @@ public class CollectPCDAction {
         SkuInstance         skuInstance     = null;\r
         String              temp;\r
         boolean             hasSkuId0       = false;\r
         SkuInstance         skuInstance     = null;\r
         String              temp;\r
         boolean             hasSkuId0       = false;\r
+        Token.PCD_TYPE      pcdType         = Token.PCD_TYPE.UNKNOWN;\r
+        int                 tokenNumber     = 0;\r
 \r
         List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo>   skuInfoList = null;\r
         DynamicPcdBuildDefinitions.PcdBuildData                 dynamicInfo = null;\r
 \r
         List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo>   skuInfoList = null;\r
         DynamicPcdBuildDefinitions.PcdBuildData                 dynamicInfo = null;\r
@@ -2152,6 +2154,21 @@ public class CollectPCDAction {
                                             dynamicInfo.getMaxDatumSize());\r
             throw new EntityException(exceptionString);\r
         }\r
                                             dynamicInfo.getMaxDatumSize());\r
             throw new EntityException(exceptionString);\r
         }\r
+        tokenNumber = Integer.decode(dynamicInfo.getToken().toString());\r
+        if (tokenNumber != token.tokenNumber) {\r
+            exceptionString = String.format("[FPD file error] For dynamic PCD %s, the token number in module %s is 0x%x, but"+\r
+                                            "in <DynamicPcdBuildDefinictions>, the token number is 0x%x, they are not match!",\r
+                                            token.cName,\r
+                                            moduleName,\r
+                                            token.tokenNumber,\r
+                                            tokenNumber);\r
+            throw new EntityException(exceptionString);\r
+        }\r
+\r
+        pcdType = Token.getpcdTypeFromString(dynamicInfo.getItemType().toString());\r
+        if (pcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
+            token.dynamicExTokenNumber = tokenNumber;\r
+        }\r
 \r
         skuInfoList = dynamicInfo.getSkuInfoList();\r
 \r
 \r
         skuInfoList = dynamicInfo.getSkuInfoList();\r
 \r
index bce2ec9ad21ecea6119a3d6e1a5de986b5b67b5e..d90133636665e72b99aa9ad50714185e449db741 100644 (file)
@@ -65,11 +65,16 @@ public class Token {
 \r
     ///\r
     /// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in\r
 \r
     ///\r
     /// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in\r
-    /// platform token space.\r
-    /// tokenNumber is defined in SPD, FPD.\r
+    /// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by\r
+    /// PCD run-time database autogen tools.\r
     ///\r
     public int              tokenNumber;\r
 \r
     ///\r
     public int              tokenNumber;\r
 \r
+    ///\r
+    /// This token number is retrieved from FPD file for DynamicEx type. \r
+    /// \r
+    public int              dynamicExTokenNumber;\r
+\r
     ///\r
     /// All supported PCD type, this value can be retrieved from SPD\r
     /// Currently, only record all PCD type for this token in FPD file.\r
     ///\r
     /// All supported PCD type, this value can be retrieved from SPD\r
     /// Currently, only record all PCD type for this token in FPD file.\r
index 378f26f4b0af0fd79305c3f9b5477ca28ca586b5..40dd3b945403e14c68d93672970c892b52dc5608 100644 (file)
@@ -30,288 +30,326 @@ import org.tianocore.build.pcd.exception.EntityException;
   is an usage instance for this PCD token.\r
 **/\r
 public class UsageInstance {\r
   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
+    ///\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
     throws EntityException {\r
+        String guidStringArray[] = null;\r
+        String guidString        = null;\r
+\r
+        hAutogenStr = "";\r
+        cAutogenStr = "";\r
+\r
+        if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
+            hAutogenStr += String.format("#define _PCD_LOCAL_TOKEN_%s   0x%016x\r\n", \r
+                                         parentToken.cName, parentToken.tokenNumber);\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
+        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
+            guidStringArray = parentToken.tokenSpaceName.toString().split("-");\r
+            guidString      = String.format("{ 0x%s, 0x%s, 0x%s, {0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s}}",\r
+                                            guidStringArray[0],\r
+                                            guidStringArray[1],\r
+                                            guidStringArray[2],\r
+                                            (guidStringArray[3].substring(0, 2)),\r
+                                            (guidStringArray[3].substring(2, 4)),\r
+                                            (guidStringArray[4].substring(0, 2)),\r
+                                            (guidStringArray[4].substring(2, 4)),\r
+                                            (guidStringArray[4].substring(4, 6)),\r
+                                            (guidStringArray[4].substring(6, 8)),\r
+                                            (guidStringArray[4].substring(8, 10)),\r
+                                            (guidStringArray[4].substring(10, 12)));\r
+                                            \r
+            hAutogenStr += String.format("extern EFI_GUID _gPcd_DynamicEx_TokenSpaceGuid_%s;\r\n",\r
+                                         parentToken.cName);\r
+            hAutogenStr += String.format("#define _PCD_MODE_%s_%s LibPcdGet%s(_PCD_LOCAL_TOKEN_%s)\r\n",\r
+                                         Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+                                         parentToken.cName,\r
+                                         Token.getAutogenLibrarydatumTypeString(parentToken.datumType),\r
+                                         parentToken.cName,\r
+                                         parentToken.cName);\r
+\r
+            if (!isBuildUsedLibrary) {\r
+                cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID _gPcd_DynamicEx_TokenSpaceGuid_%s = %s;\r\n",\r
+                                             parentToken.cName,\r
+                                             guidString);\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
-    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
+      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
-  /**\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
 \r