From 6ad43b52da40de472f2d11d9bb968f9d6096848c Mon Sep 17 00:00:00 2001 From: ragge Date: Sun, 19 Jan 2003 22:29:22 +0000 Subject: [PATCH] Add some instrumentation and clean up some VAX8600 code. From Johnny Billquist. --- sys/arch/vax/include/ioa.h | 15 ++----- sys/arch/vax/vax/crl.c | 9 ++-- sys/arch/vax/vax/genassym.cf | 5 ++- sys/arch/vax/vax/intvec.S | 6 ++- sys/arch/vax/vax/ka860.c | 79 ++++++++++++++++-------------------- sys/arch/vax/vax/sbi.c | 8 +--- sys/arch/vax/vax/subr.S | 5 ++- 7 files changed, 57 insertions(+), 70 deletions(-) diff --git a/sys/arch/vax/include/ioa.h b/sys/arch/vax/include/ioa.h index 7b38f4983183..bea076577eda 100644 --- a/sys/arch/vax/include/ioa.h +++ b/sys/arch/vax/include/ioa.h @@ -1,4 +1,4 @@ -/* $NetBSD: ioa.h,v 1.8 2001/05/16 05:36:57 matt Exp $ */ +/* $NetBSD: ioa.h,v 1.9 2003/01/19 22:29:22 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. * All rights reserved. @@ -60,8 +60,7 @@ #include "opt_cputype.h" #if VAX8600 || VAXANY -#define MAXNIOA 4 -#define NIOA8600 2 +#define NIOA8600 2 /* Number of SBI possible on a VAX86x0 */ #define IOASIZE 0x2000000 #define IOAMAPSIZ 512 /* Map one page to get at SBIA regs */ #define IOA8600(i) ((caddr_t)(0x20080000+IOASIZE*i)) @@ -88,7 +87,7 @@ struct sbia_regs int sbi_maint; int sbi_unjam; int sbi_qclr; - int sbi_unused[12]; + int sbi_unused1[12]; int sbi_iv10; int sbi_iv11; int sbi_iv12; @@ -104,13 +103,7 @@ struct sbia_regs int sbi_iv1c; int sbi_iv1d; int sbi_iv1e; -}; -struct ioa { - union ioacsr { - long ioa_csr; - u_char ioa_type; - } ioacsr; - long ioa_pad[IOAMAPSIZ / sizeof (long) - 1]; + int sbi_unused2[17]; }; #define IOA_TYPMSK 0xf0 diff --git a/sys/arch/vax/vax/crl.c b/sys/arch/vax/vax/crl.c index 9467aa6de65b..5c62163e7b41 100644 --- a/sys/arch/vax/vax/crl.c +++ b/sys/arch/vax/vax/crl.c @@ -1,4 +1,4 @@ -/* $NetBSD: crl.c,v 1.13 2002/10/23 09:12:36 jdolecek Exp $ */ +/* $NetBSD: crl.c,v 1.14 2003/01/19 22:29:23 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. * All rights reserved. @@ -79,14 +79,13 @@ const struct cdevsw crl_cdevsw = { nostop, notty, nopoll, nommap, nokqfilter, }; -struct ivec_dsp crl_intr; +struct evcnt crl_ev = EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "crl", "intr"); void crlattach() { - crl_intr = idsptch; - crl_intr.hoppaddr = crlintr; - scb->scb_csrint = &crl_intr; + evcnt_attach_static(&crl_ev); + scb_vecalloc(0xF0, crlintr, NULL, SCB_ISTACK, &crl_ev); } /*ARGSUSED*/ diff --git a/sys/arch/vax/vax/genassym.cf b/sys/arch/vax/vax/genassym.cf index bc605be6af8b..40c80352cfde 100644 --- a/sys/arch/vax/vax/genassym.cf +++ b/sys/arch/vax/vax/genassym.cf @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.25 2003/01/18 07:10:34 thorpej Exp $ +# $NetBSD: genassym.cf,v 1.26 2003/01/19 22:29:23 ragge Exp $ # # Copyright (c) 1997 Ludd, University of Lule}, Sweden. # All rights reserved. @@ -76,6 +76,9 @@ define KERNBASE KERNBASE define UVM_PAGE_IDLE_ZERO offsetof(struct uvm, page_idle_zero) +define UVME_INTRS offsetof(struct uvmexp, intrs) +define UVME_SOFTS offsetof(struct uvmexp, softs) + define CI_CURLWP offsetof(struct cpu_info, ci_curlwp) define CI_WANT_RESCHED offsetof(struct cpu_info, ci_want_resched) define CI_EXIT offsetof(struct cpu_info, ci_exit) diff --git a/sys/arch/vax/vax/intvec.S b/sys/arch/vax/vax/intvec.S index 757537bba37d..749c1f6bda3c 100644 --- a/sys/arch/vax/vax/intvec.S +++ b/sys/arch/vax/vax/intvec.S @@ -1,4 +1,4 @@ -/* $NetBSD: intvec.S,v 1.3 2002/05/13 21:11:23 matt Exp $ */ +/* $NetBSD: intvec.S,v 1.4 2003/01/19 22:29:23 ragge Exp $ */ /* * Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden. @@ -300,6 +300,7 @@ SCBENTRY(softclock) jsb softintr_dispatch incl _C_LABEL(softclock_intrcnt)+EV_COUNT adwc $0,_C_LABEL(softclock_intrcnt)+EV_COUNT+4 + incl _C_LABEL(uvmexp)+UVME_SOFTS POPR rei @@ -321,6 +322,7 @@ SCBENTRY(softnet) jsb softintr_dispatch incl _C_LABEL(softnet_intrcnt)+EV_COUNT adwc $0,_C_LABEL(softnet_intrcnt)+EV_COUNT+4 + incl _C_LABEL(uvmexp)+UVME_SOFTS POPR rei @@ -330,6 +332,7 @@ SCBENTRY(softserial) jsb softintr_dispatch incl _C_LABEL(softserial_intrcnt)+EV_COUNT adwc $0,_C_LABEL(softserial_intrcnt)+EV_COUNT+4 + incl _C_LABEL(uvmexp)+UVME_SOFTS POPR rei @@ -372,6 +375,7 @@ SCBENTRY(hardclock) 1: pushr $0x3f incl _C_LABEL(clock_intrcnt)+EV_COUNT # count the number of clock interrupts adwc $0,_C_LABEL(clock_intrcnt)+EV_COUNT+4 + incl _C_LABEL(uvmexp)+UVME_INTRS #if VAX46 || VAXANY cmpl _C_LABEL(vax_boardtype),$VAX_BTYP_46 bneq 1f diff --git a/sys/arch/vax/vax/ka860.c b/sys/arch/vax/vax/ka860.c index 5d84db872de0..0f1828ad26c2 100644 --- a/sys/arch/vax/vax/ka860.c +++ b/sys/arch/vax/vax/ka860.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka860.c,v 1.21 2003/01/01 02:29:38 thorpej Exp $ */ +/* $NetBSD: ka860.c,v 1.22 2003/01/19 22:29:23 ragge Exp $ */ /* * Copyright (c) 1986, 1988 Regents of the University of California. * All rights reserved. @@ -52,19 +52,19 @@ #include -static void ka86_memerr __P((void)); -static int ka86_mchk __P((caddr_t)); -static void ka86_reboot __P((int)); -static void ka86_clrf __P((void)); -static void ka860_init __P((struct device *)); +static void ka86_memerr(void); +static int ka86_mchk(caddr_t); +static void ka86_reboot(int); +static void ka86_clrf(void); +static void ka860_init(void); -void crlattach __P((void)); +void crlattach(void); struct cpu_dep ka860_calls = { 0, ka86_mchk, ka86_memerr, - 0, + ka860_init, generic_clkread, generic_clkwrite, 6, /* ~VUPS */ @@ -221,8 +221,7 @@ struct mc8600frame { /* machine check */ int -ka86_mchk(cmcf) - caddr_t cmcf; +ka86_mchk(caddr_t cmcf) { register struct mc8600frame *mcf = (struct mc8600frame *)cmcf; register int type; @@ -272,25 +271,27 @@ struct ka86 { }; void -ka860_init(self) - struct device *self; +ka860_init(void) { struct ka86 *ka86 = (void *)&vax_cpudata; + int fpa; /* Enable cache */ mtpr(3, PR_CSWP); - printf(": CPU serial number %d(%d), hardware ECO level %d(%d)\n%s: ", - ka86->snr, ka86->plant, ka86->eco >> 4, ka86->eco, self->dv_xname); - if (mfpr(PR_ACCS) & 255) { + printf("cpu0: ka86%d, serial number %d, mfg plant %d, " + "hardware ECO level %d\n", ka86->v8650 ? 5 : 0, ka86->snr, + ka86->plant, ka86->eco); + printf("cpu0: "); + fpa = mfpr(PR_ACCS); + if (fpa & 255) { printf("FPA present, type %d, serial number %d, enabling.\n", - mfpr(PR_ACCS) & 255, mfpr(PR_ACCS) >> 16); + fpa & 255, fpa >> 16); mtpr(0x8000, PR_ACCS); } else printf("no FPA\n"); /* enable CRD reports */ mtpr(mfpr(PR_MERG) & ~M8600_ICRD, PR_MERG); - crlattach(); } /* @@ -327,8 +328,7 @@ ka86_clrf() } void -ka86_reboot(howto) - int howto; +ka86_reboot(int howto) { WAIT; @@ -353,10 +353,7 @@ CFATTACH_DECL(abus, sizeof(struct device), * Abus is the master bus on VAX 8600. */ int -abus_match(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +abus_match(struct device *parent, struct cfdata *cf, void *aux) { if (vax_bustype == VAX_ABUS) return 1; @@ -364,29 +361,28 @@ abus_match(parent, cf, aux) } void -abus_attach(parent, self, aux) - struct device *parent, *self; - void *aux; +abus_attach(struct device *parent, struct device *self, void *aux) { volatile int tmp; volatile struct sbia_regs *sbiar; - struct ioa *ioa; int type, i; struct bp_conf bp; /* * Init CPU. + * Attach crl first. */ - ka860_init(self); + printf("\n"); + crlattach(); - for (i = 0; i < MAXNIOA; i++) { - ioa = (struct ioa *)vax_map_physmem((paddr_t)IOA8600(0), + for (i = 0; i < NIOA8600; i++) { + sbiar = (struct sbia_regs *)vax_map_physmem((paddr_t)IOA8600(i), (IOAMAPSIZ / VAX_NBPG)); - if (badaddr((caddr_t)ioa, 4)) { - vax_unmap_physmem((vaddr_t)ioa, (IOAMAPSIZ / VAX_NBPG)); + if (badaddr((caddr_t)sbiar, 4)) { + vax_unmap_physmem((vaddr_t)sbiar, (IOAMAPSIZ / VAX_NBPG)); continue; } - tmp = ioa->ioacsr.ioa_csr; + tmp = sbiar->sbi_cfg; type = tmp & IOA_TYPMSK; switch (type) { @@ -394,8 +390,8 @@ abus_attach(parent, self, aux) case IOA_SBIA: bp.type = "sbi"; bp.num = i; + bp.bp_addr = tmp; config_found(self, &bp, abus_print); - sbiar = (void *)ioa; sbiar->sbi_errsum = -1; sbiar->sbi_error = 0x1000; sbiar->sbi_fltsts = 0xc0000; @@ -405,21 +401,16 @@ abus_attach(parent, self, aux) printf("IOAdapter %x unsupported\n", type); break; } - vax_unmap_physmem((vaddr_t)ioa, (IOAMAPSIZ / VAX_NBPG)); + vax_unmap_physmem((vaddr_t)sbiar, (IOAMAPSIZ / VAX_NBPG)); } } int -abus_print(aux, hej) - void *aux; - const char *hej; +abus_print(void *aux, const char *name) { -#if ABUS_VERBOSE struct bp_conf *bp = aux; - if (hej) - aprint_normal("%s at %s", bp->type, hej); + if (name) + aprint_normal("%s at %s", bp->type, name); + printf(": rev %d", bp->bp_addr & 0xf); return (UNCONF); -#else - return (QUIET); -#endif } diff --git a/sys/arch/vax/vax/sbi.c b/sys/arch/vax/vax/sbi.c index d0f82a21d6df..1f61bc5ebc15 100644 --- a/sys/arch/vax/vax/sbi.c +++ b/sys/arch/vax/vax/sbi.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbi.c,v 1.27 2003/01/01 00:16:47 thorpej Exp $ */ +/* $NetBSD: sbi.c,v 1.28 2003/01/19 22:29:24 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -76,11 +76,7 @@ sbi_print(void *aux, const char *name) int sbi_match_abus(struct device *parent, struct cfdata *cf, void *aux) { - struct bp_conf *bp = aux; - - if (bp->num == 0) /* XXX - only one SBI */ - return 1; - return 0; + return 1; /* We've already done the matching... */ } int diff --git a/sys/arch/vax/vax/subr.S b/sys/arch/vax/vax/subr.S index 5dae1bfce0f6..b0d832a99e9a 100644 --- a/sys/arch/vax/vax/subr.S +++ b/sys/arch/vax/vax/subr.S @@ -1,4 +1,4 @@ -/* $NetBSD: subr.S,v 1.5 2003/01/18 07:10:35 thorpej Exp $ */ +/* $NetBSD: subr.S,v 1.6 2003/01/19 22:29:24 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -228,7 +228,8 @@ _C_LABEL(cmn_idsptch): beql 1f # no ptr, skip increment incl EV_COUNT(%r1) # increment low longword adwc $0,EV_COUNT+4(%r1) # add any carry to hi longword -1: pushl 4(%r0) # push argument +1: incl _C_LABEL(uvmexp)+UVME_INTRS # increment uvmexp.intrs + pushl 4(%r0) # push argument calls $1,*(%r0) # call interrupt routine popr $0x3f # pop registers rei # return from interrut