From patchwork Wed Nov 15 16:56:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 118983 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4547063qgn; Wed, 15 Nov 2017 08:57:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMZidnQbz4YSyqL7ARp5PKP4QaT0RTPMuHaqIOLHhXvQhTdYXgHELihRKikDN939H5NJeXpc X-Received: by 10.159.205.130 with SMTP id v2mr2312715plo.105.1510765042206; Wed, 15 Nov 2017 08:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510765042; cv=none; d=google.com; s=arc-20160816; b=HmE4KKGto13ol8SLbmtkyqRiaZ9lneIpgMvyKkVWHNN7u/CUqmnV1RaD1olsieKe7q HbRf0qWkuxy6Znvdcm7oRCeui4J0r1svGgAA7K77uTZEGC/q+spcATFW+uICtJzmNJjt GaGQxwUecCClzz8MbigBi/HGEQtN8ru1cqNLVt6TTOLPjyDXFCDwLTqXZ0wO12RMmaRH 5WskyUaF4PFt6Hzqf3v1nvVJLFCP9OuvY6aLUzunbZwYNMNYScyoAv0XxFQlUFKRNKSU jdMe/TJu4i+nAMKPRGVQZyopy1kKZTgdqD0Y61F6mkPF2f+OcHLTI3tjyhIzmTenQ9Di 4e3A== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=sWllmqMFrVfWpQFmvzv9zb+BEcOXKpcZqksbtHmb6d8=; b=pCm9dbUHO7Tu7opNC5DCrUzRw8kpZS0qWcxT45khga7RD0JYtJS8NTljKE7IV21ROj sFR3wcHysc8PpnfrISLb2kUk3uiD+jjmKrYHhYJjr97IAHx4ocUjjzIWk1gMtXdiDdcW yzHpnOLMk9PeQWKNwtKKT0OY8O7FLJno2QvZm/IC6TJ7lUaSh1L1folHfxSc/dPQxgbA FmulQt2IMwT4xFysP5pLG6fJ6spZ29M6fu5Be7+BsQh14nkUqtnGqj/jqoNUotSTt+IJ NHcFrAsXN1KfqfUR5wfSDx1XmibHuVgZO+f7kkR+BcT1NaeNwtjSOQAGjIaQrfKrrCp2 LPcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZQSy0Ol9; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id q10si20079207pfc.183.2017.11.15.08.57.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 08:57:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZQSy0Ol9; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 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 937D12035689A; Wed, 15 Nov 2017 08:52:58 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::22f; helo=mail-wm0-x22f.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com [IPv6:2a00:1450:400c:c09::22f]) (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 D207920356894 for ; Wed, 15 Nov 2017 08:52:56 -0800 (PST) Received: by mail-wm0-x22f.google.com with SMTP id t139so4372292wmt.1 for ; Wed, 15 Nov 2017 08:57:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uUUXAoZMD1uJYtVJXqWW4G0eWcMLD52krS0bm/GOEPg=; b=ZQSy0Ol9P9qiEux/EDh9RLovw8J7RxYeVFwSmKbYwYmDdNLbFXLObo4vXB1OTP9ETU 6KaeEJCK82kTiVDYNR9BIjXhnAFPbJz2a8mE3NsPYNQyJBiudxwTB5q+s0HYjcMWgx2h 282Ovx/UE46aBS4slgPmkTtckr0ZalaS4lihY= 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:in-reply-to :references; bh=uUUXAoZMD1uJYtVJXqWW4G0eWcMLD52krS0bm/GOEPg=; b=ogIvdprLa+FFJGuvFW0a6trbjltCm5rfzpIPsTdwauaI/XI0ZNcd/CI/DVbm5Tnykk tj5RHH51GxLBx+4x11h8UVB9OnBXJ0V6MInMjYxkwqbqCyMCpFH323psUBt/9+5W2ctl iSkVtlRRxzEeZapYoR4lJTlmdwZDcKdJvwXzwWPMIfLEVd4DhiDk6lG4mkgAAsCVucCd XlV/A2ZJd2ZrSZ6DyzxTkWSizLgObPT2yqevoQMygJqnpZqXG0TGxyi/EmsYgZxELfK4 Kc79nFYHukKlPAQmvSNXQlmw0d9DB0hxoODufdeoGdGswNyr5CAKZbOAs8Xhuxs+glEW B8iA== X-Gm-Message-State: AJaThX6eTPek63NV7pH+euY/r8GdaGomsBt26V9UpTHDXAxUCJVdvbWX Q0IWtpI+sZ0Q9j7d2kxzZbCGtTGNBco= X-Received: by 10.28.138.12 with SMTP id m12mr13357403wmd.134.1510765023903; Wed, 15 Nov 2017 08:57:03 -0800 (PST) Received: from localhost.localdomain ([160.167.170.128]) by smtp.gmail.com with ESMTPSA id p15sm5673089wre.24.2017.11.15.08.57.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 08:57:03 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Wed, 15 Nov 2017 16:56:26 +0000 Message-Id: <20171115165637.31118-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171115165637.31118-1-ard.biesheuvel@linaro.org> References: <20171115165637.31118-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 08/19] 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | 43 +++----------------- ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf | 1 - 2 files changed, 6 insertions(+), 38 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/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.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 @@ #include -#include - STATIC BOOLEAN mPL031Initialized = FALSE; STATIC EFI_EVENT mRtcVirtualAddrChangeEvent; STATIC UINTN mPL031RtcBase; @@ -133,6 +130,11 @@ LibGetTime ( EFI_STATUS Status = EFI_SUCCESS; UINT32 EpochSeconds; + // Ensure Time is a valid pointer + if (Time == NULL) { + return EFI_INVALID_PARAMETER; + } + // Initialize the hardware if not already done if (!mPL031Initialized) { Status = InitializePL031 (); @@ -141,27 +143,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. - return Status; - } 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); - } - - // Ensure Time is a valid pointer - if (Time == NULL) { - return EFI_INVALID_PARAMETER; - } + EpochSeconds = MmioRead32 (mPL031RtcBase + PL031_RTC_DR_DATA_REGISTER); // Adjust for the correct time zone // The timezone setting also reflects the DST setting of the clock @@ -235,19 +217,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. - return Status; - } - // 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 aa06a41d0b2a..a3e4f73e7d05 100644 --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf @@ -34,7 +34,6 @@ [LibraryClasses] UefiLib DebugLib PcdLib - ArmPlatformSysConfigLib DxeServicesTableLib TimeBaseLib UefiRuntimeLib