2 Initialize Secure Encrypted Virtualization (SEV) support
4 Copyright (c) 2017 - 2020, Advanced Micro Devices. All rights reserved.<BR>
5 Copyright (c) 2019, Citrix Systems, Inc.
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 // The package level header files this module uses
13 #include <Library/DebugLib.h>
14 #include <Library/MemEncryptSevLib.h>
15 #include <Library/PcdLib.h>
22 Function checks if SEV support is available, if present then it sets
23 the dynamic PcdPteMemoryEncryptionAddressOrMask with memory encryption mask.
31 UINT64 EncryptionMask
;
32 RETURN_STATUS PcdStatus
;
35 // Check if SEV is enabled
37 if (!MemEncryptSevIsEnabled ()) {
42 // Set Memory Encryption Mask PCD
44 EncryptionMask
= MemEncryptSevGetEncryptionMask ();
45 PcdStatus
= PcdSet64S (PcdPteMemoryEncryptionAddressOrMask
, EncryptionMask
);
46 ASSERT_RETURN_ERROR (PcdStatus
);
48 DEBUG ((DEBUG_INFO
, "SEV is enabled (mask 0x%lx)\n", EncryptionMask
));
51 // Set Pcd to Deny the execution of option ROM when security
54 PcdStatus
= PcdSet32S (PcdOptionRomImageVerificationPolicy
, 0x4);
55 ASSERT_RETURN_ERROR (PcdStatus
);