]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Include/Library/MemEncryptTdxLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / Include / Library / MemEncryptTdxLib.h
1 /** @file
2
3 Define Memory Encrypted Virtualization base library helper function
4
5 Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
6 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
7
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #ifndef MEM_ENCRYPT_TDX_LIB_H_
13 #define MEM_ENCRYPT_TDX_LIB_H_
14
15 #include <Base.h>
16
17 /**
18 Returns boolean to indicate whether to indicate which, if any, memory encryption is enabled
19
20 @param[in] Type Bitmask of encryption technologies to check is enabled
21
22 @retval TRUE The encryption type(s) are enabled
23 @retval FALSE The encryption type(s) are not enabled
24 **/
25 BOOLEAN
26 EFIAPI
27 MemEncryptTdxIsEnabled (
28 VOID
29 );
30
31 /**
32 This function clears memory encryption bit for the memory region specified by
33 BaseAddress and NumPages from the current page table context.
34
35 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
36 current CR3)
37 @param[in] BaseAddress The physical address that is the start
38 address of a memory region.
39 @param[in] NumPages The number of pages from start memory
40 region.
41
42 @retval RETURN_SUCCESS The attributes were cleared for the
43 memory region.
44 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
45 @retval RETURN_UNSUPPORTED Clearing the memory encryption attribute
46 is not supported
47 **/
48 RETURN_STATUS
49 EFIAPI
50 MemEncryptTdxSetPageSharedBit (
51 IN PHYSICAL_ADDRESS Cr3BaseAddress,
52 IN PHYSICAL_ADDRESS BaseAddress,
53 IN UINTN NumPages
54 );
55
56 /**
57 This function sets memory encryption bit for the memory region specified by
58 BaseAddress and NumPages from the current page table context.
59
60 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
61 current CR3)
62 @param[in] BaseAddress The physical address that is the start
63 address of a memory region.
64 @param[in] NumPages The number of pages from start memory
65 region.
66
67 @retval RETURN_SUCCESS The attributes were set for the memory
68 region.
69 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
70 @retval RETURN_UNSUPPORTED Setting the memory encryption attribute
71 is not supported
72 **/
73 RETURN_STATUS
74 EFIAPI
75 MemEncryptTdxClearPageSharedBit (
76 IN PHYSICAL_ADDRESS Cr3BaseAddress,
77 IN PHYSICAL_ADDRESS BaseAddress,
78 IN UINTN NumPages
79 );
80
81 #endif // _MEM_ENCRYPT_TDX_LIB_H_