PcAtChipsetPkg/HpetTimerDxe: Fix race condition in SetTimerPeriod()
PcAtChipsetPkg/HpetTimerDxe: Fix race condition in SetTimerPeriod()

https://bugzilla.tianocore.org/show_bug.cgi?id=182

The function TimerDriverSetTimerPeriod() disables the HPET timer
while the HPET timer HW is reprogrammed with a new timer period.
However, the MMIO write to disable the HPET timer HW can be
delayed and an HPET timer interrupt may be processed in the middle
of reprogramming the HPET timer HW and this may produced unexpected
results.

The fix is to raise TPL to TPL_HIGH_LEVEL in
TimerDriverSetTimerPeriod() during the time the HPET timer HW is
reprogrammed.  This guarantees that no timer interrupts are
processed during reprogramming.

The TimerDriverGenerateSoftInterrupt() function in this same
driver also raises TPL to TPL_HIGH_LEVEL, so this fix matches
the logic that is already used in another function for the same
reason.

Cc: Ruiyu Ni <9fa3a6894a36bca79e6a72ad65af5a5702efecd1@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <fd20bc543a9f65bb633fac7d08a403c1f1c8eb6c@intel.com>
Reviewed-by: Ruiyu Ni <9fa3a6894a36bca79e6a72ad65af5a5702efecd1@intel.com>

MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2,MattDevo/edk2