/** @file Initialize Intel TDX support. Copyright (c) 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Platform.h" /** This Function checks if TDX is available, if present then it sets the dynamic PCDs for Tdx guest. **/ VOID IntelTdxInitialize ( IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob ) { #ifdef MDE_CPU_X64 RETURN_STATUS PcdStatus; UINT64 PageMask; if (!TdIsEnabled ()) { return; } TdxHelperBuildGuidHobForTdxMeasurement (); PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrIntelTdx); ASSERT_RETURN_ERROR (PcdStatus); PlatformInfoHob->PcdConfidentialComputingGuestAttr = CCAttrIntelTdx; PageMask = TdSharedPageMask (); PcdStatus = PcdSet64S (PcdTdxSharedBitMask, PageMask); ASSERT_RETURN_ERROR (PcdStatus); PlatformInfoHob->PcdTdxSharedBitMask = PageMask; PcdStatus = PcdSetBoolS (PcdSetNxForStack, TRUE); ASSERT_RETURN_ERROR (PcdStatus); #endif }