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 is enabled
19 @retval TRUE SEV is enabled
20 @retval FALSE SEV is not enabled
24 MemEncryptSevIsEnabled (
29 This function clears memory encryption bit for the memory region specified by
30 BaseAddress and NumPages from the current page table context.
32 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
34 @param[in] BaseAddress The physical address that is the start
35 address of a memory region.
36 @param[in] NumPages The number of pages from start memory
38 @param[in] Flush Flush the caches before clearing the bit
39 (mostly TRUE except MMIO addresses)
41 @retval RETURN_SUCCESS The attributes were cleared for the
43 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
44 @retval RETURN_UNSUPPORTED Clearing the memory encryption attribute
49 MemEncryptSevClearPageEncMask (
50 IN PHYSICAL_ADDRESS Cr3BaseAddress
,
51 IN PHYSICAL_ADDRESS BaseAddress
,
57 This function sets memory encryption bit for the memory region specified by
58 BaseAddress and NumPages from the current page table context.
60 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
62 @param[in] BaseAddress The physical address that is the start
63 address of a memory region.
64 @param[in] NumPages The number of pages from start memory
66 @param[in] Flush Flush the caches before setting the bit
67 (mostly TRUE except MMIO addresses)
69 @retval RETURN_SUCCESS The attributes were set for the memory
71 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
72 @retval RETURN_UNSUPPORTED Setting the memory encryption attribute
77 MemEncryptSevSetPageEncMask (
78 IN PHYSICAL_ADDRESS Cr3BaseAddress
,
79 IN PHYSICAL_ADDRESS BaseAddress
,
86 Locate the page range that covers the initial (pre-SMBASE-relocation) SMRAM
89 @param[out] BaseAddress The base address of the lowest-address page that
90 covers the initial SMRAM Save State Map.
92 @param[out] NumberOfPages The number of pages in the page range that covers
93 the initial SMRAM Save State Map.
95 @retval RETURN_SUCCESS BaseAddress and NumberOfPages have been set on
98 @retval RETURN_UNSUPPORTED SMM is unavailable.
102 MemEncryptSevLocateInitialSmramSaveStateMapPages (
103 OUT UINTN
*BaseAddress
,
104 OUT UINTN
*NumberOfPages
106 #endif // _MEM_ENCRYPT_SEV_LIB_H_