[Sources.IA32]\r
Ia32/AmdSev.c\r
Ia32/MpFuncs.nasm\r
- MpLibTdxNull.c\r
\r
[Sources.X64]\r
X64/AmdSev.c\r
X64/MpFuncs.nasm\r
- MpLibTdx.c\r
\r
[Sources.common]\r
AmdSev.c\r
MpLib.c\r
MpLib.h\r
Microcode.c\r
- MpIntelTdx.h\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r
+++ /dev/null
-/** @file\r
- CPU MP Initialize Library header file for Td guest.\r
-\r
- Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#ifndef MP_INTEL_TDX_H_\r
-#define MP_INTEL_TDX_H_\r
-\r
-#include <PiPei.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Uefi/UefiBaseType.h>\r
-#include <Protocol/MpService.h>\r
-\r
-/**\r
- Gets detailed MP-related information on the requested processor at the\r
- instant this call is made. This service may only be called from the BSP.\r
-\r
- @param[in] ProcessorNumber The handle number of processor.\r
- @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
- the requested processor is deposited.\r
- @param[out] HealthData Return processor health data.\r
-\r
- @retval EFI_SUCCESS Processor information was returned.\r
- @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
- @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
- @retval EFI_NOT_FOUND The processor with the handle specified by\r
- ProcessorNumber does not exist in the platform.\r
- @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetProcessorInfo (\r
- IN UINTN ProcessorNumber,\r
- OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer,\r
- OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL\r
- );\r
-\r
-/**\r
- Retrieves the number of logical processor in the platform and the number of\r
- those logical processors that are enabled on this boot. This service may only\r
- be called from the BSP.\r
-\r
- @param[out] NumberOfProcessors Pointer to the total number of logical\r
- processors in the system, including the BSP\r
- and disabled APs.\r
- @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical\r
- processors that exist in system, including\r
- the BSP.\r
-\r
- @retval EFI_SUCCESS The number of logical processors and enabled\r
- logical processors was retrieved.\r
- @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
- @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL and NumberOfEnabledProcessors\r
- is NULL.\r
- @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetNumberOfProcessors (\r
- OUT UINTN *NumberOfProcessors, OPTIONAL\r
- OUT UINTN *NumberOfEnabledProcessors OPTIONAL\r
- );\r
-\r
-#endif\r
**/\r
\r
#include "MpLib.h"\r
-#include "MpIntelTdx.h"\r
#include <Library/VmgExitLib.h>\r
#include <Register/Amd/Fam17Msr.h>\r
#include <Register/Amd/Ghcb.h>\r
-#include <ConfidentialComputingGuestAttr.h>\r
\r
EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;\r
\r
UINTN BackupBufferAddr;\r
UINTN ApIdtBase;\r
\r
- if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
OldCpuMpData = GetCpuMpDataFromGuidedHob ();\r
if (OldCpuMpData == NULL) {\r
MaxLogicalProcessorNumber = PcdGet32 (PcdCpuMaxLogicalProcessorNumber);\r
CPU_INFO_IN_HOB *CpuInfoInHob;\r
UINTN OriginalProcessorNumber;\r
\r
- if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
- return TdxMpInitLibGetProcessorInfo (ProcessorNumber, ProcessorInfoBuffer, HealthData);\r
- }\r
-\r
CpuMpData = GetCpuMpData ();\r
CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;\r
\r
BOOLEAN OldInterruptState;\r
BOOLEAN OldTimerInterruptState;\r
\r
- if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
//\r
// Save and Disable Local APIC timer interrupt\r
//\r
CPU_MP_DATA *CpuMpData;\r
UINTN CallerNumber;\r
\r
- if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
CpuMpData = GetCpuMpData ();\r
\r
//\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
- *ProcessorNumber = 0;\r
- return EFI_SUCCESS;\r
- }\r
-\r
CpuMpData = GetCpuMpData ();\r
\r
return GetProcessorNumber (CpuMpData, ProcessorNumber);\r
UINTN EnabledProcessorNumber;\r
UINTN Index;\r
\r
+ CpuMpData = GetCpuMpData ();\r
+\r
if ((NumberOfProcessors == NULL) && (NumberOfEnabledProcessors == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
- return TdxMpInitLibGetNumberOfProcessors (NumberOfProcessors, NumberOfEnabledProcessors);\r
- }\r
-\r
- CpuMpData = GetCpuMpData ();\r
-\r
//\r
// Check whether caller processor is BSP\r
//\r
BOOLEAN HasEnabledAp;\r
CPU_STATE ApState;\r
\r
+ CpuMpData = GetCpuMpData ();\r
+\r
if (FailedCpuList != NULL) {\r
*FailedCpuList = NULL;\r
}\r
\r
- Status = MpInitLibGetNumberOfProcessors (&ProcessorCount, NULL);\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- if ((ProcessorCount == 1) && ExcludeBsp) {\r
+ if ((CpuMpData->CpuCount == 1) && ExcludeBsp) {\r
return EFI_NOT_STARTED;\r
}\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
- //\r
- // For Td guest ExcludeBsp must be FALSE. Otherwise it will return in above checks.\r
- //\r
- ASSERT (!ExcludeBsp);\r
-\r
- //\r
- // Start BSP.\r
- //\r
- Procedure (ProcedureArgument);\r
-\r
- return EFI_SUCCESS;\r
- }\r
-\r
- CpuMpData = GetCpuMpData ();\r
-\r
//\r
// Check whether caller processor is BSP\r
//\r
CPU_AP_DATA *CpuData;\r
UINTN CallerNumber;\r
\r
- //\r
- // In Td guest, startup of AP is not supported in current stage.\r
- //\r
- if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
CpuMpData = GetCpuMpData ();\r
\r
if (Finished != NULL) {\r
+++ /dev/null
-/** @file\r
- CPU MP Initialize Library common functions for Td guest.\r
-\r
- Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "MpLib.h"\r
-#include "MpIntelTdx.h"\r
-\r
-/**\r
- Gets detailed MP-related information on the requested processor at the\r
- instant this call is made. This service may only be called from the BSP.\r
-\r
- In current stage only the BSP is workable. So ProcessorNumber should be 0.\r
-\r
- @param[in] ProcessorNumber The handle number of processor.\r
- @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
- the requested processor is deposited.\r
- @param[out] HealthData Return processor health data.\r
-\r
- @retval EFI_SUCCESS Processor information was returned.\r
- @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
- @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL or ProcessorNumber is not 0.\r
- @retval EFI_NOT_FOUND The processor with the handle specified by\r
- ProcessorNumber does not exist in the platform.\r
- @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetProcessorInfo (\r
- IN UINTN ProcessorNumber,\r
- OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer,\r
- OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL\r
- )\r
-{\r
- UINTN OriginalProcessorNumber;\r
-\r
- //\r
- // Lower 24 bits contains the actual processor number.\r
- //\r
- OriginalProcessorNumber = ProcessorNumber;\r
- ProcessorNumber &= BIT24 - 1;\r
-\r
- if ((ProcessorInfoBuffer == NULL) || (ProcessorNumber != 0)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- ProcessorInfoBuffer->ProcessorId = 0;\r
- ProcessorInfoBuffer->StatusFlag = PROCESSOR_AS_BSP_BIT | PROCESSOR_ENABLED_BIT;\r
- ZeroMem (&ProcessorInfoBuffer->Location, sizeof (EFI_CPU_PHYSICAL_LOCATION));\r
-\r
- if ((OriginalProcessorNumber & CPU_V2_EXTENDED_TOPOLOGY) != 0) {\r
- ZeroMem (&ProcessorInfoBuffer->ExtendedInformation.Location2, sizeof (EFI_CPU_PHYSICAL_LOCATION2));\r
- }\r
-\r
- if (HealthData != NULL) {\r
- HealthData->Uint32 = 0;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Retrieves the number of logical processor in the platform and the number of\r
- those logical processors that are enabled on this boot. This service may only\r
- be called from the BSP.\r
-\r
- @param[out] NumberOfProcessors Pointer to the total number of logical\r
- processors in the system, including the BSP\r
- and disabled APs.\r
- @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical\r
- processors that exist in system, including\r
- the BSP.\r
-\r
- @retval EFI_SUCCESS The number of logical processors and enabled\r
- logical processors was retrieved.\r
- @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
- @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL and NumberOfEnabledProcessors\r
- is NULL.\r
- @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetNumberOfProcessors (\r
- OUT UINTN *NumberOfProcessors, OPTIONAL\r
- OUT UINTN *NumberOfEnabledProcessors OPTIONAL\r
- )\r
-{\r
- ASSERT (NumberOfProcessors != NULL || NumberOfEnabledProcessors != NULL);\r
- //\r
- // In current stage only the BSP is workable. So NumberOfProcessors\r
- // & NumberOfEnableddProcessors are both 1.\r
- //\r
- if (NumberOfProcessors != NULL) {\r
- *NumberOfProcessors = 1;\r
- }\r
-\r
- if (NumberOfEnabledProcessors != NULL) {\r
- *NumberOfEnabledProcessors = 1;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
+++ /dev/null
-/** @file\r
- CPU MP Initialize Library common functions (NULL instance) for Td guest.\r
-\r
- Copyright (c) 2020 - 2022, Intel Corporation. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "MpLib.h"\r
-#include "MpIntelTdx.h"\r
-\r
-/**\r
- Gets detailed MP-related information on the requested processor at the\r
- instant this call is made. This service may only be called from the BSP.\r
-\r
- @param[in] ProcessorNumber The handle number of processor.\r
- @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
- the requested processor is deposited.\r
- @param[out] HealthData Return processor health data.\r
-\r
- @retval EFI_SUCCESS Processor information was returned.\r
- @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
- @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
- @retval EFI_NOT_FOUND The processor with the handle specified by\r
- ProcessorNumber does not exist in the platform.\r
- @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetProcessorInfo (\r
- IN UINTN ProcessorNumber,\r
- OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer,\r
- OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL\r
- )\r
-{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-/**\r
- Retrieves the number of logical processor in the platform and the number of\r
- those logical processors that are enabled on this boot. This service may only\r
- be called from the BSP.\r
-\r
- @param[out] NumberOfProcessors Pointer to the total number of logical\r
- processors in the system, including the BSP\r
- and disabled APs.\r
- @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical\r
- processors that exist in system, including\r
- the BSP.\r
-\r
- @retval EFI_SUCCESS The number of logical processors and enabled\r
- logical processors was retrieved.\r
- @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
- @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL and NumberOfEnabledProcessors\r
- is NULL.\r
- @retval EFI_NOT_READY MP Initialize Library is not initialized.\r
-\r
-**/\r
-EFI_STATUS\r
-TdxMpInitLibGetNumberOfProcessors (\r
- OUT UINTN *NumberOfProcessors, OPTIONAL\r
- OUT UINTN *NumberOfEnabledProcessors OPTIONAL\r
- )\r
-{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
-}\r
[Sources.IA32]\r
Ia32/AmdSev.c\r
Ia32/MpFuncs.nasm\r
- MpLibTdxNull.c\r
\r
[Sources.X64]\r
X64/AmdSev.c\r
X64/MpFuncs.nasm\r
- MpLibTdx.c\r
\r
[Sources.common]\r
AmdSev.c\r
MpLib.c\r
MpLib.h\r
Microcode.c\r
- MpIntelTdx.h\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r