TianoCore EDK2 master
Loading...
Searching...
No Matches
Event.c File Reference
#include "DxeMain.h"
#include "Event.h"

Go to the source code of this file.

Functions

VOID CoreAcquireEventLock (VOID)
 
VOID CoreReleaseEventLock (VOID)
 
EFI_STATUS CoreInitializeEventServices (VOID)
 
VOID CoreDispatchEventNotifies (IN EFI_TPL Priority)
 
VOID CoreNotifyEvent (IN IEVENT *Event)
 
VOID CoreNotifySignalList (IN EFI_GUID *EventGroup)
 
EFI_STATUS EFIAPI CoreCreateEvent (IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *Event)
 
EFI_STATUS EFIAPI CoreCreateEventEx (IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN CONST VOID *NotifyContext OPTIONAL, IN CONST EFI_GUID *EventGroup OPTIONAL, OUT EFI_EVENT *Event)
 
EFI_STATUS EFIAPI CoreCreateEventInternal (IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN CONST VOID *NotifyContext OPTIONAL, IN CONST EFI_GUID *EventGroup OPTIONAL, OUT EFI_EVENT *Event)
 
EFI_STATUS EFIAPI CoreSignalEvent (IN EFI_EVENT UserEvent)
 
EFI_STATUS EFIAPI CoreCheckEvent (IN EFI_EVENT UserEvent)
 
EFI_STATUS EFIAPI CoreWaitForEvent (IN UINTN NumberOfEvents, IN EFI_EVENT *UserEvents, OUT UINTN *UserIndex)
 
EFI_STATUS EFIAPI CoreCloseEvent (IN EFI_EVENT UserEvent)
 

Variables

EFI_TPL gEfiCurrentTpl = TPL_APPLICATION
 
EFI_LOCK gEventQueueLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL)
 
LIST_ENTRY gEventQueue [TPL_HIGH_LEVEL+1]
 
UINTN gEventPending = 0
 
LIST_ENTRY gEventSignalQueue = INITIALIZE_LIST_HEAD_VARIABLE (gEventSignalQueue)
 
UINT32 mEventTable []
 
EFI_EVENT gIdleLoopEvent = NULL
 

Detailed Description

UEFI Event support functions implemented in this file.

Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Event.c.

Function Documentation

◆ CoreAcquireEventLock()

VOID CoreAcquireEventLock ( VOID  )

Enter critical section by acquiring the lock on gEventQueueLock.

Definition at line 94 of file Event.c.

◆ CoreCheckEvent()

EFI_STATUS EFIAPI CoreCheckEvent ( IN EFI_EVENT  UserEvent)

Check the status of an event.

Parameters
UserEventThe event to check
Return values
EFI_SUCCESSThe event is in the signaled state
EFI_NOT_READYThe event is not in the signaled state
EFI_INVALID_PARAMETEREvent is of type EVT_NOTIFY_SIGNAL

Definition at line 573 of file Event.c.

◆ CoreCloseEvent()

EFI_STATUS EFIAPI CoreCloseEvent ( IN EFI_EVENT  UserEvent)

Closes an event and frees the event structure.

Parameters
UserEventEvent to close
Return values
EFI_INVALID_PARAMETERParameters are not valid.
EFI_SUCCESSThe event has been closed

Definition at line 700 of file Event.c.

◆ CoreCreateEvent()

EFI_STATUS EFIAPI CoreCreateEvent ( IN UINT32  Type,
IN EFI_TPL  NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction  OPTIONAL,
IN VOID *NotifyContext  OPTIONAL,
OUT EFI_EVENT Event 
)

Creates an event.

Parameters
TypeThe type of event to create and its mode and attributes
NotifyTplThe task priority level of event notifications
NotifyFunctionPointer to the events notification function
NotifyContextPointer to the notification functions context; corresponds to parameter "Context" in the notification function
EventPointer to the newly created event if the call succeeds; undefined otherwise
Return values
EFI_SUCCESSThe event structure was created
EFI_INVALID_PARAMETEROne of the parameters has an invalid value
EFI_OUT_OF_RESOURCESThe event could not be allocated

Definition at line 279 of file Event.c.

◆ CoreCreateEventEx()

EFI_STATUS EFIAPI CoreCreateEventEx ( IN UINT32  Type,
IN EFI_TPL  NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction  OPTIONAL,
IN CONST VOID *NotifyContext  OPTIONAL,
IN CONST EFI_GUID *EventGroup  OPTIONAL,
OUT EFI_EVENT Event 
)

Creates an event in a group.

Parameters
TypeThe type of event to create and its mode and attributes
NotifyTplThe task priority level of event notifications
NotifyFunctionPointer to the events notification function
NotifyContextPointer to the notification functions context; corresponds to parameter "Context" in the notification function
EventGroupGUID for EventGroup if NULL act the same as gBS->CreateEvent().
EventPointer to the newly created event if the call succeeds; undefined otherwise
Return values
EFI_SUCCESSThe event structure was created
EFI_INVALID_PARAMETEROne of the parameters has an invalid value
EFI_OUT_OF_RESOURCESThe event could not be allocated

