]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/BaseMemEncryptSevLib/Ia32/MemEncryptSevLib.c
OvmfPkg/MemEncryptSevLib: clean up MemEncryptSevIsEnabled() decl
[mirror_edk2.git] / OvmfPkg / Library / BaseMemEncryptSevLib / Ia32 / MemEncryptSevLib.c
CommitLineData
a1f22614
BS
1/** @file\r
2\r
3 Secure Encrypted Virtualization (SEV) library helper function\r
4\r
5 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
6\r
4bd6bf31
LE
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
a1f22614
BS
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#include <Library/BaseLib.h>\r
18#include <Library/DebugLib.h>\r
19#include <Register/Cpuid.h>\r
20#include <Register/Amd/Cpuid.h>\r
21#include <Register/Amd/Msr.h>\r
22#include <Library/MemEncryptSevLib.h>\r
23\r
24/**\r
25 This function clears memory encryption bit for the memory region specified\r
26 by BaseAddress and Number of pages from the current page table context.\r
27\r
4bd6bf31
LE
28 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use current\r
29 CR3)\r
30 @param[in] BaseAddress The physical address that is the start\r
31 address of a memory region.\r
32 @param[in] NumberOfPages The number of pages from start memory\r
33 region.\r
a1f22614
BS
34 @param[in] Flush Flush the caches before clearing the bit\r
35 (mostly TRUE except MMIO addresses)\r
36\r
4bd6bf31
LE
37 @retval RETURN_SUCCESS The attributes were cleared for the memory\r
38 region.\r
a1f22614
BS
39 @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r
40 @retval RETURN_UNSUPPORTED Clearing memory encryption attribute is not\r
41 supported\r
42 **/\r
43RETURN_STATUS\r
44EFIAPI\r
45MemEncryptSevClearPageEncMask (\r
46 IN PHYSICAL_ADDRESS Cr3BaseAddress,\r
47 IN PHYSICAL_ADDRESS BaseAddress,\r
48 IN UINTN NumberOfPages,\r
49 IN BOOLEAN Flush\r
50 )\r
51{\r
52 //\r
53 // Memory encryption bit is not accessible in 32-bit mode\r
54 //\r
55 return RETURN_UNSUPPORTED;\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
4bd6bf31
LE
62 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use current\r
63 CR3)\r
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 Flush\r
84 )\r
85{\r
86 //\r
87 // Memory encryption bit is not accessible in 32-bit mode\r
88 //\r
89 return RETURN_UNSUPPORTED;\r
90}\r