X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EmulatorPkg%2FTimerDxe%2FTimer.c;h=dfd92acc8c1f2a144f3d51bae1d5c012f48916dc;hp=5230a9625e97a6843a5cc13b2903d140bc705666;hb=HEAD;hpb=e148512e5132e38accf2fe8188a9bdf9d1de02d8
diff --git a/EmulatorPkg/TimerDxe/Timer.c b/EmulatorPkg/TimerDxe/Timer.c
index 5230a9625e..4ec5c3ee28 100644
--- a/EmulatorPkg/TimerDxe/Timer.c
+++ b/EmulatorPkg/TimerDxe/Timer.c
@@ -5,15 +5,9 @@
timer service. In the future, the Thread creation should possibly be
abstracted by the CPU architectural protocol
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -33,12 +27,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
// Pointer to the CPU Architectural Protocol instance
//
-EFI_CPU_ARCH_PROTOCOL *mCpu;
+EFI_CPU_ARCH_PROTOCOL *mCpu;
//
// The Timer Architectural Protocol that this driver produces
//
-EFI_TIMER_ARCH_PROTOCOL mTimer = {
+EFI_TIMER_ARCH_PROTOCOL mTimer = {
EmuTimerDriverRegisterHandler,
EmuTimerDriverSetTimerPeriod,
EmuTimerDriverGetTimerPeriod,
@@ -48,22 +42,22 @@ EFI_TIMER_ARCH_PROTOCOL mTimer = {
//
// The notification function to call on every timer interrupt
//
-EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;
+EFI_TIMER_NOTIFY mTimerNotifyFunction = NULL;
//
// The current period of the timer interrupt
//
-UINT64 mTimerPeriodMs;
-
+UINT64 mTimerPeriodMs;
VOID
EFIAPI
-TimerCallback (UINT64 DeltaMs)
+TimerCallback (
+ UINT64 DeltaMs
+ )
{
EFI_TPL OriginalTPL;
EFI_TIMER_NOTIFY CallbackFunction;
-
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
if (OriginalTPL < TPL_HIGH_LEVEL) {
@@ -79,15 +73,15 @@ TimerCallback (UINT64 DeltaMs)
}
gBS->RestoreTPL (OriginalTPL);
-
}
EFI_STATUS
EFIAPI
EmuTimerDriverRegisterHandler (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- IN EFI_TIMER_NOTIFY NotifyFunction
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ IN EFI_TIMER_NOTIFY NotifyFunction
)
+
/*++
Routine Description:
@@ -133,11 +127,11 @@ Returns:
//
// Check for invalid parameters
//
- if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {
+ if ((NotifyFunction == NULL) && (mTimerNotifyFunction == NULL)) {
return EFI_INVALID_PARAMETER;
}
- if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {
+ if ((NotifyFunction != NULL) && (mTimerNotifyFunction != NULL)) {
return EFI_ALREADY_STARTED;
}
@@ -148,6 +142,7 @@ Returns:
/* Enable Timer. */
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
}
+
mTimerNotifyFunction = NotifyFunction;
return EFI_SUCCESS;
@@ -159,6 +154,7 @@ EmuTimerDriverSetTimerPeriod (
IN EFI_TIMER_ARCH_PROTOCOL *This,
IN UINT64 TimerPeriod
)
+
/*++
Routine Description:
@@ -196,14 +192,14 @@ 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)
- && (TimerPeriod < TIMER_MAXIMUM_VALUE))) {
+ if ( (TimerPeriod == 0)
+ || ( (TimerPeriod > TIMER_MINIMUM_VALUE)
+ && (TimerPeriod < TIMER_MAXIMUM_VALUE)))
+ {
mTimerPeriodMs = DivU64x32 (TimerPeriod + 5000, 10000);
gEmuThunk->SetTimer (mTimerPeriodMs, TimerCallback);
@@ -215,9 +211,10 @@ Returns:
EFI_STATUS
EFIAPI
EmuTimerDriverGetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ OUT UINT64 *TimerPeriod
)
+
/*++
Routine Description:
@@ -256,6 +253,7 @@ EFIAPI
EmuTimerDriverGenerateSoftInterrupt (
IN EFI_TIMER_ARCH_PROTOCOL *This
)
+
/*++
Routine Description:
@@ -276,7 +274,7 @@ Returns:
EFI_SUCCESS - The soft timer interrupt was generated.
- EFI_UNSUPPORTEDT - The platform does not support the generation of soft timer interrupts.
+ EFI_UNSUPPORTED - The platform does not support the generation of soft timer interrupts.
**/
{
@@ -289,6 +287,7 @@ EmuTimerDriverInitialize (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
+
/*++
Routine Description:
@@ -307,7 +306,7 @@ Returns:
EFI_OUT_OF_RESOURCES - Not enough resources available to initialize driver.
- EFI_DEVICE_ERROR - A device error occured attempting to initialize the driver.
+ EFI_DEVICE_ERROR - A device error occurred attempting to initialize the driver.
**/
{
@@ -347,6 +346,5 @@ Returns:
return Status;
}
-
return EFI_SUCCESS;
}