]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmFuncsArch.c
UefiCpuPkg/PiSmmCpuDxeSmm: Put AP into safe hlt-loop code on S3 path
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / Ia32 / SmmFuncsArch.c
index 545b534f27960855cec9f461cafa787ba9a2b7d8..8b880d6ab76368b5c6df856fde3745818ee77f73 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM CPU misc functions for Ia32 arch specific.\r
   \r
-Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -94,3 +94,28 @@ InitGdt (
   *GdtStepSize = GdtTableStepSize;\r
   return GdtTssTables;\r
 }\r
+\r
+/**\r
+  Transfer AP to safe hlt-loop after it finished restore CPU features on S3 patch.\r
+\r
+  @param[in] ApHltLoopCode    The 32-bit address of the safe hlt-loop function.\r
+  @param[in] TopOfStack       A pointer to the new stack to use for the ApHltLoopCode.\r
+\r
+**/\r
+VOID\r
+TransferApToSafeState (\r
+  IN UINT32             ApHltLoopCode,\r
+  IN UINT32             TopOfStack\r
+  )\r
+{\r
+  SwitchStack (\r
+    (SWITCH_STACK_ENTRY_POINT) (UINTN) ApHltLoopCode,\r
+    NULL,\r
+    NULL,\r
+    (VOID *) (UINTN) TopOfStack\r
+    );\r
+  //\r
+  // It should never reach here\r
+  //\r
+  ASSERT (FALSE);\r
+}\r