3 Virtual Memory Management Services to set or clear the memory encryption bit
5 Copyright (c) 2020, AMD Incorporated. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Library/CpuLib.h>
12 #include <Library/MemEncryptSevLib.h>
14 #include "VirtualMemory.h"
17 This function clears memory encryption bit for the memory region specified by
18 PhysicalAddress and Length from the current page table context.
20 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
22 @param[in] PhysicalAddress The physical address that is the start
23 address of a memory region.
24 @param[in] Length The length of memory region
25 @param[in] Flush Flush the caches before applying the
28 @retval RETURN_SUCCESS The attributes were cleared for the
30 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
31 @retval RETURN_UNSUPPORTED Clearing the memory encyrption attribute
36 InternalMemEncryptSevSetMemoryDecrypted (
37 IN PHYSICAL_ADDRESS Cr3BaseAddress
,
38 IN PHYSICAL_ADDRESS PhysicalAddress
,
44 // This function is not available during SEC.
46 return RETURN_UNSUPPORTED
;
50 This function sets memory encryption bit for the memory region specified by
51 PhysicalAddress and Length from the current page table context.
53 @param[in] Cr3BaseAddress Cr3 Base Address (if zero then use
55 @param[in] PhysicalAddress The physical address that is the start
56 address of a memory region.
57 @param[in] Length The length of memory region
58 @param[in] Flush Flush the caches before applying the
61 @retval RETURN_SUCCESS The attributes were set for the memory
63 @retval RETURN_INVALID_PARAMETER Number of pages is zero.
64 @retval RETURN_UNSUPPORTED Setting the memory encyrption attribute
69 InternalMemEncryptSevSetMemoryEncrypted (
70 IN PHYSICAL_ADDRESS Cr3BaseAddress
,
71 IN PHYSICAL_ADDRESS PhysicalAddress
,
77 // This function is not available during SEC.
79 return RETURN_UNSUPPORTED
;