]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Include/Library/MemEncryptSevLib.h
MdeModulePkg/Terminal: ReadKeyStrokeEx always return key state
[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
38 @param[in] BaseAddress The physical address that is the start address\r
39 of a memory region.\r
40 @param[in] NumberOfPages The number of pages from start memory region.\r
41 @param[in] Flush Flush the caches before clearing the bit\r
42 (mostly TRUE except MMIO addresses)\r
43\r
44 @retval RETURN_SUCCESS The attributes were cleared for the memory region.\r
45 @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r
46 @retval RETURN_UNSUPPORTED Clearing memory encryption attribute is not\r
47 supported\r
48 **/\r
49RETURN_STATUS\r
50EFIAPI\r
51MemEncryptSevClearPageEncMask (\r
52 IN PHYSICAL_ADDRESS Cr3BaseAddress,\r
53 IN PHYSICAL_ADDRESS BaseAddress,\r
54 IN UINTN NumberOfPages,\r
55 IN BOOLEAN CacheFlush\r
56 );\r
57\r
58/**\r
59 This function sets memory encryption bit for the memory region specified by\r
60 BaseAddress and Number of pages from the current page table context.\r
61\r
62 @param[in] BaseAddress The physical address that is the start address\r
63 of a memory region.\r
64 @param[in] NumberOfPages The number of pages from start memory region.\r
65 @param[in] Flush Flush the caches before clearing the bit\r
66 (mostly TRUE except MMIO addresses)\r
67\r
68 @retval RETURN_SUCCESS The attributes were set for the memory region.\r
69 @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r
70 @retval RETURN_UNSUPPORTED Clearing memory encryption attribute is not\r
71 supported\r
72 **/\r
73RETURN_STATUS\r
74EFIAPI\r
75MemEncryptSevSetPageEncMask (\r
76 IN PHYSICAL_ADDRESS Cr3BaseAddress,\r
77 IN PHYSICAL_ADDRESS BaseAddress,\r
78 IN UINTN NumberOfPages,\r
79 IN BOOLEAN CacheFlush\r
80 );\r
81#endif // _MEM_ENCRYPT_SEV_LIB_H_\r