From nobody Sat Apr 27 18:28:00 2024 Delivered-To: importer@patchew.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 1510751216692895.1594298066909; Wed, 15 Nov 2017 05:06:56 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 875D220355209; Wed, 15 Nov 2017 05:02:46 -0800 (PST) Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::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 684622034EE30 for ; Wed, 15 Nov 2017 05:02:44 -0800 (PST) Received: by mail-wm0-x22a.google.com with SMTP id 9so2857390wme.4 for ; Wed, 15 Nov 2017 05:06:53 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id s12sm50867809wrc.89.2017.11.15.05.06.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 05:06:50 -0800 (PST) X-Original-To: edk2-devel@lists.01.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; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::22a; helo=mail-wm0-x22a.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=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=NW9unjsl6uO3y8YoRXX4gOukWiSiHibEJOJlOlaGyhw=; b=TSspYkp58JOt8uxyD6q2EygR+l4l3KDEMvfo6g2LZ/VAI1NZokQGgWATwxLYhpZljo J7jfClv8I0hBZMISykPBPLpLE25lnsGKcEHtrp2tUmhT7kS1NmUwt0U+OcAw9ls9kDUd nQns+8tb0b0PaBrenkwtQf5/asOSXezzSgRs4= 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=NW9unjsl6uO3y8YoRXX4gOukWiSiHibEJOJlOlaGyhw=; b=ltksVrTY1ub7h+uSzUpuuYlg94P6jUAFFhMdsPVO4k5p+xfYDDPSa5T9nvzCO/2s2E 1TUjG9WnTHMCHs+bqsajaNRyAZfEk/osrJ6hB59Y0jpicEKcBU4ZzOqydMwZeZljdM6Q G2Edinua6gn43D48suW0G6Wr8hIUEu2PRoir/jX+x2A1e+BhxNUX85q0nCbQIlvRakie v6xBxz7c+HQG2LQuSS0iS8F7UGktU24jWeOwkoKvXLt2hdvzS8WfSABz4aIo8c0dH/+c EDe4i+Ncc2D7x5bFunu8pPBXRrp4ZQNvOBLhNw48rPjlzRX8cKdR5e2gWODps+z3kFBC 3tAQ== X-Gm-Message-State: AJaThX6GSFmpRLwtorLSGQr3c32bBXAOYvDLHtV/ttBiFVYn2q9mjvp/ rnsxyaq1mqChTPBWgbWJmCGuytbhlw8= X-Google-Smtp-Source: AGs4zMZj1Jb7KHD7UqEQuPPfpBu07p2LTLj6lG681kVze1ZV1abcORIroqCLlxyzYlCe+aw8K3GcSQ== X-Received: by 10.28.209.77 with SMTP id i74mr1174221wmg.53.1510751211366; Wed, 15 Nov 2017 05:06:51 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Wed, 15 Nov 2017 13:06:45 +0000 Message-Id: <20171115130645.31738-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 Subject: [edk2] [PATCH] ArmPlatformPkg/PL031RealTimeClockLib: drop ArmPlatformSysConfigLib reference 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: Ard Biesheuvel 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" The PL031 driver implements a VExpress/Juno specific hack to set the battery backed clock in addition to the PL031. However, none of the remaining VExpress based hardware we support in EDK2 actuall implements this feature so we can just remove it, and get rid of the cumbersome dependency on ArmPlatform.h. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | 43 = +++----------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeCloc= kLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib= .c index 459dcc0a0519..1334ad446cd9 100644 --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -38,8 +37,6 @@ =20 #include =20 -#include - STATIC BOOLEAN mPL031Initialized =3D FALSE; STATIC EFI_EVENT mRtcVirtualAddrChangeEvent; STATIC UINTN mPL031RtcBase; @@ -133,6 +130,11 @@ LibGetTime ( EFI_STATUS Status =3D EFI_SUCCESS; UINT32 EpochSeconds; =20 + // Ensure Time is a valid pointer + if (Time =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + // Initialize the hardware if not already done if (!mPL031Initialized) { Status =3D InitializePL031 (); @@ -141,27 +143,7 @@ LibGetTime ( } } =20 - // Snapshot the time as early in the function call as possible - // On some platforms we may have access to a battery backed up hardware = clock. - // If such RTC exists try to use it first. - Status =3D ArmPlatformSysConfigGet (SYS_CFG_RTC, &EpochSeconds); - if (Status =3D=3D EFI_UNSUPPORTED) { - // Battery backed up hardware RTC does not exist, revert to PL031 - EpochSeconds =3D MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTE= R); - Status =3D EFI_SUCCESS; - } else if (EFI_ERROR (Status)) { - // Battery backed up hardware RTC exists but could not be read due to = error. Abort. - return Status; - } else { - // Battery backed up hardware RTC exists and we read the time correctl= y from it. - // Now sync the PL031 to the new time. - MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds); - } - - // Ensure Time is a valid pointer - if (Time =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } + EpochSeconds =3D MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER); =20 // Adjust for the correct time zone // The timezone setting also reflects the DST setting of the clock @@ -235,19 +217,6 @@ LibSetTime ( EpochSeconds -=3D SEC_PER_HOUR; } =20 - // On some platforms we may have access to a battery backed up hardware = clock. - // - // If such RTC exists then it must be updated first, before the PL031, - // to minimise any time drift. This is important because the battery bac= ked-up - // RTC maintains the master time for the platform across reboots. - // - // If such RTC does not exist then the following function returns UNSUPP= ORTED. - Status =3D ArmPlatformSysConfigSet (SYS_CFG_RTC, EpochSeconds); - if ((EFI_ERROR (Status)) && (Status !=3D EFI_UNSUPPORTED)){ - // Any status message except SUCCESS and UNSUPPORTED indicates a hardw= are failure. - return Status; - } - // Set the PL031 MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds); =20 --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel