From: Olivier Martin Date: Fri, 20 Jun 2014 18:23:37 +0000 (+0000) Subject: ArmPlatformPkg/SP804TimerLib: Checked both Metronome and Performance timers are initi... X-Git-Tag: edk2-stable201903~11415 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ec6b8eda8fcb2e53fb90ee8d38c58cbe6d602665;p=mirror_edk2.git ArmPlatformPkg/SP804TimerLib: Checked both Metronome and Performance timers are initialized Prior to this change if Metronome timer was already initialized the initialization of the Performance timer was skipped. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15577 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c b/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c index a042dac9a3..2d9b7ccb3e 100644 --- a/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c +++ b/ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c @@ -1,8 +1,8 @@ /** @file Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
- Copyright (c) 2011, ARM Limited. All rights reserved. - + Copyright (c) 2011 - 2014, ARM Limited. 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 @@ -34,9 +34,7 @@ TimerConstructor ( ) { // Check if the Metronome Timer is already initialized - if (MmioRead32(SP804_TIMER_METRONOME_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) { - return RETURN_SUCCESS; - } else { + if ((MmioRead32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) == 0) { // Configure the Metronome Timer for free running operation, 32 bits, no prescaler, and interrupt disabled MmioWrite32 (SP804_TIMER_METRONOME_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_32BIT | SP804_PRESCALE_DIV_1); @@ -45,9 +43,7 @@ TimerConstructor ( } // Check if the Performance Timer is already initialized - if (MmioRead32(SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) { - return RETURN_SUCCESS; - } else { + if ((MmioRead32 (SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CONTROL_REG) & SP804_TIMER_CTRL_ENABLE) == 0) { // Configure the Performance timer for free running operation, 32 bits, no prescaler, interrupt disabled MmioWrite32 (SP804_TIMER_PERFORMANCE_BASE + SP804_TIMER_CONTROL_REG, SP804_TIMER_CTRL_32BIT | SP804_PRESCALE_DIV_1);