From fb2ae5fdb5207233e9be8f73d552860d9169fa8e Mon Sep 17 00:00:00 2001 From: jljusten Date: Mon, 4 Mar 2013 17:38:42 +0000 Subject: OvmfPkg: make sure ResetCold() and ResetWarm() never return Also, add a small delay after the 0xCF9 hard reset request -- on qemu/kvm the port access is translated to the qemu-internal system reset request by the CPU thread, and it might progress some more before the IO thread acts upon the system reset request. MicroSecondDelay() is implemented by OvmfPkg's own AcpiTimerLib. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14158 6f19259b-4bc3-4df7-8a09-765794883524 --- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 5 +++++ OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'OvmfPkg/Library/ResetSystemLib') diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c index 85af7f1250..d075fbef0a 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -17,6 +17,7 @@ #include #include #include +#include VOID AcpiPmControl ( @@ -46,7 +47,10 @@ ResetCold ( ) { IoWrite8 (0xCF9, BIT2 | BIT1); // 1st choice: PIIX3 RCR, RCPU|SRST + MicroSecondDelay (50); + IoWrite8 (0x64, 0xfe); // 2nd choice: keyboard controller + CpuDeadLoop (); } /** @@ -63,6 +67,7 @@ ResetWarm ( ) { IoWrite8 (0x64, 0xfe); + CpuDeadLoop (); } /** diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf index 0694b4dd3c..c4d8ce54bf 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -35,4 +35,4 @@ [LibraryClasses] DebugLib IoLib - + TimerLib -- cgit v1.2.3