mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
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:
parent
d208e1e260
commit
5f907e4a5b
@ -88,6 +88,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
|||||||
</GuidCNames>
|
</GuidCNames>
|
||||||
</Guids>
|
</Guids>
|
||||||
<Externs>
|
<Externs>
|
||||||
|
<PcdIsDriver>DXE_PCD_DRIVER</PcdIsDriver>
|
||||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||||
<Extern>
|
<Extern>
|
||||||
|
@ -85,6 +85,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
|
|||||||
</GuidCNames>
|
</GuidCNames>
|
||||||
</Guids>
|
</Guids>
|
||||||
<Externs>
|
<Externs>
|
||||||
|
<PcdIsDriver>PEI_PCD_DRIVER</PcdIsDriver>
|
||||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||||
<Extern>
|
<Extern>
|
||||||
|
@ -56,10 +56,12 @@ public class AutoGen {
|
|||||||
/// The output path of Autogen.h and Autogen.c
|
/// The output path of Autogen.h and Autogen.c
|
||||||
///
|
///
|
||||||
private String outputPath;
|
private String outputPath;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The name of FV directory
|
/// The name of FV directory
|
||||||
///
|
///
|
||||||
private String fvDir;
|
private String fvDir;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The base name of module or library.
|
/// The base name of module or library.
|
||||||
///
|
///
|
||||||
@ -76,6 +78,11 @@ public class AutoGen {
|
|||||||
///
|
///
|
||||||
private PCDAutoGenAction myPcdAutogen;
|
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
|
/// The protocl list which records in module or library surface area and
|
||||||
/// it's dependence on library instance surface area.
|
/// it's dependence on library instance surface area.
|
||||||
@ -419,6 +426,7 @@ public class AutoGen {
|
|||||||
String[] entryPointList = SurfaceAreaQuery.getModuleEntryPointArray();
|
String[] entryPointList = SurfaceAreaQuery.getModuleEntryPointArray();
|
||||||
EntryPointToAutoGen(CommonDefinition.remDupString(entryPointList), fileBuffer);
|
EntryPointToAutoGen(CommonDefinition.remDupString(entryPointList), fileBuffer);
|
||||||
|
|
||||||
|
pcdDriverType = SurfaceAreaQuery.getPcdDriverType();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Restore the DOC which include the FPD module info.
|
// Restore the DOC which include the FPD module info.
|
||||||
@ -475,7 +483,11 @@ public class AutoGen {
|
|||||||
//
|
//
|
||||||
// Call pcd autogen.
|
// Call pcd autogen.
|
||||||
//
|
//
|
||||||
this.myPcdAutogen = new PCDAutoGenAction(moduleId, this.arch, false, null);
|
this.myPcdAutogen = new PCDAutoGenAction(moduleId,
|
||||||
|
arch,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
pcdDriverType);
|
||||||
try {
|
try {
|
||||||
this.myPcdAutogen.execute();
|
this.myPcdAutogen.execute();
|
||||||
} catch (Exception exp) {
|
} catch (Exception exp) {
|
||||||
@ -625,10 +637,11 @@ public class AutoGen {
|
|||||||
//
|
//
|
||||||
// Call pcd autogen.
|
// Call pcd autogen.
|
||||||
//
|
//
|
||||||
this.myPcdAutogen = new PCDAutoGenAction(this.moduleId,
|
this.myPcdAutogen = new PCDAutoGenAction(moduleId,
|
||||||
this.arch,
|
arch,
|
||||||
true,
|
true,
|
||||||
SurfaceAreaQuery.getModulePcdEntryNameArray());
|
SurfaceAreaQuery.getModulePcdEntryNameArray(),
|
||||||
|
pcdDriverType);
|
||||||
try {
|
try {
|
||||||
this.myPcdAutogen.execute();
|
this.myPcdAutogen.execute();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -59,6 +59,15 @@ public class CommonDefinition {
|
|||||||
public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
|
public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
|
||||||
public final static String flashMapH = "FlashMap.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
|
// AutoGen.h and AutoGen.c file's header
|
||||||
//
|
//
|
||||||
|
@ -60,6 +60,7 @@ import org.tianocore.FilenameDocument.Filename;
|
|||||||
import org.tianocore.MsaHeaderDocument.MsaHeader;
|
import org.tianocore.MsaHeaderDocument.MsaHeader;
|
||||||
import org.tianocore.ProtocolsDocument.Protocols.Protocol;
|
import org.tianocore.ProtocolsDocument.Protocols.Protocol;
|
||||||
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
|
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
|
||||||
|
import org.tianocore.PcdDriverTypes;
|
||||||
|
|
||||||
import org.tianocore.common.logger.EdkLog;
|
import org.tianocore.common.logger.EdkLog;
|
||||||
import org.tianocore.build.id.FpdModuleIdentification;
|
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.PackageIdentification;
|
||||||
import org.tianocore.build.id.PlatformIdentification;
|
import org.tianocore.build.id.PlatformIdentification;
|
||||||
import org.tianocore.build.toolchain.ToolChainInfo;
|
import org.tianocore.build.toolchain.ToolChainInfo;
|
||||||
|
import org.tianocore.build.autogen.CommonDefinition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SurfaceAreaQuery class is used to query Surface Area information from msa,
|
* SurfaceAreaQuery class is used to query Surface Area information from msa,
|
||||||
@ -1275,6 +1277,30 @@ public class SurfaceAreaQuery {
|
|||||||
return getCNames("Externs", xPath);
|
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
|
* Retrieve module surface area file information
|
||||||
*
|
*
|
||||||
|
@ -22,16 +22,17 @@ import java.util.List;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
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.global.GlobalData;
|
||||||
import org.tianocore.build.id.ModuleIdentification;
|
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.MemoryDatabaseManager;
|
||||||
import org.tianocore.pcd.entity.Token;
|
import org.tianocore.pcd.entity.Token;
|
||||||
|
import org.tianocore.pcd.entity.UsageIdentification;
|
||||||
import org.tianocore.pcd.entity.UsageInstance;
|
import org.tianocore.pcd.entity.UsageInstance;
|
||||||
import org.tianocore.pcd.exception.BuildActionException;
|
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
|
/** This class is to manage how to generate the PCD information into Autogen.c and
|
||||||
Autogen.h.
|
Autogen.h.
|
||||||
@ -52,6 +53,11 @@ public class PCDAutoGenAction extends BuildAction {
|
|||||||
///
|
///
|
||||||
private boolean isBuildUsedLibrary;
|
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.
|
/// The generated string for header file.
|
||||||
///
|
///
|
||||||
@ -76,6 +82,14 @@ public class PCDAutoGenAction extends BuildAction {
|
|||||||
this.usageId = usageId;
|
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.
|
set isBuildUsedLibrary parameter.
|
||||||
|
|
||||||
@ -122,11 +136,14 @@ public class PCDAutoGenAction extends BuildAction {
|
|||||||
@param arch the architecture for module
|
@param arch the architecture for module
|
||||||
@param isBuildUsedLibary Is the current module library.
|
@param isBuildUsedLibary Is the current module library.
|
||||||
@param pcdNameArrayInMsa the pcd name array got from MSA file.
|
@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,
|
public PCDAutoGenAction(ModuleIdentification moduleId,
|
||||||
String arch,
|
String arch,
|
||||||
boolean isBuildUsedLibrary,
|
boolean isBuildUsedLibrary,
|
||||||
String[] pcdNameArrayInMsa) {
|
String[] pcdNameArrayInMsa,
|
||||||
|
CommonDefinition.PCD_DRIVER_TYPE pcdDriverType) {
|
||||||
dbManager = null;
|
dbManager = null;
|
||||||
hAutoGenString = "";
|
hAutoGenString = "";
|
||||||
cAutoGenString = "";
|
cAutoGenString = "";
|
||||||
@ -140,6 +157,7 @@ public class PCDAutoGenAction extends BuildAction {
|
|||||||
moduleId.getModuleType()));
|
moduleId.getModuleType()));
|
||||||
setIsBuildUsedLibrary(isBuildUsedLibrary);
|
setIsBuildUsedLibrary(isBuildUsedLibrary);
|
||||||
setPcdNameArrayInMsa(pcdNameArrayInMsa);
|
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
|
// Work around code, In furture following code should be modified that get
|
||||||
// these information from Uplevel Autogen tools.
|
// these information from Uplevel Autogen tools.
|
||||||
//
|
//
|
||||||
if (moduleName.equalsIgnoreCase("PcdPeim")) {
|
if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER) {
|
||||||
hAutoGenString += MemoryDatabaseManager.PcdPeimHString;
|
hAutoGenString += MemoryDatabaseManager.PcdPeimHString;
|
||||||
cAutoGenString += MemoryDatabaseManager.PcdPeimCString;
|
cAutoGenString += MemoryDatabaseManager.PcdPeimCString;
|
||||||
} else if (moduleName.equalsIgnoreCase("PcdDxe")) {
|
} else if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.DXE_PCD_DRIVER) {
|
||||||
hAutoGenString += MemoryDatabaseManager.PcdDxeHString;
|
hAutoGenString += MemoryDatabaseManager.PcdDxeHString;
|
||||||
cAutoGenString += MemoryDatabaseManager.PcdDxeCString;
|
cAutoGenString += MemoryDatabaseManager.PcdDxeCString;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user