Commit c3825c9b authored by Alexei Fedorov's avatar Alexei Fedorov
Browse files

TF-A: Add support for Measured Boot driver to FCONF



This patch adds support for Measured Boot driver functionality
to FCONF library code.

Change-Id: I81cdb06f1950f7e6e58f938a1b9c2f74f7cfdf88
Signed-off-by: default avatarAlexei Fedorov <Alexei.Fedorov@arm.com>
parent 3f498b0d
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <lib/object_pool.h> #include <lib/object_pool.h>
#include <libfdt.h> #include <libfdt.h>
/* We currently use FW, TB_FW, SOC_FW, TOS_FW, NS_fw and HW configs */ /* We currently use FW, TB_FW, SOC_FW, TOS_FW, NT_FW and HW configs */
#define MAX_DTB_INFO U(6) #define MAX_DTB_INFO U(6)
static struct dyn_cfg_dtb_info_t dtb_infos[MAX_DTB_INFO]; static struct dyn_cfg_dtb_info_t dtb_infos[MAX_DTB_INFO];
......
...@@ -27,20 +27,25 @@ int fconf_populate_tbbr_dyn_config(uintptr_t config) ...@@ -27,20 +27,25 @@ int fconf_populate_tbbr_dyn_config(uintptr_t config)
const char *compatible_str = "arm,tb_fw"; const char *compatible_str = "arm,tb_fw";
node = fdt_node_offset_by_compatible(dtb, -1, compatible_str); node = fdt_node_offset_by_compatible(dtb, -1, compatible_str);
if (node < 0) { if (node < 0) {
ERROR("FCONF: Can't find %s compatible in dtb\n", compatible_str); ERROR("FCONF: Can't find `%s` compatible in dtb\n",
compatible_str);
return node; return node;
} }
/* Locate the disable_auth cell and read the value */ /* Locate the disable_auth cell and read the value */
err = fdt_read_uint32(dtb, node, "disable_auth", &tbbr_dyn_config.disable_auth); err = fdt_read_uint32(dtb, node, "disable_auth",
&tbbr_dyn_config.disable_auth);
if (err < 0) { if (err < 0) {
WARN("FCONF: Read cell failed for `disable_auth`\n"); WARN("FCONF: Read %s failed for `%s`\n",
"cell", "disable_auth");
return err; return err;
} }
/* Check if the value is boolean */ /* Check if the value is boolean */
if ((tbbr_dyn_config.disable_auth != 0U) && (tbbr_dyn_config.disable_auth != 1U)) { if ((tbbr_dyn_config.disable_auth != 0U) &&
WARN("Invalid value for `disable_auth` cell %d\n", tbbr_dyn_config.disable_auth); (tbbr_dyn_config.disable_auth != 1U)) {
WARN("Invalid value for `%s` cell %d\n",
"disable_auth", tbbr_dyn_config.disable_auth);
return -1; return -1;
} }
...@@ -52,25 +57,40 @@ int fconf_populate_tbbr_dyn_config(uintptr_t config) ...@@ -52,25 +57,40 @@ int fconf_populate_tbbr_dyn_config(uintptr_t config)
/* Retrieve the Mbed TLS heap details from the DTB */ /* Retrieve the Mbed TLS heap details from the DTB */
err = fdt_read_uint64(dtb, node, "mbedtls_heap_addr", &val64); err = fdt_read_uint64(dtb, node, "mbedtls_heap_addr", &val64);
if (err < 0) { if (err < 0) {
ERROR("FCONF: Read cell failed for mbedtls_heap\n"); ERROR("FCONF: Read %s failed for `%s`\n",
"cell", "mbedtls_heap_addr");
return err; return err;
} }
tbbr_dyn_config.mbedtls_heap_addr = (void *)(uintptr_t)val64; tbbr_dyn_config.mbedtls_heap_addr = (void *)(uintptr_t)val64;
err = fdt_read_uint32(dtb, node, "mbedtls_heap_size", &val32); err = fdt_read_uint32(dtb, node, "mbedtls_heap_size", &val32);
if (err < 0) { if (err < 0) {
ERROR("FCONF: Read cell failed for mbedtls_heap\n"); ERROR("FCONF: Read %s failed for `%s`\n",
"cell", "mbedtls_heap_size");
return err; return err;
} }
tbbr_dyn_config.mbedtls_heap_size = val32; tbbr_dyn_config.mbedtls_heap_size = val32;
VERBOSE("FCONF:tbbr.disable_auth cell found with value = %d\n", #if MEASURED_BOOT
tbbr_dyn_config.disable_auth); /* Retrieve BL2 hash data details from the DTB */
VERBOSE("FCONF:tbbr.mbedtls_heap_addr cell found with value = %p\n", err = fdtw_read_bytes(dtb, node, "bl2_hash_data", TCG_DIGEST_SIZE,
tbbr_dyn_config.mbedtls_heap_addr); &tbbr_dyn_config.bl2_hash_data);
VERBOSE("FCONF:tbbr.mbedtls_heap_size cell found with value = %zu\n", if (err < 0) {
tbbr_dyn_config.mbedtls_heap_size); ERROR("FCONF: Read %s failed for '%s'\n",
"bytes", "bl2_hash_data");
return err;
}
#endif
VERBOSE("%s%s%s %d\n", "FCONF: `tbbr.", "disable_auth",
"` cell found with value =", tbbr_dyn_config.disable_auth);
VERBOSE("%s%s%s %p\n", "FCONF: `tbbr.", "mbedtls_heap_addr",
"` cell found with value =", tbbr_dyn_config.mbedtls_heap_addr);
VERBOSE("%s%s%s %zu\n", "FCONF: `tbbr.", "mbedtls_heap_size",
"` cell found with value =", tbbr_dyn_config.mbedtls_heap_size);
#if MEASURED_BOOT
VERBOSE("%s%s%s %p\n", "FCONF: `tbbr.", "bl2_hash_data",
"` array found at address =", tbbr_dyn_config.bl2_hash_data);
#endif
return 0; return 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment