xref: /rk3399_ARM-atf/plat/arm/board/fvp/fvp_lfa.c (revision 430f246e58d146949d399d72294f56403672bee0)
1 /*
2  * Copyright (c) 2025-2026, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <errno.h>
8 #include <plat/common/platform.h>
9 #include <services/bl31_lfa.h>
10 #include <services/el3_spmd_logical_sp.h>
11 #include <services/rmmd_rmm_lfa.h>
12 #include <tools_share/firmware_image_package.h>
13 
14 #include <plat/arm/common/plat_arm_lfa_components.h>
15 
16 /* Keep this array consistent with enum fvp_lfa_component_id_t */
17 static plat_lfa_component_info_t fvp_lfa_components[LFA_MAX_DEFINED_COMPONENTS] = {
18 	[LFA_BL31_COMPONENT] = {LFA_BL31_COMPONENT, UUID_EL3_RUNTIME_FIRMWARE_BL31,
19 				NULL, false},
20 #if BL32_BASE
21 	[LFA_BL32_COMPONENT] = {LFA_BL32_COMPONENT, UUID_SECURE_PAYLOAD_BL32,
22 				NULL, false},
23 #endif /* BL32_BASE */
24 	[LFA_BL33_COMPONENT] = {LFA_BL33_COMPONENT, UUID_NON_TRUSTED_FIRMWARE_BL33,
25 				NULL, false},
26 #if ENABLE_RMM
27 	[LFA_RMM_COMPONENT]  = {LFA_RMM_COMPONENT, UUID_REALM_MONITOR_MGMT_FIRMWARE,
28 				NULL, false},
29 #endif /* ENABLE_RMM */
30 
31 #if SUPPORT_SP_LIVE_ACTIVATION
32 	[LFA_SP1] = { LFA_SP1, IMAGE_UUID_SECURE_PARTITION_1, NULL, false},
33 
34 	[LFA_SP2] = { LFA_SP2, IMAGE_UUID_SECURE_PARTITION_2, NULL, false},
35 #endif /* SUPPORT_SP_LIVE_ACTIVATION */
36 
37 };
38 
plat_lfa_get_components(plat_lfa_component_info_t ** components)39 uint32_t plat_lfa_get_components(plat_lfa_component_info_t **components)
40 {
41 	if (components == NULL) {
42 		return -EINVAL;
43 	}
44 
45 	fvp_lfa_components[LFA_BL31_COMPONENT].activator = get_bl31_activator();
46 #if ENABLE_RMM
47 	fvp_lfa_components[LFA_RMM_COMPONENT].activator = get_rmm_activator();
48 #endif /* ENABLE_RMM */
49 
50 #if SUPPORT_SP_LIVE_ACTIVATION
51 	fvp_lfa_components[LFA_SP1].activator =
52 		get_secure_partition_activator();
53 
54 	fvp_lfa_components[LFA_SP2].activator =
55 		get_secure_partition_activator();
56 #endif /* SUPPORT_SP_LIVE_ACTIVATION */
57 
58 	*components = fvp_lfa_components;
59 	return LFA_MAX_DEFINED_COMPONENTS;
60 }
61 
is_plat_lfa_activation_pending(uint32_t lfa_component_id)62 bool is_plat_lfa_activation_pending(uint32_t lfa_component_id)
63 {
64 #if ENABLE_RMM
65 	if (lfa_component_id == LFA_RMM_COMPONENT) {
66 		return true;
67 	}
68 #endif /* ENABLE_RMM */
69 
70 #if SUPPORT_SP_LIVE_ACTIVATION
71 	if (lfa_component_id == LFA_SP1 || lfa_component_id == LFA_SP2) {
72 		return true;
73 	}
74 #endif /* SUPPORT_SP_LIVE_ACTIVATION */
75 
76 	return false;
77 }
78 
plat_lfa_cancel(uint32_t lfa_component_id)79 int plat_lfa_cancel(uint32_t lfa_component_id)
80 {
81 	/* placeholder function to do cancel LFA of given component */
82 	return 0;
83 }
84 
plat_lfa_load_auth_image(uint32_t lfa_component_id)85 int plat_lfa_load_auth_image(uint32_t lfa_component_id)
86 {
87 	/*
88 	 * In AEM FVP, we don't want to bloat the code by adding
89 	 * loading and authentication mechanism, so here we assumed
90 	 * that the components are pre-loaded and authenticated already.
91 	 */
92 	return 0;
93 }
94 
plat_lfa_notify_activate(uint32_t lfa_component_id)95 int plat_lfa_notify_activate(uint32_t lfa_component_id)
96 {
97 	return 0;
98 }
99