| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 | /* *	linux/arch/alpha/kernel/err_titan.c * *	Copyright (C) 2000 Jeff Wiedemeier (Compaq Computer Corporation) * *	Error handling code supporting TITAN systems */#include <linux/init.h>#include <linux/pci.h>#include <linux/sched.h>#include <asm/io.h>#include <asm/core_titan.h>#include <asm/hwrpb.h>#include <asm/smp.h>#include <asm/err_common.h>#include <asm/err_ev6.h>#include <asm/irq_regs.h>#include "err_impl.h"#include "proto.h"static inttitan_parse_c_misc(u64 c_misc, int print){#ifdef CONFIG_VERBOSE_MCHECK	char *src;	int nxs = 0;#endif	int status = MCHK_DISPOSITION_REPORT;#define TITAN__CCHIP_MISC__NXM		(1UL << 28)#define TITAN__CCHIP_MISC__NXS__S	(29)#define TITAN__CCHIP_MISC__NXS__M	(0x7)	if (!(c_misc & TITAN__CCHIP_MISC__NXM))		return MCHK_DISPOSITION_UNKNOWN_ERROR;#ifdef CONFIG_VERBOSE_MCHECK	if (!print)		return status;	nxs = EXTRACT(c_misc, TITAN__CCHIP_MISC__NXS);	switch(nxs) {	case 0:	/* CPU 0 */	case 1:	/* CPU 1 */	case 2:	/* CPU 2 */	case 3:	/* CPU 3 */		src = "CPU";		/* num is already the CPU number */		break;	case 4:	/* Pchip 0 */	case 5:	/* Pchip 1 */		src = "Pchip";		nxs -= 4;		break;	default:/* reserved */		src = "Unknown, NXS =";		/* leave num untouched */		break;	}	printk("%s    Non-existent memory access from: %s %d\n", 	       err_print_prefix, src, nxs);#endif /* CONFIG_VERBOSE_MCHECK */	return status;}static inttitan_parse_p_serror(int which, u64 serror, int print){	int status = MCHK_DISPOSITION_REPORT;#ifdef CONFIG_VERBOSE_MCHECK	static const char * const serror_src[] = {		"GPCI", "APCI", "AGP HP", "AGP LP"	};	static const char * const serror_cmd[] = {		"DMA Read", "DMA RMW", "SGTE Read", "Reserved"	};#endif /* CONFIG_VERBOSE_MCHECK */#define TITAN__PCHIP_SERROR__LOST_UECC	(1UL << 0)#define TITAN__PCHIP_SERROR__UECC	(1UL << 1)#define TITAN__PCHIP_SERROR__CRE	(1UL << 2)#define TITAN__PCHIP_SERROR__NXIO	(1UL << 3)#define TITAN__PCHIP_SERROR__LOST_CRE	(1UL << 4)#define TITAN__PCHIP_SERROR__ECCMASK	(TITAN__PCHIP_SERROR__UECC |	  \					 TITAN__PCHIP_SERROR__CRE)#define TITAN__PCHIP_SERROR__ERRMASK	(TITAN__PCHIP_SERROR__LOST_UECC | \					 TITAN__PCHIP_SERROR__UECC |	  \					 TITAN__PCHIP_SERROR__CRE |	  \					 TITAN__PCHIP_SERROR__NXIO |	  \					 TITAN__PCHIP_SERROR__LOST_CRE)#define TITAN__PCHIP_SERROR__SRC__S	(52)#define TITAN__PCHIP_SERROR__SRC__M	(0x3)#define TITAN__PCHIP_SERROR__CMD__S	(54)#define TITAN__PCHIP_SERROR__CMD__M	(0x3)#define TITAN__PCHIP_SERROR__SYN__S	(56)#define TITAN__PCHIP_SERROR__SYN__M	(0xff)#define TITAN__PCHIP_SERROR__ADDR__S	(15)#define TITAN__PCHIP_SERROR__ADDR__M	(0xffffffffUL)	if (!(serror & TITAN__PCHIP_SERROR__ERRMASK))		return MCHK_DISPOSITION_UNKNOWN_ERROR;#ifdef CONFIG_VERBOSE_MCHECK	if (!print)		return status;	printk("%s  PChip %d SERROR: %016llx\n",	       err_print_prefix, which, serror);	if (serror & TITAN__PCHIP_SERROR__ECCMASK) {		printk("%s    %sorrectable ECC Error:\n"		       "      Source: %-6s  Command: %-8s  Syndrome: 0x%08x\n"		       "      Address: 0x%llx\n",		       err_print_prefix,		       (serror & TITAN__PCHIP_SERROR__UECC) ? "Unc" : "C",		       serror_src[EXTRACT(serror, TITAN__PCHIP_SERROR__SRC)],		       serror_cmd[EXTRACT(serror, TITAN__PCHIP_SERROR__CMD)],		       (unsigned)EXTRACT(serror, TITAN__PCHIP_SERROR__SYN),		       EXTRACT(serror, TITAN__PCHIP_SERROR__ADDR));	}	if (serror & TITAN__PCHIP_SERROR__NXIO)		printk("%s    Non Existent I/O Error\n", err_print_prefix);	if (serror & TITAN__PCHIP_SERROR__LOST_UECC)		printk("%s    Lost Uncorrectable ECC Error\n", 		       err_print_prefix);	if (serror & TITAN__PCHIP_SERROR__LOST_CRE)		printk("%s    Lost Correctable ECC Error\n", err_print_prefix);#endif /* CONFIG_VERBOSE_MCHECK */	return status;}static int titan_parse_p_perror(int which, int port, u64 perror, int print){	int cmd;	unsigned long addr;	int status = MCHK_DISPOSITION_REPORT;#ifdef CONFIG_VERBOSE_MCHECK	static const char * const perror_cmd[] = {		"Interrupt Acknowledge", "Special Cycle",		"I/O Read",		"I/O Write",		"Reserved",		"Reserved",		"Memory Read",		"Memory Write",		"Reserved",		"Reserved",		"Configuration Read",	"Configuration Write",		"Memory Read Multiple",	"Dual Address Cycle",		"Memory Read Line",	"Memory Write and Invalidate"	};#endif /* CONFIG_VERBOSE_MCHECK */#define TITAN__PCHIP_PERROR__LOST	(1UL << 0)#define TITAN__PCHIP_PERROR__SERR	(1UL << 1)#define TITAN__PCHIP_PERROR__PERR	(1UL << 2)#define TITAN__PCHIP_PERROR__DCRTO	(1UL << 3)#define TITAN__PCHIP_PERROR__SGE	(1UL << 4)#define TITAN__PCHIP_PERROR__APE	(1UL << 5)#define TITAN__PCHIP_PERROR__TA		(1UL << 6)#define TITAN__PCHIP_PERROR__DPE	(1UL << 7)#define TITAN__PCHIP_PERROR__NDS	(1UL << 8)#define TITAN__PCHIP_PERROR__IPTPR	(1UL << 9)#define TITAN__PCHIP_PERROR__IPTPW	(1UL << 10)#define TITAN__PCHIP_PERROR__ERRMASK	(TITAN__PCHIP_PERROR__LOST |	\					 TITAN__PCHIP_PERROR__SERR |	\					 TITAN__PCHIP_PERROR__PERR |	\					 TITAN__PCHIP_PERROR__DCRTO |	\					 TITAN__PCHIP_PERROR__SGE |	\					 TITAN__PCHIP_PERROR__APE |	\					 TITAN__PCHIP_PERROR__TA |	\					 TITAN__PCHIP_PERROR__DPE |	\					 TITAN__PCHIP_PERROR__NDS |	\					 TITAN__PCHIP_PERROR__IPTPR |	\					 TITAN__PCHIP_PERROR__IPTPW)#define TITAN__PCHIP_PERROR__DAC	(1UL << 47)#define TITAN__PCHIP_PERROR__MWIN	(1UL << 48)#define TITAN__PCHIP_PERROR__CMD__S	(52)#define TITAN__PCHIP_PERROR__CMD__M	(0x0f)#define TITAN__PCHIP_PERROR__ADDR__S	(14)#define TITAN__PCHIP_PERROR__ADDR__M	(0x1fffffffful)	if (!(perror & TITAN__PCHIP_PERROR__ERRMASK))		return MCHK_DISPOSITION_UNKNOWN_ERROR;	cmd = EXTRACT(perror, TITAN__PCHIP_PERROR__CMD);	addr = EXTRACT(perror, TITAN__PCHIP_PERROR__ADDR) << 2;	/*	 * Initializing the BIOS on a video card on a bus without	 * a south bridge (subtractive decode agent) can result in 	 * master aborts as the BIOS probes the capabilities of the	 * card. XFree86 does such initialization. If the error	 * is a master abort (No DevSel as PCI Master) and the command	 * is an I/O read or write below the address where we start	 * assigning PCI I/O spaces (SRM uses 0x1000), then mark the	 * error as dismissable so starting XFree86 doesn't result	 * in a series of uncorrectable errors being reported. Also	 * dismiss master aborts to VGA frame buffer space	 * (0xA0000 - 0xC0000) and legacy BIOS space (0xC0000 - 0x100000)	 * for the same reason.	 *	 * Also mark the error dismissible if it looks like the right	 * error but only the Lost bit is set. Since the BIOS initialization	 * can cause multiple master aborts and the error interrupt can	 * be handled on a different CPU than the BIOS code is run on,	 * it is possible for a second master abort to occur between the	 * time the PALcode reads PERROR and the time it writes PERROR	 * to acknowledge the error. If this timing happens, a second	 * error will be signalled after the first, and if no additional	 * errors occur, will look like a Lost error with no additional 	 * errors on the same transaction as the previous error.	 */	if (((perror & TITAN__PCHIP_PERROR__NDS) || 	     ((perror & TITAN__PCHIP_PERROR__ERRMASK) == 	      TITAN__PCHIP_PERROR__LOST)) &&	    ((((cmd & 0xE) == 2) && (addr < 0x1000)) ||	     (((cmd & 0xE) == 6) && (addr >= 0xA0000) && (addr < 0x100000)))) {		status = MCHK_DISPOSITION_DISMISS;	}#ifdef CONFIG_VERBOSE_MCHECK	if (!print) 		return status;	printk("%s  PChip %d %cPERROR: %016llx\n",	       err_print_prefix, which, 	       port ? 'A' : 'G', perror);	if (perror & TITAN__PCHIP_PERROR__IPTPW)		printk("%s    Invalid Peer-to-Peer Write\n", err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__IPTPR)		printk("%s    Invalid Peer-to-Peer Read\n", err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__NDS)		printk("%s    No DEVSEL as PCI Master [Master Abort]\n",		       err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__DPE)		printk("%s    Data Parity Error\n", err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__TA)		printk("%s    Target Abort\n", err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__APE)		printk("%s    Address Parity Error\n", err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__SGE)		printk("%s    Scatter-Gather Error, Invalid PTE\n", 		       err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__DCRTO)		printk("%s    Delayed-Completion Retry Timeout\n", 		       err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__PERR)		printk("%s    PERR Asserted\n", err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__SERR)		printk("%s    SERR Asserted\n", err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__LOST)		printk("%s    Lost Error\n", err_print_prefix);	printk("%s      Command: 0x%x - %s\n"		 "      Address: 0x%lx\n",	       err_print_prefix,	       cmd, perror_cmd[cmd],	       addr);	if (perror & TITAN__PCHIP_PERROR__DAC)		printk("%s      Dual Address Cycle\n", err_print_prefix);	if (perror & TITAN__PCHIP_PERROR__MWIN)		printk("%s      Hit in Monster Window\n", err_print_prefix);#endif /* CONFIG_VERBOSE_MCHECK */	return status;}static inttitan_parse_p_agperror(int which, u64 agperror, int print){	int status = MCHK_DISPOSITION_REPORT;#ifdef CONFIG_VERBOSE_MCHECK	int cmd, len;	unsigned long addr;	static const char * const agperror_cmd[] = {		"Read (low-priority)",	"Read (high-priority)",		"Write (low-priority)",	"Write (high-priority)",		"Reserved",		"Reserved",		"Flush",		"Fence"	};#endif /* CONFIG_VERBOSE_MCHECK */#define TITAN__PCHIP_AGPERROR__LOST	(1UL << 0)#define TITAN__PCHIP_AGPERROR__LPQFULL	(1UL << 1)#define TITAN__PCHIP_AGPERROR__HPQFULL	(1UL << 2)#define TITAN__PCHIP_AGPERROR__RESCMD	(1UL << 3)#define TITAN__PCHIP_AGPERROR__IPTE	(1UL << 4)#define TITAN__PCHIP_AGPERROR__PTP	(1UL << 5)#define TITAN__PCHIP_AGPERROR__NOWINDOW	(1UL << 6)#define TITAN__PCHIP_AGPERROR__ERRMASK	(TITAN__PCHIP_AGPERROR__LOST |    \					 TITAN__PCHIP_AGPERROR__LPQFULL | \					 TITAN__PCHIP_AGPERROR__HPQFULL | \					 TITAN__PCHIP_AGPERROR__RESCMD |  \					 TITAN__PCHIP_AGPERROR__IPTE |    \					 TITAN__PCHIP_AGPERROR__PTP |     \					 TITAN__PCHIP_AGPERROR__NOWINDOW)#define TITAN__PCHIP_AGPERROR__DAC	(1UL << 48)#define TITAN__PCHIP_AGPERROR__MWIN	(1UL << 49)#define TITAN__PCHIP_AGPERROR__FENCE	(1UL << 59)#define TITAN__PCHIP_AGPERROR__CMD__S	(50)#define TITAN__PCHIP_AGPERROR__CMD__M	(0x07)#define TITAN__PCHIP_AGPERROR__ADDR__S	(15)#define TITAN__PCHIP_AGPERROR__ADDR__M  (0xffffffffUL)#define TITAN__PCHIP_AGPERROR__LEN__S	(53)#define TITAN__PCHIP_AGPERROR__LEN__M	(0x3f)	if (!(agperror & TITAN__PCHIP_AGPERROR__ERRMASK))		return MCHK_DISPOSITION_UNKNOWN_ERROR;#ifdef CONFIG_VERBOSE_MCHECK	if (!print)		return status;	cmd = EXTRACT(agperror, TITAN__PCHIP_AGPERROR__CMD);	addr = EXTRACT(agperror, TITAN__PCHIP_AGPERROR__ADDR) << 3;	len = EXTRACT(agperror, TITAN__PCHIP_AGPERROR__LEN);	printk("%s  PChip %d AGPERROR: %016llx\n", err_print_prefix,	       which, agperror);	if (agperror & TITAN__PCHIP_AGPERROR__NOWINDOW)		printk("%s    No Window\n", err_print_prefix);	if (agperror & TITAN__PCHIP_AGPERROR__PTP)		printk("%s    Peer-to-Peer set\n", err_print_prefix);	if (agperror & TITAN__PCHIP_AGPERROR__IPTE)		printk("%s    Invalid PTE\n", err_print_prefix);	if (agperror & TITAN__PCHIP_AGPERROR__RESCMD)		printk("%s    Reserved Command\n", err_print_prefix);	if (agperror & TITAN__PCHIP_AGPERROR__HPQFULL)		printk("%s    HP Transaction Received while Queue Full\n", 		       err_print_prefix);	if (agperror & TITAN__PCHIP_AGPERROR__LPQFULL)		printk("%s    LP Transaction Received while Queue Full\n", 		       err_print_prefix);	if (agperror & TITAN__PCHIP_AGPERROR__LOST)		printk("%s    Lost Error\n", err_print_prefix);	printk("%s      Command: 0x%x - %s, %d Quadwords%s\n"		 "      Address: 0x%lx\n",	       err_print_prefix, cmd, agperror_cmd[cmd], len,	       (agperror & TITAN__PCHIP_AGPERROR__FENCE) ? ", FENCE" : "",	       addr);	if (agperror & TITAN__PCHIP_AGPERROR__DAC)		printk("%s      Dual Address Cycle\n", err_print_prefix);	if (agperror & TITAN__PCHIP_AGPERROR__MWIN)		printk("%s      Hit in Monster Window\n", err_print_prefix);#endif /* CONFIG_VERBOSE_MCHECK */	return status;}	static inttitan_parse_p_chip(int which, u64 serror, u64 gperror, 		   u64 aperror, u64 agperror, int print){	int status = MCHK_DISPOSITION_UNKNOWN_ERROR;	status |= titan_parse_p_serror(which, serror, print);	status |= titan_parse_p_perror(which, 0, gperror, print);	status |= titan_parse_p_perror(which, 1, aperror, print);	status |= titan_parse_p_agperror(which, agperror, print);	return status;}inttitan_process_logout_frame(struct el_common *mchk_header, int print){	struct el_TITAN_sysdata_mcheck *tmchk =		(struct el_TITAN_sysdata_mcheck *)		((unsigned long)mchk_header + mchk_header->sys_offset);
 |