1) remove some dead code from WinNtBusDriver.c
2) change PCD_INVALID_TOKEN_NUMBER to 0 as stipulated in MWG spec and PCD spec. 3) support returning a Default Value when a read failure by variable service for PCD entry with Variable Enabled. 4) Remove a lot of unreferenced JAVA import from CollectPCDAction.java, PCDAutoGenAction.java, MemoryDatabaseManager.java, Token.java and UsageInstance.java. 5) Opimized to merge elements in all tables in PCD database for make the code compact. 6) Did a tighter check on how dynamic PCD entry is referenced in each module. 7) Update the PCD driver/PEIM and PCD database generation verion to 2. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@605 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -19,15 +19,11 @@ package org.tianocore.build.pcd.action;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.tianocore.build.global.GlobalData;
|
||||
import org.tianocore.build.global.SurfaceAreaQuery;
|
||||
import org.tianocore.build.pcd.entity.MemoryDatabaseManager;
|
||||
import org.tianocore.build.pcd.entity.Token;
|
||||
import org.tianocore.build.pcd.entity.UsageInstance;
|
||||
@@ -398,7 +394,7 @@ public class PCDAutoGenAction extends BuildAction {
|
||||
**/
|
||||
public static void main(String argv[]) {
|
||||
|
||||
String WorkSpace = "M:/tianocore/edk2";
|
||||
String WorkSpace = "X:/edk2";
|
||||
String logFilePath = WorkSpace + "/EdkNt32Pkg/Nt32.fpd";
|
||||
String[] nameArray = null;
|
||||
|
||||
@@ -421,13 +417,13 @@ public class PCDAutoGenAction extends BuildAction {
|
||||
//
|
||||
// Then execute the PCDAuotoGenAction to get generated Autogen.h and Autogen.c
|
||||
//
|
||||
PCDAutoGenAction autogenAction = new PCDAutoGenAction("MonoStatusCode",
|
||||
PCDAutoGenAction autogenAction = new PCDAutoGenAction("PcdPeim",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"IA32",
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
nameArray);
|
||||
autogenAction.execute();
|
||||
|
||||
|
@@ -15,20 +15,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
package org.tianocore.build.pcd.entity;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
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 java.util.UUID;
|
||||
|
||||
import org.tianocore.build.pcd.action.ActionMessage;
|
||||
import org.tianocore.build.pcd.exception.EntityException;
|
||||
|
||||
/** Database hold all PCD information comes from SPD, MSA, FPD file in memory.
|
||||
**/
|
||||
@@ -141,7 +134,6 @@ public class MemoryDatabaseManager {
|
||||
private ArrayList getDynamicRecordArray() {
|
||||
Token[] tokenArray = getRecordArray();
|
||||
int index = 0;
|
||||
int count = 0;
|
||||
ArrayList<Token> al = new ArrayList<Token>();
|
||||
|
||||
for (index = 0; index < tokenArray.length; index++) {
|
||||
@@ -159,8 +151,10 @@ public class MemoryDatabaseManager {
|
||||
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.
|
||||
* @throws EntityException
|
||||
**/
|
||||
public void getTwoPhaseDynamicRecordArray(ArrayList<Token> pei, ArrayList<Token> dxe) {
|
||||
public void getTwoPhaseDynamicRecordArray(ArrayList<Token> pei, ArrayList<Token> dxe)
|
||||
throws EntityException {
|
||||
int usageInstanceIndex = 0;
|
||||
int index = 0;
|
||||
ArrayList tokenArrayList = getDynamicRecordArray();
|
||||
@@ -185,10 +179,30 @@ public class MemoryDatabaseManager {
|
||||
}
|
||||
}
|
||||
|
||||
// If no PEI components reference the PCD entry, we insert it to DXE list
|
||||
//
|
||||
// If no PEI components reference the PCD entry,
|
||||
// we check if it is referenced in DXE driver.
|
||||
//
|
||||
if (!found) {
|
||||
dxe.add(token);
|
||||
if (token.consumers != null) {
|
||||
usageInstanceArray = token.consumers.entrySet().toArray();
|
||||
for (usageInstanceIndex = 0; usageInstanceIndex < token.consumers.size(); usageInstanceIndex ++) {
|
||||
usageInstance =(UsageInstance) (((Map.Entry)usageInstanceArray[usageInstanceIndex]).getValue());
|
||||
if (usageInstance.isDxePhaseComponent()) {
|
||||
dxe.add(token);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
//
|
||||
// We only support Dynamice(EX) type for PEI and DXE phase.
|
||||
// If it is not referenced in either PEI or DXE, throw exception now.
|
||||
//
|
||||
throw new EntityException("Dynamic(EX) PCD Entries are referenced in module that is not in PEI phase nor in DXE phase.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.tianocore.build.pcd.action.ActionMessage;
|
||||
import org.tianocore.build.pcd.exception.EntityException;
|
||||
|
||||
/** This class is to descript a PCD token object. The information of a token mainly
|
||||
@@ -164,6 +163,17 @@ public class Token {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDynamicEx() {
|
||||
|
||||
for (int i = 0; i < supportedPcdType.size(); i++) {
|
||||
if (supportedPcdType.get(i) == PCD_TYPE.DYNAMIC_EX) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Use "TokencName + "-" + SpaceTokenName" as primary key when adding token into database
|
||||
|
||||
@@ -194,6 +204,20 @@ public class Token {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isHiiEnable() {
|
||||
if (getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.HII_TYPE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isVpdEnable() {
|
||||
if (getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.VPD_TYPE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Get the token primary key in token database.
|
||||
@@ -471,6 +495,7 @@ public class Token {
|
||||
|
||||
@return string of datum type.
|
||||
**/
|
||||
|
||||
public static String getAutogendatumTypeString(DATUM_TYPE datumType) {
|
||||
switch (datumType) {
|
||||
case UINT8:
|
||||
@@ -545,6 +570,11 @@ public class Token {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getSkuIdCount () {
|
||||
return this.skuData.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Get default value for a token, For HII type, HiiDefaultValue of default
|
||||
@@ -576,13 +606,17 @@ public class Token {
|
||||
boolean isInteger = true;
|
||||
DynamicTokenValue dynamicValue = null;
|
||||
|
||||
if (isSkuEnable()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.isDynamicPCD) {
|
||||
dynamicValue = getDefaultSku();
|
||||
switch (dynamicValue.type) {
|
||||
case HII_TYPE:
|
||||
return !isValidNullValue(dynamicValue.hiiDefaultValue);
|
||||
return true;
|
||||
case VPD_TYPE:
|
||||
return false;
|
||||
return true;
|
||||
case DEFAULT_TYPE:
|
||||
return !isValidNullValue(dynamicValue.value);
|
||||
}
|
||||
|
@@ -20,8 +20,6 @@ package org.tianocore.build.pcd.entity;
|
||||
|
||||
import java.util.UUID;
|
||||
import org.tianocore.ModuleTypeDef;
|
||||
import org.tianocore.build.autogen.CommonDefinition;
|
||||
import org.tianocore.build.pcd.action.ActionMessage;
|
||||
import org.tianocore.build.pcd.exception.EntityException;
|
||||
|
||||
/**
|
||||
@@ -186,6 +184,23 @@ public class UsageInstance {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDxePhaseComponent() {
|
||||
//
|
||||
// BugBug: May need confirmation on which type of module can
|
||||
// make use of Dynamic(EX) PCD entry.
|
||||
//
|
||||
if ((moduleType == ModuleTypeDef.DXE_DRIVER) ||
|
||||
(moduleType == ModuleTypeDef.DXE_RUNTIME_DRIVER) ||
|
||||
(moduleType == ModuleTypeDef.DXE_SAL_DRIVER) ||
|
||||
(moduleType == ModuleTypeDef.DXE_SMM_DRIVER) ||
|
||||
(moduleType == ModuleTypeDef.UEFI_DRIVER) ||
|
||||
(moduleType == ModuleTypeDef.UEFI_APPLICATION)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Generate autogen string for header file and C code file.
|
||||
|
Reference in New Issue
Block a user