]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
1. Fix EDKT344: The algorithm for PCD of msa should be adjusted
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / workspace / WorkspaceTools.java
index dedbdddf20b48c45d4355a0c14eaa102630ea3a3..c27b81eea0c029dd5a1d402f2f48396150dcb400 100644 (file)
@@ -458,7 +458,31 @@ public class WorkspaceTools {
                     String help = spd.getPcdDeclarations().getPcdEntryList().get(index).getHelpText();\r
                     Vector<String> type = Tools.convertListToVector(spd.getPcdDeclarations().getPcdEntryList()\r
                                                                        .get(index).getValidUsage());\r
-\r
+                    //\r
+                    // The algorithm for PCD of msa should be:\r
+                    // 1. If the type of PCD from Spd is FEATURE_FLAG, \r
+                    //    the type of Msa only can be FEATURE_FLAG.\r
+                    // 2. If the type of PCD from Spd is not FEATURE_FLAG, \r
+                    //    the type of Msa could be selected from the PCD's all types and "DYNAMIC" type.\r
+                    //\r
+                    boolean hasFEATURE_FLAG = false;\r
+                    boolean hasDYNAMIC = false;\r
+                    for (int indexOfType = 0; indexOfType < type.size(); indexOfType++) {\r
+                        if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) {\r
+                            hasDYNAMIC = true;\r
+                        }\r
+                        if(type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {\r
+                            hasFEATURE_FLAG = true;\r
+                        }\r
+                    }\r
+                    if (hasFEATURE_FLAG) {\r
+                        type.removeAllElements();\r
+                        type.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);\r
+                    } else {\r
+                        if (!hasDYNAMIC) {\r
+                            type.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);\r
+                        }\r
+                    }\r
                     vector.addPcd(new PcdIdentification(name, guidCName, help, type));\r
                 }\r
             }\r