]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Variable/RuntimeDxe/PrivilegePolymorphic.h
9b294e6b3674c86baafe169694ca67ea29478a3c
[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 This program and the accompanying materials are licensed and made available
13 under the terms and conditions of the BSD License which accompanies this
14 distribution. The full text of the license may be found at
15 http://opensource.org/licenses/bsd-license.php
16
17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
18 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 **/
20 #ifndef _PRIVILEGE_POLYMORPHIC_H_
21 #define _PRIVILEGE_POLYMORPHIC_H_
22
23 #include <Uefi/UefiBaseType.h>
24
25 /**
26 SecureBoot Hook for auth variable update.
27
28 @param[in] VariableName Name of Variable to be found.
29 @param[in] VendorGuid Variable vendor GUID.
30 **/
31 VOID
32 EFIAPI
33 SecureBootHook (
34 IN CHAR16 *VariableName,
35 IN EFI_GUID *VendorGuid
36 );
37
38 /**
39 Initialization for MOR Control Lock.
40
41 @retval EFI_SUCCESS MorLock initialization success.
42 @return Others Some error occurs.
43 **/
44 EFI_STATUS
45 MorLockInit (
46 VOID
47 );
48
49 /**
50 Delayed initialization for MOR Control Lock at EndOfDxe.
51
52 This function performs any operations queued by MorLockInit().
53 **/
54 VOID
55 MorLockInitAtEndOfDxe (
56 VOID
57 );
58
59 /**
60 This service is an MOR/MorLock checker handler for the SetVariable().
61
62 @param[in] VariableName the name of the vendor's variable, as a
63 Null-Terminated Unicode String
64 @param[in] VendorGuid Unify identifier for vendor.
65 @param[in] Attributes Attributes bitmask to set for the variable.
66 @param[in] DataSize The size in bytes of Data-Buffer.
67 @param[in] Data Point to the content of the variable.
68
69 @retval EFI_SUCCESS The MOR/MorLock check pass, and Variable
70 driver can store the variable data.
71 @retval EFI_INVALID_PARAMETER The MOR/MorLock data or data size or
72 attributes is not allowed for MOR variable.
73 @retval EFI_ACCESS_DENIED The MOR/MorLock is locked.
74 @retval EFI_ALREADY_STARTED The MorLock variable is handled inside this
75 function. Variable driver can just return
76 EFI_SUCCESS.
77 **/
78 EFI_STATUS
79 SetVariableCheckHandlerMor (
80 IN CHAR16 *VariableName,
81 IN EFI_GUID *VendorGuid,
82 IN UINT32 Attributes,
83 IN UINTN DataSize,
84 IN VOID *Data
85 );
86
87 /**
88 This service is consumed by the variable modules to place a barrier to stop
89 speculative execution.
90
91 Ensures that no later instruction will execute speculatively, until all prior
92 instructions have completed.
93
94 **/
95 VOID
96 VariableSpeculationBarrier (
97 VOID
98 );
99
100 /**
101 Notify the system that the SMM variable driver is ready.
102 **/
103 VOID
104 VariableNotifySmmReady (
105 VOID
106 );
107
108 /**
109 Notify the system that the SMM variable write driver is ready.
110 **/
111 VOID
112 VariableNotifySmmWriteReady (
113 VOID
114 );
115
116 /**
117 Variable Driver main entry point. The Variable driver places the 4 EFI
118 runtime services in the EFI System Table and installs arch protocols
119 for variable read and write services being available. It also registers
120 a notification function for an EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event.
121
122 @retval EFI_SUCCESS Variable service successfully initialized.
123 **/
124 EFI_STATUS
125 EFIAPI
126 MmVariableServiceInitialize (
127 VOID
128 );
129
130 /**
131 This function checks if the buffer is valid per processor architecture and
132 does not overlap with SMRAM.
133
134 @param Buffer The buffer start address to be checked.
135 @param Length The buffer length to be checked.
136
137 @retval TRUE This buffer is valid per processor architecture and does not
138 overlap with SMRAM.
139 @retval FALSE This buffer is not valid per processor architecture or overlaps
140 with SMRAM.
141 **/
142 BOOLEAN
143 VariableSmmIsBufferOutsideSmmValid (
144 IN EFI_PHYSICAL_ADDRESS Buffer,
145 IN UINT64 Length
146 );
147
148 /**
149 Whether the TCG or TCG2 protocols are installed in the UEFI protocol database.
150 This information is used by the MorLock code to infer whether an existing
151 MOR variable is legitimate or not.
152
153 @retval TRUE Either the TCG or TCG2 protocol is installed in the UEFI
154 protocol database
155 @retval FALSE Neither the TCG nor the TCG2 protocol is installed in the UEFI
156 protocol database
157 **/
158 BOOLEAN
159 VariableHaveTcgProtocols (
160 VOID
161 );
162
163 #endif