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::22a; helo=mail-wm0-x22a.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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) 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) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Cc: Ard Biesheuvel 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: [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: , X-List-Received-Date: Wed, 15 Nov 2017 13:02:45 -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 +++----------------- 1 file changed, 6 insertions(+), 37 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); -- 2.11.0