Make sure the PCD dxe service driver can handle the case where no PEIM is using any dynamic PCD entry and the PEI phase PCD database is empty.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@388 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2006-06-02 05:28:18 +00:00
parent e74da3e30a
commit 3496595d7b
5 changed files with 27 additions and 21 deletions

View File

@ -282,13 +282,24 @@ BuildPcdDxeDataBase (
ASSERT (mPcdDatabase != NULL);
GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
ASSERT (GuidHob != NULL);
PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);
//
// Copy PCD Entries refereneced in PEI phase to PCD DATABASE
//
CopyMem (&mPcdDatabase->PeiDb, PeiDatabase, sizeof (PEI_PCD_DATABASE));
if (GuidHob != NULL) {
//
// We will copy over the PEI phase's PCD Database.
//
// If no PEIMs use dynamic Pcd Entry, the Pcd Service PEIM
// should not be included at all. So the GuidHob could
// be NULL. If it is NULL, we just copy over the DXE Default
// Value to PCD Database.
//
PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);
//
// Copy PCD Entries refereneced in PEI phase to PCD DATABASE
//
CopyMem (&mPcdDatabase->PeiDb, PeiDatabase, sizeof (PEI_PCD_DATABASE));
}
//
// Copy PCD Entries with default value to PCD DATABASE

View File

@ -723,8 +723,8 @@ LibPcdCancelCallback (
PCD_TOKEN_NUMBER
EFIAPI
LibPcdGetNextToken (
IN CONST GUID *Guid, OPTIONAL
IN OUT PCD_TOKEN_NUMBER TokenNumber
IN CONST GUID *Guid, OPTIONAL
IN PCD_TOKEN_NUMBER TokenNumber
)
{
return 0;

View File

@ -837,7 +837,7 @@ PCD_TOKEN_NUMBER
EFIAPI
LibPcdGetNextToken (
IN CONST GUID *Guid, OPTIONAL
IN OUT PCD_TOKEN_NUMBER TokenNumber
IN PCD_TOKEN_NUMBER TokenNumber
)
{
EFI_STATUS Status;

View File

@ -929,7 +929,7 @@ PCD_TOKEN_NUMBER
EFIAPI
LibPcdGetNextToken (
IN CONST GUID *Guid, OPTIONAL
IN OUT PCD_TOKEN_NUMBER TokenNumber
IN PCD_TOKEN_NUMBER TokenNumber
)
{
EFI_STATUS Status;

View File

@ -442,21 +442,18 @@ class LocalTokenNumberTable {
private ArrayList<String> alComment;
private String phase;
private int len;
private int bodyStart;
private int bodyLineNum;
public LocalTokenNumberTable (String phase) {
this.phase = phase;
al = new ArrayList<String>();
alComment = new ArrayList<String>();
bodyStart = 0;
bodyLineNum = 0;
len = 0;
}
public String getSizeMacro () {
return String.format(PcdDatabase.LocalTokenNumberTableSizeMacro, phase, getSize());
return String.format(PcdDatabase.LocalTokenNumberTableSizeMacro, phase, getSize())
+ String.format(PcdDatabase.LocalTokenNumberSizeMacro, phase, al.size());
}
public int getSize () {
@ -476,7 +473,6 @@ class LocalTokenNumberTable {
output.add("/* LocalTokenNumberTable */");
output.add("{");
bodyStart = 2;
if (al.size() == 0) {
output.add("0");
@ -498,8 +494,6 @@ class LocalTokenNumberTable {
}
bodyLineNum = al.size();
output.add("}");
return output;
@ -641,16 +635,17 @@ class PcdDatabase {
public final static String ExMapTableDeclaration = "DYNAMICEX_MAPPING ExMapTable[%s_EXMAPPING_TABLE_SIZE];\r\n";
public final static String GuidTableDeclaration = "EFI_GUID GuidTable[%s_GUID_TABLE_SIZE];\r\n";
public final static String LocalTokenNumberTableDeclaration = "UINT32 LocalTokenNumberTable[%s_LOCAL_TOKEN_NUMBER];\r\n";
public final static String LocalTokenNumberTableDeclaration = "UINT32 LocalTokenNumberTable[%s_LOCAL_TOKEN_NUMBER_TABLE_SIZE];\r\n";
public final static String StringTableDeclaration = "UINT16 StringTable[%s_STRING_TABLE_SIZE];\r\n";
public final static String SizeTableDeclaration = "UINT16 SizeTable[%s_LOCAL_TOKEN_NUMBER];\r\n";
public final static String SizeTableDeclaration = "UINT16 SizeTable[%s_LOCAL_TOKEN_NUMBER_TABLE_SIZE];\r\n";
public final static String SkuIdTableDeclaration = "UINT8 SkuIdTable[%s_SKUID_TABLE_SIZE];\r\n";
public final static String ExMapTableSizeMacro = "#define %s_EXMAPPING_TABLE_SIZE %d\r\n";
public final static String ExTokenNumber = "#define %s_EX_TOKEN_NUMBER %d\r\n";
public final static String GuidTableSizeMacro = "#define %s_GUID_TABLE_SIZE %d\r\n";
public final static String LocalTokenNumberTableSizeMacro = "#define %s_LOCAL_TOKEN_NUMBER %d\r\n";
public final static String LocalTokenNumberTableSizeMacro = "#define %s_LOCAL_TOKEN_NUMBER_TABLE_SIZE %d\r\n";
public final static String LocalTokenNumberSizeMacro = "#define %s_LOCAL_TOKEN_NUMBER %d\r\n";
public final static String StringTableSizeMacro = "#define %s_STRING_TABLE_SIZE %d\r\n";
public final static String SkuIdTableSizeMacro = "#define %s_SKUID_TABLE_SIZE %d\r\n";