From nobody Mon Feb 9 11:06:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47398+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47398+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568749808; cv=none; d=zoho.com; s=zohoarc; b=VmiZjlB0LKJ2IJuUjedfmY+4uptRwNbUpXXzPGoTfGI5AHBSwUio7NEQkr/HqNpnXxI/+OyNAE8jdWM/aBpWv7uwml9EQoANK8TXgMxTVy0g46i/2B0u8HeeJJAgzSVFTzfN7Jo0g9Y/i7zn5M0AyLB8K2PAqh3aW1ZYx8Su1R8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568749808; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=2lhBGKYOAYTHRbjuNcs0ViMzYzn5zuxvtQFNL5jFxiI=; b=dJX4UxpK7F5+8ehoQ0Byoj4ekaZsvJpvCEE6ofBcUebQTC037wo7QOWUdvqgBCHR8qzJYInSKn/knsW4oQew3ts8YfUtsp9AUwFbJadGvzVjLyw1bkyzaKuUBT1CkMfrDLdtbVAJTbb96h9+Xer4ENlQGzkcBrBzK5f0NABBrcw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47398+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 156874980875848.41371905735309; Tue, 17 Sep 2019 12:50:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JVngYY1788612xJCeEivKNZP; Tue, 17 Sep 2019 12:50:08 -0700 X-Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Tue, 17 Sep 2019 12:50:07 -0700 X-Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A0BA368DA; Tue, 17 Sep 2019 19:50:07 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-37.rdu2.redhat.com [10.10.120.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0885B600C4; Tue, 17 Sep 2019 19:50:05 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Dandan Bi , Hao A Wu , Jian J Wang , Liming Gao Subject: [edk2-devel] [PATCH 11/35] MdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug Date: Tue, 17 Sep 2019 21:49:11 +0200 Message-Id: <20190917194935.24322-12-lersek@redhat.com> In-Reply-To: <20190917194935.24322-1-lersek@redhat.com> References: <20190917194935.24322-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 17 Sep 2019 19:50:07 +0000 (UTC) Precedence: Bulk List-Unsubscribe: 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 X-Gm-Message-State: 2V4c0oPRFyij7ohR8WlPpWoRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1568749808; bh=gbBOj9/04CrASuaR37J8P1QxLKoBoK27/h0hgtjEJIo=; h=Cc:Date:From:Reply-To:Subject:To; b=fweqN9dfyQ5S96gTtFuKv/AmIPR7VZaHwGCxpAyklRab0vKtH8q8OsRuuksTVKk0v2z KqRXMvyyQkKUenremqohKOYclQbigGq46/nr5Ysc3MFBd//r5kG3KBEkUfxe+8vYlkiCq uMNFGhp0NRDJPd/AcXMynUVp3nn9rjMnp34= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The PI spec (v1.7) correctly specifies "EFI_RUNTIME_EVENT_ENTRY.Event" in natural language, but the field type in the structure definition itself is wrong -- it should be EFI_EVENT, not (EFI_EVENT*). This spec bug is likely unfixable for compatibility reasons, and so edk2 works it around already. We should clearly document the workaround. Functionally, this patch is a no-op. (I've also requested a non-normative (informative) clarification for the PI spec: .) Cc: Dandan Bi Cc: Hao A Wu Cc: Jian J Wang Cc: Liming Gao Signed-off-by: Laszlo Ersek Reviewed-by: Dandan Bi --- Notes: lightly tested, as these modules are part of the ArmVirt and/or OVMF platforms MdeModulePkg/Core/Dxe/Event/Event.c | 8 ++++++++ MdeModulePkg/Core/RuntimeDxe/Runtime.c | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c b/MdeModulePkg/Core/Dxe/Ev= ent/Event.c index 21db38aaf037..c83c572c8f84 100644 --- a/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/MdeModulePkg/Core/Dxe/Event/Event.c @@ -485,6 +485,14 @@ CoreCreateEventInternal ( IEvent->RuntimeData.NotifyTpl =3D NotifyTpl; IEvent->RuntimeData.NotifyFunction =3D NotifyFunction; IEvent->RuntimeData.NotifyContext =3D (VOID *) NotifyContext; + // + // Work around the bug in the Platform Init specification (v1.7), repo= rted + // as Mantis#2017: "EFI_RUNTIME_EVENT_ENTRY.Event" should have type + // EFI_EVENT, not (EFI_EVENT*). The PI spec documents the field correc= tly + // as "The EFI_EVENT returned by CreateEvent()", but the type of the f= ield + // doesn't match the natural language description. Therefore we need an + // explicit cast here. + // IEvent->RuntimeData.Event =3D (EFI_EVENT *) IEvent; InsertTailList (&gRuntime->EventHead, &IEvent->RuntimeData.Link); } diff --git a/MdeModulePkg/Core/RuntimeDxe/Runtime.c b/MdeModulePkg/Core/Run= timeDxe/Runtime.c index c52b2b7ecf68..f7220a205d1e 100644 --- a/MdeModulePkg/Core/RuntimeDxe/Runtime.c +++ b/MdeModulePkg/Core/RuntimeDxe/Runtime.c @@ -285,8 +285,16 @@ RuntimeDriverSetVirtualAddressMap ( for (Link =3D mRuntime.EventHead.ForwardLink; Link !=3D &mRuntime.EventH= ead; Link =3D Link->ForwardLink) { RuntimeEvent =3D BASE_CR (Link, EFI_RUNTIME_EVENT_ENTRY, Link); if ((RuntimeEvent->Type & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) =3D=3D EV= T_SIGNAL_VIRTUAL_ADDRESS_CHANGE) { + // + // Work around the bug in the Platform Init specification (v1.7), + // reported as Mantis#2017: "EFI_RUNTIME_EVENT_ENTRY.Event" should h= ave + // type EFI_EVENT, not (EFI_EVENT*). The PI spec documents the field + // correctly as "The EFI_EVENT returned by CreateEvent()", but the t= ype + // of the field doesn't match the natural language description. Ther= efore + // we need an explicit cast here. + // RuntimeEvent->NotifyFunction ( - RuntimeEvent->Event, + (EFI_EVENT) RuntimeEvent->Event, RuntimeEvent->NotifyContext ); } --=20 2.19.1.3.g30247aa5d201 -=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 (#47398): https://edk2.groups.io/g/devel/message/47398 Mute This Topic: https://groups.io/mt/34180212/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-