]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Include/Library/MemEncryptSevLib.h
OvmfPkg/MemEncryptSevLib: rewrap to 79 characters width
[mirror_edk2.git] / OvmfPkg / Include / Library / MemEncryptSevLib.h
CommitLineData
a1f22614
BS
1/** @file\r
2\r
3 Define Secure Encrypted Virtualization (SEV) base library helper function\r
4\r
5 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
6\r
7 This program and the accompanying materials are licensed and made available\r
8 under the terms and conditions of the BSD License which accompanies this\r
9 distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef _MEM_ENCRYPT_SEV_LIB_H_\r
18#define _MEM_ENCRYPT_SEV_LIB_H_\r
19\r
20#include <Base.h>\r
21\r
22/**\r
23 Returns a boolean to indicate whether SEV is enabled\r
24\r
25 @retval TRUE SEV is active\r
26 @retval FALSE SEV is not enabled\r
27 **/\r
28BOOLEAN\r
29EFIAPI\r
30MemEncryptSevIsEnabled (\r
31 VOID\r
32 );\r
33\r
34/**\r
35 This function clears memory encryption bit for the memory region specified\r
36 by BaseAddress and Number of pages from the current page table context.\r
37\r
4bd6bf31
LE
38 @param[in] BaseAddress The physical address that is the start\r
39 address of a memory region.\r
40 @param[in] NumberOfPages The number of pages from start memory\r
41 region.\r
a1f22614
BS
42 @param[in] Flush Flush the caches before clearing the bit\r
43 (mostly TRUE except MMIO addresses)\r
44\r
4bd6bf31
LE
45 @retval RETURN_SUCCESS The attributes were cleared for the memory\r
46 region.\r
a1f22614
BS
47 @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r
48 @retval RETURN_UNSUPPORTED Clearing memory encryption attribute is not\r
49 supported\r
50 **/\r
51RETURN_STATUS\r
52EFIAPI\r
53MemEncryptSevClearPageEncMask (\r
54 IN PHYSICAL_ADDRESS Cr3BaseAddress,\r
55 IN PHYSICAL_ADDRESS BaseAddress,\r
56 IN UINTN NumberOfPages,\r
57 IN BOOLEAN CacheFlush\r
58 );\r
59\r
60/**\r
61 This function sets memory encryption bit for the memory region specified by\r
62 BaseAddress and Number of pages from the current page table context.\r
63\r
4bd6bf31
LE
64 @param[in] BaseAddress The physical address that is the start\r
65 address of a memory region.\r
66 @param[in] NumberOfPages The number of pages from start memory\r
67 region.\r
a1f22614
BS
68 @param[in] Flush Flush the caches before clearing the bit\r
69 (mostly TRUE except MMIO addresses)\r
70\r
4bd6bf31
LE
71 @retval RETURN_SUCCESS The attributes were set for the memory\r
72 region.\r
a1f22614
BS
73 @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r
74 @retval RETURN_UNSUPPORTED Clearing memory encryption attribute is not\r
75 supported\r
76 **/\r
77RETURN_STATUS\r
78EFIAPI\r
79MemEncryptSevSetPageEncMask (\r
80 IN PHYSICAL_ADDRESS Cr3BaseAddress,\r
81 IN PHYSICAL_ADDRESS BaseAddress,\r
82 IN UINTN NumberOfPages,\r
83 IN BOOLEAN CacheFlush\r
84 );\r
85#endif // _MEM_ENCRYPT_SEV_LIB_H_\r