summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2011-09-15 00:48:25 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2011-09-15 00:48:25 +0000
commitd01c124a9f964e11364ea050866a3f484542f7b5 (patch)
treed6cdfbd76fbc0bacc881e523fead3fdc42fb4f94 /sys
parentdcd4e2631102842425eff8af339c2c99ea04bfd0 (diff)
Switch vax to timecounters. There are three different clock sources:
- ICR/NICR on most systems (1MHz counter resolution). - diagnostic timer on KA46/KA48 (1kHz counter resolution, counter is actually running at around 1024 kHz but is not guaranteed to be monotonic at this rate). - 100Hz clock on VXT (nothing but the 100Hz clock interrupt). Tested on KA49 (ICR style), KA46, KA48 (diagtmr style), VXT2000+ (VXT {empty,hopeless}ness'r'us style).
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/vax/include/_types.h5
-rw-r--r--sys/arch/vax/include/clock.h11
-rw-r--r--sys/arch/vax/include/cpu.h23
-rw-r--r--sys/arch/vax/vax/clock.c262
-rw-r--r--sys/arch/vax/vax/ka410.c4
-rw-r--r--sys/arch/vax/vax/ka43.c4
-rw-r--r--sys/arch/vax/vax/ka48.c12
-rw-r--r--sys/arch/vax/vax/ka49.c4
-rw-r--r--sys/arch/vax/vax/ka53.c4
-rw-r--r--sys/arch/vax/vax/ka60.c17
-rw-r--r--sys/arch/vax/vax/ka630.c4
-rw-r--r--sys/arch/vax/vax/ka650.c16
-rw-r--r--sys/arch/vax/vax/ka660.c4
-rw-r--r--sys/arch/vax/vax/ka670.c4
-rw-r--r--sys/arch/vax/vax/ka680.c4
-rw-r--r--sys/arch/vax/vax/vxt.c9
16 files changed, 232 insertions, 155 deletions
diff --git a/sys/arch/vax/include/_types.h b/sys/arch/vax/include/_types.h
index cbe54c2234e..c30c99e25f4 100644
--- a/sys/arch/vax/include/_types.h
+++ b/sys/arch/vax/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.12 2011/09/08 03:40:32 guenther Exp $ */
+/* $OpenBSD: _types.h,v 1.13 2011/09/15 00:48:24 miod Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -142,4 +142,7 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
+/* Feature test macros */
+#define __HAVE_TIMECOUNTER
+
#endif /* _MACHINE__TYPES_H_ */
diff --git a/sys/arch/vax/include/clock.h b/sys/arch/vax/include/clock.h
index 00caf4d1c2a..971486834c7 100644
--- a/sys/arch/vax/include/clock.h
+++ b/sys/arch/vax/include/clock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.h,v 1.8 2008/08/18 23:19:24 miod Exp $ */
+/* $OpenBSD: clock.h,v 1.9 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: clock.h,v 1.4 1999/09/06 19:52:53 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -42,10 +42,6 @@
#define DAYSPERYEAR(y) (IS_LEAPYEAR(y) ? 366 : 365)
#define SECPERYEAR(y) (DAYSPERYEAR(y) * SEC_PER_DAY)
-#define CLKREAD_OK 0
-#define CLKREAD_BAD -1
-#define CLKREAD_WARN -2
-
#define TODRBASE (1 << 28) /* Rumours say it comes from VMS */
#define SEC_OFF 0
@@ -70,9 +66,10 @@ extern volatile short *clk_page;
extern int clk_adrshift, clk_tweak;
/* Prototypes */
-int generic_clkread(time_t);
+void icr_hardclock(struct clockframe *);
+int generic_clkread(struct timespec *, time_t);
void generic_clkwrite(void);
-int chip_clkread(time_t);
+int chip_clkread(struct timespec *, time_t);
void chip_clkwrite(void);
int yeartonum(int);
diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h
index 79b350094ac..d16676d7ad5 100644
--- a/sys/arch/vax/include/cpu.h
+++ b/sys/arch/vax/include/cpu.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: cpu.h,v 1.39 2011/07/06 20:42:05 miod Exp $ */
-/* $NetBSD: cpu.h,v 1.41 1999/10/21 20:01:36 ragge Exp $ */
+/* $OpenBSD: cpu.h,v 1.40 2011/09/15 00:48:24 miod Exp $ */
+/* $NetBSD: cpu.h,v 1.41 1999/10/21 20:01:36 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -70,8 +70,8 @@ extern struct cpu_info cpu_info_store;
#define cpu_unidle(ci)
struct clockframe {
- int pc;
- int ps;
+ int pc;
+ int ps;
};
/*
@@ -79,12 +79,11 @@ struct clockframe {
* struct for the current cpu is set up in locore.c.
*/
struct cpu_dep {
- void (*cpu_init)(void); /* pmap init before mm is on */
- int (*cpu_mchk)(caddr_t); /* Machine check handling */
- void (*cpu_memerr)(void); /* Memory subsystem errors */
- /* Autoconfiguration */
- void (*cpu_conf)(void);
- int (*cpu_clkread)(time_t); /* Read cpu clock time */
+ void (*cpu_init)(void); /* pmap init before mm is on */
+ int (*cpu_mchk)(caddr_t); /* Machine check handling */
+ void (*cpu_memerr)(void); /* Memory subsystem errors */
+ void (*cpu_conf)(void); /* Autoconfiguration */
+ int (*cpu_clkread)(struct timespec *, time_t); /* Read cpu clock time */
void (*cpu_clkwrite)(void); /* Write system time to cpu */
short cpu_vups; /* speed of cpu */
short cpu_scbsz; /* (estimated) size of system control block */
@@ -116,9 +115,9 @@ extern int bootdev;
* process as soon as possible.
*/
-#define signotify(p) mtpr(AST_OK,PR_ASTLVL);
+#define signotify(p) mtpr(AST_OK,PR_ASTLVL);
-extern int want_resched; /* resched() was called */
+extern int want_resched; /* resched() was called */
/*
* This is used during profiling to integrate system time.
diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c
index cfb9cdc904f..6344deede50 100644
--- a/sys/arch/vax/vax/clock.c
+++ b/sys/arch/vax/vax/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.23 2011/07/06 18:32:59 miod Exp $ */
+/* $OpenBSD: clock.c,v 1.24 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: clock.c,v 1.35 2000/06/04 06:16:58 matt Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
@@ -35,6 +35,7 @@
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/device.h>
+#include <sys/timetc.h>
#include <dev/clock_subr.h>
@@ -45,62 +46,45 @@
#include <machine/uvax.h>
struct evcount clock_intrcnt;
+uint32_t icr_count;
+
+#if defined(VAX46) || defined(VAX48)
+u_int vax_diagtmr_get_tc(struct timecounter *);
/*
- * microtime() should return number of usecs in struct timeval.
- * We may get wrap-arounds, but that will be fixed with lasttime
- * check. This may fault within 10 msecs.
+ * This counter is only reliable in millisecond units. See comments in
+ * vax_diagtmr_get_tc() for details.
*/
-void
-microtime(tvp)
- struct timeval *tvp;
-{
- int s, i;
- static struct timeval lasttime;
+struct timecounter vax_diagtmr_tc = {
+ .tc_get_timecount = vax_diagtmr_get_tc,
+ .tc_counter_mask = 0xffff, /* 16 bits */
+ .tc_frequency = 1000, /* 1kHz */
+ /* tc_name will be filled in */
+ .tc_quality = 100
+};
+#endif
- s = splhigh();
- bcopy((caddr_t)&time, tvp, sizeof(struct timeval));
+#ifdef VXT
+u_int vax_vxt_get_tc(struct timecounter *);
- switch (vax_boardtype) {
-#ifdef VAX46
- case VAX_BTYP_46:
- {
- extern struct vs_cpu *ka46_cpu;
- i = *(volatile int *)(&ka46_cpu->vc_diagtimu);
- i = (i >> 16) * 1024 + (i & 0x3ff);
- }
- break;
-#endif
-#if defined(VAX48) || defined(VXT)
- case VAX_BTYP_48:
- case VAX_BTYP_VXT:
- /*
- * PR_ICR doesn't exist. We could use the vc_diagtimu
- * counter, saving the value on the timer interrupt and
- * subtracting that from the current value.
- */
- i = 0;
- break;
+struct timecounter vax_vxt_tc = {
+ .tc_get_timecount = vax_vxt_get_tc,
+ .tc_counter_mask = 0xffffffff,
+ .tc_frequency = 100, /* 100Hz */
+ .tc_name = "vxt",
+ .tc_quality = 0
+};
#endif
- default:
- i = mfpr(PR_ICR);
- break;
- }
- i += tick; /* Get current interval count */
- tvp->tv_usec += i;
- while (tvp->tv_usec >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- if (tvp->tv_sec == lasttime.tv_sec &&
- tvp->tv_usec <= lasttime.tv_usec &&
- (tvp->tv_usec = lasttime.tv_usec + 1) >= 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- bcopy(tvp, &lasttime, sizeof(struct timeval));
- splx(s);
-}
+
+u_int vax_icr_get_tc(struct timecounter *);
+
+struct timecounter vax_icr_tc = {
+ .tc_get_timecount = vax_icr_get_tc,
+ .tc_counter_mask = 0xffffffff,
+ .tc_frequency = 1000000, /* 1MHz */
+ .tc_name = "icr",
+ .tc_quality = 100
+};
/*
* Sets year to the year in fs_time and then calculates the number of
@@ -112,38 +96,35 @@ microtime(tvp)
*/
void
-inittodr(fs_time)
- time_t fs_time;
+inittodr(time_t fs_time)
{
int rv, deltat;
+ struct timespec ts;
- rv = (*dep_call->cpu_clkread) (fs_time);
- switch (rv) {
-
- case CLKREAD_BAD: /* No useable information from system clock */
- time.tv_sec = fs_time;
+ rv = (*dep_call->cpu_clkread)(&ts, fs_time);
+ if (rv != 0) {
+ /* No useable information from system clock */
+ ts.tv_sec = fs_time;
+ ts.tv_nsec = 0;
resettodr();
- break;
-
- case CLKREAD_WARN: /* Just give the warning */
- break;
-
- default: /* System clock OK, no warning if we don't want to. */
- deltat = time.tv_sec - fs_time;
+ } else {
+ /* System clock OK, no warning if we don't want to. */
+ deltat = ts.tv_sec - fs_time;
if (deltat < 0)
deltat = -deltat;
if (deltat >= 2 * SEC_PER_DAY) {
- printf("Clock has %s %d days",
- time.tv_sec < fs_time ? "lost" : "gained",
+ printf("clock has %s %d days",
+ ts.tv_sec < fs_time ? "lost" : "gained",
deltat / SEC_PER_DAY);
- rv = CLKREAD_WARN;
+ rv = EINVAL;
}
- break;
}
- if (rv < CLKREAD_OK)
+ if (rv != 0)
printf(" -- CHECK AND RESET THE DATE!\n");
+
+ tc_setclock(&ts);
}
/*
@@ -155,29 +136,73 @@ resettodr()
{
(*dep_call->cpu_clkwrite)();
}
+
/*
* A delayloop that delays about the number of milliseconds that is
* given as argument.
*/
void
-delay(i)
- int i;
+delay(int i)
{
asm ("1: sobgtr %0, 1b" : : "r" (dep_call->cpu_vups * i));
}
/*
* On all VAXen there are a microsecond clock that should
- * be used for interval interrupts. Some CPUs don't use the ICR interval
- * register but it doesn't hurt to load it anyway.
+ * be used for interval interrupts. We have to be wary of the few CPUs
+ * which don't implement the ICR interval register.
*/
void
cpu_initclocks()
{
+ switch (vax_boardtype) {
+#ifdef VAX46
+ /* VAXstation 4000/60: no ICR register but a specific timer */
+ case VAX_BTYP_46:
+ {
+ extern struct vs_cpu *ka46_cpu;
+
+ vax_diagtmr_tc.tc_priv = ka46_cpu;
+ vax_diagtmr_tc.tc_name = "KA46";
+ tc_init(&vax_diagtmr_tc);
+ }
+ break;
+#endif
+#ifdef VAX48
+ /* VAXstation 4000/VLC: no ICR register but a specific timer */
+ case VAX_BTYP_48:
+ {
+ extern struct vs_cpu *ka48_cpu;
+
+ vax_diagtmr_tc.tc_priv = ka48_cpu;
+ vax_diagtmr_tc.tc_name = "KA48";
+ tc_init(&vax_diagtmr_tc);
+ }
+ break;
+#endif
+#ifdef VXT
+ /* VXT2000: neither NICR nor ICR registers, no known other timer. */
+ case VAX_BTYP_VXT:
+ tc_init(&vax_vxt_tc);
+ break;
+#endif
+ /* all other systems: NICR+ICR registers implementing a 1MHz timer. */
+ default:
+ tc_init(&vax_icr_tc);
+ break;
+ }
+
+ evcount_attach(&clock_intrcnt, "clock", NULL);
if (vax_boardtype != VAX_BTYP_VXT)
- mtpr(-10000, PR_NICR); /* Load in count register */
+ mtpr(-tick, PR_NICR); /* Load in count register */
mtpr(0x800000d1, PR_ICCS); /* Start clock and enable interrupt */
- evcount_attach(&clock_intrcnt, "clock", NULL);
+}
+
+void
+icr_hardclock(struct clockframe *cf)
+{
+ icr_count += 10000; /* tick */
+ hardclock(cf);
}
/*
@@ -191,8 +216,7 @@ cpu_initclocks()
* Converts a year to corresponding number of ticks.
*/
int
-yeartonum(y)
- int y;
+yeartonum(int y)
{
int n;
@@ -205,8 +229,7 @@ yeartonum(y)
* Converts tick number to a year 70 ->
*/
int
-numtoyear(num)
- int num;
+numtoyear(int num)
{
int y = 70, j;
while (num >= (j = SECPERYEAR(y))) {
@@ -218,13 +241,12 @@ numtoyear(num)
#if VAX650 || VAX660 || VAX670 || VAX680 || VAX53
/*
- * Reads the TODR register; returns a (probably) true tick value,
- * or CLKREAD_BAD if failed. The year is based on the argument
- * year; the TODR doesn't hold years.
+ * Reads the TODR register; returns 0 if a valid time has been found, EINVAL
+ * otherwise. The year is based on the argument year; the TODR doesn't hold
+ * years.
*/
int
-generic_clkread(base)
- time_t base;
+generic_clkread(struct timespec *ts, time_t base)
{
unsigned klocka = mfpr(PR_TODR);
@@ -236,11 +258,13 @@ generic_clkread(base)
printf("TODR stopped");
else
printf("TODR too small");
- return CLKREAD_BAD;
+ return EINVAL;
}
- time.tv_sec = yeartonum(numtoyear(base)) + (klocka - TODRBASE) / 100;
- return CLKREAD_OK;
+ ts->tv_sec =
+ yeartonum(numtoyear(base)) + (klocka - TODRBASE) / 100;
+ ts->tv_nsec = 0;
+ return 0;
}
/*
@@ -249,7 +273,7 @@ generic_clkread(base)
void
generic_clkwrite()
{
- unsigned tid = time.tv_sec, bastid;
+ uint32_t tid = time_second, bastid;
bastid = tid - yeartonum(numtoyear(tid));
mtpr((bastid * 100) + TODRBASE, PR_TODR);
@@ -266,8 +290,7 @@ int clk_tweak; /* Offset of time into word. */
#define REGPOKE(off, v) (clk_page[off << clk_adrshift] = ((v) << clk_tweak))
int
-chip_clkread(base)
- time_t base;
+chip_clkread(struct timespec *ts, time_t base)
{
struct clock_ymdhms c;
int timeout = 1<<15, s;
@@ -279,12 +302,12 @@ chip_clkread(base)
if ((REGPEEK(CSRD_OFF) & CSRD_VRT) == 0) {
printf("WARNING: TOY clock not marked valid");
- return CLKREAD_BAD;
+ return EINVAL;
}
while (REGPEEK(CSRA_OFF) & CSRA_UIP)
if (--timeout == 0) {
printf ("TOY clock timed out");
- return CLKREAD_BAD;
+ return EINVAL;
}
s = splhigh();
@@ -297,8 +320,9 @@ chip_clkread(base)
c.dt_sec = REGPEEK(SEC_OFF);
splx(s);
- time.tv_sec = clock_ymdhms_to_secs(&c);
- return CLKREAD_OK;
+ ts->tv_sec = clock_ymdhms_to_secs(&c);
+ ts->tv_nsec = 0;
+ return 0;
}
void
@@ -313,7 +337,7 @@ chip_clkwrite()
REGPOKE(CSRB_OFF, CSRB_SET);
- clock_secs_to_ymdhms(time.tv_sec, &c);
+ clock_secs_to_ymdhms(time_second, &c);
REGPOKE(YR_OFF, ((u_char)(c.dt_year - 1970)));
REGPOKE(MON_OFF, c.dt_mon);
@@ -326,3 +350,49 @@ chip_clkwrite()
REGPOKE(CSRB_OFF, CSRB_DM|CSRB_24);
};
#endif
+
+#if defined(VAX46) || defined(VAX48)
+u_int
+vax_diagtmr_get_tc(struct timecounter *tc)
+{
+ /*
+ * The diagnostic timer runs at about 1024kHz.
+ * The microsecond counter counts from 0 to 1023 inclusive (so it
+ * really is a 1/1024th millisecond counter) and increments the
+ * millisecond counter, which is a free-running 16 bit counter.
+ *
+ * To compensate for the timer not running at exactly 1024kHz,
+ * the microsecond counter is reset (to zero) every clock interrupt,
+ * i.e. every 10 millisecond.
+ *
+ * Without resetting the microsecond counter, experiments show that,
+ * on KA48, the millisecond counter increments of 960 in a second,
+ * instead of the expected 1000 (i.e. a 24/25 ratio). But resetting
+ * the microsecond counter (which does not affect the millisecond
+ * counter value) ought to make it __slower__ - who can explain
+ * this behaviour?
+ *
+ * Because we reset the ``binary microsecond'' counter and can not
+ * afford time moving backwards, we only return the millisecond
+ * counter here.
+ */
+ struct vs_cpu *vscpu;
+
+ vscpu = (struct vs_cpu *)tc->tc_priv;
+ return *(volatile uint16_t *)&vscpu->vc_diagtimm;
+}
+#endif
+
+#ifdef VXT
+u_int
+vax_vxt_get_tc(struct timecounter *tc)
+{
+ return (u_int)clock_intrcnt.ec_count;
+}
+#endif
+
+u_int
+vax_icr_get_tc(struct timecounter *tc)
+{
+ return icr_count + (u_int)(tick + (int)mfpr(PR_ICR));
+}
diff --git a/sys/arch/vax/vax/ka410.c b/sys/arch/vax/vax/ka410.c
index a9a7093fb4f..ec8e9616ede 100644
--- a/sys/arch/vax/vax/ka410.c
+++ b/sys/arch/vax/vax/ka410.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka410.c,v 1.12 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka410.c,v 1.13 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: ka410.c,v 1.21 1999/09/06 19:52:53 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -79,7 +79,7 @@ struct cpu_dep ka410_calls = {
ka410_halt,
ka410_reboot,
ka410_clrf,
- hardclock
+ icr_hardclock
};
diff --git a/sys/arch/vax/vax/ka43.c b/sys/arch/vax/vax/ka43.c
index 0ce094f900d..01f47cf3812 100644
--- a/sys/arch/vax/vax/ka43.c
+++ b/sys/arch/vax/vax/ka43.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka43.c,v 1.14 2011/09/13 21:25:23 miod Exp $ */
+/* $OpenBSD: ka43.c,v 1.15 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: ka43.c,v 1.19 1999/09/06 19:52:53 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -81,7 +81,7 @@ struct cpu_dep ka43_calls = {
ka43_halt,
ka43_reboot,
ka43_clrf,
- hardclock
+ icr_hardclock
};
static volatile struct ka43_cpu *ka43_cpu = (void *)KA43_CPU_BASE;
diff --git a/sys/arch/vax/vax/ka48.c b/sys/arch/vax/vax/ka48.c
index e9b68951abe..66c455dbf9a 100644
--- a/sys/arch/vax/vax/ka48.c
+++ b/sys/arch/vax/vax/ka48.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka48.c,v 1.12 2011/08/31 21:32:44 miod Exp $ */
+/* $OpenBSD: ka48.c,v 1.13 2011/09/15 00:48:24 miod Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -61,6 +61,7 @@ static int ka48_mchk(caddr_t);
static void ka48_halt(void);
static void ka48_reboot(int);
static void ka48_cache_enable(void);
+static void ka48_hardclock(struct clockframe *);
struct vs_cpu *ka48_cpu;
@@ -79,7 +80,7 @@ struct cpu_dep ka48_calls = {
ka48_halt,
ka48_reboot,
NULL,
- hardclock
+ ka48_hardclock
};
@@ -170,3 +171,10 @@ ka48_reboot(arg)
((u_int8_t *) clk_page)[KA48_CPMBX] = KA48_HLT_BOOT;
asm("halt");
}
+
+static void
+ka48_hardclock(struct clockframe *cf)
+{
+ ka48_cpu->vc_diagtimu = 0;
+ hardclock(cf);
+}
diff --git a/sys/arch/vax/vax/ka49.c b/sys/arch/vax/vax/ka49.c
index 313aa64daa7..fdc3784da54 100644
--- a/sys/arch/vax/vax/ka49.c
+++ b/sys/arch/vax/vax/ka49.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka49.c,v 1.10 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka49.c,v 1.11 2011/09/15 00:48:24 miod Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -65,7 +65,7 @@ struct cpu_dep ka49_calls = {
ka49_halt,
ka49_reboot,
NULL,
- hardclock
+ icr_hardclock
};
diff --git a/sys/arch/vax/vax/ka53.c b/sys/arch/vax/vax/ka53.c
index a5f7d11c045..7e0fca1eafa 100644
--- a/sys/arch/vax/vax/ka53.c
+++ b/sys/arch/vax/vax/ka53.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka53.c,v 1.8 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka53.c,v 1.9 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: ka53.c,v 1.2 2000/06/04 02:19:27 matt Exp $ */
/*
* Copyright (c) 2002 Hugh Graham.
@@ -66,7 +66,7 @@ struct cpu_dep ka53_calls = {
generic_halt,
generic_reboot,
NULL,
- hardclock
+ icr_hardclock
};
void
diff --git a/sys/arch/vax/vax/ka60.c b/sys/arch/vax/vax/ka60.c
index b59621a0991..4896f44042c 100644
--- a/sys/arch/vax/vax/ka60.c
+++ b/sys/arch/vax/vax/ka60.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka60.c,v 1.2 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka60.c,v 1.3 2011/09/15 00:48:24 miod Exp $ */
/*
* Copyright (c) 2008 Miodrag Vallat.
@@ -76,7 +76,7 @@
#include <vax/mbus/mbusvar.h>
#include <vax/mbus/fwioreg.h>
-int ka60_clkread(time_t);
+int ka60_clkread(struct timespec *, time_t);
void ka60_clkwrite(void);
void ka60_clrf(void);
void ka60_conf(void);
@@ -273,7 +273,7 @@ ka60_mchk(caddr_t mcef)
* Clock routines. They need to access the TODR through the SSC.
*/
int
-ka60_clkread(time_t base)
+ka60_clkread(struct timespec *ts, time_t base)
{
unsigned klocka = cvax_ssc_ptr->ssc_todr;
@@ -286,17 +286,18 @@ ka60_clkread(time_t base)
cvax_ssc_ptr->ssc_todr = 1; /* spin it */
} else
printf("TODR too small");
- return CLKREAD_BAD;
+ return EINVAL;
}
- time.tv_sec = yeartonum(numtoyear(base)) + (klocka - TODRBASE) / 100;
- return CLKREAD_OK;
+ ts->tv_sec = yeartonum(numtoyear(base)) + (klocka - TODRBASE) / 100;
+ ts->tv_nsec = 0;
+ return 0;
}
void
ka60_clkwrite()
{
- unsigned tid = time.tv_sec, bastid;
+ uint32_t tid = time_second, bastid;
bastid = tid - yeartonum(numtoyear(tid));
cvax_ssc_ptr->ssc_todr = (bastid * 100) + TODRBASE;
@@ -352,6 +353,6 @@ ka60_hardclock(struct clockframe *cf)
int s;
s = splclock();
- hardclock(cf);
+ icr_hardclock(cf);
splx(s);
}
diff --git a/sys/arch/vax/vax/ka630.c b/sys/arch/vax/vax/ka630.c
index 6bcdf7a02c6..d420cecd880 100644
--- a/sys/arch/vax/vax/ka630.c
+++ b/sys/arch/vax/vax/ka630.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka630.c,v 1.11 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka630.c,v 1.12 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: ka630.c,v 1.17 1999/09/06 19:52:52 ragge Exp $ */
/*-
* Copyright (c) 1982, 1988, 1990, 1993
@@ -67,7 +67,7 @@ struct cpu_dep ka630_calls = {
ka630_halt,
ka630_reboot,
ka630_clrf,
- hardclock
+ icr_hardclock
};
/*
diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c
index c3f42dbc06d..0174e1e5eaf 100644
--- a/sys/arch/vax/vax/ka650.c
+++ b/sys/arch/vax/vax/ka650.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka650.c,v 1.19 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka650.c,v 1.20 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: ka650.c,v 1.25 2001/04/27 15:02:37 ragge Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
@@ -79,7 +79,7 @@ struct cpu_dep ka650_calls = {
cvax_halt,
cvax_reboot,
NULL,
- hardclock
+ icr_hardclock
};
/*
@@ -127,11 +127,11 @@ uvaxIII_memerr()
if (ka650cbd.cbd_cacr & CACR_CPE) {
printf("cache 2 tag parity error: ");
- if (time.tv_sec - cache2tag < 7) {
+ if (time_second - cache2tag < 7) {
ka650setcache(CACHEOFF);
printf("caching disabled\n");
} else {
- cache2tag = time.tv_sec;
+ cache2tag = time_second;
printf("flushing cache\n");
ka650setcache(CACHEON);
}
@@ -187,19 +187,19 @@ uvaxIII_mchk(cmcf)
if (i & CAER_DAT) {
printf("data");
i = cache1data;
- cache1data = time.tv_sec;
+ cache1data = time_second;
}
if (i & CAER_TAG) {
printf("tag");
i = cache1tag;
- cache1tag = time.tv_sec;
+ cache1tag = time_second;
}
} else if ((i & CAER_MCD) || (ka650merr_ptr->merr_errstat & MEM_CDAL)) {
printf("CDAL");
i = cdalerr;
- cdalerr = time.tv_sec;
+ cdalerr = time_second;
}
- if (time.tv_sec - i < 7) {
+ if (time_second - i < 7) {
ka650setcache(CACHEOFF);
printf(" parity error: caching disabled\n");
} else {
diff --git a/sys/arch/vax/vax/ka660.c b/sys/arch/vax/vax/ka660.c
index 1405904550d..1d494421ab6 100644
--- a/sys/arch/vax/vax/ka660.c
+++ b/sys/arch/vax/vax/ka660.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka660.c,v 1.7 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka660.c,v 1.8 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: ka660.c,v 1.3 2000/06/29 07:14:27 mrg Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden.
@@ -79,7 +79,7 @@ struct cpu_dep ka660_calls = {
generic_halt,
generic_reboot,
NULL,
- hardclock
+ icr_hardclock
};
diff --git a/sys/arch/vax/vax/ka670.c b/sys/arch/vax/vax/ka670.c
index a1ead555a0d..e3ca9800663 100644
--- a/sys/arch/vax/vax/ka670.c
+++ b/sys/arch/vax/vax/ka670.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka670.c,v 1.10 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka670.c,v 1.11 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: ka670.c,v 1.4 2000/03/13 23:52:35 soren Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden.
@@ -69,7 +69,7 @@ struct cpu_dep ka670_calls = {
generic_halt,
generic_reboot,
NULL,
- hardclock
+ icr_hardclock
};
#define KA670_MC_RESTART 0x00008000 /* Restart possible*/
diff --git a/sys/arch/vax/vax/ka680.c b/sys/arch/vax/vax/ka680.c
index aaaf68f6ce8..4291e3ff18d 100644
--- a/sys/arch/vax/vax/ka680.c
+++ b/sys/arch/vax/vax/ka680.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ka680.c,v 1.13 2011/07/06 20:42:05 miod Exp $ */
+/* $OpenBSD: ka680.c,v 1.14 2011/09/15 00:48:24 miod Exp $ */
/* $NetBSD: ka680.c,v 1.3 2001/01/28 21:01:53 ragge Exp $ */
/*
* Copyright (c) 2002 Hugh Graham.
@@ -97,7 +97,7 @@ struct cpu_dep ka680_calls = {
generic_halt,
generic_reboot,
NULL,
- hardclock
+ icr_hardclock
};
void
diff --git a/sys/arch/vax/vax/vxt.c b/sys/arch/vax/vax/vxt.c
index 2ddc5a05375..2c8faf9230b 100644
--- a/sys/arch/vax/vax/vxt.c
+++ b/sys/arch/vax/vax/vxt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vxt.c,v 1.7 2011/08/31 21:33:26 miod Exp $ */
+/* $OpenBSD: vxt.c,v 1.8 2011/09/15 00:48:24 miod Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -52,7 +52,7 @@ static int vxt_mchk(caddr_t);
static void vxt_halt(void);
static void vxt_reboot(int);
static void vxt_cache_enable(void);
-static int missing_clkread(time_t);
+static int missing_clkread(struct timespec *, time_t);
static void missing_clkwrite(void);
/*
@@ -137,11 +137,10 @@ vxt_reboot(arg)
}
int
-missing_clkread(base)
- time_t base;
+missing_clkread(struct timespec *ts, time_t base)
{
printf("WARNING: no TOY clock");
- return CLKREAD_BAD;
+ return EINVAL;
}
void