]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/PiSmmCpuDxeSmm: TransferApToSafeState() use UINTN params
authorMichael Kinney <michael.d.kinney@intel.com>
Thu, 17 Nov 2016 20:41:35 +0000 (12:41 -0800)
committerMichael Kinney <michael.d.kinney@intel.com>
Fri, 18 Nov 2016 01:37:50 +0000 (17:37 -0800)
Update TransferApToSafeState() use UINTN params to reduce the
number of type casts required in these calls.  Also change
the NumberToFinish parameter from UINT32* to UINTN
NumberToFinishAddress to resolve issues with conversion from
a volatile pointer to a non-volatile pointer.  The assembly
code that receives the NumberToFinishAddress value must treat
that memory location as a volatile to track the number of APs.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmFuncsArch.c
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c

index 3fb686439aeda027d073edf9977f37dd077cbc94..4af86b70f2aa34d8eac0dacd38d0211dcff45282 100644 (file)
@@ -385,7 +385,7 @@ MPRendezvousProcedure (
   CPU_REGISTER_TABLE         *RegisterTableList;\r
   UINT32                     InitApicId;\r
   UINTN                      Index;\r
-  UINT32                     TopOfStack;\r
+  UINT                     TopOfStack;\r
   UINT8                      Stack[128];\r
 \r
   ProgramVirtualWireMode ();\r
@@ -403,10 +403,10 @@ MPRendezvousProcedure (
   //\r
   // Place AP into the safe code, count down the number with lock mechanism in the safe code.\r
   //\r
-  TopOfStack  = (UINT32) (UINTN) Stack + sizeof (Stack);\r
-  TopOfStack &= ~(UINT32) (CPU_STACK_ALIGNMENT - 1);\r
+  TopOfStack  = (UINTN) Stack + sizeof (Stack);\r
+  TopOfStack &= ~(UINTN) (CPU_STACK_ALIGNMENT - 1);\r
   CopyMem ((VOID *) (UINTN) mApHltLoopCode, mApHltLoopCodeTemplate, sizeof (mApHltLoopCodeTemplate));\r
-  TransferApToSafeState ((UINT32) (UINTN) mApHltLoopCode, TopOfStack, &mNumberToFinish);\r
+  TransferApToSafeState ((UINTN)mApHltLoopCode, TopOfStack, (UINTN)&mNumberToFinish);\r
 }\r
 \r
 /**\r
index 428169831328b1508096fdd8d019451dbc788317..f4db6c8b60cc0f7d6b0e2de54d85a6fab4ae8fbd 100644 (file)
@@ -129,23 +129,23 @@ InitGdt (
 /**\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
-  @param[in] NumberToFinish   Semaphore of APs finish count.\r
+  @param[in] ApHltLoopCode          The address of the safe hlt-loop function.\r
+  @param[in] TopOfStack             A pointer to the new stack to use for the ApHltLoopCode.\r
+  @param[in] NumberToFinishAddress  Address of Semaphore of APs finish count.\r
 \r
 **/\r
 VOID\r
 TransferApToSafeState (\r
-  IN UINT32             ApHltLoopCode,\r
-  IN UINT32             TopOfStack,\r
-  IN UINT32             *NumberToFinish\r
+  IN UINTN  ApHltLoopCode,\r
+  IN UINTN  TopOfStack,\r
+  IN UINTN  NumberToFinishAddress\r
   )\r
 {\r
   SwitchStack (\r
-    (SWITCH_STACK_ENTRY_POINT) (UINTN) ApHltLoopCode,\r
-    NumberToFinish,\r
+    (SWITCH_STACK_ENTRY_POINT)ApHltLoopCode,\r
+    (VOID *)NumberToFinishAddress,\r
     NULL,\r
-    (VOID *) (UINTN) TopOfStack\r
+    (VOID *)TopOfStack\r
     );\r
   //\r
   // It should never reach here\r
index 907526e40680d4965be712bd54e1ef50761e519e..abe5cc612b2055a453dddcccd5cfba1228ab9342 100644 (file)
@@ -974,16 +974,16 @@ GetAcpiS3EnableFlag (
 /**\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
-  @param[in] NumberToFinish   Semaphore of APs finish count.\r
+  @param[in] ApHltLoopCode          The address of the safe hlt-loop function.\r
+  @param[in] TopOfStack             A pointer to the new stack to use for the ApHltLoopCode.\r
+  @param[in] NumberToFinishAddress  Address of Semaphore of APs finish count.\r
 \r
 **/\r
 VOID\r
 TransferApToSafeState (\r
-  IN UINT32             ApHltLoopCode,\r
-  IN UINT32             TopOfStack,\r
-  IN UINT32             *NumberToFinish\r
+  IN UINTN  ApHltLoopCode,\r
+  IN UINTN  TopOfStack,\r
+  IN UINTN  NumberToFinishAddress\r
   );\r
 \r
 #endif\r
index d6d6a1a5035ca07c1d82175c427196a061062a8f..9fc00c1578c1f1c57fe0fd8bb6d89a60167906a4 100644 (file)
@@ -129,24 +129,24 @@ GetProtectedModeCS (
 /**\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
-  @param[in] NumberToFinish   Semaphore of APs finish count.\r
+  @param[in] ApHltLoopCode          The address of the safe hlt-loop function.\r
+  @param[in] TopOfStack             A pointer to the new stack to use for the ApHltLoopCode.\r
+  @param[in] NumberToFinishAddress  Address of Semaphore of APs finish count.\r
 \r
 **/\r
 VOID\r
 TransferApToSafeState (\r
-  IN UINT32             ApHltLoopCode,\r
-  IN UINT32             TopOfStack,\r
-  IN UINT32             *NumberToFinish\r
+  IN UINTN  ApHltLoopCode,\r
+  IN UINTN  TopOfStack,\r
+  IN UINTN  NumberToFinishAddress\r
   )\r
 {\r
   AsmDisablePaging64 (\r
     GetProtectedModeCS (),\r
-    (UINT32) (UINTN) ApHltLoopCode,\r
-    (UINT32) (UINTN) NumberToFinish,\r
+    (UINT32)ApHltLoopCode,\r
+    (UINT32)NumberToFinishAddress,\r
     0,\r
-    TopOfStack\r
+    (UINT32)TopOfStack\r
     );\r
   //\r
   // It should never reach here\r