1 /** @file
2   UEFI Event support functions and structure.
3 
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution.  The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef __EVENT_H__
17 #define __EVENT_H__
18 
19 
20 #define VALID_TPL(a)            ((a) <= TPL_HIGH_LEVEL)
21 extern  UINTN                   gEventPending;
22 
23 ///
24 /// Set if Event is part of an event group
25 ///
26 #define EVT_EXFLAG_EVENT_GROUP                    0x01
27 ///
28 /// Set if Event is registered on a protocol notify
29 ///
30 #define EVT_EXFLAG_EVENT_PROTOCOL_NOTIFICATION    0x02
31 
32 //
33 // EFI_EVENT
34 //
35 
36 ///
37 /// Timer event information
38 ///
39 typedef struct {
40   LIST_ENTRY      Link;
41   UINT64          TriggerTime;
42   UINT64          Period;
43 } TIMER_EVENT_INFO;
44 
45 #define EVENT_SIGNATURE         SIGNATURE_32('e','v','n','t')
46 typedef struct {
47   UINTN                   Signature;
48   UINT32                  Type;
49   UINT32                  SignalCount;
50   ///
51   /// Entry if the event is registered to be signalled
52   ///
53   LIST_ENTRY              SignalLink;
54   ///
55   /// Notification information for this event
56   ///
57   EFI_TPL                 NotifyTpl;
58   EFI_EVENT_NOTIFY        NotifyFunction;
59   VOID                    *NotifyContext;
60   EFI_GUID                EventGroup;
61   LIST_ENTRY              NotifyLink;
62   UINT8                   ExFlag;
63   ///
64   /// A list of all runtime events
65   ///
66   EFI_RUNTIME_EVENT_ENTRY RuntimeData;
67   TIMER_EVENT_INFO        Timer;
68 } IEVENT;
69 
70 //
71 // Internal prototypes
72 //
73 
74 
75 /**
76   Dispatches all pending events.
77 
78   @param  Priority               The task priority level of event notifications
79                                  to dispatch
80 
81 **/
82 VOID
83 CoreDispatchEventNotifies (
84   IN EFI_TPL      Priority
85   );
86 
87 
88 /**
89   Initializes timer support.
90 
91 **/
92 VOID
93 CoreInitializeTimer (
94   VOID
95   );
96 
97 #endif
98