summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Core/Dxe/Event
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-18 09:50:09 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2008-07-18 09:50:09 +0000
commite94a9ff7271367e649ee4f9a86da1f1bea6d112e (patch)
treebcf3077b88cb89d1e7127285b6c54d9658f67287 /MdeModulePkg/Core/Dxe/Event
parentff61847ddc91285a9ef8be00b89304870c493ef8 (diff)
downloadedk2-platforms-e94a9ff7271367e649ee4f9a86da1f1bea6d112e.tar.xz
Code scrub for DxeCore
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5520 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe/Event')
-rw-r--r--MdeModulePkg/Core/Dxe/Event/Event.c14
-rw-r--r--MdeModulePkg/Core/Dxe/Event/Timer.c38
-rw-r--r--MdeModulePkg/Core/Dxe/Event/Tpl.c12
3 files changed, 24 insertions, 40 deletions
diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c b/MdeModulePkg/Core/Dxe/Event/Event.c
index 5e0b9c70ab..1f458a402a 100644
--- a/MdeModulePkg/Core/Dxe/Event/Event.c
+++ b/MdeModulePkg/Core/Dxe/Event/Event.c
@@ -92,7 +92,6 @@ CoreReleaseEventLock (
/**
Initializes "event" support and populates parts of the System and Runtime Table.
-
@retval EFI_SUCCESS Always return success
**/
@@ -385,7 +384,7 @@ CoreCreateEventEx (
return EFI_OUT_OF_RESOURCES;
}
- SetMem (IEvent, sizeof (IEVENT), 0);
+ ZeroMem (IEvent, sizeof (IEVENT));
IEvent->Signature = EVENT_SIGNATURE;
IEvent->Type = Type;
@@ -433,9 +432,9 @@ CoreCreateEventEx (
/**
- Signals the event. Queues the event to be notified if needed
+ Signals the event. Queues the event to be notified if needed.
- @param UserEvent The event to signal
+ @param UserEvent The event to signal .
@retval EFI_INVALID_PARAMETER Parameters are not valid.
@retval EFI_SUCCESS The event was signaled.
@@ -521,7 +520,7 @@ CoreCheckEvent (
return EFI_INVALID_PARAMETER;
}
- if (Event->Type & EVT_NOTIFY_SIGNAL) {
+ if ((Event->Type & EVT_NOTIFY_SIGNAL) != 0) {
return EFI_INVALID_PARAMETER;
}
@@ -532,7 +531,6 @@ CoreCheckEvent (
//
// Queue the wait notify function
//
-
CoreAcquireEventLock ();
if (!Event->SignalCount) {
CoreNotifyEvent (Event);
@@ -560,7 +558,6 @@ CoreCheckEvent (
-
/**
Stops execution until an event is signaled.
@@ -616,7 +613,6 @@ CoreWaitForEvent (
}
-
/**
Closes an event and frees the event structure.
@@ -648,7 +644,7 @@ CoreCloseEvent (
//
// If it's a timer event, make sure it's not pending
//
- if (Event->Type & EVT_TIMER) {
+ if ((Event->Type & EVT_TIMER) != 0) {
CoreSetTimer (Event, TimerCancel, 0);
}
diff --git a/MdeModulePkg/Core/Dxe/Event/Timer.c b/MdeModulePkg/Core/Dxe/Event/Timer.c
index c163266617..924499e004 100644
--- a/MdeModulePkg/Core/Dxe/Event/Timer.c
+++ b/MdeModulePkg/Core/Dxe/Event/Timer.c
@@ -60,18 +60,16 @@ CoreInsertEventTimer (
// Internal data
//
-STATIC LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);
-STATIC EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);
-STATIC EFI_EVENT mEfiCheckTimerEvent;
+LIST_ENTRY mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);
+EFI_LOCK mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);
+EFI_EVENT mEfiCheckTimerEvent = NULL;
-STATIC EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
-STATIC UINT64 mEfiSystemTime = 0;
+EFI_LOCK mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
+UINT64 mEfiSystemTime = 0;
//
// Timer functions
//
-
-
/**
Initializes timer support.
@@ -84,12 +82,12 @@ CoreInitializeTimer (
EFI_STATUS Status;
Status = CoreCreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_HIGH_LEVEL - 1,
- CoreCheckTimers,
- NULL,
- &mEfiCheckTimerEvent
- );
+ EVT_NOTIFY_SIGNAL,
+ TPL_HIGH_LEVEL - 1,
+ CoreCheckTimers,
+ NULL,
+ &mEfiCheckTimerEvent
+ );
ASSERT_EFI_ERROR (Status);
}
@@ -110,6 +108,7 @@ CoreCurrentSystemTime (
CoreAcquireLock (&mEfiSystemTimeLock);
SystemTime = mEfiSystemTime;
CoreReleaseLock (&mEfiSystemTimeLock);
+
return SystemTime;
}
@@ -132,20 +131,17 @@ CoreTimerTick (
//
// Check runtiem flag in case there are ticks while exiting boot services
//
-
CoreAcquireLock (&mEfiSystemTimeLock);
//
// Update the system time
//
-
mEfiSystemTime += Duration;
//
// If the head of the list is expired, fire the timer event
// to process it
//
-
if (!IsListEmpty (&mEfiTimerList)) {
Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, EVENT_SIGNATURE);
@@ -179,7 +175,6 @@ CoreCheckTimers (
//
// Check the timer database for expired timers
//
-
CoreAcquireLock (&mEfiTimerLock);
SystemTime = CoreCurrentSystemTime ();
@@ -189,7 +184,6 @@ CoreCheckTimers (
//
// If this timer is not expired, then we're done
//
-
if (Event->u.Timer.TriggerTime > SystemTime) {
break;
}
@@ -210,11 +204,9 @@ CoreCheckTimers (
// If this is a periodic timer, set it
//
if (Event->u.Timer.Period) {
-
//
// Compute the timers new trigger time
//
-
Event->u.Timer.TriggerTime = Event->u.Timer.TriggerTime + Event->u.Timer.Period;
//
@@ -228,7 +220,6 @@ CoreCheckTimers (
//
// Add the timer
//
-
CoreInsertEventTimer (Event);
}
}
@@ -258,13 +249,11 @@ CoreInsertEventTimer (
//
// Get the timer's trigger time
//
-
TriggerTime = Event->u.Timer.TriggerTime;
//
// Insert the timer into the timer database in assending sorted order
//
-
for (Link = mEfiTimerList.ForwardLink; Link != &mEfiTimerList; Link = Link->ForwardLink) {
Event2 = CR (Link, IEVENT, u.Timer.Link, EVENT_SIGNATURE);
@@ -278,7 +267,6 @@ CoreInsertEventTimer (
-
/**
Sets the type of timer and the trigger time for a timer event.
@@ -323,7 +311,6 @@ CoreSetTimer (
//
// If the timer is queued to the timer database, remove it
//
-
if (Event->u.Timer.Link.ForwardLink != NULL) {
RemoveEntryList (&Event->u.Timer.Link);
Event->u.Timer.Link.ForwardLink = NULL;
@@ -347,5 +334,6 @@ CoreSetTimer (
}
CoreReleaseLock (&mEfiTimerLock);
+
return EFI_SUCCESS;
}
diff --git a/MdeModulePkg/Core/Dxe/Event/Tpl.c b/MdeModulePkg/Core/Dxe/Event/Tpl.c
index 1fbf39ece3..4f63889709 100644
--- a/MdeModulePkg/Core/Dxe/Event/Tpl.c
+++ b/MdeModulePkg/Core/Dxe/Event/Tpl.c
@@ -1,5 +1,5 @@
/** @file
- Task priority (TPL) function
+ Task priority (TPL) functions.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -52,14 +52,14 @@ CoreHighestSetBit (
IN UINTN Number
)
{
- UINTN msb;
+ UINTN Msb;
- msb = 31;
- while ((msb > 0) && ((Number & (UINTN)(1 << msb)) == 0)) {
- msb--;
+ Msb = 31;
+ while ((Msb > 0) && ((Number & (UINTN)(1 << Msb)) == 0)) {
+ Msb--;
}
- return msb;
+ return Msb;
}