mirror of https://github.com/acidanthera/audk.git
Adjust the function layout of Timer.c to remove the prototype to reduce sync efforts.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5918 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
3f1435782f
commit
f94b9be34f
|
@ -15,47 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
#include "DxeMain.h"
|
#include "DxeMain.h"
|
||||||
|
|
||||||
//
|
|
||||||
// Internal prototypes
|
|
||||||
//
|
|
||||||
/**
|
|
||||||
Returns the current system time.
|
|
||||||
|
|
||||||
@return The current system time
|
|
||||||
|
|
||||||
**/
|
|
||||||
UINT64
|
|
||||||
CoreCurrentSystemTime (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Checks the sorted timer list against the current system time.
|
|
||||||
Signals any expired event timer.
|
|
||||||
|
|
||||||
@param CheckEvent Not used
|
|
||||||
@param Context Not used
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
CoreCheckTimers (
|
|
||||||
IN EFI_EVENT CheckEvent,
|
|
||||||
IN VOID *Context
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Inserts the timer event.
|
|
||||||
|
|
||||||
@param Event Points to the internal structure of timer event
|
|
||||||
to be installed
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
CoreInsertEventTimer (
|
|
||||||
IN IEVENT *Event
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Internal data
|
// Internal data
|
||||||
//
|
//
|
||||||
|
@ -71,27 +30,42 @@ UINT64 mEfiSystemTime = 0;
|
||||||
// Timer functions
|
// Timer functions
|
||||||
//
|
//
|
||||||
/**
|
/**
|
||||||
Initializes timer support.
|
Inserts the timer event.
|
||||||
|
|
||||||
|
@param Event Points to the internal structure of timer event
|
||||||
|
to be installed
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
CoreInitializeTimer (
|
CoreInsertEventTimer (
|
||||||
VOID
|
IN IEVENT *Event
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
UINT64 TriggerTime;
|
||||||
|
LIST_ENTRY *Link;
|
||||||
|
IEVENT *Event2;
|
||||||
|
|
||||||
Status = CoreCreateEvent (
|
ASSERT_LOCKED (&mEfiTimerLock);
|
||||||
EVT_NOTIFY_SIGNAL,
|
|
||||||
TPL_HIGH_LEVEL - 1,
|
//
|
||||||
CoreCheckTimers,
|
// Get the timer's trigger time
|
||||||
NULL,
|
//
|
||||||
&mEfiCheckTimerEvent
|
TriggerTime = Event->u.Timer.TriggerTime;
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
//
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
if (Event2->u.Timer.TriggerTime > TriggerTime) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InsertTailList (Link, &Event->u.Timer.Link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns the current system time.
|
Returns the current system time.
|
||||||
|
|
||||||
|
@ -112,48 +86,6 @@ CoreCurrentSystemTime (
|
||||||
return SystemTime;
|
return SystemTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Called by the platform code to process a tick.
|
|
||||||
|
|
||||||
@param Duration The number of 100ns elasped since the last call
|
|
||||||
to TimerTick
|
|
||||||
|
|
||||||
**/
|
|
||||||
VOID
|
|
||||||
EFIAPI
|
|
||||||
CoreTimerTick (
|
|
||||||
IN UINT64 Duration
|
|
||||||
)
|
|
||||||
{
|
|
||||||
IEVENT *Event;
|
|
||||||
|
|
||||||
//
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
if (Event->u.Timer.TriggerTime <= mEfiSystemTime) {
|
|
||||||
CoreSignalEvent (mEfiCheckTimerEvent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CoreReleaseLock (&mEfiSystemTimeLock);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Checks the sorted timer list against the current system time.
|
Checks the sorted timer list against the current system time.
|
||||||
Signals any expired event timer.
|
Signals any expired event timer.
|
||||||
|
@ -229,40 +161,65 @@ CoreCheckTimers (
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Inserts the timer event.
|
Initializes timer support.
|
||||||
|
|
||||||
@param Event Points to the internal structure of timer event
|
|
||||||
to be installed
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
CoreInsertEventTimer (
|
CoreInitializeTimer (
|
||||||
IN IEVENT *Event
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 TriggerTime;
|
EFI_STATUS Status;
|
||||||
LIST_ENTRY *Link;
|
|
||||||
IEVENT *Event2;
|
|
||||||
|
|
||||||
ASSERT_LOCKED (&mEfiTimerLock);
|
Status = CoreCreateEvent (
|
||||||
|
EVT_NOTIFY_SIGNAL,
|
||||||
|
TPL_HIGH_LEVEL - 1,
|
||||||
|
CoreCheckTimers,
|
||||||
|
NULL,
|
||||||
|
&mEfiCheckTimerEvent
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Called by the platform code to process a tick.
|
||||||
|
|
||||||
|
@param Duration The number of 100ns elasped since the last call
|
||||||
|
to TimerTick
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
CoreTimerTick (
|
||||||
|
IN UINT64 Duration
|
||||||
|
)
|
||||||
|
{
|
||||||
|
IEVENT *Event;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the timer's trigger time
|
// Check runtiem flag in case there are ticks while exiting boot services
|
||||||
//
|
//
|
||||||
TriggerTime = Event->u.Timer.TriggerTime;
|
CoreAcquireLock (&mEfiSystemTimeLock);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Insert the timer into the timer database in assending sorted order
|
// Update the system time
|
||||||
//
|
//
|
||||||
for (Link = mEfiTimerList.ForwardLink; Link != &mEfiTimerList; Link = Link->ForwardLink) {
|
mEfiSystemTime += Duration;
|
||||||
Event2 = CR (Link, IEVENT, u.Timer.Link, EVENT_SIGNATURE);
|
|
||||||
|
|
||||||
if (Event2->u.Timer.TriggerTime > TriggerTime) {
|
//
|
||||||
break;
|
// 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);
|
||||||
|
|
||||||
|
if (Event->u.Timer.TriggerTime <= mEfiSystemTime) {
|
||||||
|
CoreSignalEvent (mEfiCheckTimerEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InsertTailList (Link, &Event->u.Timer.Link);
|
CoreReleaseLock (&mEfiSystemTimeLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue