diff options
author | Chen Fan <chen.fan.fnst@cn.fujitsu.com> | 2014-11-13 18:28:10 +0000 |
---|---|---|
committer | jljusten <jljusten@Edk2> | 2014-11-13 18:28:10 +0000 |
commit | 9908a829d0c1c92ca9bf462c0d9210f63784c131 (patch) | |
tree | 37e5945a4158dcc79a2b109b3e8dc4b6854e79f5 /UefiCpuPkg | |
parent | b7c05ba5173f4ae8ccfc901755aa79dcc97ebde2 (diff) | |
download | edk2-platforms-9908a829d0c1c92ca9bf462c0d9210f63784c131.tar.xz |
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
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r-- | UefiCpuPkg/CpuDxe/CpuMp.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/UefiCpuPkg/CpuDxe/CpuMp.c b/UefiCpuPkg/CpuDxe/CpuMp.c index 878cdf25db..1b449a7a8d 100644 --- a/UefiCpuPkg/CpuDxe/CpuMp.c +++ b/UefiCpuPkg/CpuDxe/CpuMp.c @@ -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 ();
}
|