diff options
author | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2011-01-02 13:25:18 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2011-01-02 13:25:18 +0000 |
commit | ea791197cd200b71eff94dbbcaf231a03040b6f8 (patch) | |
tree | 4936b9775c8d6cebced66816f687c409e619bbbd /sys/arch/hppa64 | |
parent | 8e5869b3e96ec1d14c26833511d16008ead7c580 (diff) |
- move resettodr and inittodr to clock.c, like the other clock related functions
Diffstat (limited to 'sys/arch/hppa64')
-rw-r--r-- | sys/arch/hppa64/dev/clock.c | 56 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/machdep.c | 62 |
2 files changed, 59 insertions, 59 deletions
diff --git a/sys/arch/hppa64/dev/clock.c b/sys/arch/hppa64/dev/clock.c index 5100f9869e2..c080cd0a824 100644 --- a/sys/arch/hppa64/dev/clock.c +++ b/sys/arch/hppa64/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.2 2010/07/24 21:27:57 kettenis Exp $ */ +/* $OpenBSD: clock.c,v 1.3 2011/01/02 13:25:17 jasper Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -52,6 +52,60 @@ cpu_initclocks() mtctl(__itmr, CR_ITMR); } +/* + * initialize the system time from the time of day clock + */ +void +inittodr(time_t t) +{ + struct pdc_tod tod PDC_ALIGNMENT; + int error, tbad = 0; + struct timespec ts; + + if (t < 12*SECYR) { + printf ("WARNING: preposterous time in file system"); + t = 6*SECYR + 186*SECDAY + SECDAY/2; + tbad = 1; + } + + if ((error = pdc_call((iodcio_t)pdc, + 1, PDC_TOD, PDC_TOD_READ, &tod, 0, 0, 0, 0, 0))) + printf("clock: failed to fetch (%d)\n", error); + + ts.tv_sec = tod.sec; + ts.tv_nsec = tod.usec * 1000; + tc_setclock(&ts); + + if (!tbad) { + u_long dt; + + dt = (tod.sec < t)? t - tod.sec : tod.sec - t; + + if (dt < 2 * SECDAY) + return; + printf("WARNING: clock %s %ld days", + tod.sec < t? "lost" : "gained", dt / SECDAY); + } + + printf (" -- CHECK AND RESET THE DATE!\n"); +} + +/* + * reset the time of day clock to the value in time + */ +void +resettodr() +{ + struct timeval tv; + int error; + + microtime(&tv); + + if ((error = pdc_call((iodcio_t)pdc, 1, PDC_TOD, PDC_TOD_WRITE, + tv.tv_sec, tv.tv_usec))) + printf("clock: failed to save (%d)\n", error); +} + void setstatclockrate(int newhz) { diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c index e6d7a707dd0..a2928adddfa 100644 --- a/sys/arch/hppa64/hppa64/machdep.c +++ b/sys/arch/hppa64/hppa64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.28 2011/01/01 18:59:26 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.29 2011/01/02 13:25:17 jasper Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -426,60 +426,6 @@ printf("here7\n"); } /* - * initialize the system time from the time of day clock - */ -void -inittodr(time_t t) -{ - struct pdc_tod tod PDC_ALIGNMENT; - int error, tbad = 0; - struct timespec ts; - - if (t < 12*SECYR) { - printf ("WARNING: preposterous time in file system"); - t = 6*SECYR + 186*SECDAY + SECDAY/2; - tbad = 1; - } - - if ((error = pdc_call((iodcio_t)pdc, - 1, PDC_TOD, PDC_TOD_READ, &tod, 0, 0, 0, 0, 0))) - printf("clock: failed to fetch (%d)\n", error); - - ts.tv_sec = tod.sec; - ts.tv_nsec = tod.usec * 1000; - tc_setclock(&ts); - - if (!tbad) { - u_long dt; - - dt = (tod.sec < t)? t - tod.sec : tod.sec - t; - - if (dt < 2 * SECDAY) - return; - printf("WARNING: clock %s %ld days", - tod.sec < t? "lost" : "gained", dt / SECDAY); - } - - printf (" -- CHECK AND RESET THE DATE!\n"); -} - -/* - * reset the time of day clock to the value in time - */ -void -resettodr() -{ - struct timeval tv; - int error; - - microtime(&tv); - - if ((error = pdc_call((iodcio_t)pdc, 1, PDC_TOD, PDC_TOD_WRITE, - tv.tv_sec, tv.tv_usec))) - printf("clock: failed to save (%d)\n", error); -} - -/* * compute cpu clock ratio such as: * cpu_ticksnum / cpu_ticksdenom = t + delta * delta -> 0 @@ -793,7 +739,7 @@ dumpsys(void) /* bcopy(), error on fault */ int -kcopy(const void *src, void *dst, size_t size) +kcopy(const void *from, void *to, size_t size) { return spcopy(HPPA_SID_KERNEL, from, HPPA_SID_KERNEL, to, size); } @@ -838,7 +784,7 @@ copyout(const void *src, void *dst, size_t size) * Set registers on exec. */ void -setregs(struct proc *p, truct exec_package *pack, u_long stack, +setregs(struct proc *p, struct exec_package *pack, u_long stack, register_t *retval) { extern paddr_t fpu_curpcb; /* from locore.S */ @@ -1044,7 +990,7 @@ sys_sigreturn(struct proc *p, void *v, register_t *retval) * machine dependent system variables. */ int -cpu_sysctl(int *name, u_int namelen, void *oldp, size_t oldlenp, void *newp, +cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, size_t newlen, struct proc *p) { dev_t consdev; |