]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / PrivilegePolymorphic.h
CommitLineData
00663d04
LE
1/** @file\r
2 Polymorphic functions that are called from both the privileged driver (i.e.,\r
3 the DXE_SMM variable module) and the non-privileged drivers (i.e., one or\r
4 both of the DXE_RUNTIME variable modules).\r
5\r
6 Each of these functions has two implementations, appropriate for privileged\r
7 vs. non-privileged driver code.\r
8\r
9 Copyright (c) 2017, Red Hat, Inc.<BR>\r
e83d841f 10 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
00663d04 11\r
9d510e61 12 SPDX-License-Identifier: BSD-2-Clause-Patent\r
00663d04
LE
13**/\r
14#ifndef _PRIVILEGE_POLYMORPHIC_H_\r
15#define _PRIVILEGE_POLYMORPHIC_H_\r
16\r
17#include <Uefi/UefiBaseType.h>\r
18\r
19/**\r
20 SecureBoot Hook for auth variable update.\r
21\r
22 @param[in] VariableName Name of Variable to be found.\r
23 @param[in] VendorGuid Variable vendor GUID.\r
24**/\r
25VOID\r
26EFIAPI\r
27SecureBootHook (\r
28 IN CHAR16 *VariableName,\r
29 IN EFI_GUID *VendorGuid\r
30 );\r
31\r
03877377
LE
32/**\r
33 Initialization for MOR Control Lock.\r
34\r
35 @retval EFI_SUCCESS MorLock initialization success.\r
36 @return Others Some error occurs.\r
37**/\r
38EFI_STATUS\r
39MorLockInit (\r
40 VOID\r
41 );\r
42\r
f1304280
LE
43/**\r
44 Delayed initialization for MOR Control Lock at EndOfDxe.\r
45\r
46 This function performs any operations queued by MorLockInit().\r
47**/\r
48VOID\r
49MorLockInitAtEndOfDxe (\r
50 VOID\r
51 );\r
52\r
03877377
LE
53/**\r
54 This service is an MOR/MorLock checker handler for the SetVariable().\r
55\r
56 @param[in] VariableName the name of the vendor's variable, as a\r
57 Null-Terminated Unicode String\r
58 @param[in] VendorGuid Unify identifier for vendor.\r
59 @param[in] Attributes Attributes bitmask to set for the variable.\r
60 @param[in] DataSize The size in bytes of Data-Buffer.\r
61 @param[in] Data Point to the content of the variable.\r
62\r
63 @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable\r
64 driver can store the variable data.\r
65 @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or\r
66 attributes is not allowed for MOR variable.\r
67 @retval EFI_ACCESS_DENIED The MOR/MorLock is locked.\r
68 @retval EFI_ALREADY_STARTED The MorLock variable is handled inside this\r
69 function. Variable driver can just return\r
70 EFI_SUCCESS.\r
71**/\r
72EFI_STATUS\r
73SetVariableCheckHandlerMor (\r
74 IN CHAR16 *VariableName,\r
75 IN EFI_GUID *VendorGuid,\r
76 IN UINT32 Attributes,\r
77 IN UINTN DataSize,\r
78 IN VOID *Data\r
79 );\r
80\r
e83d841f 81/**\r
49395ea0
HW
82 This service is consumed by the variable modules to place a barrier to stop\r
83 speculative execution.\r
84\r
85 Ensures that no later instruction will execute speculatively, until all prior\r
86 instructions have completed.\r
e83d841f
HW
87\r
88**/\r
89VOID\r
49395ea0 90VariableSpeculationBarrier (\r
e83d841f
HW
91 VOID\r
92 );\r
93\r
a855f63e 94/**\r
44289eea 95 Notify the system that the SMM variable driver is ready.\r
a855f63e
AB
96**/\r
97VOID\r
98VariableNotifySmmReady (\r
99 VOID\r
100 );\r
101\r
102/**\r
44289eea 103 Notify the system that the SMM variable write driver is ready.\r
a855f63e
AB
104**/\r
105VOID\r
106VariableNotifySmmWriteReady (\r
107 VOID\r
108 );\r
109\r
110/**\r
111 Variable Driver main entry point. The Variable driver places the 4 EFI\r
112 runtime services in the EFI System Table and installs arch protocols\r
113 for variable read and write services being available. It also registers\r
114 a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.\r
115\r
116 @retval EFI_SUCCESS Variable service successfully initialized.\r
117**/\r
118EFI_STATUS\r
119EFIAPI\r
120MmVariableServiceInitialize (\r
121 VOID\r
122 );\r
123\r
124/**\r
125 This function checks if the buffer is valid per processor architecture and\r
126 does not overlap with SMRAM.\r
127\r
128 @param Buffer The buffer start address to be checked.\r
129 @param Length The buffer length to be checked.\r
130\r
131 @retval TRUE This buffer is valid per processor architecture and does not\r
132 overlap with SMRAM.\r
133 @retval FALSE This buffer is not valid per processor architecture or overlaps\r
134 with SMRAM.\r
135**/\r
136BOOLEAN\r
137VariableSmmIsBufferOutsideSmmValid (\r
138 IN EFI_PHYSICAL_ADDRESS Buffer,\r
139 IN UINT64 Length\r
140 );\r
141\r
142/**\r
143 Whether the TCG or TCG2 protocols are installed in the UEFI protocol database.\r
144 This information is used by the MorLock code to infer whether an existing\r
145 MOR variable is legitimate or not.\r
146\r
147 @retval TRUE Either the TCG or TCG2 protocol is installed in the UEFI\r
148 protocol database\r
149 @retval FALSE Neither the TCG nor the TCG2 protocol is installed in the UEFI\r
150 protocol database\r
151**/\r
152BOOLEAN\r
153VariableHaveTcgProtocols (\r
154 VOID\r
155 );\r
156\r
00663d04 157#endif\r