From nobody Mon Feb 9 09:09:10 2026 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 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-