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>
IEvent->RuntimeData.NotifyTpl = NotifyTpl;\r
IEvent->RuntimeData.NotifyFunction = NotifyFunction;\r
IEvent->RuntimeData.NotifyContext = (VOID *) NotifyContext;\r
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
IEvent->RuntimeData.Event = (EFI_EVENT *) IEvent;\r
InsertTailList (&gRuntime->EventHead, &IEvent->RuntimeData.Link);\r
}\r
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
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->NotifyFunction (\r
+ (EFI_EVENT) RuntimeEvent->Event,\r
RuntimeEvent->NotifyContext\r
);\r
}\r
RuntimeEvent->NotifyContext\r
);\r
}\r