]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/BaseMemEncryptSevLib/Ia32/MemEncryptSevLib.c
OvmfPkg/MemEncryptSevLib: clean up MemEncryptSevSetPageEncMask() 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
5b5028e6
LE
25 This function clears memory encryption bit for the memory region specified by\r
26 BaseAddress and NumPages from the current page table context.\r
a1f22614 27\r
5b5028e6
LE
28 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use\r
29 current CR3)\r
30 @param[in] BaseAddress The physical address that is the start\r
31 address of a memory region.\r
32 @param[in] NumPages The number of pages from start memory\r
33 region.\r
34 @param[in] Flush Flush the caches before clearing the bit\r
35 (mostly TRUE except MMIO addresses)\r
a1f22614 36\r
5b5028e6
LE
37 @retval RETURN_SUCCESS The attributes were cleared for the\r
38 memory region.\r
39 @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r
40 @retval RETURN_UNSUPPORTED Clearing the memory encryption attribute\r
41 is not supported\r
42**/\r
a1f22614
BS
43RETURN_STATUS\r
44EFIAPI\r
45MemEncryptSevClearPageEncMask (\r
46 IN PHYSICAL_ADDRESS Cr3BaseAddress,\r
47 IN PHYSICAL_ADDRESS BaseAddress,\r
5b5028e6 48 IN UINTN NumPages,\r
a1f22614
BS
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
154dcd6c 60 BaseAddress and NumPages from the current page table context.\r
a1f22614 61\r
154dcd6c
LE
62 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use\r
63 current CR3)\r
64 @param[in] BaseAddress The physical address that is the start\r
65 address of a memory region.\r
66 @param[in] NumPages The number of pages from start memory\r
67 region.\r
68 @param[in] Flush Flush the caches before setting the bit\r
69 (mostly TRUE except MMIO addresses)\r
a1f22614 70\r
154dcd6c
LE
71 @retval RETURN_SUCCESS The attributes were set for the memory\r
72 region.\r
73 @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r
74 @retval RETURN_UNSUPPORTED Setting the memory encryption attribute\r
75 is not supported\r
76**/\r
a1f22614
BS
77RETURN_STATUS\r
78EFIAPI\r
79MemEncryptSevSetPageEncMask (\r
80 IN PHYSICAL_ADDRESS Cr3BaseAddress,\r
81 IN PHYSICAL_ADDRESS BaseAddress,\r
154dcd6c 82 IN UINTN NumPages,\r
a1f22614
BS
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