xref: /openbmc/linux/arch/sparc/include/asm/ecc.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2a439fe51SSam Ravnborg /*
3a439fe51SSam Ravnborg  * ecc.h: Definitions and defines for the external cache/memory
4a439fe51SSam Ravnborg  *        controller on the sun4m.
5a439fe51SSam Ravnborg  *
6a439fe51SSam Ravnborg  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
7a439fe51SSam Ravnborg  */
8a439fe51SSam Ravnborg 
9a439fe51SSam Ravnborg #ifndef _SPARC_ECC_H
10a439fe51SSam Ravnborg #define _SPARC_ECC_H
11a439fe51SSam Ravnborg 
12a439fe51SSam Ravnborg /* These registers are accessed through the SRMMU passthrough ASI 0x20 */
13a439fe51SSam Ravnborg #define ECC_ENABLE     0x00000000       /* ECC enable register */
14a439fe51SSam Ravnborg #define ECC_FSTATUS    0x00000008       /* ECC fault status register */
15a439fe51SSam Ravnborg #define ECC_FADDR      0x00000010       /* ECC fault address register */
16a439fe51SSam Ravnborg #define ECC_DIGNOSTIC  0x00000018       /* ECC diagnostics register */
17a439fe51SSam Ravnborg #define ECC_MBAENAB    0x00000020       /* MBus arbiter enable register */
18a439fe51SSam Ravnborg #define ECC_DMESG      0x00001000       /* Diagnostic message passing area */
19a439fe51SSam Ravnborg 
20a439fe51SSam Ravnborg /* ECC MBus Arbiter Enable register:
21a439fe51SSam Ravnborg  *
22a439fe51SSam Ravnborg  * ----------------------------------------
23a439fe51SSam Ravnborg  * |              |SBUS|MOD3|MOD2|MOD1|RSV|
24a439fe51SSam Ravnborg  * ----------------------------------------
25a439fe51SSam Ravnborg  *  31           5   4   3    2    1    0
26a439fe51SSam Ravnborg  *
27a439fe51SSam Ravnborg  * SBUS: Enable MBus Arbiter on the SBus 0=off 1=on
28a439fe51SSam Ravnborg  * MOD3: Enable MBus Arbiter on MBus module 3  0=off 1=on
29a439fe51SSam Ravnborg  * MOD2: Enable MBus Arbiter on MBus module 2  0=off 1=on
30a439fe51SSam Ravnborg  * MOD1: Enable MBus Arbiter on MBus module 1  0=off 1=on
31a439fe51SSam Ravnborg  */
32a439fe51SSam Ravnborg 
33a439fe51SSam Ravnborg #define ECC_MBAE_SBUS     0x00000010
34a439fe51SSam Ravnborg #define ECC_MBAE_MOD3     0x00000008
35a439fe51SSam Ravnborg #define ECC_MBAE_MOD2     0x00000004
36a439fe51SSam Ravnborg #define ECC_MBAE_MOD1     0x00000002
37a439fe51SSam Ravnborg 
38a439fe51SSam Ravnborg /* ECC Fault Control Register layout:
39a439fe51SSam Ravnborg  *
40a439fe51SSam Ravnborg  * -----------------------------
41a439fe51SSam Ravnborg  * |    RESV   | ECHECK | EINT |
42a439fe51SSam Ravnborg  * -----------------------------
43a439fe51SSam Ravnborg  *  31        2     1       0
44a439fe51SSam Ravnborg  *
45a439fe51SSam Ravnborg  * ECHECK:  Enable ECC checking.  0=off 1=on
46a439fe51SSam Ravnborg  * EINT:  Enable Interrupts for correctable errors. 0=off 1=on
47a439fe51SSam Ravnborg  */
48a439fe51SSam Ravnborg #define ECC_FCR_CHECK    0x00000002
49a439fe51SSam Ravnborg #define ECC_FCR_INTENAB  0x00000001
50a439fe51SSam Ravnborg 
51a439fe51SSam Ravnborg /* ECC Fault Address Register Zero layout:
52a439fe51SSam Ravnborg  *
53a439fe51SSam Ravnborg  * -----------------------------------------------------
54a439fe51SSam Ravnborg  * | MID | S | RSV |  VA   | BM |AT| C| SZ |TYP| PADDR |
55a439fe51SSam Ravnborg  * -----------------------------------------------------
56a439fe51SSam Ravnborg  *  31-28  27 26-22  21-14   13  12 11 10-8 7-4   3-0
57a439fe51SSam Ravnborg  *
58a439fe51SSam Ravnborg  * MID: ModuleID of the faulting processor. ie. who did it?
59a439fe51SSam Ravnborg  * S: Supervisor/Privileged access? 0=no 1=yes
60a439fe51SSam Ravnborg  * VA: Bits 19-12 of the virtual faulting address, these are the
61a439fe51SSam Ravnborg  *     superset bits in the virtual cache and can be used for
62a439fe51SSam Ravnborg  *     a flush operation if necessary.
63a439fe51SSam Ravnborg  * BM: Boot mode? 0=no 1=yes  This is just like the SRMMU boot
64a439fe51SSam Ravnborg  *     mode bit.
65a439fe51SSam Ravnborg  * AT: Did this fault happen during an atomic instruction? 0=no
66a439fe51SSam Ravnborg  *     1=yes.  This means either an 'ldstub' or 'swap' instruction
67a439fe51SSam Ravnborg  *     was in progress (but not finished) when this fault happened.
68a439fe51SSam Ravnborg  *     This indicated whether the bus was locked when the fault
69a439fe51SSam Ravnborg  *     occurred.
70a439fe51SSam Ravnborg  * C: Did the pte for this access indicate that it was cacheable?
71a439fe51SSam Ravnborg  *    0=no 1=yes
72a439fe51SSam Ravnborg  * SZ: The size of the transaction.
73a439fe51SSam Ravnborg  * TYP: The transaction type.
74a439fe51SSam Ravnborg  * PADDR: Bits 35-32 of the physical address for the fault.
75a439fe51SSam Ravnborg  */
76a439fe51SSam Ravnborg #define ECC_FADDR0_MIDMASK   0xf0000000
77a439fe51SSam Ravnborg #define ECC_FADDR0_S         0x08000000
78a439fe51SSam Ravnborg #define ECC_FADDR0_VADDR     0x003fc000
79a439fe51SSam Ravnborg #define ECC_FADDR0_BMODE     0x00002000
80a439fe51SSam Ravnborg #define ECC_FADDR0_ATOMIC    0x00001000
81a439fe51SSam Ravnborg #define ECC_FADDR0_CACHE     0x00000800
82a439fe51SSam Ravnborg #define ECC_FADDR0_SIZE      0x00000700
83a439fe51SSam Ravnborg #define ECC_FADDR0_TYPE      0x000000f0
84a439fe51SSam Ravnborg #define ECC_FADDR0_PADDR     0x0000000f
85a439fe51SSam Ravnborg 
86a439fe51SSam Ravnborg /* ECC Fault Address Register One layout:
87a439fe51SSam Ravnborg  *
88a439fe51SSam Ravnborg  * -------------------------------------
89a439fe51SSam Ravnborg  * |          Physical Address 31-0    |
90a439fe51SSam Ravnborg  * -------------------------------------
91a439fe51SSam Ravnborg  *  31                               0
92a439fe51SSam Ravnborg  *
93a439fe51SSam Ravnborg  * You get the upper 4 bits of the physical address from the
94a439fe51SSam Ravnborg  * PADDR field in ECC Fault Address Zero register.
95a439fe51SSam Ravnborg  */
96a439fe51SSam Ravnborg 
97a439fe51SSam Ravnborg /* ECC Fault Status Register layout:
98a439fe51SSam Ravnborg  *
99a439fe51SSam Ravnborg  * ----------------------------------------------
100a439fe51SSam Ravnborg  * | RESV|C2E|MULT|SYNDROME|DWORD|UNC|TIMEO|BS|C|
101a439fe51SSam Ravnborg  * ----------------------------------------------
102a439fe51SSam Ravnborg  *  31-18  17  16    15-8    7-4   3    2    1 0
103a439fe51SSam Ravnborg  *
104a439fe51SSam Ravnborg  * C2E: A C2 graphics error occurred. 0=no 1=yes (SS10 only)
105a439fe51SSam Ravnborg  * MULT: Multiple errors occurred ;-O 0=no 1=prom_panic(yes)
106a439fe51SSam Ravnborg  * SYNDROME: Controller is mentally unstable.
107a439fe51SSam Ravnborg  * DWORD:
108a439fe51SSam Ravnborg  * UNC: Uncorrectable error.  0=no 1=yes
109a439fe51SSam Ravnborg  * TIMEO: Timeout occurred. 0=no 1=yes
110a439fe51SSam Ravnborg  * BS: C2 graphics bad slot access. 0=no 1=yes (SS10 only)
111a439fe51SSam Ravnborg  * C: Correctable error? 0=no 1=yes
112a439fe51SSam Ravnborg  */
113a439fe51SSam Ravnborg 
114a439fe51SSam Ravnborg #define ECC_FSR_C2ERR    0x00020000
115a439fe51SSam Ravnborg #define ECC_FSR_MULT     0x00010000
116a439fe51SSam Ravnborg #define ECC_FSR_SYND     0x0000ff00
117a439fe51SSam Ravnborg #define ECC_FSR_DWORD    0x000000f0
118a439fe51SSam Ravnborg #define ECC_FSR_UNC      0x00000008
119a439fe51SSam Ravnborg #define ECC_FSR_TIMEO    0x00000004
120a439fe51SSam Ravnborg #define ECC_FSR_BADSLOT  0x00000002
121a439fe51SSam Ravnborg #define ECC_FSR_C        0x00000001
122a439fe51SSam Ravnborg 
123a439fe51SSam Ravnborg #endif /* !(_SPARC_ECC_H) */
124