]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/PlatformPei/IntelTdx.c
OvmfPkg/PlatformPei: remove mFeatureControlValue
[mirror_edk2.git] / OvmfPkg / PlatformPei / IntelTdx.c
1 /** @file
2 Initialize Intel TDX support.
3
4 Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include <PiPei.h>
11 #include <Library/BaseLib.h>
12 #include <Library/DebugLib.h>
13 #include <Library/HobLib.h>
14 #include <Library/BaseMemoryLib.h>
15 #include <Library/MemoryAllocationLib.h>
16 #include <IndustryStandard/Tdx.h>
17 #include <IndustryStandard/QemuFwCfg.h>
18 #include <Library/QemuFwCfgLib.h>
19 #include <Library/PeiServicesLib.h>
20 #include <Library/TdxLib.h>
21 #include <Library/PlatformInitLib.h>
22 #include <WorkArea.h>
23 #include <ConfidentialComputingGuestAttr.h>
24 #include "Platform.h"
25
26 /**
27 This Function checks if TDX is available, if present then it sets
28 the dynamic PCDs for Tdx guest.
29 **/
30 VOID
31 IntelTdxInitialize (
32 VOID
33 )
34 {
35 #ifdef MDE_CPU_X64
36 RETURN_STATUS PcdStatus;
37
38 if (!TdIsEnabled ()) {
39 return;
40 }
41
42 PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrIntelTdx);
43 ASSERT_RETURN_ERROR (PcdStatus);
44
45 PcdStatus = PcdSet64S (PcdTdxSharedBitMask, TdSharedPageMask ());
46 ASSERT_RETURN_ERROR (PcdStatus);
47
48 PcdStatus = PcdSetBoolS (PcdSetNxForStack, TRUE);
49 ASSERT_RETURN_ERROR (PcdStatus);
50 #endif
51 }