public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Liming" <liming.gao@intel.com>
To: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: Using PcdSet32S for gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
Date: Fri, 16 Mar 2018 01:15:53 +0000	[thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E1E78A2@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <b9ffdc19d2687e9b0af34fe922eedf48@mail.gmail.com>

You need to configure PCD in [PcdsDynamicDefault.common.DEFAULT] of platform DSC file, and remove it from platform FDF file. 

You can refer to Nt32Pkg\Nt32Pkg.dsc, it configure gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase as Dynamic, and set it at boot time. 

Thanks
Liming
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Vladimir Olovyannikov
> Sent: Friday, March 16, 2018 9:13 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] Using PcdSet32S for gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
> 
> Hi,
> 
> I would like  to overwrite
> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
> From an Fvb runtime driver.
> For that purpose I try to do it like this:
> PcdStatus = PcdSet32S(PcdFlashNvStorageVariableBase,
> (UINT32)(UINTN)Instance->VariableBase);
> 
> My .inf file for the driver contains
> [Packages]
>   MdePkg/MdePkg.dec
>   MdeModulePkg/MdeModulePkg.dec
>   MyTestPlatformPkg/MytestPlatformPkg.dec
> 
> and
> [Pcd]
>   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
> 
> When I build the image, I am getting
> /uefi/MdePkg/Include/Library/PcdLib.h:630:45: error: implicit declaration of
> function `_PCD_SET_MODE_32_S_PcdFlashNvStorageVariableBase`
> [-Werror=implicit-function-declaration]
> #define PcdSet32S(TokenName, Value)         _PCD_SET_MODE_32_S_##TokenName
> ((Value))
>                                              ^
> /uefi/BroadcomPlatformPkg/Drivers/FvbDxe/FvbImpl.c:1090:19: note: in
> expansion of macro `PcdSet32S`
>        PcdStatus = PcdSet32S(PcdFlashNvStorageVariableBase,
> (UINT32)(UINTN)Instance->VariableBase);
>                    ^~~~~~~~~
> in Autogen.h for the driver:
> extern const  UINT32  _gPcd_FixedAtBuild_PcdFlashNvStorageVariableBase;
> #define _PCD_GET_MODE_SIZE_PcdFlashNvStorageVariableBase
> _PCD_SIZE_PcdFlashNvStorageVariableBase
> //#define _PCD_SET_MODE_32_PcdFlashNvStorageVariableBase  ASSERT(FALSE)  //
> It is not allowed to set value for a FIXED_AT_BUILD PCD
> 
> Similarly there are no definitions for other Pcds for PcdSet32 (for instance
> PcdFlashNvStorageFtwWorkingBase);
> they are all set as "FixedAtBuild".
> 
> I can see the PcdFlashNvStorageVariableBase is declared in MdeModulePkg as
> [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> ...
> ## Base address of the NV variable range in flash device.
>   # @Prompt Base address of flash NV variable range.
>   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x0|UINT32|0x30000001
> 
> Why is it set as "FixedAtBuild", and how can I change it to be writable?
> I can see that some platforms (for instance, OvmfPkg) overwrite these
> variables via PcdSet32S/PcdSet64S.
> 
> What am I missing here?
> 
> Thank you,
> Vladimir
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2018-03-16  1:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16  1:12 Using PcdSet32S for gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize Vladimir Olovyannikov
2018-03-16  1:15 ` Gao, Liming [this message]
2018-03-16  1:25   ` Vladimir Olovyannikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E1E78A2@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox