private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType;\r
\r
///\r
- /// The protocl list which records in module or library surface area and\r
- /// it's dependence on library instance surface area.\r
+ /// The Guid CName list which recoreded in module or library surface area \r
+ /// and it's dependence on library instance surface area.\r
///\r
- private Set<String> mProtocolList = new HashSet<String>();\r
-\r
- ///\r
- /// The Ppi list which recorded in module or library surface area and its\r
- /// dependency on library instance surface area.\r
- ///\r
- private Set<String> mPpiList = new HashSet<String>();\r
-\r
- ///\r
- /// The Guid list which recoreded in module or library surface area and it's\r
- /// dependence on library instance surface area.\r
- ///\r
- private Set<String> mGuidList = new HashSet<String>();\r
+ private Set<String> mGuidCNameList = new HashSet<String>();\r
\r
///\r
/// The dependence package list which recoreded in module or library surface\r
//\r
// Write library class's related *.h file to autogen.h.\r
//\r
+ List<String> libClasses = new ArrayList<String>(100);\r
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);\r
- if (libClassList.length > 0) {\r
- libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
- item = libClassIncludeH.iterator();\r
- while (item.hasNext()) {\r
- fileBuffer.append(item.next().toString());\r
- }\r
+ for (int i = 0; i < libClassList.length; ++i) {\r
+ libClasses.add(libClassList[i]);\r
}\r
\r
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);\r
- if (libClassList.length > 0) {\r
- libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
- item = libClassIncludeH.iterator();\r
- while (item.hasNext()) {\r
- fileBuffer.append(item.next().toString());\r
+ for (int i = 0; i < libClassList.length; ++i) {\r
+ libClasses.add(libClassList[i]);\r
+ }\r
+ //\r
+ // Add AutoGen used library class\r
+ // \r
+ int moduleTypeId = CommonDefinition.getModuleType(moduleType);\r
+ if (!libClasses.contains("DebugLib") && moduleTypeId != CommonDefinition.ModuleTypeUnknown\r
+ && moduleTypeId != CommonDefinition.ModuleTypeBase) {\r
+ libClasses.add("DebugLib");\r
+ }\r
+ switch (moduleTypeId) {\r
+ case CommonDefinition.ModuleTypeDxeDriver:\r
+ case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+ case CommonDefinition.ModuleTypeDxeSalDriver:\r
+ case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+ case CommonDefinition.ModuleTypeUefiDriver:\r
+ case CommonDefinition.ModuleTypeUefiApplication:\r
+ if (!libClasses.contains("UefiBootServicesTableLib")) {\r
+ libClasses.add("UefiBootServicesTableLib");\r
}\r
+ break;\r
}\r
+ LibraryClassToAutogenH(fileBuffer, libClasses.toArray(new String[libClasses.size()]));\r
fileBuffer.append("\r\n");\r
\r
//\r
//\r
String guid = CommonDefinition.formatGuidName(saq.getModuleGuid());\r
if (this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
+ globalDeclarations.append("extern GUID gEfiCallerIdGuid;\r\n");\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = {");\r
- } else {\r
+ } else if (!this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_USER_DEFINED)) {\r
+ globalDeclarations.append("extern EFI_GUID gEfiCallerIdGuid;\r\n");\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");\r
}\r
\r
}\r
\r
//\r
- // Write consumed ppi, guid, protocol to autogen.c\r
+ // Write consumed ppi, guid, protocol, etc to autogen.c\r
//\r
- ProtocolGuidToAutogenC(fileBuffer);\r
- PpiGuidToAutogenC(fileBuffer);\r
- GuidGuidToAutogenC(fileBuffer);\r
+ CNameToAutogenC(fileBuffer);\r
\r
//\r
// Call pcd autogen.\r
//\r
// Write library class's related *.h file to autogen.h\r
//\r
+ List<String> libClasses = new ArrayList<String>(100);\r
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);\r
- if (libClassList != null) {\r
- libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
- item = libClassIncludeH.iterator();\r
- while (item.hasNext()) {\r
- fileBuffer.append(item.next().toString());\r
- }\r
+ for (int i = 0; i < libClassList.length; ++i) {\r
+ libClasses.add(libClassList[i]);\r
}\r
\r
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);\r
- if (libClassList != null) {\r
- libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
- item = libClassIncludeH.iterator();\r
- while (item.hasNext()) {\r
- fileBuffer.append(item.next().toString());\r
+ for (int i = 0; i < libClassList.length; ++i) {\r
+ libClasses.add(libClassList[i]);\r
+ }\r
+ //\r
+ // Add AutoGen used library class\r
+ // \r
+ int moduleTypeId = CommonDefinition.getModuleType(moduleType);\r
+ if (!libClasses.contains("DebugLib") && moduleTypeId != CommonDefinition.ModuleTypeUnknown\r
+ && moduleTypeId != CommonDefinition.ModuleTypeBase) {\r
+ libClasses.add("DebugLib");\r
+ }\r
+ switch (moduleTypeId) {\r
+ case CommonDefinition.ModuleTypeDxeDriver:\r
+ case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+ case CommonDefinition.ModuleTypeDxeSalDriver:\r
+ case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+ case CommonDefinition.ModuleTypeUefiDriver:\r
+ case CommonDefinition.ModuleTypeUefiApplication:\r
+ if (!libClasses.contains("UefiBootServicesTableLib")) {\r
+ libClasses.add("UefiBootServicesTableLib");\r
}\r
+ break;\r
}\r
+ LibraryClassToAutogenH(fileBuffer, libClasses.toArray(new String[libClasses.size()]));\r
fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);\r
\r
//\r
build module or library.\r
@return includeStrList List of *.h file.\r
**/\r
- Set<String> LibraryClassToAutogenH(String[] libClassList)\r
+ void LibraryClassToAutogenH(StringBuffer fileBuffer, String[] libClassList)\r
throws EdkException {\r
- Set<String> includeStrList = new LinkedHashSet<String>();\r
String includeName[];\r
String str = "";\r
\r
for (int j = 0; j < includeName.length; j++) {\r
String includeNameStr = includeName[j];\r
if (includeNameStr != null) {\r
- str = CommonDefinition.INCLUDE + " " + "<";\r
- str = str + includeNameStr + ">\r\n";\r
- includeStrList.add(str);\r
+ fileBuffer.append(CommonDefinition.INCLUDE);\r
+ fileBuffer.append(" <");\r
+ fileBuffer.append(includeNameStr);\r
+ fileBuffer.append(">\r\n");\r
includeNameStr = null;\r
}\r
}\r
}\r
- return includeStrList;\r
}\r
\r
/**\r
}\r
\r
/**\r
- PpiGuidToAutogenc\r
- \r
- This function gets GUIDs from SPD file accrodeing to <PPIs> information\r
- and write those GUIDs to AutoGen.c.\r
- \r
- @param fileBuffer\r
- String Buffer for Autogen.c file.\r
- @throws BuildException\r
- Guid must set value!\r
- **/\r
- void PpiGuidToAutogenC(StringBuffer fileBuffer) throws AutoGenException {\r
- String[] cNameGuid = null;\r
-\r
- //\r
- // Get the all PPI adn PPI Notify from MSA file,\r
- // then add those PPI ,and PPI Notify name to list.\r
- //\r
-\r
- String[] ppiList = saq.getPpiArray(this.arch);\r
- for (int i = 0; i < ppiList.length; i++) {\r
- this.mPpiList.add(ppiList[i]);\r
- }\r
-\r
- String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);\r
- for (int i = 0; i < ppiNotifyList.length; i++) {\r
- this.mPpiList.add(ppiNotifyList[i]);\r
- }\r
-\r
- //\r
- // Find CNAME and GUID from dependence SPD file and write to Autogen.c\r
- //\r
- Iterator ppiIterator = this.mPpiList.iterator();\r
- String ppiKeyWord = null;\r
- while (ppiIterator.hasNext()) {\r
- ppiKeyWord = ppiIterator.next().toString();\r
- cNameGuid = GlobalData.getPpiGuid(this.mDepPkgList, ppiKeyWord);\r
- if (cNameGuid != null) {\r
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
- fileBuffer.append(cNameGuid[0]);\r
- fileBuffer.append(" = { ");\r
- fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
- fileBuffer.append(" } ;");\r
- } else {\r
- //\r
- // If can't find Ppi GUID declaration in every package\r
- //\r
- throw new AutoGenException("Can not find Ppi GUID ["\r
- + ppiKeyWord + "] declaration in any SPD package!");\r
- }\r
- }\r
- }\r
-\r
- /**\r
- ProtocolGuidToAutogenc\r
+ CNameToAutogenc\r
\r
- This function gets GUIDs from SPD file accrodeing to <Protocol>\r
- information and write those GUIDs to AutoGen.c.\r
- \r
- @param fileBuffer\r
- String Buffer for Autogen.c file.\r
- @throws BuildException\r
- Protocol name must set.\r
- **/\r
- void ProtocolGuidToAutogenC(StringBuffer fileBuffer) throws EdkException {\r
- String[] cNameGuid = null;\r
-\r
- String[] protocolList = saq.getProtocolArray(this.arch);\r
-\r
- //\r
- // Add result to Autogen global list.\r
- //\r
- for (int i = 0; i < protocolList.length; i++) {\r
- this.mProtocolList.add(protocolList[i]);\r
- }\r
-\r
- String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);\r
-\r
- for (int i = 0; i < protocolNotifyList.length; i++) {\r
- this.mProtocolList.add(protocolNotifyList[i]);\r
- }\r
-\r
- //\r
- // Get the NAME and GUID from dependence SPD and write to Autogen.c\r
- //\r
- Iterator protocolIterator = this.mProtocolList.iterator();\r
- String protocolKeyWord = null;\r
-\r
-\r
- while (protocolIterator.hasNext()) {\r
- protocolKeyWord = protocolIterator.next().toString();\r
- cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, protocolKeyWord);\r
- if (cNameGuid != null) {\r
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
- fileBuffer.append(cNameGuid[0]);\r
- fileBuffer.append(" = { ");\r
- fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
- fileBuffer.append(" } ;");\r
- } else {\r
- //\r
- // If can't find protocol GUID declaration in every package\r
- //\r
- throw new AutoGenException("Can not find protocol Guid ["\r
- + protocolKeyWord + "] declaration in any SPD package!");\r
- }\r
- }\r
- }\r
-\r
- /**\r
- GuidGuidToAutogenc\r
- \r
- This function gets GUIDs from SPD file accrodeing to <Guids> information\r
- and write those GUIDs to AutoGen.c.\r
+ This function gets GUIDs from SPD file accrodeing to <Protocols> <Ppis> \r
+ <Guids> information and write those GUIDs to AutoGen.c.\r
\r
@param fileBuffer\r
String Buffer for Autogen.c file.\r
\r
**/\r
- void GuidGuidToAutogenC(StringBuffer fileBuffer) throws AutoGenException {\r
+ void CNameToAutogenC(StringBuffer fileBuffer) throws AutoGenException {\r
String[] cNameGuid = null;\r
String guidKeyWord = null;\r
\r
- String[] guidList = saq.getGuidEntryArray(this.arch);\r
-\r
- for (int i = 0; i < guidList.length; i++) {\r
- this.mGuidList.add(guidList[i]);\r
+ String[] cnameList = saq.getCNameArray(this.arch);\r
+ for (int i = 0; i < cnameList.length; i++) {\r
+ this.mGuidCNameList.add(cnameList[i]);\r
}\r
\r
\r
- Iterator guidIterator = this.mGuidList.iterator();\r
+ Iterator guidIterator = this.mGuidCNameList.iterator();\r
while (guidIterator.hasNext()) {\r
guidKeyWord = guidIterator.next().toString();\r
cNameGuid = GlobalData.getGuid(this.mDepPkgList, guidKeyWord);\r
-\r
- if (cNameGuid != null) {\r
- fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
- fileBuffer.append(cNameGuid[0]);\r
- fileBuffer.append(" = { ");\r
- fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
- fileBuffer.append("} ;");\r
- } else {\r
- //\r
- // If can't find GUID declaration in every package\r
- //\r
- throw new AutoGenException("Can not find Guid [" + guidKeyWord\r
- + "] declaration in any SPD package. ");\r
+ if (cNameGuid == null) {\r
+ cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, guidKeyWord);\r
+ if (cNameGuid == null) {\r
+ cNameGuid = GlobalData.getPpiGuid(this.mDepPkgList, guidKeyWord);\r
+ if (cNameGuid == null) {\r
+ //\r
+ // If can't find GUID declaration in every package, stop the build\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO,"WARN: Can not find Guid [" + guidKeyWord + "] declaration in any SPD file.");\r
+ continue;\r
+ //throw new AutoGenException("Can not find Guid [" + guidKeyWord\r
+ // + "] declaration in any SPD package. ");\r
+ }\r
+ }\r
}\r
\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
+ fileBuffer.append(cNameGuid[0]);\r
+ fileBuffer.append(" = { ");\r
+ fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
+ fileBuffer.append("} ;");\r
}\r
}\r
\r
+ " doesn't support module type " + moduleType);\r
}\r
//\r
- // Get <PPis>, <Protocols>, <Guids> list of this library\r
+ // Get CName list from <PPis>, <Protocols>, <Guids>, etc. of this library\r
// instance.\r
//\r
- String[] ppiList = saq.getPpiArray(this.arch);\r
- String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);\r
- String[] protocolList = saq.getProtocolArray(this.arch);\r
- String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);\r
- String[] guidList = saq.getGuidEntryArray(this.arch);\r
+ String[] guidCNameList = saq.getCNameArray(this.arch); \r
PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);\r
\r
//\r
// protocol, guid\r
// list.\r
//\r
- for (index = 0; index < ppiList.length; index++) {\r
- this.mPpiList.add(ppiList[index]);\r
- }\r
-\r
- for (index = 0; index < ppiNotifyList.length; index++) {\r
- this.mPpiList.add(ppiNotifyList[index]);\r
- }\r
-\r
- for (index = 0; index < protocolList.length; index++) {\r
- this.mProtocolList.add(protocolList[index]);\r
+ for (index = 0; index < guidCNameList.length; index++) {\r
+ this.mGuidCNameList.add(guidCNameList[index]);\r
}\r
\r
- for (index = 0; index < protocolNotifyList.length; index++) {\r
- this.mProtocolList.add(protocolNotifyList[index]);\r
- }\r
-\r
- for (index = 0; index < guidList.length; index++) {\r
- this.mGuidList.add(guidList[index]);\r
- }\r
for (index = 0; index < pkgList.length; index++) {\r
if (!this.mDepPkgList.contains(pkgList[index])) {\r
this.mDepPkgList.add(pkgList[index]);\r