1/* $NetBSD: comlogout.c,v 1.4 2001/01/03 21:40:25 thorpej Exp $ */
2
3/*
4 * Copyright (c) 1998 by Matthew Jacob
5 * NASA AMES Research Center.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice immediately at the beginning of the file, without modification,
13 *    this list of conditions, and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in the
16 *    documentation and/or other materials provided with the distribution.
17 * 3. The name of the author may not be used to endorse or promote products
18 *    derived from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: comlogout.c,v 1.4 2001/01/03 21:40:25 thorpej Exp $");
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/device.h>
39
40#include <machine/rpb.h>
41#include <machine/autoconf.h>
42#include <sys/bus.h>
43#include <machine/frame.h>
44#include <machine/cpuconf.h>
45#include <machine/logout.h>
46
47/*
48 * Common PAL Logout Handling Code
49 */
50
51/* (pretty much just structured console printout right now) */
52
53void
54ev5_logout_print(mc_hdr_ev5 *ev5lohdrp, mc_uc_ev5 *mcucev5p)
55{
56	int i;
57	static const char *fmt1 = "        %-30s = 0x%l016x\n";
58
59	printf("      Processor Machine Check (%x), Code 0x%lx\n",
60	    ALPHA_PROC_MCHECK, ev5lohdrp->mcheck_code);
61	/* Print PAL fields */
62	for (i = 0; i < 24; i += 2) {
63		printf("\tPAL temp[%d-%d]\t\t= 0x%16lx 0x%16lx\n", i, i+1,
64		    mcucev5p->paltemp[i], mcucev5p->paltemp[i+1]);
65	}
66	for (i = 0; i < 8; i += 2) {
67		printf("\tshadow[%d-%d]\t\t\t= 0x%16lx 0x%16lx\n", i, i+1,
68		    mcucev5p->shadow[i], mcucev5p->shadow[i+1]);
69	}
70	printf("\n");
71	printf(fmt1, "Excepting Instruction Addr", mcucev5p->exc_addr);
72	printf(fmt1, "Summary of arithmetic traps", mcucev5p->exc_sum);
73	printf(fmt1, "Exception mask", mcucev5p->exc_mask);
74	printf(fmt1, "Base address for PALcode", mcucev5p->pal_base);
75	printf(fmt1, "Interrupt Status Reg", mcucev5p->isr);
76	printf(fmt1, "Current setup of EV5 IBOX", mcucev5p->icsr);
77	printf(fmt1, (mcucev5p->ic_perr_stat & 0x800)?
78	       "I-CACHE Reg Data parity error" :
79	       "I-CACHE Reg Tag parity error", mcucev5p->ic_perr_stat);
80	printf(fmt1, "D-CACHE error Reg", mcucev5p->dc_perr_stat);
81
82	if (mcucev5p->dc_perr_stat & 0x2) {
83		switch (mcucev5p->dc_perr_stat & 0x3c) {
84		case 8:
85			printf("        %-40s\n", "Data error in bank 1");
86			break;
87		case 4:
88			printf("        %-40s\n", "Data error in bank 0");
89			break;
90		case 20:
91			printf("        %-40s\n", "Tag error in bank 1");
92			break;
93		case 10:
94			printf("        %-40s\n", "Tag error in bank 0");
95			break;
96		}
97	}
98	printf(fmt1, "Effective VA", mcucev5p->va);
99	printf(fmt1, "Reason for D-stream", mcucev5p->mm_stat);
100	printf(fmt1, "EV5 SCache address", mcucev5p->sc_addr);
101	printf(fmt1, "EV5 SCache TAG/Data parity", mcucev5p->sc_stat);
102	printf(fmt1, "EV5 BC_TAG_ADDR", mcucev5p->bc_tag_addr);
103	printf(fmt1, "EV5 EI_ADDR Phys addr of Xfer", mcucev5p->ei_addr);
104	printf(fmt1, "Fill Syndrome", mcucev5p->fill_syndrome);
105	printf(fmt1, "ei_stat reg", mcucev5p->ei_stat);
106	printf(fmt1, "ld_lock", mcucev5p->ld_lock);
107}
108