3 Parts of the SMM/MM implementation that are specific to traditional MM
5 Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>
6 Copyright (c) 2018, Linaro, Ltd. All rights reserved. <BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Library/UefiBootServicesTableLib.h>
18 #include <Library/SmmMemLib.h>
22 This function checks if the buffer is valid per processor architecture and
23 does not overlap with SMRAM.
25 @param Buffer The buffer start address to be checked.
26 @param Length The buffer length to be checked.
28 @retval TRUE This buffer is valid per processor architecture and does not
30 @retval FALSE This buffer is not valid per processor architecture or overlaps
34 VariableSmmIsBufferOutsideSmmValid (
35 IN EFI_PHYSICAL_ADDRESS Buffer
,
39 return SmmIsBufferOutsideSmmValid (Buffer
, Length
);
43 Notify the system that the SMM variable driver is ready.
46 VariableNotifySmmReady (
54 Status
= gBS
->InstallProtocolInterface (
56 &gEfiSmmVariableProtocolGuid
,
60 ASSERT_EFI_ERROR (Status
);
64 Notify the system that the SMM variable write driver is ready.
67 VariableNotifySmmWriteReady (
75 Status
= gBS
->InstallProtocolInterface (
77 &gSmmVariableWriteGuid
,
81 ASSERT_EFI_ERROR (Status
);
85 Variable service MM driver entry point
87 @param[in] ImageHandle A handle for the image that is initializing this
89 @param[in] SystemTable A pointer to the EFI system table
91 @retval EFI_SUCCESS Variable service successfully initialized.
95 VariableServiceInitialize (
96 IN EFI_HANDLE ImageHandle
,
97 IN EFI_SYSTEM_TABLE
*SystemTable
100 return MmVariableServiceInitialize ();
104 Whether the TCG or TCG2 protocols are installed in the UEFI protocol database.
105 This information is used by the MorLock code to infer whether an existing
106 MOR variable is legitimate or not.
108 @retval TRUE Either the TCG or TCG2 protocol is installed in the UEFI
110 @retval FALSE Neither the TCG nor the TCG2 protocol is installed in the UEFI
114 VariableHaveTcgProtocols (
121 Status
= gBS
->LocateProtocol (
122 &gEfiTcg2ProtocolGuid
,
123 NULL
, // Registration
126 if (!EFI_ERROR (Status
)) {
130 Status
= gBS
->LocateProtocol (
131 &gEfiTcgProtocolGuid
,
132 NULL
, // Registration
135 return !EFI_ERROR (Status
);