]>
Commit | Line | Data |
---|---|---|
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 | |
d4dd22c7 | 25 | @retval TRUE SEV is enabled\r |
a1f22614 | 26 | @retval FALSE SEV is not enabled\r |
d4dd22c7 | 27 | **/\r |
a1f22614 BS |
28 | BOOLEAN\r |
29 | EFIAPI\r | |
30 | MemEncryptSevIsEnabled (\r | |
31 | VOID\r | |
32 | );\r | |
33 | \r | |
34 | /**\r | |
5b5028e6 LE |
35 | This function clears memory encryption bit for the memory region specified by\r |
36 | BaseAddress and NumPages from the current page table context.\r | |
37 | \r | |
38 | @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use\r | |
39 | current CR3)\r | |
40 | @param[in] BaseAddress The physical address that is the start\r | |
41 | address of a memory region.\r | |
42 | @param[in] NumPages The number of pages from start memory\r | |
43 | region.\r | |
44 | @param[in] Flush Flush the caches before clearing the bit\r | |
45 | (mostly TRUE except MMIO addresses)\r | |
46 | \r | |
47 | @retval RETURN_SUCCESS The attributes were cleared for the\r | |
48 | memory region.\r | |
49 | @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r | |
50 | @retval RETURN_UNSUPPORTED Clearing the memory encryption attribute\r | |
51 | is not supported\r | |
52 | **/\r | |
a1f22614 BS |
53 | RETURN_STATUS\r |
54 | EFIAPI\r | |
55 | MemEncryptSevClearPageEncMask (\r | |
56 | IN PHYSICAL_ADDRESS Cr3BaseAddress,\r | |
57 | IN PHYSICAL_ADDRESS BaseAddress,\r | |
5b5028e6 LE |
58 | IN UINTN NumPages,\r |
59 | IN BOOLEAN Flush\r | |
a1f22614 BS |
60 | );\r |
61 | \r | |
62 | /**\r | |
63 | This function sets memory encryption bit for the memory region specified by\r | |
154dcd6c | 64 | BaseAddress and NumPages from the current page table context.\r |
a1f22614 | 65 | \r |
154dcd6c LE |
66 | @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use\r |
67 | current CR3)\r | |
68 | @param[in] BaseAddress The physical address that is the start\r | |
69 | address of a memory region.\r | |
70 | @param[in] NumPages The number of pages from start memory\r | |
71 | region.\r | |
72 | @param[in] Flush Flush the caches before setting the bit\r | |
73 | (mostly TRUE except MMIO addresses)\r | |
a1f22614 | 74 | \r |
154dcd6c LE |
75 | @retval RETURN_SUCCESS The attributes were set for the memory\r |
76 | region.\r | |
77 | @retval RETURN_INVALID_PARAMETER Number of pages is zero.\r | |
78 | @retval RETURN_UNSUPPORTED Setting the memory encryption attribute\r | |
79 | is not supported\r | |
80 | **/\r | |
a1f22614 BS |
81 | RETURN_STATUS\r |
82 | EFIAPI\r | |
83 | MemEncryptSevSetPageEncMask (\r | |
84 | IN PHYSICAL_ADDRESS Cr3BaseAddress,\r | |
85 | IN PHYSICAL_ADDRESS BaseAddress,\r | |
154dcd6c LE |
86 | IN UINTN NumPages,\r |
87 | IN BOOLEAN Flush\r | |
a1f22614 | 88 | );\r |
61a044c6 LE |
89 | \r |
90 | \r | |
91 | /**\r | |
92 | Locate the page range that covers the initial (pre-SMBASE-relocation) SMRAM\r | |
93 | Save State Map.\r | |
94 | \r | |
95 | @param[out] BaseAddress The base address of the lowest-address page that\r | |
96 | covers the initial SMRAM Save State Map.\r | |
97 | \r | |
98 | @param[out] NumberOfPages The number of pages in the page range that covers\r | |
99 | the initial SMRAM Save State Map.\r | |
100 | \r | |
101 | @retval RETURN_SUCCESS BaseAddress and NumberOfPages have been set on\r | |
102 | output.\r | |
103 | \r | |
104 | @retval RETURN_UNSUPPORTED SMM is unavailable.\r | |
105 | **/\r | |
106 | RETURN_STATUS\r | |
107 | EFIAPI\r | |
108 | MemEncryptSevLocateInitialSmramSaveStateMapPages (\r | |
109 | OUT UINTN *BaseAddress,\r | |
110 | OUT UINTN *NumberOfPages\r | |
111 | );\r | |
a1f22614 | 112 | #endif // _MEM_ENCRYPT_SEV_LIB_H_\r |