]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix 2 BootScript thunk issue on MEM_POLL.
authorjyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 27 Apr 2011 07:35:20 +0000 (07:35 +0000)
committerjyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 27 Apr 2011 07:35:20 +0000 (07:35 +0000)
1) MEM_POLL stall time is incorrect.
Framework version: Duration is used for Stall(), which is Microseconds.
                   Total time is: Duration(Microseconds) * LoopTimes.
PI version:        Duration is always 100ns. Delay is LoopTimes.
                   Total time is: 100ns * Delay.
So Delay = Duration(Microseconds) * LoopTimes / 100ns
         = Duration * 1000ns * LoopTimes / 100ns
         = Duration * 10 * LoopTimes

2) MEM_POLL BitMask/BitValue order is incorrect.
Framework version: First BitMask, then BitValue
PI version: First Data, then DataMask
So we revert their order in function call

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11595 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/ScriptSave.c

index 3a3b8c8be53f0b93fea22763127d4b416d0e9255..eb8de8ce6d7e7c9f352822fb7ec48166d540a1f7 100644 (file)
@@ -514,15 +514,29 @@ BootScriptMemPoll (
   BitValue    = VA_ARG (Marker, UINT8 *);\r
   Duration    = (UINT64)VA_ARG (Marker, UINT64);\r
   LoopTimes   = (UINT64)VA_ARG (Marker, UINT64);\r
-  Delay       = MultU64x64 (DivU64x32(Duration, 100), LoopTimes);\r
+  //\r
+  // Framework version: Duration is used for Stall(), which is Microseconds.\r
+  //                    Total time is: Duration(Microseconds) * LoopTimes.\r
+  // PI version:        Duration is always 100ns. Delay is LoopTimes.\r
+  //                    Total time is: 100ns * Delay.\r
+  // So Delay = Duration(Microseconds) * LoopTimes / 100ns\r
+  //          = Duration * 1000ns * LoopTimes / 100ns\r
+  //          = Duration * 10 * LoopTimes\r
+  //\r
+  Delay       = MultU64x64 (MultU64x32 (Duration, 10), LoopTimes);\r
   \r
+  //\r
+  // Framework version: First BitMask, then BitValue\r
+  // PI version: First Data, then DataMask\r
+  // So we revert their order in function call\r
+  //\r
   return mS3SaveState->Write (\r
                           mS3SaveState,\r
                           EFI_BOOT_SCRIPT_MEM_POLL_OPCODE,\r
-                          Width, \r
-                          Address, \r
-                          BitMask, \r
-                          BitValue, \r
+                          Width,\r
+                          Address,\r
+                          BitValue,\r
+                          BitMask,\r
                           Delay\r
                           );\r
 }\r