18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _SPARC64_CHAFSR_H
38c2ecf20Sopenharmony_ci#define _SPARC64_CHAFSR_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/* Cheetah Asynchronous Fault Status register, ASI=0x4C VA<63:0>=0x0 */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* Comments indicate which processor variants on which the bit definition
88c2ecf20Sopenharmony_ci * is valid.  Codes are:
98c2ecf20Sopenharmony_ci * ch	-->	cheetah
108c2ecf20Sopenharmony_ci * ch+	-->	cheetah plus
118c2ecf20Sopenharmony_ci * jp	-->	jalapeno
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* All bits of this register except M_SYNDROME and E_SYNDROME are
158c2ecf20Sopenharmony_ci * read, write 1 to clear.  M_SYNDROME and E_SYNDROME are read-only.
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* Software bit set by linux trap handlers to indicate that the trap was
198c2ecf20Sopenharmony_ci * signalled at %tl >= 1.
208c2ecf20Sopenharmony_ci */
218c2ecf20Sopenharmony_ci#define CHAFSR_TL1		(1UL << 63UL) /* n/a */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* Unmapped error from system bus for prefetch queue or
248c2ecf20Sopenharmony_ci * store queue read operation
258c2ecf20Sopenharmony_ci */
268c2ecf20Sopenharmony_ci#define CHPAFSR_DTO		(1UL << 59UL) /* ch+ */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* Bus error from system bus for prefetch queue or store queue
298c2ecf20Sopenharmony_ci * read operation
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci#define CHPAFSR_DBERR		(1UL << 58UL) /* ch+ */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* Hardware corrected E-cache Tag ECC error */
348c2ecf20Sopenharmony_ci#define CHPAFSR_THCE		(1UL << 57UL) /* ch+ */
358c2ecf20Sopenharmony_ci/* System interface protocol error, hw timeout caused */
368c2ecf20Sopenharmony_ci#define JPAFSR_JETO		(1UL << 57UL) /* jp */
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/* SW handled correctable E-cache Tag ECC error */
398c2ecf20Sopenharmony_ci#define CHPAFSR_TSCE		(1UL << 56UL) /* ch+ */
408c2ecf20Sopenharmony_ci/* Parity error on system snoop results */
418c2ecf20Sopenharmony_ci#define JPAFSR_SCE		(1UL << 56UL) /* jp */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* Uncorrectable E-cache Tag ECC error */
448c2ecf20Sopenharmony_ci#define CHPAFSR_TUE		(1UL << 55UL) /* ch+ */
458c2ecf20Sopenharmony_ci/* System interface protocol error, illegal command detected */
468c2ecf20Sopenharmony_ci#define JPAFSR_JEIC		(1UL << 55UL) /* jp */
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* Uncorrectable system bus data ECC error due to prefetch
498c2ecf20Sopenharmony_ci * or store fill request
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_ci#define CHPAFSR_DUE		(1UL << 54UL) /* ch+ */
528c2ecf20Sopenharmony_ci/* System interface protocol error, illegal ADTYPE detected */
538c2ecf20Sopenharmony_ci#define JPAFSR_JEIT		(1UL << 54UL) /* jp */
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/* Multiple errors of the same type have occurred.  This bit is set when
568c2ecf20Sopenharmony_ci * an uncorrectable error or a SW correctable error occurs and the status
578c2ecf20Sopenharmony_ci * bit to report that error is already set.  When multiple errors of
588c2ecf20Sopenharmony_ci * different types are indicated by setting multiple status bits.
598c2ecf20Sopenharmony_ci *
608c2ecf20Sopenharmony_ci * This bit is not set if multiple HW corrected errors with the same
618c2ecf20Sopenharmony_ci * status bit occur, only uncorrectable and SW correctable ones have
628c2ecf20Sopenharmony_ci * this behavior.
638c2ecf20Sopenharmony_ci *
648c2ecf20Sopenharmony_ci * This bit is not set when multiple ECC errors happen within a single
658c2ecf20Sopenharmony_ci * 64-byte system bus transaction.  Only the first ECC error in a 16-byte
668c2ecf20Sopenharmony_ci * subunit will be logged.  All errors in subsequent 16-byte subunits
678c2ecf20Sopenharmony_ci * from the same 64-byte transaction are ignored.
688c2ecf20Sopenharmony_ci */
698c2ecf20Sopenharmony_ci#define CHAFSR_ME		(1UL << 53UL) /* ch,ch+,jp */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* Privileged state error has occurred.  This is a capture of PSTATE.PRIV
728c2ecf20Sopenharmony_ci * at the time the error is detected.
738c2ecf20Sopenharmony_ci */
748c2ecf20Sopenharmony_ci#define CHAFSR_PRIV		(1UL << 52UL) /* ch,ch+,jp */
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/* The following bits 51 (CHAFSR_PERR) to 33 (CHAFSR_CE) are sticky error
778c2ecf20Sopenharmony_ci * bits and record the most recently detected errors.  Bits accumulate
788c2ecf20Sopenharmony_ci * errors that have been detected since the last write to clear the bit.
798c2ecf20Sopenharmony_ci */
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/* System interface protocol error.  The processor asserts its' ERROR
828c2ecf20Sopenharmony_ci * pin when this event occurs and it also logs a specific cause code
838c2ecf20Sopenharmony_ci * into a JTAG scannable flop.
848c2ecf20Sopenharmony_ci */
858c2ecf20Sopenharmony_ci#define CHAFSR_PERR		(1UL << 51UL) /* ch,ch+,jp */
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* Internal processor error.  The processor asserts its' ERROR
888c2ecf20Sopenharmony_ci * pin when this event occurs and it also logs a specific cause code
898c2ecf20Sopenharmony_ci * into a JTAG scannable flop.
908c2ecf20Sopenharmony_ci */
918c2ecf20Sopenharmony_ci#define CHAFSR_IERR		(1UL << 50UL) /* ch,ch+,jp */
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/* System request parity error on incoming address */
948c2ecf20Sopenharmony_ci#define CHAFSR_ISAP		(1UL << 49UL) /* ch,ch+,jp */
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/* HW Corrected system bus MTAG ECC error */
978c2ecf20Sopenharmony_ci#define CHAFSR_EMC		(1UL << 48UL) /* ch,ch+ */
988c2ecf20Sopenharmony_ci/* Parity error on L2 cache tag SRAM */
998c2ecf20Sopenharmony_ci#define JPAFSR_ETP		(1UL << 48UL) /* jp */
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/* Uncorrectable system bus MTAG ECC error */
1028c2ecf20Sopenharmony_ci#define CHAFSR_EMU		(1UL << 47UL) /* ch,ch+ */
1038c2ecf20Sopenharmony_ci/* Out of range memory error has occurred */
1048c2ecf20Sopenharmony_ci#define JPAFSR_OM		(1UL << 47UL) /* jp */
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* HW Corrected system bus data ECC error for read of interrupt vector */
1078c2ecf20Sopenharmony_ci#define CHAFSR_IVC		(1UL << 46UL) /* ch,ch+ */
1088c2ecf20Sopenharmony_ci/* Error due to unsupported store */
1098c2ecf20Sopenharmony_ci#define JPAFSR_UMS		(1UL << 46UL) /* jp */
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/* Uncorrectable system bus data ECC error for read of interrupt vector */
1128c2ecf20Sopenharmony_ci#define CHAFSR_IVU		(1UL << 45UL) /* ch,ch+,jp */
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/* Unmapped error from system bus */
1158c2ecf20Sopenharmony_ci#define CHAFSR_TO		(1UL << 44UL) /* ch,ch+,jp */
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* Bus error response from system bus */
1188c2ecf20Sopenharmony_ci#define CHAFSR_BERR		(1UL << 43UL) /* ch,ch+,jp */
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* SW Correctable E-cache ECC error for instruction fetch or data access
1218c2ecf20Sopenharmony_ci * other than block load.
1228c2ecf20Sopenharmony_ci */
1238c2ecf20Sopenharmony_ci#define CHAFSR_UCC		(1UL << 42UL) /* ch,ch+,jp */
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* Uncorrectable E-cache ECC error for instruction fetch or data access
1268c2ecf20Sopenharmony_ci * other than block load.
1278c2ecf20Sopenharmony_ci */
1288c2ecf20Sopenharmony_ci#define CHAFSR_UCU		(1UL << 41UL) /* ch,ch+,jp */
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci/* Copyout HW Corrected ECC error */
1318c2ecf20Sopenharmony_ci#define CHAFSR_CPC		(1UL << 40UL) /* ch,ch+,jp */
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/* Copyout Uncorrectable ECC error */
1348c2ecf20Sopenharmony_ci#define CHAFSR_CPU		(1UL << 39UL) /* ch,ch+,jp */
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/* HW Corrected ECC error from E-cache for writeback */
1378c2ecf20Sopenharmony_ci#define CHAFSR_WDC		(1UL << 38UL) /* ch,ch+,jp */
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/* Uncorrectable ECC error from E-cache for writeback */
1408c2ecf20Sopenharmony_ci#define CHAFSR_WDU		(1UL << 37UL) /* ch,ch+,jp */
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/* HW Corrected ECC error from E-cache for store merge or block load */
1438c2ecf20Sopenharmony_ci#define CHAFSR_EDC		(1UL << 36UL) /* ch,ch+,jp */
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/* Uncorrectable ECC error from E-cache for store merge or block load */
1468c2ecf20Sopenharmony_ci#define CHAFSR_EDU		(1UL << 35UL) /* ch,ch+,jp */
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ci/* Uncorrectable system bus data ECC error for read of memory or I/O */
1498c2ecf20Sopenharmony_ci#define CHAFSR_UE		(1UL << 34UL) /* ch,ch+,jp */
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci/* HW Corrected system bus data ECC error for read of memory or I/O */
1528c2ecf20Sopenharmony_ci#define CHAFSR_CE		(1UL << 33UL) /* ch,ch+,jp */
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/* Uncorrectable ECC error from remote cache/memory */
1558c2ecf20Sopenharmony_ci#define JPAFSR_RUE		(1UL << 32UL) /* jp */
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* Correctable ECC error from remote cache/memory */
1588c2ecf20Sopenharmony_ci#define JPAFSR_RCE		(1UL << 31UL) /* jp */
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* JBUS parity error on returned read data */
1618c2ecf20Sopenharmony_ci#define JPAFSR_BP		(1UL << 30UL) /* jp */
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/* JBUS parity error on data for writeback or block store */
1648c2ecf20Sopenharmony_ci#define JPAFSR_WBP		(1UL << 29UL) /* jp */
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/* Foreign read to DRAM incurring correctable ECC error */
1678c2ecf20Sopenharmony_ci#define JPAFSR_FRC		(1UL << 28UL) /* jp */
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci/* Foreign read to DRAM incurring uncorrectable ECC error */
1708c2ecf20Sopenharmony_ci#define JPAFSR_FRU		(1UL << 27UL) /* jp */
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define CHAFSR_ERRORS		(CHAFSR_PERR | CHAFSR_IERR | CHAFSR_ISAP | CHAFSR_EMC | \
1738c2ecf20Sopenharmony_ci				 CHAFSR_EMU | CHAFSR_IVC | CHAFSR_IVU | CHAFSR_TO | \
1748c2ecf20Sopenharmony_ci				 CHAFSR_BERR | CHAFSR_UCC | CHAFSR_UCU | CHAFSR_CPC | \
1758c2ecf20Sopenharmony_ci				 CHAFSR_CPU | CHAFSR_WDC | CHAFSR_WDU | CHAFSR_EDC | \
1768c2ecf20Sopenharmony_ci				 CHAFSR_EDU | CHAFSR_UE | CHAFSR_CE)
1778c2ecf20Sopenharmony_ci#define CHPAFSR_ERRORS		(CHPAFSR_DTO | CHPAFSR_DBERR | CHPAFSR_THCE | \
1788c2ecf20Sopenharmony_ci				 CHPAFSR_TSCE | CHPAFSR_TUE | CHPAFSR_DUE | \
1798c2ecf20Sopenharmony_ci				 CHAFSR_PERR | CHAFSR_IERR | CHAFSR_ISAP | CHAFSR_EMC | \
1808c2ecf20Sopenharmony_ci				 CHAFSR_EMU | CHAFSR_IVC | CHAFSR_IVU | CHAFSR_TO | \
1818c2ecf20Sopenharmony_ci				 CHAFSR_BERR | CHAFSR_UCC | CHAFSR_UCU | CHAFSR_CPC | \
1828c2ecf20Sopenharmony_ci				 CHAFSR_CPU | CHAFSR_WDC | CHAFSR_WDU | CHAFSR_EDC | \
1838c2ecf20Sopenharmony_ci				 CHAFSR_EDU | CHAFSR_UE | CHAFSR_CE)
1848c2ecf20Sopenharmony_ci#define JPAFSR_ERRORS		(JPAFSR_JETO | JPAFSR_SCE | JPAFSR_JEIC | \
1858c2ecf20Sopenharmony_ci				 JPAFSR_JEIT | CHAFSR_PERR | CHAFSR_IERR | \
1868c2ecf20Sopenharmony_ci				 CHAFSR_ISAP | JPAFSR_ETP | JPAFSR_OM | \
1878c2ecf20Sopenharmony_ci				 JPAFSR_UMS | CHAFSR_IVU | CHAFSR_TO | \
1888c2ecf20Sopenharmony_ci				 CHAFSR_BERR | CHAFSR_UCC | CHAFSR_UCU | \
1898c2ecf20Sopenharmony_ci				 CHAFSR_CPC | CHAFSR_CPU | CHAFSR_WDC | \
1908c2ecf20Sopenharmony_ci				 CHAFSR_WDU | CHAFSR_EDC | CHAFSR_EDU | \
1918c2ecf20Sopenharmony_ci				 CHAFSR_UE | CHAFSR_CE | JPAFSR_RUE | \
1928c2ecf20Sopenharmony_ci				 JPAFSR_RCE | JPAFSR_BP | JPAFSR_WBP | \
1938c2ecf20Sopenharmony_ci				 JPAFSR_FRC | JPAFSR_FRU)
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ci/* Active JBUS request signal when error occurred */
1968c2ecf20Sopenharmony_ci#define JPAFSR_JBREQ		(0x7UL << 24UL) /* jp */
1978c2ecf20Sopenharmony_ci#define JPAFSR_JBREQ_SHIFT	24UL
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci/* L2 cache way information */
2008c2ecf20Sopenharmony_ci#define JPAFSR_ETW		(0x3UL << 22UL) /* jp */
2018c2ecf20Sopenharmony_ci#define JPAFSR_ETW_SHIFT	22UL
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/* System bus MTAG ECC syndrome.  This field captures the status of the
2048c2ecf20Sopenharmony_ci * first occurrence of the highest-priority error according to the M_SYND
2058c2ecf20Sopenharmony_ci * overwrite policy.  After the AFSR sticky bit, corresponding to the error
2068c2ecf20Sopenharmony_ci * for which the M_SYND is reported, is cleared, the contents of the M_SYND
2078c2ecf20Sopenharmony_ci * field will be unchanged by will be unfrozen for further error capture.
2088c2ecf20Sopenharmony_ci */
2098c2ecf20Sopenharmony_ci#define CHAFSR_M_SYNDROME	(0xfUL << 16UL) /* ch,ch+,jp */
2108c2ecf20Sopenharmony_ci#define CHAFSR_M_SYNDROME_SHIFT	16UL
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/* Agenid Id of the foreign device causing the UE/CE errors */
2138c2ecf20Sopenharmony_ci#define JPAFSR_AID		(0x1fUL << 9UL) /* jp */
2148c2ecf20Sopenharmony_ci#define JPAFSR_AID_SHIFT	9UL
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci/* System bus or E-cache data ECC syndrome.  This field captures the status
2178c2ecf20Sopenharmony_ci * of the first occurrence of the highest-priority error according to the
2188c2ecf20Sopenharmony_ci * E_SYND overwrite policy.  After the AFSR sticky bit, corresponding to the
2198c2ecf20Sopenharmony_ci * error for which the E_SYND is reported, is cleare, the contents of the E_SYND
2208c2ecf20Sopenharmony_ci * field will be unchanged but will be unfrozen for further error capture.
2218c2ecf20Sopenharmony_ci */
2228c2ecf20Sopenharmony_ci#define CHAFSR_E_SYNDROME	(0x1ffUL << 0UL) /* ch,ch+,jp */
2238c2ecf20Sopenharmony_ci#define CHAFSR_E_SYNDROME_SHIFT	0UL
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci/* The AFSR must be explicitly cleared by software, it is not cleared automatically
2268c2ecf20Sopenharmony_ci * by a read.  Writes to bits <51:33> with bits set will clear the corresponding
2278c2ecf20Sopenharmony_ci * bits in the AFSR.  Bits associated with disrupting traps must be cleared before
2288c2ecf20Sopenharmony_ci * interrupts are re-enabled to prevent multiple traps for the same error.  I.e.
2298c2ecf20Sopenharmony_ci * PSTATE.IE and AFSR bits control delivery of disrupting traps.
2308c2ecf20Sopenharmony_ci *
2318c2ecf20Sopenharmony_ci * Since there is only one AFAR, when multiple events have been logged by the
2328c2ecf20Sopenharmony_ci * bits in the AFSR, at most one of these events will have its status captured
2338c2ecf20Sopenharmony_ci * in the AFAR.  The highest priority of those event bits will get AFAR logging.
2348c2ecf20Sopenharmony_ci * The AFAR will be unlocked and available to capture the address of another event
2358c2ecf20Sopenharmony_ci * as soon as the one bit in AFSR that corresponds to the event logged in AFAR is
2368c2ecf20Sopenharmony_ci * cleared.  For example, if AFSR.CE is detected, then AFSR.UE (which overwrites
2378c2ecf20Sopenharmony_ci * the AFAR), and AFSR.UE is cleared by not AFSR.CE, then the AFAR will be unlocked
2388c2ecf20Sopenharmony_ci * and ready for another event, even though AFSR.CE is still set.  The same rules
2398c2ecf20Sopenharmony_ci * also apply to the M_SYNDROME and E_SYNDROME fields of the AFSR.
2408c2ecf20Sopenharmony_ci */
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci#endif /* _SPARC64_CHAFSR_H */
243