{\r
UINTN Index;\r
\r
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {\r
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {\r
if (IsPresentAp (Index)) {\r
ReleaseSemaphore (mSmmMpSyncData->CpuData[Index].Run);\r
}\r
\r
CpuData = mSmmMpSyncData->CpuData;\r
ProcessorInfo = gSmmCpuPrivate->ProcessorInfo;\r
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {\r
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {\r
if (!(*(CpuData[Index].Present)) && ProcessorInfo[Index].ProcessorId != INVALID_APIC_ID) {\r
if (((Exceptions & ARRIVAL_EXCEPTION_DELAYED) != 0) && SmmCpuFeaturesGetSmmRegister (Index, SmmRegSmmDelayed) != 0) {\r
continue;\r
//\r
// Send SMI IPIs to bring outside processors in\r
//\r
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {\r
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {\r
if (!(*(mSmmMpSyncData->CpuData[Index].Present)) && gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId != INVALID_APIC_ID) {\r
SendSmiIpi ((UINT32)gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId);\r
}\r
{\r
UINTN Index;\r
\r
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {\r
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {\r
//\r
// Ignore BSP and APs which not call in SMM.\r
//\r
//\r
while (TRUE) {\r
PresentCount = 0;\r
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {\r
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {\r
if (*(mSmmMpSyncData->CpuData[Index].Present)) {\r
PresentCount ++;\r
}\r
}\r
\r
CpuCount = 0;\r
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {\r
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {\r
if (IsPresentAp (Index)) {\r
CpuCount ++;\r
\r
// Here code always use AcquireSpinLock instead of AcquireSpinLockOrFail for not\r
// block mode.\r
//\r
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {\r
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {\r
if (IsPresentAp (Index)) {\r
AcquireSpinLock (mSmmMpSyncData->CpuData[Index].Busy);\r
}\r
}\r
\r
- for (Index = 0; Index < mMaxNumberOfCpus; Index++) {\r
+ for (Index = mMaxNumberOfCpus; Index-- > 0;) {\r
if (IsPresentAp (Index)) {\r
mSmmMpSyncData->CpuData[Index].Procedure = (EFI_AP_PROCEDURE2) Procedure;\r
mSmmMpSyncData->CpuData[Index].Parameter = ProcedureArguments;\r