From patchwork Wed Apr 29 18:22:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 47749 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 003182121F for ; Wed, 29 Apr 2015 18:22:39 +0000 (UTC) Received: by wiun10 with SMTP id n10sf16245261wiu.1 for ; Wed, 29 Apr 2015 11:22:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=lAyeLHLXXQTrahvHqXyDgKOv6kng5FP2imncNdIPHtY=; b=LvEGF95hIcR7r4jRSpXVoi63ENkoHemys7oe3q2AoMQdLmqKfF/3sSKFXwHsFw2dBp AfyVtuPLOJYvZpO5uDy9MKcXATYy5zoN+ESnoAwPBRUTqvV+kBLdOvI3lED8SHNQPx13 VVWc4bmpjOj+wxv0oPIIj8sb/7+a6eojfpGCG3uWkMRNHKhHLWHTfcXt8VhL7xMlxuQT AgWRskVtyaSZMnDnPeSFpvl9+34DFvcFJ+bwXlPPJdgmM3uEAmU2gNGZplGyfk199K8o HY5y0dB9ypS3ChohqeZfGPI/kBEGo81+jQAPSg+WqgKK35zcQZP4us59c711D1rmQqBI 1uFA== X-Gm-Message-State: ALoCoQntTK+JMdrmnmYG8hnsvSbNO2H9a5atT9st32hdAscSer5LkmgLgtxQ3WTzLLs6GnDrd354 X-Received: by 10.180.88.226 with SMTP id bj2mr13792982wib.7.1430331759343; Wed, 29 Apr 2015 11:22:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.98 with SMTP id ln2ls269211lac.61.gmail; Wed, 29 Apr 2015 11:22:39 -0700 (PDT) X-Received: by 10.152.6.105 with SMTP id z9mr323308laz.98.1430331759135; Wed, 29 Apr 2015 11:22:39 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id pz9si19938238lbb.92.2015.04.29.11.22.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 11:22:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbbqq2 with SMTP id qq2so26766692lbb.3 for ; Wed, 29 Apr 2015 11:22:39 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr316009lab.35.1430331758865; Wed, 29 Apr 2015 11:22:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp2669595lbt; Wed, 29 Apr 2015 11:22:37 -0700 (PDT) X-Received: by 10.50.178.138 with SMTP id cy10mr1134431igc.3.1430331757237; Wed, 29 Apr 2015 11:22:37 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id c18si2126423igr.39.2015.04.29.11.22.36 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 29 Apr 2015 11:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YnWct-0000lm-4h; Wed, 29 Apr 2015 18:22:27 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YnWcr-0000lg-Ps for edk2-devel@lists.sourceforge.net; Wed, 29 Apr 2015 18:22:25 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.47 as permitted sender) client-ip=74.125.82.47; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wg0-f47.google.com; Received: from mail-wg0-f47.google.com ([74.125.82.47]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YnWcq-0006Et-QT for edk2-devel@lists.sourceforge.net; Wed, 29 Apr 2015 18:22:25 +0000 Received: by wgyo15 with SMTP id o15so37607898wgy.2 for ; Wed, 29 Apr 2015 11:22:18 -0700 (PDT) X-Received: by 10.180.77.195 with SMTP id u3mr425490wiw.30.1430331738765; Wed, 29 Apr 2015 11:22:18 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id k2sm301924wix.4.2015.04.29.11.22.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Apr 2015 11:22:17 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, leif.lindholm@linaro.org, roy.franz@linaro.org, geoff@infradead.org, olivier.martin@arm.com Date: Wed, 29 Apr 2015 20:22:07 +0200 Message-Id: <1430331729-7367-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1430331729-7367-1-git-send-email-ard.biesheuvel@linaro.org> References: <1430331729-7367-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1YnWcq-0006Et-QT Subject: [edk2] [PATCH 1/3] ArmPlatformPkg: remove VExpress system clock from PL031 driver X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The PL031 RTC driver library is used by the implementation of the GetTime/SetTime Runtime Services. This is why it registers its MMIO registers as requiring runtime remapping. However, in some cases, it calls into the VExpress sysconfig library to access a platform specific battery backed clock, and the MMIO registers of that hardware block are not accessible at runtime. Furthermore, adding runtime remapping of those registers is problematic, since they control all kinds of system features like clocks and regulators, which means it needs to be accessible by the OS as well. So the only reasonable way around it is to remove the sysconfig accesses completely. If such functionality is still required at boot time, it will need to be readded to a boot-time specific clock driver instead. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- .../PL031RealTimeClockLib/PL031RealTimeClockLib.c | 31 +--------------------- .../PL031RealTimeClockLib.inf | 1 - 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c index 52ba48992b83..d31434e248ab 100644 --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -269,21 +268,7 @@ LibGetTime ( } // 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 = ArmPlatformSysConfigGet (SYS_CFG_RTC, &EpochSeconds); - if (Status == EFI_UNSUPPORTED) { - // Battery backed up hardware RTC does not exist, revert to PL031 - EpochSeconds = MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER); - Status = EFI_SUCCESS; - } else if (EFI_ERROR (Status)) { - // Battery backed up hardware RTC exists but could not be read due to error. Abort. - goto EXIT; - } else { - // Battery backed up hardware RTC exists and we read the time correctly from it. - // Now sync the PL031 to the new time. - MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds); - } + EpochSeconds = MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER); // Ensure Time is a valid pointer if (Time == NULL) { @@ -476,20 +461,6 @@ LibSetTime ( EpochSeconds -= SEC_PER_HOUR; } - // 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 backed-up - // RTC maintains the master time for the platform across reboots. - // - // If such RTC does not exist then the following function returns UNSUPPORTED. - Status = ArmPlatformSysConfigSet (SYS_CFG_RTC, EpochSeconds); - if ((EFI_ERROR (Status)) && (Status != EFI_UNSUPPORTED)){ - // Any status message except SUCCESS and UNSUPPORTED indicates a hardware failure. - goto EXIT; - } - - // Set the PL031 MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds); diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf index 3a98fc757e3d..ba8ece6f7306 100644 --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf @@ -34,7 +34,6 @@ UefiLib DebugLib PcdLib - ArmPlatformSysConfigLib DxeServicesTableLib UefiRuntimeLib