2 Functions related to the Firmware Volume Block service whose
3 implementation is specific to the SMM driver build.
5 Copyright (C) 2015, Red Hat, Inc.
6 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/DebugLib.h>
12 #include <Library/PcdLib.h>
13 #include <Library/SmmServicesTableLib.h>
14 #include <Protocol/DevicePath.h>
15 #include <Protocol/SmmFirmwareVolumeBlock.h>
17 #include "FwBlockService.h"
20 InstallProtocolInterfaces (
21 IN EFI_FW_VOL_BLOCK_DEVICE
*FvbDevice
27 ASSERT (FeaturePcdGet (PcdSmmSmramRequire
));
30 // There is no SMM service that can install multiple protocols in the SMM
31 // protocol database in one go.
33 // The SMM Firmware Volume Block protocol structure is the same as the
34 // Firmware Volume Block protocol structure.
37 DEBUG ((EFI_D_INFO
, "Installing QEMU flash SMM FVB\n"));
38 Status
= gSmst
->SmmInstallProtocolInterface (
40 &gEfiSmmFirmwareVolumeBlockProtocolGuid
,
42 &FvbDevice
->FwVolBlockInstance
44 ASSERT_EFI_ERROR (Status
);
46 Status
= gSmst
->SmmInstallProtocolInterface (
48 &gEfiDevicePathProtocolGuid
,
52 ASSERT_EFI_ERROR (Status
);
56 InstallVirtualAddressChangeHandler (
66 MarkIoMemoryRangeForRuntimeAccess (
67 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
79 SetPcdFlashNvStorageBaseAddresses (
83 RETURN_STATUS PcdStatus
;
86 // Set several PCD values to point to flash
88 PcdStatus
= PcdSet64S (
89 PcdFlashNvStorageVariableBase64
,
90 (UINTN
) PcdGet32 (PcdOvmfFlashNvStorageVariableBase
)
92 ASSERT_RETURN_ERROR (PcdStatus
);
93 PcdStatus
= PcdSet32S (
94 PcdFlashNvStorageFtwWorkingBase
,
95 PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase
)
97 ASSERT_RETURN_ERROR (PcdStatus
);
98 PcdStatus
= PcdSet32S (
99 PcdFlashNvStorageFtwSpareBase
,
100 PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase
)
102 ASSERT_RETURN_ERROR (PcdStatus
);