From nobody Thu May 16 10:22:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109836+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109836+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697804354; cv=none; d=zohomail.com; s=zohoarc; b=C2bFxS7/rPZJNGeW/OzmYgXT9fHW+YtHwVk0N4clOvXiAoBH8AfZfEBteW+38jHiwfBE7EDAgW11Sx8FeSmyUQ02c4Q+TRHbsp5oi0T9U01vna+TEOS0M3QtpW3u0T8aeGTf0BP7fEsL1N6thU5qRlgs+FZcRY/UF3AWEUWp+dw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697804354; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=rlK24aMYUCE15qQhsKEAVb/9Zd+2NIMR9WNZ+EKDMpM=; b=LtTSEvdkGsELElE9TRVz4W45W35hCOzFDWqmWZ3kTQetb/M/QsjOZPNS0VgMajI4ZGPp9vwcSYIShKj2M8XIpumX5wGm6lCsEoxTMiEEBaNRwnimTCFIoKnzOjPJ7+FPwTwz/TxpHwbD8rXG10v/QqajWgR1OXbNNwd80elkD1s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109836+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697804354100324.44731167957525; Fri, 20 Oct 2023 05:19:14 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=rlK24aMYUCE15qQhsKEAVb/9Zd+2NIMR9WNZ+EKDMpM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1697804353; v=1; b=ea3pNgvrXuHfk1ha3VwsIB3E3SjrqOKsuncJk7BK0qsQbiKOTq5ing0XCAB2gIAY0iBmiCt0 IAERTsaw/JbwPlPv59emU7bFsWC8Dl5YcMdmyWdddYdtGbbO248nvITAbMyrW9jh/IdxNxYF1a5 lTkpDU3QIOyDpY8hWzDuNmvU= X-Received: by 127.0.0.2 with SMTP id sqt5YY1788612xTPDSYPkYuJ; Fri, 20 Oct 2023 05:19:13 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.52928.1697804352989004577 for ; Fri, 20 Oct 2023 05:19:13 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-t5r6_grqPs2bfoHIeEXfiw-1; Fri, 20 Oct 2023 08:19:09 -0400 X-MC-Unique: t5r6_grqPs2bfoHIeEXfiw-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AC4F5185A797; Fri, 20 Oct 2023 12:19:08 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.194.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8D85503B; Fri, 20 Oct 2023 12:19:07 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Wenyi Xie Subject: [edk2-devel] [edk2-platforms PATCH 1/7] Hisilicon/DS3231RealTimeClockLib: remove superfluous instance init steps Date: Fri, 20 Oct 2023 14:18:57 +0200 Message-Id: <20231020121903.44986-2-lersek@redhat.com> In-Reply-To: <20231020121903.44986-1-lersek@redhat.com> References: <20231020121903.44986-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: OSnf4z6bVLKulyerbYWSHENex1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697804354330100001 Content-Type: text/plain; charset="utf-8"; x-default="true" RealTimeClockLib instances are consumed by edk2's EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function InitializeRealTimeClock(), the driver: (1) calls LibRtcInitialize(), (2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services to its own similarly-named functions -- where those functions wrap the corresponding RealTimeClockLib APIs, (3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol interface. Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through II-9.7.2.7. However, this means that LibRtcInitialize() (of any RealTimeClockLib instance) should not itself (a) set the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be overwritten in step (2) anyway, and step (3) will uselessly install a second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in the protocol database. (The protocol only serves to notify the DXE Foundation about said runtime services being available.) Clean up Hisilicon/DS3231RealTimeClockLib accordingly. (Note that the lib instance INF file already does not list UefiBootServicesTableLib, UefiRuntimeServicesTableLib, and gEfiRealTimeClockArchProtocolGuid.) Build-tested only (with the D03 and D05 platforms). Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Wenyi Xie Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4565 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel --- Platform/Hisilicon/D03/Library/DS3231RealTimeClockLib/DS3231RealTimeClockL= ib.c | 27 +++----------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/Platform/Hisilicon/D03/Library/DS3231RealTimeClockLib/DS3231Re= alTimeClockLib.c b/Platform/Hisilicon/D03/Library/DS3231RealTimeClockLib/DS= 3231RealTimeClockLib.c index 3a84b6e9297b..be143c47577b 100644 --- a/Platform/Hisilicon/D03/Library/DS3231RealTimeClockLib/DS3231RealTimeC= lockLib.c +++ b/Platform/Hisilicon/D03/Library/DS3231RealTimeClockLib/DS3231RealTimeC= lockLib.c @@ -25,11 +25,8 @@ #include #include #include -#include -#include #include #include -#include #include #include "DS3231RealTimeClock.h" #include @@ -433,19 +430,9 @@ LibRtcInitialize ( ) { EFI_STATUS Status; - EFI_HANDLE Handle; - - EFI_TIME EfiTime; =20 - // Setup the setters and getters - gRT->GetTime =3D LibGetTime; - gRT->SetTime =3D LibSetTime; - gRT->GetWakeupTime =3D LibGetWakeupTime; - gRT->SetWakeupTime =3D LibSetWakeupTime; - - - (VOID)gRT->GetTime (&EfiTime, NULL); + (VOID)LibGetTime (&EfiTime, NULL); if((EfiTime.Year < 2015) || (EfiTime.Year > 2099)){ EfiTime.Year =3D 2015; EfiTime.Month =3D 1; @@ -454,20 +441,12 @@ LibRtcInitialize ( EfiTime.Minute =3D 0; EfiTime.Second =3D 0; EfiTime.Nanosecond =3D 0; - Status =3D gRT->SetTime(&EfiTime); + Status =3D LibSetTime(&EfiTime); if (EFI_ERROR(Status)) { DEBUG((EFI_D_ERROR, "[%a]:[%dL] Status : %r\n", __FUNCTION__, __LI= NE__, Status)); } } =20 - // Install the protocol - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, NULL, - NULL - ); - - return Status; + return EFI_SUCCESS; } -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109836): https://edk2.groups.io/g/devel/message/109836 Mute This Topic: https://groups.io/mt/102079654/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 10:22:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109840+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109840+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697804361; cv=none; d=zohomail.com; s=zohoarc; b=KCZJUY3lNh7trsLh4WiXdLKza5XUwZME/i3lUmoWtr5vXw+ol5bwl9Lr5+UtPfHxdp5/KxeAtFjtITftfE5QXO6euJa8vqccS44brNwzr+1OtcrpVrJHZ6aC84fjRJYjEQsudet9U0vJN55FVQiGEOejIX5YZSLRp4sSas/DWdY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697804361; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=nsUhLbbQ79ThVPawhw1k6Nj+Fp1yqbRMxr6l8yLCzIY=; b=YKNcTkgbSCVzraHDJD8HoRCb53/6LcKsZk+8cjk2d91xvDQIPKwV2IHISJHiEWnq//ddkRHKPfQ944dsWhlDDuHKf1GWrgVhb+jJ5MpolS2ptvtDs9LVfLRXVjShUfT8bsLxdd5h7MYjZmwhcGaCxNQZJk12Nut0rKE/sD2Lxz0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109840+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16978043611321018.4599397662827; Fri, 20 Oct 2023 05:19:21 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=nsUhLbbQ79ThVPawhw1k6Nj+Fp1yqbRMxr6l8yLCzIY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1697804360; v=1; b=gy28T8e/mfweO63N7ruspzxTtp/3ZY6z+aE9afEvVsJeJ9lZKJBSCuqUsAVxAyrnjOw8hb5D lpNZtMZ0GIsMZ0IeFVkhrM3BcP0xxy48TjkSp1FmN4TkY7DasvF5sMzhTbRKuTeZwPwuowCnGvC NV3GubhblYqbdDyE/fqq6YfY= X-Received: by 127.0.0.2 with SMTP id 4X9xYY1788612xM1PlTYlyGy; Fri, 20 Oct 2023 05:19:20 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.52933.1697804360107108132 for ; Fri, 20 Oct 2023 05:19:20 -0700 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-220-xVHkFKkYNG-NSZJlrApD7A-1; Fri, 20 Oct 2023 08:19:11 -0400 X-MC-Unique: xVHkFKkYNG-NSZJlrApD7A-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 50D1D29A9D3F; Fri, 20 Oct 2023 12:19:11 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.194.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D3A2503B; Fri, 20 Oct 2023 12:19:10 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Bibo Mao , Chao Li , Xianglai li Subject: [edk2-devel] [edk2-platforms PATCH 2/7] LoongArchQemuPkg/LsRealTimeClockLib: remove superfluous instance init steps Date: Fri, 20 Oct 2023 14:18:58 +0200 Message-Id: <20231020121903.44986-3-lersek@redhat.com> In-Reply-To: <20231020121903.44986-1-lersek@redhat.com> References: <20231020121903.44986-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ca4391Mb1pXIXW91Yc5oLHHux1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697804362340100017 Content-Type: text/plain; charset="utf-8"; x-default="true" RealTimeClockLib instances are consumed by edk2's EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function InitializeRealTimeClock(), the driver: (1) calls LibRtcInitialize(), (2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services to its own similarly-named functions -- where those functions wrap the corresponding RealTimeClockLib APIs, (3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol interface. Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through II-9.7.2.7. However, this means that LibRtcInitialize() (of any RealTimeClockLib instance) should not itself (a) set the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be overwritten in step (2) anyway, and step (3) will uselessly install a second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in the protocol database. (The protocol only serves to notify the DXE Foundation about said runtime services being available.) Clean up LoongArchQemuPkg/LsRealTimeClockLib accordingly. (Note that the lib instance INF file already does not list UefiRuntimeServicesTableLib.) Build-tested only (with "Loongson.dsc"). Cc: Bibo Mao Cc: Chao Li Cc: Xianglai li Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4565 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel Reviewed-by: Chao Li --- Notes: context:-W Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealTimeCl= ockLib.inf | 3 --- Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealTimeCl= ockLib.c | 16 ---------------- 2 files changed, 19 deletions(-) diff --git a/Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/= LsRealTimeClockLib.inf b/Platform/Loongson/LoongArchQemuPkg/Library/LsRealT= imeClockLib/LsRealTimeClockLib.inf index 5aa95650f8ba..c5ab1a702167 100644 --- a/Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealT= imeClockLib.inf +++ b/Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealT= imeClockLib.inf @@ -40,8 +40,5 @@ [Pcd] [Guids] gEfiEventVirtualAddressChangeGuid =20 -[Protocols] - gEfiRealTimeClockArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED - [Depex] TRUE diff --git a/Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/= LsRealTimeClockLib.c b/Platform/Loongson/LoongArchQemuPkg/Library/LsRealTim= eClockLib/LsRealTimeClockLib.c index eeac011a9400..954589ecb328 100644 --- a/Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealT= imeClockLib.c +++ b/Platform/Loongson/LoongArchQemuPkg/Library/LsRealTimeClockLib/LsRealT= imeClockLib.c @@ -1,30 +1,28 @@ /** @file Implement EFI RealTimeClock runtime services via RTC Lib. =20 Copyright (c) 2022, Loongson Limited. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include #include =20 #include #include =20 #include #include #include #include #include #include #include #include #include -#include #include -#include #include "LsRealTimeClock.h" =20 STATIC BOOLEAN mInitialized =3D FALSE; @@ -291,46 +289,32 @@ EFIAPI LibRtcInitialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; - EFI_HANDLE Handle; =20 InitRtc (); Status =3D KvmtoolRtcMapMemory (ImageHandle, (mRtcBase & ~EFI_PAGE_MASK)= ); if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, "Failed to map memory for loongson 7A RTC. Status =3D %r\n", Status )); return Status; } =20 - // Setup the setters and getters - gRT->GetTime =3D LibGetTime; - gRT->SetTime =3D LibSetTime; - - // Install the protocol - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); - // // Register for the virtual address change event // Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, VirtualNotifyEvent, NULL, &gEfiEventVirtualAddressChangeGuid, &mRtcVirtualAddrChangeEvent ); ASSERT_EFI_ERROR (Status); return Status; } -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109840): https://edk2.groups.io/g/devel/message/109840 Mute This Topic: https://groups.io/mt/102079659/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 10:22:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109838+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109838+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697804358; cv=none; d=zohomail.com; s=zohoarc; b=m8OjgVpe7Bh2RqS1O4mo2QQwFdZ5KuKIQrweLM1909bME1x7FevGJ99HL0ugomPH4SwLj8IsCd+dmnakgphKrb3p6bBaVstoh68yA3ttMLebB/1KtkgL3JbYeFK+TY05bppYqfuGEbztglFinwBPLUOYenOveqnK7T+6iSniAvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697804358; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=C6kkXrMODAziqkUHvX4JFxtN7A7tHIkp9PqMLaJwo1U=; b=gS4zbGoPwpt9orKyCR2yUg976PYWvr1zficAm+9bzoA5t5FuaO4rwevRWHwcgkJfQsBL0saYfM2vdWJOuVJn2ritu7kbPgdTZgy0Tu+Kwv92veA+HgeAuJctcTC2nmwkN7wmmo5SHgDcsTZ4rbw9XHfUIH6xEjx/DGOLK7kMO8E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109838+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697804358108213.01662344774968; Fri, 20 Oct 2023 05:19:18 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=C6kkXrMODAziqkUHvX4JFxtN7A7tHIkp9PqMLaJwo1U=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1697804357; v=1; b=jVqKX9j/6TzOEJH/fuRCSxKro07Q02Sg+NbHNEwdyDRPgbWecozQTt8yD7/wGl9Gv4TOrc5t n/HMzGDacvqbgNwBWiRtIr71gMAcacMNPed5YXbajCSuWt9HGn4Jl/0wXZC/E71DHnBRkH0z1TA kSbKoFX+duOKpq59EBldPMh8= X-Received: by 127.0.0.2 with SMTP id ASFFYY1788612xyEsu12XSpK; Fri, 20 Oct 2023 05:19:17 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.52931.1697804357135663028 for ; Fri, 20 Oct 2023 05:19:17 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-513-wSbe0PU-OHqRC8JUiS-97Q-1; Fri, 20 Oct 2023 08:19:12 -0400 X-MC-Unique: wSbe0PU-OHqRC8JUiS-97Q-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 788C388B77A; Fri, 20 Oct 2023 12:19:12 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.194.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 951058CEF; Fri, 20 Oct 2023 12:19:11 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Wenyi Xie Subject: [edk2-devel] [edk2-platforms PATCH 3/7] Hisilicon/M41T83RealTimeClockLib: remove superfluous instance init steps Date: Fri, 20 Oct 2023 14:18:59 +0200 Message-Id: <20231020121903.44986-4-lersek@redhat.com> In-Reply-To: <20231020121903.44986-1-lersek@redhat.com> References: <20231020121903.44986-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 2CapaJ6qxgudP48pz1biFdDGx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697804358337100009 Content-Type: text/plain; charset="utf-8"; x-default="true" RealTimeClockLib instances are consumed by edk2's EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function InitializeRealTimeClock(), the driver: (1) calls LibRtcInitialize(), (2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services to its own similarly-named functions -- where those functions wrap the corresponding RealTimeClockLib APIs, (3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol interface. Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through II-9.7.2.7. However, this means that LibRtcInitialize() (of any RealTimeClockLib instance) should not itself (a) set the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be overwritten in step (2) anyway, and step (3) will uselessly install a second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in the protocol database. (The protocol only serves to notify the DXE Foundation about said runtime services being available.) Clean up Hisilicon/M41T83RealTimeClockLib accordingly (it only has code that's redundant for step (2); it does not try to install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL). (Note that the lib instance INF file already does not list UefiRuntimeServicesTableLib.) Build-tested only (with the D06 platform). Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Wenyi Xie Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4565 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel --- Silicon/Hisilicon/Library/M41T83RealTimeClockLib/M41T83RealTimeClockLib.c = | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Silicon/Hisilicon/Library/M41T83RealTimeClockLib/M41T83RealTim= eClockLib.c b/Silicon/Hisilicon/Library/M41T83RealTimeClockLib/M41T83RealTi= meClockLib.c index 5f9465843475..3a2cd451c4ef 100644 --- a/Silicon/Hisilicon/Library/M41T83RealTimeClockLib/M41T83RealTimeClockL= ib.c +++ b/Silicon/Hisilicon/Library/M41T83RealTimeClockLib/M41T83RealTimeClockL= ib.c @@ -18,7 +18,6 @@ #include #include #include -#include #include "M41T83RealTimeClock.h" =20 extern I2C_DEVICE gRtcDevice; @@ -427,12 +426,6 @@ LibRtcInitialize ( =20 EfiInitializeLock (&mRtcLock, TPL_CALLBACK); =20 - // Setup the setters and getters - gRT->GetTime =3D LibGetTime; - gRT->SetTime =3D LibSetTime; - gRT->GetWakeupTime =3D LibGetWakeupTime; - gRT->SetWakeupTime =3D LibSetWakeupTime; - Status =3D InitializeM41T83 (); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Status : %r\nRTC M41T83 Init Failed != !!\n", -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109838): https://edk2.groups.io/g/devel/message/109838 Mute This Topic: https://groups.io/mt/102079657/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 10:22:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109843+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109843+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697804367; cv=none; d=zohomail.com; s=zohoarc; b=Lvy/OVhmt34ZTVdHvAYizpEWceGns6cEOdGKfp+wP5mgiA0+6CoEJ0hZdHMFcJ2DgFjC4WozHEZ3MoisQTalSdXb3NU83p3e3Qg6J1ll1IUpWIghY2lecYZ32Oc2KwPbnjkhP+hODi3a+so2/AhQLrwnqjNikc8uRhuHr2ev8LM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697804367; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=qXEQBgzeCYr2LFSrkTV6KNTGJyEj3KEGRpZv7tDcAlI=; b=bc/xNBdMoqN2JU7YXymCA6xVCPmJHUgOxGsFu5XkSvvA55KN5CZzRz3dAK1l2yh0IHHrfM+a5JeKd3JvAe0BOvAVaBZ6115TXjsF3pH0qPBAGJJdgdJzt7ZVbrOM2IWTKUDXEh0ZUid0najubD5bW+KJHug2u4x0T4NLnOY8+x8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109843+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697804367083434.436080620286; Fri, 20 Oct 2023 05:19:27 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=qXEQBgzeCYr2LFSrkTV6KNTGJyEj3KEGRpZv7tDcAlI=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1697804366; v=1; b=vbIRFGWo4TaRiu1urysXJCON2ZzpMdS3wn90CRnKurkH0CF/LK93zX56CvKrpVqEP+VdQLXD nSubdGFBYYQTg2Q201SWyRZLdsGw8XuA+f5Ps/PGOn0aZ7fJ0c6Mtz7og0NL8sZ5zp4ygzl8zOk kCjOHfMEsyB+X3v95Rn5iwBI= X-Received: by 127.0.0.2 with SMTP id eUWtYY1788612xBSIVU6HQOf; Fri, 20 Oct 2023 05:19:26 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.52786.1697804366139665049 for ; Fri, 20 Oct 2023 05:19:26 -0700 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-414-WvmsOL9DMY-Ju8sTCB6Siw-1; Fri, 20 Oct 2023 08:19:14 -0400 X-MC-Unique: WvmsOL9DMY-Ju8sTCB6Siw-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2C422815E46; Fri, 20 Oct 2023 12:19:13 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.194.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC98E503B; Fri, 20 Oct 2023 12:19:12 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Wenyi Xie Subject: [edk2-devel] [edk2-platforms PATCH 4/7] Hisilicon/RX8900RealTimeClockLib: remove superfluous instance init steps Date: Fri, 20 Oct 2023 14:19:00 +0200 Message-Id: <20231020121903.44986-5-lersek@redhat.com> In-Reply-To: <20231020121903.44986-1-lersek@redhat.com> References: <20231020121903.44986-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: i8Zezu5Eg6NFRNgkwBTaB9zmx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697804368432100030 Content-Type: text/plain; charset="utf-8"; x-default="true" RealTimeClockLib instances are consumed by edk2's EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function InitializeRealTimeClock(), the driver: (1) calls LibRtcInitialize(), (2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services to its own similarly-named functions -- where those functions wrap the corresponding RealTimeClockLib APIs, (3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol interface. Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through II-9.7.2.7. However, this means that LibRtcInitialize() (of any RealTimeClockLib instance) should not itself (a) set the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be overwritten in step (2) anyway, and step (3) will uselessly install a second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in the protocol database. (The protocol only serves to notify the DXE Foundation about said runtime services being available.) Clean up Hisilicon/RX8900RealTimeClockLib accordingly. (Note that the lib instance INF file already does not list UefiBootServicesTableLib, UefiRuntimeServicesTableLib, and gEfiRealTimeClockArchProtocolGuid.) Note that this patch is *untestable* in edk2-platforms (and in edk2-non-osi too), because no platform consumes RX8900RealTimeClockLib -- worse, there hasn't been a single consumer since the introduction of the lib instance in commit de704335c47f ("Silicon/Hisilicon: Add RX8900RealTimeClockLib", 2020-05-20). Normally this would nominate RX8900RealTimeClockLib to the axe, but commit de704335c47f said, "There are some boards base on D06, but use RX8900 RTC, so upstream the RX8900RealTimeClockLib", so I guess there might be out-of-tree / proprietary consumers. Quite unfortunate. Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Wenyi Xie Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4565 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel --- Silicon/Hisilicon/Library/RX8900RealTimeClockLib/RX8900RealTimeClockLib.c = | 24 +++----------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/Silicon/Hisilicon/Library/RX8900RealTimeClockLib/RX8900RealTim= eClockLib.c b/Silicon/Hisilicon/Library/RX8900RealTimeClockLib/RX8900RealTi= meClockLib.c index ea41202fc72a..eaaf95a1979d 100644 --- a/Silicon/Hisilicon/Library/RX8900RealTimeClockLib/RX8900RealTimeClockL= ib.c +++ b/Silicon/Hisilicon/Library/RX8900RealTimeClockLib/RX8900RealTimeClockL= ib.c @@ -15,11 +15,8 @@ #include #include #include -#include #include #include -#include -#include #include "RX8900RealTimeClock.h" =20 extern I2C_DEVICE gRtcDevice; @@ -417,16 +414,9 @@ LibRtcInitialize ( ) { EFI_STATUS Status; - EFI_HANDLE Handle; EFI_TIME EfiTime; =20 - // Setup the setters and getters - gRT->GetTime =3D LibGetTime; - gRT->SetTime =3D LibSetTime; - gRT->GetWakeupTime =3D LibGetWakeupTime; - gRT->SetWakeupTime =3D LibSetWakeupTime; - - Status =3D gRT->GetTime (&EfiTime, NULL); + Status =3D LibGetTime (&EfiTime, NULL); if (EFI_ERROR (Status) || (EfiTime.Year < 2000) || (EfiTime.Year > 2099)= || (!IsTimeValid (&EfiTime))) { EfiTime.Year =3D 2000; @@ -439,19 +429,11 @@ LibRtcInitialize ( EfiTime.Daylight =3D 0; EfiTime.TimeZone =3D EFI_UNSPECIFIED_TIMEZONE; =20 - Status =3D gRT->SetTime (&EfiTime); + Status =3D LibSetTime (&EfiTime); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "SetTime Status : %r\n", Status)); } } =20 - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, - NULL, - NULL - ); - - return Status; + return EFI_SUCCESS; } -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109843): https://edk2.groups.io/g/devel/message/109843 Mute This Topic: https://groups.io/mt/102079662/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 10:22:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109839+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109839+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697804358; cv=none; d=zohomail.com; s=zohoarc; b=IA2Gx0lfiiedqtYISG6yETxyyG4iUz3aKv5e6bjGRmDit0iYrSlCxBz6ciBiOHwN/vfTGn+jGua+Luz5NmeBxoc9BEh4etVkaItlK3KFqD5JYujMbVupCA4molOs8jQtDZGE5pMlFdK/7Sq9WKY4xvYgLCXDBgNp6OeyzY4Vsfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697804358; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=tTGkcXUHErG+JXugjOyQpmL03z0zQfB/XMciSYbmjT4=; b=mQCeMiH19uVWILVcrmQuXv9Qoi+MH1LznpB6qOduifTebH8w5TfpL2KKxZ6G+Cnepr6Q20X/Qk9Kn1YP7UVEY0Dk3tt0exfpeXRgO4kjqFnl7WzcfchEOEMXNG9+RSDO2dWu3Q2H995g4dPHVclSYnixvvgJ+aY/6MrTRq/0W7o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109839+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697804358165928.7692240544576; Fri, 20 Oct 2023 05:19:18 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=tTGkcXUHErG+JXugjOyQpmL03z0zQfB/XMciSYbmjT4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1697804357; v=1; b=ClZpr+N9/GOLO56MRrImsJkk5QfSoqlzbiOr1Hb0OfGPezLjRMZpTOjlwJXXH5zFNH+8YJvw F7Y6D9JXEeSogMqfS3Ll/WIoigkyQJaWGTHyy9PaYc6YRNxWvGUHLGX4xUPH93349k3Hkdg1z0E dRM3vcHhRijW4jKtv/guTOTM= X-Received: by 127.0.0.2 with SMTP id HAtMYY1788612xGI2yzIAc8f; Fri, 20 Oct 2023 05:19:17 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.52782.1697804357224475205 for ; Fri, 20 Oct 2023 05:19:17 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-557-PWVrtCdyPUuuSYwQ-MgGEw-1; Fri, 20 Oct 2023 08:19:15 -0400 X-MC-Unique: PWVrtCdyPUuuSYwQ-MgGEw-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4FEE10201F3; Fri, 20 Oct 2023 12:19:14 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.194.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4AFB503C; Fri, 20 Oct 2023 12:19:13 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Leif Lindholm , Marcin Wojtas Subject: [edk2-devel] [edk2-platforms PATCH 5/7] Silicon/Marvell/RealTimeClockLib: remove superfluous instance init steps Date: Fri, 20 Oct 2023 14:19:01 +0200 Message-Id: <20231020121903.44986-6-lersek@redhat.com> In-Reply-To: <20231020121903.44986-1-lersek@redhat.com> References: <20231020121903.44986-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: LsOol3kPFFZEvlL7J25zuUojx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697804360351100013 Content-Type: text/plain; charset="utf-8"; x-default="true" RealTimeClockLib instances are consumed by edk2's EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function InitializeRealTimeClock(), the driver: (1) calls LibRtcInitialize(), (2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services to its own similarly-named functions -- where those functions wrap the corresponding RealTimeClockLib APIs, (3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol interface. Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through II-9.7.2.7. However, this means that LibRtcInitialize() (of any RealTimeClockLib instance) should not itself (a) set the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be overwritten in step (2) anyway, and step (3) will uselessly install a second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in the protocol database. (The protocol only serves to notify the DXE Foundation about said runtime services being available.) Clean up Silicon/Marvell/RealTimeClockLib accordingly (it only has code that's redundant for step (3); it does not try to set "gRT" fields). (Note that the lib instance INF file already does not list gEfiRealTimeClockArchProtocolGuid.) Build-tested only (with "Armada70x0Db.dsc"). Cc: Leif Lindholm Cc: Marcin Wojtas Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4565 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel --- Notes: context:-W Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c | 1= 9 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeCl= ockLib.c b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeCloc= kLib.c index d538b030b111..c026ac2dee31 100644 --- a/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c +++ b/Silicon/Marvell/Armada7k8k/Library/RealTimeClockLib/RealTimeClockLib.c @@ -1,30 +1,29 @@ /** @file Implement EFI RealTimeClock runtime services via RTC Lib. =20 Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
Copyright (c) 2017, Marvell International Ltd. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ /** Derived from: ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c =20 **/ =20 #include #include #include #include #include #include #include #include #include #include -#include #include "RealTimeClockLib.h" =20 STATIC EFI_EVENT mRtcVirtualAddrChangeEvent; @@ -245,85 +244,69 @@ EFIAPI LibRtcInitialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_HANDLE Handle; EFI_STATUS Status; =20 // Obtain RTC device base address mArmadaRtcBase =3D PcdGet64 (PcdRtcBaseAddress); =20 // Check if the controller can be initialized if (mArmadaRtcBase =3D=3D 0) { DEBUG ((DEBUG_ERROR, "RTC: None of controllers enabled\n")); return EFI_INVALID_PARAMETER; } =20 // Declare the controller as EFI_MEMORY_RUNTIME Status =3D gDS->AddMemorySpace ( EfiGcdMemoryTypeMemoryMappedIo, mArmadaRtcBase, SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_RUNTIME ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "RTC: Failed to add memory space\n")); return Status; } =20 Status =3D gDS->SetMemorySpaceAttributes ( mArmadaRtcBase, SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_RUNTIME ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "RTC: Failed to set memory attributes\n")); goto ErrSetMem; } =20 /* Update RTC-MBUS bridge timing parameters */ MmioAndThenOr32 ( mArmadaRtcBase + RTC_BRIDGE_TIMING_CTRL0_REG_OFFS, ~(RTC_WRITE_SETUP_DELAY_MASK | RTC_WRITE_PERIOD_DELAY_MASK), (RTC_WRITE_SETUP_DELAY_DEFAULT | RTC_WRITE_PERIOD_DELAY_DEFAULT) ); MmioAndThenOr32 ( mArmadaRtcBase + RTC_BRIDGE_TIMING_CTRL1_REG_OFFS, ~RTC_READ_OUTPUT_DELAY_MASK, RTC_READ_OUTPUT_DELAY_DEFAULT ); =20 - // Install the protocol - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, - NULL, - NULL - ); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "RTC: Failed to install the protocol\n")); - goto ErrSetMem; - } - // Register for the virtual address change event Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, VirtualNotifyEvent, NULL, &gEfiEventVirtualAddressChangeGuid, &mRtcVirtualAddrChangeEvent ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "RTC: Failed to register virtual address change e= vent\n")); - goto ErrEvent; + goto ErrSetMem; } =20 return Status; =20 -ErrEvent: - gBS->UninstallProtocolInterface (Handle, &gEfiRealTimeClockArchProtocolG= uid, NULL); ErrSetMem: gDS->RemoveMemorySpace (mArmadaRtcBase, SIZE_4KB); =20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109839): https://edk2.groups.io/g/devel/message/109839 Mute This Topic: https://groups.io/mt/102079658/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 10:22:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109842+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109842+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697804366; cv=none; d=zohomail.com; s=zohoarc; b=bboSo4kK2JUzFw71omBxJomtqoXdghcfQ+zHq5cCaYMD2em7qmklyfi3x87GZcfeJ8l+SuIEBl/Cu6WSzdwF5W/EvpeJ0eRY7jFht9XIAizwY+whweXedhfBZxODvWGVoruCHQgnDAOmbdiwjpJ+KxFO/znuLI8NMoYI93vYXTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697804366; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=Y2ImJVdIW6jGwB3XEtUPzn7RoAkApog17K2uqY6j9es=; b=aiaQSgJwbT9Ls9/EHU+cQZWtqmaZSSNnb/yoPvois3Fn6sS8kLLYDEFs3Uz+4rIHd243rD5qQ1KuhCwsO/ib996vnqe1IgyfYNSE2RabUTJJrSnNpO43Z755ziem4d2QGsHB6abIaA/nGirlUf5W2e6jAjMOGp+Uo+kEGNBud7U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109842+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697804366528568.2132527914623; Fri, 20 Oct 2023 05:19:26 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=Y2ImJVdIW6jGwB3XEtUPzn7RoAkApog17K2uqY6j9es=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1697804366; v=1; b=FJrypdyu7XbIaXbwjKN71HhJzcIhVfbSlbXoZslnZkTzfDVYYlpGmxzZ1g2wapJJM5KRV3+Z lQvID6tapGZ2HAECO7ptwf70An7sQxPyqSuAhjb82JOIUAvCBKV8JHfUYDzV6xTq5dCfD8zH66M WnDiCt1voeMFzKAGVCTYuor8= X-Received: by 127.0.0.2 with SMTP id K4OXYY1788612xSYIvZByA5D; Fri, 20 Oct 2023 05:19:26 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.52785.1697804365571973374 for ; Fri, 20 Oct 2023 05:19:25 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-490-H7YmKm56NUG_IWXHApTVAA-1; Fri, 20 Oct 2023 08:19:16 -0400 X-MC-Unique: H7YmKm56NUG_IWXHApTVAA-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0115B8115B1; Fri, 20 Oct 2023 12:19:16 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.194.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id E90F2503C; Fri, 20 Oct 2023 12:19:14 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Leif Lindholm , Ling Jia , Peng Xie , Yiqi Shu Subject: [edk2-devel] [edk2-platforms PATCH 6/7] FT2000-4Pkg/RealTimeClockLib: remove superfluous instance init steps Date: Fri, 20 Oct 2023 14:19:02 +0200 Message-Id: <20231020121903.44986-7-lersek@redhat.com> In-Reply-To: <20231020121903.44986-1-lersek@redhat.com> References: <20231020121903.44986-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: cpt0TkNeBQ3zRuLsc6WnlAyJx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697804368424100029 Content-Type: text/plain; charset="utf-8"; x-default="true" RealTimeClockLib instances are consumed by edk2's EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function InitializeRealTimeClock(), the driver: (1) calls LibRtcInitialize(), (2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services to its own similarly-named functions -- where those functions wrap the corresponding RealTimeClockLib APIs, (3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol interface. Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through II-9.7.2.7. However, this means that LibRtcInitialize() (of any RealTimeClockLib instance) should not itself (a) set the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be overwritten in step (2) anyway, and step (3) will uselessly install a second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in the protocol database. (The protocol only serves to notify the DXE Foundation about said runtime services being available.) Clean up FT2000-4Pkg/RealTimeClockLib accordingly (it only has code that's redundant for step (3); it does not try to set "gRT" fields). (Note that the lib instance INF file already does not list gEfiRealTimeClockArchProtocolGuid.) Build-tested only (with "DurianPkg.dsc"). Cc: Leif Lindholm Cc: Ling Jia Cc: Peng Xie Cc: Yiqi Shu Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4565 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel --- Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | = 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeC= lockLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeCl= ockLib.c index 5c3d0cdccff8..26fbd7a3552a 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib= .c +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib= .c @@ -15,7 +15,6 @@ #include #include #include -#include #include "RealTimeClockLib.h" =20 STATIC EFI_EVENT mRtcVirtualAddrChangeEvent; @@ -344,7 +343,6 @@ LibRtcInitialize ( ) { EFI_STATUS Status; - EFI_HANDLE Handle; INT16 TimeZone; UINTN Size; EFI_TIME Time; @@ -437,17 +435,6 @@ LibRtcInitialize ( return Status; } // - // Install the protocol - // - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, - NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); - // // Register for the virtual address change event // Status =3D gBS->CreateEventEx ( -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109842): https://edk2.groups.io/g/devel/message/109842 Mute This Topic: https://groups.io/mt/102079661/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 10:22:12 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109841+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109841+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697804365; cv=none; d=zohomail.com; s=zohoarc; b=dHXkwbVC0lIzFtyXVk3qh42joJRNJlgnIF7aizAAYZcgDG1vxjv/uQSWgzQZUVwVUtmDLygCmOTv+L990VfNAglaQd9EWJclw52rkb5RmcmHKg38rXvIXn6H6Yl9JB/2T2a4BQVGeAwP4KyhwYDriCLj2GbTQB59pH8j6KIYzM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697804365; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=sUHEubcCGNA4JLbOKl9Zk24z9uTu25blXQPOBnSO9Cg=; b=IT4DLNudOVmtyhPIsLBQXkKbBKwWM1sb16TkoBIypYna2wPqhzbSeoX6fxUM43j6o4h8Fx5R6gj2xXEHqx7fgpflxrhVsY0C+QpUp69A7d8AugHfH2TlWnsSr+Nt8qwUqIIesyPUtyLJN1dbRR5T6/u6Z2MB1TDXa0n6GGPUPoQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109841+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1697804365502397.69913267636946; Fri, 20 Oct 2023 05:19:25 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=sUHEubcCGNA4JLbOKl9Zk24z9uTu25blXQPOBnSO9Cg=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1697804365; v=1; b=V/kktuTV/IjKq/WorHy9JoyiuPoNhL431Cesz9tdS2MaFXqLYGkWXw30H6KUGDTe2N5m790K 7HVSPzD+HrJSrMDCIhvTRRupC4XMRwA2RMkJqOloZYuppjX8Lo25+40MA8YBFBCQ82WhZyLCk3Q 2K+1ULOX7FKksQo6gUvdPFBM= X-Received: by 127.0.0.2 with SMTP id hnyBYY1788612xLaluc9CSi7; Fri, 20 Oct 2023 05:19:25 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.52935.1697804364521721074 for ; Fri, 20 Oct 2023 05:19:24 -0700 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-74-pP1_j6JdPXySGose5-xGcw-1; Fri, 20 Oct 2023 08:19:17 -0400 X-MC-Unique: pP1_j6JdPXySGose5-xGcw-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0598A3C1492C; Fri, 20 Oct 2023 12:19:17 +0000 (UTC) X-Received: from lacos-laptop-9.usersys.redhat.com (unknown [10.39.194.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 448658CEF; Fri, 20 Oct 2023 12:19:16 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms PATCH 7/7] Omap35xxPkg/RealTimeClockLib: remove superfluous instance init steps Date: Fri, 20 Oct 2023 14:19:03 +0200 Message-Id: <20231020121903.44986-8-lersek@redhat.com> In-Reply-To: <20231020121903.44986-1-lersek@redhat.com> References: <20231020121903.44986-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 6umK8r1vjgIA0zsH11E6mfzkx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697804366389100023 Content-Type: text/plain; charset="utf-8"; x-default="true" RealTimeClockLib instances are consumed by edk2's EmbeddedPkg/RealTimeClockRuntimeDxe driver. In its entry point function InitializeRealTimeClock(), the driver: (1) calls LibRtcInitialize(), (2) sets the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services to its own similarly-named functions -- where those functions wrap the corresponding RealTimeClockLib APIs, (3) installs EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL with a NULL protocol interface. Steps (2) and (3) conform to PI v1.8 sections II-9.7.2.4 through II-9.7.2.7. However, this means that LibRtcInitialize() (of any RealTimeClockLib instance) should not itself (a) set the GetTime(), SetTime(), GetWakeupTime() and SetWakeupTime() runtime services, nor (b) install EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL. The runtime service pointers will be overwritten in step (2) anyway, and step (3) will uselessly install a second (NULL-interface) EFI_REAL_TIME_CLOCK_ARCH_PROTOCOL instance in the protocol database. (The protocol only serves to notify the DXE Foundation about said runtime services being available.) Clean up Omap35xxPkg/RealTimeClockLib accordingly. (Note that the lib instance INF file already does not list UefiRuntimeServicesTableLib and gEfiRealTimeClockArchProtocolGuid.) Build-tested only (with "BeagleBoardPkg.dsc"). Cc: Ard Biesheuvel Cc: Leif Lindholm Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4565 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel --- Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTimeCloc= kLib.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/= RealTimeClockLib.c b/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeC= lockLib/RealTimeClockLib.c index 10920a13786b..24fcaaf125c4 100644 --- a/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTim= eClockLib.c +++ b/Silicon/TexasInstruments/Omap35xxPkg/Library/RealTimeClockLib/RealTim= eClockLib.c @@ -10,11 +10,9 @@ =20 #include #include -#include #include #include =20 -#include #include =20 #include @@ -242,7 +240,6 @@ LibRtcInitialize ( ) { EFI_STATUS Status; - EFI_HANDLE Handle; UINT8 Data; EFI_TPL OldTpl; =20 @@ -255,19 +252,5 @@ LibRtcInitialize ( ASSERT_EFI_ERROR(Status); gBS->RestoreTPL(OldTpl); =20 - // Setup the setters and getters - gRT->GetTime =3D LibGetTime; - gRT->SetTime =3D LibSetTime; - gRT->GetWakeupTime =3D LibGetWakeupTime; - gRT->SetWakeupTime =3D LibSetWakeupTime; - - // Install the protocol - Handle =3D NULL; - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Handle, - &gEfiRealTimeClockArchProtocolGuid, NULL, - NULL - ); - - return Status; + return EFI_SUCCESS; } -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109841): https://edk2.groups.io/g/devel/message/109841 Mute This Topic: https://groups.io/mt/102079660/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-