xref: /rk3399_ARM-atf/include/plat/arm/common/plat_arm.h (revision 1cf3e2f0a8eb0d6324ce3db68dd5c78bdb690a8a)
1b4315306SDan Handley /*
2*1cf3e2f0SManish V Badarkhe  * Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
3b4315306SDan Handley  *
482cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
5b4315306SDan Handley  */
615b94cc1SAntonio Nino Diaz #ifndef PLAT_ARM_H
715b94cc1SAntonio Nino Diaz #define PLAT_ARM_H
8b4315306SDan Handley 
9d6dcbcadSLouis Mayencourt #include <stdbool.h>
10b4315306SDan Handley #include <stdint.h>
1109d40e0eSAntonio Nino Diaz 
1209d40e0eSAntonio Nino Diaz #include <drivers/arm/tzc_common.h>
1309d40e0eSAntonio Nino Diaz #include <lib/bakery_lock.h>
1409d40e0eSAntonio Nino Diaz #include <lib/cassert.h>
1509d40e0eSAntonio Nino Diaz #include <lib/el3_runtime/cpu_data.h>
1609d40e0eSAntonio Nino Diaz #include <lib/spinlock.h>
1709d40e0eSAntonio Nino Diaz #include <lib/utils_def.h>
1809d40e0eSAntonio Nino Diaz #include <lib/xlat_tables/xlat_tables_compat.h>
19b4315306SDan Handley 
20afc931f5SSandrine Bailleux /*******************************************************************************
21afc931f5SSandrine Bailleux  * Forward declarations
22afc931f5SSandrine Bailleux  ******************************************************************************/
23afc931f5SSandrine Bailleux struct meminfo;
24a8aa7fecSYatharth Kochar struct image_info;
25cab0b5b0SSoby Mathew struct bl_params;
26afc931f5SSandrine Bailleux 
2723411d2cSSummer Qin typedef struct arm_tzc_regions_info {
2823411d2cSSummer Qin 	unsigned long long base;
2923411d2cSSummer Qin 	unsigned long long end;
30af6491f8SAntonio Nino Diaz 	unsigned int sec_attr;
3123411d2cSSummer Qin 	unsigned int nsaid_permissions;
3223411d2cSSummer Qin } arm_tzc_regions_info_t;
3323411d2cSSummer Qin 
3423411d2cSSummer Qin /*******************************************************************************
3523411d2cSSummer Qin  * Default mapping definition of the TrustZone Controller for ARM standard
3623411d2cSSummer Qin  * platforms.
3723411d2cSSummer Qin  * Configure:
3823411d2cSSummer Qin  *   - Region 0 with no access;
3923411d2cSSummer Qin  *   - Region 1 with secure access only;
4023411d2cSSummer Qin  *   - the remaining DRAM regions access from the given Non-Secure masters.
4123411d2cSSummer Qin  ******************************************************************************/
423f3c341aSPaul Beesley #if SPM_MM
4323411d2cSSummer Qin #define ARM_TZC_REGIONS_DEF						\
44c8720729SZelalem Aweke 	{ARM_AP_TZC_DRAM1_BASE, ARM_EL3_TZC_DRAM1_END + ARM_L1_GPT_SIZE,\
4523411d2cSSummer Qin 		TZC_REGION_S_RDWR, 0},					\
4623411d2cSSummer Qin 	{ARM_NS_DRAM1_BASE, ARM_NS_DRAM1_END, ARM_TZC_NS_DRAM_S_ACCESS, \
4723411d2cSSummer Qin 		PLAT_ARM_TZC_NS_DEV_ACCESS}, 				\
4823411d2cSSummer Qin 	{ARM_DRAM2_BASE, ARM_DRAM2_END, ARM_TZC_NS_DRAM_S_ACCESS,	\
4923411d2cSSummer Qin 		PLAT_ARM_TZC_NS_DEV_ACCESS},				\
500560efb9SArd Biesheuvel 	{PLAT_SP_IMAGE_NS_BUF_BASE, (PLAT_SP_IMAGE_NS_BUF_BASE +	\
510560efb9SArd Biesheuvel 		PLAT_SP_IMAGE_NS_BUF_SIZE) - 1, TZC_REGION_S_NONE,	\
5223411d2cSSummer Qin 		PLAT_ARM_TZC_NS_DEV_ACCESS}
5323411d2cSSummer Qin 
54c8720729SZelalem Aweke #elif ENABLE_RME
55c8720729SZelalem Aweke #define ARM_TZC_REGIONS_DEF						    \
56c8720729SZelalem Aweke 	{ARM_AP_TZC_DRAM1_BASE, ARM_AP_TZC_DRAM1_END, TZC_REGION_S_RDWR, 0},\
57c8720729SZelalem Aweke 	{ARM_EL3_TZC_DRAM1_BASE, ARM_L1_GPT_END, TZC_REGION_S_RDWR, 0},	    \
58c8720729SZelalem Aweke 	{ARM_NS_DRAM1_BASE, ARM_NS_DRAM1_END, ARM_TZC_NS_DRAM_S_ACCESS,	    \
59c8720729SZelalem Aweke 		PLAT_ARM_TZC_NS_DEV_ACCESS},				    \
608c980a4aSJavier Almansa Sobrino 	/* Realm and Shared area share the same PAS */		    \
618c980a4aSJavier Almansa Sobrino 	{ARM_REALM_BASE, ARM_EL3_RMM_SHARED_END, ARM_TZC_NS_DRAM_S_ACCESS,  \
62c8720729SZelalem Aweke 		PLAT_ARM_TZC_NS_DEV_ACCESS},				    \
63c8720729SZelalem Aweke 	{ARM_DRAM2_BASE, ARM_DRAM2_END, ARM_TZC_NS_DRAM_S_ACCESS,	    \
64c8720729SZelalem Aweke 		PLAT_ARM_TZC_NS_DEV_ACCESS}
65c8720729SZelalem Aweke 
6623411d2cSSummer Qin #else
6723411d2cSSummer Qin #define ARM_TZC_REGIONS_DEF						\
68c8720729SZelalem Aweke 	{ARM_AP_TZC_DRAM1_BASE, ARM_EL3_TZC_DRAM1_END + ARM_L1_GPT_SIZE,\
6923411d2cSSummer Qin 		TZC_REGION_S_RDWR, 0},					\
7023411d2cSSummer Qin 	{ARM_NS_DRAM1_BASE, ARM_NS_DRAM1_END, ARM_TZC_NS_DRAM_S_ACCESS, \
7123411d2cSSummer Qin 		PLAT_ARM_TZC_NS_DEV_ACCESS},	 			\
7223411d2cSSummer Qin 	{ARM_DRAM2_BASE, ARM_DRAM2_END, ARM_TZC_NS_DRAM_S_ACCESS,	\
7323411d2cSSummer Qin 		PLAT_ARM_TZC_NS_DEV_ACCESS}
7423411d2cSSummer Qin #endif
7523411d2cSSummer Qin 
76b4315306SDan Handley #define ARM_CASSERT_MMAP						  \
77053b4f92SChris Kay 	CASSERT((ARRAY_SIZE(plat_arm_mmap) - 1) <= PLAT_ARM_MMAP_ENTRIES, \
78053b4f92SChris Kay 		assert_plat_arm_mmap_mismatch);				  \
79053b4f92SChris Kay 	CASSERT((PLAT_ARM_MMAP_ENTRIES + ARM_BL_REGIONS)		  \
80b4315306SDan Handley 		<= MAX_MMAP_REGIONS,					  \
81b4315306SDan Handley 		assert_max_mmap_regions);
82b4315306SDan Handley 
831eb735d7SRoberto Vargas void arm_setup_romlib(void);
841eb735d7SRoberto Vargas 
85402b3cf8SJulius Werner #if defined(IMAGE_BL31) || (!defined(__aarch64__) && defined(IMAGE_BL32))
86b4315306SDan Handley /*
87b4315306SDan Handley  * Use this macro to instantiate lock before it is used in below
88b4315306SDan Handley  * arm_lock_xxx() macros
89b4315306SDan Handley  */
901931d1d7SSandrine Bailleux #define ARM_INSTANTIATE_LOCK	static DEFINE_BAKERY_LOCK(arm_lock)
91c04a3b6cSSoby Mathew #define ARM_LOCK_GET_INSTANCE	(&arm_lock)
9232aee841SRoberto Vargas 
9332aee841SRoberto Vargas #if !HW_ASSISTED_COHERENCY
9432aee841SRoberto Vargas #define ARM_SCMI_INSTANTIATE_LOCK	DEFINE_BAKERY_LOCK(arm_scmi_lock)
9532aee841SRoberto Vargas #else
9632aee841SRoberto Vargas #define ARM_SCMI_INSTANTIATE_LOCK	spinlock_t arm_scmi_lock
9732aee841SRoberto Vargas #endif
9832aee841SRoberto Vargas #define ARM_SCMI_LOCK_GET_INSTANCE	(&arm_scmi_lock)
9932aee841SRoberto Vargas 
100b4315306SDan Handley /*
101b4315306SDan Handley  * These are wrapper macros to the Coherent Memory Bakery Lock API.
102b4315306SDan Handley  */
103b4315306SDan Handley #define arm_lock_init()		bakery_lock_init(&arm_lock)
104b4315306SDan Handley #define arm_lock_get()		bakery_lock_get(&arm_lock)
105b4315306SDan Handley #define arm_lock_release()	bakery_lock_release(&arm_lock)
106b4315306SDan Handley 
107b4315306SDan Handley #else
108b4315306SDan Handley 
109b4315306SDan Handley /*
1106f249345SYatharth Kochar  * Empty macros for all other BL stages other than BL31 and BL32
111b4315306SDan Handley  */
11219583169SJeenu Viswambharan #define ARM_INSTANTIATE_LOCK	static int arm_lock __unused
113c04a3b6cSSoby Mathew #define ARM_LOCK_GET_INSTANCE	0
114b4315306SDan Handley #define arm_lock_init()
115b4315306SDan Handley #define arm_lock_get()
116b4315306SDan Handley #define arm_lock_release()
117b4315306SDan Handley 
118402b3cf8SJulius Werner #endif /* defined(IMAGE_BL31) || (!defined(__aarch64__) && defined(IMAGE_BL32)) */
119b4315306SDan Handley 
1202204afdeSSoby Mathew #if ARM_RECOM_STATE_ID_ENC
1212204afdeSSoby Mathew /*
1222204afdeSSoby Mathew  * Macros used to parse state information from State-ID if it is using the
1232204afdeSSoby Mathew  * recommended encoding for State-ID.
1242204afdeSSoby Mathew  */
1252204afdeSSoby Mathew #define ARM_LOCAL_PSTATE_WIDTH		4
1262204afdeSSoby Mathew #define ARM_LOCAL_PSTATE_MASK		((1 << ARM_LOCAL_PSTATE_WIDTH) - 1)
1272204afdeSSoby Mathew 
128e75cc247SWing Li #if PSCI_OS_INIT_MODE
129e75cc247SWing Li #define ARM_LAST_AT_PLVL_MASK		(ARM_LOCAL_PSTATE_MASK <<	\
130e75cc247SWing Li 					 (ARM_LOCAL_PSTATE_WIDTH *	\
131e75cc247SWing Li 					  (PLAT_MAX_PWR_LVL + 1)))
132e75cc247SWing Li #endif /* __PSCI_OS_INIT_MODE__ */
133e75cc247SWing Li 
1342204afdeSSoby Mathew /* Macros to construct the composite power state */
1352204afdeSSoby Mathew 
1362204afdeSSoby Mathew /* Make composite power state parameter till power level 0 */
1372204afdeSSoby Mathew #if PSCI_EXTENDED_STATE_ID
1382204afdeSSoby Mathew 
1392204afdeSSoby Mathew #define arm_make_pwrstate_lvl0(lvl0_state, pwr_lvl, type) \
1402204afdeSSoby Mathew 		(((lvl0_state) << PSTATE_ID_SHIFT) | ((type) << PSTATE_TYPE_SHIFT))
1412204afdeSSoby Mathew #else
1422204afdeSSoby Mathew #define arm_make_pwrstate_lvl0(lvl0_state, pwr_lvl, type) \
1432204afdeSSoby Mathew 		(((lvl0_state) << PSTATE_ID_SHIFT) | \
1442204afdeSSoby Mathew 		((pwr_lvl) << PSTATE_PWR_LVL_SHIFT) | \
1452204afdeSSoby Mathew 		((type) << PSTATE_TYPE_SHIFT))
1462204afdeSSoby Mathew #endif /* __PSCI_EXTENDED_STATE_ID__ */
1472204afdeSSoby Mathew 
1482204afdeSSoby Mathew /* Make composite power state parameter till power level 1 */
1492204afdeSSoby Mathew #define arm_make_pwrstate_lvl1(lvl1_state, lvl0_state, pwr_lvl, type) \
1502204afdeSSoby Mathew 		(((lvl1_state) << ARM_LOCAL_PSTATE_WIDTH) | \
1512204afdeSSoby Mathew 		arm_make_pwrstate_lvl0(lvl0_state, pwr_lvl, type))
1522204afdeSSoby Mathew 
1535f3a6030SSoby Mathew /* Make composite power state parameter till power level 2 */
1545f3a6030SSoby Mathew #define arm_make_pwrstate_lvl2(lvl2_state, lvl1_state, lvl0_state, pwr_lvl, type) \
1555f3a6030SSoby Mathew 		(((lvl2_state) << (ARM_LOCAL_PSTATE_WIDTH * 2)) | \
1565f3a6030SSoby Mathew 		arm_make_pwrstate_lvl1(lvl1_state, lvl0_state, pwr_lvl, type))
1575f3a6030SSoby Mathew 
1582204afdeSSoby Mathew #endif /* __ARM_RECOM_STATE_ID_ENC__ */
1592204afdeSSoby Mathew 
160b10d4499SJeenu Viswambharan /* ARM State switch error codes */
161b10d4499SJeenu Viswambharan #define STATE_SW_E_PARAM		(-2)
162b10d4499SJeenu Viswambharan #define STATE_SW_E_DENIED		(-3)
163b4315306SDan Handley 
164a6ffddecSMax Shvetsov /* plat_get_rotpk_info() flags */
165a6ffddecSMax Shvetsov #define ARM_ROTPK_REGS_ID		1
166a6ffddecSMax Shvetsov #define ARM_ROTPK_DEVEL_RSA_ID		2
167a6ffddecSMax Shvetsov #define ARM_ROTPK_DEVEL_ECDSA_ID	3
1685f899286Slaurenw-arm #define ARM_ROTPK_DEVEL_FULL_DEV_RSA_KEY_ID	4
1690e753437SManish V Badarkhe 
170b4315306SDan Handley /* IO storage utility functions */
17197399821SLouis Mayencourt int arm_io_setup(void);
172b4315306SDan Handley 
173ef1daa42SManish V Badarkhe /* Set image specification in IO block policy */
1742f1177b2SManish V Badarkhe int arm_set_image_source(unsigned int image_id, const char *part_name,
1752f1177b2SManish V Badarkhe 			 uintptr_t *dev_handle, uintptr_t *image_spec);
1762f1177b2SManish V Badarkhe void arm_set_fip_addr(uint32_t active_fw_bank_idx);
177ef1daa42SManish V Badarkhe 
178b4315306SDan Handley /* Security utility functions */
1794ed16765SSuyash Pathak void arm_tzc400_setup(uintptr_t tzc_base,
1804ed16765SSuyash Pathak 			const arm_tzc_regions_info_t *tzc_regions);
181618f0feeSVikram Kanigiri struct tzc_dmc500_driver_data;
18223411d2cSSummer Qin void arm_tzc_dmc500_setup(struct tzc_dmc500_driver_data *plat_driver_data,
18323411d2cSSummer Qin 			const arm_tzc_regions_info_t *tzc_regions);
184b4315306SDan Handley 
18588a0523eSAntonio Nino Diaz /* Console utility functions */
18688a0523eSAntonio Nino Diaz void arm_console_boot_init(void);
18788a0523eSAntonio Nino Diaz void arm_console_boot_end(void);
18888a0523eSAntonio Nino Diaz void arm_console_runtime_init(void);
18988a0523eSAntonio Nino Diaz void arm_console_runtime_end(void);
19088a0523eSAntonio Nino Diaz 
191c1bb8a05SSoby Mathew /* Systimer utility function */
192c1bb8a05SSoby Mathew void arm_configure_sys_timer(void);
193c1bb8a05SSoby Mathew 
194b4315306SDan Handley /* PM utility functions */
19538dce70fSSoby Mathew int arm_validate_power_state(unsigned int power_state,
19638dce70fSSoby Mathew 			    psci_power_state_t *req_state);
19771e7a4e5SJeenu Viswambharan int arm_validate_psci_entrypoint(uintptr_t entrypoint);
198f9e858b1SSoby Mathew int arm_validate_ns_entrypoint(uintptr_t entrypoint);
199e35a3fb5SSoby Mathew void arm_system_pwr_domain_save(void);
200c1bb8a05SSoby Mathew void arm_system_pwr_domain_resume(void);
201dc6aad2eSRoberto Vargas int arm_psci_read_mem_protect(int *enabled);
202f145403cSRoberto Vargas int arm_nor_psci_write_mem_protect(int val);
203638b034cSRoberto Vargas void arm_nor_psci_do_static_mem_protect(void);
204638b034cSRoberto Vargas void arm_nor_psci_do_dyn_mem_protect(void);
205f145403cSRoberto Vargas int arm_psci_mem_protect_chk(uintptr_t base, u_register_t length);
20638dce70fSSoby Mathew 
20738dce70fSSoby Mathew /* Topology utility function */
20838dce70fSSoby Mathew int arm_check_mpidr(u_register_t mpidr);
209b4315306SDan Handley 
210b4315306SDan Handley /* BL1 utility functions */
211b4315306SDan Handley void arm_bl1_early_platform_setup(void);
212b4315306SDan Handley void arm_bl1_platform_setup(void);
213b4315306SDan Handley void arm_bl1_plat_arch_setup(void);
214b4315306SDan Handley 
215b4315306SDan Handley /* BL2 utility functions */
21682869675SManish V Badarkhe void arm_bl2_early_platform_setup(uintptr_t fw_config, struct meminfo *mem_layout);
217b4315306SDan Handley void arm_bl2_platform_setup(void);
218b4315306SDan Handley void arm_bl2_plat_arch_setup(void);
219b4315306SDan Handley uint32_t arm_get_spsr_for_bl32_entry(void);
220b4315306SDan Handley uint32_t arm_get_spsr_for_bl33_entry(void);
221609e053cSAmbroise Vincent int arm_bl2_plat_handle_post_image_load(unsigned int image_id);
22207570d59SYatharth Kochar int arm_bl2_handle_post_image_load(unsigned int image_id);
2235b8d50e4SSathees Balya struct bl_params *arm_get_next_bl_params(void);
224b4315306SDan Handley 
22581528dbcSRoberto Vargas /* BL2 at EL3 functions */
22681528dbcSRoberto Vargas void arm_bl2_el3_early_platform_setup(void);
22781528dbcSRoberto Vargas void arm_bl2_el3_plat_arch_setup(void);
22881528dbcSRoberto Vargas 
229dcda29f6SYatharth Kochar /* BL2U utility functions */
230dcda29f6SYatharth Kochar void arm_bl2u_early_platform_setup(struct meminfo *mem_layout,
231dcda29f6SYatharth Kochar 				void *plat_info);
232dcda29f6SYatharth Kochar void arm_bl2u_platform_setup(void);
233dcda29f6SYatharth Kochar void arm_bl2u_plat_arch_setup(void);
234dcda29f6SYatharth Kochar 
235d178637dSJuan Castillo /* BL31 utility functions */
2360c306cc0SSoby Mathew void arm_bl31_early_platform_setup(void *from_bl2, uintptr_t soc_fw_config,
2370c306cc0SSoby Mathew 				uintptr_t hw_config, void *plat_params_from_bl2);
238b4315306SDan Handley void arm_bl31_platform_setup(void);
239080225daSSoby Mathew void arm_bl31_plat_runtime_setup(void);
240b4315306SDan Handley void arm_bl31_plat_arch_setup(void);
241b4315306SDan Handley 
242b4315306SDan Handley /* TSP utility functions */
243b4315306SDan Handley void arm_tsp_early_platform_setup(void);
244b4315306SDan Handley 
245181bbd41SSoby Mathew /* SP_MIN utility functions */
2460c306cc0SSoby Mathew void arm_sp_min_early_platform_setup(void *from_bl2, uintptr_t tos_fw_config,
2470c306cc0SSoby Mathew 				uintptr_t hw_config, void *plat_params_from_bl2);
24821568304SDimitris Papastamos void arm_sp_min_plat_runtime_setup(void);
24926d1e0c3SMadhukar Pappireddy void arm_sp_min_plat_arch_setup(void);
250181bbd41SSoby Mathew 
251436223deSYatharth Kochar /* FIP TOC validity check */
252d6dcbcadSLouis Mayencourt bool arm_io_is_toc_valid(void);
253b4315306SDan Handley 
254c228956aSSoby Mathew /* Utility functions for Dynamic Config */
255cab0b5b0SSoby Mathew void arm_bl2_dyn_cfg_init(void);
256ba597da7SJohn Tsichritzis void arm_bl1_set_mbedtls_heap(void);
257ba597da7SJohn Tsichritzis int arm_get_mbedtls_heap(void **heap_addr, size_t *heap_size);
258c228956aSSoby Mathew 
2590ab49645SAlexei Fedorov #if MEASURED_BOOT
260efa65218SManish V Badarkhe int arm_set_tos_fw_info(uintptr_t log_addr, size_t log_size);
261efa65218SManish V Badarkhe int arm_set_nt_fw_info(
2627b4e1fbbSAlexei Fedorov /*
2637b4e1fbbSAlexei Fedorov  * Currently OP-TEE does not support reading DTBs from Secure memory
2647b4e1fbbSAlexei Fedorov  * and this option should be removed when feature is supported.
2657b4e1fbbSAlexei Fedorov  */
2667b4e1fbbSAlexei Fedorov #ifdef SPD_opteed
2677b4e1fbbSAlexei Fedorov 			uintptr_t log_addr,
2680ab49645SAlexei Fedorov #endif
2697b4e1fbbSAlexei Fedorov 			size_t log_size, uintptr_t *ns_log_addr);
270*1cf3e2f0SManish V Badarkhe int arm_set_tb_fw_info(uintptr_t log_addr, size_t log_size,
271*1cf3e2f0SManish V Badarkhe 		       size_t log_max_size);
272*1cf3e2f0SManish V Badarkhe int arm_get_tb_fw_info(uint64_t *log_addr, size_t *log_size,
273*1cf3e2f0SManish V Badarkhe 		       size_t *log_max_size);
2747b4e1fbbSAlexei Fedorov #endif /* MEASURED_BOOT */
2750ab49645SAlexei Fedorov 
276b4315306SDan Handley /*
277cb4adb0dSDaniel Boulby  * Free the memory storing initialization code only used during an images boot
278cb4adb0dSDaniel Boulby  * time so it can be reclaimed for runtime data
279cb4adb0dSDaniel Boulby  */
280cb4adb0dSDaniel Boulby void arm_free_init_memory(void);
281cb4adb0dSDaniel Boulby 
282cb4adb0dSDaniel Boulby /*
28360e8f3cfSPetre-Ionut Tudor  * Make the higher level translation tables read-only
28460e8f3cfSPetre-Ionut Tudor  */
28560e8f3cfSPetre-Ionut Tudor void arm_xlat_make_tables_readonly(void);
28660e8f3cfSPetre-Ionut Tudor 
28760e8f3cfSPetre-Ionut Tudor /*
288b4315306SDan Handley  * Mandatory functions required in ARM standard platforms
289b4315306SDan Handley  */
2900108047aSSoby Mathew unsigned int plat_arm_get_cluster_core_count(u_register_t mpidr);
29127573c59SAchin Gupta void plat_arm_gic_driver_init(void);
292b4315306SDan Handley void plat_arm_gic_init(void);
29327573c59SAchin Gupta void plat_arm_gic_cpuif_enable(void);
29427573c59SAchin Gupta void plat_arm_gic_cpuif_disable(void);
295d17b953aSJeenu Viswambharan void plat_arm_gic_redistif_on(void);
296d17b953aSJeenu Viswambharan void plat_arm_gic_redistif_off(void);
29727573c59SAchin Gupta void plat_arm_gic_pcpu_init(void);
298e35a3fb5SSoby Mathew void plat_arm_gic_save(void);
299e35a3fb5SSoby Mathew void plat_arm_gic_resume(void);
300b4315306SDan Handley void plat_arm_security_setup(void);
301b4315306SDan Handley void plat_arm_pwrc_setup(void);
3026355f234SVikram Kanigiri void plat_arm_interconnect_init(void);
3036355f234SVikram Kanigiri void plat_arm_interconnect_enter_coherency(void);
3046355f234SVikram Kanigiri void plat_arm_interconnect_exit_coherency(void);
3052a246d2eSDimitris Papastamos void plat_arm_program_trusted_mailbox(uintptr_t address);
306d6dcbcadSLouis Mayencourt bool plat_arm_bl1_fwu_needed(void);
30737b70031SAmbroise Vincent __dead2 void plat_arm_error_handler(int err);
308586f60ccSManish V Badarkhe __dead2 void plat_arm_system_reset(void);
309b4315306SDan Handley 
31074c21244SVijayenthiran Subramaniam /*
311a6ffddecSMax Shvetsov  * Optional functions in ARM standard platforms
31274c21244SVijayenthiran Subramaniam  */
31374c21244SVijayenthiran Subramaniam void plat_arm_override_gicr_frames(const uintptr_t *plat_gicr_frames);
31488005701SSandrine Bailleux int arm_get_rotpk_info(void *cookie, void **key_ptr, unsigned int *key_len,
315a6ffddecSMax Shvetsov 	unsigned int *flags);
316a6ffddecSMax Shvetsov int arm_get_rotpk_info_regs(void **key_ptr, unsigned int *key_len,
317a6ffddecSMax Shvetsov 	unsigned int *flags);
318a6ffddecSMax Shvetsov int arm_get_rotpk_info_cc(void **key_ptr, unsigned int *key_len,
319a6ffddecSMax Shvetsov 	unsigned int *flags);
320a6ffddecSMax Shvetsov int arm_get_rotpk_info_dev(void **key_ptr, unsigned int *key_len,
321a6ffddecSMax Shvetsov 	unsigned int *flags);
32274c21244SVijayenthiran Subramaniam 
323d8d6cf24SSummer Qin #if ARM_PLAT_MT
324d8d6cf24SSummer Qin unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr);
325d8d6cf24SSummer Qin #endif
326d8d6cf24SSummer Qin 
327a8aa7fecSYatharth Kochar /*
328a8aa7fecSYatharth Kochar  * This function is called after loading SCP_BL2 image and it is used to perform
329a8aa7fecSYatharth Kochar  * any platform-specific actions required to handle the SCP firmware.
330a8aa7fecSYatharth Kochar  */
331a8aa7fecSYatharth Kochar int plat_arm_bl2_handle_scp_bl2(struct image_info *scp_bl2_image_info);
332a8aa7fecSYatharth Kochar 
333b4315306SDan Handley /*
334b4315306SDan Handley  * Optional functions required in ARM standard platforms
335b4315306SDan Handley  */
336b4315306SDan Handley void plat_arm_io_setup(void);
337b4315306SDan Handley int plat_arm_get_alt_image_source(
33816948ae1SJuan Castillo 	unsigned int image_id,
33916948ae1SJuan Castillo 	uintptr_t *dev_handle,
34016948ae1SJuan Castillo 	uintptr_t *image_spec);
34138dce70fSSoby Mathew unsigned int plat_arm_calc_core_pos(u_register_t mpidr);
34265cb1c4cSVikram Kanigiri const mmap_region_t *plat_arm_get_mmap(void);
343b4315306SDan Handley 
3445486a965SSoby Mathew /* Allow platform to override psci_pm_ops during runtime */
3455486a965SSoby Mathew const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops);
3465486a965SSoby Mathew 
347b10d4499SJeenu Viswambharan /* Execution state switch in ARM platforms */
348b10d4499SJeenu Viswambharan int arm_execution_state_switch(unsigned int smc_fid,
349b10d4499SJeenu Viswambharan 		uint32_t pc_hi,
350b10d4499SJeenu Viswambharan 		uint32_t pc_lo,
351b10d4499SJeenu Viswambharan 		uint32_t cookie_hi,
352b10d4499SJeenu Viswambharan 		uint32_t cookie_lo,
353b10d4499SJeenu Viswambharan 		void *handle);
354b10d4499SJeenu Viswambharan 
3550ed8c001SSoby Mathew /* Optional functions for SP_MIN */
3560ed8c001SSoby Mathew void plat_arm_sp_min_early_platform_setup(u_register_t arg0, u_register_t arg1,
3570ed8c001SSoby Mathew 			u_register_t arg2, u_register_t arg3);
3580ed8c001SSoby Mathew 
3591af540efSRoberto Vargas /* global variables */
3601af540efSRoberto Vargas extern plat_psci_ops_t plat_arm_psci_pm_ops;
3611af540efSRoberto Vargas extern const mmap_region_t plat_arm_mmap[];
362ecd62429SJeenu Viswambharan extern const unsigned int arm_pm_idle_states[];
3631af540efSRoberto Vargas 
364b0c97dafSAditya Angadi /* secure watchdog */
365b0c97dafSAditya Angadi void plat_arm_secure_wdt_start(void);
366b0c97dafSAditya Angadi void plat_arm_secure_wdt_stop(void);
367b0c97dafSAditya Angadi 
3680e753437SManish V Badarkhe /* Get SOC-ID of ARM platform */
3690e753437SManish V Badarkhe uint32_t plat_arm_get_soc_id(void);
3700e753437SManish V Badarkhe 
37115b94cc1SAntonio Nino Diaz #endif /* PLAT_ARM_H */
372