diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-04-27 13:02:51 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2020-04-27 13:02:51 +0000 |
commit | cd1718ab1878a39624690350ef24c622a24142ce (patch) | |
tree | c0dea1acca53465735aa2bc9c16a68fffcee99ac /sys/arch/armv7 | |
parent | cc1029a8574cb09e6b09dd9ec8cf26b044654fa9 (diff) |
Bring inittodr()/resettodr() in line with arm64 and move it to
arrm32_machdep.c.
ok mpi@
Diffstat (limited to 'sys/arch/armv7')
-rw-r--r-- | sys/arch/armv7/armv7/intr.c | 89 |
1 files changed, 1 insertions, 88 deletions
diff --git a/sys/arch/armv7/armv7/intr.c b/sys/arch/armv7/armv7/intr.c index 1e11ea73c50..68b6c7bf525 100644 --- a/sys/arch/armv7/armv7/intr.c +++ b/sys/arch/armv7/armv7/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.16 2019/09/29 11:25:25 patrick Exp $ */ +/* $OpenBSD: intr.c,v 1.17 2020/04/27 13:02:50 kettenis Exp $ */ /* * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org> * @@ -17,10 +17,8 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/timetc.h> #include <sys/malloc.h> -#include <dev/clock_subr.h> #include <arm/cpufunc.h> #include <machine/cpu.h> #include <machine/intr.h> @@ -836,91 +834,6 @@ arm_dflt_delay(u_int usecs) } -todr_chip_handle_t todr_handle; - -/* - * inittodr: - * - * Initialize time from the time-of-day register. - */ -#define MINYEAR 2003 /* minimum plausible year */ -void -inittodr(time_t base) -{ - time_t deltat; - struct timeval rtctime; - struct timespec ts; - int badbase; - - if (base < (MINYEAR - 1970) * SECYR) { - printf("WARNING: preposterous time in file system\n"); - /* read the system clock anyway */ - base = (MINYEAR - 1970) * SECYR; - badbase = 1; - } else - badbase = 0; - - if (todr_handle == NULL || - todr_gettime(todr_handle, &rtctime) != 0 || - rtctime.tv_sec == 0) { - /* - * Believe the time in the file system for lack of - * anything better, resetting the TODR. - */ - rtctime.tv_sec = base; - rtctime.tv_usec = 0; - if (todr_handle != NULL && !badbase) { - printf("WARNING: preposterous clock chip time\n"); - resettodr(); - } - ts.tv_sec = rtctime.tv_sec; - ts.tv_nsec = rtctime.tv_usec * 1000; - tc_setclock(&ts); - goto bad; - } else { - ts.tv_sec = rtctime.tv_sec; - ts.tv_nsec = rtctime.tv_usec * 1000; - tc_setclock(&ts); - } - - if (!badbase) { - /* - * See if we gained/lost two or more days; if - * so, assume something is amiss. - */ - deltat = rtctime.tv_sec - base; - if (deltat < 0) - deltat = -deltat; - if (deltat < 2 * SECDAY) - return; /* all is well */ - printf("WARNING: clock %s %ld days\n", - rtctime.tv_sec < base ? "lost" : "gained", - (long)deltat / SECDAY); - } - bad: - printf("WARNING: CHECK AND RESET THE DATE!\n"); -} - -/* - * resettodr: - * - * Reset the time-of-day register with the current time. - */ -void -resettodr(void) -{ - struct timeval rtctime; - - if (time_second == 1) - return; - - microtime(&rtctime); - - if (todr_handle != NULL && - todr_settime(todr_handle, &rtctime) != 0) - printf("resettodr: failed to set time\n"); -} - void setstatclockrate(int new) { |