]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuMpPei: Add AsmHltLoop ()
authorJeff Fan <jeff.fan@intel.com>
Wed, 15 Jul 2015 03:45:45 +0000 (03:45 +0000)
committervanjeff <vanjeff@Edk2>
Wed, 15 Jul 2015 03:45:45 +0000 (03:45 +0000)
Add AsmHltLoop () in assembly code, it will not be copied into AP wakeup
buffer and invoked at end of ApCFunction (). To make sure AP work in case
AP wakeup buffer is restored to original data.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18013 6f19259b-4bc3-4df7-8a09-765794883524

UefiCpuPkg/CpuMpPei/CpuMpPei.c
UefiCpuPkg/CpuMpPei/CpuMpPei.h
UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.asm
UefiCpuPkg/CpuMpPei/Ia32/MpFuncs.nasm
UefiCpuPkg/CpuMpPei/X64/MpFuncs.asm
UefiCpuPkg/CpuMpPei/X64/MpFuncs.nasm

index 7b75d354dd51b7767ae92216b77639fb45a3f8bc..40e62e0405b5948c6bd2c05e966d28dfa361b141 100644 (file)
@@ -169,6 +169,7 @@ ApCFunction (
   //
   InterlockedIncrement ((UINT32 *)&PeiCpuMpData->FinishedCount);
 
   //
   InterlockedIncrement ((UINT32 *)&PeiCpuMpData->FinishedCount);
 
+  AsmCliHltLoop ();
 }
 
 /**
 }
 
 /**
index 97d52bf563231527178eb0b9f1e844c0da723fae..c241349a976701a563804c4d2b27852f2ad9da93 100644 (file)
@@ -166,6 +166,15 @@ AsmInitializeGdt (
   IN IA32_DESCRIPTOR  *Gdtr
   );
 
   IN IA32_DESCRIPTOR  *Gdtr
   );
 
+/**
+  Assembly code to do CLI-HALT loop.
+
+**/
+VOID
+EFIAPI
+AsmCliHltLoop (
+  VOID
+  );
 
 /**
   This function will be called by BSP to wakeup AP.
 
 /**
   This function will be called by BSP to wakeup AP.
index 63c80489f4fb0d7fb744be2e679ca96396ef28f9..060f4670e06a9c1eb20b0a5b3da43ff766a76384 100644 (file)
@@ -144,6 +144,12 @@ CProcedureInvoke:
 RendezvousFunnelProc   ENDP
 RendezvousFunnelProcEnd::
 
 RendezvousFunnelProc   ENDP
 RendezvousFunnelProcEnd::
 
+AsmCliHltLoop PROC near C PUBLIC
+    cli
+    hlt
+    jmp        $-2
+AsmCliHltLoop ENDP
+
 ;-------------------------------------------------------------------------------------
 ;  AsmGetAddressMap (&AddressMap);
 ;-------------------------------------------------------------------------------------
 ;-------------------------------------------------------------------------------------
 ;  AsmGetAddressMap (&AddressMap);
 ;-------------------------------------------------------------------------------------
index fe45cf1f9fa0843cb48c47066bd16acdb21abd1c..3a8e91fe74ab32792b75298d02254ba954769fb0 100644 (file)
@@ -132,6 +132,12 @@ CProcedureInvoke:
     jmp        $                 ; never reach here
 RendezvousFunnelProcEnd:
 
     jmp        $                 ; never reach here
 RendezvousFunnelProcEnd:
 
+global ASM_PFX(AsmCliHltLoop)
+ASM_PFX(AsmCliHltLoop):
+    cli
+    hlt
+    jmp        $-2
+
 ;-------------------------------------------------------------------------------------
 ;  AsmGetAddressMap (&AddressMap);
 ;-------------------------------------------------------------------------------------
 ;-------------------------------------------------------------------------------------
 ;  AsmGetAddressMap (&AddressMap);
 ;-------------------------------------------------------------------------------------
index 6622c43fcf07d4bc5f94e88c199687f72342ead5..18c8b72a34914a1c4fd08aaed96b7ca211a82446 100644 (file)
@@ -181,6 +181,12 @@ CProcedureInvoke:
 RendezvousFunnelProc   ENDP
 RendezvousFunnelProcEnd::
 
 RendezvousFunnelProc   ENDP
 RendezvousFunnelProcEnd::
 
+AsmCliHltLoop PROC
+    cli
+    hlt
+    jmp $-2
+AsmCliHltLoop ENDP
+
 ;-------------------------------------------------------------------------------------
 ;  AsmGetAddressMap (&AddressMap);
 ;-------------------------------------------------------------------------------------
 ;-------------------------------------------------------------------------------------
 ;  AsmGetAddressMap (&AddressMap);
 ;-------------------------------------------------------------------------------------
index 8b93c0d1f7fc8b83d06453ad32cbd11dfec2bf92..4683543e3cc5227c5d044c17686ecbd66769a160 100644 (file)
@@ -175,6 +175,12 @@ CProcedureInvoke:
 
 RendezvousFunnelProcEnd:
 
 
 RendezvousFunnelProcEnd:
 
+global ASM_PFX(AsmCliHltLoop)
+ASM_PFX(AsmCliHltLoop):
+    cli
+    hlt
+    jmp $-2
+
 ;-------------------------------------------------------------------------------------
 ;  AsmGetAddressMap (&AddressMap);
 ;-------------------------------------------------------------------------------------
 ;-------------------------------------------------------------------------------------
 ;  AsmGetAddressMap (&AddressMap);
 ;-------------------------------------------------------------------------------------