3 Define Secure Encrypted Virtualization (SEV) base library helper function
5 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef _MEM_ENCRYPT_SEV_LIB_H_
12 #define _MEM_ENCRYPT_SEV_LIB_H_
17 Returns a boolean to indicate whether SEV-ES is enabled.
19 @retval TRUE SEV-ES is enabled
20 @retval FALSE SEV-ES is not enabled
24 MemEncryptSevEsIsEnabled (
29 Returns a boolean to indicate whether SEV is enabled
31 @retval TRUE SEV is enabled
32 @retval FALSE SEV is not enabled
36 MemEncryptSevIsEnabled (
41 This function clears memory encryption bit for the memory region specified by
42 BaseAddress and NumPages from the current page table context.
44 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
46 @param[in] BaseAddress The physical address that is the start
47 address of a memory region.
48 @param[in] NumPages The number of pages from start memory
50 @param[in] Flush Flush the caches before clearing the bit
51 (mostly TRUE except MMIO addresses)
53 @retval RETURN_SUCCESS The attributes were cleared for the
55 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
56 @retval RETURN_UNSUPPORTED Clearing the memory encryption attribute
61 MemEncryptSevClearPageEncMask (
62 IN PHYSICAL_ADDRESS Cr3BaseAddress
,
63 IN PHYSICAL_ADDRESS BaseAddress
,
69 This function sets memory encryption bit for the memory region specified by
70 BaseAddress and NumPages from the current page table context.
72 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
74 @param[in] BaseAddress The physical address that is the start
75 address of a memory region.
76 @param[in] NumPages The number of pages from start memory
78 @param[in] Flush Flush the caches before setting the bit
79 (mostly TRUE except MMIO addresses)
81 @retval RETURN_SUCCESS The attributes were set for the memory
83 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
84 @retval RETURN_UNSUPPORTED Setting the memory encryption attribute
89 MemEncryptSevSetPageEncMask (
90 IN PHYSICAL_ADDRESS Cr3BaseAddress
,
91 IN PHYSICAL_ADDRESS BaseAddress
,
98 Locate the page range that covers the initial (pre-SMBASE-relocation) SMRAM
101 @param[out] BaseAddress The base address of the lowest-address page that
102 covers the initial SMRAM Save State Map.
104 @param[out] NumberOfPages The number of pages in the page range that covers
105 the initial SMRAM Save State Map.
107 @retval RETURN_SUCCESS BaseAddress and NumberOfPages have been set on
110 @retval RETURN_UNSUPPORTED SMM is unavailable.
114 MemEncryptSevLocateInitialSmramSaveStateMapPages (
115 OUT UINTN
*BaseAddress
,
116 OUT UINTN
*NumberOfPages
118 #endif // _MEM_ENCRYPT_SEV_LIB_H_