xref: /rk3399_ARM-atf/plat/arm/board/tc/tc_bl2_measured_boot.c (revision a8dc2595ab7e10dac8285d2c0b6da7ebbcd0edb0)
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 <plat/common/platform.h>
17 #include <platform_def.h>
18 
19 /* TC specific table with image IDs and metadata. Intentionally not a
20  * const struct, some members might set by bootloaders during trusted boot.
21  */
22 struct rse_mboot_metadata tc_rse_mboot_metadata[] = {
23 	{
24 		.id = BL31_IMAGE_ID,
25 		.slot = U(9),
26 		.signer_id_size = SIGNER_ID_MIN_SIZE,
27 		.sw_type = MBOOT_BL31_IMAGE_STRING,
28 		.pk_oid = BL31_IMAGE_KEY_OID,
29 		.lock_measurement = true },
30 	{
31 		.id = HW_CONFIG_ID,
32 		.slot = U(10),
33 		.signer_id_size = SIGNER_ID_MIN_SIZE,
34 		.sw_type = MBOOT_HW_CONFIG_STRING,
35 		.pk_oid = HW_CONFIG_KEY_OID,
36 		.lock_measurement = true },
37 	{
38 		.id = SOC_FW_CONFIG_ID,
39 		.slot = U(11),
40 		.signer_id_size = SIGNER_ID_MIN_SIZE,
41 		.sw_type = MBOOT_SOC_FW_CONFIG_STRING,
42 		.pk_oid = SOC_FW_CONFIG_KEY_OID,
43 		.lock_measurement = true },
44 	{
45 		.id = SCP_BL2_IMAGE_ID,
46 		.slot = U(12),
47 		.signer_id_size = SIGNER_ID_MIN_SIZE,
48 		.sw_type = MBOOT_SCP_BL2_IMAGE_STRING,
49 		.pk_oid = SCP_BL2_IMAGE_KEY_OID,
50 		.lock_measurement = true },
51 	{
52 		.id = RSE_MBOOT_INVALID_ID }
53 };
54 
55 void bl2_plat_mboot_init(void)
56 {
57 	enum sfcp_error_t sfcp_err;
58 
59 	/* Initialize SFCP for communications between AP and RSE */
60 	sfcp_err = sfcp_init();
61 	if (sfcp_err != SFCP_ERROR_SUCCESS) {
62 		ERROR("Unable to initialize SFCP\n");
63 		plat_panic_handler();
64 	}
65 
66 	rse_measured_boot_init(tc_rse_mboot_metadata);
67 }
68 
69 void bl2_plat_mboot_finish(void)
70 {
71 	/* Nothing to do. */
72 }
73