/*++\r
\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+Copyright (c) 2006 - 2007, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
Module Name:\r
\r
Abstract:\r
\r
EFI Event support\r
- \r
+\r
--*/\r
\r
\r
//\r
EFI_EVENT_TIMER,\r
//\r
- // 0x00000100 Generic event with a notification function that \r
+ // 0x00000100 Generic event with a notification function that\r
// can be waited on with CheckEvent() or WaitForEvent()\r
//\r
EFI_EVENT_NOTIFY_WAIT,\r
//\r
- // 0x00000200 Generic event with a notification function that \r
+ // 0x00000200 Generic event with a notification function that\r
// is queue when the event is signaled with SignalEvent()\r
//\r
EFI_EVENT_NOTIFY_SIGNAL,\r
//\r
- // 0x00000201 ExitBootServicesEvent. \r
+ // 0x00000201 ExitBootServicesEvent.\r
//\r
EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
//\r
//\r
EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
\r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
- //\r
- // 0x00000203 ReadyToBootEvent.\r
- //\r
- EFI_EVENT_SIGNAL_READY_TO_BOOT,\r
- //\r
- // 0x00000204 LegacyBootEvent.\r
- //\r
- EFI_EVENT_SIGNAL_LEGACY_BOOT,\r
- //\r
- // 0x00000603 Signal all ReadyToBootEvents.\r
- //\r
- EFI_EVENT_NOTIFY_SIGNAL_ALL | EFI_EVENT_SIGNAL_READY_TO_BOOT,\r
- //\r
- // 0x00000604 Signal all LegacyBootEvents.\r
- //\r
- EFI_EVENT_NOTIFY_SIGNAL_ALL | EFI_EVENT_SIGNAL_LEGACY_BOOT,\r
-#endif\r
-\r
//\r
- // 0x00000000 Generic event without a notification function. \r
- // It can be signaled with SignalEvent() and checked with CheckEvent() \r
+ // 0x00000000 Generic event without a notification function.\r
+ // It can be signaled with SignalEvent() and checked with CheckEvent()\r
// or WaitForEvent().\r
//\r
0x00000000,\r
//\r
- // 0x80000100 Timer event with a notification function that can be \r
+ // 0x80000100 Timer event with a notification function that can be\r
// waited on with CheckEvent() or WaitForEvent()\r
//\r
EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_WAIT,\r
Arguments:\r
\r
None\r
- \r
+\r
Returns:\r
\r
EFI_SUCCESS - Always return success\r
}\r
\r
CoreInitializeTimer ();\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
\r
Routine Description:\r
\r
- Dispatches all pending events. \r
+ Dispatches all pending events.\r
\r
Arguments:\r
\r
Priority - The task priority level of event notifications to dispatch\r
- \r
+\r
Returns:\r
\r
None\r
{\r
IEVENT *Event;\r
LIST_ENTRY *Head;\r
- \r
+\r
CoreAcquireEventLock ();\r
ASSERT (gEventQueueLock.OwnerTpl == Priority);\r
Head = &gEventQueue[Priority];\r
// Dispatch all the pending notifications\r
//\r
while (!IsListEmpty (Head)) {\r
- \r
+\r
Event = CR (Head->ForwardLink, IEVENT, NotifyLink, EVENT_SIGNATURE);\r
RemoveEntryList (&Event->NotifyLink);\r
\r
}\r
\r
CoreReleaseEventLock ();\r
- \r
+\r
//\r
// Notify this event\r
//\r
Arguments:\r
\r
Event - The Event to notify\r
- \r
+\r
Returns:\r
\r
None\r
Event->NotifyLink.ForwardLink = NULL;\r
}\r
\r
- // \r
+ //\r
// Queue the event to the pending notification list\r
//\r
\r
\r
Arguments:\r
EventGroup - The list to signal\r
- \r
+\r
Returns:\r
\r
None\r
CoreReleaseEventLock ();\r
}\r
\r
-\r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
-\r
-static\r
-VOID\r
-EFIAPI\r
-EventNotifySignalAllNullEvent (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-{\r
- //\r
- // This null event is a size efficent way to enusre that \r
- // EFI_EVENT_NOTIFY_SIGNAL_ALL is error checked correctly.\r
- // EFI_EVENT_NOTIFY_SIGNAL_ALL is now mapped into \r
- // CreateEventEx() and this function is used to make the\r
- // old error checking in CreateEvent() for Tiano extensions\r
- // function.\r
- //\r
- return;\r
-}\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
EFI_STATUS\r
EFIAPI\r
CoreCreateEvent (\r
EFI_OUT_OF_RESOURCES - The event could not be allocated\r
\r
--*/\r
-{ \r
+{\r
EFI_GUID *GuidPtr;\r
EFI_EVENT_NOTIFY Function;\r
- \r
+\r
GuidPtr = NULL;\r
Function = NotifyFunction;\r
\r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
- //\r
- // Clear EFI_EVENT_NOFITY_SIGNAL_ALL (Tiano extension) as all events in the \r
- // EventGroup now have this property. So we need to filter it out.\r
- //\r
- if (Type & EFI_EVENT_NOTIFY_SIGNAL_ALL) {\r
- Type &= ~EFI_EVENT_NOTIFY_SIGNAL_ALL;\r
- Function = EventNotifySignalAllNullEvent;\r
- }\r
-\r
- //\r
- // Map the Tiano extensions Events to CreateEventEx form\r
- //\r
- if (Type == EFI_EVENT_SIGNAL_READY_TO_BOOT) {\r
- GuidPtr = &gEfiEventReadyToBootGuid;\r
- } else if (Type == EFI_EVENT_SIGNAL_LEGACY_BOOT) {\r
- GuidPtr = &gEfiEventLegacyBootGuid\r
- }\r
-#endif\r
-\r
//\r
// Convert EFI 1.10 Events to thier UEFI 2.0 CreateEventEx mapping\r
- // \r
+ //\r
if (Type == EVENT_SIGNAL_EXIT_BOOT_SERVICES) {\r
GuidPtr = &gEfiEventExitBootServicesGuid;\r
} else if (Type == EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {\r
GuidPtr = &gEfiEventVirtualAddressChangeGuid;\r
}\r
- \r
+\r
return CoreCreateEventEx (Type, NotifyTpl, Function, NotifyContext, GuidPtr, Event);\r
}\r
\r
//\r
// Check for an invalid NotifyFunction or NotifyTpl\r
//\r
- if ((NotifyFunction == NULL) || \r
- (NotifyTpl < EFI_TPL_APPLICATION) || \r
+ if ((NotifyFunction == NULL) ||\r
+ (NotifyTpl < EFI_TPL_APPLICATION) ||\r
(NotifyTpl >= EFI_TPL_HIGH_LEVEL)) {\r
return EFI_INVALID_PARAMETER;\r
}\r
// Allcoate and initialize a new event structure.\r
//\r
Status = CoreAllocatePool (\r
- (Type & EFI_EVENT_RUNTIME) ? EfiRuntimeServicesData: EfiBootServicesData, \r
+ (Type & EFI_EVENT_RUNTIME) ? EfiRuntimeServicesData: EfiBootServicesData,\r
sizeof (IEVENT),\r
(VOID **)&IEvent\r
);\r
\r
IEvent->Signature = EVENT_SIGNATURE;\r
IEvent->Type = Type;\r
- \r
+\r
IEvent->NotifyTpl = NotifyTpl;\r
IEvent->NotifyFunction = NotifyFunction;\r
IEvent->NotifyContext = (VOID *)NotifyContext;\r
}\r
\r
CoreAcquireEventLock ();\r
- \r
+\r
if ((Type & EFI_EVENT_NOTIFY_SIGNAL) != 0x00000000) {\r
//\r
// The Event's NotifyFunction must be queued whenever the event is signaled\r
//\r
InsertHeadList (&gEventSignalQueue, &IEvent->SignalLink);\r
}\r
- \r
+\r
CoreReleaseEventLock ();\r
- \r
+\r
//\r
// Done\r
//\r
Routine Description:\r
\r
Signals the event. Queues the event to be notified if needed\r
- \r
+\r
Arguments:\r
\r
UserEvent - The event to signal\r
- \r
+\r
Returns:\r
\r
EFI_INVALID_PARAMETER - Parameters are not valid.\r
- \r
+\r
EFI_SUCCESS - The event was signaled.\r
\r
--*/\r
if (Event->Type & EFI_EVENT_NOTIFY_SIGNAL) {\r
if (Event->ExFlag) {\r
//\r
- // The CreateEventEx() style requires all members of the Event Group \r
- // to be signaled. \r
+ // The CreateEventEx() style requires all members of the Event Group\r
+ // to be signaled.\r
//\r
CoreReleaseEventLock ();\r
CoreNotifySignalList (&Event->EventGroup);\r
Routine Description:\r
\r
Check the status of an event\r
- \r
+\r
Arguments:\r
\r
UserEvent - The event to check\r
- \r
+\r
Returns:\r
\r
EFI_SUCCESS - The event is in the signaled state\r
Routine Description:\r
\r
Stops execution until an event is signaled.\r
- \r
+\r
Arguments:\r
\r
NumberOfEvents - The number of events in the UserEvents array\r
UserEvents - An array of EFI_EVENT\r
UserIndex - Pointer to the index of the event which satisfied the wait condition\r
- \r
+\r
Returns:\r
\r
EFI_SUCCESS - The event indicated by Index was signaled.\r
- EFI_INVALID_PARAMETER - The event indicated by Index has a notification function or \r
+ EFI_INVALID_PARAMETER - The event indicated by Index has a notification function or\r
Event was not a valid type\r
EFI_UNSUPPORTED - The current TPL is not TPL_APPLICATION\r
\r
}\r
\r
for(;;) {\r
- \r
+\r
for(Index = 0; Index < NumberOfEvents; Index++) {\r
\r
Status = CoreCheckEvent (UserEvents[Index]);\r
//\r
// This was the location of the Idle loop callback in EFI 1.x reference\r
// code. We don't have that concept in this base at this point.\r
- // \r
+ //\r
}\r
}\r
\r
Routine Description:\r
\r
Closes an event and frees the event structure.\r
- \r
+\r
Arguments:\r
\r
UserEvent - Event to close\r
- \r
+\r
Returns:\r
\r
EFI_INVALID_PARAMETER - Parameters are not valid.\r
- \r
+\r
EFI_SUCCESS - The event has been closed\r
\r
--*/\r
//\r
// If the event is queued somewhere, remove it\r
//\r
- \r
+\r
if (Event->RuntimeData.Link.ForwardLink != NULL) {\r
RemoveEntryList (&Event->RuntimeData.Link);\r
}\r
- \r
+\r
if (Event->NotifyLink.ForwardLink != NULL) {\r
RemoveEntryList (&Event->NotifyLink);\r
}\r