Definition at line 312 of file Event.c.

◆ CoreCreateEventInternal()

EFI_STATUS EFIAPI CoreCreateEventInternal ( IN UINT32  Type,
IN EFI_TPL  NotifyTpl,
IN EFI_EVENT_NOTIFY NotifyFunction  OPTIONAL,
IN CONST VOID *NotifyContext  OPTIONAL,
IN CONST EFI_GUID *EventGroup  OPTIONAL,
OUT EFI_EVENT Event 
)

Creates a general-purpose event structure

Parameters
TypeThe type of event to create and its mode and attributes
NotifyTplThe task priority level of event notifications
NotifyFunctionPointer to the events notification function
NotifyContextPointer to the notification functions context; corresponds to parameter "Context" in the notification function
EventGroupGUID for EventGroup if NULL act the same as gBS->CreateEvent().
EventPointer to the newly created event if the call succeeds; undefined otherwise
Return values
EFI_SUCCESSThe event structure was created
EFI_INVALID_PARAMETEROne of the parameters has an invalid value
EFI_OUT_OF_RESOURCESThe event could not be allocated

Definition at line 358 of file Event.c.

◆ CoreDispatchEventNotifies()

VOID CoreDispatchEventNotifies ( IN EFI_TPL  Priority)

Dispatches all pending events.

Parameters
PriorityThe task priority level of event notifications to dispatch

Definition at line 152 of file Event.c.

◆ CoreInitializeEventServices()

EFI_STATUS CoreInitializeEventServices ( VOID  )

Initializes "event" support.

Return values
EFI_SUCCESSAlways return success

Definition at line 120 of file Event.c.

◆ CoreNotifyEvent()

VOID CoreNotifyEvent ( IN IEVENT Event)

Queues the event's notification function to fire.

Parameters
EventThe Event to notify

Definition at line 205 of file Event.c.

◆ CoreNotifySignalList()

VOID CoreNotifySignalList ( IN EFI_GUID EventGroup)

Signals all events in the EventGroup.

Parameters
EventGroupThe list to signal

Definition at line 238 of file Event.c.

◆ CoreReleaseEventLock()

VOID CoreReleaseEventLock ( VOID  )

Exit critical section by releasing the lock on gEventQueueLock.

Definition at line 106 of file Event.c.

◆ CoreSignalEvent()

EFI_STATUS EFIAPI CoreSignalEvent ( IN EFI_EVENT  UserEvent)

Signals the event. Queues the event to be notified if needed.

Parameters
UserEventThe event to signal .
Return values
EFI_INVALID_PARAMETERParameters are not valid.
EFI_SUCCESSThe event was signaled.

Definition at line 514 of file Event.c.

◆ CoreWaitForEvent()

EFI_STATUS EFIAPI CoreWaitForEvent ( IN UINTN  NumberOfEvents,
IN EFI_EVENT UserEvents,
OUT UINTN UserIndex 
)

Stops execution until an event is signaled.

Parameters
NumberOfEventsThe number of events in the UserEvents array
UserEventsAn array of EFI_EVENT
UserIndexPointer to the index of the event which satisfied the wait condition
Return values
EFI_SUCCESSThe event indicated by Index was signaled.
EFI_INVALID_PARAMETERThe event indicated by Index has a notification function or Event was not a valid type
EFI_UNSUPPORTEDThe current TPL is not TPL_APPLICATION

Definition at line 642 of file Event.c.

Variable Documentation

◆ gEfiCurrentTpl

EFI_TPL gEfiCurrentTpl = TPL_APPLICATION

gEfiCurrentTpl - Current Task priority level

Definition at line 16 of file Event.c.

◆ gEventPending

UINTN gEventPending = 0

gEventPending - A bitmask of the EventQueues that are pending

Definition at line 31 of file Event.c.

◆ gEventQueue

LIST_ENTRY gEventQueue[TPL_HIGH_LEVEL+1]

gEventQueue - A list of event's to notify for each priority level

Definition at line 26 of file Event.c.

◆ gEventQueueLock

EFI_LOCK gEventQueueLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL)

gEventQueueLock - Protects the event queues

Definition at line 21 of file Event.c.

◆ gEventSignalQueue

LIST_ENTRY gEventSignalQueue = INITIALIZE_LIST_HEAD_VARIABLE (gEventSignalQueue)

gEventSignalQueue - A list of events to signal based on EventGroup type

Definition at line 36 of file Event.c.

◆ gIdleLoopEvent

EFI_EVENT gIdleLoopEvent = NULL

gIdleLoopEvent - Event which is signalled when the core is idle

Definition at line 87 of file Event.c.

◆ mEventTable

UINT32 mEventTable[]
Initial value:
= {
EVT_TIMER | EVT_NOTIFY_SIGNAL,
EVT_TIMER,
EVT_NOTIFY_WAIT,
EVT_NOTIFY_SIGNAL,
EVT_SIGNAL_EXIT_BOOT_SERVICES,
EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
0x00000000,
EVT_TIMER | EVT_NOTIFY_WAIT,
}

Enumerate the valid types

Definition at line 41 of file Event.c.