Attention is currently required from: Sean Rhodes, Martin Roth, Matt DeVillier, Arthur Heymans, Patrick Rudolph. Hello build bot (Jenkins), Sean Rhodes, Martin Roth, Jakub Czapiga, Matt DeVillier, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/52564
to look at the new patch set (#11).
Change subject: drivers/efi: Add EFI variable store option support ......................................................................
drivers/efi: Add EFI variable store option support
Add a driver to read and write EFI variables stored in a region device. This is particullary useful for EDK2 as payload and allows to reuse existing EFI tools to set/get options used by the firmware.
The write implementation is fault tolerant and doesn't corrupt the variable store. A faulting write might result in using the old value even though a 'newer' had been completely written.
Implemented basic unit tests for header corruption, writing existing data and append new data into the store.
Initial firmware region state: Initially the variable store region isn't formatted. Usually this is done in the EDK2 payload when no valid firmware volume could be found. It might be useful to do this offline or in coreboot to have a working option store on the first boot or when it was corrupted.
Performance improvements: Right now the code always checks if the firmware volume header is valid. This could be optimised by caching the test result in heap. For write operations it would be good to cache the end of the variable store in the heap as well, instead of walking the whole store.
Reclaiming memory: The EFI variable store is append write only. To update an existing variable, first a new is written to the end of the store and then the previous is marked invalid. This only works on PNOR flash that allow to clear set bits, but keep cleared bits state. This mechanisms allows a fault tolerant write, but it also requires to "clean" the variable store for time to time. This cleaning would remove variables that have been marked "deleted". Such cleaning mechanism in turn must be fault tolerant and thus must use a second parition in the SPI flash as backup/working region. For now to cleaning is done in coreboot.
Fault checking: The driver should check if a previous write was successfull and if not mark variables as deleted on the next operation.
Tested and working: - Could enumerate all existing variables - Could read variables - Could write variables
Change-Id: I8079f71d29da5dc2db956fc68bef1486fe3906bb Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- A src/drivers/efi/Kconfig A src/drivers/efi/Makefile.inc A src/drivers/efi/efivars.c A src/drivers/efi/efivars.h M tests/Makefile.inc A tests/drivers/Makefile.inc A tests/drivers/efivars.c 7 files changed, 876 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/52564/11