From nobody Sat May 4 01:03:35 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; dkim=fail; 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 149918844207032.71472885446997; Tue, 4 Jul 2017 10:14:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A08AC21C9E7A7; Tue, 4 Jul 2017 10:12:21 -0700 (PDT) Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id F224521C9E7A3 for ; Tue, 4 Jul 2017 10:12:19 -0700 (PDT) Received: by mail-wm0-x229.google.com with SMTP id 62so201909819wmw.1 for ; Tue, 04 Jul 2017 10:13:58 -0700 (PDT) Received: from mohikan.hemma.eciton.net (cpc92316-cmbg19-2-0-cust118.5-4.cable.virginm.net. [82.12.0.119]) by smtp.gmail.com with ESMTPSA id m123sm10296647wmb.3.2017.07.04.10.13.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 10:13:56 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=visnVZgcxImpexT0lr5vHcfGSphHw8o3+qMoHFTs4sg=; b=g/HvUaFZngHf5KzWMnTa17ISnC6c3Uj5C8BZO+6ewUj3Pj6vHaf77AuPRNiTEwQu+c CyrWMm3JxI4z45ueYi6TRWEbIYmcH2C6IygNyisnuRmvsXTXb8K3IHhVw5kkHZ/Z8wi0 idIsSDMMPFTjz3otQ4BrELLTgiW4AvHO/uSV8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=visnVZgcxImpexT0lr5vHcfGSphHw8o3+qMoHFTs4sg=; b=RV/YsYjI1FQsnvn/r7Ph28wQIoQKjexJl4DsEEvWVu7c1K5U3alMFqAI1OmdQ/mJ0s RqtGHJjz/4RvFRYtP5uY2TXs6sdrWoY+SGc9k2ykIcCqufZN3IRXsYFHyrGEOPMSCIeH QqMTrD/5R6DpS8UP1NHpApa5Y+goH8klOi7baQ0E7CHJfHy8FLQWPLA7YVYpvDGHQRSq y/WIACvKP5FrnymLihHcM/m6VTktKUZ6LZVMJORB+6lH/igwyiibaIXcQ68NTGQJt+pc 7w0kkxhO6yko42htXhZvRUXR3lyPFG4SiKNj5+iexPjqpiIjZNIF+gIa4CAoENs7m+WZ Jx3Q== X-Gm-Message-State: AIVw113/SlV0Y1JdgMyFpByFGPkC5Ud1wd4/7qiyKO/gi89am0ktts1F SHvvtXGJY5wCB9FoIEJNPQ== X-Received: by 10.28.97.86 with SMTP id v83mr7714896wmb.74.1499188436769; Tue, 04 Jul 2017 10:13:56 -0700 (PDT) From: Leif Lindholm To: edk2-devel@lists.01.org Date: Tue, 4 Jul 2017 18:11:55 +0100 Message-Id: <20170704171155.27302-1-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [edk2] [PATCH v2] ArmPlatformPkg: convert VExpress ResetSystemLib to ResetSystemLib 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: ryan.harkin@linaro.org, ard.biesheuvel@linaro.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since we're in the process of migrating all of the VExpress platforms to MdeModulePkg ResetSystemRuntimeDxe, convert VExpress ResetSystemLib from EfiResetSystemLib interface to the ResetSystemLib one. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm Reviewed-by: Ard Biesheuvel Tested-by: Ryan Harkin --- .../Library/ResetSystemLib/ResetSystemLib.c | 117 ++++++++++++-----= ---- .../Library/ResetSystemLib/ResetSystemLib.inf | 6 +- 2 files changed, 73 insertions(+), 50 deletions(-) diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSyst= emLib.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemL= ib.c index bafb6f8093..d2bc4a88fa 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c @@ -5,6 +5,7 @@ =20 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
Copyright (c) 2013, ARM Ltd. All rights reserved.
+ Copyright (c) 2017, Linaro Ltd. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -16,73 +17,95 @@ =20 **/ =20 -#include +#include =20 -#include -#include -#include #include +#include +#include =20 #include =20 /** - Resets the entire platform. + 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 is asynchronous to system operation and operates without regard to + cycle boundaries. =20 - @param ResetType The type of reset to perform. - @param ResetStatus The status code for the reset. - @param DataSize The size, in bytes, of WatchdogData. - @param ResetData For a ResetType of EfiResetCold, EfiResetW= arm, or - EfiResetShutdown the data buffer starts wi= th a Null-terminated - Unicode string, optionally followed by add= itional binary data. + If this function returns, it means that the system does not support cold + reset. +**/ +VOID +EFIAPI +ResetCold ( + VOID + ) +{ + ArmPlatformSysConfigSet (SYS_CFG_REBOOT, 0); +} + +/** + This function causes a system-wide initialization (warm reset), in which= all + processors are set to their initial state. Pending cycles are not corrup= ted. =20 + If this function returns, it means that the system does not support warm + reset. **/ -EFI_STATUS +VOID EFIAPI -LibResetSystem ( - IN EFI_RESET_TYPE ResetType, - IN EFI_STATUS ResetStatus, - IN UINTN DataSize, - IN CHAR16 *ResetData OPTIONAL +ResetWarm ( + VOID ) { - switch (ResetType) { - case EfiResetPlatformSpecific: - // Map the platform specific reset as reboot - case EfiResetWarm: - // Map a warm reset into a cold reset - case EfiResetCold: - // Send the REBOOT function to the platform microcontroller - ArmPlatformSysConfigSet (SYS_CFG_REBOOT, 0); - - // We should never be here - while(1); - case EfiResetShutdown: - // Send the SHUTDOWN function to the platform microcontroller - ArmPlatformSysConfigSet (SYS_CFG_SHUTDOWN, 0); - - // We should never be here - while(1); - } - - ASSERT(FALSE); - return EFI_UNSUPPORTED; + ResetCold (); } =20 /** - Initialize any infrastructure required for LibResetSystem () to function. + This function causes the system to enter a power state equivalent + 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 + ) +{ + ArmPlatformSysConfigSet (SYS_CFG_SHUTDOWN, 0); +} =20 - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. +/** + This function causes the system to enter S3 and then wake up immediately. =20 - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + If this function returns, it means that the system does not support S3 + feature. +**/ +VOID +EFIAPI +EnterS3WithImmediateWake ( + VOID + ) +{ + // not implemented +} =20 +/** + 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. **/ -EFI_STATUS +VOID EFIAPI -LibInitializeResetSystem ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable +ResetPlatformSpecific ( + IN UINTN DataSize, + IN VOID *ResetData ) { - return EFI_SUCCESS; + ResetCold (); } diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSyst= emLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSyste= mLib.inf index 8c17ea8cdb..780636c1de 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.i= nf +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.i= nf @@ -2,6 +2,7 @@ # Reset System lib to make it easy to port new platforms # # Copyright (c) 2008, Apple Inc. All rights reserved.
+# Copyright (c) 2017, Linaro Ltd. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -19,17 +20,16 @@ FILE_GUID =3D 36885202-0854-4373-bfd2-95d229b44d44 MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D EfiResetSystemLib + LIBRARY_CLASS =3D ResetSystemLib =20 [Sources.common] ResetSystemLib.c =20 [Packages] + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec - EmbeddedPkg/EmbeddedPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec =20 [LibraryClasses] DebugLib - BaseLib ArmPlatformSysConfigLib --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel