summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-07-10 08:57:06 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-07-10 08:57:06 +0000
commit8588aa0429684ae0815bd26f08f640cc6e9763ed (patch)
tree96611dfec771a6d43e45ab860808dab85db9b9e9
parentdad73a68a2807ebbb2e39df7b3d9d1c8545b2291 (diff)
Add a function to get the time of day from the prom on the m4k.
-rw-r--r--sys/arch/sparc64/include/sparc64.h3
-rw-r--r--sys/arch/sparc64/sparc64/ofw_machdep.c23
2 files changed, 24 insertions, 2 deletions
diff --git a/sys/arch/sparc64/include/sparc64.h b/sys/arch/sparc64/include/sparc64.h
index 3e1ec936893..fcfced0e8a6 100644
--- a/sys/arch/sparc64/include/sparc64.h
+++ b/sys/arch/sparc64/include/sparc64.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sparc64.h,v 1.10 2008/07/07 14:46:18 kettenis Exp $ */
+/* $OpenBSD: sparc64.h,v 1.11 2008/07/10 08:57:05 kettenis Exp $ */
/* $NetBSD: sparc64.h,v 1.3 2000/10/20 05:47:03 mrg Exp $ */
/*
@@ -55,6 +55,7 @@ int prom_dtlb_load(int index, u_int64_t data, vaddr_t vaddr);
void prom_start_cpu(int cpu, void *func, long arg);
void prom_start_cpu_by_cpuid(int cpu, void *func, long arg);
const char *prom_serengeti_set_console_input(const char *);
+time_t prom_opl_get_tod(void);
/*
* Debug
diff --git a/sys/arch/sparc64/sparc64/ofw_machdep.c b/sys/arch/sparc64/sparc64/ofw_machdep.c
index c0f829d1da6..47a88e54a5c 100644
--- a/sys/arch/sparc64/sparc64/ofw_machdep.c
+++ b/sys/arch/sparc64/sparc64/ofw_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_machdep.c,v 1.27 2008/07/07 14:46:18 kettenis Exp $ */
+/* $OpenBSD: ofw_machdep.c,v 1.28 2008/07/10 08:57:05 kettenis Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.16 2001/07/20 00:07:14 eeh Exp $ */
/*
@@ -762,6 +762,27 @@ prom_serengeti_set_console_input(const char *new)
return (const char *)args.old;
}
+time_t
+prom_opl_get_tod(void)
+{
+ static struct {
+ cell_t name;
+ cell_t nargs;
+ cell_t nreturns;
+ cell_t stick;
+ cell_t time;
+ } args;
+
+ args.name = ADR2CELL("FJSV,get-tod");
+ args.nargs = 0;
+ args.nreturns = 2;
+
+ if (openfirmware(&args) == -1)
+ return (time_t)-1;
+
+ return (time_t)args.time;
+}
+
#ifdef DEBUG
int ofmapintrdebug = 0;
#define DPRINTF(x) do { if (ofmapintrdebug) printf x; } while (0)