162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * ecc.h: Definitions and defines for the external cache/memory
462306a36Sopenharmony_ci *        controller on the sun4m.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef _SPARC_ECC_H
1062306a36Sopenharmony_ci#define _SPARC_ECC_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/* These registers are accessed through the SRMMU passthrough ASI 0x20 */
1362306a36Sopenharmony_ci#define ECC_ENABLE     0x00000000       /* ECC enable register */
1462306a36Sopenharmony_ci#define ECC_FSTATUS    0x00000008       /* ECC fault status register */
1562306a36Sopenharmony_ci#define ECC_FADDR      0x00000010       /* ECC fault address register */
1662306a36Sopenharmony_ci#define ECC_DIGNOSTIC  0x00000018       /* ECC diagnostics register */
1762306a36Sopenharmony_ci#define ECC_MBAENAB    0x00000020       /* MBus arbiter enable register */
1862306a36Sopenharmony_ci#define ECC_DMESG      0x00001000       /* Diagnostic message passing area */
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci/* ECC MBus Arbiter Enable register:
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci * ----------------------------------------
2362306a36Sopenharmony_ci * |              |SBUS|MOD3|MOD2|MOD1|RSV|
2462306a36Sopenharmony_ci * ----------------------------------------
2562306a36Sopenharmony_ci *  31           5   4   3    2    1    0
2662306a36Sopenharmony_ci *
2762306a36Sopenharmony_ci * SBUS: Enable MBus Arbiter on the SBus 0=off 1=on
2862306a36Sopenharmony_ci * MOD3: Enable MBus Arbiter on MBus module 3  0=off 1=on
2962306a36Sopenharmony_ci * MOD2: Enable MBus Arbiter on MBus module 2  0=off 1=on
3062306a36Sopenharmony_ci * MOD1: Enable MBus Arbiter on MBus module 1  0=off 1=on
3162306a36Sopenharmony_ci */
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define ECC_MBAE_SBUS     0x00000010
3462306a36Sopenharmony_ci#define ECC_MBAE_MOD3     0x00000008
3562306a36Sopenharmony_ci#define ECC_MBAE_MOD2     0x00000004
3662306a36Sopenharmony_ci#define ECC_MBAE_MOD1     0x00000002
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/* ECC Fault Control Register layout:
3962306a36Sopenharmony_ci *
4062306a36Sopenharmony_ci * -----------------------------
4162306a36Sopenharmony_ci * |    RESV   | ECHECK | EINT |
4262306a36Sopenharmony_ci * -----------------------------
4362306a36Sopenharmony_ci *  31        2     1       0
4462306a36Sopenharmony_ci *
4562306a36Sopenharmony_ci * ECHECK:  Enable ECC checking.  0=off 1=on
4662306a36Sopenharmony_ci * EINT:  Enable Interrupts for correctable errors. 0=off 1=on
4762306a36Sopenharmony_ci */
4862306a36Sopenharmony_ci#define ECC_FCR_CHECK    0x00000002
4962306a36Sopenharmony_ci#define ECC_FCR_INTENAB  0x00000001
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/* ECC Fault Address Register Zero layout:
5262306a36Sopenharmony_ci *
5362306a36Sopenharmony_ci * -----------------------------------------------------
5462306a36Sopenharmony_ci * | MID | S | RSV |  VA   | BM |AT| C| SZ |TYP| PADDR |
5562306a36Sopenharmony_ci * -----------------------------------------------------
5662306a36Sopenharmony_ci *  31-28  27 26-22  21-14   13  12 11 10-8 7-4   3-0
5762306a36Sopenharmony_ci *
5862306a36Sopenharmony_ci * MID: ModuleID of the faulting processor. ie. who did it?
5962306a36Sopenharmony_ci * S: Supervisor/Privileged access? 0=no 1=yes
6062306a36Sopenharmony_ci * VA: Bits 19-12 of the virtual faulting address, these are the
6162306a36Sopenharmony_ci *     superset bits in the virtual cache and can be used for
6262306a36Sopenharmony_ci *     a flush operation if necessary.
6362306a36Sopenharmony_ci * BM: Boot mode? 0=no 1=yes  This is just like the SRMMU boot
6462306a36Sopenharmony_ci *     mode bit.
6562306a36Sopenharmony_ci * AT: Did this fault happen during an atomic instruction? 0=no
6662306a36Sopenharmony_ci *     1=yes.  This means either an 'ldstub' or 'swap' instruction
6762306a36Sopenharmony_ci *     was in progress (but not finished) when this fault happened.
6862306a36Sopenharmony_ci *     This indicated whether the bus was locked when the fault
6962306a36Sopenharmony_ci *     occurred.
7062306a36Sopenharmony_ci * C: Did the pte for this access indicate that it was cacheable?
7162306a36Sopenharmony_ci *    0=no 1=yes
7262306a36Sopenharmony_ci * SZ: The size of the transaction.
7362306a36Sopenharmony_ci * TYP: The transaction type.
7462306a36Sopenharmony_ci * PADDR: Bits 35-32 of the physical address for the fault.
7562306a36Sopenharmony_ci */
7662306a36Sopenharmony_ci#define ECC_FADDR0_MIDMASK   0xf0000000
7762306a36Sopenharmony_ci#define ECC_FADDR0_S         0x08000000
7862306a36Sopenharmony_ci#define ECC_FADDR0_VADDR     0x003fc000
7962306a36Sopenharmony_ci#define ECC_FADDR0_BMODE     0x00002000
8062306a36Sopenharmony_ci#define ECC_FADDR0_ATOMIC    0x00001000
8162306a36Sopenharmony_ci#define ECC_FADDR0_CACHE     0x00000800
8262306a36Sopenharmony_ci#define ECC_FADDR0_SIZE      0x00000700
8362306a36Sopenharmony_ci#define ECC_FADDR0_TYPE      0x000000f0
8462306a36Sopenharmony_ci#define ECC_FADDR0_PADDR     0x0000000f
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci/* ECC Fault Address Register One layout:
8762306a36Sopenharmony_ci *
8862306a36Sopenharmony_ci * -------------------------------------
8962306a36Sopenharmony_ci * |          Physical Address 31-0    |
9062306a36Sopenharmony_ci * -------------------------------------
9162306a36Sopenharmony_ci *  31                               0
9262306a36Sopenharmony_ci *
9362306a36Sopenharmony_ci * You get the upper 4 bits of the physical address from the
9462306a36Sopenharmony_ci * PADDR field in ECC Fault Address Zero register.
9562306a36Sopenharmony_ci */
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/* ECC Fault Status Register layout:
9862306a36Sopenharmony_ci *
9962306a36Sopenharmony_ci * ----------------------------------------------
10062306a36Sopenharmony_ci * | RESV|C2E|MULT|SYNDROME|DWORD|UNC|TIMEO|BS|C|
10162306a36Sopenharmony_ci * ----------------------------------------------
10262306a36Sopenharmony_ci *  31-18  17  16    15-8    7-4   3    2    1 0
10362306a36Sopenharmony_ci *
10462306a36Sopenharmony_ci * C2E: A C2 graphics error occurred. 0=no 1=yes (SS10 only)
10562306a36Sopenharmony_ci * MULT: Multiple errors occurred ;-O 0=no 1=prom_panic(yes)
10662306a36Sopenharmony_ci * SYNDROME: Controller is mentally unstable.
10762306a36Sopenharmony_ci * DWORD:
10862306a36Sopenharmony_ci * UNC: Uncorrectable error.  0=no 1=yes
10962306a36Sopenharmony_ci * TIMEO: Timeout occurred. 0=no 1=yes
11062306a36Sopenharmony_ci * BS: C2 graphics bad slot access. 0=no 1=yes (SS10 only)
11162306a36Sopenharmony_ci * C: Correctable error? 0=no 1=yes
11262306a36Sopenharmony_ci */
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci#define ECC_FSR_C2ERR    0x00020000
11562306a36Sopenharmony_ci#define ECC_FSR_MULT     0x00010000
11662306a36Sopenharmony_ci#define ECC_FSR_SYND     0x0000ff00
11762306a36Sopenharmony_ci#define ECC_FSR_DWORD    0x000000f0
11862306a36Sopenharmony_ci#define ECC_FSR_UNC      0x00000008
11962306a36Sopenharmony_ci#define ECC_FSR_TIMEO    0x00000004
12062306a36Sopenharmony_ci#define ECC_FSR_BADSLOT  0x00000002
12162306a36Sopenharmony_ci#define ECC_FSR_C        0x00000001
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#endif /* !(_SPARC_ECC_H) */
124