xref: /rk3399_ARM-atf/plat/renesas/rcar_gen4/include/rcar_private.h (revision 322107b1148c058a692fc2a759569dd3b49f3962)
1 /*
2  * Copyright (c) 2015-2025, Renesas Electronics Corporation. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef RCAR_PRIVATE_H
8 #define RCAR_PRIVATE_H
9 
10 #include <common/bl_common.h>
11 #include <lib/bakery_lock.h>
12 #include <lib/el3_runtime/cpu_data.h>
13 #include <lib/mmio.h>
14 
15 #include <platform_def.h>
16 
17 /*
18  * This structure represents the superset of information that is passed to
19  * BL31 e.g. while passing control to it from BL2 which is bl31_params
20  * and bl31_plat_params and its elements
21  */
22 typedef struct bl2_to_bl31_params_mem {
23 	image_info_t bl32_image_info;
24 	image_info_t bl33_image_info;
25 	entry_point_info_t bl33_ep_info;
26 	entry_point_info_t bl32_ep_info;
27 } bl2_to_bl31_params_mem_t;
28 
29 #define RCAR_INSTANTIATE_LOCK	DEFINE_BAKERY_LOCK(rcar_lock)
30 /*
31  * Constants to specify how many bakery locks this platform implements. These
32  * are used if the platform chooses not to use coherent memory for bakery lock
33  * data structures.
34  */
35 #define RCAR_MAX_BAKERIES	2
36 
37 /*
38  * Definition of structure which holds platform specific per-cpu data. Currently
39  * it holds only the bakery lock information for each cpu. Constants to
40  * specify how many bakeries this platform implements and bakery ids are
41  * specified in rcar_def.h
42  */
43 typedef struct rcar_cpu_data {
44 	bakery_info_t pcpu_bakery_info[RCAR_MAX_BAKERIES];
45 } rcar_cpu_data_t;
46 
47 /*
48  * Helper macros for bakery lock api when using the above rcar_cpu_data_t for
49  * bakery lock data structures. It assumes that the bakery_info is at the
50  * beginning of the platform specific per-cpu data.
51  */
52 #define rcar_lock_init()	bakery_lock_init(&rcar_lock)
53 #define rcar_lock_get()		bakery_lock_get(&rcar_lock)
54 #define rcar_lock_release()	bakery_lock_release(&rcar_lock)
55 
56 /*
57  * Function and variable prototypes
58  */
59 void rcar_configure_mmu_el3(uintptr_t total_base,
60 			    size_t total_size,
61 			    uintptr_t ro_start,
62 			    uintptr_t ro_limit
63 			    );
64 
65 
66 void plat_invalidate_icache(void);
67 
68 void rcar_console_boot_init(void);
69 void rcar_console_runtime_init(void);
70 
71 int32_t rcar_cluster_pos_by_mpidr(u_register_t mpidr);
72 
73 #endif /* RCAR_PRIVATE_H */
74