mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 23:24:03 +02:00
EmulatorPkg/Mpservice: Add StateLock where missing
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@15730 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
0dd40e1460
commit
a31a3b4a3e
@ -437,17 +437,17 @@ CpuMpServicesStartupAllAps (
|
|||||||
// state 1 by 1, until the previous 1 finished its task
|
// state 1 by 1, until the previous 1 finished its task
|
||||||
// if not "SingleThread", all APs are put to ready state from the beginning
|
// if not "SingleThread", all APs are put to ready state from the beginning
|
||||||
//
|
//
|
||||||
if (ProcessorData->State == CPU_STATE_IDLE) {
|
|
||||||
gMPSystem.StartCount++;
|
|
||||||
|
|
||||||
gThread->MutexLock(ProcessorData->StateLock);
|
gThread->MutexLock(ProcessorData->StateLock);
|
||||||
|
if (ProcessorData->State == CPU_STATE_IDLE) {
|
||||||
ProcessorData->State = APInitialState;
|
ProcessorData->State = APInitialState;
|
||||||
gThread->MutexUnlock (ProcessorData->StateLock);
|
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||||
|
|
||||||
|
gMPSystem.StartCount++;
|
||||||
if (SingleThread) {
|
if (SingleThread) {
|
||||||
APInitialState = CPU_STATE_BLOCKED;
|
APInitialState = CPU_STATE_BLOCKED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
gThread->MutexUnlock (ProcessorData->StateLock);
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -671,9 +671,12 @@ CpuMpServicesStartupThisAP (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gThread->MutexLock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
|
if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
|
||||||
|
gThread->MutexUnlock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
gThread->MutexUnlock(gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
|
|
||||||
if ((WaitEvent != NULL) && gReadToBoot) {
|
if ((WaitEvent != NULL) && gReadToBoot) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
@ -789,9 +792,12 @@ CpuMpServicesSwitchBSP (
|
|||||||
}
|
}
|
||||||
ASSERT (Index != gMPSystem.NumberOfProcessors);
|
ASSERT (Index != gMPSystem.NumberOfProcessors);
|
||||||
|
|
||||||
|
gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
|
if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
|
||||||
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
return EFI_NOT_READY;
|
return EFI_NOT_READY;
|
||||||
}
|
}
|
||||||
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
|
|
||||||
// Skip for now as we need switch a bunch of stack stuff around and it's complex
|
// Skip for now as we need switch a bunch of stack stuff around and it's complex
|
||||||
// May not be worth it?
|
// May not be worth it?
|
||||||
@ -861,9 +867,12 @@ CpuMpServicesEnableDisableAP (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
|
if (gMPSystem.ProcessorData[ProcessorNumber].State != CPU_STATE_IDLE) {
|
||||||
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
|
|
||||||
if (EnableAP) {
|
if (EnableAP) {
|
||||||
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0 ) {
|
if ((gMPSystem.ProcessorData[ProcessorNumber].Info.StatusFlag & PROCESSOR_ENABLED_BIT) == 0 ) {
|
||||||
@ -1019,7 +1028,9 @@ CpuCheckAllAPsStatus (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gThread->MutexLock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
gMPSystem.ProcessorData[ProcessorNumber].State = CPU_STATE_IDLE;
|
gMPSystem.ProcessorData[ProcessorNumber].State = CPU_STATE_IDLE;
|
||||||
|
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
|
||||||
gMPSystem.FinishCount++;
|
gMPSystem.FinishCount++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user