This adds support for FVB in order to support a platform independent and non-volatile variable store on UefiPayloadPkg. It is required for non-volatile variable support, TPM support, Secureboot support and more. Since commit bc744f5893fc4d53275ed26dd8d968011c6a09c1 coreboot supports the SMMSTORE v2 feature. It implements a SMI handler that is able to write, read and erase pages in the boot media (SPI flash). The communication is done using a fixed communication buffer that is allocated in CBMEM. The existence of this optional feature is advertised by a coreboot table. When the SMMSTORE feature is not available the variable emulation is used by setting PcdEmuVariableNvModeEnable to TRUE. Add a library for SMMStore to be used in DXE. The DXE component provides runtime services and takes care of virtual to physical mapping the communication buffers between SMM and OS. Make use of the APRIORI DXE to initialize an empty store on the first boot and set the PCDs to sane values before the variable driver is loaded. Tests on Intel(R) Xeon(R) E-2288G CPU @ 3.70G showed that the SMI isn't triggered with a probability of 1:40 of all cases when called in a tight loop. The CPU continues running and the SMI is triggeres asynchronously a few clock cycles later. coreboot only handels synchronous APM request and does nothing on asynchronous APM triggers. As there's no livesign from SMM it's impossible to tell if the handler has run. Just wait a bit and try again to trigger a synchronous SMI. Tests confirmed that out of 5 million tries the SMI is now always handled. Tested on Linux and Windows 10 on real hardware. Currently this cannot be tested on coreboot and qemu as it doesn't support the SMMSTORE on qemu. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
62 lines
1.7 KiB
INI
62 lines
1.7 KiB
INI
#/** @file
|
|
#
|
|
# Component description file for SMMSTORE module
|
|
#
|
|
# Copyright (c) 2020, 9elements Agency GmbH<BR>
|
|
#
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
#
|
|
#**/
|
|
[Defines]
|
|
INF_VERSION = 0x00010005
|
|
BASE_NAME = UefiPayloadBlSMMStoreDxe
|
|
FILE_GUID = A0402FCA-6B25-4CEA-B7DD-C08F99714B29
|
|
MODULE_TYPE = DXE_RUNTIME_DRIVER
|
|
VERSION_STRING = 1.0
|
|
ENTRY_POINT = BlSMMSTOREInitialise
|
|
|
|
[Sources.common]
|
|
BlSMMStoreDxe.h
|
|
BlSMMStoreDxe.c
|
|
BlSMMStoreFvbDxe.c
|
|
|
|
[Packages]
|
|
MdePkg/MdePkg.dec
|
|
MdeModulePkg/MdeModulePkg.dec
|
|
EmbeddedPkg/EmbeddedPkg.dec
|
|
UefiPayloadPkg/UefiPayloadPkg.dec
|
|
|
|
[LibraryClasses]
|
|
BaseLib
|
|
DebugLib
|
|
HobLib
|
|
SmmStoreLib
|
|
UefiLib
|
|
UefiDriverEntryPoint
|
|
UefiBootServicesTableLib
|
|
UefiRuntimeLib
|
|
DxeServicesTableLib
|
|
|
|
[Guids]
|
|
gEfiSystemNvDataFvGuid
|
|
gEfiVariableGuid
|
|
gEfiAuthenticatedVariableGuid
|
|
gEfiEventVirtualAddressChangeGuid
|
|
gEdkiiNvVarStoreFormattedGuid ## PRODUCES ## PROTOCOL
|
|
gEfiSMMSTOREInfoHobGuid ## CONSUMES
|
|
|
|
[Protocols]
|
|
gEfiDevicePathProtocolGuid ## BY_START
|
|
gEfiFirmwareVolumeBlockProtocolGuid ## BY_START
|
|
|
|
[Pcd]
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
|
gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable
|
|
|
|
[Depex]
|
|
BEFORE gVariableRuntimeDxeFileGuid |