From nobody Fri May 3 12:48:30 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1500973546292654.9546821678663; Tue, 25 Jul 2017 02:05:46 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5CE2221D28FC6; Tue, 25 Jul 2017 02:03:37 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E3BE121CE7481 for ; Tue, 25 Jul 2017 02:03:35 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2017 02:05:37 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.7]) by fmsmga001.fm.intel.com with ESMTP; 25 Jul 2017 02:05:32 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,411,1496127600"; d="scan'208";a="1176184138" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 25 Jul 2017 17:05:27 +0800 Message-Id: <20170725090527.22460-1-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.12.2.windows.2 Subject: [edk2] [PATCH] Nt32Pkg: Add the ResetSystemLib in Nt32 Platform. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: HuajingLi MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: HuajingLi Signed-off-by: Huajing Li Reviewed-by: Ruiyu Ni --- Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.c | 98 ++++++++++++++++ .../ResetSystemLib/ResetSystemLib.inf} | 27 ++--- Nt32Pkg/Nt32Pkg.dsc | 3 +- Nt32Pkg/Nt32Pkg.fdf | 2 +- Nt32Pkg/ResetRuntimeDxe/reset.c | 126 -----------------= ---- 5 files changed, 108 insertions(+), 148 deletions(-) create mode 100644 Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.c rename Nt32Pkg/{ResetRuntimeDxe/ResetRuntimeDxe.inf =3D> Library/ResetSyst= emLib/ResetSystemLib.inf} (54%) delete mode 100644 Nt32Pkg/ResetRuntimeDxe/reset.c diff --git a/Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.c b/Nt32Pkg/Libr= ary/ResetSystemLib/ResetSystemLib.c new file mode 100644 index 0000000000..743b61cbb9 --- /dev/null +++ b/Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.c @@ -0,0 +1,98 @@ +/** @file + =20 + Copyright (c) 2017, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +#include +#include +#include + +/** + This function causes a system-wide reset (cold reset), in which + all circuitry within the system returns to its initial state. This type = of reset=20 + is asynchronous to system operation and operates without regard to + cycle boundaries. + + If this function returns, it means that the system does not support cold= reset.=20 +**/ +VOID +EFIAPI +ResetCold ( + VOID + ) +{ + gWinNt->ExitProcess (0); + ASSERT (FALSE); +} + +/** + This function causes a system-wide initialization (warm reset), in which= all processors=20 + are set to their initial state. Pending cycles are not corrupted. + + If this function returns, it means that the system does not support warm= reset. +**/ +VOID +EFIAPI +ResetWarm ( + VOID + ) +{ + ResetCold (); +} + +/** + This function causes the system to enter a power state equivalent=20 + to the ACPI G2/S5 or G3 states. + + If this function returns, it means that the system does not support shut= down reset. +**/ +VOID +EFIAPI +ResetShutdown ( + VOID + ) +{ + ResetCold (); +} + +/** + This function causes the system to enter S3 and then wake up immediately. + + If this function returns, it means that the system does not support S3 f= eature. +**/ +VOID +EFIAPI +EnterS3WithImmediateWake ( + VOID + ) +{ + ResetCold (); +} + +/** + This function causes a systemwide reset. The exact type of the reset is + defined by the EFI_GUID that follows the Null-terminated Unicode string = passed + into ResetData. If the platform does not recognize the EFI_GUID in Reset= Data + the platform must pick a supported reset type to perform.The platform may + optionally log the parameters from any non-normal reset that occurs. + + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData The data buffer starts with a Null-terminated str= ing, + followed by the EFI_GUID. +**/ +VOID +EFIAPI +ResetPlatformSpecific ( + IN UINTN DataSize, + IN VOID *ResetData + ) +{ + ResetCold (); +} diff --git a/Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf b/Nt32Pkg/Library/= ResetSystemLib/ResetSystemLib.inf similarity index 54% rename from Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf rename to Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf index 4e21e21afb..b39f63ab6f 100644 --- a/Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf +++ b/Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf @@ -1,8 +1,6 @@ ## @file -# NT Emulation Reset Architectural Protocol Driver as defined in TIANO -# -# This Reset module simulates system reset by process exit on NT. -# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+# =20 +# Copyright (c) 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -11,17 +9,15 @@ # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. # -# ## =20 [Defines] INF_VERSION =3D 0x00010005 - BASE_NAME =3D Reset - FILE_GUID =3D BA929954-35B0-4dd3-90CD-9634BD7E1CF1 - MODULE_TYPE =3D DXE_DRIVER + BASE_NAME =3D Nt32ResetSystemLib + FILE_GUID =3D A7EBA1F6-5505-4fba-8895-386EE02B2FAC + MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - - ENTRY_POINT =3D InitializeNtReset + LIBRARY_CLASS =3D ResetSystemLib =20 # # The following information is for reference only and not required by the = build tools. @@ -30,21 +26,12 @@ [Defines] # =20 [Sources] - reset.c + ResetSystemLib.c =20 [Packages] MdePkg/MdePkg.dec Nt32Pkg/Nt32Pkg.dec =20 [LibraryClasses] - UefiBootServicesTableLib WinNtLib - UefiDriverEntryPoint DebugLib - -[Protocols] - gEfiResetArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED - -[Depex] - TRUE - diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc index fa3446be06..00848907cf 100644 --- a/Nt32Pkg/Nt32Pkg.dsc +++ b/Nt32Pkg/Nt32Pkg.dsc @@ -167,6 +167,7 @@ [LibraryClasses] CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/C= puExceptionHandlerLibNull.inf LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + ResetSystemLib|Nt32Pkg/Library/ResetSystemLib/ResetSystemLib.inf !if $(TLS_ENABLE) =3D=3D TRUE OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf !else @@ -394,7 +395,7 @@ [Components] } Nt32Pkg/MetronomeDxe/MetronomeDxe.inf Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf - Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf index ffa4b0a4a5..e03999b0cb 100644 --- a/Nt32Pkg/Nt32Pkg.fdf +++ b/Nt32Pkg/Nt32Pkg.fdf @@ -200,7 +200,7 @@ [FV.FvRecovery] INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf INF Nt32Pkg/MetronomeDxe/MetronomeDxe.inf INF Nt32Pkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf -INF Nt32Pkg/ResetRuntimeDxe/ResetRuntimeDxe.inf +INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf diff --git a/Nt32Pkg/ResetRuntimeDxe/reset.c b/Nt32Pkg/ResetRuntimeDxe/rese= t.c deleted file mode 100644 index 468f7128fb..0000000000 --- a/Nt32Pkg/ResetRuntimeDxe/reset.c +++ /dev/null @@ -1,126 +0,0 @@ -/**@file - -Copyright (c) 2006, Intel Corporation. All rights reserved.
-This program and the accompanying materials =20 -are licensed and made available under the terms and conditions of the BSD = License =20 -which accompanies this distribution. The full text of the license may be = found at =20 -http://opensource.org/licenses/bsd-license.php = =20 - = =20 -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, = =20 -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. =20 - -Module Name: - - Reset.c - -Abstract: - - Reset Architectural Protocol as defined in Tiano under NT Emulation - -**/ - -#include -#include -#include -#include -#include -#include -#include - - -EFI_STATUS -EFIAPI -InitializeNtReset ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -VOID -EFIAPI -WinNtResetSystem ( - IN EFI_RESET_TYPE ResetType, - IN EFI_STATUS ResetStatus, - IN UINTN DataSize, - IN VOID *ResetData OPTIONAL - ); - - -EFI_STATUS -EFIAPI -InitializeNtReset ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - -Routine Description: - - -Arguments: - - ImageHandle of the loaded driver - Pointer to the System Table - -Returns: - - Status ---*/ -// TODO: SystemTable - add argument and description to function comment -{ - EFI_STATUS Status; - EFI_HANDLE Handle; - - SystemTable->RuntimeServices->ResetSystem =3D WinNtResetSystem; - - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiResetArchProtocolGuid, - NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -VOID -EFIAPI -WinNtResetSystem ( - IN EFI_RESET_TYPE ResetType, - IN EFI_STATUS ResetStatus, - IN UINTN DataSize, - IN VOID *ResetData OPTIONAL - ) -/*++ - -Routine Description: - - TODO: Add function description - -Arguments: - - ResetType - TODO: add argument description - ResetStatus - TODO: add argument description - DataSize - TODO: add argument description - ResetData - TODO: add argument description - -Returns: - - EFI_SUCCESS - TODO: Add description for return value - ---*/ -{ - // - // BUGBUG Need to kill all console windows later - // - // - // Discard ResetType, always return 0 as exit code - // - gWinNt->ExitProcess (0); - - // - // Should never go here - // - ASSERT (FALSE); -} --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel