From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AGs4zMbtpy0fiGmYtvtG8m0Sy7tN7F3oJtBNcqhAt+v9WjW3YM8yd3figC/268jPwcrVbfaUi5Ok2A== 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 Cc: Ard Biesheuvel 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: [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: , X-List-Received-Date: Wed, 15 Nov 2017 16:52:57 -0000 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(-) 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 -- 2.11.0