X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fglobal%2FSurfaceAreaQuery.java;h=1086bb8d498ce6940fc704274ae18431cc173714;hp=235c604eb3c391ab68495842378ed767341e7f4c;hb=bd4814401e1277f19fa1498dbd187dca68923b47;hpb=7d6ef0a92952746ba92183efb7b8291e0bc2d1b7 diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java index 235c604eb3..1086bb8d49 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -23,8 +23,11 @@ import java.util.Stack; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.w3c.dom.Node; + import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlString; + import org.tianocore.BuildOptionsDocument; import org.tianocore.CNameType; import org.tianocore.ExternsDocument; @@ -57,20 +60,22 @@ import org.tianocore.FilenameDocument.Filename; import org.tianocore.MsaHeaderDocument.MsaHeader; import org.tianocore.ProtocolsDocument.Protocols.Protocol; import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify; +import org.tianocore.PcdDriverTypes; + +import org.tianocore.common.logger.EdkLog; import org.tianocore.build.id.FpdModuleIdentification; import org.tianocore.build.id.ModuleIdentification; import org.tianocore.build.id.PackageIdentification; import org.tianocore.build.id.PlatformIdentification; import org.tianocore.build.toolchain.ToolChainInfo; -import org.tianocore.logger.EdkLog; -import org.w3c.dom.Node; +import org.tianocore.build.autogen.CommonDefinition; /** * SurfaceAreaQuery class is used to query Surface Area information from msa, * mbd, spd and fpd files. - * + * * This class should not instantiated. All the public interfaces is static. - * + * * @since GenBuild 1.0 */ public class SurfaceAreaQuery { @@ -105,7 +110,7 @@ public class SurfaceAreaQuery { /** * Set a Surface Area document for query later - * + * * @param map * A Surface Area document in TopLevelElementName/XmlObject * format. @@ -120,7 +125,7 @@ public class SurfaceAreaQuery { * Push current used Surface Area document into query stack. The given new * document will be used for any immediately followed getXXX() callings, * untill pop() is called. - * + * * @param newMap * The TopLevelElementName/XmlObject format of a Surface Area * document. @@ -180,7 +185,7 @@ public class SurfaceAreaQuery { /** * Search all XML documents stored in "map" for the specified xPath, using * relative path (starting with '$this') - * + * * @param xPath * xpath query string array * @returns An array of XmlObject if elements are found at the specified @@ -219,7 +224,7 @@ public class SurfaceAreaQuery { /** * Search XML documents named by "rootName" for the given xPath, using * relative path (starting with '$this') - * + * * @param rootName * The top level element name * @param xPath @@ -255,7 +260,7 @@ public class SurfaceAreaQuery { /** * Retrieve SourceFiles/Filename for specified ARCH type - * + * * @param arch * architecture name * @returns An 2 dimension string array if elements are found at the known @@ -282,7 +287,7 @@ public class SurfaceAreaQuery { outputList.add(new String[] {sourceFileNames[i].getToolCode(),sourceFileNames[i].getStringValue()}); } } - + String[][] outputString = new String[outputList.size()][2]; for (int index = 0; index < outputList.size(); index++) { outputString[index][0] = outputList.get(index)[0]; @@ -293,7 +298,7 @@ public class SurfaceAreaQuery { /** * Retrieve /PlatformDefinitions/OutputDirectory from FPD - * + * * @returns Directory names array if elements are found at the known xpath * @returns Empty if nothing is found at the known xpath */ @@ -317,7 +322,7 @@ public class SurfaceAreaQuery { } PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0]; if(item.getIntermediateDirectories() == null) { - return null; + return null; } else { return item.getIntermediateDirectories().toString(); @@ -334,7 +339,7 @@ public class SurfaceAreaQuery { ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0]; return item.getFfsFormatKey(); } - + public static String getModuleFvBindingKeyword() { String[] xPath = new String[] { "/" }; @@ -345,7 +350,7 @@ public class SurfaceAreaQuery { ModuleSaBuildOptionsDocument.ModuleSaBuildOptions item = (ModuleSaBuildOptionsDocument.ModuleSaBuildOptions)returns[0]; return item.getFvBinding(); } - + public static List getModuleSupportedArchs() { String[] xPath = new String[] { "/" }; @@ -356,17 +361,17 @@ public class SurfaceAreaQuery { ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0]; return item.getSupportedArchitectures(); } - + public static BuildOptionsDocument.BuildOptions.Ffs[] getFpdFfs() { String[] xPath = new String[] {"/Ffs"}; - + Object[] returns = get("BuildOptions", xPath); if (returns == null || returns.length == 0) { return new BuildOptionsDocument.BuildOptions.Ffs[0]; } return (BuildOptionsDocument.BuildOptions.Ffs[])returns; } - + public static String getModuleOutputFileBasename() { String[] xPath = new String[] { "/" }; @@ -377,18 +382,18 @@ public class SurfaceAreaQuery { ModuleDefinitionsDocument.ModuleDefinitions item = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0]; return item.getOutputFileBasename(); } - + /** * Retrieve BuildOptions/Option or Arch/Option - * + * * @param toolChainFamilyFlag * if true, retrieve options for toolchain family; otherwise for * toolchain - * + * * @returns String[][5] name, target, toolchain, arch, coommand of options * if elements are found at the known xpath. String[0][] if dont * find element. - * + * * @returns Empty array if nothing is there */ public static String[][] getOptions(String from, String[] xPath, boolean toolChainFamilyFlag) { @@ -397,7 +402,6 @@ public class SurfaceAreaQuery { String toolchainFamily = null; List archList = null; String cmd = null; - String targetName = null; String optionName = null; Object[] returns = get(from, xPath); @@ -442,7 +446,7 @@ public class SurfaceAreaQuery { } archList = new ArrayList(); - List archEnumList = option.getSupArchList(); + List archEnumList = option.getSupArchList(); if (archEnumList == null) { archList.add(null); } else { @@ -478,7 +482,7 @@ public class SurfaceAreaQuery { public static String[][] getModuleBuildOptions(boolean toolChainFamilyFlag) { String[] xPath; - + if (toolChainFamilyFlag == true) { xPath = new String[] { "/Options/Option[not(@ToolChainFamily) and not(@TagName)]", @@ -489,8 +493,8 @@ public class SurfaceAreaQuery { "/Options/Option[@TagName]", }; } return getOptions("ModuleSaBuildOptions", xPath, toolChainFamilyFlag); - } - + } + public static String[][] getPlatformBuildOptions(boolean toolChainFamilyFlag) { String[] xPath; @@ -514,7 +518,7 @@ public class SurfaceAreaQuery { if (returns == null || returns.length == 0) { return null; } - + PlatformDefinitionsDocument.PlatformDefinitions item = (PlatformDefinitionsDocument.PlatformDefinitions)returns[0]; ToolChainInfo toolChainInfo = new ToolChainInfo(); toolChainInfo.addTargets(item.getBuildTargets().toString()); @@ -525,7 +529,7 @@ public class SurfaceAreaQuery { /** * Retrieve /ModuleType - * + * * @returns The module type name if elements are found at the known xpath * @returns null if nothing is there */ @@ -543,10 +547,10 @@ public class SurfaceAreaQuery { /** * Retrieve PackageDependencies/Package - * + * * @param arch * Architecture name - * + * * @returns package name list if elements are found at the known xpath * @returns null if nothing is there */ @@ -555,17 +559,17 @@ public class SurfaceAreaQuery { String packageGuid = null; String packageVersion = null; - + xPath = new String[] { "/Package" }; - + Object[] returns = get("PackageDependencies", xPath); if (returns == null) { return new PackageIdentification[0]; } // - // Get packageIdentification - // + // Get packageIdentification + // List packageIdList = new ArrayList(); for (int i = 0; i < returns.length; i++) { PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i]; @@ -580,7 +584,7 @@ public class SurfaceAreaQuery { // // transfer packageIdentification list to array. - // + // PackageIdentification[] packageIdArray = new PackageIdentification[packageIdList.size()]; for (int i = 0; i < packageIdList.size(); i++) { packageIdArray[i] = new PackageIdentification(null, packageIdList.get(i).getGuid(),packageIdList.get(i).getVersion()); @@ -590,17 +594,16 @@ public class SurfaceAreaQuery { /** * Retrieve LibraryClassDefinitions/LibraryClass for specified usage - * + * * @param usage * Library class usage - * + * * @returns LibraryClass objects list if elements are found at the known * xpath * @returns null if nothing is there */ - public static String[] getLibraryClasses(String usage) { + public static String[] getLibraryClasses(String usage, String arch) { String[] xPath; - if (usage == null || usage.equals("")) { xPath = new String[] { "/LibraryClass" }; } else { @@ -613,16 +616,23 @@ public class SurfaceAreaQuery { } LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns; - String[] libraryClassName = new String[libraryClassList.length]; + List libraryClassName = new ArrayList(); for (int i = 0; i < libraryClassList.length; i++) { - libraryClassName[i] = libraryClassList[i].getKeyword(); + List archList = libraryClassList[i].getSupArchList(); + + if (arch == null || contains(archList, arch)) { + libraryClassName.add(libraryClassList[i].getKeyword()); + } } - return libraryClassName; + + String[] libraryArray = new String[libraryClassName.size()]; + libraryClassName.toArray(libraryArray); + return libraryArray; } /** * Retrieve ModuleEntryPoint names - * + * * @returns ModuleEntryPoint name list if elements are found at the known * xpath * @returns null if nothing is there @@ -647,10 +657,10 @@ public class SurfaceAreaQuery { /** * retrieve Protocol for specified usage - * + * * @param usage * Protocol usage arch Architecture - * + * * @returns Protocol String list if elements are found at the known xpath * @returns String[0] if nothing is there */ @@ -687,10 +697,10 @@ public class SurfaceAreaQuery { /** * retrieve Protocol for specified usage - * + * * @param arch * Architecture - * + * * @returns Protocol String list if elements are found at the known xpath * @returns String[0] if nothing is there */ @@ -710,7 +720,7 @@ public class SurfaceAreaQuery { Protocol[] returnlList = (Protocol[]) returns; List protocolList = new ArrayList(); - + for (int i = 0; i < returns.length; i++) { List archList = returnlList[i].getSupArchList(); if (archList == null || contains(archList, arch)){ @@ -726,10 +736,10 @@ public class SurfaceAreaQuery { /** * Retrieve ProtocolNotify for specified usage - * + * * @param usage * ProtocolNotify usage - * + * * @returns String[] if elements are found at the known xpath * @returns String[0] if nothing is there */ @@ -748,13 +758,13 @@ public class SurfaceAreaQuery { } List protocolNotifyList = new ArrayList(); - + for (int i = 0; i < returns.length; i++) { List archList = ((ProtocolNotify) returns[i]).getSupArchList(); if (archList == null || contains(archList, arch)){ protocolNotifyList.add(((ProtocolNotify) returns[i]).getProtocolNotifyCName()); } - + } String[] protocolNotifyArray = new String[protocolNotifyList.size()]; for (int i = 0; i < protocolNotifyList.size(); i++) { @@ -765,10 +775,10 @@ public class SurfaceAreaQuery { /** * Retrieve ProtocolNotify for specified usage - * + * * @param usage * ProtocolNotify usage - * + * * @returns String[] if elements are found at the known xpath * @returns String[0] if nothing is there */ @@ -805,7 +815,7 @@ public class SurfaceAreaQuery { /** * Retrieve ModuleUnloadImage names - * + * * @returns ModuleUnloadImage name list if elements are found at the known * xpath * @returns null if nothing is there @@ -830,7 +840,7 @@ public class SurfaceAreaQuery { /** * Retrieve Extern - * + * * @returns Extern objects list if elements are found at the known xpath * @returns null if nothing is there */ @@ -847,10 +857,10 @@ public class SurfaceAreaQuery { /** * Retrieve PpiNotify for specified arch - * + * * @param arch * PpiNotify arch - * + * * @returns String[] if elements are found at the known xpath * @returns String[0] if nothing is there */ @@ -868,14 +878,14 @@ public class SurfaceAreaQuery { return new String[0]; } - + List ppiNotifyList = new ArrayList(); for (int i = 0; i < returns.length; i++) { List archList = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getSupArchList(); if (archList == null || contains(archList, arch)){ - ppiNotifyList.add(((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName()); + ppiNotifyList.add(((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName()); } - + } String[] ppiNotifyArray = new String[ppiNotifyList.size()]; for (int i = 0; i < ppiNotifyList.size(); i++) { @@ -887,11 +897,11 @@ public class SurfaceAreaQuery { /** * Retrieve PpiNotify for specified usage and arch - * + * * @param arch * PpiNotify arch usage PpiNotify usage - * - * + * + * * @returns String[] if elements are found at the known xpath * @returns String[0] if nothing is there */ @@ -928,10 +938,10 @@ public class SurfaceAreaQuery { /** * Retrieve Ppi for specified arch - * + * * @param arch * Ppi arch - * + * * @returns String[] if elements are found at the known xpath * @returns String[0] if nothing is there */ @@ -953,9 +963,9 @@ public class SurfaceAreaQuery { for (int i = 0; i < returns.length; i++) { List archList = ((PPIsDocument.PPIs.Ppi) returns[i]).getSupArchList(); if (archList == null || contains(archList, arch)){ - ppiList.add(((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName()); + ppiList.add(((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName()); } - + } String[] ppiArray = new String[ppiList.size()]; for (int i = 0; i < ppiList.size(); i++) { @@ -966,11 +976,11 @@ public class SurfaceAreaQuery { /** * Retrieve PpiNotify for specified usage and arch - * + * * @param arch * PpiNotify arch usage PpiNotify usage - * - * + * + * * @returns String[] if elements are found at the known xpath * @returns String[0] if nothing is there */ @@ -1007,10 +1017,10 @@ public class SurfaceAreaQuery { /** * Retrieve GuidEntry information for specified usage - * + * * @param arch * GuidEntry arch - * + * * @returns GuidEntry objects list if elements are found at the known xpath * @returns null if nothing is there */ @@ -1032,9 +1042,9 @@ public class SurfaceAreaQuery { for (int i = 0; i < returns.length; i++) { List archList = ((GuidsDocument.Guids.GuidCNames) returns[i]).getSupArchList(); if (archList == null || contains(archList, arch)){ - guidList.add(((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName()); + guidList.add(((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName()); } - + } String[] guidArray = new String[guidList.size()]; for (int i = 0; i < guidList.size(); i++) { @@ -1046,10 +1056,10 @@ public class SurfaceAreaQuery { /** * Retrieve GuidEntry information for specified usage - * + * * @param arch * GuidEntry arch usage GuidEntry usage - * + * * @returns GuidEntry objects list if elements are found at the known xpath * @returns null if nothing is there */ @@ -1085,12 +1095,12 @@ public class SurfaceAreaQuery { /** * Retrieve Library instance information - * + * * @param arch * Architecture name * @param usage * Library instance usage - * + * * @returns library instance name list if elements are found at the known * xpath * @returns null if nothing is there @@ -1106,7 +1116,7 @@ public class SurfaceAreaQuery { xPath = new String[] { "/Instance" }; } else { // - // Since Schema don't have SupArchList now, so the follow Xpath is + // Since Schema don't have SupArchList now, so the follow Xpath is // equal to "/Instance" and [not(@SupArchList) or @SupArchList= arch] // don't have effect. // @@ -1161,7 +1171,7 @@ public class SurfaceAreaQuery { /** * Retrive library's constructor name - * + * * @returns constructor name list if elements are found at the known xpath * @returns null if nothing is there */ @@ -1179,7 +1189,7 @@ public class SurfaceAreaQuery { /** * Retrive library's destructor name - * + * * @returns destructor name list if elements are found at the known xpath * @returns null if nothing is there */ @@ -1200,7 +1210,7 @@ public class SurfaceAreaQuery { /** * Retrive DriverBinding names - * + * * @returns DriverBinding name list if elements are found at the known xpath * @returns null if nothing is there */ @@ -1211,7 +1221,7 @@ public class SurfaceAreaQuery { /** * Retrive ComponentName names - * + * * @returns ComponentName name list if elements are found at the known xpath * @returns null if nothing is there */ @@ -1222,7 +1232,7 @@ public class SurfaceAreaQuery { /** * Retrive DriverConfig names - * + * * @returns DriverConfig name list if elements are found at the known xpath * @returns null if nothing is there */ @@ -1233,7 +1243,7 @@ public class SurfaceAreaQuery { /** * Retrive DriverDiag names - * + * * @returns DriverDiag name list if elements are found at the known xpath * @returns null if nothing is there */ @@ -1244,7 +1254,7 @@ public class SurfaceAreaQuery { /** * Retrive SetVirtualAddressMapCallBack names - * + * * @returns SetVirtualAddressMapCallBack name list if elements are found at * the known xpath * @returns null if nothing is there @@ -1256,7 +1266,7 @@ public class SurfaceAreaQuery { /** * Retrive ExitBootServicesCallBack names - * + * * @returns ExitBootServicesCallBack name list if elements are found at the * known xpath * @returns null if nothing is there @@ -1266,9 +1276,33 @@ public class SurfaceAreaQuery { return getCNames("Externs", xPath); } + /** + Judge whether current driver is PEI_PCD_DRIVER or DXE_PCD_DRIVER or + NOT_PCD_DRIVER. + + @return CommonDefinition.PCD_DRIVER_TYPE the type of current driver + **/ + public static CommonDefinition.PCD_DRIVER_TYPE getPcdDriverType() { + String[] xPath = new String[] {"/PcdIsDriver"}; + Object[] results = get ("Externs", xPath); + + if (results != null && results.length != 0) { + PcdDriverTypes type = (PcdDriverTypes) results[0]; + String typeStr = type.enumValue().toString(); + if (typeStr.equals(CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER.toString())) { + return CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER; + } else if (typeStr.equals(CommonDefinition.PCD_DRIVER_TYPE.DXE_PCD_DRIVER.toString())) { + return CommonDefinition.PCD_DRIVER_TYPE.DXE_PCD_DRIVER; + } + return CommonDefinition.PCD_DRIVER_TYPE.UNKNOWN_PCD_DRIVER; + } + + return CommonDefinition.PCD_DRIVER_TYPE.NOT_PCD_DRIVER; + } + /** * Retrieve module surface area file information - * + * * @returns ModuleSA objects list if elements are found at the known xpath * @returns Empty ModuleSA list if nothing is there */ @@ -1298,24 +1332,24 @@ public class SurfaceAreaQuery { ObjectMap.put("Libraries", moduleSA.getLibraries()); } if (((ModuleSADocument.ModuleSA) result[i]).getPcdBuildDefinition() != null) { - ObjectMap.put("PcdBuildDefinition", moduleSA - .getPcdBuildDefinition()); + ObjectMap.put("PcdBuildDefinition", moduleSA.getPcdBuildDefinition()); } - if (((ModuleSADocument.ModuleSA) result[i]) - .getModuleSaBuildOptions() != null) { - ObjectMap.put("ModuleSaBuildOptions", moduleSA - .getModuleSaBuildOptions()); + if (((ModuleSADocument.ModuleSA) result[i]).getModuleSaBuildOptions() != null) { + ObjectMap.put("ModuleSaBuildOptions", moduleSA.getModuleSaBuildOptions()); } // // Get Fpd SA Module attribute and create FpdMoudleIdentification. // - arch = moduleSA.getSupArchList().toString(); + if (moduleSA.isSetSupArchList()) { + arch = moduleSA.getSupArchList().toString(); + } else { + arch = null; + } // TBD fvBinding = null; - saVersion = ((ModuleSADocument.ModuleSA) result[i]) - .getModuleVersion(); + saVersion = ((ModuleSADocument.ModuleSA) result[i]).getModuleVersion(); saGuid = moduleSA.getModuleGuid(); pkgGuid = moduleSA.getPackageGuid(); @@ -1325,10 +1359,8 @@ public class SurfaceAreaQuery { // Create Module Identification which have class member of package // identification. // - PackageIdentification pkgId = new PackageIdentification(null, - pkgGuid, pkgVersion); - ModuleIdentification saId = new ModuleIdentification(null, saGuid, - saVersion); + PackageIdentification pkgId = new PackageIdentification(null, pkgGuid, pkgVersion); + ModuleIdentification saId = new ModuleIdentification(null, saGuid, saVersion); saId.setPackage(pkgId); @@ -1336,21 +1368,24 @@ public class SurfaceAreaQuery { // Create FpdModule Identification which have class member of module // identification // - if (arch != null) { - String[] archList = arch.split(" "); - for (int j = 0; j < archList.length; j++) { - FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId, archList[j]); - - if (fvBinding != null) { - fpdSaId.setFvBinding(fvBinding); - } - - // - // Put element to Map>. - // - fpdModuleMap.put(fpdSaId, ObjectMap); + String[] archList = new String[0]; + if (arch == null || arch.trim().length() == 0) { + archList = GlobalData.getToolChainInfo().getArchs(); + } else { + archList = arch.split(" "); + } + for (int j = 0; j < archList.length; j++) { + FpdModuleIdentification fpdSaId = new FpdModuleIdentification(saId, archList[j]); + + if (fvBinding != null) { + fpdSaId.setFvBinding(fvBinding); } + + // + // Put element to Map>. + // + fpdModuleMap.put(fpdSaId, ObjectMap); } } return fpdModuleMap; @@ -1358,7 +1393,7 @@ public class SurfaceAreaQuery { /** * Retrieve valid image names - * + * * @returns valid iamges name list if elements are found at the known xpath * @returns empty list if nothing is there */ @@ -1377,31 +1412,43 @@ public class SurfaceAreaQuery { return result; } - - public static Node getFpdUserExtension() { - String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore']" }; + + public static Node getFpdUserExtensionPreBuild() { + String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" }; Object[] queryResult = get("PlatformSurfaceArea", xPath); if (queryResult == null || queryResult.length == 0) { return null; } UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0]; - + + return a.getDomNode(); + } + + public static Node getFpdUserExtensionPostBuild() { + String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" }; + + Object[] queryResult = get("PlatformSurfaceArea", xPath); + if (queryResult == null || queryResult.length == 0) { + return null; + } + UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0]; + return a.getDomNode(); } /** * Retrieve FV image option information - * + * * @param fvName * FV image name - * + * * @returns option name/value list if elements are found at the known xpath * @returns empty list if nothing is there */ public static String[][] getFpdOptions(String fvName) { String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Options' and ./FvImageNames='" - + fvName.toUpperCase() + "']/FvImageOptions" }; + + fvName + "']/FvImageOptions" }; Object[] queryResult = get("PlatformSurfaceArea", xPath); if (queryResult == null) { return new String[0][]; @@ -1459,24 +1506,24 @@ public class SurfaceAreaQuery { /** * Retrieve FV image attributes information - * + * * @param fvName * FV image name - * + * * @returns attribute name/value list if elements are found at the known * xpath * @returns empty list if nothing is there */ public static String[][] getFpdAttributes(String fvName) { String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Attributes' and ./FvImageNames='" - + fvName.toUpperCase() + "']/FvImageOptions" }; + + fvName + "']/FvImageOptions" }; Object[] queryResult = get("PlatformSurfaceArea", xPath); if (queryResult == null) { return new String[0][]; } ArrayList list = new ArrayList(); for (int i = 0; i < queryResult.length; i++) { - + FvImagesDocument.FvImages.FvImage.FvImageOptions item = (FvImagesDocument.FvImages.FvImage.FvImageOptions) queryResult[i]; List namevalues = item.getNameValueList(); Iterator iter = namevalues.iterator(); @@ -1496,7 +1543,7 @@ public class SurfaceAreaQuery { /** * Retrieve flash definition file name - * + * * @returns file name if elements are found at the known xpath * @returns null if nothing is there */ @@ -1520,26 +1567,26 @@ public class SurfaceAreaQuery { } String[][] result = new String[queryResult.length][2]; - + for (int i = 0; i < queryResult.length; i++) { FvImagesDocument.FvImages.NameValue item = (FvImagesDocument.FvImages.NameValue)queryResult[i]; result[i][0] = item.getName(); result[i][1] = item.getValue(); } - return result; + return result; } - + /** * Retrieve FV image component options - * + * * @param fvName * FV image name - * + * * @returns name/value pairs list if elements are found at the known xpath * @returns empty list if nothing is there */ public static String[][] getFpdComponents(String fvName) { - String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName.toUpperCase() + "']/FvImageOptions" }; + String[] xPath = new String[] { "/Flash/FvImages/FvImage[@Type='Components' and ./FvImageNames='"+ fvName + "']/FvImageOptions" }; Object[] queryResult = get("PlatformSurfaceArea", xPath); if (queryResult == null) { return new String[0][]; @@ -1561,12 +1608,12 @@ public class SurfaceAreaQuery { result[i][0] = list.get(i)[0]; result[i][1] = list.get(i)[1]; } - return result; + return result; } /** * Retrieve PCD tokens - * + * * @returns CName/ItemType pairs list if elements are found at the known * xpath * @returns null if nothing is there @@ -1584,7 +1631,7 @@ public class SurfaceAreaQuery { /** * Retrieve MAS header - * + * * @return * @return */ @@ -1616,12 +1663,12 @@ public class SurfaceAreaQuery { /** * Retrieve Extern Specification - * + * * @param - * + * * @return String[] If have specification element in the String[0] * If no specification element in the - * + * */ public static String[] getExternSpecificaiton() { @@ -1642,7 +1689,7 @@ public class SurfaceAreaQuery { /** * Retreive MsaFile which in SPD - * + * * @param * @return String[][3] The string sequence is ModuleName, ModuleGuid, * ModuleVersion, MsaFile String[0][] If no msafile in SPD @@ -1751,7 +1798,7 @@ public class SurfaceAreaQuery { String[] guidPair = new String[2]; guidPair[0] = entry.getCName(); guidPair[1] = entry.getGuidValue(); - guidDeclMap.put(entry.getName(), guidPair); + guidDeclMap.put(entry.getCName(), guidPair); EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName()); EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[0]); EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[1]); @@ -1782,7 +1829,7 @@ public class SurfaceAreaQuery { protocolPair[0] = entry.getCName(); protocolPair[1] = entry.getGuidValue(); - protoclMap.put(entry.getName(), protocolPair); + protoclMap.put(entry.getCName(), protocolPair); EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName()); EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[0]); EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[1]); @@ -1792,7 +1839,7 @@ public class SurfaceAreaQuery { /** * getSpdPpi() Retrieve the SPD PPI Entry - * + * * @param * @return Map if get the PPI entry from SPD. Key - PPI * Name String[0] - PPI CNAME String[1] - PPI Guid Null if no PPI @@ -1817,14 +1864,14 @@ public class SurfaceAreaQuery { String[] ppiPair = new String[2]; ppiPair[0] = entry.getCName(); ppiPair[1] = entry.getGuidValue(); - ppiMap.put(entry.getName(), ppiPair); + ppiMap.put(entry.getCName(), ppiPair); } return ppiMap; } /** * Retrieve module Guid string - * + * * @returns GUILD string if elements are found at the known xpath * @returns null if nothing is there */ @@ -1856,7 +1903,7 @@ public class SurfaceAreaQuery { /** Get name array of PCD in a module. In one module, token space is same, and token name should not be conflicted. - + @return String[] **/ public static String[] getModulePcdEntryNameArray() { @@ -1885,6 +1932,9 @@ public class SurfaceAreaQuery { @return boolean **/ public static boolean contains(List list, String str) { + if (list == null || list.size()== 0) { + return true; + } Iterator it = list.iterator(); while (it.hasNext()) { String s = (String)it.next(); @@ -1895,4 +1945,21 @@ public class SurfaceAreaQuery { return false; } + + public static boolean isHaveTianoR8FlashMap(){ + String[] xPath = new String[] {"/"}; + Object[] returns = get ("Externs", xPath); + + if (returns == null) { + return false; + } + + ExternsDocument.Externs ext = (ExternsDocument.Externs)returns[0]; + + if (ext.getTianoR8FlashMapH()){ + return true; + }else { + return false; + } + } }