📄 ka8200.c
字号:
#ifndef lintstatic char *sccsid = "@(#)ka8200.c 4.1 ULTRIX 7/2/90";#endif lint/************************************************************************ * * * Copyright (c) 1984,85,86 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************//* ------------------------------------------------------------------------ * Modification History: * * 27-Nov-89 Paul Grist * added frame_type argument to logmck() call. * * 06-Nov-89 Paul Grist * Made modifications to ka8200machcheck() routine: * o For all machine checks, scan VAXBI and log any errors * o Report recoverabe machine checks to error logger * o Fixed problem (resulting from vmb) which caused lost dumps * * 24-May-89 darrell * Changed the #include for cpuconf.h to find it in it's new home -- * sys/machine/common/cpuconf.h * * 24-May-89 darrell * Removed the v_ prefix from all cpusw fields, removed cpup from any * arguments being passed in function args. cpup is now defined * globally -- as part of the new cpusw. * * 26-Jan-89 jaw * fix up start/stop cpu. * * 18-Jun-88 -- jaw change to new cpu data format. * * 05-Aug-86 -- jaw * move bistop command after the bus scan for CPU's. The Scan of * the bus will cause BI errors to occur. * * 28-Jul-86 -- bjg * Set cpu_subtype to indicate 8200, 8300, or 8400; * and log cpu_subtype with MEM errs * * 21-Apr-86 -- jrs * Add code to configure to do a "quick" scan down the bi so that * we can determine what system identity to use. * * 09-Apr-86 -- jaw make bierror routine work for multiple bi's. * * 02-Apr-86 -- jaw add support for nautilus console and memory adapter * * 18-Mar-86 -- jrs * Change mask to allow inter processor interrupts from slaves for * scheduling purposes. * * 13-Mar-86 -- darrell * Passing cpup into ka820init -- for consistency sake. * * 05-Mar-86 -- pmk * added arg recover to logmck and replaced display with cprintf * * 05-Mar-86 -- jaw VAXBI device and controller config code added. * todr code put in cpusw. * * 03-Mar-86 -- jrs * Cleaned up secondary processor start code to go through defined * area in rpb rather than creating awkward direct jump. * * 25-Feb-86 -- jrs * Added code to flush secondary processor output before trying attn. * * 19-Feb-86 -- pmk * Added for loop to memenable for check of all controllers * * 18-Feb-86 -- jrs * Added code to force the secondary processors to start automatically * after autoconfig is complete. * * 18-Mar-86 -- jaw add routines to cpu switch for nexus/unibus addresses * also got rid of some globals like nexnum. * * 12-Feb-86 Darrell Dunnuck * Removed the routines memerr, memenable, setcache, and tocons * from machdep.c and put them here for this processor type. * Added a new routine cachenbl. * * 04-feb-86 -- jaw get rid of biic.h. * * 03-Feb-86 -- jaw -- added 8200 config routine. * * 15-Jan-86 -- darrell * Moved this file from sys/vaxbi to sys/vax, and removed * the structure definition for the generic machinecheck * stack frame. * * 20-Jan-86 -- pmk add machine check errlogging * * 11-Nov-85 -- jaw test for time of last machine check was incorrect. * * 27-OCT-85 -- jaw BDA reset bug fix. * * 26-Oct-85 -- jaw Bug fixes to machine check handler. * * 05-Jul-85 -- jaw fixup CRD handling. * * 26-Jun-85 -- jaw Machine check handler not printing type if * multiple errors have occurred. * * 19-Jun-85 -- jaw VAX8200 name change. * * 05 Jun 85 -- jaw clean up and setup port CSR. * * 20 Mar 85 -- jaw add support for VAX 8200 * * * ------------------------------------------------------------------------ */#include "../machine/pte.h"#include "../h/param.h"#include "../h/smp_lock.h"#include "../h/systm.h"#include "../h/map.h"#include "../h/buf.h"#include "../h/time.h"#include "../h/kernel.h"#include "../h/errlog.h"#include "../h/errno.h"#include "../../machine/common/cpuconf.h"#include "../h/cpudata.h"#include "../machine/cons.h"#include "../machine/cpu.h"#include "../machine/mtpr.h"#include "../machine/scb.h"#include "../machine/clock.h"#include "../machine/mem.h"#include "../machine/nexus.h"#include "../machine/rx50.h"#include "../machine/ka8200.h"#include "../io/uba/ubareg.h"#include "../io/uba/ubavar.h"#include "../io/bi/bimemreg.h"#include "../io/bi/bireg.h"extern int (*UNIvec[])();extern int numuba;extern int nNUBA;extern int cache_state;extern int ignorebi;extern int cold;extern struct bidata bidata[];extern struct cpusw *cpup; /* pointer to cpusw entry */#define TLKBUF 100int cputalking = -1;int cpureport = -1;char talkbuf[TLKBUF];char *talkin = talkbuf;char *talkout = talkbuf;char *mc8200[] = { "cpu bad ipl", "cpu microcode lost error", "cpu microcode parity error", "cpu DAL parity error", "BI bus error", "cpu BTB tag parity error", "cpu Cache tag parity error"};#define MC8200_BADIPL 0x1#define MC8200_UERR 0x2#define MC8200_UPARITY 0x4#define MC8200_DPARITY 0x8#define MC8200_BIERR 0x10#define MC8200_BPARITY 0x20#define MC8200_CPARITY 0x40struct mc8200frame { int mc8200_bcnt; int mc8200_summary; int mc8200_parm1; int mc8200_va; int mc8200_vap; int mc8200_mar; int mc8200_stat; int mc8200_pcfail; int mc8200_upcfail; int mc8200_pc; int mc8200_psl;};extern int smp;ka8200conf(){ union cpusid cpusid; int bicpunode,nexndx; char *nxp; register int binode; register short type; struct bi_nodespace *nxv; register int procfound=0; char *nxpp; bicpunode = mfpr(BINID); cpusid.cpusid = mfpr(SID); bidata[0].bivirt = (struct bi_nodespace *) nexus; bidata[0].biphys = (struct bi_nodespace *) NEX8200(0); bidata[0].bivec_page = &scb.scb_stray; bidata[0].cpu_biic_addr = bidata[0].bivirt + bicpunode; nxp = (char *) (ka8200nexaddr(0,bicpunode)); nxaccess(nxp,Nexmap[(bicpunode)],BINODE_SIZE); /* count number of cpus */ ignorebi = 1; mtpr(BISTOP,0x0ffff); nxv = bidata[0].bivirt; for (binode = 0; binode < NBINODES; binode++, nxv++) { nxpp = (char *) ka8200nexaddr(0, binode); nxaccess(nxpp, Nexmap[binode], BINODE_SIZE); if ((*cpup->badaddr)((caddr_t) nxv, sizeof(long)) == 0) { type=(short) nxv->biic.biic_typ; if ( type== BI_KA820) { if (binode != mfpr(BINID)) { /* secondary processor startup needed */ procfound |= 1 << binode; cpu_avail++; } else /* take out else to make interrupts symmetric */ bidata[0].biintr_dst |= (1 << binode); } if (type==BI_BUA || type==BI_BLA || type==BI_BDA || type==BI_COMB) bisst(&nxv->biic.biic_ctrl); } } printf("VAX 8%s0 hardware rev = %d, ucode patch rev = %d\n", ((procfound != 0)? "30": "20"), cpusid.cpu8200.cp_hrev, cpusid.cpu8200.cp_patch); printf(" sec patch = %d, ucode rev = %d\n", cpusid.cpu8200.cp_secp, cpusid.cpu8200.cp_urev); /* set cpu_subtype for error logger */ if (procfound !=0) cpu_subtype = ST_8200; else cpu_subtype = ST_8300; bisetvec(0); (void) spl0(); probebi(0); /* Write protect the scb and Unibus interrupt * vectors */ return(0);}ka8200stopcpu() { spl7(); CURRENT_CPUDATA->cpu_state &= ~CPU_RUN; asm("halt");}ka8200startcpu(cpu_num)int cpu_num;{ struct bi_nodespace *nxv; nxv = bidata[0].bivirt; nxv += cpu_num; if (((bidata[0].binodes_alive & (1 << cpu_num)) != 0) && (((short) nxv->biic.biic_typ) == BI_KA820)) { get_cpudata(cpu_num); bidata[0].biintr_dst |= (1<<cpu_num); /*ka820_setbi_int(); for symmetrix interrupts */ ka820procinit(cpu_num); return(1); } return(0);}#ifdef notdef/* * Set new interrupt destination field in BIIC of all * MP safe boards. */ka820_setbi_int() { int i; struct bisw *pbisw; struct bi_nodespace *nxv; nxv =bidata[0].bivirt; for(i=0; i<16 ; i++, nxv++) { if (bidata[0].binodes_alive & (1<<i)) { pbisw = bidata[0].bierr[i].pbisw; if ((pbisw->bi_flags & (BIF_DEVICE|BIF_CONTROLLER|BIF_ADAPTER)) && (pbisw->bi_flags & BIF_SMP)) { nxv->biic.biic_int_dst = bidata[0].biintr_dst; } } }}#endif notdefka820init(nxv,nxp,binumber,binode)char *nxp;struct ka820_regs *nxv;int binumber;int binode;{ /* allow ipintr from all sources */ nxv->ka820_biic.biic_ip_msk = 0xffff0000; /* map VAX8200 onboard options */ nxaccess((char *) PORTV8200,V8200pmap,512); nxaccess((char *) WATCHV8200,V8200wmap,512); nxaccess((char *) RX50V8200,V8200rmap,512); v8200port |= (V8200_CRDCLR | V8200_CONSEN | V8200_CONSCLR | V8200_RXEN);}ka820slavehalt() { register int i; printf("\nhalting slave processors \n"); for(i=0; i<32; i++) { if (CPUDATA(i)) { (void) ka820txstr(CPUDATA(i)->cpu_num, "\020"); (void) ka820prompt(); } }}/* * ka820procinit() - * * Try and start the processor and the specified node. * */ka820procinit(nexid)int nexid;{ /* initialize buffer for capturing chars from secondary processor and then tell interrupt routine who to capture */ talkin = talkbuf; talkout = talkbuf; cputalking = nexid; /* flush any pending message secondary is trying to send */ (void) ka820prompt(); /* try and send control-p to get secondary's attention and see if he sends us ">>>" prompt */ if (ka820txstr(nexid, "\020") == 0) { printf("VAXBI node %d - Attention FAILED\n", nexid); } else if (ka820prompt() == 0) { printf("VAXBI node %d - No reply to attention\n", nexid); } /* Send init command to seconardy. Check command echo and receipt of new prompt */ if (ka820txstr(nexid, "I\r") == 0) { printf("VAXBI node %d - First stage initialization FAILED\n", nexid); } else if (ka820matchl("I\r") == 0 || ka820prompt() == 0) { printf("VAXBI node %d - No reply to first stage initialization\n", nexid); } else { /* send the start string and check echo */ if (ka820txstr(nexid, "S 100\r") == 0 || ka820matchl("S 100\r") == 0) { printf("VAXBI node %d - Startup failed\n", nexid); } } /* dialogue has ended, tell intr routine anything else is unanticipated and erroneous */ cputalking = -1;}ka820rxcd(){ register int binode; register short conschar; register int fromcpu; conschar = mfpr(RXCD); binode = mfpr(BINID); fromcpu = (conschar >> 8) & 0x1f; /* we are on master CPU */ if (BOOT_CPU) { /* handle chars from cpu we are trying to handle */ if (fromcpu == cputalking) { *talkin++ = (char) conschar; if ((talkin - talkbuf) >= TLKBUF) { talkin = talkbuf; } if (talkin == talkout) { printf("CPU conversation buffer overflow\n"); } /* unsolicited chars from a cpu */ } else { /* if we are booting, just return as we may not be able to safely handle anything */ if (cold != 0) { return; } /* is a label necessary ? */ if (fromcpu != cpureport) { printf("VAXBI node %d: ", fromcpu); cpureport = fromcpu; } /* print the character we got */ printf("%c",(char) conschar); /* end of line should reset reporting cpu so we get new header on next line */ if ((conschar & 0x7f) == '\n') { cpureport = -1; } } }}/* * ka820matchl - * * Sit and match echoed characters from supplied command line. * Make sure we handle extra characters from end of line. * Return 1 if match succeeds, 0 if it fails. * */ka820matchl(cmdline)char *cmdline;{ register char *current; register int incoming; current = cmdline; /* loop until match string is exhausted or timeout occurs */ while (*current != '\0') { if ((incoming = ka820nxtchr()) < 0 || incoming != *current) { break; } current++; } /* if string is okay so far, we must also match newline if last character of match string (last thing we saw) was a return */ if (*current == '\0') { if (incoming == '\r') { if (ka820nxtchr() != '\n') { return(0); } } return(1); } return(0);}/* * ka820prompt - * * Sit until we find a prompt on the remote port and * no further input. Return 0 if timedout without prompt * else 1 if prompt was last thing detected. * */ka820prompt(){ register int anglecnt; register int current; anglecnt = 0; /* we sit in loop till timeout, not just ">>>" as we don't really know what might be queued on secondardy cpu. Need quiescent state so we wait... */ while ((current = ka820nxtchr()) >= 0) { if (current == '>') { anglecnt++; } else { anglecnt = 0; } } return((anglecnt >= 3)? 1: 0);}/* * ka820nxtchr - * * Return next character from secondary processor buffer.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -