aboutsummaryrefslogtreecommitdiff
path: root/hw/sbe.c
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 /hw/sbe.c
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 'hw/sbe.c')
-rw-r--r--hw/sbe.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/hw/sbe.c b/hw/sbe.c
new file mode 100644
index 0000000..991485e
--- /dev/null
+++ b/hw/sbe.c
@@ -0,0 +1,31 @@
+// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+
+/*
+ * SBE communication driver (common code)
+ */
+
+#define pr_fmt(fmt) "SBE: " fmt
+
+#include <sbe.h>
+#include <sbe-p8.h>
+#include <sbe-p9.h>
+#include <skiboot.h>
+#include <stdbool.h>
+
+bool sbe_has_timer = false;
+
+void sbe_update_timer_expiry(uint64_t target)
+{
+ assert(sbe_timer_ok);
+
+ if (proc_gen == proc_gen_p9 || proc_gen == proc_gen_p10)
+ p9_sbe_update_timer_expiry(target);
+
+ if (proc_gen == proc_gen_p8)
+ p8_sbe_update_timer_expiry(target);
+}
+
+bool sbe_timer_ok(void)
+{
+ return sbe_has_timer;
+}