1 /*
2  * Copyright (c) 2023-2024, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef ERRATA_CPUSPEC_H
8 #define ERRATA_CPUSPEC_H
9 
10 #include <stdint.h>
11 #include <arch_helpers.h>
12 
13 #if __aarch64__
14 #include <cortex_a710.h>
15 #include <cortex_a78.h>
16 #include <cortex_a78_ae.h>
17 #include <cortex_a78c.h>
18 #include <cortex_x2.h>
19 #include <cortex_x3.h>
20 #include <cortex_x4.h>
21 #include <neoverse_n2.h>
22 #include <neoverse_v1.h>
23 #include <neoverse_v2.h>
24 #endif
25 
26 /* Max number of platform based errata with no workaround in EL3 */
27 #define MAX_PLAT_CPU_ERRATA_ENTRIES	2
28 
29 #define ERRATA_LIST_END		(MAX_PLAT_CPU_ERRATA_ENTRIES - 1)
30 
31 /* Default values for unused memory in the array */
32 #define UNDEF_ERRATA		{UINT_MAX, UCHAR_MAX, UCHAR_MAX}
33 
34 #define EXTRACT_PARTNUM(x)	((x >> MIDR_PN_SHIFT) & MIDR_PN_MASK)
35 
36 #define RXPX_RANGE(x, y, z)	(((x >= y) && (x <= z)) ? true : false)
37 
38 /*
39  * CPU specific values for errata handling
40  */
41 struct em_cpu{
42 	unsigned int em_errata_id;
43 	unsigned char em_rxpx_lo;	/* lowest revision of errata applicable for the cpu */
44 	unsigned char em_rxpx_hi;	/* highest revision of errata applicable for the cpu */
45 };
46 
47 struct em_cpu_list{
48 	unsigned long cpu_partnumber;	/* cpu specific part number defined in midr reg */
49 	struct   em_cpu cpu_errata_list[MAX_PLAT_CPU_ERRATA_ENTRIES];
50 };
51 
52 int32_t verify_errata_implemented(uint32_t errata_id, uint32_t forward_flag);
53 #endif /* ERRATA_CPUSPEC_H */
54