2 Polymorphic functions that are called from both the privileged driver (i.e.,
3 the DXE_SMM variable module) and the non-privileged drivers (i.e., one or
4 both of the DXE_RUNTIME variable modules).
6 Each of these functions has two implementations, appropriate for privileged
7 vs. non-privileged driver code.
9 Copyright (c) 2017, Red Hat, Inc.<BR>
10 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
12 SPDX-License-Identifier: BSD-2-Clause-Patent
15 #ifndef _PRIVILEGE_POLYMORPHIC_H_
16 #define _PRIVILEGE_POLYMORPHIC_H_
18 #include <Uefi/UefiBaseType.h>
21 SecureBoot Hook for auth variable update.
23 @param[in] VariableName Name of Variable to be found.
24 @param[in] VendorGuid Variable vendor GUID.
29 IN CHAR16
*VariableName
,
30 IN EFI_GUID
*VendorGuid
34 Initialization for MOR Control Lock.
36 @retval EFI_SUCCESS MorLock initialization success.
37 @return Others Some error occurs.
45 Delayed initialization for MOR Control Lock at EndOfDxe.
47 This function performs any operations queued by MorLockInit().
50 MorLockInitAtEndOfDxe (
55 This service is an MOR/MorLock checker handler for the SetVariable().
57 @param[in] VariableName the name of the vendor's variable, as a
58 Null-Terminated Unicode String
59 @param[in] VendorGuid Unify identifier for vendor.
60 @param[in] Attributes Attributes bitmask to set for the variable.
61 @param[in] DataSize The size in bytes of Data-Buffer.
62 @param[in] Data Point to the content of the variable.
64 @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable
65 driver can store the variable data.
66 @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or
67 attributes is not allowed for MOR variable.
68 @retval EFI_ACCESS_DENIED The MOR/MorLock is locked.
69 @retval EFI_ALREADY_STARTED The MorLock variable is handled inside this
70 function. Variable driver can just return
74 SetVariableCheckHandlerMor (
75 IN CHAR16
*VariableName
,
76 IN EFI_GUID
*VendorGuid
,
83 This service is consumed by the variable modules to place a barrier to stop
84 speculative execution.
86 Ensures that no later instruction will execute speculatively, until all prior
87 instructions have completed.
91 VariableSpeculationBarrier (
96 Notify the system that the SMM variable driver is ready.
99 VariableNotifySmmReady (
104 Notify the system that the SMM variable write driver is ready.
107 VariableNotifySmmWriteReady (
112 Variable Driver main entry point. The Variable driver places the 4 EFI
113 runtime services in the EFI System Table and installs arch protocols
114 for variable read and write services being available. It also registers
115 a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
117 @retval EFI_SUCCESS Variable service successfully initialized.
121 MmVariableServiceInitialize (
126 This function checks if the buffer is valid per processor architecture and
127 does not overlap with SMRAM.
129 @param Buffer The buffer start address to be checked.
130 @param Length The buffer length to be checked.
132 @retval TRUE This buffer is valid per processor architecture and does not
134 @retval FALSE This buffer is not valid per processor architecture or overlaps
138 VariableSmmIsBufferOutsideSmmValid (
139 IN EFI_PHYSICAL_ADDRESS Buffer
,
144 Whether the TCG or TCG2 protocols are installed in the UEFI protocol database.
145 This information is used by the MorLock code to infer whether an existing
146 MOR variable is legitimate or not.
148 @retval TRUE Either the TCG or TCG2 protocol is installed in the UEFI
150 @retval FALSE Neither the TCG nor the TCG2 protocol is installed in the UEFI
154 VariableHaveTcgProtocols (