]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg ResetSystemLib: Add shutdown support for OVMF
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 13 Jan 2011 05:46:52 +0000 (05:46 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 13 Jan 2011 05:46:52 +0000 (05:46 +0000)
This library will allow the UEFI RuntimeServices
ResetSystem call to function with OVMF.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11251 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c [new file with mode: 0644]
OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf [new file with mode: 0644]
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
new file mode 100644 (file)
index 0000000..d9de12e
--- /dev/null
@@ -0,0 +1,101 @@
+/** @file\r
+  Reset System Library functions for OVMF\r
+\r
+  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/IoLib.h>\r
+\r
+VOID\r
+AcpiPmControl (\r
+  UINTN SuspendType\r
+  )\r
+{\r
+  ASSERT (SuspendType < 6);\r
+\r
+  IoAndThenOr16 (0x404, ~0x3c00, SuspendType << 10);\r
+  IoOr16 (0x404, BIT13);\r
+  CpuDeadLoop ();\r
+}\r
+\r
+/**\r
+  Calling this function causes a system-wide reset. This sets\r
+  all circuitry within the system to its initial state. This type of reset\r
+  is asynchronous to system operation and operates without regard to\r
+  cycle boundaries.\r
+\r
+  System reset should not return, if it returns, it means the system does\r
+  not support cold reset.\r
+**/\r
+VOID\r
+EFIAPI\r
+ResetCold (\r
+  VOID\r
+  )\r
+{\r
+  IoWrite8 (0x64, 0xfe);\r
+}\r
+\r
+/**\r
+  Calling this function causes a system-wide initialization. The processors\r
+  are set to their initial state, and pending cycles are not corrupted.\r
+\r
+  System reset should not return, if it returns, it means the system does\r
+  not support warm reset.\r
+**/\r
+VOID\r
+EFIAPI\r
+ResetWarm (\r
+  VOID\r
+  )\r
+{\r
+  IoWrite8 (0x64, 0xfe);\r
+}\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
+  AcpiPmControl (0);\r
+  ASSERT (FALSE);\r
+}\r
+\r
+\r
+/**\r
+  Calling this function causes the system to enter a power state for capsule\r
+  update.\r
+\r
+  Reset update should not return, if it returns, it means the system does\r
+  not support capsule update.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+EnterS3WithImmediateWake (\r
+  VOID\r
+  )\r
+{\r
+  AcpiPmControl (1);\r
+  ASSERT (FALSE);\r
+}\r
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
new file mode 100644 (file)
index 0000000..0694b4d
--- /dev/null
@@ -0,0 +1,38 @@
+## @file\r
+#  Library instance for ResetSystem library class for OVMF\r
+#\r
+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution.  The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\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 tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF\r
+#\r
+\r
+[Sources]\r
+  ResetSystemLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
+  IoLib\r
+\r
index d29ed0769fc42c75edf4088fd8d3d70cf3113888..5af066c0b2b40ef416ab25b7c4796a68285188a7 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform\r
 #\r
 ## @file\r
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform\r
 #\r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -96,7 +96,7 @@
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
 !endif\r
 \r
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
 !endif\r
 \r
-  ResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
+  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf\r
 \r
 [LibraryClasses.common.SEC]\r
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf\r
 \r
 [LibraryClasses.common.SEC]\r
index 64fcad4608af90154de6e274936404f3322a9165..cbb6bc8f95301ea945f0b3e02c71632625f44d7f 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform\r
 #\r
 ## @file\r
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform\r
 #\r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -96,7 +96,7 @@
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
 !endif\r
 \r
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
 !endif\r
 \r
-  ResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
+  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf\r
 \r
 [LibraryClasses.common.SEC]\r
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf\r
 \r
 [LibraryClasses.common.SEC]\r
index bc1ed152bc106ac3feeb901a7d21ea38f19f26b0..05d998777cb9f9ddfd2bbdfcc9bed74029cfb185 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform\r
 #\r
 ## @file\r
 #  EFI/Framework Open Virtual Machine Firmware (OVMF) platform\r
 #\r
-#  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -96,7 +96,7 @@
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
 !endif\r
 \r
   DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf\r
 !endif\r
 \r
-  ResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
+  ResetSystemLib|OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf\r
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf\r
 \r
 [LibraryClasses.common.SEC]\r
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf\r
 \r
 [LibraryClasses.common.SEC]\r