From d70cdcf0b5fa1f41e236d4303ecb994af57c0409 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Fri, 17 Apr 2020 17:37:50 +0200 Subject: OvmfPkg/ResetSystemLib: rename to BaseResetSystemLib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation for introducing DxeResetSystemLib, rename the current (only) ResetSystemLib instance to BaseResetSystemLib. In the DSC files, keep the ResetSystemLib resolution in the same [LibraryClasses] section, but move it near the TimerLib resolution, as the differences between the ResetSystemLib instances will mostly follow those seen under OvmfPkg/Library/AcpiTimerLib. (While OvmfXen does not use "OvmfPkg/Library/AcpiTimerLib", perform the same movement there too, for keeping future DSC diffing simple.) Cc: Anthony Perard Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Julien Grall 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-6-lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Ard Biesheuvel Reviewed-by: Rebecca Cran --- OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c | 51 ++++++++++++++++++++++ .../Library/ResetSystemLib/BaseResetSystemLib.inf | 38 ++++++++++++++++ OvmfPkg/Library/ResetSystemLib/ResetShutdown.c | 51 ---------------------- OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf | 38 ---------------- 4 files changed, 89 insertions(+), 89 deletions(-) create mode 100644 OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c create mode 100644 OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf delete mode 100644 OvmfPkg/Library/ResetSystemLib/ResetShutdown.c delete mode 100644 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf (limited to 'OvmfPkg/Library/ResetSystemLib') diff --git a/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c b/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c new file mode 100644 index 0000000000..21c80e4323 --- /dev/null +++ b/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c @@ -0,0 +1,51 @@ +/** @file + Base Reset System Library Shutdown API implementation for OVMF. + + Copyright (C) 2020, Red Hat, Inc. + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include // BIT13 + +#include // CpuDeadLoop() +#include // ASSERT() +#include // IoOr16() +#include // PciRead16() +#include // ResetShutdown() +#include // OVMF_HOSTBRIDGE_DID + +/** + 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 + ) +{ + UINT16 AcpiPmBaseAddress; + UINT16 HostBridgeDevId; + + 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, 0); + IoOr16 (AcpiPmBaseAddress + 4, BIT13); + CpuDeadLoop (); +} diff --git a/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf new file mode 100644 index 0000000000..0772780b2d --- /dev/null +++ b/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf @@ -0,0 +1,38 @@ +## @file +# Base library instance for ResetSystem library class for OVMF +# +# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = BaseResetSystemLib + FILE_GUID = 66564872-21d4-4d2a-a68b-1e844f980820 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ResetSystemLib + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + +[Sources] + BaseResetShutdown.c + ResetSystemLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + PciLib + TimerLib diff --git a/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c b/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c deleted file mode 100644 index 971d94fa57..0000000000 --- a/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c +++ /dev/null @@ -1,51 +0,0 @@ -/** @file - Reset System Library Shutdown API implementation for OVMF. - - Copyright (C) 2020, Red Hat, Inc. - Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent -**/ - -#include // BIT13 - -#include // CpuDeadLoop() -#include // ASSERT() -#include // IoOr16() -#include // PciRead16() -#include // ResetShutdown() -#include // OVMF_HOSTBRIDGE_DID - -/** - 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 - ) -{ - UINT16 AcpiPmBaseAddress; - UINT16 HostBridgeDevId; - - 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, 0); - IoOr16 (AcpiPmBaseAddress + 4, BIT13); - CpuDeadLoop (); -} diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf deleted file mode 100644 index 9362f884f1..0000000000 --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf +++ /dev/null @@ -1,38 +0,0 @@ -## @file -# Library instance for ResetSystem library class for OVMF -# -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = ResetSystemLib - FILE_GUID = 66564872-21d4-4d2a-a68b-1e844f980820 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = ResetSystemLib - -# -# The following information is for reference only and not required by the build -# tools. -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Sources] - ResetShutdown.c - ResetSystemLib.c - -[Packages] - MdeModulePkg/MdeModulePkg.dec - MdePkg/MdePkg.dec - OvmfPkg/OvmfPkg.dec - -[LibraryClasses] - BaseLib - DebugLib - IoLib - PciLib - TimerLib -- cgit v1.2.3