]> git.proxmox.com Git - mirror_edk2.git/commitdiff
The unit of Duration for S3BootScriptSaveMemPoll() is us, but not ns, so update BootS...
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Jan 2013 05:18:19 +0000 (05:18 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 15 Jan 2013 05:18:19 +0000 (05:18 +0000)
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14048 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c
MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c

index afb4c107761958a5eccb8eeede796712dd269501..cba331a3bda30d41dc5ef231c4838a64a58d528e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Interpret and execute the S3 data in S3 boot script. \r
 \r
-  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -1176,7 +1176,7 @@ BootScriptExecuteMemPoll (
   }\r
 \r
   for (LoopTimes = 0; LoopTimes < MemPoll.LoopTimes; LoopTimes++) {\r
-    NanoSecondDelay ((UINTN)MemPoll.Duration);\r
+    MicroSecondDelay ((UINTN)MemPoll.Duration);\r
 \r
     Data = 0;\r
     Status = ScriptMemoryRead (\r
index 249fb8caff85196266859acfdec24996fac1bd9d..723c77a52b042b05e4bcb5eac66934fb32d6771b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for S3 Boot Script Saver state driver.\r
 \r
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -344,16 +344,33 @@ BootScriptWriteMemPoll (
   VOID                      *Data;                                    \r
   VOID                      *DataMask;                                  \r
   UINTN                     Delay;                                   \r
-                                                                         \r
+  UINTN                     LoopTimes;\r
+  UINT32                    Remainder;\r
+\r
   Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);                  \r
   Address  = VA_ARG (Marker, UINT64);                                    \r
   Data     = VA_ARG (Marker, VOID *);                                    \r
   DataMask = VA_ARG (Marker, VOID *);                                    \r
   Delay    = (UINTN)VA_ARG (Marker, UINT64);                            \r
   //\r
-  // According to the spec, the interval between 2 pools is 100ns\r
-  //                                                                       \r
-  return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 100, Delay); \r
+  // According to the spec, the interval between 2 polls is 100ns,\r
+  // but the unit of Duration for S3BootScriptSaveMemPoll() is microsecond(1000ns).\r
+  // Duration * 1000ns * LoopTimes = Delay * 100ns\r
+  // Duration will be minimum 1(microsecond) to be minimum deviation,\r
+  // so LoopTimes = Delay / 10.\r
+  //\r
+  LoopTimes = DivU64x32Remainder (\r
+                Delay,\r
+                10,\r
+                &Remainder\r
+                );\r
+  if (Remainder != 0) {\r
+    //\r
+    // If Remainder is not zero, LoopTimes will be rounded up by 1.\r
+    //\r
+    LoopTimes +=1;\r
+  }\r
+  return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1, LoopTimes);\r
 \r
 }\r
 \r
index d0652d3fd8fc068c27678f9138489e183413d8d6..3bb086fe4975a6925ef82ff4f557229d40318a3f 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for S3 SMM Boot Script Saver state driver.\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -343,16 +343,33 @@ BootScriptWriteMemPoll (
   VOID                      *Data;                                       \r
   VOID                      *DataMask;                                   \r
   UINTN                      Delay;                                       \r
-                                                                         \r
+  UINTN                      LoopTimes;\r
+  UINT32                     Remainder;\r
+\r
   Width    = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);                  \r
   Address  = VA_ARG (Marker, UINT64);                                    \r
   Data     = VA_ARG (Marker, VOID *);                                    \r
   DataMask = VA_ARG (Marker, VOID *);                                    \r
   Delay    = (UINTN)VA_ARG (Marker, UINT64);                            \r
   //\r
-  // According to the spec, the interval between 2 pools is 100ns\r
-  //                                                                       \r
-  return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 100, Delay); \r
+  // According to the spec, the interval between 2 polls is 100ns,\r
+  // but the unit of Duration for S3BootScriptSaveMemPoll() is microsecond(1000ns).\r
+  // Duration * 1000ns * LoopTimes = Delay * 100ns\r
+  // Duration will be minimum 1(microsecond) to be minimum deviation,\r
+  // so LoopTimes = Delay / 10.\r
+  //\r
+  LoopTimes = DivU64x32Remainder (\r
+                Delay,\r
+                10,\r
+                &Remainder\r
+                );\r
+  if (Remainder != 0) {\r
+    //\r
+    // If Remainder is not zero, LoopTimes will be rounded up by 1.\r
+    //\r
+    LoopTimes +=1;\r
+  }\r
+  return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1, LoopTimes); \r
 \r
 }\r
 \r