/* This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext. This event is signaled with  */
EFI_STATUS EFIAPI EfiNamedEventListen(IN CONST EFI_GUID *Name, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN CONST VOID *NotifyContext OPTIONAL, OUT VOID *Registration OPTIONAL)
/* This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext. This event is signaled with  */
EFI_STATUS EFIAPI EfiNamedEventListen(IN CONST EFI_GUID *Name, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN CONST VOID *NotifyContext OPTIONAL, OUT VOID *Registration OPTIONAL)
{
  EFI_STATUS  Status;
  EFI_EVENT   Event;
  VOID        *RegistrationLocal;
  ASSERT (Name != NULL);
  ASSERT (NotifyFunction != NULL);
  ASSERT (NotifyTpl <= TPL_HIGH_LEVEL);
  Status = gBS->CreateEvent (
                  EVT_NOTIFY_SIGNAL,
                  NotifyTpl,
                  NotifyFunction,
                  (VOID *)NotifyContext,
                  &Event
                  );
  ASSERT_EFI_ERROR (Status);
  if (Registration != NULL) {
    RegistrationLocal = Registration;
  } else {
    RegistrationLocal = &RegistrationLocal;
  }
  Status = gBS->RegisterProtocolNotify (
                  (EFI_GUID *)Name,
                  Event,
                  RegistrationLocal
                  );
  ASSERT_EFI_ERROR (Status);
  return Status;
}