xref: /rk3399_ARM-atf/plat/arm/board/tc/tc_bl1_measured_boot.c (revision 2801427972c4b0d4c0165edb509f21186103f21f)
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/zero_oid.h>
14 
15 #include <plat/arm/common/plat_arm.h>
16 #include <platform_def.h>
17 
18 /* Table with platform specific 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 = FW_CONFIG_ID,
24 		.slot = U(6),
25 		.signer_id_size = SIGNER_ID_MIN_SIZE,
26 		.sw_type = MBOOT_FW_CONFIG_STRING,
27 		.pk_oid = ZERO_OID,
28 		.lock_measurement = true },
29 	{
30 		.id = TB_FW_CONFIG_ID,
31 		.slot = U(7),
32 		.signer_id_size = SIGNER_ID_MIN_SIZE,
33 		.sw_type = MBOOT_TB_FW_CONFIG_STRING,
34 		.pk_oid = ZERO_OID,
35 		.lock_measurement = true },
36 	{
37 		.id = BL2_IMAGE_ID,
38 		.slot = U(8),
39 		.signer_id_size = SIGNER_ID_MIN_SIZE,
40 		.sw_type = MBOOT_BL2_IMAGE_STRING,
41 		.pk_oid = ZERO_OID,
42 		.lock_measurement = true },
43 
44 	{
45 		.id = RSE_MBOOT_INVALID_ID }
46 };
47 
bl1_plat_mboot_init(void)48 void bl1_plat_mboot_init(void)
49 {
50 	enum sfcp_error_t sfcp_err;
51 
52 	/* Initialize SFCP for communications between AP and RSE */
53 	sfcp_err = sfcp_init();
54 	if (sfcp_err != SFCP_ERROR_SUCCESS) {
55 		ERROR("Unable to initialize SFCP\n");
56 		plat_panic_handler();
57 	}
58 
59 	rse_measured_boot_init(tc_rse_mboot_metadata);
60 }
61 
bl1_plat_mboot_finish(void)62 void bl1_plat_mboot_finish(void)
63 {
64 	/* Nothing to do. */
65 }
66