From: kettenis Date: Thu, 10 Jul 2008 08:57:05 +0000 (+0000) Subject: Add a function to get the time of day from the prom on the m4k. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=929a70db3429eb0deb12b7e81b3a9e11ea69b009;p=openbsd Add a function to get the time of day from the prom on the m4k. --- 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)