From ccd55824e79865a04b1c872bda4af0f1de1f50be Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Tue, 25 Aug 2009 07:29:13 +0000 Subject: Integrate patch from Andrew Fish to make it run on OS X. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9194 6f19259b-4bc3-4df7-8a09-765794883524 --- UnixPkg/TimerDxe/Timer.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'UnixPkg/TimerDxe') diff --git a/UnixPkg/TimerDxe/Timer.c b/UnixPkg/TimerDxe/Timer.c index 53b5656..7f43a36 100644 --- a/UnixPkg/TimerDxe/Timer.c +++ b/UnixPkg/TimerDxe/Timer.c @@ -62,7 +62,7 @@ UINT64 mTimerPeriodMs; VOID -TimerCallback (UINT64 DeltaMs) +TimerCallback (UINT64 DeltaMs) /*++ Routine Description: @@ -84,12 +84,12 @@ Returns: --*/ { EFI_TPL OriginalTPL; - EFI_TIMER_NOTIFY CallbackFunction; - + EFI_TIMER_NOTIFY CallbackFunction; + OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL); - if (OriginalTPL < TPL_HIGH_LEVEL) { + if (OriginalTPL < TPL_HIGH_LEVEL) { CallbackFunction = mTimerNotifyFunction; // @@ -99,7 +99,7 @@ Returns: if (CallbackFunction != NULL) { CallbackFunction ((UINT64) (DeltaMs * 10000)); } - } + } gBS->RestoreTPL (OriginalTPL); @@ -164,13 +164,13 @@ Returns: return EFI_ALREADY_STARTED; } - if (NotifyFunction == NULL) { - /* Disable timer. */ - gUnix->SetTimer (0, TimerCallback); - } else if (mTimerNotifyFunction == NULL) { - /* Enable Timer. */ - gUnix->SetTimer (mTimerPeriodMs, TimerCallback); - } + if (NotifyFunction == NULL) { + /* Disable timer. */ + gUnix->SetTimer (0, TimerCallback); + } else if (mTimerNotifyFunction == NULL) { + /* Enable Timer. */ + gUnix->SetTimer (mTimerPeriodMs, TimerCallback); + } mTimerNotifyFunction = NotifyFunction; return EFI_SUCCESS; @@ -224,13 +224,13 @@ Returns: // If TimerPeriod is 0, then the timer thread should be canceled // If the TimerPeriod is valid, then create and/or adjust the period of the timer thread // - if (TimerPeriod == 0 - || ((TimerPeriod > TIMER_MINIMUM_VALUE) + if (TimerPeriod == 0 + || ((TimerPeriod > TIMER_MINIMUM_VALUE) && (TimerPeriod < TIMER_MAXIMUM_VALUE))) { mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000); - - gUnix->SetTimer (mTimerPeriodMs, TimerCallback); - } + + gUnix->SetTimer (mTimerPeriodMs, TimerCallback); + } return EFI_SUCCESS; } @@ -369,6 +369,6 @@ Returns: if (EFI_ERROR (Status)) { return Status; } - + return EFI_SUCCESS; } -- cgit v1.1