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 <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-24 16:43:50 +08:00 committed by mergify[bot]
parent cfaccc89a2
commit 2a15750b79
7 changed files with 28 additions and 28 deletions

View File

@ -41,13 +41,13 @@ RestoreSmmConfigurationInS3 (
// //
if (mRestoreSmmConfigurationInS3) { 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; gMmst->MmStartupThisAp = gSmmCpuPrivate->SmmCoreEntryContext.SmmStartupThisAp;
gSmst->CurrentlyExecutingCpu = gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu; gMmst->CurrentlyExecutingCpu = gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu;
gSmst->NumberOfCpus = gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus; gMmst->NumberOfCpus = gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus;
gSmst->CpuSaveStateSize = gSmmCpuPrivate->SmmCoreEntryContext.CpuSaveStateSize; gMmst->CpuSaveStateSize = gSmmCpuPrivate->SmmCoreEntryContext.CpuSaveStateSize;
gSmst->CpuSaveState = gSmmCpuPrivate->SmmCoreEntryContext.CpuSaveState; gMmst->CpuSaveState = gSmmCpuPrivate->SmmCoreEntryContext.CpuSaveState;
// //
// Configure SMM Code Access Check feature if available. // Configure SMM Code Access Check feature if available.
@ -220,7 +220,7 @@ InitSmmS3ResumeState (
ZeroMem (SmmS3ResumeState, sizeof (SMM_S3_RESUME_STATE)); ZeroMem (SmmS3ResumeState, sizeof (SMM_S3_RESUME_STATE));
mSmmS3ResumeState = SmmS3ResumeState; mSmmS3ResumeState = SmmS3ResumeState;
SmmS3ResumeState->Smst = (EFI_PHYSICAL_ADDRESS)(UINTN)gSmst; SmmS3ResumeState->Smst = (EFI_PHYSICAL_ADDRESS)(UINTN)gMmst;
SmmS3ResumeState->SmmS3ResumeEntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)SmmRestoreCpu; SmmS3ResumeState->SmmS3ResumeEntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)SmmRestoreCpu;

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementation of SMM CPU Services Protocol. Implementation of SMM CPU Services Protocol.
Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.<BR> Copyright (c) 2011 - 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -98,7 +98,7 @@ SmmSwitchBsp (
} }
if ((gSmmCpuPrivate->Operation[ProcessorNumber] != SmmCpuNone) || if ((gSmmCpuPrivate->Operation[ProcessorNumber] != SmmCpuNone) ||
(gSmst->CurrentlyExecutingCpu == ProcessorNumber)) (gMmst->CurrentlyExecutingCpu == ProcessorNumber))
{ {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -376,7 +376,7 @@ InitializeSmmCpuServices (
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = gSmst->SmmInstallProtocolInterface ( Status = gMmst->MmInstallProtocolInterface (
&Handle, &Handle,
&gEfiSmmCpuServiceProtocolGuid, &gEfiSmmCpuServiceProtocolGuid,
EFI_NATIVE_INTERFACE, EFI_NATIVE_INTERFACE,
@ -387,7 +387,7 @@ InitializeSmmCpuServices (
return Status; return Status;
} }
Status = gSmst->SmmInstallProtocolInterface ( Status = gMmst->MmInstallProtocolInterface (
&Handle, &Handle,
&gEdkiiSmmCpuRendezvousProtocolGuid, &gEdkiiSmmCpuRendezvousProtocolGuid,
EFI_NATIVE_INTERFACE, EFI_NATIVE_INTERFACE,

View File

@ -232,7 +232,7 @@ SmmReadSaveState (
// //
// Retrieve pointer to the specified CPU's SMM Save State buffer // 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; return EFI_INVALID_PARAMETER;
} }
@ -304,7 +304,7 @@ SmmWriteSaveState (
// //
// Retrieve pointer to the specified CPU's SMM Save State buffer // 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; return EFI_INVALID_PARAMETER;
} }
@ -1289,7 +1289,7 @@ PiCpuSmmEntry (
// //
// Install the SMM CPU Protocol into SMM protocol database // Install the SMM CPU Protocol into SMM protocol database
// //
Status = gSmst->SmmInstallProtocolInterface ( Status = gMmst->MmInstallProtocolInterface (
&mSmmCpuHandle, &mSmmCpuHandle,
&gEfiSmmCpuProtocolGuid, &gEfiSmmCpuProtocolGuid,
EFI_NATIVE_INTERFACE, EFI_NATIVE_INTERFACE,
@ -1300,7 +1300,7 @@ PiCpuSmmEntry (
// //
// Install the SMM Memory Attribute Protocol into SMM protocol database // Install the SMM Memory Attribute Protocol into SMM protocol database
// //
Status = gSmst->SmmInstallProtocolInterface ( Status = gMmst->MmInstallProtocolInterface (
&mSmmCpuHandle, &mSmmCpuHandle,
&gEdkiiSmmMemoryAttributeProtocolGuid, &gEdkiiSmmMemoryAttributeProtocolGuid,
EFI_NATIVE_INTERFACE, EFI_NATIVE_INTERFACE,
@ -1321,7 +1321,7 @@ PiCpuSmmEntry (
// //
// Install the SMM Mp Protocol into SMM protocol database // Install the SMM Mp Protocol into SMM protocol database
// //
Status = gSmst->SmmInstallProtocolInterface ( Status = gMmst->MmInstallProtocolInterface (
&mSmmCpuHandle, &mSmmCpuHandle,
&gEfiMmMpProtocolGuid, &gEfiMmMpProtocolGuid,
EFI_NATIVE_INTERFACE, EFI_NATIVE_INTERFACE,
@ -1346,7 +1346,7 @@ PiCpuSmmEntry (
// //
// register SMM Ready To Lock Protocol notification // register SMM Ready To Lock Protocol notification
// //
Status = gSmst->SmmRegisterProtocolNotify ( Status = gMmst->MmRegisterProtocolNotify (
&gEfiSmmReadyToLockProtocolGuid, &gEfiSmmReadyToLockProtocolGuid,
SmmReadyToLockEventNotify, SmmReadyToLockEventNotify,
&Registration &Registration
@ -1591,7 +1591,7 @@ ConfigSmmCodeAccessCheck (
// //
// Enable SMM Code Access Check feature for the APs. // 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 (Index != gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu) {
if (gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId == INVALID_APIC_ID) { if (gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId == INVALID_APIC_ID) {
// //
@ -1609,7 +1609,7 @@ ConfigSmmCodeAccessCheck (
// //
// Call SmmStartupThisAp() to enable SMM Code Access Check on an AP. // 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); ASSERT_EFI_ERROR (Status);
// //
@ -1648,7 +1648,7 @@ AllocateCodePages (
return NULL; return NULL;
} }
Status = gSmst->SmmAllocatePages (AllocateAnyPages, EfiRuntimeServicesCode, Pages, &Memory); Status = gMmst->MmAllocatePages (AllocateAnyPages, EfiRuntimeServicesCode, Pages, &Memory);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return NULL; return NULL;
} }

View File

@ -37,7 +37,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <Library/MtrrLib.h> #include <Library/MtrrLib.h>
#include <Library/SmmCpuPlatformHookLib.h> #include <Library/SmmCpuPlatformHookLib.h>
#include <Library/SmmServicesTableLib.h> #include <Library/MmServicesTableLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h> #include <Library/UefiRuntimeServicesTableLib.h>

View File

@ -80,7 +80,7 @@
MtrrLib MtrrLib
IoLib IoLib
TimerLib TimerLib
SmmServicesTableLib MmServicesTableLib
MemoryAllocationLib MemoryAllocationLib
DebugAgentLib DebugAgentLib
HobLib HobLib

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2016 - 2023, Intel Corporation. All rights reserved.<BR> Copyright (c) 2016 - 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -774,9 +774,9 @@ SmmGetSystemConfigurationTable (
ASSERT (Table != NULL); ASSERT (Table != NULL);
*Table = NULL; *Table = NULL;
for (Index = 0; Index < gSmst->NumberOfTableEntries; Index++) { for (Index = 0; Index < gMmst->NumberOfTableEntries; Index++) {
if (CompareGuid (TableGuid, &(gSmst->SmmConfigurationTable[Index].VendorGuid))) { if (CompareGuid (TableGuid, &(gMmst->MmConfigurationTable[Index].VendorGuid))) {
*Table = gSmst->SmmConfigurationTable[Index].VendorTable; *Table = gMmst->MmConfigurationTable[Index].VendorTable;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }

View File

@ -892,7 +892,7 @@ InitSmmProfileInternal (
// //
// Start SMM profile when SmmReadyToLock protocol is installed. // Start SMM profile when SmmReadyToLock protocol is installed.
// //
Status = gSmst->SmmRegisterProtocolNotify ( Status = gMmst->MmRegisterProtocolNotify (
&gEfiSmmReadyToLockProtocolGuid, &gEfiSmmReadyToLockProtocolGuid,
InitSmmProfileCallBack, InitSmmProfileCallBack,
&Registration &Registration
@ -1374,7 +1374,7 @@ SmmProfilePFHandler (
// Indicate it is not software SMI // Indicate it is not software SMI
// //
SmiCommand = 0xFFFFFFFFFFFFFFFFULL; 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); Status = SmmReadSaveState (&mSmmCpu, sizeof (IoInfo), EFI_SMM_SAVE_STATE_REGISTER_IO, Index, &IoInfo);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
continue; continue;