UefiCpuPkg/PiSmmCpuDxeSmm: Define mIsStandaloneMm to indicate SMM or MM

Define the mIsStandaloneMm to indicate it's the MM_STANDALONE MM CPU
driver or DXE_SMM_DRIVER SMM CPU driver execution.

With mIsStandaloneMm, GetMpInformationFromMpServices() can be skipped
for the MM CPU since it can not call the
GetMpInformationFromMpServices() due to the NON-SMM MP Services usage
for the MP Information.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
This commit is contained in:
Jiaxin Wu 2024-06-26 13:28:56 +08:00 committed by mergify[bot]
parent 5f88a44637
commit 9ee5334796
4 changed files with 41 additions and 3 deletions

View File

@ -625,9 +625,14 @@ GetMpInformation (
HobCount = 0;
FirstMpInfo2Hob = GetFirstGuidHob (&gMpInformation2HobGuid);
if (FirstMpInfo2Hob == NULL) {
DEBUG ((DEBUG_INFO, "%a: [INFO] gMpInformation2HobGuid HOB not found.\n", __func__));
return GetMpInformationFromMpServices (NumberOfCpus, MaxNumberOfCpus);
if (mIsStandaloneMm) {
ASSERT (FirstMpInfo2Hob != NULL);
} else {
if (FirstMpInfo2Hob == NULL) {
DEBUG ((DEBUG_INFO, "%a: [INFO] gMpInformation2HobGuid HOB not found.\n", __func__));
return GetMpInformationFromMpServices (NumberOfCpus, MaxNumberOfCpus);
}
}
GuidHob = FirstMpInfo2Hob;

View File

@ -253,6 +253,8 @@ typedef struct {
LIST_ENTRY *FirstFreeToken;
} SMM_CPU_PRIVATE_DATA;
extern const BOOLEAN mIsStandaloneMm;
extern SMM_CPU_PRIVATE_DATA *gSmmCpuPrivate;
extern CPU_HOT_PLUG_DATA mCpuHotPlugData;
extern UINTN mMaxNumberOfCpus;

View File

@ -12,6 +12,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "PiSmmCpuCommon.h"
#include <Library/UefiBootServicesTableLib.h>
//
// TRUE to indicate it's the MM_STANDALONE MM CPU driver.
// FALSE to indicate it's the DXE_SMM_DRIVER SMM CPU driver.
//
const BOOLEAN mIsStandaloneMm = FALSE;
/**
To get system port address of the SMI Command Port in FADT table.

View File

@ -9,6 +9,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "PiSmmCpuCommon.h"
//
// TRUE to indicate it's the MM_STANDALONE MM CPU driver.
// FALSE to indicate it's the DXE_SMM_DRIVER SMM CPU driver.
//
const BOOLEAN mIsStandaloneMm = TRUE;
/**
To get system port address of the SMI Command Port.
@ -94,3 +100,22 @@ GetAcpiS3EnableFlag (
mAcpiS3Enable = MmAcpiS3EnableHob->AcpiS3Enable;
}
}
/**
Extract NumberOfCpus, MaxNumberOfCpus and EFI_PROCESSOR_INFORMATION.
@param[out] NumberOfCpus Pointer to NumberOfCpus.
@param[out] MaxNumberOfCpus Pointer to MaxNumberOfCpus.
@retval ProcessorInfo Pointer to EFI_PROCESSOR_INFORMATION buffer.
**/
EFI_PROCESSOR_INFORMATION *
GetMpInformationFromMpServices (
OUT UINTN *NumberOfCpus,
OUT UINTN *MaxNumberOfCpus
)
{
ASSERT (FALSE);
return NULL;
}