📄 ka9000.c
字号:
#ifndef lintstatic char *sccsid = "@(#)ka9000.c 4.13 ULTRIX 4/11/91";#endif lint/************************************************************************ * * * Copyright (c) 1988,1989,1990 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: ka9000.c * * 11-Apr-91 dlh * ka9000startcpu() * moved where vpdata area is KM_ALLOC'd. This will ensure that * the area has been allocated before the cpu is actually * started. * * 20-dec-90 * added parameter to vp_reset() call * added call to vp_reset() during ka9000startcpu() * * 14-Nov-90 -- stuarth * added is_adapt_configured to ensure xmi is configured * moved address computations in xja_err to before where addrs are used * * 13-Nov-90 -- paradis * Put console back in a useful state when it signals that * it has rebooted. * * 12-Nov-90 -- stuarth * SPU msgs with only a header are now processed. * SPU timestamp msgs are now not logged. * * 16-Oct-90 -- stuarth * SPU log, swap args in memory message. Add UNDEF for default case. * * 15-Oct-90 -- paradis * Copy return status to SPARAM field of RXFCT when done. * * 10-Oct-90 -- paradis * Added VAX 9000 vector support. * * 17-Sep-90 -- stuarth (Stuart Hollander) * Added XJA error handling. * Added logging in machine check code. * Removed setting XJA_IPE in errintr because IPE is not in that reg. * Removed kmalloc of only one xmidata struct. We kmalloc 4 of them. * * 31-Aug-90 -- paradis * Removed TXFCT asynchronous request mechanism; not used. * Added error-logging support (stuarth) * Added machine-check handler * Removed unnecessary XMI reset from ka9000_reboot() * Simplified DMD allocation scheme * General cleanups * * 22-Nov-89 -- paradis (Jim Paradis) * Merged in SPU support * * 13-Nov-89 -- rafiey (Ali Rafieymehr) * Merged in changes required for booting VAX9000 * * 27-Sep-89 -- rafiey (Ali Rafieymehr) * Created this file for VAX9000 (Aquarius) * **********************************************************************/#include "../../machine/common/cpuconf.h"#include "../h/types.h"#include "../h/time.h"#include "../h/param.h"#include "../vax/cons.h"#include "../h/smp_lock.h"#include "../h/errlog.h"#include "../vax/mtpr.h"#include "../vax/cpu.h"#include "../machine/scb.h"#include "../vax/mem.h"#include "../vax/pte.h"#include "../vax/nexus.h"#include "../io/uba/ubareg.h"#include "../vax/ioa.h"#include "../h/user.h"#include "../h/cmap.h"#include "../h/vmmac.h"#include "../h/kmalloc.h"#include "../vax/psl.h"#include "../h/cpudata.h"#include "../vax/ka9000.h"#include "../machine/cvax.h"#include "../h/proc.h"#include "../h/ipc.h"#include "../h/shm.h"#include "../h/conf.h"#include "../h/errno.h"#include "../h/systm.h"#include "../h/map.h"#include "../h/vm.h"#include "../h/tty.h"#include "../machine/vectors.h"#include "../io/xmi/xmireg.h"#include "../io/xmi/xmareg.h"extern long sbi_there; /* defined in autoconf.c */extern int nexusinfo(); /* defined in errlog.c */extern int catcher[256];int ka9000mem_err_report; /* state of memory error reporting */int ka9000memerrs = 0; /* number of times memerr has been entered */extern struct bidata bidata[];extern int cache_state;extern int nNVAXBI;extern char *ka9000_ip_addr;struct v9000csr v9000csr[1];extern struct xja_regs xja_mem[];extern struct xmi_reg xmi_start[];int ali_debug_flag = 0;/* Structures to hold soft-error statistics */struct mc9000_softerr_stats cpu_softerrs[NCPU_9K];struct mc9000_softerr_stats vbox_softerrs[NCPU_9K];struct mc9000_softerr_stats mem_softerrs;/* External data */extern int boot_cpu_mask;extern int boot_cpu_num;extern struct sminfo sminfo;/* Static data local to this module *//* Datagram allocator */struct dmd * spu_dmdlist = (struct dmd *)NULL;/* Keepalive system */int ka9000_keepalive_enabled = 0;int ka9000_keepalive_misses = 0;/* Spurious interrupt counters */int ka9000_addcpu_reqs = 0;int ka9000_rmcpu_reqs = 0;int ka9000_opcom_reqs = 0;/* Error logger */int ka9000_errlog_enabled = 0;/*ARGSUSED*/xja0_errvec(pc, ps) caddr_t pc; int ps; {ka9000xja_err(0); }/*ARGSUSED*/xja1_errvec(pc, ps) caddr_t pc; int ps; {ka9000xja_err(1); }/*ARGSUSED*/xja2_errvec(pc, ps) caddr_t pc; int ps; {ka9000xja_err(2); }/*ARGSUSED*/xja3_errvec(pc, ps) caddr_t pc; int ps; {ka9000xja_err(3); }int (*xja_err_vectors[4])() = { xja0_errvec, xja1_errvec, xja2_errvec, xja3_errvec };extern int max_vec_procs;ka9000conf(cpup) struct cpusw *cpup;{ struct xmi_reg *nxv; /* virtual pointer to XMI node */ struct xmi_reg *nxp; /* physical pointer to XMI node */ register int timeout; register struct xmidata *xmidata; struct xja_regs *xja; struct pte *pte; int cpu_subtype; int cpucnf; int i; int xja_node; union cpusid cpusid; extern char Sysbase[]; extern int nNXMI; cpusid.cpusid = mfpr(SID);/* * Map XJA private space * The relevant part of XJA private space is a structure * that fits in under one page. So we use one virtual * page to map only one physical page of each xja priv spc */ for(i = 0; i<nNXMI; i++){ if(mfpr(CPUCNF) & (1 << (CPUCNF_XJA_PRESENT+i))) nxaccess(XJA_START_PHYS+XJA_SIZE*i, ((struct pte *)XJAmap)+i, NBPG); }/* allocate xmi structures */ KM_ALLOC(xmidata,struct xmidata *,nNXMI*sizeof(struct xmidata ), KM_DEVBUF,KM_NOW_CL_CO_CA);/* * We allocate all xmi structs, even if not configured. * But we invalidate (xminum = -1) the non-configured ones. */ head_xmidata = xmidata; xmidata->next = 0; xmidata->xminum = -1; for(i=0; i<nNXMI; i++, xmidata++) { if(i == nNXMI-1) xmidata->next = 0; else xmidata->next = xmidata+1; xmidata->xminum = -1; if(!(mfpr(CPUCNF) & (1<< (CPUCNF_XJA_PRESENT+i)))) continue; /* was xmi configured? */ if(is_adapt_configured("xmi", i) == 0) { printf("xmi %x not configured\n", i); continue; } xmidata->xminum = i; xja =(struct xja_regs *) (((char *)xja_mem) + i*NBPG); /* clear error flags */ xja->xja_errs = xja->xja_errs;#define INTSTK 1 /* set entry in SCB */ *((caddr_t *) ((caddr_t)&scb+0x50+(0x200*i)) ) = (caddr_t)xja_err_vectors[i] + INTSTK; /* Enable all XJA interrupts */ xja->xja_errintr = XJA_XMI_ARB | XJA_JXDI | XJA_TRANS_TOUT | XJA_CMD_NOACK | XJA_RD_RES | XJA_RD_SEQ_ERR | XJA_REATTEMP_TOUT | XJA_CRD | XJA_WR_NOACK | XJA_RD_NOACK | XJA_WR_SEQ_ERR | XJA_PAR_ERR | XJA_CC ; xja_node = (xja->xja_cnf >> 12) & 0xf; xmidata->xmiintr_dst = 1<< xja_node; xmidata->xmiphys = (struct xmi_reg *) (XMI_START_PHYS + 0x800000 * i); xmidata->xmivec_page = &scb.scb_stray + i*128; /* Map xja node space */ nxv = xmi_start; nxv += (i*16) + xja_node; nxp = (struct xmi_reg *) ka9000nexaddr(i,xja_node); nxaccess(nxp,&Sysmap[btop((int)(nxv) & ~VA_SYS)],XMINODE_SIZE); } /* Initialize machine check soft error statistics */ for(i = 0; i < NCPU_9K; i++) { cpu_softerrs[i].err_cnt = 0; cpu_softerrs[i].lasterr_time = 0; vbox_softerrs[i].err_cnt = 0; vbox_softerrs[i].lasterr_time = 0; } mem_softerrs.err_cnt = 0; mem_softerrs.lasterr_time = 0; cpucnf = mfpr(CPUCNF); cpu_avail = 0; for (i = 0; i < 4; i++) { if (cpucnf & (1 << i)) cpu_avail++; } /* Configure vector processors (if any) */ vpmask = vpfree = vptotal = 0; if(max_vec_procs > 0) { /* * Set up vector processing system wide variables. Record * which scalar cpu's have an attached vector processor. */ vpmask = (cpucnf >> 8) & 0xf; vpfree = 1 ; for(i = 0; i < 4; i++) { /* Should be constant */ if(vpfree & vpmask) { printf("VBOX processor attached to cpu %d\n", i); vptotal++; } vpfree <<=1; } vpfree = vpmask; num_vec_procs = 0; KM_ALLOC (( CURRENT_CPUDATA->cpu_vpdata), struct vpdata *, sizeof(struct vpdata), KM_VECTOR, KM_CLEAR | KM_CONTIG ); if (vpmask & CURRENT_CPUDATA->cpu_mask) { vp_reset (CURRENT_CPUDATA->cpu_num); } } /* Make sure the vector processor is disabled. Take advantage * of the fact that (according to section 13.2.3 of the VAX * architecture reference manual) neither a mtpr(VPSR) nor a * mfpr(VPSR) will cause a reserved operand fault on a * vector-absent VAX. */ mtpr(VPSR, 0); if (cpusid.cpu9000.cp_type_id) printf("VAX92%d0%s, ", cpu_avail, (vptotal > 0) ? "-VP" : ""); else printf("VAX94%d0%s, ", cpu_avail, (vptotal > 0) ? "-VP" : ""); printf("serial no. %d, plant code = %d, hardware rev level = %d\n", cpusid.cpu9000.cp_sno, cpusid.cpu9000.cp_plant, cpusid.cpu9000.cp_rev);/* * Set the Interrupt mode to absolute mode (not Round Robin) */ timeout = 20000000; while((mfpr(TXFCT) & TXFCT_RDY) == 0) { if(--timeout == 0) { panic("ka9000conf: TXFCT not ready"); } } mtpr(TXPRM, boot_cpu_mask); /* Select boot cpu only *//* * Set the interrupt mode to absolute (not round robin) */ mtpr (TXFCT, TXFCT_SET_INTMODE); timeout = 20000000; while((mfpr(TXFCT) & TXFCT_RDY) == 0) { if(--timeout == 0) { panic("ka9000conf: TXFCT not ready"); } } printf("\tCPU Configuration = 0x%x\n", mfpr(CPUCNF)); /* Set up the SPU */ ka9000_init_spu(); spl0(); /* Ready for interrupts */ for(i=0; i<nNXMI; i++){ if(mfpr(CPUCNF) & (1 << (CPUCNF_XJA_PRESENT+i))) xmiconf(i); } return(0);}ka9000_enable_cache() {}extern struct xmidata *get_xmi();ka9000mapcsr() { struct xja_regs *xja; register int i; register int xja_node;/* * Map XJA private space */ for(i = 0; i<nNXMI; i++){ if(mfpr(CPUCNF) & (1 << (CPUCNF_XJA_PRESENT+i))) { nxaccess(XJA_START_PHYS+XJA_SIZE*i, ((struct pte *)XJAmap)+i, NBPG); xja =(struct xja_regs *) (((char *)xja_mem) + i*NBPG); xja->xja_errs = xja->xja_errs; xja_node = (xja->xja_cnf >> 12) & 0xf; /* XJA fatal errors always vector to SCB 50H. Other XJA errors use xja_errscb to determine SCB vector. Upon XJA init, xja_errscb is set to 64H. We change it to 50H so all xja errs go to same vec. */ xja->xja_errscb = 0x50 + (0x200 * i); } }}/* * ka9000memerr --- Hard errors are reported through SCB vector * 0x60, at IPL 0x1d. These errors include the following: * This routine runs on the interrupt stack. * * XBE:WDNAK -- write data noAck. * XBE:TE -- Transmit Error. * XBE:CNAK -- Command NoAck. * CSR1:WDPE -- DAL write Parity Error. * XBE:WEI -- XMI write Error IVINTR's. * XBE:XFAULT -- XMI fault assertion. * All forms of Ident errors (which bits?). */ka9000_xma_check_errors(xcp,priority)struct xcp_reg *xcp;int priority;{}ka9000_clear_err(){ struct xmi_reg *nxv; /* virtual pointer to XMI node */ struct xja_regs *xja; register int i; register int xja_node; int s; s = spl7(); for(i = 0; i<nNXMI; i++){ if(mfpr(CPUCNF) & (1 << (CPUCNF_XJA_PRESENT+i))) { nxv = xmi_start; nxv += (i * 16); xja =(struct xja_regs *) (((char *)xja_mem) + i*NBPG); xja_node = (xja->xja_cnf >> 12) & 0xf; nxv += xja_node; nxv->xmi_xbe = nxv->xmi_xbe & ~XMI_XBAD; } } splx(s);}ka9000_clear_xbe(){ struct xmi_reg *nxv; /* virtual pointer to XMI node */ struct xja_regs *xja; register int i; register int xja_node; for(i = 0; i<nNXMI; i++){ if(mfpr(CPUCNF) & (1 << (CPUCNF_XJA_PRESENT+i))) { nxv = xmi_start; nxv += (i * 16); xja =(struct xja_regs *) (((char *)xja_mem) + i*NBPG); xja_node = (xja->xja_cnf >> 12) & 0xf; nxv += xja_node; nxv->xmi_xbe = nxv->xmi_xbe & ~XMI_XBAD; } }}/* log XMA memory error. If priority is not LOW then print to console.*/ka9000_log_mem_error(xcp,xma,priority) int priority; struct xma_reg *xma; struct xcp_reg *xcp;{ struct el_xma *xma_pkg; struct xmidata *xmidata; struct el_rec *elrp;}/* * ka9000crderr() --- "Soft" errors are reported through SCB vector * 0x54, at IPL 0x1a. These errors include the following: * This routine runs on the interrupt stack. * * XBE:CRD - Correctable main memory errors. * * 2nd Level cache errors. * CSR2:VBPE - Valid bit parity error. * CSR2:TPE - Tag parity error. * CSR2:IQO - Invailidate Queue Overflow. * CSR2:DTPE - Duplicate Tag Store Parity Error. * CSR2:CFE - Cache Fill Error., * * XMI soft errors. * XBE:CC - Corrected conformation Errors. * XBE:IPE - Inconsistent Parity Error. * XBE:PE - Parity Error. */ka9000crderr(){ struct xcp_reg *xcp_node; int save_led_val; register struct xmidata *xmidata ; int node; struct xcp_machdep_data *xcpdata; register struct el_xcpsoft *sptr; register int csr2_errs,xbe_errs, flush_cache=0; return(0);}/* * Routine xcp_log_soft * * Discription: This routine logs a soft error for processor pointed * to by the pointer xcp_node. A maximum of 1 packet are logged every * 15 minutes. * */ka9000_xcp_log_soft(xcp_node,sptr) struct xcp_reg *xcp_node; register struct el_xcpsoft *sptr;{ struct el_rec *elrp; register struct el_xcp54 *ptr;}/* * Routine: xma_check_crd * * Discription: This routine scans all of the Calypso arrays * looking for the board that signaled the CRD error. When found * the error is logged and CRD's are disabled from that board. */ka9000_xma_check_crd(xcp,xmidata) struct xcp_reg *xcp; struct xmidata *xmidata;{ int xminode; struct xma_reg *xma;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -