Fix the bug that using hardcode driver name to judge whether current driver is PCD driver.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1281 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2006-08-15 17:11:06 +00:00
parent d208e1e260
commit 5f907e4a5b
6 changed files with 1791 additions and 1723 deletions

View File

@ -88,6 +88,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
</GuidCNames>
</Guids>
<Externs>
<PcdIsDriver>DXE_PCD_DRIVER</PcdIsDriver>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern>

View File

@ -85,6 +85,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
</GuidCNames>
</Guids>
<Externs>
<PcdIsDriver>PEI_PCD_DRIVER</PcdIsDriver>
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
<Extern>

File diff suppressed because it is too large Load Diff

View File

@ -34,15 +34,15 @@ public class CommonDefinition {
public final static String autoGenHbegin = "extern int __make_me_compile_correctly;\r\n";
public final static String include = "#include";
public final static String autoGenCLine1 = "\r\n";
public final static String autoGenCLine2 = "const UINT8 _gDebugPropertyMask "
+ "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"
+ " | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"
+ " | DEBUG_PROPERTY_DEBUG_CODE_ENABLED;\r\n";
+ "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"
+ " | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"
+ " | DEBUG_PROPERTY_DEBUG_CODE_ENABLED;\r\n";
public final static String autoGenCLine3 = "const UINTN _gModuleDefaultErrorLevel"
+ " = EFI_D_ERROR | EFI_D_LOAD;\r\n";
+ " = EFI_D_ERROR | EFI_D_LOAD;\r\n";
public final static String autoGenHLine1 = "#define EFI_SPECIFICATION_VERSION 0x00020000\r\n";
public final static String autoGenHVersionDefault = "#define EFI_SPECIFICATION_VERSION 0x00000000\r\n";
public final static String autoGenHLine2 = "#define EDK_RELEASE_VERSION 0x00090000\r\n";
@ -56,32 +56,41 @@ public class CommonDefinition {
public final static String ppiGuid = "PpiGuid";
public final static String guidGuid = "Guid";
public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
public final static String flashMapH = "FlashMap.h";
public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
public final static String flashMapH = "FlashMap.h";
//
// The defintions for identifying current module
// is PEI Pcd driver or Dxe Pcd driver.
//
public static enum PCD_DRIVER_TYPE { NOT_PCD_DRIVER,
PEI_PCD_DRIVER,
DXE_PCD_DRIVER,
UNKNOWN_PCD_DRIVER};
//
// AutoGen.h and AutoGen.c file's header
//
public final static String autogenHNotation =
"/**\r\n" +
" DO NOT EDIT\r\n" +
" FILE auto-generated by GenBuild tasks\r\n" +
" Module name:\r\n" +
" AutoGen.h\r\n" +
" Abstract:" +
" Auto-generated AutoGen.h for building module or library.\r\n" +
"**/\r\n\r\n";
"/**\r\n" +
" DO NOT EDIT\r\n" +
" FILE auto-generated by GenBuild tasks\r\n" +
" Module name:\r\n" +
" AutoGen.h\r\n" +
" Abstract:" +
" Auto-generated AutoGen.h for building module or library.\r\n" +
"**/\r\n\r\n";
public final static String autogenCNotation =
"/**\r\n" +
" DO NOT EDIT\r\n" +
" FILE auto-generated by GenBuild tasks\r\n" +
" Module name:\r\n" +
" AutoGen.c\r\n" +
" Abstract:" +
" Auto-generated AutoGen.c for building module or library.\r\n" +
"**/\r\n\r\n";
"/**\r\n" +
" DO NOT EDIT\r\n" +
" FILE auto-generated by GenBuild tasks\r\n" +
" Module name:\r\n" +
" AutoGen.c\r\n" +
" Abstract:" +
" Auto-generated AutoGen.c for building module or library.\r\n" +
"**/\r\n\r\n";
//
// module type
//
@ -97,8 +106,8 @@ public class CommonDefinition {
public final static int ModuleTypeUefiDriver = 9;
public final static int ModuleTypeUefiApplication = 10;
public final static int ModuleTypeUnknown = 11;
//
// component type
//
@ -123,13 +132,13 @@ public class CommonDefinition {
public final static int ComponentTypeCustomBuild = 18;
public final static int ComponentTypeUnknown = 19;
//
// Usaged style
//
public final static String AlwaysConsumed = "ALWAYS_CONSUMED";
public final static String AlwaysProduced = "ALWAYS_PRODUCED";
public static class MyEnum {
String moduleTypeStr;
@ -147,47 +156,47 @@ public class CommonDefinition {
return -1;
}
}
//
// Module type
//
public static final MyEnum[] moduleEnum = new MyEnum[] {
new MyEnum("BASE", ModuleTypeBase),
new MyEnum("SEC", ModuleTypeSec),
new MyEnum("PEI_CORE", ModuleTypePeiCore),
new MyEnum("PEIM", ModuleTypePeim),
new MyEnum("DXE_CORE", ModuleTypeDxeCore),
new MyEnum("DXE_DRIVER", ModuleTypeDxeDriver),
new MyEnum("DXE_RUNTIME_DRIVER", ModuleTypeDxeRuntimeDriver),
new MyEnum("DXE_SAL_DRIVER", ModuleTypeDxeSalDriver),
new MyEnum("DXE_SMM_DRIVER", ModuleTypeDxeSmmDriver),
new MyEnum("UEFI_DRIVER", ModuleTypeUefiDriver),
new MyEnum("UEFI_APPLICATION", ModuleTypeUefiApplication) };
new MyEnum("BASE", ModuleTypeBase),
new MyEnum("SEC", ModuleTypeSec),
new MyEnum("PEI_CORE", ModuleTypePeiCore),
new MyEnum("PEIM", ModuleTypePeim),
new MyEnum("DXE_CORE", ModuleTypeDxeCore),
new MyEnum("DXE_DRIVER", ModuleTypeDxeDriver),
new MyEnum("DXE_RUNTIME_DRIVER", ModuleTypeDxeRuntimeDriver),
new MyEnum("DXE_SAL_DRIVER", ModuleTypeDxeSalDriver),
new MyEnum("DXE_SMM_DRIVER", ModuleTypeDxeSmmDriver),
new MyEnum("UEFI_DRIVER", ModuleTypeUefiDriver),
new MyEnum("UEFI_APPLICATION", ModuleTypeUefiApplication)};
//
// Component type
//
public static final MyEnum[] componentEnum = new MyEnum[]{
new MyEnum("APRIORI", ComponentTypeApriori),
new MyEnum("SEC", ComponentTypeSec),
new MyEnum("LIBRARY", ComponentTypeLibrary),
new MyEnum("FV_IMAGE_FILE", ComponentTypeFvImageFile),
new MyEnum("BS_DRIVER", ComponentTypeBsDriver),
new MyEnum("RT_DRIVER", ComponentTypeRtDriver),
new MyEnum("SAL_RT_DRIVER", ComponentTypeSalRtDriver),
new MyEnum("PE32_PEIM", ComponentTypePe32Peim),
new MyEnum("PIC_PEIM", ComponentTypePicPeim),
new MyEnum("COMBINED_PEIM_DRIVER", ComponentTypeCombinedPeimDriver),
new MyEnum("PEI_CORE", ComponentTypePeiCore),
new MyEnum("DXE_CORE", ComponentTypeDxeCore),
new MyEnum("APPLICATION", ComponentTypeApplication),
new MyEnum("BS_DRIVER_EFI", ComponentTypeBsDriverEfi),
new MyEnum("SHELLAPP", ComponentTypeShellApp),
new MyEnum("BINARY", ComponentTypeBinary),
new MyEnum("LOGO", ComponentTypeLogo),
new MyEnum("CUSTOM_BUILD", ComponentTypeCustomBuild)
};
new MyEnum("APRIORI", ComponentTypeApriori),
new MyEnum("SEC", ComponentTypeSec),
new MyEnum("LIBRARY", ComponentTypeLibrary),
new MyEnum("FV_IMAGE_FILE", ComponentTypeFvImageFile),
new MyEnum("BS_DRIVER", ComponentTypeBsDriver),
new MyEnum("RT_DRIVER", ComponentTypeRtDriver),
new MyEnum("SAL_RT_DRIVER", ComponentTypeSalRtDriver),
new MyEnum("PE32_PEIM", ComponentTypePe32Peim),
new MyEnum("PIC_PEIM", ComponentTypePicPeim),
new MyEnum("COMBINED_PEIM_DRIVER", ComponentTypeCombinedPeimDriver),
new MyEnum("PEI_CORE", ComponentTypePeiCore),
new MyEnum("DXE_CORE", ComponentTypeDxeCore),
new MyEnum("APPLICATION", ComponentTypeApplication),
new MyEnum("BS_DRIVER_EFI", ComponentTypeBsDriverEfi),
new MyEnum("SHELLAPP", ComponentTypeShellApp),
new MyEnum("BINARY", ComponentTypeBinary),
new MyEnum("LOGO", ComponentTypeLogo),
new MyEnum("CUSTOM_BUILD", ComponentTypeCustomBuild)
};
/**
getModuleType
@ -234,18 +243,18 @@ public class CommonDefinition {
@param componentType Integer value of component type.
@return
**/
**/
static public String getComponentTypeString (int componentType) {
if ((componentType > CommonDefinition.ComponentTypeUnknown) ||
(componentType < CommonDefinition.ComponentTypeNull)) {
return null;
}
for (int index = 0; index < CommonDefinition.componentEnum.length; index ++) {
if (componentType == CommonDefinition.componentEnum[index].type) {
return CommonDefinition.componentEnum[index].moduleTypeStr;
if ((componentType > CommonDefinition.ComponentTypeUnknown) ||
(componentType < CommonDefinition.ComponentTypeNull)) {
return null;
}
}
return null;
for (int index = 0; index < CommonDefinition.componentEnum.length; index ++) {
if (componentType == CommonDefinition.componentEnum[index].type) {
return CommonDefinition.componentEnum[index].moduleTypeStr;
}
}
return null;
}
/**
@ -258,12 +267,12 @@ public class CommonDefinition {
@return
**/
static public boolean isLibraryComponent (int componentType) {
if (ComponentTypeLibrary == componentType) {
return true;
}
return false;
if (ComponentTypeLibrary == componentType) {
return true;
}
return false;
}
/**
* formateGuidName
*
@ -278,7 +287,7 @@ public class CommonDefinition {
String guid = "";
int index = 0;
if (guidNameConv
.matches("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}")) {
.matches("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}")) {
strList = guidNameConv.split("-");
guid = "0x" + strList[0] + ", ";
guid = guid + "0x" + strList[1] + ", ";
@ -295,7 +304,7 @@ public class CommonDefinition {
guid = guid + "}";
return guid;
} else if (guidNameConv
.matches("0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?")) {
.matches("0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?")) {
strList = guidNameConv.split(",");
//
@ -317,12 +326,12 @@ public class CommonDefinition {
return guid;
} else {
System.out
.println("Check GUID Value, It doesn't conform to the registry format specified in the schema!!!");
.println("Check GUID Value, It doesn't conform to the registry format specified in the schema!!!");
return "0";
}
}
/**
* Remove deuplicat string in list
*
@ -335,20 +344,20 @@ public class CommonDefinition {
public static String[] remDupString (String[] orgList){
Set<String> strList = new LinkedHashSet<String>();
String[] desList ;
if (orgList == null){
if (orgList == null) {
return new String[0];
}
for (int i = 0; i < orgList.length; i++){
for (int i = 0; i < orgList.length; i++) {
strList.add(orgList[i]);
}
desList = new String[strList.size()];
Iterator item = strList.iterator();
int index = 0;
while (item.hasNext()){
while (item.hasNext()) {
desList[index] = (String)item.next();
index++;
}
return desList;
}
}

View File

@ -60,6 +60,7 @@ 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;
@ -67,6 +68,7 @@ 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.build.autogen.CommonDefinition;
/**
* SurfaceAreaQuery class is used to query Surface Area information from msa,
@ -1275,6 +1277,30 @@ 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
*

View File

@ -22,16 +22,17 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.tianocore.build.autogen.CommonDefinition;
import org.tianocore.build.exception.PcdAutogenException;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.pcd.action.ActionMessage;
import org.tianocore.pcd.action.BuildAction;
import org.tianocore.pcd.entity.MemoryDatabaseManager;
import org.tianocore.pcd.entity.Token;
import org.tianocore.pcd.entity.UsageIdentification;
import org.tianocore.pcd.entity.UsageInstance;
import org.tianocore.pcd.exception.BuildActionException;
import org.tianocore.pcd.entity.UsageIdentification;
import org.tianocore.pcd.action.BuildAction;
import org.tianocore.pcd.action.ActionMessage;
import org.tianocore.build.exception.PcdAutogenException;
/** This class is to manage how to generate the PCD information into Autogen.c and
Autogen.h.
@ -52,6 +53,11 @@ public class PCDAutoGenAction extends BuildAction {
///
private boolean isBuildUsedLibrary;
///
/// One of PEI_PCD_DRIVER, DXE_PCD_DRIVER, NOT_PCD_DRIVER
///
private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType;
///
/// The generated string for header file.
///
@ -76,6 +82,14 @@ public class PCDAutoGenAction extends BuildAction {
this.usageId = usageId;
}
/**
Set paramter pcdDriverType
@param pcdDriverType the driver type for PCD
**/
public void setPcdDriverType(CommonDefinition.PCD_DRIVER_TYPE pcdDriverType) {
this.pcdDriverType = pcdDriverType;
}
/**
set isBuildUsedLibrary parameter.
@ -122,11 +136,14 @@ public class PCDAutoGenAction extends BuildAction {
@param arch the architecture for module
@param isBuildUsedLibary Is the current module library.
@param pcdNameArrayInMsa the pcd name array got from MSA file.
@param pcdDriverType one of PEI_PCD_DRIVER, DXE_PCD_DRIVER,
NOT_PCD_DRIVER
**/
public PCDAutoGenAction(ModuleIdentification moduleId,
String arch,
boolean isBuildUsedLibrary,
String[] pcdNameArrayInMsa) {
String[] pcdNameArrayInMsa,
CommonDefinition.PCD_DRIVER_TYPE pcdDriverType) {
dbManager = null;
hAutoGenString = "";
cAutoGenString = "";
@ -140,6 +157,7 @@ public class PCDAutoGenAction extends BuildAction {
moduleId.getModuleType()));
setIsBuildUsedLibrary(isBuildUsedLibrary);
setPcdNameArrayInMsa(pcdNameArrayInMsa);
setPcdDriverType(pcdDriverType);
}
/**
@ -303,10 +321,10 @@ public class PCDAutoGenAction extends BuildAction {
// Work around code, In furture following code should be modified that get
// these information from Uplevel Autogen tools.
//
if (moduleName.equalsIgnoreCase("PcdPeim")) {
if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER) {
hAutoGenString += MemoryDatabaseManager.PcdPeimHString;
cAutoGenString += MemoryDatabaseManager.PcdPeimCString;
} else if (moduleName.equalsIgnoreCase("PcdDxe")) {
} else if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.DXE_PCD_DRIVER) {
hAutoGenString += MemoryDatabaseManager.PcdDxeHString;
cAutoGenString += MemoryDatabaseManager.PcdDxeCString;
}