From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 7BBFB209455EE for ; Tue, 4 Jul 2017 04:44:45 -0700 (PDT) Received: by mail-wm0-x236.google.com with SMTP id z75so44124817wmc.0 for ; Tue, 04 Jul 2017 04:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=17uDpM/cNpwxzt90gwzkobvI0UG2Amfjf1RfXXHzyNI=; b=J3Kw9Omnkh/GPHj4zEf3LlFP0082GP6XfGV7UOBHYgUiwIGnZAmnTvZjE/IT9YTJaR +cjbu4pJ4aErm/tqoK6iAgNp+T/eBfXf+SPId40u08LdJbNYUcAGQ0QnQCr2GYHdp8RJ qeDncG6SeRk1a1XWgDRWY0r+yxPW9MLeuQtYw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=17uDpM/cNpwxzt90gwzkobvI0UG2Amfjf1RfXXHzyNI=; b=iBrl1VU90RapRssKYNW/WqqhkC1oV57pf/J6lgdJuDliN/Q0xZT7djxdzyadtQGSsP kui6zqqRks+ePdZ20gBGt8byuhge5MMH+7aJFosOlfPBf5jhGdic4kOstOnUIo7uDues WjDj2XgvV4KwtwFgNkcAvt+jIBmgU2WBwIkXWDupJDy4C9QtYaReJLNmZkyf9/ddhZXt u/IEjyHPYczuHUkXyvzfjMJIpU5YjWjI5np3JoCej23jkCrHg7BWYmGzD8XKgErM+0kl AUN0aQvf6xgR863isMfY4DSA19iUC9VaMR9jFJ9w67J6gBDaL218nlfCRmB5+Tkr+qsh wAgg== X-Gm-Message-State: AIVw1126xO07SMZjMPa+JDirXi+23BIx3vSsb6jguAXbb0NERrTu0Ciy C+KfegDwcD0a/7tm X-Received: by 10.28.136.4 with SMTP id k4mr17712313wmd.4.1499168782236; Tue, 04 Jul 2017 04:46:22 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id l70sm18340501wmd.3.2017.07.04.04.46.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 04:46:21 -0700 (PDT) Date: Tue, 4 Jul 2017 12:46:20 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" , Ryan Harkin Message-ID: <20170704114620.GO26676@bivouac.eciton.net> References: <20170704112911.24114-1-leif.lindholm@linaro.org> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [PATCH] 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: , X-List-Received-Date: Tue, 04 Jul 2017 11:44:46 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 04, 2017 at 12:35:34PM +0100, Ard Biesheuvel wrote: > On 4 July 2017 at 12:29, Leif Lindholm wrote: > > 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 > > --- > > .../Library/ResetSystemLib/ResetSystemLib.c | 118 ++++++++++++--------- > > .../Library/ResetSystemLib/ResetSystemLib.inf | 4 +- > > 2 files changed, 72 insertions(+), 50 deletions(-) > > > > diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c > > index bafb6f8093..45bb0ab848 100644 > > --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c > > +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.c > > @@ -5,6 +5,7 @@ > > > > 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.
> > > > This program and the accompanying materials > > are licensed and made available under the terms and conditions of the BSD License > > @@ -16,73 +17,92 @@ > > > > **/ > > > > -#include > > +#include > > > > -#include > > #include > > -#include > > -#include > > - > > -#include > > Don't we need some of these for the definitions of > ArmPlatformSysConfigSet and SYS_CFG_REBOOT? Yes, I messed up the corresponding changes in OpenPlatformPkg for the build test... Thanks. Update coming. > > +#include > > > > /** > > - 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. > > > > - @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, EfiResetWarm, or > > - EfiResetShutdown the data buffer starts with a Null-terminated > > - Unicode string, optionally followed by additional 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 corrupted. > > + > > + 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 (); > > } > > > > /** > > - 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. > > > > - @param ImageHandle The firmware allocated handle for the EFI image. > > - @param SystemTable A pointer to the EFI System Table. > > + If this function returns, it means that the system does not support shut down reset. > > +**/ > > +VOID > > +EFIAPI > > +ResetShutdown ( > > + VOID > > + ) > > +{ > > + ArmPlatformSysConfigSet (SYS_CFG_SHUTDOWN, 0); > > +} > > > > - @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > > +/** > > + 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 > > + feature. > > +**/ > > +VOID > > +EFIAPI > > +EnterS3WithImmediateWake ( > > + VOID > > + ) > > +{ > > + // not implemented > > +} > > > > +/** > > + 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 ResetData > > + 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 string, > > + 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/ResetSystemLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf > > index 8c17ea8cdb..bb87df50ef 100644 > > --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf > > +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ResetSystemLib/ResetSystemLib.inf > > @@ -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 BSD License > > @@ -19,12 +20,13 @@ > > FILE_GUID = 36885202-0854-4373-bfd2-95d229b44d44 > > MODULE_TYPE = BASE > > VERSION_STRING = 1.0 > > - LIBRARY_CLASS = EfiResetSystemLib > > + LIBRARY_CLASS = ResetSystemLib > > > > [Sources.common] > > ResetSystemLib.c > > > > [Packages] > > + MdeModulePkg/MdeModulePkg.dec > > MdePkg/MdePkg.dec > > EmbeddedPkg/EmbeddedPkg.dec > > Do we still need this? Unlikely. > > ArmPlatformPkg/ArmPlatformPkg.dec > > ... and this, given my question above? Probably. / Leif