public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Using PcdSet32S for gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
@ 2018-03-16  1:12 Vladimir Olovyannikov
  2018-03-16  1:15 ` Gao, Liming
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Olovyannikov @ 2018-03-16  1:12 UTC (permalink / raw)
  To: edk2-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using PcdSet32S for gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
  2018-03-16  1:12 Using PcdSet32S for gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize Vladimir Olovyannikov
@ 2018-03-16  1:15 ` Gao, Liming
  2018-03-16  1:25   ` Vladimir Olovyannikov
  0 siblings, 1 reply; 3+ messages in thread
From: Gao, Liming @ 2018-03-16  1:15 UTC (permalink / raw)
  To: Vladimir Olovyannikov, edk2-devel@lists.01.org

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using PcdSet32S for gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
  2018-03-16  1:15 ` Gao, Liming
@ 2018-03-16  1:25   ` Vladimir Olovyannikov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Olovyannikov @ 2018-03-16  1:25 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel

Thanks a lot Liming,
This works.

Vladimir
-----Original Message-----
From: Gao, Liming [mailto:liming.gao@intel.com]
Sent: Thursday, March 15, 2018 6:16 PM
To: Vladimir Olovyannikov; edk2-devel@lists.01.org
Subject: RE: [edk2] Using PcdSet32S for
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize

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|UINT3
> 2|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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-16  1:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-16  1:12 Using PcdSet32S for gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize Vladimir Olovyannikov
2018-03-16  1:15 ` Gao, Liming
2018-03-16  1:25   ` Vladimir Olovyannikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox