UefiCpuPkg/PiSmmCpuDxeSmm: Avoid BspIndex typecasting

Use MAX_UINT32 directly instead of typecasting from signed
to unsigned value.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Jiaxin Wu 2024-02-06 15:49:00 +08:00 committed by mergify[bot]
parent edc6681206
commit d698bcfe4f
1 changed files with 6 additions and 6 deletions

View File

@ -696,10 +696,10 @@ BSPHandler (
ResetTokens (); ResetTokens ();
// //
// Reset BspIndex to -1, meaning BSP has not been elected. // Reset BspIndex to MAX_UINT32, meaning BSP has not been elected.
// //
if (FeaturePcdGet (PcdCpuSmmEnableBspElection)) { if (FeaturePcdGet (PcdCpuSmmEnableBspElection)) {
mSmmMpSyncData->BspIndex = (UINT32)-1; mSmmMpSyncData->BspIndex = MAX_UINT32;
} }
// //
@ -747,7 +747,7 @@ APHandler (
// //
// BSP timeout in the first round // BSP timeout in the first round
// //
if (mSmmMpSyncData->BspIndex != -1) { if (mSmmMpSyncData->BspIndex != MAX_UINT32) {
// //
// BSP Index is known // BSP Index is known
// Existing AP is in SMI now but BSP not in, so, try bring BSP in SMM. // Existing AP is in SMI now but BSP not in, so, try bring BSP in SMM.
@ -1656,7 +1656,7 @@ SmiRendezvous (
// //
InterlockedCompareExchange32 ( InterlockedCompareExchange32 (
(UINT32 *)&mSmmMpSyncData->BspIndex, (UINT32 *)&mSmmMpSyncData->BspIndex,
(UINT32)-1, MAX_UINT32,
(UINT32)CpuIndex (UINT32)CpuIndex
); );
} }
@ -1854,9 +1854,9 @@ InitializeMpSyncData (
mSmmMpSyncData->CandidateBsp = (BOOLEAN *)(mSmmMpSyncData->CpuData + gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus); mSmmMpSyncData->CandidateBsp = (BOOLEAN *)(mSmmMpSyncData->CpuData + gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus);
if (FeaturePcdGet (PcdCpuSmmEnableBspElection)) { if (FeaturePcdGet (PcdCpuSmmEnableBspElection)) {
// //
// Enable BSP election by setting BspIndex to -1 // Enable BSP election by setting BspIndex to MAX_UINT32
// //
mSmmMpSyncData->BspIndex = (UINT32)-1; mSmmMpSyncData->BspIndex = MAX_UINT32;
} else { } else {
// //
// Use NonSMM BSP as SMM BSP // Use NonSMM BSP as SMM BSP