2015-11-30 19:48:50 +01:00
|
|
|
/**@file
|
|
|
|
Functions related to the Firmware Volume Block service whose
|
|
|
|
implementation is specific to the SMM driver build.
|
|
|
|
|
|
|
|
Copyright (C) 2015, Red Hat, Inc.
|
|
|
|
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
|
|
|
|
2019-04-04 01:06:33 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2015-11-30 19:48:50 +01:00
|
|
|
**/
|
|
|
|
|
|
|
|
#include <Library/DebugLib.h>
|
2015-11-30 19:48:54 +01:00
|
|
|
#include <Library/PcdLib.h>
|
2015-11-30 19:48:50 +01:00
|
|
|
#include <Library/SmmServicesTableLib.h>
|
|
|
|
#include <Protocol/DevicePath.h>
|
|
|
|
#include <Protocol/SmmFirmwareVolumeBlock.h>
|
|
|
|
|
|
|
|
#include "FwBlockService.h"
|
|
|
|
|
|
|
|
VOID
|
|
|
|
InstallProtocolInterfaces (
|
|
|
|
IN EFI_FW_VOL_BLOCK_DEVICE *FvbDevice
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EFI_HANDLE FvbHandle;
|
|
|
|
EFI_STATUS Status;
|
|
|
|
|
2015-11-30 19:48:54 +01:00
|
|
|
ASSERT (FeaturePcdGet (PcdSmmSmramRequire));
|
|
|
|
|
2015-11-30 19:48:50 +01:00
|
|
|
//
|
|
|
|
// There is no SMM service that can install multiple protocols in the SMM
|
|
|
|
// protocol database in one go.
|
|
|
|
//
|
|
|
|
// The SMM Firmware Volume Block protocol structure is the same as the
|
|
|
|
// Firmware Volume Block protocol structure.
|
|
|
|
//
|
|
|
|
FvbHandle = NULL;
|
|
|
|
DEBUG ((EFI_D_INFO, "Installing QEMU flash SMM FVB\n"));
|
|
|
|
Status = gSmst->SmmInstallProtocolInterface (
|
|
|
|
&FvbHandle,
|
|
|
|
&gEfiSmmFirmwareVolumeBlockProtocolGuid,
|
|
|
|
EFI_NATIVE_INTERFACE,
|
|
|
|
&FvbDevice->FwVolBlockInstance
|
|
|
|
);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
Status = gSmst->SmmInstallProtocolInterface (
|
|
|
|
&FvbHandle,
|
|
|
|
&gEfiDevicePathProtocolGuid,
|
|
|
|
EFI_NATIVE_INTERFACE,
|
|
|
|
FvbDevice->DevicePath
|
|
|
|
);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
InstallVirtualAddressChangeHandler (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// Nothing.
|
|
|
|
//
|
|
|
|
}
|
2018-07-06 17:00:41 +02:00
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
MarkIoMemoryRangeForRuntimeAccess (
|
|
|
|
IN EFI_PHYSICAL_ADDRESS BaseAddress,
|
|
|
|
IN UINTN Length
|
|
|
|
)
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// Nothing
|
|
|
|
//
|
|
|
|
|
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|
2020-03-10 23:27:36 +01:00
|
|
|
|
|
|
|
VOID
|
|
|
|
SetPcdFlashNvStorageBaseAddresses (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
//
|
OvmfPkg: set fixed FlashNvStorage base addresses with -D SMM_REQUIRE
The following flash-related base addresses:
- PcdFlashNvStorageVariableBase64,
- PcdFlashNvStorageFtwWorkingBase,
- PcdFlashNvStorageFtwSpareBase,
are always set to constant (invariable) values in the "-D SMM_REQUIRE"
build of OVMF. (That's because in the SMM build, actual pflash is a hard
requirement, and the RAM-based emulation is never available.)
Set said PCDs statically, at build. This will allow us to depend on their
values in the PEI phase.
When SMM_REQUIRE is FALSE, this change has no effect (confirmed by report
file comparison).
When SMM_REQUIRE is TRUE, the report file shows the following changes:
- "PcdOvmfFlashNvStorageFtwSpareBase" and
"PcdOvmfFlashNvStorageFtwWorkingBase" are no longer consumed by any
module directly,
- for "PcdFlashNvStorageFtwSpareBase", "PcdFlashNvStorageFtwWorkingBase"
and "PcdFlashNvStorageVariableBase64", the access method changes from
DYN to FIXED,
- for the latter PCDs, the zero (dynamic default) values are replaced with
the desired constants.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=386
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200310222739.26717-4-lersek@redhat.com>
Acked-by: Leif Lindholm <leif@nuviainc.com>
2020-03-10 23:27:37 +01:00
|
|
|
// Do nothing.
|
2020-03-10 23:27:36 +01:00
|
|
|
//
|
|
|
|
}
|