summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-02 05:28:18 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-02 05:28:18 +0000
commit3496595d7bafc329cae169f79c450253b32fadd8 (patch)
tree5d20380c71fe1bdceb1ab61d8480a3e8e02eae47
parente74da3e30a12f2591d7fa30322397c0f6fa96dbc (diff)
downloadedk2-platforms-3496595d7bafc329cae169f79c450253b32fadd8.tar.xz
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
-rw-r--r--EdkModulePkg/Universal/PCD/Dxe/Service.c23
-rw-r--r--MdePkg/Library/BasePcdLibNull/PcdLib.c4
-rw-r--r--MdePkg/Library/DxePcdLib/DxePcdLib.c2
-rw-r--r--MdePkg/Library/PeiPcdLib/PeiPcdLib.c2
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java17
5 files changed, 27 insertions, 21 deletions
diff --git a/EdkModulePkg/Universal/PCD/Dxe/Service.c b/EdkModulePkg/Universal/PCD/Dxe/Service.c
index e1aded74f9..bccd0a600a 100644
--- a/EdkModulePkg/Universal/PCD/Dxe/Service.c
+++ b/EdkModulePkg/Universal/PCD/Dxe/Service.c
@@ -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
diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePcdLibNull/PcdLib.c
index 7b8dc50d5c..a4e0183964 100644
--- a/MdePkg/Library/BasePcdLibNull/PcdLib.c
+++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c
@@ -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;
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c
index b4949d5d99..f3818a6e7e 100644
--- a/MdePkg/Library/DxePcdLib/DxePcdLib.c
+++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c
@@ -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;
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
index 9000c859b5..8ef5205593 100644
--- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
+++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c
@@ -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;
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
index e10f325ee6..1eb060b6a6 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
@@ -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";