MdeModulePkg/VariableRuntimeDxe: factor out boot service accesses

In preparation of providing a standalone MM based variable runtime
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>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Ard Biesheuvel
2019-01-03 19:28:24 +01:00
parent d0def00d33
commit a855f63e2f
5 changed files with 222 additions and 56 deletions

View File

@@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include "Variable.h"
typedef struct {
@@ -419,8 +418,6 @@ MorLockInitAtEndOfDxe (
{
UINTN MorSize;
EFI_STATUS MorStatus;
EFI_STATUS TcgStatus;
VOID *TcgInterface;
if (!mMorLockInitializationRequired) {
//
@@ -458,20 +455,7 @@ MorLockInitAtEndOfDxe (
// can be deduced from the absence of the TCG / TCG2 protocols, as edk2's
// MOR implementation depends on (one of) those protocols.
//
TcgStatus = gBS->LocateProtocol (
&gEfiTcg2ProtocolGuid,
NULL, // Registration
&TcgInterface
);
if (EFI_ERROR (TcgStatus)) {
TcgStatus = gBS->LocateProtocol (
&gEfiTcgProtocolGuid,
NULL, // Registration
&TcgInterface
);
}
if (!EFI_ERROR (TcgStatus)) {
if (VariableHaveTcgProtocols ()) {
//
// The MOR variable originates from the platform firmware; set the MOR
// Control Lock variable to report the locking capability to the OS.