On Thu, Jul 24, 2014 at 12:51 AM, Andrew Fish afish@apple.com wrote:
What is the value for _PCD_GET_MODE_32_##TokenName in the autogen of the module where the 0 is returned? Is it calling LibPcdGet32() or does it point to the global?
_PCD_GET_MODE_32_##TokenName is #defined to the appropriate _gPcd_FixedAtBuild_##TokenName in AutoGen.h of my module. LibPcdGet32() is not called. The same module's AutoGen.i contains const UINT32 _gPcd_FixedAtBuild_##TokenName = <right_pcd_value>;
But when I check the value of _gPcd_FixedAtBuild_##TokenName from my module, it always shows as 0.
#define PcdGet32(TokenName) _PCD_GET_MODE_32_##TokenName
It could be due to what Laszlo suggested earlier, but I already am building for DEBUG. ASSERT() acts as a no-op for me because PcdGet at [1] simply returns 0 and DebugAssertEnabled always fails!
I don’t understand how that statement matches this statement you made: “The execution never comes to calling LibPcdGet32(), for either BasePcdLibNull or PcdLib.”
I meant that ASSERT() statements do nothing throughout the codebase because of PcdGet failing.
On Wed, Jul 23, 2014 at 6:06 PM, Laszlo Ersek lersek@redhat.com wrote:
Library instances that usably resolve the PcdLib library class are:
$ git grep -l 'LIBRARY_CLASS *= *PcdLib' -- '*.inf'
EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf MdePkg/Library/DxePcdLib/DxePcdLib.inf MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
In PEIMs, you need the fourth; in DXE & UEFI drivers, you need the third.
I think I might not need these implementations for the PEI phase since I am not using any Dymanic PCDs (as suggested in sec. 4.102 - "MdePkg Document With Libraries.pdf" at [1]).
However, this is not the entire picture yet, because these libraries delegate the work to a PPI (in PEI) and to a protocol (in DXE) that are provided by dedicated drivers, respectively:
- MdeModulePkg/Universal/PCD/Pei/Pcd.inf
- MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
You should add these drivers to the corresponding (ie. PEI vs. DXE) APRIORI files of the firmware volumes that your FDF file defines, so that any driver loaded / dispatched later can use their PCD services (through the above-mentioned library instances). Refer to OvmfPkg/OvmfPkgX64.fdf for examples.
How are APRIORI drivers initialized? I couldn't figure which phase is responsible for launching them.
[1] http://sourceforge.net/projects/edk2/files/EDK_II_Libraries/UDK2014/
Thanks, Varad