efi_loader: run CreateEvent() notify function based on flags
authorJonathan Gray <jsg@jsg.id.au>
Sun, 12 Mar 2017 08:26:06 +0000 (19:26 +1100)
committerAlexander Graf <agraf@suse.de>
Mon, 3 Jul 2017 11:48:51 +0000 (13:48 +0200)
The UEFI specification states that the tpl, function and context
arguments are to be ignored if neither EVT_NOTIFY_WAIT or
EVT_NOTIFY_SIGNAL are specified.  This matches observed behaviour with
an AMI EDK2 based UEFI implementation.

Skip calling the notify function if neither flag is present.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Acked-By: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
include/efi_api.h
lib/efi_loader/efi_boottime.c

index 5c3836a51be944d1a9296024d48f8101e992ba3b..f071b36b53623e6e60baf515fd1ff9daa6b2cfdd 100644 (file)
@@ -28,6 +28,9 @@ enum efi_event_type {
        EFI_TIMER_RELATIVE = 2
 };
 
+#define EVT_NOTIFY_WAIT                0x00000100
+#define EVT_NOTIFY_SIGNAL      0x00000200
+
 /* EFI Boot Services table */
 struct efi_boot_services {
        struct efi_table_hdr hdr;
index 51080cbeed2f35d03fb1deb983a0d0a26021a92b..eb5946a95946f6f86cfcec90c30cbd0762b02a18 100644 (file)
@@ -210,7 +210,9 @@ void efi_timer_check(void)
                /* Triggering! */
                if (efi_event.trigger_type == EFI_TIMER_PERIODIC)
                        efi_event.trigger_next += efi_event.trigger_time / 10;
-               efi_event.notify_function(&efi_event, efi_event.notify_context);
+               if (efi_event.type & (EVT_NOTIFY_WAIT | EVT_NOTIFY_SIGNAL))
+                       efi_event.notify_function(&efi_event,
+                                                 efi_event.notify_context);
        }
 
        WATCHDOG_RESET();