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 <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2675
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <
20200417153751.7110-6-lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
--- /dev/null
+/** @file\r
+ Base Reset System Library Shutdown API implementation for OVMF.\r
+\r
+ Copyright (C) 2020, Red Hat, Inc.\r
+ Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#include <Base.h> // BIT13\r
+\r
+#include <Library/BaseLib.h> // CpuDeadLoop()\r
+#include <Library/DebugLib.h> // ASSERT()\r
+#include <Library/IoLib.h> // IoOr16()\r
+#include <Library/PciLib.h> // PciRead16()\r
+#include <Library/ResetSystemLib.h> // ResetShutdown()\r
+#include <OvmfPlatforms.h> // OVMF_HOSTBRIDGE_DID\r
+\r
+/**\r
+ Calling this function causes the system to enter a power state equivalent\r
+ to the ACPI G2/S5 or G3 states.\r
+\r
+ System shutdown should not return, if it returns, it means the system does\r
+ not support shut down reset.\r
+**/\r
+VOID\r
+EFIAPI\r
+ResetShutdown (\r
+ VOID\r
+ )\r
+{\r
+ UINT16 AcpiPmBaseAddress;\r
+ UINT16 HostBridgeDevId;\r
+\r
+ AcpiPmBaseAddress = 0;\r
+ HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);\r
+ switch (HostBridgeDevId) {\r
+ case INTEL_82441_DEVICE_ID:\r
+ AcpiPmBaseAddress = PIIX4_PMBA_VALUE;\r
+ break;\r
+ case INTEL_Q35_MCH_DEVICE_ID:\r
+ AcpiPmBaseAddress = ICH9_PMBASE_VALUE;\r
+ break;\r
+ default:\r
+ ASSERT (FALSE);\r
+ CpuDeadLoop ();\r
+ }\r
+\r
+ IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, 0);\r
+ IoOr16 (AcpiPmBaseAddress + 4, BIT13);\r
+ CpuDeadLoop ();\r
+}\r
--- /dev/null
+## @file\r
+# Base library instance for ResetSystem library class for OVMF\r
+#\r
+# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = BaseResetSystemLib\r
+ FILE_GUID = 66564872-21d4-4d2a-a68b-1e844f980820\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = ResetSystemLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build\r
+# tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64\r
+#\r
+\r
+[Sources]\r
+ BaseResetShutdown.c\r
+ ResetSystemLib.c\r
+\r
+[Packages]\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ MdePkg/MdePkg.dec\r
+ OvmfPkg/OvmfPkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
+ DebugLib\r
+ IoLib\r
+ PciLib\r
+ TimerLib\r
+++ /dev/null
-/** @file\r
- Reset System Library Shutdown API implementation for OVMF.\r
-\r
- Copyright (C) 2020, Red Hat, Inc.\r
- Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-**/\r
-\r
-#include <Base.h> // BIT13\r
-\r
-#include <Library/BaseLib.h> // CpuDeadLoop()\r
-#include <Library/DebugLib.h> // ASSERT()\r
-#include <Library/IoLib.h> // IoOr16()\r
-#include <Library/PciLib.h> // PciRead16()\r
-#include <Library/ResetSystemLib.h> // ResetShutdown()\r
-#include <OvmfPlatforms.h> // OVMF_HOSTBRIDGE_DID\r
-\r
-/**\r
- Calling this function causes the system to enter a power state equivalent\r
- to the ACPI G2/S5 or G3 states.\r
-\r
- System shutdown should not return, if it returns, it means the system does\r
- not support shut down reset.\r
-**/\r
-VOID\r
-EFIAPI\r
-ResetShutdown (\r
- VOID\r
- )\r
-{\r
- UINT16 AcpiPmBaseAddress;\r
- UINT16 HostBridgeDevId;\r
-\r
- AcpiPmBaseAddress = 0;\r
- HostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);\r
- switch (HostBridgeDevId) {\r
- case INTEL_82441_DEVICE_ID:\r
- AcpiPmBaseAddress = PIIX4_PMBA_VALUE;\r
- break;\r
- case INTEL_Q35_MCH_DEVICE_ID:\r
- AcpiPmBaseAddress = ICH9_PMBASE_VALUE;\r
- break;\r
- default:\r
- ASSERT (FALSE);\r
- CpuDeadLoop ();\r
- }\r
-\r
- IoBitFieldWrite16 (AcpiPmBaseAddress + 4, 10, 13, 0);\r
- IoOr16 (AcpiPmBaseAddress + 4, BIT13);\r
- CpuDeadLoop ();\r
-}\r
+++ /dev/null
-## @file\r
-# Library instance for ResetSystem library class for OVMF\r
-#\r
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-# SPDX-License-Identifier: BSD-2-Clause-Patent\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = ResetSystemLib\r
- FILE_GUID = 66564872-21d4-4d2a-a68b-1e844f980820\r
- MODULE_TYPE = BASE\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = ResetSystemLib\r
-\r
-#\r
-# The following information is for reference only and not required by the build\r
-# tools.\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64\r
-#\r
-\r
-[Sources]\r
- ResetShutdown.c\r
- ResetSystemLib.c\r
-\r
-[Packages]\r
- MdeModulePkg/MdeModulePkg.dec\r
- MdePkg/MdePkg.dec\r
- OvmfPkg/OvmfPkg.dec\r
-\r
-[LibraryClasses]\r
- BaseLib\r
- DebugLib\r
- IoLib\r
- PciLib\r
- TimerLib\r
[LibraryClasses]\r
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf\r
+ ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf\r
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf\r
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf\r
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf\r
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
!endif\r
\r
- ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf\r
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf\r
\r
[LibraryClasses]\r
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf\r
+ ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf\r
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf\r
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf\r
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf\r
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
!endif\r
\r
- ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf\r
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf\r
\r
[LibraryClasses]\r
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf\r
+ ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf\r
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf\r
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf\r
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf\r
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
!endif\r
\r
- ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf\r
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf\r
\r
[LibraryClasses]\r
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
TimerLib|MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+ ResetSystemLib|OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf\r
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf\r
BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf\r
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf\r
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
!endif\r
\r
- ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
LocalApicLib|UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf\r
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf\r
\r