]> git.proxmox.com Git - mirror_edk2.git/commit
OvmfPkg/EmuVariableFvbRuntimeDxe: change block size to 4KB
authorLaszlo Ersek <lersek@redhat.com>
Sat, 6 May 2017 11:17:58 +0000 (13:17 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 18 May 2017 21:38:45 +0000 (23:38 +0200)
commit7e8329267ecb62670263bfc6afec93f37bfa19d2
tree44345b038a04fc24fac734ce43262f59df71eb18
parent89f385ce0ad7bf2c93a80ff7733e45f2af88937a
OvmfPkg/EmuVariableFvbRuntimeDxe: change block size to 4KB

EmuVariableFvbRuntimeDxe currently produces a Firmware Volume Block
protocol that is based on a block map of two blocks, each block having
PcdFlashNvStorageFtwSpareSize for size.

(The total size is 2 * PcdFlashNvStorageFtwSpareSize.)

FaultTolerantWriteDxe in turn expects the block size to be a power of two.

In the 4MB build of OVMF, PcdFlashNvStorageFtwSpareSize is 264KB, which is
not a power of two. In order to equip EmuVariableFvbRuntimeDxe for this
build, shrink the block size to 4KB (EFI_PAGE_SIZE), and grow the block
count from 2 to EFI_SIZE_TO_PAGES(2 * PcdFlashNvStorageFtwSpareSize). The
total size remains

  2 * PcdFlashNvStorageFtwSpareSize
  --------------------------------- * EFI_PAGE_SIZE
            EFI_PAGE_SIZE

Right now EmuVariableFvbRuntimeDxe open-codes the block count of 2 in
various limit checks, so introduce a few new macros:
- EMU_FVB_NUM_TOTAL_BLOCKS, for the LHS of the above product,
- EMU_FVB_NUM_SPARE_BLOCKS for the half of that.

Also rework the FVB protocol members to support an arbitrary count of
blocks.

Keep the invariant intact that the first half of the firmware volume hosts
the variable store and the FTW working block, and that the second half
maps the FTW spare area.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=527
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Regression-tested-by: Gary Lin <glin@suse.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c
OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.h