Revision: 14048
http://edk2.svn.sourceforge.net/edk2/?rev=14048&view=rev
Author: lzeng14
Date: 2013-01-15 05:18:19 +0000 (Tue, 15 Jan 2013)
Log Message:
-----------
The unit of Duration for S3BootScriptSaveMemPoll() is us, but not ns, so update
BootScriptExecuteMemPoll() to use MicroSecondDelay() instead of
NanoSecondDelay(), and update BootScriptWriteMemPoll() to use
S3BootScriptSaveMemPoll() correctly with possible minimum deviation.
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c
trunk/edk2/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
trunk/edk2/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
Modified:
trunk/edk2/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c
===================================================================
--- trunk/edk2/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c
2013-01-15 02:19:42 UTC (rev 14047)
+++ trunk/edk2/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptExecute.c
2013-01-15 05:18:19 UTC (rev 14048)
@@ -1,7 +1,7 @@
/** @file
Interpret and execute the S3 data in S3 boot script.
- Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -1176,7 +1176,7 @@
}
for (LoopTimes = 0; LoopTimes < MemPoll.LoopTimes; LoopTimes++) {
- NanoSecondDelay ((UINTN)MemPoll.Duration);
+ MicroSecondDelay ((UINTN)MemPoll.Duration);
Data = 0;
Status = ScriptMemoryRead (
Modified: trunk/edk2/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
2013-01-15 02:19:42 UTC (rev 14047)
+++ trunk/edk2/MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveState.c
2013-01-15 05:18:19 UTC (rev 14048)
@@ -1,7 +1,7 @@
/** @file
Implementation for S3 Boot Script Saver state driver.
- Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -344,16 +344,33 @@
VOID *Data;
VOID *DataMask;
UINTN Delay;
-
+ UINTN LoopTimes;
+ UINT32 Remainder;
+
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
Address = VA_ARG (Marker, UINT64);
Data = VA_ARG (Marker, VOID *);
DataMask = VA_ARG (Marker, VOID *);
Delay = (UINTN)VA_ARG (Marker, UINT64);
//
- // According to the spec, the interval between 2 pools is 100ns
- //
- return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 100, Delay);
+ // According to the spec, the interval between 2 polls is 100ns,
+ // but the unit of Duration for S3BootScriptSaveMemPoll() is
microsecond(1000ns).
+ // Duration * 1000ns * LoopTimes = Delay * 100ns
+ // Duration will be minimum 1(microsecond) to be minimum deviation,
+ // so LoopTimes = Delay / 10.
+ //
+ LoopTimes = DivU64x32Remainder (
+ Delay,
+ 10,
+ &Remainder
+ );
+ if (Remainder != 0) {
+ //
+ // If Remainder is not zero, LoopTimes will be rounded up by 1.
+ //
+ LoopTimes +=1;
+ }
+ return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1,
LoopTimes);
}
Modified: trunk/edk2/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
2013-01-15 02:19:42 UTC (rev 14047)
+++ trunk/edk2/MdeModulePkg/Universal/Acpi/SmmS3SaveState/SmmS3SaveState.c
2013-01-15 05:18:19 UTC (rev 14048)
@@ -1,7 +1,7 @@
/** @file
Implementation for S3 SMM Boot Script Saver state driver.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -343,16 +343,33 @@
VOID *Data;
VOID *DataMask;
UINTN Delay;
-
+ UINTN LoopTimes;
+ UINT32 Remainder;
+
Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH);
Address = VA_ARG (Marker, UINT64);
Data = VA_ARG (Marker, VOID *);
DataMask = VA_ARG (Marker, VOID *);
Delay = (UINTN)VA_ARG (Marker, UINT64);
//
- // According to the spec, the interval between 2 pools is 100ns
- //
- return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 100, Delay);
+ // According to the spec, the interval between 2 polls is 100ns,
+ // but the unit of Duration for S3BootScriptSaveMemPoll() is
microsecond(1000ns).
+ // Duration * 1000ns * LoopTimes = Delay * 100ns
+ // Duration will be minimum 1(microsecond) to be minimum deviation,
+ // so LoopTimes = Delay / 10.
+ //
+ LoopTimes = DivU64x32Remainder (
+ Delay,
+ 10,
+ &Remainder
+ );
+ if (Remainder != 0) {
+ //
+ // If Remainder is not zero, LoopTimes will be rounded up by 1.
+ //
+ LoopTimes +=1;
+ }
+ return S3BootScriptSaveMemPoll (Width, Address, DataMask, Data, 1,
LoopTimes);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits