From 2a15750b79377a2e81deb6c5fb32abf9138a8839 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Mon, 24 Jun 2024 16:43:50 +0800 Subject: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Update gSmst to gMmst This patch update the gSmst to gMmst for SMM and MM common usage. No function impact. Signed-off-by: Jiaxin Wu Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Star Zeng Cc: Dun Tan Cc: Hongbin1 Zhang Cc: Wei6 Xu Cc: Yuanhao Xie --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 14 +++++++------- UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c | 8 ++++---- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 18 +++++++++--------- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 2 +- .../PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 8 ++++---- UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 4 ++-- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c index caad70ac84..4c6f31c16a 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c @@ -41,13 +41,13 @@ RestoreSmmConfigurationInS3 ( // if (mRestoreSmmConfigurationInS3) { // - // Need make sure gSmst is correct because below function may use them. + // Need make sure gMmst is correct because below function may use them. // - gSmst->SmmStartupThisAp = gSmmCpuPrivate->SmmCoreEntryContext.SmmStartupThisAp; - gSmst->CurrentlyExecutingCpu = gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu; - gSmst->NumberOfCpus = gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus; - gSmst->CpuSaveStateSize = gSmmCpuPrivate->SmmCoreEntryContext.CpuSaveStateSize; - gSmst->CpuSaveState = gSmmCpuPrivate->SmmCoreEntryContext.CpuSaveState; + gMmst->MmStartupThisAp = gSmmCpuPrivate->SmmCoreEntryContext.SmmStartupThisAp; + gMmst->CurrentlyExecutingCpu = gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu; + gMmst->NumberOfCpus = gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus; + gMmst->CpuSaveStateSize = gSmmCpuPrivate->SmmCoreEntryContext.CpuSaveStateSize; + gMmst->CpuSaveState = gSmmCpuPrivate->SmmCoreEntryContext.CpuSaveState; // // Configure SMM Code Access Check feature if available. @@ -220,7 +220,7 @@ InitSmmS3ResumeState ( ZeroMem (SmmS3ResumeState, sizeof (SMM_S3_RESUME_STATE)); mSmmS3ResumeState = SmmS3ResumeState; - SmmS3ResumeState->Smst = (EFI_PHYSICAL_ADDRESS)(UINTN)gSmst; + SmmS3ResumeState->Smst = (EFI_PHYSICAL_ADDRESS)(UINTN)gMmst; SmmS3ResumeState->SmmS3ResumeEntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)SmmRestoreCpu; diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c index c0485b0519..3d1ea99400 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c @@ -1,7 +1,7 @@ /** @file Implementation of SMM CPU Services Protocol. -Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -98,7 +98,7 @@ SmmSwitchBsp ( } if ((gSmmCpuPrivate->Operation[ProcessorNumber] != SmmCpuNone) || - (gSmst->CurrentlyExecutingCpu == ProcessorNumber)) + (gMmst->CurrentlyExecutingCpu == ProcessorNumber)) { return EFI_UNSUPPORTED; } @@ -376,7 +376,7 @@ InitializeSmmCpuServices ( { EFI_STATUS Status; - Status = gSmst->SmmInstallProtocolInterface ( + Status = gMmst->MmInstallProtocolInterface ( &Handle, &gEfiSmmCpuServiceProtocolGuid, EFI_NATIVE_INTERFACE, @@ -387,7 +387,7 @@ InitializeSmmCpuServices ( return Status; } - Status = gSmst->SmmInstallProtocolInterface ( + Status = gMmst->MmInstallProtocolInterface ( &Handle, &gEdkiiSmmCpuRendezvousProtocolGuid, EFI_NATIVE_INTERFACE, diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c index e7149ff7fd..71ff40b9ff 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -232,7 +232,7 @@ SmmReadSaveState ( // // Retrieve pointer to the specified CPU's SMM Save State buffer // - if ((CpuIndex >= gSmst->NumberOfCpus) || (Buffer == NULL)) { + if ((CpuIndex >= gMmst->NumberOfCpus) || (Buffer == NULL)) { return EFI_INVALID_PARAMETER; } @@ -304,7 +304,7 @@ SmmWriteSaveState ( // // Retrieve pointer to the specified CPU's SMM Save State buffer // - if ((CpuIndex >= gSmst->NumberOfCpus) || (Buffer == NULL)) { + if ((CpuIndex >= gMmst->NumberOfCpus) || (Buffer == NULL)) { return EFI_INVALID_PARAMETER; } @@ -1289,7 +1289,7 @@ PiCpuSmmEntry ( // // Install the SMM CPU Protocol into SMM protocol database // - Status = gSmst->SmmInstallProtocolInterface ( + Status = gMmst->MmInstallProtocolInterface ( &mSmmCpuHandle, &gEfiSmmCpuProtocolGuid, EFI_NATIVE_INTERFACE, @@ -1300,7 +1300,7 @@ PiCpuSmmEntry ( // // Install the SMM Memory Attribute Protocol into SMM protocol database // - Status = gSmst->SmmInstallProtocolInterface ( + Status = gMmst->MmInstallProtocolInterface ( &mSmmCpuHandle, &gEdkiiSmmMemoryAttributeProtocolGuid, EFI_NATIVE_INTERFACE, @@ -1321,7 +1321,7 @@ PiCpuSmmEntry ( // // Install the SMM Mp Protocol into SMM protocol database // - Status = gSmst->SmmInstallProtocolInterface ( + Status = gMmst->MmInstallProtocolInterface ( &mSmmCpuHandle, &gEfiMmMpProtocolGuid, EFI_NATIVE_INTERFACE, @@ -1346,7 +1346,7 @@ PiCpuSmmEntry ( // // register SMM Ready To Lock Protocol notification // - Status = gSmst->SmmRegisterProtocolNotify ( + Status = gMmst->MmRegisterProtocolNotify ( &gEfiSmmReadyToLockProtocolGuid, SmmReadyToLockEventNotify, &Registration @@ -1591,7 +1591,7 @@ ConfigSmmCodeAccessCheck ( // // Enable SMM Code Access Check feature for the APs. // - for (Index = 0; Index < gSmst->NumberOfCpus; Index++) { + for (Index = 0; Index < gMmst->NumberOfCpus; Index++) { if (Index != gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu) { if (gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId == INVALID_APIC_ID) { // @@ -1609,7 +1609,7 @@ ConfigSmmCodeAccessCheck ( // // Call SmmStartupThisAp() to enable SMM Code Access Check on an AP. // - Status = gSmst->SmmStartupThisAp (ConfigSmmCodeAccessCheckOnCurrentProcessor, Index, &Index); + Status = gMmst->MmStartupThisAp (ConfigSmmCodeAccessCheckOnCurrentProcessor, Index, &Index); ASSERT_EFI_ERROR (Status); // @@ -1648,7 +1648,7 @@ AllocateCodePages ( return NULL; } - Status = gSmst->SmmAllocatePages (AllocateAnyPages, EfiRuntimeServicesCode, Pages, &Memory); + Status = gMmst->MmAllocatePages (AllocateAnyPages, EfiRuntimeServicesCode, Pages, &Memory); if (EFI_ERROR (Status)) { return NULL; } diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h index abbdd79f05..9d4775afda 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h @@ -37,7 +37,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include +#include #include #include #include diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf index 2412f4caeb..886a616a0c 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf @@ -80,7 +80,7 @@ MtrrLib IoLib TimerLib - SmmServicesTableLib + MmServicesTableLib MemoryAllocationLib DebugAgentLib HobLib diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index 6e0c251397..a66dd4ac46 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -1,6 +1,6 @@ /** @file -Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -774,9 +774,9 @@ SmmGetSystemConfigurationTable ( ASSERT (Table != NULL); *Table = NULL; - for (Index = 0; Index < gSmst->NumberOfTableEntries; Index++) { - if (CompareGuid (TableGuid, &(gSmst->SmmConfigurationTable[Index].VendorGuid))) { - *Table = gSmst->SmmConfigurationTable[Index].VendorTable; + for (Index = 0; Index < gMmst->NumberOfTableEntries; Index++) { + if (CompareGuid (TableGuid, &(gMmst->MmConfigurationTable[Index].VendorGuid))) { + *Table = gMmst->MmConfigurationTable[Index].VendorTable; return EFI_SUCCESS; } } diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c index 115d477fd0..bdfe05f851 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c @@ -892,7 +892,7 @@ InitSmmProfileInternal ( // // Start SMM profile when SmmReadyToLock protocol is installed. // - Status = gSmst->SmmRegisterProtocolNotify ( + Status = gMmst->MmRegisterProtocolNotify ( &gEfiSmmReadyToLockProtocolGuid, InitSmmProfileCallBack, &Registration @@ -1374,7 +1374,7 @@ SmmProfilePFHandler ( // Indicate it is not software SMI // SmiCommand = 0xFFFFFFFFFFFFFFFFULL; - for (Index = 0; Index < gSmst->NumberOfCpus; Index++) { + for (Index = 0; Index < gMmst->NumberOfCpus; Index++) { Status = SmmReadSaveState (&mSmmCpu, sizeof (IoInfo), EFI_SMM_SAVE_STATE_REGISTER_IO, Index, &IoInfo); if (EFI_ERROR (Status)) { continue;