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