From b6d542e927a3fa0ff4fd7278917f25b0494c07ba Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 17 Apr 2020 17:37:49 +0200 Subject: OvmfPkg/ResetSystemLib: factor out ResetShutdown() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the ResetShutdown() definition to its own file. This will help us introduce: - a new library instance that is not broken in runtime modules (the current library instance is broken in runtime modules), - another new library instance for bhyve support. While at it, squash AcpiPmControl() into ResetShutdown(), open-coding SuspendType=0. This is justified because we've had no other callers for AcpiPmControl() since commit 2d9950a2bff8 ("OvmfPkg: remove EnterS3WithImmediateWake () from ResetSystemLib", 2020-01-10). Tested with the "reset -s" UEFI shell command, on both i440fx and q35. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daudé Cc: Rebecca Cran Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675 Signed-off-by: Laszlo Ersek Message-Id: <20200417153751.7110-5-lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Ard Biesheuvel Reviewed-by: Rebecca Cran --- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c | 49 ------------------------- 1 file changed, 49 deletions(-) (limited to 'OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c') diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c index 0fc142325e..fe51f53d1d 100644 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -9,41 +9,9 @@ #include // BIT1 #include // CpuDeadLoop() -#include // ASSERT() #include // IoWrite8() -#include // PciRead16() #include // ResetCold() #include // MicroSecondDelay() -#include // OVMF_HOSTBRIDGE_DID - -VOID -AcpiPmControl ( - UINTN SuspendType - ) -{ - UINT16 AcpiPmBaseAddress; - UINT16 HostBridgeDevId; - - ASSERT (SuspendType < 6); - - AcpiPmBaseAddress = 0; - HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID); - switch (HostBridgeDevId) { - case INTEL_82441_DEVICE_ID: - AcpiPmBaseAddress = PIIX4_PMBA_VALUE; - break; - case INTEL_Q35_MCH_DEVICE_ID: - AcpiPmBaseAddress = ICH9_PMBASE_VALUE; - break; - default: - ASSERT (FALSE); - CpuDeadLoop (); - } - - IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, (UINT16) SuspendType); - IoOr16 (AcpiPmBaseAddress + 4, BIT13); - CpuDeadLoop (); -} /** Calling this function causes a system-wide reset. This sets @@ -84,23 +52,6 @@ ResetWarm ( CpuDeadLoop (); } -/** - Calling this function causes the system to enter a power state equivalent - to the ACPI G2/S5 or G3 states. - - System shutdown should not return, if it returns, it means the system does - not support shut down reset. -**/ -VOID -EFIAPI -ResetShutdown ( - VOID - ) -{ - AcpiPmControl (0); - ASSERT (FALSE); -} - /** This function causes a systemwide reset. The exact type of the reset is -- cgit v1.2.3