]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/ResetSystemLib: rename to BaseResetSystemLib
authorLaszlo Ersek <lersek@redhat.com>
Fri, 17 Apr 2020 15:37:50 +0000 (17:37 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 22 Apr 2020 19:42:32 +0000 (19:42 +0000)
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>
OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c [new file with mode: 0644]
OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf [new file with mode: 0644]
OvmfPkg/Library/ResetSystemLib/ResetShutdown.c [deleted file]
OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf [deleted file]
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc
OvmfPkg/OvmfXen.dsc

diff --git a/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c b/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c
new file mode 100644 (file)
index 0000000..21c80e4
--- /dev/null
@@ -0,0 +1,51 @@
+/** @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
diff --git a/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/BaseResetSystemLib.inf
new file mode 100644 (file)
index 0000000..0772780
--- /dev/null
@@ -0,0 +1,38 @@
+## @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
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c b/OvmfPkg/Library/ResetSystemLib/ResetShutdown.c
deleted file mode 100644 (file)
index 971d94f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @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
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
deleted file mode 100644 (file)
index 9362f88..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-## @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
index cbc5f0e583bc43d35cce3751febc72f3c8e670c0..cd0ed34e0e5a194eeca85e9b1595c97bae37bee8 100644 (file)
 [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
index 6d69cc6cb56fc2f0d613695f9a1182841a655813..3c377c6e858e43b4e3ed75dbd20f631d80019986 100644 (file)
 [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
index 5ad4f461ce52d8c42a99d5a01512cbe99d35e3d8..701a7ccea9870c6dc7db466bc143c7a22f48c0fe 100644 (file)
 [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
index 47ee8db8b8848d8b6bc7a19d36b315990c22285c..86b24d1716b9b6800d4189bdc4cb3f94d2dd9e0f 100644 (file)
 [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