OvmfPkg/PlatformInitLib: Add functions for EmuVariableNvStore
There are 3 functions added for EmuVariableNvStore: - PlatformReserveEmuVariableNvStore - PlatformInitEmuVariableNvStore - PlatformValidateNvVarStore PlatformReserveEmuVariableNvStore allocate storage for NV variables early on so it will be at a consistent address. PlatformInitEmuVariableNvStore copies the content in PcdOvmfFlashNvStorageVariableBase to the storage allocated by PlatformReserveEmuVariableNvStore. This is used in the case that OVMF is launched with -bios parameter. Because in that situation UEFI variables will be partially emulated, and non-volatile variables may lose their contents after a reboot. This makes the secure boot feature not working. PlatformValidateNvVarStore is renamed from TdxValidateCfv and it is used to validate the integrity of FlashNvVarStore (PcdOvmfFlashNvStorageVariableBase). It should be called before PlatformInitEmuVariableNvStore is called to copy over the content. Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
@@ -234,4 +234,55 @@ PlatformTdxPublishRamRegions (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Check the integrity of NvVarStore.
|
||||
|
||||
@param[in] NvVarStoreBase - A pointer to NvVarStore header
|
||||
@param[in] NvVarStoreSize - NvVarStore size
|
||||
|
||||
@retval TRUE - The NvVarStore is valid.
|
||||
@retval FALSE - The NvVarStore is invalid.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
PlatformValidateNvVarStore (
|
||||
IN UINT8 *NvVarStoreBase,
|
||||
IN UINT32 NvVarStoreSize
|
||||
);
|
||||
|
||||
/**
|
||||
Allocate storage for NV variables early on so it will be
|
||||
at a consistent address. Since VM memory is preserved
|
||||
across reboots, this allows the NV variable storage to survive
|
||||
a VM reboot.
|
||||
|
||||
*
|
||||
* @retval VOID* The pointer to the storage for NV Variables
|
||||
*/
|
||||
VOID *
|
||||
EFIAPI
|
||||
PlatformReserveEmuVariableNvStore (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
When OVMF is lauched with -bios parameter, UEFI variables will be
|
||||
partially emulated, and non-volatile variables may lose their contents
|
||||
after a reboot. This makes the secure boot feature not working.
|
||||
|
||||
This function is used to initialize the EmuVariableNvStore
|
||||
with the conent in PcdOvmfFlashNvStorageVariableBase.
|
||||
|
||||
@param[in] EmuVariableNvStore - A pointer to EmuVariableNvStore
|
||||
|
||||
@retval EFI_SUCCESS - Successfully init the EmuVariableNvStore
|
||||
@retval Others - As the error code indicates
|
||||
*/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PlatformInitEmuVariableNvStore (
|
||||
IN VOID *EmuVariableNvStore
|
||||
);
|
||||
|
||||
#endif // PLATFORM_INIT_LIB_H_
|
||||
|
Reference in New Issue
Block a user