mirror of https://github.com/acidanthera/audk.git
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@250 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
1ae1cdbd84
commit
99d2c3c41e
|
@ -254,4 +254,29 @@ public class CommonDefinition {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static public boolean isPeiPhaseComponent (int componentType) {
|
||||
if (ComponentTypePe32Peim == componentType
|
||||
|| ComponentTypePicPeim == componentType
|
||||
|| ComponentTypeCombinedPeimDriver == componentType
|
||||
|| ComponentTypePeiCore == componentType) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static public boolean isPe32PeimComponent (int componentType) {
|
||||
if (ComponentTypePe32Peim == componentType) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static public boolean isBsDriverComponent (int componentType) {
|
||||
if (ComponentTypeBsDriver == componentType) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -190,6 +190,14 @@ public class PCDAutoGenAction extends BuildAction {
|
|||
}
|
||||
}
|
||||
|
||||
if (moduleName.equalsIgnoreCase("PcdPeim")) {
|
||||
hAutoGenString += dbManager.PcdPeimHString;
|
||||
cAutoGenString += dbManager.PcdPeimCString;
|
||||
} else if (moduleName.equalsIgnoreCase("PcdDxe")) {
|
||||
hAutoGenString += dbManager.PcdDxeHString;
|
||||
cAutoGenString += dbManager.PcdDxeCString;
|
||||
}
|
||||
|
||||
ActionMessage.debug(this,
|
||||
"Module " + moduleName + "'s PCD header file:\r\n" + hAutoGenString + "\r\n"
|
||||
);
|
||||
|
@ -518,7 +526,9 @@ public class PCDAutoGenAction extends BuildAction {
|
|||
@param argv paramter from command line
|
||||
**/
|
||||
public static void main(String argv[]) {
|
||||
String logFilePath = "M:/tianocore/edk2/trunk/edk2/EdkNt32Pkg/Nt32.fpd";
|
||||
|
||||
String WorkSpace = "G:/edk2";
|
||||
String logFilePath = WorkSpace + "/EdkNt32Pkg/Nt32.fpd";
|
||||
|
||||
//
|
||||
// At first, CollectPCDAction should be invoked to collect
|
||||
|
@ -526,12 +536,12 @@ public class PCDAutoGenAction extends BuildAction {
|
|||
//
|
||||
CollectPCDAction collectionAction = new CollectPCDAction();
|
||||
GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db",
|
||||
"M:/tianocore/edk2/trunk/edk2");
|
||||
WorkSpace);
|
||||
|
||||
GlobalData.getPCDMemoryDBManager().setLogFileName(logFilePath + ".PCDMemroyDatabaseLog.txt");
|
||||
|
||||
try {
|
||||
collectionAction.perform("M:/tianocore/edk2/trunk/edk2",
|
||||
collectionAction.perform(WorkSpace,
|
||||
logFilePath,
|
||||
ActionMessage.MAX_MESSAGE_LEVEL);
|
||||
} catch(Exception e) {
|
||||
|
@ -541,10 +551,16 @@ public class PCDAutoGenAction extends BuildAction {
|
|||
//
|
||||
// Then execute the PCDAuotoGenAction to get generated Autogen.h and Autogen.c
|
||||
//
|
||||
PCDAutoGenAction autogenAction = new PCDAutoGenAction("PcdEmulator",
|
||||
true
|
||||
PCDAutoGenAction autogenAction = new PCDAutoGenAction("PcdDxe",
|
||||
false
|
||||
);
|
||||
autogenAction.execute();
|
||||
autogenAction.execute();
|
||||
|
||||
System.out.println(autogenAction.OutputH());
|
||||
System.out.println("WQWQWQWQWQ");
|
||||
System.out.println(autogenAction.OutputC());
|
||||
|
||||
|
||||
System.out.println (autogenAction.hAutoGenString);
|
||||
System.out.println (autogenAction.cAutoGenString);
|
||||
|
||||
|
|
|
@ -20,13 +20,26 @@ import java.io.File;
|
|||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.tianocore.build.autogen.CommonDefinition;
|
||||
import org.tianocore.build.pcd.action.ActionMessage;
|
||||
|
||||
class AlignmentSizeComp implements Comparator {
|
||||
public int compare (Object a, Object b) {
|
||||
Token tA = (Token) a;
|
||||
Token tB = (Token) b;
|
||||
|
||||
return Token.getAutogendatumTypeAlignmentSize(tA.datumType)
|
||||
- Token.getAutogendatumTypeAlignmentSize(tB.datumType);
|
||||
}
|
||||
}
|
||||
|
||||
/** Database hold all PCD information comes from SPD, MSA, FPD file in memory.
|
||||
**/
|
||||
public class MemoryDatabaseManager {
|
||||
|
@ -40,6 +53,11 @@ public class MemoryDatabaseManager {
|
|||
///
|
||||
private static String logFileName = null;
|
||||
|
||||
public static String PcdPeimHString = "";
|
||||
public static String PcdPeimCString = "";
|
||||
public static String PcdDxeHString = "";
|
||||
public static String PcdDxeCString = "";
|
||||
|
||||
/**
|
||||
Constructure function
|
||||
**/
|
||||
|
@ -135,7 +153,81 @@ public class MemoryDatabaseManager {
|
|||
return tokenArray;
|
||||
}
|
||||
|
||||
|
||||
private ArrayList getDynamicRecordArray() {
|
||||
Token[] tokenArray = getRecordArray();
|
||||
int index = 0;
|
||||
int count = 0;
|
||||
ArrayList al = new ArrayList();
|
||||
|
||||
for (index = 0; index < tokenArray.length; index++) {
|
||||
if (tokenArray[index].pcdType == Token.PCD_TYPE.DYNAMIC ||
|
||||
tokenArray[index].pcdType == Token.PCD_TYPE.DYNAMIC_EX) {
|
||||
al.add(tokenArray[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return al;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get the token record array contained all PCD token referenced by PEI phase.
|
||||
The output array is sorted based on descending order of the size of alignment for each feilds.
|
||||
|
||||
@return the token record array contained all PCD token referenced in PEI phase.
|
||||
**/
|
||||
public void getTwoPhaseDynamicRecordArray(ArrayList<Token> pei, ArrayList<Token> dxe) {
|
||||
int usageInstanceIndex = 0;
|
||||
int index = 0;
|
||||
ArrayList tokenArrayList = getDynamicRecordArray();
|
||||
List<UsageInstance> usageInstanceArray = null;
|
||||
UsageInstance usageInstance = null;
|
||||
|
||||
//pei = new ArrayList<Token>();
|
||||
//dxe = new ArrayList<Token>();
|
||||
|
||||
for (index = 0; index < tokenArrayList.size(); index++) {
|
||||
boolean found = false;
|
||||
Token token = (Token) tokenArrayList.get(index);
|
||||
if (token.producers != null) {
|
||||
usageInstanceArray = token.producers;
|
||||
for (usageInstanceIndex = 0; usageInstanceIndex < usageInstanceArray.size(); usageInstanceIndex++) {
|
||||
usageInstance = (UsageInstance) usageInstanceArray.get(usageInstanceIndex);
|
||||
if (CommonDefinition.isPeiPhaseComponent(usageInstance.componentType)) {
|
||||
pei.add(token);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!found) {
|
||||
if (token.consumers != null) {
|
||||
usageInstanceArray = token.consumers;
|
||||
for (usageInstanceIndex = 0; usageInstanceIndex < usageInstanceArray.size(); usageInstanceIndex ++) {
|
||||
usageInstance =(UsageInstance) usageInstanceArray.get(usageInstanceIndex);
|
||||
if (CommonDefinition.isPeiPhaseComponent(usageInstance.componentType)) {
|
||||
pei.add(token);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If no PEI components reference the PCD entry, we insert it to DXE list
|
||||
//
|
||||
if (!found) {
|
||||
dxe.add(token);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
Get all PCD record for a module according to module's name.
|
||||
|
||||
@param moduleName the name of module.
|
||||
|
|
|
@ -252,12 +252,16 @@ public class Token {
|
|||
UUID nullUUID = new UUID(0, 0);
|
||||
|
||||
if (platformtokenSpaceName == nullUUID) {
|
||||
return cName + "-" + tokenSpaceName.toString();
|
||||
return cName + "_" + tokenSpaceName.toString().replace('-', '_');
|
||||
} else {
|
||||
return cName + "-" + platformtokenSpaceName.toString();
|
||||
return cName + "_" + platformtokenSpaceName.toString().replace('-', '_');
|
||||
}
|
||||
}
|
||||
|
||||
public String getPrimaryKeyString () {
|
||||
return cName + "_" + tokenSpaceName.toString().replace('-', '_');
|
||||
}
|
||||
|
||||
/**
|
||||
Judge datumType is valid
|
||||
|
||||
|
@ -634,6 +638,43 @@ public class Token {
|
|||
|
||||
return uuid;
|
||||
}
|
||||
|
||||
//
|
||||
// BugBug: We need change this algorithm accordingly when schema is updated
|
||||
// to support no default value.
|
||||
//
|
||||
public boolean hasDefaultValue () {
|
||||
|
||||
if (hiiEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (vpdEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (datum.toString().compareTo("NoDefault") == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isStringType () {
|
||||
String str = datum.toString();
|
||||
|
||||
if (datumType == Token.DATUM_TYPE.POINTER &&
|
||||
str.startsWith("L\"") &&
|
||||
str.endsWith("\"")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getStringTypeString () {
|
||||
return datum.toString().substring(2, datum.toString().length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ public class UsageInstance {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
switch(parentToken.pcdType) {
|
||||
case FEATURE_FLAG:
|
||||
if(CommonDefinition.isLibraryComponent(componentType)) {
|
||||
|
@ -429,7 +429,8 @@ public class UsageInstance {
|
|||
parentToken.cName
|
||||
);
|
||||
break;
|
||||
case DYNAMIC:
|
||||
case DYNAMIC:
|
||||
hAutogenStr += "\r\n";
|
||||
hAutogenStr += String.format(
|
||||
"#define _PCD_MODE_%s_%s LibPcdGet%s(_PCD_TOKEN_%s)\r\n",
|
||||
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
|
||||
|
|
Loading…
Reference in New Issue