]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / PrivilegePolymorphic.h
1 /** @file
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).
5
6 Each of these functions has two implementations, appropriate for privileged
7 vs. non-privileged driver code.
8
9 Copyright (c) 2017, Red Hat, Inc.<BR>
10 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
11
12 SPDX-License-Identifier: BSD-2-Clause-Patent
13 **/
14
15 #ifndef _PRIVILEGE_POLYMORPHIC_H_
16 #define _PRIVILEGE_POLYMORPHIC_H_
17
18 #include <Uefi/UefiBaseType.h>
19
20 /**
21 SecureBoot Hook for auth variable update.
22
23 @param[in] VariableName Name of Variable to be found.
24 @param[in] VendorGuid Variable vendor GUID.
25 **/
26 VOID
27 EFIAPI
28 SecureBootHook (
29 IN CHAR16 *VariableName,
30 IN EFI_GUID *VendorGuid
31 );
32
33 /**
34 Initialization for MOR Control Lock.
35
36 @retval EFI_SUCCESS MorLock initialization success.
37 @return Others Some error occurs.
38 **/
39 EFI_STATUS
40 MorLockInit (
41 VOID
42 );
43
44 /**
45 Delayed initialization for MOR Control Lock at EndOfDxe.
46
47 This function performs any operations queued by MorLockInit().
48 **/
49 VOID
50 MorLockInitAtEndOfDxe (
51 VOID
52 );
53
54 /**
55 This service is an MOR/MorLock checker handler for the SetVariable().
56
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.
63
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
71 EFI_SUCCESS.
72 **/
73 EFI_STATUS
74 SetVariableCheckHandlerMor (
75 IN CHAR16 *VariableName,
76 IN EFI_GUID *VendorGuid,
77 IN UINT32 Attributes,
78 IN UINTN DataSize,
79 IN VOID *Data
80 );
81
82 /**
83 This service is consumed by the variable modules to place a barrier to stop
84 speculative execution.
85
86 Ensures that no later instruction will execute speculatively, until all prior
87 instructions have completed.
88
89 **/
90 VOID
91 VariableSpeculationBarrier (
92 VOID
93 );
94
95 /**
96 Notify the system that the SMM variable driver is ready.
97 **/
98 VOID
99 VariableNotifySmmReady (
100 VOID
101 );
102
103 /**
104 Notify the system that the SMM variable write driver is ready.
105 **/
106 VOID
107 VariableNotifySmmWriteReady (
108 VOID
109 );
110
111 /**
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.
116
117 @retval EFI_SUCCESS Variable service successfully initialized.
118 **/
119 EFI_STATUS
120 EFIAPI
121 MmVariableServiceInitialize (
122 VOID
123 );
124
125 /**
126 This function checks if the buffer is valid per processor architecture and
127 does not overlap with SMRAM.
128
129 @param Buffer The buffer start address to be checked.
130 @param Length The buffer length to be checked.
131
132 @retval TRUE This buffer is valid per processor architecture and does not
133 overlap with SMRAM.
134 @retval FALSE This buffer is not valid per processor architecture or overlaps
135 with SMRAM.
136 **/
137 BOOLEAN
138 VariableSmmIsBufferOutsideSmmValid (
139 IN EFI_PHYSICAL_ADDRESS Buffer,
140 IN UINT64 Length
141 );
142
143 /**
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.
147
148 @retval TRUE Either the TCG or TCG2 protocol is installed in the UEFI
149 protocol database
150 @retval FALSE Neither the TCG nor the TCG2 protocol is installed in the UEFI
151 protocol database
152 **/
153 BOOLEAN
154 VariableHaveTcgProtocols (
155 VOID
156 );
157
158 #endif