Justin,

This looks like a bug in the DXE Core. 

As you point out the example in the UEFI spec on how to signal the event does 
not work in the edk2. I do not see a hard requirement that all events in an 
event group need to have a notification function. The spec seems to say the 
opposite, that all the notification functions associated with the event will be 
signaled by the DXE Core. 

UEFI 2.4 SignalEvent() Description

ThesuppliedEventisplacedinthesignaledstate. 
IfEventisalreadyinthesignaledstate,then EFI_SUCCESS is returned. If Event is of 
type EVT_NOTIFY_SIGNAL, then the event’s notification function is scheduled to 
be invoked at the event’s notification task priority level. SignalEvent() may 
be invoked from any task priority level.

If the supplied Event is a part of an event group, then all of the events in 
the event group are also signaled and their notification functions are 
scheduled.

When signaling an event group, it is possible to create an event in the group, 
signal it and then close the event to remove it from the group. For example:
       EFI_EVENT Event;
       EFI_GUID gMyEventGroupGuid = EFI_MY_EVENT_GROUP_GUID;
       gBS->CreateEventEx (
             0,
             0,
             NULL,
             NULL,
             &gMyEventGroupGuid,
             &Event
       );
       gBS->SignalEvent (Event);
       gBS->CloseEvent (Event);

Thanks,

Andrew Fish

PS I hit this a few days ago and ended up adding the dummy callback event to 
make it work. I guess I should have double checked the spec! 

On May 30, 2014, at 11:00 AM, justin_johns...@dell.com wrote:

> Hello all,
> I’m working with the DXE core event services and am not sure that the code in 
> MdeModulePkg agrees with the UEFI spec.
> The situation is this: in several modules I have created an event using the 
> CreateEventEx() method, with an EventGroup GUID. Later, I want to signal the 
> event group, but the module which does the signaling does not have any work 
> to do in response to the event. It would seem that I can signal the event by 
> doing as indicated in the UEFI spec:
> gBS->CreateEventEx (
>   0,
>   0,
>   NULL,
>   NULL,
>   &gMyEventGroupGuid,
>   &Event);
> gBS->SignalEvent(Event);
>  
> However, this does not work with EDKII. I see in Event.c :
> if ((Event->Type & EVT_NOTIFY_SIGNAL) != 0) {
>       if (Event->ExFlag) {
>         //
>         // The CreateEventEx() style requires all members of the Event Group
>         //  to be signaled.
>         //
>         CoreReleaseEventLock ();
>         CoreNotifySignalList (&Event->EventGroup);
>         CoreAcquireEventLock ();
>  
> Which seems to indicate that the event group is only signaled if the event 
> being signaled is of type EVT_NOTIFY_SIGNAL. In order to get my event group 
> signaled, I must create an event with a dummy callback and give it type 
> EVT_NOTIFY_SIGNAL, even though I do not have any work to do in response to 
> the event.
>  
> Is this an error in MdeModulePkg’s implementation? Or is the spec incomplete?
>  
> Thanks.
>  
> --
> Justin Johnson
> Platform Software Engineer
> Dell, Inc.
>  
> ------------------------------------------------------------------------------
> Time is money. Stop wasting it! Get your web API in 5 minutes.
> www.restlet.com/download
> http://p.sf.net/sfu/restlet_______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to