]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Nt32Pkg: Add the ResetSystemLib in Nt32 Platform.
authorHuajingLi <huajing.li@intel.com>
Sat, 22 Jul 2017 07:40:53 +0000 (15:40 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 26 Jul 2017 07:40:32 +0000 (15:40 +0800)
Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.c [new file with mode: 0644]
Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf [new file with mode: 0644]
Nt32Pkg/Nt32Pkg.dsc
Nt32Pkg/Nt32Pkg.fdf
Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf [deleted file]
Nt32Pkg/ResetRuntimeDxe/reset.c [deleted file]

diff --git a/Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.c b/Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.c
new file mode 100644 (file)
index 0000000..743b61c
--- /dev/null
@@ -0,0 +1,98 @@
+/** @file\r
+  \r
+  Copyright (c) 2017, 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
+#include <Uefi.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/WinNtLib.h>\r
+\r
+/**\r
+  This function causes a system-wide reset (cold reset), in which\r
+  all circuitry within the system returns to its initial state. This type of reset \r
+  is asynchronous to system operation and operates without regard to\r
+  cycle boundaries.\r
+\r
+  If this function returns, it means that the system does not support cold reset. \r
+**/\r
+VOID\r
+EFIAPI\r
+ResetCold (\r
+  VOID\r
+  )\r
+{\r
+  gWinNt->ExitProcess (0);\r
+  ASSERT (FALSE);\r
+}\r
+\r
+/**\r
+  This function causes a system-wide initialization (warm reset), in which all processors \r
+  are set to their initial state. Pending cycles are not corrupted.\r
+\r
+  If this function returns, it means that the system does not support warm reset.\r
+**/\r
+VOID\r
+EFIAPI\r
+ResetWarm (\r
+  VOID\r
+  )\r
+{\r
+  ResetCold ();\r
+}\r
+\r
+/**\r
+  This function causes the system to enter a power state equivalent \r
+  to the ACPI G2/S5 or G3 states.\r
+\r
+  If this function returns, it means that the system does not support shut down reset.\r
+**/\r
+VOID\r
+EFIAPI\r
+ResetShutdown (\r
+  VOID\r
+  )\r
+{\r
+  ResetCold ();\r
+}\r
+\r
+/**\r
+  This function causes the system to enter S3 and then wake up immediately.\r
+\r
+  If this function returns, it means that the system does not support S3 feature.\r
+**/\r
+VOID\r
+EFIAPI\r
+EnterS3WithImmediateWake (\r
+  VOID\r
+  )\r
+{\r
+  ResetCold ();\r
+}\r
+\r
+/**\r
+  This function causes a systemwide reset. The exact type of the reset is\r
+  defined by the EFI_GUID that follows the Null-terminated Unicode string passed\r
+  into ResetData. If the platform does not recognize the EFI_GUID in ResetData\r
+  the platform must pick a supported reset type to perform.The platform may\r
+  optionally log the parameters from any non-normal reset that occurs.\r
+\r
+  @param[in]  DataSize   The size, in bytes, of ResetData.\r
+  @param[in]  ResetData  The data buffer starts with a Null-terminated string,\r
+                         followed by the EFI_GUID.\r
+**/\r
+VOID\r
+EFIAPI\r
+ResetPlatformSpecific (\r
+  IN UINTN   DataSize,\r
+  IN VOID    *ResetData\r
+  )\r
+{\r
+  ResetCold ();\r
+}\r
diff --git a/Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf b/Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf
new file mode 100644 (file)
index 0000000..b39f63a
--- /dev/null
@@ -0,0 +1,37 @@
+## @file\r
+#  \r
+#  Copyright (c) 2017, 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
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\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                      = Nt32ResetSystemLib\r
+  FILE_GUID                      = A7EBA1F6-5505-4fba-8895-386EE02B2FAC\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\r
+#\r
+\r
+[Sources]\r
+  ResetSystemLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  Nt32Pkg/Nt32Pkg.dec\r
+\r
+[LibraryClasses]\r
+  WinNtLib\r
+  DebugLib\r
index fa3446be062f956a42b093ef13b9eb798f08da31..00848907cf3ba50c8867f05dd5bb9678a17b1096 100644 (file)
   CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf\r
   LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf\r
   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf\r
+  ResetSystemLib|Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf\r
 !if $(TLS_ENABLE) == TRUE\r
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf\r
 !else\r
   }\r
   Nt32Pkg/MetronomeDxe/MetronomeDxe.inf\r
   Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf\r
