xref: /rk3399_ARM-atf/include/lib/cpus/errata.h (revision 3f4c1e1e7b976e6950cbcc4ddf8c32e989d837ac)
16bb96fa6SBoyan Karatotev /*
2*3f4c1e1eSBoyan Karatotev  * Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
36bb96fa6SBoyan Karatotev  *
46bb96fa6SBoyan Karatotev  * SPDX-License-Identifier: BSD-3-Clause
56bb96fa6SBoyan Karatotev  */
66bb96fa6SBoyan Karatotev 
76bb96fa6SBoyan Karatotev #ifndef ERRATA_REPORT_H
86bb96fa6SBoyan Karatotev #define ERRATA_REPORT_H
96bb96fa6SBoyan Karatotev 
10*3f4c1e1eSBoyan Karatotev #include <lib/cpus/cpu_ops.h>
11*3f4c1e1eSBoyan Karatotev 
12*3f4c1e1eSBoyan Karatotev 
13*3f4c1e1eSBoyan Karatotev #define ERRATUM_WA_FUNC_SIZE	CPU_WORD_SIZE
14*3f4c1e1eSBoyan Karatotev #define ERRATUM_CHECK_FUNC_SIZE	CPU_WORD_SIZE
15*3f4c1e1eSBoyan Karatotev #define ERRATUM_ID_SIZE		4
16*3f4c1e1eSBoyan Karatotev #define ERRATUM_CVE_SIZE	2
17*3f4c1e1eSBoyan Karatotev #define ERRATUM_CHOSEN_SIZE	1
18*3f4c1e1eSBoyan Karatotev #define ERRATUM_MITIGATED_SIZE	1
19*3f4c1e1eSBoyan Karatotev 
20*3f4c1e1eSBoyan Karatotev #define ERRATUM_WA_FUNC		0
21*3f4c1e1eSBoyan Karatotev #define ERRATUM_CHECK_FUNC	ERRATUM_WA_FUNC + ERRATUM_WA_FUNC_SIZE
22*3f4c1e1eSBoyan Karatotev #define ERRATUM_ID		ERRATUM_CHECK_FUNC + ERRATUM_CHECK_FUNC_SIZE
23*3f4c1e1eSBoyan Karatotev #define ERRATUM_CVE		ERRATUM_ID + ERRATUM_ID_SIZE
24*3f4c1e1eSBoyan Karatotev #define ERRATUM_CHOSEN		ERRATUM_CVE + ERRATUM_CVE_SIZE
25*3f4c1e1eSBoyan Karatotev #define ERRATUM_MITIGATED	ERRATUM_CHOSEN + ERRATUM_CHOSEN_SIZE
26*3f4c1e1eSBoyan Karatotev #define ERRATUM_ENTRY_SIZE	ERRATUM_MITIGATED + ERRATUM_MITIGATED_SIZE
27*3f4c1e1eSBoyan Karatotev 
286bb96fa6SBoyan Karatotev #ifndef __ASSEMBLER__
296bb96fa6SBoyan Karatotev 
306bb96fa6SBoyan Karatotev void print_errata_status(void);
316bb96fa6SBoyan Karatotev void errata_print_msg(unsigned int status, const char *cpu, const char *id);
326bb96fa6SBoyan Karatotev 
33*3f4c1e1eSBoyan Karatotev #else
34*3f4c1e1eSBoyan Karatotev 
35*3f4c1e1eSBoyan Karatotev /*
36*3f4c1e1eSBoyan Karatotev  * errata framework macro helpers
37*3f4c1e1eSBoyan Karatotev  *
38*3f4c1e1eSBoyan Karatotev  * NOTE an erratum and CVE id could clash. However, both numbers are very large
39*3f4c1e1eSBoyan Karatotev  * and the probablity is minuscule. Working around this makes code very
40*3f4c1e1eSBoyan Karatotev  * complicated and extremely difficult to read so it is not considered. In the
41*3f4c1e1eSBoyan Karatotev  * unlikely event that this does happen, prepending the CVE id with a 0 should
42*3f4c1e1eSBoyan Karatotev  * resolve the conflict
43*3f4c1e1eSBoyan Karatotev  */
44*3f4c1e1eSBoyan Karatotev #define ERRATUM(id)		0, id
45*3f4c1e1eSBoyan Karatotev #define CVE(year, id)		year, id
46*3f4c1e1eSBoyan Karatotev #define NO_ISB			1
47*3f4c1e1eSBoyan Karatotev #define NO_ASSERT		0
48*3f4c1e1eSBoyan Karatotev 
496bb96fa6SBoyan Karatotev #endif /* __ASSEMBLER__ */
506bb96fa6SBoyan Karatotev 
516bb96fa6SBoyan Karatotev /* Errata status */
526bb96fa6SBoyan Karatotev #define ERRATA_NOT_APPLIES	0
536bb96fa6SBoyan Karatotev #define ERRATA_APPLIES		1
546bb96fa6SBoyan Karatotev #define ERRATA_MISSING		2
556bb96fa6SBoyan Karatotev 
566bb96fa6SBoyan Karatotev /* Macro to get CPU revision code for checking errata version compatibility. */
576bb96fa6SBoyan Karatotev #define CPU_REV(r, p)		((r << 4) | p)
586bb96fa6SBoyan Karatotev 
596bb96fa6SBoyan Karatotev #endif /* ERRATA_REPORT_H */
60