UefiCpuPkg/SmmRelocationLib: Remove unnecessary CpuIndex

This patch is to remove unnecessary CpuIndex.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Jiaxin Wu
2024-04-23 14:00:44 +08:00
committed by mergify[bot]
parent 9783dc01cc
commit c56ea95b28
5 changed files with 3 additions and 23 deletions

View File

@@ -17,14 +17,12 @@ volatile BOOLEAN *mRebasedFlag;
can be executed immediately after AP exits SMM to indicate to can be executed immediately after AP exits SMM to indicate to
the BSP that an AP has exited SMM after SMBASE relocation. the BSP that an AP has exited SMM after SMBASE relocation.
@param[in] CpuIndex The processor index.
@param[in] RebasedFlag A pointer to a flag that is set to TRUE @param[in] RebasedFlag A pointer to a flag that is set to TRUE
immediately after AP exits SMM. immediately after AP exits SMM.
**/ **/
VOID VOID
SemaphoreHook ( SemaphoreHook (
IN UINTN CpuIndex,
IN volatile BOOLEAN *RebasedFlag IN volatile BOOLEAN *RebasedFlag
) )
{ {
@@ -34,7 +32,6 @@ SemaphoreHook (
CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET); CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);
mSmmRelocationOriginalAddress = (UINTN)HookReturnFromSmm ( mSmmRelocationOriginalAddress = (UINTN)HookReturnFromSmm (
CpuIndex,
CpuState, CpuState,
(UINT64)(UINTN)&SmmRelocationSemaphoreComplete, (UINT64)(UINTN)&SmmRelocationSemaphoreComplete,
(UINT64)(UINTN)&SmmRelocationSemaphoreComplete (UINT64)(UINTN)&SmmRelocationSemaphoreComplete

View File

@@ -83,8 +83,6 @@ SmmRelocationSemaphoreComplete (
detected, and the appropriate hook must be selected. Always clear the auto detected, and the appropriate hook must be selected. Always clear the auto
HALT restart flag if it is set. HALT restart flag if it is set.
@param[in] CpuIndex The processor index for the currently
executing CPU.
@param[in,out] CpuState Pointer to SMRAM Save State Map for the @param[in,out] CpuState Pointer to SMRAM Save State Map for the
currently executing CPU. currently executing CPU.
@param[in] NewInstructionPointer32 Instruction pointer to use if resuming to @param[in] NewInstructionPointer32 Instruction pointer to use if resuming to
@@ -98,7 +96,6 @@ SmmRelocationSemaphoreComplete (
UINT64 UINT64
EFIAPI EFIAPI
HookReturnFromSmm ( HookReturnFromSmm (
IN UINTN CpuIndex,
IN OUT SMRAM_SAVE_STATE_MAP *CpuState, IN OUT SMRAM_SAVE_STATE_MAP *CpuState,
IN UINT64 NewInstructionPointer32, IN UINT64 NewInstructionPointer32,
IN UINT64 NewInstructionPointer IN UINT64 NewInstructionPointer
@@ -109,14 +106,12 @@ HookReturnFromSmm (
can be executed immediately after AP exits SMM to indicate to can be executed immediately after AP exits SMM to indicate to
the BSP that an AP has exited SMM after SMBASE relocation. the BSP that an AP has exited SMM after SMBASE relocation.
@param[in] CpuIndex The processor index.
@param[in] RebasedFlag A pointer to a flag that is set to TRUE @param[in] RebasedFlag A pointer to a flag that is set to TRUE
immediately after AP exits SMM. immediately after AP exits SMM.
**/ **/
VOID VOID
SemaphoreHook ( SemaphoreHook (
IN UINTN CpuIndex,
IN volatile BOOLEAN *RebasedFlag IN volatile BOOLEAN *RebasedFlag
); );

View File

@@ -31,11 +31,6 @@ UINT64 mSmBase;
// //
volatile BOOLEAN mRebased; volatile BOOLEAN mRebased;
//
// CpuIndex for current CPU
//
UINTN mCpuIndex;
/** /**
This function will get the SmBase for CpuIndex. This function will get the SmBase for CpuIndex.
@@ -155,7 +150,7 @@ SmmInitHandler (
// SMM re-based flag can't be set before RSM, because SMM save state context might be override // SMM re-based flag can't be set before RSM, because SMM save state context might be override
// by next AP flow before it take effect. // by next AP flow before it take effect.
// //
SemaphoreHook (mCpuIndex, &mRebased); SemaphoreHook (&mRebased);
} }
/** /**
@@ -229,7 +224,6 @@ SmmRelocateBases (
if (BspApicId != (UINT32)ProcessorInfo.ProcessorId) { if (BspApicId != (UINT32)ProcessorInfo.ProcessorId) {
mRebased = FALSE; mRebased = FALSE;
mSmBase = GetSmBase (Index, SmmRelocationStart, TileSize); mSmBase = GetSmBase (Index, SmmRelocationStart, TileSize);
mCpuIndex = Index;
SendSmiIpi ((UINT32)ProcessorInfo.ProcessorId); SendSmiIpi ((UINT32)ProcessorInfo.ProcessorId);
// //
// Wait for this AP to finish its 1st SMI // Wait for this AP to finish its 1st SMI

View File

@@ -84,8 +84,6 @@ ConfigureSmBase (
detected, and the appropriate hook must be selected. Always clear the auto detected, and the appropriate hook must be selected. Always clear the auto
HALT restart flag if it is set. HALT restart flag if it is set.
@param[in] CpuIndex The processor index for the currently
executing CPU.
@param[in,out] CpuState Pointer to SMRAM Save State Map for the @param[in,out] CpuState Pointer to SMRAM Save State Map for the
currently executing CPU. currently executing CPU.
@param[in] NewInstructionPointer32 Instruction pointer to use if resuming to @param[in] NewInstructionPointer32 Instruction pointer to use if resuming to
@@ -99,7 +97,6 @@ ConfigureSmBase (
UINT64 UINT64
EFIAPI EFIAPI
HookReturnFromSmm ( HookReturnFromSmm (
IN UINTN CpuIndex,
IN OUT SMRAM_SAVE_STATE_MAP *CpuState, IN OUT SMRAM_SAVE_STATE_MAP *CpuState,
IN UINT64 NewInstructionPointer32, IN UINT64 NewInstructionPointer32,
IN UINT64 NewInstructionPointer IN UINT64 NewInstructionPointer

View File

@@ -28,14 +28,12 @@ SmmRelocationSemaphoreComplete32 (
can be executed immediately after AP exits SMM to indicate to can be executed immediately after AP exits SMM to indicate to
the BSP that an AP has exited SMM after SMBASE relocation. the BSP that an AP has exited SMM after SMBASE relocation.
@param[in] CpuIndex The processor index.
@param[in] RebasedFlag A pointer to a flag that is set to TRUE @param[in] RebasedFlag A pointer to a flag that is set to TRUE
immediately after AP exits SMM. immediately after AP exits SMM.
**/ **/
VOID VOID
SemaphoreHook ( SemaphoreHook (
IN UINTN CpuIndex,
IN volatile BOOLEAN *RebasedFlag IN volatile BOOLEAN *RebasedFlag
) )
{ {
@@ -51,7 +49,6 @@ SemaphoreHook (
CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET); CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET);
mSmmRelocationOriginalAddress = HookReturnFromSmm ( mSmmRelocationOriginalAddress = HookReturnFromSmm (
CpuIndex,
CpuState, CpuState,
(UINT64)(UINTN)&SmmRelocationSemaphoreComplete32, (UINT64)(UINTN)&SmmRelocationSemaphoreComplete32,
(UINT64)(UINTN)&SmmRelocationSemaphoreComplete (UINT64)(UINTN)&SmmRelocationSemaphoreComplete