From 963c3a2d4911c20304ed4355b12759edab355cdd Mon Sep 17 00:00:00 2001 From: miod Date: Mon, 18 Aug 2008 23:05:37 +0000 Subject: [PATCH] Make hardclock() a cpu_dep member. Most machines will use the generic hardclock() here, except for KA46 which needs to reset the diagnostic timer. This gives us working clock interrupt counters for vmstat -i in the process. --- sys/arch/vax/include/cpu.h | 13 ++++++------ sys/arch/vax/vax/genassym.cf | 6 ++---- sys/arch/vax/vax/intvec.s | 38 ++++++++++++++++-------------------- sys/arch/vax/vax/ka410.c | 4 +++- sys/arch/vax/vax/ka43.c | 4 +++- sys/arch/vax/vax/ka46.c | 13 +++++++++++- sys/arch/vax/vax/ka48.c | 5 ++++- sys/arch/vax/vax/ka49.c | 5 ++++- sys/arch/vax/vax/ka53.c | 5 ++++- sys/arch/vax/vax/ka630.c | 4 +++- sys/arch/vax/vax/ka650.c | 5 ++++- sys/arch/vax/vax/ka660.c | 5 ++++- sys/arch/vax/vax/ka670.c | 6 ++++-- sys/arch/vax/vax/ka680.c | 5 ++++- sys/arch/vax/vax/ka750.c | 9 ++++++--- sys/arch/vax/vax/ka780.c | 7 ++++++- sys/arch/vax/vax/ka820.c | 7 ++++++- sys/arch/vax/vax/ka860.c | 4 +++- sys/arch/vax/vax/vxt.c | 5 ++++- 19 files changed, 100 insertions(+), 50 deletions(-) diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h index 19bd039089a..104eaec2ebb 100644 --- a/sys/arch/vax/include/cpu.h +++ b/sys/arch/vax/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.28 2008/08/15 22:38:20 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.29 2008/08/18 23:05:37 miod Exp $ */ /* $NetBSD: cpu.h,v 1.41 1999/10/21 20:01:36 ragge Exp $ */ /* @@ -64,6 +64,11 @@ extern struct cpu_info cpu_info_store; #define CPU_INFO_FOREACH(cii, ci) \ for (cii = 0, ci = curcpu(); ci != NULL; ci = NULL) +struct clockframe { + int pc; + int ps; +}; + /* * All cpu-dependent info is kept in this struct. Pointer to the * struct for the current cpu is set up in locore.c. @@ -82,15 +87,11 @@ struct cpu_dep { void (*cpu_reboot)(int); /* Cpu dependent reboot call */ void (*cpu_clrf)(void); /* Clear cold/warm start flags */ void (*cpu_subconf)(struct device *);/*config cpu dep. devs */ + void (*cpu_hardclock)(struct clockframe *); /* hardclock handler */ }; extern struct cpu_dep *dep_call; /* Holds pointer to current CPU struct. */ -struct clockframe { - int pc; - int ps; -}; - extern struct device *booted_from; extern int mastercpu; extern int bootdev; diff --git a/sys/arch/vax/vax/genassym.cf b/sys/arch/vax/vax/genassym.cf index 76a50e81cd5..0caf8adc02c 100644 --- a/sys/arch/vax/vax/genassym.cf +++ b/sys/arch/vax/vax/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.9 2007/05/16 05:19:15 miod Exp $ +# $OpenBSD: genassym.cf,v 1.10 2008/08/18 23:05:38 miod Exp $ # $NetBSD: genassym.cf,v 1.10 1999/11/19 22:09:55 ragge Exp $ # # Copyright (c) 1997 Ludd, University of Lule}, Sweden. @@ -61,6 +61,7 @@ member iftrap struct cpu_dep member MCHK cpu_mchk member MEMERR cpu_memerr +member HARDCLOCK cpu_hardclock struct cpu_info member ci_curproc @@ -112,6 +113,3 @@ export SYS_sigreturn export SYS_exit export VAX_TYP_UV2 -export VAX_TYP_8SS -export VAX_BTYP_46 -export VAX_BTYP_48 diff --git a/sys/arch/vax/vax/intvec.s b/sys/arch/vax/vax/intvec.s index a2b569e3f23..3b0e6b35e16 100644 --- a/sys/arch/vax/vax/intvec.s +++ b/sys/arch/vax/vax/intvec.s @@ -1,4 +1,4 @@ -/* $OpenBSD: intvec.s,v 1.21 2007/05/10 17:59:27 deraadt Exp $ */ +/* $OpenBSD: intvec.s,v 1.22 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: intvec.s,v 1.39 1999/06/28 08:20:48 itojun Exp $ */ /* @@ -157,7 +157,7 @@ _rpb: # at when returning from a intentional test. # mcheck: .globl mcheck - tstl _cold # Ar we still in coldstart? + tstl _cold # Are we still in coldstart? bneq L4 # Yes. pushr $0x7f @@ -216,16 +216,16 @@ ENTRY(privinflt) # Privileged/unimplemented instruction .align 2 .globl transl_v # 20: Translation violation transl_v: - pushr $0x3f + PUSHR pushl 28(sp) pushl 28(sp) calls $2,_pmap_simulref tstl r0 bneq 1f - popr $0x3f + POPR addl2 $8,sp rei -1: popr $0x3f +1: POPR brb access_v .align 2 @@ -273,7 +273,7 @@ ENTRY(cmrerr) POPR rei -ENTRY(sbiflt); +ENTRY(sbiflt) pushab sbifltmsg calls $1, _panic @@ -298,21 +298,17 @@ ENTRY(netint) TRAPCALL(ddbtrap, T_KDBTRAP) - .align 2 - .globl hardclock -hardclock: mtpr $0xc1,$PR_ICCS # Reset interrupt flag - pushr $0x3f -#ifdef VAX46 - cmpl _vax_boardtype,$VAX_BTYP_46 - bneq 1f - movl _ka46_cpu,r0 - clrl 0x1c(r0) -#endif -1: pushl sp - addl2 $24,(sp) - calls $1,_hardclock - popr $0x3f - rei +ENTRY(hardclock) + mtpr $0xc1,$PR_ICCS # Reset interrupt flag + PUSHR + pushl sp + addl2 $24,(sp) + movl _dep_call,r0 + calls $1,*HARDCLOCK(r0) + incl _clock_intrcnt+EC_COUNT # increment low longword + adwc $0,_clock_intrcnt+EC_COUNT+4 # add any carry to hi longword + POPR + rei /* * Main routine for traps; all go through this. diff --git a/sys/arch/vax/vax/ka410.c b/sys/arch/vax/vax/ka410.c index 39f01fb07ed..657b3e747a9 100644 --- a/sys/arch/vax/vax/ka410.c +++ b/sys/arch/vax/vax/ka410.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka410.c,v 1.9 2002/03/14 01:26:48 millert Exp $ */ +/* $OpenBSD: ka410.c,v 1.10 2008/08/18 23:05:38 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,6 +79,8 @@ struct cpu_dep ka410_calls = { ka410_halt, ka410_reboot, ka410_clrf, + NULL, + hardclock }; diff --git a/sys/arch/vax/vax/ka43.c b/sys/arch/vax/vax/ka43.c index a148e97f80d..fad08e42188 100644 --- a/sys/arch/vax/vax/ka43.c +++ b/sys/arch/vax/vax/ka43.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka43.c,v 1.11 2008/08/15 22:38:23 miod Exp $ */ +/* $OpenBSD: ka43.c,v 1.12 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka43.c,v 1.19 1999/09/06 19:52:53 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -82,6 +82,8 @@ struct cpu_dep ka43_calls = { ka43_halt, ka43_reboot, ka43_clrf, + NULL, + hardclock }; static volatile struct ka43_cpu *ka43_cpu = (void *)KA43_CPU_BASE; diff --git a/sys/arch/vax/vax/ka46.c b/sys/arch/vax/vax/ka46.c index 318eee29b83..a05f6c7ea1b 100644 --- a/sys/arch/vax/vax/ka46.c +++ b/sys/arch/vax/vax/ka46.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka46.c,v 1.8 2008/08/15 22:38:23 miod Exp $ */ +/* $OpenBSD: ka46.c,v 1.9 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka46.c,v 1.12 2000/03/04 07:27:49 matt Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. @@ -61,6 +61,7 @@ static int ka46_mchk(caddr_t); static void ka46_halt(void); static void ka46_reboot(int); static void ka46_cache_enable(void); +static void ka46_hardclock(struct clockframe *); struct vs_cpu *ka46_cpu; @@ -78,6 +79,9 @@ struct cpu_dep ka46_calls = { 2, /* SCB pages */ ka46_halt, ka46_reboot, + NULL, + NULL, + ka46_hardclock }; @@ -180,3 +184,10 @@ ka46_reboot(arg) ((u_int8_t *) clk_page)[KA46_CPMBX] = KA46_HLT_BOOT; asm("halt"); } + +static void +ka46_hardclock(struct clockframe *cf) +{ + ka46_cpu->vc_diagtimu = 0; + hardclock(cf); +} diff --git a/sys/arch/vax/vax/ka48.c b/sys/arch/vax/vax/ka48.c index 6d633bf0ebd..912b2030583 100644 --- a/sys/arch/vax/vax/ka48.c +++ b/sys/arch/vax/vax/ka48.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka48.c,v 1.9 2008/08/15 22:38:23 miod Exp $ */ +/* $OpenBSD: ka48.c,v 1.10 2008/08/18 23:05:38 miod Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -79,6 +79,9 @@ struct cpu_dep ka48_calls = { 2, /* SCB pages */ ka48_halt, ka48_reboot, + NULL, + NULL, + hardclock }; diff --git a/sys/arch/vax/vax/ka49.c b/sys/arch/vax/vax/ka49.c index 29889c95080..eb71fd8a1ba 100644 --- a/sys/arch/vax/vax/ka49.c +++ b/sys/arch/vax/vax/ka49.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka49.c,v 1.8 2008/08/15 22:38:23 miod Exp $ */ +/* $OpenBSD: ka49.c,v 1.9 2008/08/18 23:05:38 miod Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -64,6 +64,9 @@ struct cpu_dep ka49_calls = { 2, /* SCB pages */ ka49_halt, ka49_reboot, + NULL, + NULL, + hardclock }; diff --git a/sys/arch/vax/vax/ka53.c b/sys/arch/vax/vax/ka53.c index 16bcd73bf6c..bc964a1f9b1 100644 --- a/sys/arch/vax/vax/ka53.c +++ b/sys/arch/vax/vax/ka53.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka53.c,v 1.6 2008/08/15 22:38:23 miod Exp $ */ +/* $OpenBSD: ka53.c,v 1.7 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka53.c,v 1.2 2000/06/04 02:19:27 matt Exp $ */ /* * Copyright (c) 2002 Hugh Graham. @@ -65,6 +65,9 @@ struct cpu_dep ka53_calls = { 2, /* SCB pages */ generic_halt, generic_reboot, + NULL, + NULL, + hardclock }; void diff --git a/sys/arch/vax/vax/ka630.c b/sys/arch/vax/vax/ka630.c index 7c8a9b47253..e5381182008 100644 --- a/sys/arch/vax/vax/ka630.c +++ b/sys/arch/vax/vax/ka630.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka630.c,v 1.9 2003/06/02 23:27:58 millert Exp $ */ +/* $OpenBSD: ka630.c,v 1.10 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka630.c,v 1.17 1999/09/06 19:52:52 ragge Exp $ */ /*- * Copyright (c) 1982, 1988, 1990, 1993 @@ -67,6 +67,8 @@ struct cpu_dep ka630_calls = { ka630_halt, ka630_reboot, ka630_clrf, + NULL, + hardclock }; /* diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c index fd2b5cd6b91..851e9f33127 100644 --- a/sys/arch/vax/vax/ka650.c +++ b/sys/arch/vax/vax/ka650.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka650.c,v 1.16 2008/08/15 22:47:45 miod Exp $ */ +/* $OpenBSD: ka650.c,v 1.17 2008/08/18 23:05:38 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,6 +79,9 @@ struct cpu_dep ka650_calls = { 2, /* SCB pages */ ka650_halt, ka650_reboot, + NULL, + NULL, + hardclock }; /* diff --git a/sys/arch/vax/vax/ka660.c b/sys/arch/vax/vax/ka660.c index 52ec1e13b39..7f31beb5a7e 100644 --- a/sys/arch/vax/vax/ka660.c +++ b/sys/arch/vax/vax/ka660.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka660.c,v 1.4 2002/09/28 06:25:11 hugh Exp $ */ +/* $OpenBSD: ka660.c,v 1.5 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka660.c,v 1.3 2000/06/29 07:14:27 mrg Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. @@ -81,6 +81,9 @@ struct cpu_dep ka660_calls = { 2, /* SCB pages */ generic_halt, generic_reboot, + NULL, + NULL, + hardclock }; diff --git a/sys/arch/vax/vax/ka670.c b/sys/arch/vax/vax/ka670.c index b68ed275ed8..35cd8e355de 100644 --- a/sys/arch/vax/vax/ka670.c +++ b/sys/arch/vax/vax/ka670.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka670.c,v 1.8 2006/06/30 16:14:31 miod Exp $ */ +/* $OpenBSD: ka670.c,v 1.9 2008/08/18 23:05:38 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,9 @@ struct cpu_dep ka670_calls = { 2, /* SCB pages */ generic_halt, generic_reboot, - 0, + NULL, + NULL, + 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 08b8af1503c..310088509fc 100644 --- a/sys/arch/vax/vax/ka680.c +++ b/sys/arch/vax/vax/ka680.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka680.c,v 1.11 2008/08/15 22:38:23 miod Exp $ */ +/* $OpenBSD: ka680.c,v 1.12 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka680.c,v 1.3 2001/01/28 21:01:53 ragge Exp $ */ /* * Copyright (c) 2002 Hugh Graham. @@ -97,6 +97,9 @@ struct cpu_dep ka680_calls = { 2, /* SCB pages */ generic_halt, generic_reboot, + NULL, + NULL, + hardclock }; void diff --git a/sys/arch/vax/vax/ka750.c b/sys/arch/vax/vax/ka750.c index af12420d0f4..5fcdfc42810 100644 --- a/sys/arch/vax/vax/ka750.c +++ b/sys/arch/vax/vax/ka750.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka750.c,v 1.10 2003/06/02 23:27:59 millert Exp $ */ +/* $OpenBSD: ka750.c,v 1.11 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka750.c,v 1.30 1999/08/14 11:30:48 ragge Exp $ */ /* * Copyright (c) 1982, 1986, 1988 The Regents of the University of California. @@ -61,9 +61,12 @@ struct cpu_dep ka750_calls = { generic_clkwrite, 1, /* ~VUPS */ 4, /* SCB pages */ - 0, /* halt call */ - 0, /* Reboot call */ + NULL, /* halt call */ + NULL, /* Reboot call */ ka750_clrf, + NULL, + NULL, + hardclock }; static caddr_t mcraddr[4]; /* XXX */ diff --git a/sys/arch/vax/vax/ka780.c b/sys/arch/vax/vax/ka780.c index 422338a536f..362eb5a581a 100644 --- a/sys/arch/vax/vax/ka780.c +++ b/sys/arch/vax/vax/ka780.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka780.c,v 1.9 2003/06/02 23:27:59 millert Exp $ */ +/* $OpenBSD: ka780.c,v 1.10 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka780.c,v 1.14 1999/08/07 10:36:49 ragge Exp $ */ /*- * Copyright (c) 1982, 1986, 1988 The Regents of the University of California. @@ -108,6 +108,11 @@ struct cpu_dep ka780_calls = { generic_clkwrite, 2, /* ~VUPS */ 5, /* SCB pages */ + NULL, + NULL, + NULL, + NULL, + hardclock }; /* diff --git a/sys/arch/vax/vax/ka820.c b/sys/arch/vax/vax/ka820.c index 4ad8cd24b2c..1ab61f24bd3 100644 --- a/sys/arch/vax/vax/ka820.c +++ b/sys/arch/vax/vax/ka820.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka820.c,v 1.12 2003/11/10 21:05:06 miod Exp $ */ +/* $OpenBSD: ka820.c,v 1.13 2008/08/18 23:05:38 miod Exp $ */ /* $NetBSD: ka820.c,v 1.22 2000/06/04 02:19:27 matt Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. @@ -83,6 +83,11 @@ struct cpu_dep ka820_calls = { ka820_clkwrite, 3, /* ~VUPS */ 5, /* SCB pages */ + NULL, + NULL, + NULL, + NULL, + hardclock }; struct cfattach cpu_bi_ca = { diff --git a/sys/arch/vax/vax/ka860.c b/sys/arch/vax/vax/ka860.c index cb7fef88bb0..38c885d5dc1 100644 --- a/sys/arch/vax/vax/ka860.c +++ b/sys/arch/vax/vax/ka860.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka860.c,v 1.9 2006/07/20 19:08:15 miod Exp $ */ +/* $OpenBSD: ka860.c,v 1.10 2008/08/18 23:05:39 miod Exp $ */ /* $NetBSD: ka860.c,v 1.15 1999/08/07 10:36:49 ragge Exp $ */ /* * Copyright (c) 1986, 1988 Regents of the University of California. @@ -69,6 +69,8 @@ struct cpu_dep ka860_calls = { 0, /* Halt call, nothing special */ ka86_reboot, ka86_clrf, + NULL, + hardclock }; /* diff --git a/sys/arch/vax/vax/vxt.c b/sys/arch/vax/vax/vxt.c index fe733411291..5c6028c2ced 100644 --- a/sys/arch/vax/vax/vxt.c +++ b/sys/arch/vax/vax/vxt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vxt.c,v 1.3 2008/08/15 22:41:48 miod Exp $ */ +/* $OpenBSD: vxt.c,v 1.4 2008/08/18 23:05:39 miod Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -72,6 +72,9 @@ struct cpu_dep vxt_calls = { 2, /* SCB pages */ vxt_halt, vxt_reboot, + NULL, + NULL, + hardclock }; void -- 2.20.1