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>

View File

@ -56,10 +56,12 @@ public class AutoGen {
/// The output path of Autogen.h and Autogen.c
///
private String outputPath;
///
/// The name of FV directory
///
private String fvDir;
///
/// The base name of module or library.
///
@ -76,6 +78,11 @@ public class AutoGen {
///
private PCDAutoGenAction myPcdAutogen;
///
/// the one of type : NOT_PCD_DRIVER, PEI_PCD_DRIVER, DXE_PCD_DRIVER
///
private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType;
///
/// The protocl list which records in module or library surface area and
/// it's dependence on library instance surface area.
@ -419,6 +426,7 @@ public class AutoGen {
String[] entryPointList = SurfaceAreaQuery.getModuleEntryPointArray();
EntryPointToAutoGen(CommonDefinition.remDupString(entryPointList), fileBuffer);
pcdDriverType = SurfaceAreaQuery.getPcdDriverType();
//
// Restore the DOC which include the FPD module info.
@ -475,7 +483,11 @@ public class AutoGen {
//
// Call pcd autogen.
//
this.myPcdAutogen = new PCDAutoGenAction(moduleId, this.arch, false, null);
this.myPcdAutogen = new PCDAutoGenAction(moduleId,
arch,
false,
null,
pcdDriverType);
try {
this.myPcdAutogen.execute();
} catch (Exception exp) {
@ -625,10 +637,11 @@ public class AutoGen {
//
// Call pcd autogen.
//
this.myPcdAutogen = new PCDAutoGenAction(this.moduleId,
this.arch,
this.myPcdAutogen = new PCDAutoGenAction(moduleId,
arch,
true,
SurfaceAreaQuery.getModulePcdEntryNameArray());
SurfaceAreaQuery.getModulePcdEntryNameArray(),
pcdDriverType);
try {
this.myPcdAutogen.execute();
} catch (Exception e) {

View File

@ -59,6 +59,15 @@ public class CommonDefinition {
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
//

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;
}