diff options
author | Laszlo Ersek <lersek@redhat.com> | 2019-09-07 13:17:49 +0200 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2019-10-09 09:40:09 +0200 |
commit | d342d318e9da83031841b602012699039c2e99bb (patch) | |
tree | 0b232a6845325c4ae6616b1fbaa4bb78be19da84 /MdeModulePkg | |
parent | 0bee7dbd2b02aaa53352c544c7c53d20ea9160a9 (diff) | |
download | edk2-d342d318e9da83031841b602012699039c2e99bb.tar.gz |
MdeModulePkg: document workaround for EFI_RUNTIME_EVENT_ENTRY PI spec bug
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>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Event/Event.c | 8 | ||||
-rw-r--r-- | MdeModulePkg/Core/RuntimeDxe/Runtime.c | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c b/MdeModulePkg/Core/Dxe/Event/Event.c index 21db38aaf0..c83c572c8f 100644 --- a/MdeModulePkg/Core/Dxe/Event/Event.c +++ b/MdeModulePkg/Core/Dxe/Event/Event.c @@ -485,6 +485,14 @@ CoreCreateEventInternal ( IEvent->RuntimeData.NotifyTpl = NotifyTpl;
IEvent->RuntimeData.NotifyFunction = NotifyFunction;
IEvent->RuntimeData.NotifyContext = (VOID *) NotifyContext;
+ //
+ // Work around the bug in the Platform Init specification (v1.7), reported
+ // as Mantis#2017: "EFI_RUNTIME_EVENT_ENTRY.Event" should have type
+ // EFI_EVENT, not (EFI_EVENT*). The PI spec documents the field correctly
+ // as "The EFI_EVENT returned by CreateEvent()", but the type of the field
+ // doesn't match the natural language description. Therefore we need an
+ // explicit cast here.
+ //
IEvent->RuntimeData.Event = (EFI_EVENT *) IEvent;
InsertTailList (&gRuntime->EventHead, &IEvent->RuntimeData.Link);
}
diff --git a/MdeModulePkg/Core/RuntimeDxe/Runtime.c b/MdeModulePkg/Core/RuntimeDxe/Runtime.c index c52b2b7ecf..f7220a205d 100644 --- a/MdeModulePkg/Core/RuntimeDxe/Runtime.c +++ b/MdeModulePkg/Core/RuntimeDxe/Runtime.c @@ -285,8 +285,16 @@ RuntimeDriverSetVirtualAddressMap ( for (Link = mRuntime.EventHead.ForwardLink; Link != &mRuntime.EventHead; Link = Link->ForwardLink) {
RuntimeEvent = BASE_CR (Link, EFI_RUNTIME_EVENT_ENTRY, Link);
if ((RuntimeEvent->Type & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) == EVT_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 have
+ // type EFI_EVENT, not (EFI_EVENT*). The PI spec documents the field
+ // correctly as "The EFI_EVENT returned by CreateEvent()", but the type
+ // of the field doesn't match the natural language description. Therefore
+ // we need an explicit cast here.
+ //
RuntimeEvent->NotifyFunction (
- RuntimeEvent->Event,
+ (EFI_EVENT) RuntimeEvent->Event,
RuntimeEvent->NotifyContext
);
}
|