3 Define Secure Encrypted Virtualization (SEV) base library helper function
5 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available
8 under the terms and conditions of the BSD License which accompanies this
9 distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef _MEM_ENCRYPT_SEV_LIB_H_
18 #define _MEM_ENCRYPT_SEV_LIB_H_
23 Returns a boolean to indicate whether SEV is enabled
25 @retval TRUE SEV is enabled
26 @retval FALSE SEV is not enabled
30 MemEncryptSevIsEnabled (
35 This function clears memory encryption bit for the memory region specified by
36 BaseAddress and NumPages from the current page table context.
38 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
40 @param[in] BaseAddress The physical address that is the start
41 address of a memory region.
42 @param[in] NumPages The number of pages from start memory
44 @param[in] Flush Flush the caches before clearing the bit
45 (mostly TRUE except MMIO addresses)
47 @retval RETURN_SUCCESS The attributes were cleared for the
49 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
50 @retval RETURN_UNSUPPORTED Clearing the memory encryption attribute
55 MemEncryptSevClearPageEncMask (
56 IN PHYSICAL_ADDRESS Cr3BaseAddress
,
57 IN PHYSICAL_ADDRESS BaseAddress
,
63 This function sets memory encryption bit for the memory region specified by
64 BaseAddress and NumPages from the current page table context.
66 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
68 @param[in] BaseAddress The physical address that is the start
69 address of a memory region.
70 @param[in] NumPages The number of pages from start memory
72 @param[in] Flush Flush the caches before setting the bit
73 (mostly TRUE except MMIO addresses)
75 @retval RETURN_SUCCESS The attributes were set for the memory
77 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
78 @retval RETURN_UNSUPPORTED Setting the memory encryption attribute
83 MemEncryptSevSetPageEncMask (
84 IN PHYSICAL_ADDRESS Cr3BaseAddress
,
85 IN PHYSICAL_ADDRESS BaseAddress
,
92 Locate the page range that covers the initial (pre-SMBASE-relocation) SMRAM
95 @param[out] BaseAddress The base address of the lowest-address page that
96 covers the initial SMRAM Save State Map.
98 @param[out] NumberOfPages The number of pages in the page range that covers
99 the initial SMRAM Save State Map.
101 @retval RETURN_SUCCESS BaseAddress and NumberOfPages have been set on
104 @retval RETURN_UNSUPPORTED SMM is unavailable.
108 MemEncryptSevLocateInitialSmramSaveStateMapPages (
109 OUT UINTN
*BaseAddress
,
110 OUT UINTN
*NumberOfPages
112 #endif // _MEM_ENCRYPT_SEV_LIB_H_