18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *	include/asm-mips/dec/ecc.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *	ECC handling logic definitions common to DECstation/DECsystem
68c2ecf20Sopenharmony_ci *	5000/200 (KN02), 5000/240 (KN03), 5000/260 (KN05) and
78c2ecf20Sopenharmony_ci *	DECsystem 5900 (KN03), 5900/260 (KN05) systems.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci *	Copyright (C) 2003  Maciej W. Rozycki
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci#ifndef __ASM_MIPS_DEC_ECC_H
128c2ecf20Sopenharmony_ci#define __ASM_MIPS_DEC_ECC_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * Error Address Register bits.
168c2ecf20Sopenharmony_ci * The register is r/wc -- any write clears it.
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci#define KN0X_EAR_VALID		(1<<31)		/* error data valid, bus IRQ */
198c2ecf20Sopenharmony_ci#define KN0X_EAR_CPU		(1<<30)		/* CPU/DMA transaction */
208c2ecf20Sopenharmony_ci#define KN0X_EAR_WRITE		(1<<29)		/* write/read transaction */
218c2ecf20Sopenharmony_ci#define KN0X_EAR_ECCERR		(1<<28)		/* ECC/timeout or overrun */
228c2ecf20Sopenharmony_ci#define KN0X_EAR_RES_27		(1<<27)		/* unused */
238c2ecf20Sopenharmony_ci#define KN0X_EAR_ADDRESS	(0x7ffffff<<0)	/* address involved */
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/*
268c2ecf20Sopenharmony_ci * Error Syndrome Register bits.
278c2ecf20Sopenharmony_ci * The register is frozen when EAR.VALID is set, otherwise it records bits
288c2ecf20Sopenharmony_ci * from the last memory read.  The register is r/wc -- any write clears it.
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_ci#define KN0X_ESR_VLDHI		(1<<31)		/* error data valid hi word */
318c2ecf20Sopenharmony_ci#define KN0X_ESR_CHKHI		(0x7f<<24)	/* check bits read from mem */
328c2ecf20Sopenharmony_ci#define KN0X_ESR_SNGHI		(1<<23)		/* single/double bit error */
338c2ecf20Sopenharmony_ci#define KN0X_ESR_SYNHI		(0x7f<<16)	/* syndrome from ECC logic */
348c2ecf20Sopenharmony_ci#define KN0X_ESR_VLDLO		(1<<15)		/* error data valid lo word */
358c2ecf20Sopenharmony_ci#define KN0X_ESR_CHKLO		(0x7f<<8)	/* check bits read from mem */
368c2ecf20Sopenharmony_ci#define KN0X_ESR_SNGLO		(1<<7)		/* single/double bit error */
378c2ecf20Sopenharmony_ci#define KN0X_ESR_SYNLO		(0x7f<<0)	/* syndrome from ECC logic */
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct pt_regs;
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciextern void dec_ecc_be_init(void);
478c2ecf20Sopenharmony_ciextern int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup);
488c2ecf20Sopenharmony_ciextern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id);
498c2ecf20Sopenharmony_ci#endif
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci#endif /* __ASM_MIPS_DEC_ECC_H */
52