TianoCore EDK2 master
Loading...
Searching...
No Matches
MemEncryptSevLib.h
Go to the documentation of this file.
1
11#ifndef _MEM_ENCRYPT_SEV_LIB_H_
12#define _MEM_ENCRYPT_SEV_LIB_H_
13
14#include <Base.h>
15#include <WorkArea.h>
16
17//
18// Define the maximum number of #VCs allowed (e.g. the level of nesting
19// that is allowed => 2 allows for 1 nested #VCs). I this value is changed,
20// be sure to increase the size of
21// gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBackupSize
22// in any FDF file using this PCD.
23//
24#define VMGEXIT_MAXIMUM_VC_COUNT 2
25
26//
27// Per-CPU data mapping structure
28// Use UINT32 for cached indicators and compare to a specific value
29// so that the hypervisor can't indicate a value is cached by just
30// writing random data to that area.
31//
32typedef struct {
33 UINT32 Dr7Cached;
34 UINT64 Dr7;
35
36 UINTN VcCount;
37 VOID *GhcbBackupPages;
39
40//
41// Memory encryption address range states.
42//
43typedef enum {
44 MemEncryptSevAddressRangeUnencrypted,
45 MemEncryptSevAddressRangeEncrypted,
46 MemEncryptSevAddressRangeMixed,
47 MemEncryptSevAddressRangeError,
48} MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE;
49
56BOOLEAN
57EFIAPI
59 VOID
60 );
61
68BOOLEAN
69EFIAPI
71 VOID
72 );
73
80BOOLEAN
81EFIAPI
83 VOID
84 );
85
103RETURN_STATUS
104EFIAPI
106 IN PHYSICAL_ADDRESS Cr3BaseAddress,
107 IN PHYSICAL_ADDRESS BaseAddress,
108 IN UINTN NumPages
109 );
110
128RETURN_STATUS
129EFIAPI
131 IN PHYSICAL_ADDRESS Cr3BaseAddress,
132 IN PHYSICAL_ADDRESS BaseAddress,
133 IN UINTN NumPages
134 );
135
151RETURN_STATUS
152EFIAPI
154 OUT UINTN *BaseAddress,
155 OUT UINTN *NumberOfPages
156 );
157
163UINT64
164EFIAPI
166 VOID
167 );
168
175BOOLEAN
176EFIAPI
178 VOID
179 );
180
196MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE
197EFIAPI
199 IN PHYSICAL_ADDRESS Cr3BaseAddress,
200 IN PHYSICAL_ADDRESS BaseAddress,
201 IN UINTN Length
202 );
203
221RETURN_STATUS
222EFIAPI
224 IN PHYSICAL_ADDRESS Cr3BaseAddress,
225 IN PHYSICAL_ADDRESS BaseAddress,
226 IN UINTN NumPages
227 );
228
236VOID
237EFIAPI
239 IN PHYSICAL_ADDRESS BaseAddress,
240 IN UINTN NumPages
241 );
242
243#endif // _MEM_ENCRYPT_SEV_LIB_H_
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
BOOLEAN EFIAPI MemEncryptSevEsDebugVirtualizationIsEnabled(VOID)
RETURN_STATUS EFIAPI MemEncryptSevClearPageEncMask(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
UINT64 EFIAPI MemEncryptSevGetEncryptionMask(VOID)
MEM_ENCRYPT_SEV_ADDRESS_RANGE_STATE EFIAPI MemEncryptSevGetAddressRangeState(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN Length)
BOOLEAN EFIAPI MemEncryptSevSnpIsEnabled(VOID)
BOOLEAN EFIAPI MemEncryptSevIsEnabled(VOID)
VOID EFIAPI MemEncryptSevSnpPreValidateSystemRam(IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
RETURN_STATUS EFIAPI MemEncryptSevLocateInitialSmramSaveStateMapPages(OUT UINTN *BaseAddress, OUT UINTN *NumberOfPages)
RETURN_STATUS EFIAPI MemEncryptSevClearMmioPageEncMask(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
RETURN_STATUS EFIAPI MemEncryptSevSetPageEncMask(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
BOOLEAN EFIAPI MemEncryptSevEsIsEnabled(VOID)