From patchwork Wed Apr 13 08:10:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 65692 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2366025qge; Wed, 13 Apr 2016 01:10:29 -0700 (PDT) X-Received: by 10.66.149.194 with SMTP id uc2mr11220264pab.116.1460535029403; Wed, 13 Apr 2016 01:10:29 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id ey12si4127564pac.203.2016.04.13.01.10.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Apr 2016 01:10:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8CC321A2022; Wed, 13 Apr 2016 01:10:28 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: 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 6AF361A1FB4 for ; Wed, 13 Apr 2016 01:10:27 -0700 (PDT) Received: by mail-wm0-x22f.google.com with SMTP id n3so62468567wmn.0 for ; Wed, 13 Apr 2016 01:10:27 -0700 (PDT) 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=7gM38AXRl3xHeC8uBs69p3NKVD0yes8BrD0Afkun+sE=; b=BqOXlsjQlAtnAwLksN+Ryg4hrTigcXZycwL4OQgt3knRpKlf+Y8K02wvPlk0c3i6nQ F9rbtBGO7r0Su9oKmkYiq1OfEiLau4kxp3zcNBtCMrO3UL/aZ9hB0J5bmt6eGb9s0F6X U7+9LyVc8gnaRJHmoZ5rnpJ+g/tk0fitKZ/do= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7gM38AXRl3xHeC8uBs69p3NKVD0yes8BrD0Afkun+sE=; b=fBBg5VWfJFNRCjAO7kLYdLXi9++iOR/kvDMr99Zib74pI2JFSxy5EMpcVKbFSHGa5I t9c8KFv8/VJjw1Zel0bg1wRTR7PXIYReUkmzc8wYf1qYbWCXjyufwT6KFuPsmPlnHnSA Wjyuh8aUV4Duw1UTe0gGAuvKwtMFzm3jk3l5TPm7/eQ09pvH9AXzp97y5Oq4KFcbuJFu K3RyZX2JsyUzCr4t2wNh/0obYZc1NqPUH5iKRvNfj0L/hq8gliyrDV9Zh+TqqzEZ+q3I dDb5zJoKVnWtlS0QmZgCkYqvHpydhtrZkA2nvG+rImuJG1nS5DV+U84qu4u85d4Rv3Fz i7Zw== X-Gm-Message-State: AOPr4FVngNR9bUgtO5eg7GEiMFfmOvmvHg+ceI7/QO3L//IUJ9Fxw0Xrk28yuXMz9O8rk5TC X-Received: by 10.194.158.226 with SMTP id wx2mr7971064wjb.91.1460535026142; Wed, 13 Apr 2016 01:10:26 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id s10sm34475702wjp.3.2016.04.13.01.10.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Apr 2016 01:10:25 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Wed, 13 Apr 2016 10:10:20 +0200 Message-Id: <1460535020-3044-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460535020-3044-1-git-send-email-ard.biesheuvel@linaro.org> References: <1460535020-3044-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 2/2] ArmPlatformPkg/PL031RealTimeClockLib: remove local copy of gRT pointer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Since the only reason for keeping a local copy mRT of the gRT pointer is to be able to call GetVariable/SetVariable at runtime, use the UefiRuntimeLib helpers instead, so that we can drop mRT altogether. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) -- 2.5.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 516b45675c69..4aa448b528ed 100644 --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c @@ -43,7 +43,6 @@ STATIC CONST CHAR16 mDaylightVariableName[] = L"PL031RtcDaylight"; STATIC BOOLEAN mPL031Initialized = FALSE; STATIC EFI_EVENT mRtcVirtualAddrChangeEvent; STATIC UINTN mPL031RtcBase; -STATIC EFI_RUNTIME_SERVICES *mRT; EFI_STATUS IdentifyPL031 ( @@ -293,7 +292,7 @@ LibGetTime ( // Get the current time zone information from non-volatile storage Size = sizeof (TimeZone); - Status = mRT->GetVariable ( + Status = EfiGetVariable ( (CHAR16 *)mTimeZoneVariableName, &gEfiCallerIdGuid, NULL, @@ -311,7 +310,7 @@ LibGetTime ( // The time zone variable does not exist in non-volatile storage, so create it. Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE; // Store it - Status = mRT->SetVariable ( + Status = EfiSetVariable ( (CHAR16 *)mTimeZoneVariableName, &gEfiCallerIdGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, @@ -345,7 +344,7 @@ LibGetTime ( // Get the current daylight information from non-volatile storage Size = sizeof (Daylight); - Status = mRT->GetVariable ( + Status = EfiGetVariable ( (CHAR16 *)mDaylightVariableName, &gEfiCallerIdGuid, NULL, @@ -363,7 +362,7 @@ LibGetTime ( // The daylight variable does not exist in non-volatile storage, so create it. Time->Daylight = 0; // Store it - Status = mRT->SetVariable ( + Status = EfiSetVariable ( (CHAR16 *)mDaylightVariableName, &gEfiCallerIdGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, @@ -497,7 +496,7 @@ LibSetTime ( // Do this after having set the RTC. // Save the current time zone information into non-volatile storage - Status = mRT->SetVariable ( + Status = EfiSetVariable ( (CHAR16 *)mTimeZoneVariableName, &gEfiCallerIdGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, @@ -515,7 +514,7 @@ LibSetTime ( } // Save the current daylight information into non-volatile storage - Status = mRT->SetVariable ( + Status = EfiSetVariable ( (CHAR16 *)mDaylightVariableName, &gEfiCallerIdGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, @@ -608,7 +607,6 @@ LibRtcVirtualNotifyEvent ( // runtime calls will be made in virtual mode. // EfiConvertPointer (0x0, (VOID**)&mPL031RtcBase); - EfiConvertPointer (0x0, (VOID**)&mRT); return; } @@ -650,8 +648,6 @@ LibRtcInitialize ( return Status; } - mRT = gRT; - // Install the protocol Handle = NULL; Status = gBS->InstallMultipleProtocolInterfaces (