mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/CpuDxe: Ap do loop routine to execute procedure
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16361 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
b7c05ba517
commit
9908a829d0
|
@ -1108,10 +1108,41 @@ ProcessorToIdleState (
|
|||
IN VOID *Context2 OPTIONAL
|
||||
)
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "Ap apicid is %d\n", GetApicId ()));
|
||||
UINTN ProcessorNumber;
|
||||
CPU_DATA_BLOCK *CpuData;
|
||||
EFI_AP_PROCEDURE Procedure;
|
||||
VOID *ProcedureArgument;
|
||||
|
||||
WhoAmI (&mMpServicesTemplate, &ProcessorNumber);
|
||||
CpuData = &mMpSystemData.CpuDatas[ProcessorNumber];
|
||||
|
||||
AsmApDoneWithCommonStack ();
|
||||
|
||||
while (TRUE) {
|
||||
while (!AcquireSpinLockOrFail (&CpuData->CpuDataLock)) {
|
||||
CpuPause ();
|
||||
}
|
||||
|
||||
ProcedureArgument = CpuData->Parameter;
|
||||
Procedure = CpuData->Procedure;
|
||||
ReleaseSpinLock (&CpuData->CpuDataLock);
|
||||
|
||||
if (Procedure != NULL) {
|
||||
Procedure (ProcedureArgument);
|
||||
|
||||
while (!AcquireSpinLockOrFail (&CpuData->CpuDataLock)) {
|
||||
CpuPause ();
|
||||
}
|
||||
|
||||
CpuData->Procedure = NULL;
|
||||
ReleaseSpinLock (&CpuData->CpuDataLock);
|
||||
|
||||
SetApState (CpuData, CpuStateFinished);
|
||||
}
|
||||
|
||||
CpuPause ();
|
||||
}
|
||||
|
||||
CpuSleep ();
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue