> > From: Duran, Leo > > Sent: Tuesday, May 05, 2015 12:49 PM > > To: 'edk2-devel@lists.sourceforge.net' > > Subject: Question about SetPcd > > > > I'm declaring a Pcd with some default value as > [PcdsPatchableInModule.common], and here are my observations: > > 1) In PEIM module1 after PcdSetXX() with a new value and can read back > the new value with PcdGetXX() > > 2) However, from PEIM module2 (which runs later) PcdGetXX() returns > the default declared value > > > > Question: Is there a way to invoke PcdSetXX() so that the new value is > persistent across modules? > > > > PatchableInModule means patching a binary is supported. Dynamic means > lookup the value in a database (via Pcd PPI, and Protocoli ) and sharing it > across modules. > > As Tim mentioned by using Patchable you are scoping the PCD value to be > compiled into your module, so a different location for every setting. > Changing that value does not update other modules. > > > https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Include/Library/ > PcdLib.h > #define PatchPcdSet8(TokenName, Value) > (_gPcd_BinaryPatch_##TokenName = (Value)) > > You need to define the PCD to a [PcdsDynamicDefault.common] in your DSC > file. This means all the values come from this PEIM > https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdeModulePkg/Universa > l/PCD/Pei/ and all the other modules will use the PCD PPI to get/set PCD > values. The PCD macro in the PEIM ends up calling a library call that > abstracts > the PCD PPI call. > > > Thanks, > > Andrew Fish >
Thanks Tim & Andrew. 1) The .DEC file declares the PCD as: [PcdsFixedAtBuild.common, PcdsDynamic.common, PcdsPatchableInModule.common] 2) As suggested, in my .DSC file I define it as: [PcdsDynamicDefault.common] 3) But now (at PEIM init-time), when I invoke PcdSet64 () I get an ASSERT ... PcdLib.c(131) Anyway, it seems like I've done the proper declaration (.DSC file wise) Thanks again for the feedback. Leo ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel