mirror of https://github.com/acidanthera/audk.git
EmulatorPkg/MpService: StartupAllAPs should verify processor state before setting state
if any enabled APs are not in idle state, StartupAllAPs() should return immediately, and must not change the other idled processor state. so we checked the state before changed them. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16416 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
ca186b1d4f
commit
c156d27b39
|
@ -420,6 +420,24 @@ CpuMpServicesStartupAllAps (
|
|||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
for (Number = 0; Number < gMPSystem.NumberOfProcessors; Number++) {
|
||||
ProcessorData = &gMPSystem.ProcessorData[Number];
|
||||
if ((ProcessorData->Info.StatusFlag & PROCESSOR_AS_BSP_BIT) == PROCESSOR_AS_BSP_BIT) {
|
||||
// Skip BSP
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ProcessorData->Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0) {
|
||||
// Skip Disabled processors
|
||||
continue;
|
||||
}
|
||||
gThread->MutexLock(ProcessorData->StateLock);
|
||||
if (ProcessorData->State != CPU_STATE_IDLE) {
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
return EFI_NOT_READY;
|
||||
}
|
||||
gThread->MutexUnlock(ProcessorData->StateLock);
|
||||
}
|
||||
|
||||
if (FailedCpuList != NULL) {
|
||||
gMPSystem.FailedList = AllocatePool ((gMPSystem.NumberOfProcessors + 1) * sizeof (UINTN));
|
||||
|
@ -461,17 +479,13 @@ CpuMpServicesStartupAllAps (
|
|||
// if not "SingleThread", all APs are put to ready state from the beginning
|
||||
//
|
||||
gThread->MutexLock(ProcessorData->StateLock);
|
||||
if (ProcessorData->State == CPU_STATE_IDLE) {
|
||||
ProcessorData->State = APInitialState;
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
ASSERT (ProcessorData->State == CPU_STATE_IDLE);
|
||||
ProcessorData->State = APInitialState;
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
|
||||
gMPSystem.StartCount++;
|
||||
if (SingleThread) {
|
||||
APInitialState = CPU_STATE_BLOCKED;
|
||||
}
|
||||
} else {
|
||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||
return EFI_NOT_READY;
|
||||
gMPSystem.StartCount++;
|
||||
if (SingleThread) {
|
||||
APInitialState = CPU_STATE_BLOCKED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue