]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/QemuFlashFvbServicesRuntimeDxe/FwBlockServiceSmm.c
33bc3e1137be4e4cc8e2ec3901d6414f3f3f900b
[mirror_edk2.git] / OvmfPkg / QemuFlashFvbServicesRuntimeDxe / FwBlockServiceSmm.c
1 /**@file
2 Functions related to the Firmware Volume Block service whose
3 implementation is specific to the SMM driver build.
4
5 Copyright (C) 2015, Red Hat, Inc.
6 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9 **/
10
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>
16
17 #include "FwBlockService.h"
18
19 VOID
20 InstallProtocolInterfaces (
21 IN EFI_FW_VOL_BLOCK_DEVICE *FvbDevice
22 )
23 {
24 EFI_HANDLE FvbHandle;
25 EFI_STATUS Status;
26
27 ASSERT (FeaturePcdGet (PcdSmmSmramRequire));
28
29 //
30 // There is no SMM service that can install multiple protocols in the SMM
31 // protocol database in one go.
32 //
33 // The SMM Firmware Volume Block protocol structure is the same as the
34 // Firmware Volume Block protocol structure.
35 //
36 FvbHandle = NULL;
37 DEBUG ((EFI_D_INFO, "Installing QEMU flash SMM FVB\n"));
38 Status = gSmst->SmmInstallProtocolInterface (
39 &FvbHandle,
40 &gEfiSmmFirmwareVolumeBlockProtocolGuid,
41 EFI_NATIVE_INTERFACE,
42 &FvbDevice->FwVolBlockInstance
43 );
44 ASSERT_EFI_ERROR (Status);
45
46 Status = gSmst->SmmInstallProtocolInterface (
47 &FvbHandle,
48 &gEfiDevicePathProtocolGuid,
49 EFI_NATIVE_INTERFACE,
50 FvbDevice->DevicePath
51 );
52 ASSERT_EFI_ERROR (Status);
53 }
54
55 VOID
56 InstallVirtualAddressChangeHandler (
57 VOID
58 )
59 {
60 //
61 // Nothing.
62 //
63 }
64
65 EFI_STATUS
66 MarkIoMemoryRangeForRuntimeAccess (
67 IN EFI_PHYSICAL_ADDRESS BaseAddress,
68 IN UINTN Length
69 )
70 {
71 //
72 // Nothing
73 //
74
75 return EFI_SUCCESS;
76 }
77
78 VOID
79 SetPcdFlashNvStorageBaseAddresses (
80 VOID
81 )
82 {
83 RETURN_STATUS PcdStatus;
84
85 //
86 // Set several PCD values to point to flash
87 //
88 PcdStatus = PcdSet64S (
89 PcdFlashNvStorageVariableBase64,
90 (UINTN) PcdGet32 (PcdOvmfFlashNvStorageVariableBase)
91 );
92 ASSERT_RETURN_ERROR (PcdStatus);
93 PcdStatus = PcdSet32S (
94 PcdFlashNvStorageFtwWorkingBase,
95 PcdGet32 (PcdOvmfFlashNvStorageFtwWorkingBase)
96 );
97 ASSERT_RETURN_ERROR (PcdStatus);
98 PcdStatus = PcdSet32S (
99 PcdFlashNvStorageFtwSpareBase,
100 PcdGet32 (PcdOvmfFlashNvStorageFtwSpareBase)
101 );
102 ASSERT_RETURN_ERROR (PcdStatus);
103 }