]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug
authorLaszlo Ersek <lersek@redhat.com>
Sat, 7 Sep 2019 11:17:49 +0000 (13:17 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 9 Oct 2019 07:40:09 +0000 (09:40 +0200)
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: <https://mantis.uefi.org/mantis/view.php?id=2017>.)

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
MdeModulePkg/Core/Dxe/Event/Event.c
MdeModulePkg/Core/RuntimeDxe/Runtime.c

index 21db38aaf037466067bbde4d4056bdd79ffa7fa8..c83c572c8f84bd703ca32da88466c7ec4d270dc9 100644 (file)
@@ -485,6 +485,14 @@ CoreCreateEventInternal (
     IEvent->RuntimeData.NotifyTpl      = NotifyTpl;\r
     IEvent->RuntimeData.NotifyFunction = NotifyFunction;\r
     IEvent->RuntimeData.NotifyContext  = (VOID *) NotifyContext;\r
+    //\r
+    // Work around the bug in the Platform Init specification (v1.7), reported\r
+    // as Mantis#2017: "EFI_RUNTIME_EVENT_ENTRY.Event" should have type\r
+    // EFI_EVENT, not (EFI_EVENT*). The PI spec documents the field correctly\r
+    // as "The EFI_EVENT returned by CreateEvent()", but the type of the field\r
+    // doesn't match the natural language description. Therefore we need an\r
+    // explicit cast here.\r
+    //\r
     IEvent->RuntimeData.Event          = (EFI_EVENT *) IEvent;\r
     InsertTailList (&gRuntime->EventHead, &IEvent->RuntimeData.Link);\r
   }\r
index c52b2b7ecf68e0840dde8ebd981afd4ef1378d25..f7220a205d1e48b77ebcc6f88d54ead9c53bf5b8 100644 (file)
@@ -285,8 +285,16 @@ RuntimeDriverSetVirtualAddressMap (
   for (Link = mRuntime.EventHead.ForwardLink; Link != &mRuntime.EventHead; Link = Link->ForwardLink) {\r
     RuntimeEvent = BASE_CR (Link, EFI_RUNTIME_EVENT_ENTRY, Link);\r
     if ((RuntimeEvent->Type & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {\r
+      //\r
+      // Work around the bug in the Platform Init specification (v1.7),\r
+      // reported as Mantis#2017: "EFI_RUNTIME_EVENT_ENTRY.Event" should have\r
+      // type EFI_EVENT, not (EFI_EVENT*). The PI spec documents the field\r
+      // correctly as "The EFI_EVENT returned by CreateEvent()", but the type\r
+      // of the field doesn't match the natural language description. Therefore\r
+      // we need an explicit cast here.\r
+      //\r
       RuntimeEvent->NotifyFunction (\r
-                      RuntimeEvent->Event,\r
+                      (EFI_EVENT) RuntimeEvent->Event,\r
                       RuntimeEvent->NotifyContext\r
                       );\r
     }\r