-  Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf\r
+  MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf\r
   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf\r
   Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf\r
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf  {\r
index ffa4b0a4a5ad8b81ae9635e66e504ce4dbeb579e..e03999b0cbe07c308142c5b925f6136e2daaa1f2 100644 (file)
@@ -200,7 +200,7 @@ INF  MdeModulePkg/Core/Dxe/DxeMain.inf
 INF  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf\r
 INF  Nt32Pkg/MetronomeDxe/MetronomeDxe.inf\r
 INF  Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf\r
-INF  Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf\r
+INF  MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf\r
 INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf\r
 INF  Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf\r
 INF  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf\r
diff --git a/Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf b/Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
deleted file mode 100644 (file)
index 4e21e21..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-## @file\r
-# NT Emulation Reset Architectural Protocol Driver as defined in TIANO\r
-#\r
-# This Reset module simulates system reset by process exit on NT.\r
-# Copyright (c) 2006 - 2010, 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
-#  which accompanies this distribution. The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\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
-\r
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = Reset\r
-  FILE_GUID                      = BA929954-35B0-4dd3-90CD-9634BD7E1CF1\r
-  MODULE_TYPE                    = DXE_DRIVER\r
-  VERSION_STRING                 = 1.0\r
-\r
-  ENTRY_POINT                    = InitializeNtReset\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-#  VALID_ARCHITECTURES           = IA32\r
-#\r
-\r
-[Sources]\r
-  reset.c\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  Nt32Pkg/Nt32Pkg.dec\r
-\r
-[LibraryClasses]\r
-  UefiBootServicesTableLib\r
-  WinNtLib\r
-  UefiDriverEntryPoint\r
-  DebugLib\r
-\r
-[Protocols]\r
-  gEfiResetArchProtocolGuid                     # PROTOCOL ALWAYS_PRODUCED\r
-\r
-[Depex]\r
-  TRUE\r
-\r
diff --git a/Nt32Pkg/ResetRuntimeDxe/reset.c b/Nt32Pkg/ResetRuntimeDxe/reset.c
deleted file mode 100644 (file)
index 468f712..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/**@file\r
-\r
-Copyright (c) 2006, 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
-Module Name:\r
-\r
- Reset.c\r
-\r
-Abstract:\r
-\r
-  Reset Architectural Protocol as defined in Tiano under NT Emulation\r
-\r
-**/\r
-\r
-#include <Uefi.h>\r
-#include <WinNtDxe.h>\r
-#include <Protocol/Reset.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/WinNtLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeNtReset (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  );\r
-\r
-VOID\r
-EFIAPI\r
-WinNtResetSystem (\r
-  IN EFI_RESET_TYPE   ResetType,\r
-  IN EFI_STATUS       ResetStatus,\r
-  IN UINTN            DataSize,\r
-  IN VOID             *ResetData OPTIONAL\r
-  );\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-InitializeNtReset (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-\r
-Arguments:\r
-\r
-  ImageHandle of the loaded driver\r
-  Pointer to the System Table\r
-\r
-Returns:\r
-\r
-  Status\r
---*/\r
-// TODO:    SystemTable - add argument and description to function comment\r
-{\r
-  EFI_STATUS  Status;\r
-  EFI_HANDLE  Handle;\r
-\r
-  SystemTable->RuntimeServices->ResetSystem = WinNtResetSystem;\r
-\r
-  Handle = NULL;\r
-  Status = gBS->InstallMultipleProtocolInterfaces (\r
-                  &Handle,\r
-                  &gEfiResetArchProtocolGuid,\r
-                  NULL,\r
-                  NULL\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  return Status;\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-WinNtResetSystem (\r
-  IN EFI_RESET_TYPE   ResetType,\r
-  IN EFI_STATUS       ResetStatus,\r
-  IN UINTN            DataSize,\r
-  IN VOID             *ResetData OPTIONAL\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  ResetType   - TODO: add argument description\r
-  ResetStatus - TODO: add argument description\r
-  DataSize    - TODO: add argument description\r
-  ResetData   - TODO: add argument description\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS - TODO: Add description for return value\r
-\r
---*/\r
-{\r
-  //\r
-  // BUGBUG Need to kill all console windows later\r
-  //\r
-  //\r
-  // Discard ResetType, always return 0 as exit code\r
-  //\r
-  gWinNt->ExitProcess (0);\r
-\r
-  //\r
-  // Should never go here\r
-  //\r
-  ASSERT (FALSE);\r
-}\r