summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg/Library
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2014-06-20 18:23:37 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-06-20 18:23:37 +0000
commitec6b8eda8fcb2e53fb90ee8d38c58cbe6d602665 (patch)
treef9ebe1cc5b2dec1fbf925e7989748e632ddb9684 /ArmPlatformPkg/Library
parent97be2801745630eab090446211289a6315040a30 (diff)
downloadedk2-ec6b8eda8fcb2e53fb90ee8d38c58cbe6d602665.tar.gz
edk2-ec6b8eda8fcb2e53fb90ee8d38c58cbe6d602665.tar.bz2
edk2-ec6b8eda8fcb2e53fb90ee8d38c58cbe6d602665.zip
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 <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15577 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPlatformPkg/Library')
-rw-r--r--ArmPlatformPkg/Library/SP804TimerLib/SP804TimerLib.c12
1 files changed, 4 insertions, 8 deletions
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.<BR>
- 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);