X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fpcd%2Faction%2FPCDAutoGenAction.java;h=28bb81853e4a8eb2426e5b7026499fd939e52adf;hp=5928061ff46d8ac50c2fc81f0e1aed9e5af4e890;hb=11eb278ae57cfc9ba415fcf91e61dea56d6082c0;hpb=b6297711809e23f322ba99177445670b56f28973 diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java index 5928061ff4..28bb81853e 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java @@ -22,19 +22,21 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.tianocore.build.autogen.CommonDefinition; +import org.tianocore.build.exception.PcdAutogenException; import org.tianocore.build.global.GlobalData; import org.tianocore.build.id.ModuleIdentification; +import org.tianocore.pcd.action.ActionMessage; +import org.tianocore.pcd.action.BuildAction; import org.tianocore.pcd.entity.MemoryDatabaseManager; import org.tianocore.pcd.entity.Token; +import org.tianocore.pcd.entity.UsageIdentification; import org.tianocore.pcd.entity.UsageInstance; import org.tianocore.pcd.exception.BuildActionException; -import org.tianocore.pcd.entity.UsageIdentification; -import org.tianocore.pcd.action.BuildAction; -import org.tianocore.pcd.action.ActionMessage; -import org.tianocore.build.exception.PcdAutogenException; -/** This class is to manage how to generate the PCD information into Autogen.c and - Autogen.h. +/** + This class is to manage how to generate the PCD information into Autogen.c + and Autogen.h. **/ public class PCDAutoGenAction extends BuildAction { /// @@ -52,6 +54,11 @@ public class PCDAutoGenAction extends BuildAction { /// private boolean isBuildUsedLibrary; + /// + /// One of PEI_PCD_DRIVER, DXE_PCD_DRIVER, NOT_PCD_DRIVER + /// + private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType; + /// /// The generated string for header file. /// @@ -76,6 +83,14 @@ public class PCDAutoGenAction extends BuildAction { this.usageId = usageId; } + /** + Set paramter pcdDriverType + + @param pcdDriverType the driver type for PCD + **/ + public void setPcdDriverType(CommonDefinition.PCD_DRIVER_TYPE pcdDriverType) { + this.pcdDriverType = pcdDriverType; + } /** set isBuildUsedLibrary parameter. @@ -99,7 +114,7 @@ public class PCDAutoGenAction extends BuildAction { @return the string of header file for PCD **/ - public String OutputH() { + public String getHAutoGenString() { return hAutoGenString; } @@ -108,7 +123,7 @@ public class PCDAutoGenAction extends BuildAction { @return the string of C code file for PCD **/ - public String OutputC() { + public String getCAutoGenString() { return cAutoGenString; } @@ -122,11 +137,14 @@ public class PCDAutoGenAction extends BuildAction { @param arch the architecture for module @param isBuildUsedLibary Is the current module library. @param pcdNameArrayInMsa the pcd name array got from MSA file. + @param pcdDriverType one of PEI_PCD_DRIVER, DXE_PCD_DRIVER, + NOT_PCD_DRIVER **/ public PCDAutoGenAction(ModuleIdentification moduleId, String arch, boolean isBuildUsedLibrary, - String[] pcdNameArrayInMsa) { + String[] pcdNameArrayInMsa, + CommonDefinition.PCD_DRIVER_TYPE pcdDriverType) { dbManager = null; hAutoGenString = ""; cAutoGenString = ""; @@ -140,6 +158,7 @@ public class PCDAutoGenAction extends BuildAction { moduleId.getModuleType())); setIsBuildUsedLibrary(isBuildUsedLibrary); setPcdNameArrayInMsa(pcdNameArrayInMsa); + setPcdDriverType(pcdDriverType); } /** @@ -171,7 +190,7 @@ public class PCDAutoGenAction extends BuildAction { } ActionMessage.debug(this, - "PCD memory database contains " + dbManager.getDBSize() + " PCD tokens"); + "PCD memory database contains " + dbManager.getDBSize() + " PCD tokens."); generateAutogenForModule(); } @@ -228,9 +247,9 @@ public class PCDAutoGenAction extends BuildAction { // All library's PCD should instanted in module's who // use this library instance. If not, give errors. // - throw new BuildActionException (String.format("Module %s use library instance %s, the PCD %s " + - "is required by this library instance, but can not find " + - "it in the %s's in FPD file!", + throw new BuildActionException (String.format("Module %s using library instance %s; the PCD %s " + + "is required by this library instance, but can not be found " + + "in the %s's in the FPD file!", MemoryDatabaseManager.CurrentModuleName, moduleName, pcdNameArrayInMsa[index], @@ -299,41 +318,12 @@ public class PCDAutoGenAction extends BuildAction { cAutoGenString += usageInstance.getCAutogenStr(); } - // - // Work around code, In furture following code should be modified that get - // these information from Uplevel Autogen tools. - // - if (moduleName.equalsIgnoreCase("PcdPeim")) { + if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.PEI_PCD_DRIVER) { hAutoGenString += MemoryDatabaseManager.PcdPeimHString; cAutoGenString += MemoryDatabaseManager.PcdPeimCString; - } else if (moduleName.equalsIgnoreCase("PcdDxe")) { + } else if (pcdDriverType == CommonDefinition.PCD_DRIVER_TYPE.DXE_PCD_DRIVER) { hAutoGenString += MemoryDatabaseManager.PcdDxeHString; cAutoGenString += MemoryDatabaseManager.PcdDxeCString; } } - - /** - Test case function - - @param argv paramter from command line - **/ - public static void main(String argv[]) { - - String WorkSpace = "X:/edk2"; - String logFilePath = WorkSpace + "/EdkNt32Pkg/Nt32.fpd"; - - // - // At first, CollectPCDAction should be invoked to collect - // all PCD information from SPD, MSA, FPD. - // - PlatformPcdPreprocessActionForBuilding collectionAction = new PlatformPcdPreprocessActionForBuilding(); - GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", - WorkSpace,null); - - try { - collectionAction.perform(logFilePath, ActionMessage.MAX_MESSAGE_LEVEL); - } catch(Exception e) { - e.printStackTrace(); - } - } }