aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2021-12-20 22:22:47 +1000
committerCédric Le Goater <clg@kaod.org>2022-01-03 16:12:45 +0100
commit0475a94b2faa9685eb8f4314e9a0d0e42771ea57 (patch)
tree5eb5beabf235911ed4c0d2856ac5ccd24428dc55 /core
parenta6816a42c1f40481c998177b2b88329984ed25b2 (diff)
downloadskiboot-0475a94b2faa9685eb8f4314e9a0d0e42771ea57.zip
skiboot-0475a94b2faa9685eb8f4314e9a0d0e42771ea57.tar.gz
skiboot-0475a94b2faa9685eb8f4314e9a0d0e42771ea57.tar.bz2
SBE: create processor-independent timer APIs
Rather than have code call processor-specific SBE routines depending on version, hide those details in SBE APIs. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [ clg: Fixed run-timer test ] Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'core')
-rw-r--r--core/interrupts.c5
-rw-r--r--core/test/run-timer.c6
-rw-r--r--core/timer.c13
3 files changed, 9 insertions, 15 deletions
diff --git a/core/interrupts.c b/core/interrupts.c
index c39c280..35571f2 100644
--- a/core/interrupts.c
+++ b/core/interrupts.c
@@ -16,8 +16,7 @@
#include <device.h>
#include <ccan/str/str.h>
#include <timer.h>
-#include <sbe-p8.h>
-#include <sbe-p9.h>
+#include <sbe.h>
#include <xive.h>
/* ICP registers */
@@ -491,7 +490,7 @@ static int64_t opal_handle_interrupt(uint32_t isn, __be64 *outstanding_event_mas
is->ops->interrupt(is, isn);
/* Check timers if SBE timer isn't working */
- if (!p8_sbe_timer_ok() && !p9_sbe_timer_ok())
+ if (!sbe_timer_ok())
check_timers(true);
/* Update output events */
diff --git a/core/test/run-timer.c b/core/test/run-timer.c
index 8f8b20e..4e540ca 100644
--- a/core/test/run-timer.c
+++ b/core/test/run-timer.c
@@ -55,15 +55,15 @@ static void expiry(struct timer *t, void *data, uint64_t now)
count--;
}
-void p8_sbe_update_timer_expiry(uint64_t new_target)
+void sbe_update_timer_expiry(uint64_t new_target)
{
(void)new_target;
/* FIXME: do intersting SLW timer sim */
}
-void p9_sbe_update_timer_expiry(uint64_t new_target)
+bool sbe_timer_ok(void)
{
- (void)new_target;
+ return true;
}
int main(void)
diff --git a/core/timer.c b/core/timer.c
index 43c3883..f803b7f 100644
--- a/core/timer.c
+++ b/core/timer.c
@@ -15,8 +15,7 @@
#include <fsp.h>
#include <device.h>
#include <opal.h>
-#include <sbe-p8.h>
-#include <sbe-p9.h>
+#include <sbe.h>
#ifdef __TEST__
#define this_cpu() ((void *)-1)
@@ -36,10 +35,8 @@ static uint64_t timer_poll_gen;
static inline void update_timer_expiry(uint64_t target)
{
- if (proc_gen < proc_gen_p9)
- p8_sbe_update_timer_expiry(target);
- else
- p9_sbe_update_timer_expiry(target);
+ if (sbe_timer_ok())
+ sbe_update_timer_expiry(target);
}
void init_timer(struct timer *t, timer_func_t expiry, void *data)
@@ -287,9 +284,7 @@ void late_init_timers(void)
*/
if (platform.heartbeat_time) {
heartbeat = platform.heartbeat_time();
- } else if (p9_sbe_timer_ok()) {
- heartbeat = HEARTBEAT_DEFAULT_MS * 10;
- } else if (p8_sbe_timer_ok()) {
+ } else if (sbe_timer_ok()) {
heartbeat = HEARTBEAT_DEFAULT_MS * 10;
}