xref: /rk3399_ARM-atf/plat/arm/board/tc/tc_bl2_measured_boot.c (revision 66e46af64f0c15ee2ddb22fda39df836c6ec1937)
1 /*
2  * Copyright (c) 2022-2026, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <stdint.h>
8 
9 #include <common/debug.h>
10 #include <drivers/arm/sfcp.h>
11 #include <drivers/measured_boot/metadata.h>
12 #include <drivers/measured_boot/rse/rse_measured_boot.h>
13 #include <tools_share/tbbr_oid.h>
14 
15 #include <plat/common/common_def.h>
16 #include <platform_def.h>
17 
18 /* TC specific table with image IDs and metadata. Intentionally not a
19  * const struct, some members might set by bootloaders during trusted boot.
20  */
21 struct rse_mboot_metadata tc_rse_mboot_metadata[] = {
22 	{
23 		.id = BL31_IMAGE_ID,
24 		.slot = U(9),
25 		.signer_id_size = SIGNER_ID_MIN_SIZE,
26 		.sw_type = MBOOT_BL31_IMAGE_STRING,
27 		.pk_oid = BL31_IMAGE_KEY_OID,
28 		.lock_measurement = true },
29 	{
30 		.id = HW_CONFIG_ID,
31 		.slot = U(10),
32 		.signer_id_size = SIGNER_ID_MIN_SIZE,
33 		.sw_type = MBOOT_HW_CONFIG_STRING,
34 		.pk_oid = HW_CONFIG_KEY_OID,
35 		.lock_measurement = true },
36 	{
37 		.id = SOC_FW_CONFIG_ID,
38 		.slot = U(11),
39 		.signer_id_size = SIGNER_ID_MIN_SIZE,
40 		.sw_type = MBOOT_SOC_FW_CONFIG_STRING,
41 		.pk_oid = SOC_FW_CONFIG_KEY_OID,
42 		.lock_measurement = true },
43 	{
44 		.id = SCP_BL2_IMAGE_ID,
45 		.slot = U(12),
46 		.signer_id_size = SIGNER_ID_MIN_SIZE,
47 		.sw_type = MBOOT_SCP_BL2_IMAGE_STRING,
48 		.pk_oid = SCP_BL2_IMAGE_KEY_OID,
49 		.lock_measurement = true },
50 	{
51 		.id = RSE_MBOOT_INVALID_ID }
52 };
53 
54 void bl2_plat_mboot_init(void)
55 {
56 	enum sfcp_error_t sfcp_err;
57 
58 	/* Initialize SFCP for communications between AP and RSE */
59 	sfcp_err = sfcp_init();
60 	if (sfcp_err != SFCP_ERROR_SUCCESS) {
61 		ERROR("Unable to initialize SFCP\n");
62 		plat_panic_handler();
63 	}
64 
65 	rse_measured_boot_init(tc_rse_mboot_metadata);
66 }
67 
68 void bl2_plat_mboot_finish(void)
69 {
70 	/* Nothing to do. */
71 }
72