Change the macro for dynamicEx type PCD and modify autogen tools to auto generate TokenSpaceGuid. After modification, you can use two method access DynamicPCD,
1) PcdGet8/PcdGet32/... to get a value of DynamicEx PCD, same as PcdSetxx 2) PcdGet8Ex/PcdGet32Ex to get a value of DynamicEx PCD, same as PcdSetxxEx. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@549 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -77,12 +77,12 @@ Module Name: PcdLib.h
|
|||||||
//
|
//
|
||||||
// Dynamic Ex is to support binary distribution
|
// Dynamic Ex is to support binary distribution
|
||||||
//
|
//
|
||||||
#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 (Guid, _PCD_TOKEN_##TokenName)
|
#define PcdGetEx8(TokenName) LibPcdGetEx8 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
|
||||||
#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 (Guid, _PCD_TOKEN_##TokenName)
|
#define PcdGetEx16(TokenName) LibPcdGetEx16 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
|
||||||
#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 (Guid, _PCD_TOKEN_##TokenName)
|
#define PcdGetEx32(TokenName) LibPcdGetEx32 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
|
||||||
#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 (Guid, _PCD_TOKEN_##TokenName)
|
#define PcdGetEx64(TokenName) LibPcdGetEx64 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
|
||||||
#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr (Guid, _PCD_TOKEN_##TokenName)
|
#define PcdGetExPtr(TokenName) LibPcdGetExPtr (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
|
||||||
#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool (Guid, _PCD_TOKEN_##TokenName)
|
#define PcdGetExBool(TokenName) LibPcdGetExBool (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -99,12 +99,12 @@ Module Name: PcdLib.h
|
|||||||
//
|
//
|
||||||
// Dynamic Set Ex
|
// Dynamic Set Ex
|
||||||
//
|
//
|
||||||
#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 (Guid, _PCD_TOKEN_##TokenName, Value)
|
#define PcdSetEx8(TokenName, Value) LibPcdSetEx8 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
|
||||||
#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 (Guid, _PCD_TOKEN_##TokenName, Value)
|
#define PcdSetEx16(TokenName, Value) LibPcdSetEx16 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
|
||||||
#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 (Guid, _PCD_TOKEN_##TokenName, Value)
|
#define PcdSetEx32(TokenName, Value) LibPcdSetEx32 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
|
||||||
#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 (Guid, _PCD_TOKEN_##TokenName, Value)
|
#define PcdSetEx64(TokenName, Value) LibPcdSetEx64 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
|
||||||
#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) LibPcdSetExPtr (Guid, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)
|
#define PcdSetExPtr(TokenName, SizeOfBuffer, Buffer) LibPcdSetExPtr (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)
|
||||||
#define PcdSetExBool(Guid, TokenName, Value) LibPcdSetExBool(Guid, _PCD_TOKEN_##TokenName, Value)
|
#define PcdSetExBool(TokenName, Value) LibPcdSetExBool(&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2117,6 +2117,8 @@ public class CollectPCDAction {
|
|||||||
SkuInstance skuInstance = null;
|
SkuInstance skuInstance = null;
|
||||||
String temp;
|
String temp;
|
||||||
boolean hasSkuId0 = false;
|
boolean hasSkuId0 = false;
|
||||||
|
Token.PCD_TYPE pcdType = Token.PCD_TYPE.UNKNOWN;
|
||||||
|
int tokenNumber = 0;
|
||||||
|
|
||||||
List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> skuInfoList = null;
|
List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> skuInfoList = null;
|
||||||
DynamicPcdBuildDefinitions.PcdBuildData dynamicInfo = null;
|
DynamicPcdBuildDefinitions.PcdBuildData dynamicInfo = null;
|
||||||
@@ -2152,6 +2154,21 @@ public class CollectPCDAction {
|
|||||||
dynamicInfo.getMaxDatumSize());
|
dynamicInfo.getMaxDatumSize());
|
||||||
throw new EntityException(exceptionString);
|
throw new EntityException(exceptionString);
|
||||||
}
|
}
|
||||||
|
tokenNumber = Integer.decode(dynamicInfo.getToken().toString());
|
||||||
|
if (tokenNumber != token.tokenNumber) {
|
||||||
|
exceptionString = String.format("[FPD file error] For dynamic PCD %s, the token number in module %s is 0x%x, but"+
|
||||||
|
"in <DynamicPcdBuildDefinictions>, the token number is 0x%x, they are not match!",
|
||||||
|
token.cName,
|
||||||
|
moduleName,
|
||||||
|
token.tokenNumber,
|
||||||
|
tokenNumber);
|
||||||
|
throw new EntityException(exceptionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
pcdType = Token.getpcdTypeFromString(dynamicInfo.getItemType().toString());
|
||||||
|
if (pcdType == Token.PCD_TYPE.DYNAMIC_EX) {
|
||||||
|
token.dynamicExTokenNumber = tokenNumber;
|
||||||
|
}
|
||||||
|
|
||||||
skuInfoList = dynamicInfo.getSkuInfoList();
|
skuInfoList = dynamicInfo.getSkuInfoList();
|
||||||
|
|
||||||
|
@@ -65,11 +65,16 @@ public class Token {
|
|||||||
|
|
||||||
///
|
///
|
||||||
/// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in
|
/// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in
|
||||||
/// platform token space.
|
/// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by
|
||||||
/// tokenNumber is defined in SPD, FPD.
|
/// PCD run-time database autogen tools.
|
||||||
///
|
///
|
||||||
public int tokenNumber;
|
public int tokenNumber;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// This token number is retrieved from FPD file for DynamicEx type.
|
||||||
|
///
|
||||||
|
public int dynamicExTokenNumber;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// All supported PCD type, this value can be retrieved from SPD
|
/// All supported PCD type, this value can be retrieved from SPD
|
||||||
/// Currently, only record all PCD type for this token in FPD file.
|
/// Currently, only record all PCD type for this token in FPD file.
|
||||||
|
@@ -201,12 +201,22 @@ public class UsageInstance {
|
|||||||
*/
|
*/
|
||||||
public void generateAutoGen(boolean isBuildUsedLibrary)
|
public void generateAutoGen(boolean isBuildUsedLibrary)
|
||||||
throws EntityException {
|
throws EntityException {
|
||||||
|
String guidStringArray[] = null;
|
||||||
|
String guidString = null;
|
||||||
|
|
||||||
hAutogenStr = "";
|
hAutogenStr = "";
|
||||||
cAutogenStr = "";
|
cAutogenStr = "";
|
||||||
|
|
||||||
|
if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {
|
||||||
|
hAutogenStr += String.format("#define _PCD_LOCAL_TOKEN_%s 0x%016x\r\n",
|
||||||
|
parentToken.cName, parentToken.tokenNumber);
|
||||||
|
hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%016x\r\n",
|
||||||
|
parentToken.cName, parentToken.dynamicExTokenNumber);
|
||||||
|
} else {
|
||||||
hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%016x\r\n",
|
hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%016x\r\n",
|
||||||
parentToken.cName, parentToken.tokenNumber);
|
parentToken.cName, parentToken.tokenNumber);
|
||||||
|
}
|
||||||
|
|
||||||
switch (modulePcdType) {
|
switch (modulePcdType) {
|
||||||
case FEATURE_FLAG:
|
case FEATURE_FLAG:
|
||||||
if (isBuildUsedLibrary) {
|
if (isBuildUsedLibrary) {
|
||||||
@@ -292,6 +302,34 @@ public class UsageInstance {
|
|||||||
parentToken.cName);
|
parentToken.cName);
|
||||||
break;
|
break;
|
||||||
case DYNAMIC_EX:
|
case DYNAMIC_EX:
|
||||||
|
guidStringArray = parentToken.tokenSpaceName.toString().split("-");
|
||||||
|
guidString = String.format("{ 0x%s, 0x%s, 0x%s, {0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s}}",
|
||||||
|
guidStringArray[0],
|
||||||
|
guidStringArray[1],
|
||||||
|
guidStringArray[2],
|
||||||
|
(guidStringArray[3].substring(0, 2)),
|
||||||
|
(guidStringArray[3].substring(2, 4)),
|
||||||
|
(guidStringArray[4].substring(0, 2)),
|
||||||
|
(guidStringArray[4].substring(2, 4)),
|
||||||
|
(guidStringArray[4].substring(4, 6)),
|
||||||
|
(guidStringArray[4].substring(6, 8)),
|
||||||
|
(guidStringArray[4].substring(8, 10)),
|
||||||
|
(guidStringArray[4].substring(10, 12)));
|
||||||
|
|
||||||
|
hAutogenStr += String.format("extern EFI_GUID _gPcd_DynamicEx_TokenSpaceGuid_%s;\r\n",
|
||||||
|
parentToken.cName);
|
||||||
|
hAutogenStr += String.format("#define _PCD_MODE_%s_%s LibPcdGet%s(_PCD_LOCAL_TOKEN_%s)\r\n",
|
||||||
|
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
|
||||||
|
parentToken.cName,
|
||||||
|
Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
|
||||||
|
parentToken.cName,
|
||||||
|
parentToken.cName);
|
||||||
|
|
||||||
|
if (!isBuildUsedLibrary) {
|
||||||
|
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID _gPcd_DynamicEx_TokenSpaceGuid_%s = %s;\r\n",
|
||||||
|
parentToken.cName,
|
||||||
|
guidString);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user