162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *	include/asm-mips/dec/ecc.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *	ECC handling logic definitions common to DECstation/DECsystem
662306a36Sopenharmony_ci *	5000/200 (KN02), 5000/240 (KN03), 5000/260 (KN05) and
762306a36Sopenharmony_ci *	DECsystem 5900 (KN03), 5900/260 (KN05) systems.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci *	Copyright (C) 2003  Maciej W. Rozycki
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci#ifndef __ASM_MIPS_DEC_ECC_H
1262306a36Sopenharmony_ci#define __ASM_MIPS_DEC_ECC_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/*
1562306a36Sopenharmony_ci * Error Address Register bits.
1662306a36Sopenharmony_ci * The register is r/wc -- any write clears it.
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_ci#define KN0X_EAR_VALID		(1<<31)		/* error data valid, bus IRQ */
1962306a36Sopenharmony_ci#define KN0X_EAR_CPU		(1<<30)		/* CPU/DMA transaction */
2062306a36Sopenharmony_ci#define KN0X_EAR_WRITE		(1<<29)		/* write/read transaction */
2162306a36Sopenharmony_ci#define KN0X_EAR_ECCERR		(1<<28)		/* ECC/timeout or overrun */
2262306a36Sopenharmony_ci#define KN0X_EAR_RES_27		(1<<27)		/* unused */
2362306a36Sopenharmony_ci#define KN0X_EAR_ADDRESS	(0x7ffffff<<0)	/* address involved */
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci/*
2662306a36Sopenharmony_ci * Error Syndrome Register bits.
2762306a36Sopenharmony_ci * The register is frozen when EAR.VALID is set, otherwise it records bits
2862306a36Sopenharmony_ci * from the last memory read.  The register is r/wc -- any write clears it.
2962306a36Sopenharmony_ci */
3062306a36Sopenharmony_ci#define KN0X_ESR_VLDHI		(1<<31)		/* error data valid hi word */
3162306a36Sopenharmony_ci#define KN0X_ESR_CHKHI		(0x7f<<24)	/* check bits read from mem */
3262306a36Sopenharmony_ci#define KN0X_ESR_SNGHI		(1<<23)		/* single/double bit error */
3362306a36Sopenharmony_ci#define KN0X_ESR_SYNHI		(0x7f<<16)	/* syndrome from ECC logic */
3462306a36Sopenharmony_ci#define KN0X_ESR_VLDLO		(1<<15)		/* error data valid lo word */
3562306a36Sopenharmony_ci#define KN0X_ESR_CHKLO		(0x7f<<8)	/* check bits read from mem */
3662306a36Sopenharmony_ci#define KN0X_ESR_SNGLO		(1<<7)		/* single/double bit error */
3762306a36Sopenharmony_ci#define KN0X_ESR_SYNLO		(0x7f<<0)	/* syndrome from ECC logic */
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#ifndef __ASSEMBLY__
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#include <linux/interrupt.h>
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_cistruct pt_regs;
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciextern void dec_ecc_be_init(void);
4762306a36Sopenharmony_ciextern int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup);
4862306a36Sopenharmony_ciextern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id);
4962306a36Sopenharmony_ci#endif
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#endif /* __ASM_MIPS_DEC_ECC_H */
52