xref: /rk3399_ARM-atf/plat/arm/board/fvp/fvp_lfa.c (revision f2ab12441fdcc8d98ee7da3f406d0f1045ca1b59)
1 /*
2  * Copyright (c) 2025, 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/rmmd_rmm_lfa.h>
11 #include <tools_share/firmware_image_package.h>
12 
13 #include <plat/arm/common/plat_arm_lfa_components.h>
14 
15 /* Keep this array consistent with enum fvp_lfa_component_id_t */
16 static plat_lfa_component_info_t fvp_lfa_components[LFA_MAX_DEFINED_COMPONENTS] = {
17 	[LFA_BL31_COMPONENT] = {LFA_BL31_COMPONENT, UUID_EL3_RUNTIME_FIRMWARE_BL31,
18 				NULL, false},
19 #if BL32_BASE
20 	[LFA_BL32_COMPONENT] = {LFA_BL32_COMPONENT, UUID_SECURE_PAYLOAD_BL32,
21 				NULL, false},
22 #endif /* BL32_BASE */
23 	[LFA_BL33_COMPONENT] = {LFA_BL33_COMPONENT, UUID_NON_TRUSTED_FIRMWARE_BL33,
24 				NULL, false},
25 #if ENABLE_RME
26 	[LFA_RMM_COMPONENT]  = {LFA_RMM_COMPONENT, UUID_REALM_MONITOR_MGMT_FIRMWARE,
27 				NULL, false},
28 #endif /* ENABLE_RME */
29 };
30 
31 uint32_t plat_lfa_get_components(plat_lfa_component_info_t **components)
32 {
33 	if (components == NULL) {
34 		return -EINVAL;
35 	}
36 
37 	fvp_lfa_components[LFA_BL31_COMPONENT].activator = get_bl31_activator();
38 #if ENABLE_RME
39 	fvp_lfa_components[LFA_RMM_COMPONENT].activator = get_rmm_activator();
40 #endif /* ENABLE_RME */
41 
42 	*components = fvp_lfa_components;
43 	return LFA_MAX_DEFINED_COMPONENTS;
44 }
45 
46 bool is_plat_lfa_activation_pending(uint32_t lfa_component_id)
47 {
48 #if ENABLE_RME
49 	if (lfa_component_id == LFA_RMM_COMPONENT) {
50 		return true;
51 	}
52 #endif /* ENABLE_RME */
53 
54 	return false;
55 }
56 
57 int plat_lfa_cancel(uint32_t lfa_component_id)
58 {
59 	/* placeholder function to do cancel LFA of given component */
60 	return 0;
61 }
62 
63 int plat_lfa_load_auth_image(uint32_t lfa_component_id)
64 {
65 	/*
66 	 * In AEM FVP, we don't want to bloat the code by adding
67 	 * loading and authentication mechanism, so here we assumed
68 	 * that the components are pre-loaded and authenticated already.
69 	 */
70 	return 0;
71 }
72 
73 int plat_lfa_notify_activate(uint32_t lfa_component_id)
74 {
75 	return 0;
76 }
77