audk/MdeModulePkg/Universal/Acpi/SmmS3SaveState
Laszlo Ersek 387ccad8f6 MdeModulePkg: S3SaveStateDxe, SmmS3SaveState: save 64-bit LoopTimes
The BootScriptWriteMemPoll() helper function in both drivers does the
following:

- pop Delay from the variable argument list as UINT64, then truncate it to
  UINTN,

- divide Delay by 10, using DivU64x32Remainder(), then store the quotient
  in LoopTimes (also UINTN),

- pass LoopTimes to S3BootScriptSaveMemPoll() as last argument.

The truncation to UINTN is superfluous and wrong in this logic (not to
mention incompatible with the PI spec); it prevents callers from
specifying Delays longer than 0xFFFF_FFFF * 100ns (approximately 429
seconds == 7 minutes 9 seconds) on Ia32. In particular it prevents callers
from specifying an infinite timeout (for example, 0xFFFF_FFFF_FFFF_FFFF *
100ns, approximately 58494 years).

Change the type of Delay and LoopTimes to UINT64. Keep the same logic,
just remove the truncations. The resultant LoopTimes values can be safely
passed to S3BootScriptSaveMemPoll() thanks to the previous patch.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
2017-01-03 12:23:38 +01:00
..
InternalSmmSaveState.h MdeModulePkg: Add ACPI S3 Save State drivers 2011-08-29 22:19:48 +00:00
SmmS3SaveState.c MdeModulePkg: S3SaveStateDxe, SmmS3SaveState: save 64-bit LoopTimes 2017-01-03 12:23:38 +01:00
SmmS3SaveState.inf MdeModulePkg SmmS3SaveStateDxe: Consume PcdAcpiS3Enable to control the code 2016-04-11 08:48:29 +08:00
SmmS3SaveState.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
SmmS3SaveStateExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00