]> git.proxmox.com Git - mirror_edk2.git/commit - OvmfPkg/PlatformPei/Platform.c
OvmfPkg: PlatformPei: clear CMOS 0xF after setting mBootMode
authorLaszlo Ersek <lersek@redhat.com>
Wed, 2 Sep 2015 18:45:35 +0000 (18:45 +0000)
committerlersek <lersek@Edk2>
Wed, 2 Sep 2015 18:45:35 +0000 (18:45 +0000)
commit9be751890e182292fd03803d58e44ac9ac9706ef
treeb289277e43b3d2b383645452e78f51ae4cafd61c
parentda7056309218ae3cda95f8512c3f94e4d9a55c16
OvmfPkg: PlatformPei: clear CMOS 0xF after setting mBootMode

We have an old bug in BootModeInitialization(): firmware is supposed to
clear the CMOS register 0xF after reading it for the last time. QEMU only
sets this register to 0xFE in "hw/timer/mc146818rtc.c", function
rtc_notify_suspend(), and never clears it. However, SeaBIOS does clear it
in "src/post.c" and "src/resume.c", so let's follow suit.

We've never noticed this until now because the register gets mysteriously
cleared on non-resume reboots when OVMF runs on qemu-system-x86_64. But on
qemu-system-i386, this bug breaks a (suspend, resume, reboot) triplet:
after the last step OVMF thinks it's resuming because when it actually
resumed (in the middle step), it failed to clear the register.

BootModeInitialization() is the perfect function to clear the register,
right after setting mBootMode: the function is executed on both normal
boot and on S3 resume; it succeeds DebugDumpCmos() -- so the dump is not
affected by this patch --; and everything that relies on S3 vs. normal
boot after we clear the register uses mBootMode anyway.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18391 6f19259b-4bc3-4df7-8a09-765794883524
OvmfPkg/PlatformPei/Platform.c