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 ((DEBUG_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,
VirtioRingInit(IN VIRTIO_DEVICE_PROTOCOL * VirtIo,IN UINT16 QueueSize,OUT VRING * Ring)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   //
84   // Do nothing.
85   //
86 }
87