The layout in EmulatorPkg about VARIBLE and FTW is really good example.
In MdeModulePkg.dec , one useful comment is need to be attentive for variable 
reclaim work.

MdeModulePkg.dec:
  ## Size of the NV variable range. Note that this value should less than or 
equal to PcdFlashNvStorageFtwSpareSize
  #  The root cause is that variable driver will use FTW protocol to reclaim 
variable region.
  #  If the length of variable region is larger than FTW spare size, it means 
the whole variable region can not
  #  be reflushed through the manner of fault tolerant write.
  
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x0|UINT32|0x30000002

Thanks.
Star
-----Original Message-----
From: Jordan Justen [mailto:[email protected]] 
Sent: Wednesday, June 26, 2013 5:15 AM
To: Laszlo Ersek
Cc: Zeng, Star; [email protected]
Subject: Re: [edk2] [PATCH 1/2] MdeModulePkg and SecurityPkg: PEI variable does 
not robustly handle crashes during Reclaim().

On Tue, Jun 25, 2013 at 1:00 PM, Laszlo Ersek <[email protected]> wrote:
> On 06/25/13 18:16, Jordan Justen wrote:
>> Hey all. I've put Star's patches into this tree:
>> https://github.com/jljusten/edk2/tree/zeng-20130624
>>
>> ... in case it helps with code-review/testing.
>
> Where can I read about how flash storage / fault tolerant writes are 
> supposed to work? Like spare area, reclaim, the PCDs we had to adjust 
> recently for secure boot, and so on. The series is currently Greek to 
> me, I need to educate myself.

Hmm. I would imagine that such a doc exists, but I'm not sure where.
It should be a careful dance between the Firmware Volume Block, Variable, and 
Fault Tolerant Write drivers.

> This is a complex area I think. For example the NvVars stuff in OVMF 
> only got clear(er) to me when I spent half a day on Michael Chang's 
> patch and the code it touches -- it's completely non-intuitive that 
> OVMF has a memory buffer as flash storage (with fault tolerant writes) 
> which is snooped on by another component that writes to a file during 
> the boot phase whatever it hears. Or some such. (I could easily be 
> confused still...)

I'm sorry about that. OVMF uses a few (to put it nicely) 'clever'
hacks to make variables somewhat persistent.

You might be better off reviewing EmulatorPkg variables. At the lowest level, 
they are written to disk, so that part isn't too relevant, but everything else 
(I think) follows 'real' platforms more closely.

-Jordan

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to