From nobody Wed May 15 16:13:20 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+109835+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+109835+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1697804275; cv=none; d=zohomail.com; s=zohoarc; b=GjeocC8YqtSjPCLFAX7aKPTRksllwM82haVFWx3btUrNap0r0gFl4okK+h4qsyirHPisl80hmRXz9savVwGjdQYxLGb4FllBzhVnFs8WkAOaPgOT3gU3f5V1tIaZsnXpXULMMgsXS1TfeQtlX5YHsy2CCzm6drRPQg5YXEj2Kdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697804275; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=+UrD1S4TrUFCbe6jMdB4+JNaBMoWX37Z0TR6gZ4ODuE=; b=noa+71spYwdgziuZcVfW7xSBgQ1KokeTgQQAgOvdbOnM8Xuz01YKBrrjLgsx0iZbhJC+LTOkyhXNpl5wuoh0crssS2TctMxhdLV30F5ybMiZHsE6d6MmfLYDRt/qYszRIOOBgySgUfnfLBe65fz3JCudFSky+8qEkHQEeDIjPeg= 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+109835+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 1697804275124644.596060505973; Fri, 20 Oct 2023 05:17:55 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=+UrD1S4TrUFCbe6jMdB4+JNaBMoWX37Z0TR6gZ4ODuE=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id: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=1697804274; v=1; b=ujDtQNcIs12oL2Zpehz1mwBrjDzaTeNWmOc2QtomN02ckEWZn1Gwo5jh2Hiprdmu7g3OyZpp AADyhMDCqtgpfeQmOenRhkaRqeN7OCUCXxM2ZWmn7LfbLSYLZrsCjo5T/TGmNm7t2tGcYJJ7x5l PZsUve1GDjTv+d1mT6Ferj2g= X-Received: by 127.0.0.2 with SMTP id t9ASYY1788612xWch1A8PGBb; Fri, 20 Oct 2023 05:17:54 -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.52755.1697804273669199859 for ; Fri, 20 Oct 2023 05:17:53 -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-287-yWDGiD_lOmWDCjVofAnZow-1; Fri, 20 Oct 2023 08:17:51 -0400 X-MC-Unique: yWDGiD_lOmWDCjVofAnZow-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 32243801234; Fri, 20 Oct 2023 12:17:51 +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 6D925492BD9; Fri, 20 Oct 2023 12:17:50 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [PATCH] ArmPlatformPkg/PL031RealTimeClockLib: remove superfluous instance init steps Date: Fri, 20 Oct 2023 14:17:48 +0200 Message-Id: <20231020121748.44862-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 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: qudeNWwKY4IRohFSQ8vSs03Nx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1697804275963100001 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 ArmPlatformPkg/PL031RealTimeClockLib 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.) Tested with ArmVirtQemu. 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 --- Notes: context:-W ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | 13 = ------------- 1 file changed, 13 deletions(-) diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeCloc= kLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib= .c index 9e852696d2fd..1896f9d16d3b 100644 --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c @@ -1,34 +1,32 @@ /** @file Implement EFI RealTimeClock runtime services via RTC Lib. =20 Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
Copyright (c) 2011 - 2020, Arm Limited. All rights reserved.
Copyright (c) 2019, Linaro Ltd. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include =20 #include #include =20 #include #include #include #include #include #include #include #include #include #include #include #include =20 -#include - #include "PL031RealTimeClock.h" =20 STATIC BOOLEAN mPL031Initialized =3D FALSE; @@ -307,52 +305,41 @@ EFIAPI LibRtcInitialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; - EFI_HANDLE Handle; =20 // Initialize RTC Base Address mPL031RtcBase =3D PcdGet32 (PcdPL031RtcBase); =20 // Declare the controller as EFI_MEMORY_RUNTIME Status =3D gDS->AddMemorySpace ( EfiGcdMemoryTypeMemoryMappedIo, mPL031RtcBase, SIZE_4KB, EFI_MEMORY_UC | EFI_MEMORY_RUNTIME ); if (EFI_ERROR (Status)) { return Status; } =20 Status =3D gDS->SetMemorySpaceAttributes (mPL031RtcBase, SIZE_4KB, EFI_M= EMORY_UC | EFI_MEMORY_RUNTIME); if (EFI_ERROR (Status)) { return Status; } =20 - // 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); =20 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 (#109835): https://edk2.groups.io/g/devel/message/109835 Mute This Topic: https://groups.io/mt/102079629/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-