Use the address of guid array as parameter directly for _PCD_MODE_xx macro for DynamicEx type PCD.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@582 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2006-06-21 03:36:00 +00:00
parent 8aeaf59524
commit a49b34c00e
2 changed files with 16 additions and 20 deletions

View File

@ -339,19 +339,22 @@ public class PCDAutoGenAction extends BuildAction {
(guidStringArray[4].substring(6, 8)),
(guidStringArray[4].substring(8, 10)),
(guidStringArray[4].substring(10, 12)));
if (!isBuildUsedLibrary) {
Pattern pattern = Pattern.compile("(" + guidStringCName + ")+?");
Matcher matcher = pattern.matcher(cAutoGenString + " ");
//
// Find whether this guid array variable has been generated into autogen.c
// For different DyanmicEx pcd token who use same token space guid, the token space
// guid array should be only generated once.
//
if (!matcher.find()) {
Pattern pattern = Pattern.compile("(" + guidStringCName + ")+?");
Matcher matcher = pattern.matcher(cAutoGenString + " ");
//
// Find whether this guid array variable has been generated into autogen.c
// For different DyanmicEx pcd token who use same token space guid, the token space
// guid array should be only generated once.
//
if (!matcher.find()) {
hAutoGenString += String.format("extern EFI_GUID %s;\r\n",
guidStringCName);
if (!isBuildUsedLibrary) {
cAutoGenString += String.format("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID %s = %s;\r\n",
guidStringCName,
guidString);
}
}
}
}

View File

@ -200,7 +200,7 @@ public class UsageInstance {
@param isBuildUsedLibrary whether the autogen is for library.
*/
public void generateAutoGen(boolean isBuildUsedLibrary)
throws EntityException {
throws EntityException {
String guidStringCName = null;
boolean isByteArray = false;
String printDatum = null;
@ -340,20 +340,13 @@ public class UsageInstance {
guidStringCName = "_gPcd_TokenSpaceGuid_" +
parentToken.tokenSpaceName.toString().replaceAll("-", "_");
hAutogenStr += String.format("extern const EFI_GUID *_gPcd_DynamicEx_TokenSpaceGuid_%s;\r\n",
parentToken.cName);
hAutogenStr += String.format("#define _PCD_MODE_%s_%s LibPcdGetEx%s(_gPcd_DynamicEx_TokenSpaceGuid_%s, _PCD_TOKEN_%s)\r\n",
hAutogenStr += String.format("#define _PCD_MODE_%s_%s LibPcdGetEx%s(&%s, _PCD_TOKEN_%s)\r\n",
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
parentToken.cName,
Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
parentToken.cName,
guidStringCName,
parentToken.cName);
if (!isBuildUsedLibrary) {
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID *_gPcd_DynamicEx_TokenSpaceGuid_%s = &%s;\r\n",
parentToken.cName,
guidStringCName);
}
break;
}
}