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   This program and the accompanying materials are licensed and made available
9   under the terms and conditions of the BSD License which accompanies this
10   distribution.  The full text of the license may be found at
11   http://opensource.org/licenses/bsd-license.php
12 
13   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 **/
16 
17 #include <Library/DebugLib.h>
18 #include <Library/PcdLib.h>
19 #include <Library/SmmServicesTableLib.h>
20 #include <Protocol/DevicePath.h>
21 #include <Protocol/SmmFirmwareVolumeBlock.h>
22 
23 #include "FwBlockService.h"
24 
25 VOID
InstallProtocolInterfaces(IN EFI_FW_VOL_BLOCK_DEVICE * FvbDevice)26 InstallProtocolInterfaces (
27   IN EFI_FW_VOL_BLOCK_DEVICE *FvbDevice
28   )
29 {
30   EFI_HANDLE FvbHandle;
31   EFI_STATUS Status;
32 
33   ASSERT (FeaturePcdGet (PcdSmmSmramRequire));
34 
35   //
36   // There is no SMM service that can install multiple protocols in the SMM
37   // protocol database in one go.
38   //
39   // The SMM Firmware Volume Block protocol structure is the same as the
40   // Firmware Volume Block protocol structure.
41   //
42   FvbHandle = NULL;
43   DEBUG ((EFI_D_INFO, "Installing QEMU flash SMM FVB\n"));
44   Status = gSmst->SmmInstallProtocolInterface (
45                     &FvbHandle,
46                     &gEfiSmmFirmwareVolumeBlockProtocolGuid,
47                     EFI_NATIVE_INTERFACE,
48                     &FvbDevice->FwVolBlockInstance
49                     );
50   ASSERT_EFI_ERROR (Status);
51 
52   Status = gSmst->SmmInstallProtocolInterface (
53                     &FvbHandle,
54                     &gEfiDevicePathProtocolGuid,
55                     EFI_NATIVE_INTERFACE,
56                     FvbDevice->DevicePath
57                     );
58   ASSERT_EFI_ERROR (Status);
59 }
60 
61 VOID
InstallVirtualAddressChangeHandler(VOID)62 InstallVirtualAddressChangeHandler (
63   VOID
64   )
65 {
66   //
67   // Nothing.
68   //
69 }
70