From patchwork Tue Jul 4 11:29:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 106943 Delivered-To: patch@linaro.org Received: by 10.182.135.102 with SMTP id pr6csp920877obb; Tue, 4 Jul 2017 04:31:17 -0700 (PDT) X-Received: by 10.99.97.69 with SMTP id v66mr14999554pgb.217.1499167877643; Tue, 04 Jul 2017 04:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499167877; cv=none; d=google.com; s=arc-20160816; b=d61KWT7xnhmWag+VPmgXqFHuODcZlMxD1tEBHnI8CxAdpV3X8TJ4TR2qgW2N4+Vf8S K2/i9XLUA83LB4SrcDHovV34NkR77jv59OmtclEGPh7K39q0E2LxvVi8etfAS+5xqrlO QmiHYOxWEcTNsS7odU/+qF85nj2dveIpVnovnigx/6hQysAwRULFnRQlbVw7gqOipEZN 3i/g2tkChfQwBAUClmpn9U3hOrliXYgSGzsg0Gdz+NrfZDfi0fhbJ8QRUW8lEUqHw0z8 xqksG+IbmnAt3E12vaIPhjz+wYVIDT1cjQo3TfEn6Cx/rUQjgZFf7Xm+AtEdFCPFjcui N86Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=wPg/3KrjbfZrJ4dpxkxsDQ+/HoGYLFZAf15tMyQtwjc=; b=PPXOmKK7/lWRyHyI3yxU2VmR/ifpfI9goDWNvy2VWm5I48AwAQi8HJQtlpfcH4wbWi HnZ0Rmtl4nrrNQODNbQyZzPucBpBClG3FunPbJrJnHYB0t7qy7wT0rRYH55GQyBnEtNI QVj/ANmGvQ5dPEd+XcEErxw0TfAPa01g7BfvkBO7a4Bru+xpKD8v5G0bpRriVr/wSCDA L2vHUXnFl2B3uwa27GOM3JAWB4N5B2yhEYoUmBfzs8VgYxGor1yJdEUdOV19KPA/SUla NXl0ua0QKAYs+5ovEM88KTAi8IU8w/I9R78k4NwrwJU3kzWJ34VME9f45nJik/cS+b9n RXLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=EQFPaHlL; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id l10si14365648pfe.4.2017.07.04.04.31.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 04:31:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=EQFPaHlL; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 989D821A00AC9; Tue, 4 Jul 2017 04:29:38 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wr0-x22a.google.com (mail-wr0-x22a.google.com [IPv6:2a00:1450:400c:c0c::22a]) (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 87384209455EA for ; Tue, 4 Jul 2017 04:29:36 -0700 (PDT) Received: by mail-wr0-x22a.google.com with SMTP id k67so246971284wrc.2 for ; Tue, 04 Jul 2017 04:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=8EpS3jWZuuFsS8Vxp3qFwgsdYecTIpq3Beiz6n49qXM=; b=EQFPaHlLs9CCADbiGow3HjYlHGWwhTQ4OpJVzBPSshuDnSFvEuCEHsay1ZclJBHxRJ nBKmSSATbrrBNDlZD/pYzIxHjV36xzE2snS7BgkHv1URsDwiG0mbMXvFs6ScoI2v9+xv 4M3PGKYc/YX4ych2+CjERzojgELjVzkkvZbgc= 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=8EpS3jWZuuFsS8Vxp3qFwgsdYecTIpq3Beiz6n49qXM=; b=jquQayZFe4o1LoEafJ1n6AGP7YxoNwr1ZhWNPFoVOKlkHPjThFnRcjQptHKKyVSJZq UUZRefu9p4YoVs7tGnlkO3UCW8BF+7tbGjM1uj/pdlWXqYg1rhDMvB6klV1wA4yWITN0 /mrzeQim5Gqvj6ecw+J264rLcEnBMJvKCePha+//8j9ziA3Owh6U878WWWTq4QSbnB2M 6vJMAasfAce/JHN99D/FUFhe2p2qf2sQduURVPOOGWY9zsJgOV6zbayM0WscWWdnvJnH Eq54tDPtsVY7dKAjJ774q4nyhhdnbD5duwcBQP5wn2NP9Tbj+g+a+mkwnqchC8Gpt+RB a+ag== X-Gm-Message-State: AKS2vOxS+mL57Om25UplOK6BYY6sBIXOHr/HvabA7tL7453TAU1yUDfN VJkaXgIB11EdhCe3Y4wcrw== X-Received: by 10.223.142.66 with SMTP id n60mr36660920wrb.188.1499167872977; Tue, 04 Jul 2017 04:31:12 -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 f45sm32944933wrf.2.2017.07.04.04.31.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jul 2017 04:31:12 -0700 (PDT) From: Leif Lindholm To: edk2-devel@lists.01.org Date: Tue, 4 Jul 2017 12:29:11 +0100 Message-Id: <20170704112911.24114-1-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [edk2] [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: , Cc: ryan.harkin@linaro.org, ard.biesheuvel@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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 +#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 ArmPlatformPkg/ArmPlatformPkg.dec