MdeModulePkg/FaultTolerantWriteDxe: factor out boot service accesses

In preparation of providing a standalone MM based FTW driver, move
the existing SMM driver to the new MM services table, and factor out
some pieces that are specific to the traditional driver, mainly
related to the use of UEFI boot services, which are not accessible
to standalone MM drivers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Ard Biesheuvel
2019-01-03 19:28:22 +01:00
parent e2f0d814c1
commit 22cedf5bbd
7 changed files with 233 additions and 48 deletions

View File

@@ -31,7 +31,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiDriverEntryPoint.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/ReportStatusCodeLib.h>
//
@@ -766,4 +765,26 @@ WriteWorkSpaceData (
IN UINT8 *Buffer
);
/**
Internal implementation of CRC32. Depending on the execution context
(traditional SMM or DXE vs standalone MM), this function is implemented
via a call to the CalculateCrc32 () boot service, or via a library
call.
If Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param[in] Buffer A pointer to the buffer on which the 32-bit CRC is
to be computed.
@param[in] Length The number of bytes in the buffer Data.
@retval Crc32 The 32-bit CRC was computed for the data buffer.
**/
UINT32
FtwCalculateCrc32 (
IN VOID *Buffer,
IN UINTN Length
);
#endif