mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00
Merge changes from topic "morello/firmware-revision" into integration
* changes: feat(morello): add TF-A version string to NT_FW_CONFIG feat(morello): set NT_FW_CONFIG properties for MCC, PCC and SCP version
This commit is contained in:
commit
9bb15ab53a
3 changed files with 130 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2021-2023, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -23,4 +23,19 @@
|
|||
scc-config = <0x0>;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Placeholder for firmware-version node with default values.
|
||||
* The value will be set to the correct values during
|
||||
* the BL2 stage of boot.
|
||||
*/
|
||||
firmware-version {
|
||||
#ifdef TARGET_PLATFORM_SOC
|
||||
mcc-fw-version = <0x0>;
|
||||
pcc-fw-version = <0x0>;
|
||||
#endif
|
||||
scp-fw-version = <0x0>;
|
||||
scp-fw-commit = <0x0>;
|
||||
tfa-fw-version = "unknown-dirty_00000000";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -15,6 +15,15 @@
|
|||
MORELLO_NS_SRAM_SIZE, \
|
||||
MT_DEVICE | MT_RW | MT_SECURE)
|
||||
|
||||
/* SDS Firmware version defines */
|
||||
#define MORELLO_SDS_FIRMWARE_VERSION_STRUCT_ID U(2)
|
||||
#define MORELLO_SDS_FIRMWARE_VERSION_OFFSET U(0)
|
||||
#ifdef TARGET_PLATFORM_FVP
|
||||
# define MORELLO_SDS_FIRMWARE_VERSION_SIZE U(8)
|
||||
#else
|
||||
# define MORELLO_SDS_FIRMWARE_VERSION_SIZE U(16)
|
||||
#endif
|
||||
|
||||
/* SDS Platform information defines */
|
||||
#define MORELLO_SDS_PLATFORM_INFO_STRUCT_ID U(8)
|
||||
#define MORELLO_SDS_PLATFORM_INFO_OFFSET U(0)
|
||||
|
@ -122,8 +131,40 @@ struct morello_plat_info {
|
|||
} __packed;
|
||||
#endif
|
||||
|
||||
/* Compile time assertion to ensure the size of structure is of the required bytes */
|
||||
/* SDS Firmware revision struct definition */
|
||||
#ifdef TARGET_PLATFORM_FVP
|
||||
/*
|
||||
* Firmware revision structure stored in SDS.
|
||||
* This structure holds information about firmware versions.
|
||||
* - SCP firmware version
|
||||
* - SCP firmware commit
|
||||
*/
|
||||
struct morello_firmware_version {
|
||||
uint32_t scp_fw_ver;
|
||||
uint32_t scp_fw_commit;
|
||||
} __packed;
|
||||
#else
|
||||
/*
|
||||
* Firmware revision structure stored in SDS.
|
||||
* This structure holds information about firmware versions.
|
||||
* - SCP firmware version
|
||||
* - SCP firmware commit
|
||||
* - MCC firmware version
|
||||
* - PCC firmware version
|
||||
*/
|
||||
struct morello_firmware_version {
|
||||
uint32_t scp_fw_ver;
|
||||
uint32_t scp_fw_commit;
|
||||
uint32_t mcc_fw_ver;
|
||||
uint32_t pcc_fw_ver;
|
||||
} __packed;
|
||||
#endif
|
||||
|
||||
/* Compile time assertions to ensure the size of structures are of the required bytes */
|
||||
CASSERT(sizeof(struct morello_plat_info) == MORELLO_SDS_PLATFORM_INFO_SIZE,
|
||||
assert_invalid_plat_info_size);
|
||||
|
||||
CASSERT(sizeof(struct morello_firmware_version) == MORELLO_SDS_FIRMWARE_VERSION_SIZE,
|
||||
assert_invalid_firmware_version_size);
|
||||
|
||||
#endif /* MORELLO_DEF_H */
|
||||
|
|
|
@ -23,7 +23,8 @@ static inline uint64_t get_mem_client_mode(uint64_t size)
|
|||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* This function inserts Platform information via device tree nodes as,
|
||||
* This function inserts Platform information and firmware versions
|
||||
* via device tree nodes as,
|
||||
* platform-info {
|
||||
* local-ddr-size = <0x0 0x0>;
|
||||
*#ifdef TARGET_PLATFORM_SOC
|
||||
|
@ -33,12 +34,22 @@ static inline uint64_t get_mem_client_mode(uint64_t size)
|
|||
* scc-config = <0x0>;
|
||||
*#endif
|
||||
* };
|
||||
* firmware-version {
|
||||
*#ifdef TARGET_PLATFORM_SOC
|
||||
* mcc-fw-version = <0x0>;
|
||||
* pcc-fw-version = <0x0>;
|
||||
*#endif
|
||||
* scp-fw-version = <0x0>;
|
||||
* scp-fw-commit = <0x0>;
|
||||
* tfa-fw-version = "unknown-dirty_00000000";
|
||||
* };
|
||||
******************************************************************************/
|
||||
static int plat_morello_append_config_node(struct morello_plat_info *plat_info)
|
||||
static int plat_morello_append_config_node(struct morello_plat_info *plat_info,
|
||||
struct morello_firmware_version *fw_version)
|
||||
{
|
||||
bl_mem_params_node_t *mem_params;
|
||||
void *fdt;
|
||||
int nodeoffset, err;
|
||||
int nodeoffset_plat, nodeoffset_fw, err;
|
||||
uint64_t usable_mem_size;
|
||||
|
||||
usable_mem_size = plat_info->local_ddr_size;
|
||||
|
@ -57,35 +68,41 @@ static int plat_morello_append_config_node(struct morello_plat_info *plat_info)
|
|||
return -1;
|
||||
}
|
||||
|
||||
nodeoffset = fdt_subnode_offset(fdt, 0, "platform-info");
|
||||
if (nodeoffset < 0) {
|
||||
nodeoffset_plat = fdt_subnode_offset(fdt, 0, "platform-info");
|
||||
if (nodeoffset_plat < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to get platform-info node offset\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
nodeoffset_fw = fdt_subnode_offset(fdt, 0, "firmware-version");
|
||||
if (nodeoffset_fw < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to get firmware-version node offset\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef TARGET_PLATFORM_SOC
|
||||
err = fdt_setprop_u64(fdt, nodeoffset, "remote-ddr-size",
|
||||
err = fdt_setprop_u64(fdt, nodeoffset_plat, "remote-ddr-size",
|
||||
plat_info->remote_ddr_size);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set remote-ddr-size\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset, "remote-chip-count",
|
||||
err = fdt_setprop_u32(fdt, nodeoffset_plat, "remote-chip-count",
|
||||
plat_info->remote_chip_count);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set remote-chip-count\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset, "multichip-mode",
|
||||
err = fdt_setprop_u32(fdt, nodeoffset_plat, "multichip-mode",
|
||||
plat_info->multichip_mode);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set multichip-mode\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset, "scc-config",
|
||||
err = fdt_setprop_u32(fdt, nodeoffset_plat, "scc-config",
|
||||
plat_info->scc_config);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set scc-config\n");
|
||||
|
@ -95,8 +112,41 @@ static int plat_morello_append_config_node(struct morello_plat_info *plat_info)
|
|||
if (plat_info->scc_config & MORELLO_SCC_CLIENT_MODE_MASK) {
|
||||
usable_mem_size = get_mem_client_mode(plat_info->local_ddr_size);
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset_fw, "mcc-fw-version",
|
||||
fw_version->mcc_fw_ver);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set mcc-fw-version\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset_fw, "pcc-fw-version",
|
||||
fw_version->pcc_fw_ver);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set pcc-fw-version\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
err = fdt_setprop_u64(fdt, nodeoffset, "local-ddr-size",
|
||||
err = fdt_setprop_u32(fdt, nodeoffset_fw, "scp-fw-version",
|
||||
fw_version->scp_fw_ver);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set scp-fw-version\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset_fw, "scp-fw-commit",
|
||||
fw_version->scp_fw_commit);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set scp-fw-commit\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_string(fdt, nodeoffset_fw, "tfa-fw-version", version_string);
|
||||
if (err < 0) {
|
||||
WARN("NT_FW_CONFIG: Unable to set tfa-fw-version\n");
|
||||
}
|
||||
|
||||
err = fdt_setprop_u64(fdt, nodeoffset_plat, "local-ddr-size",
|
||||
usable_mem_size);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set local-ddr-size\n");
|
||||
|
@ -115,6 +165,7 @@ bl_params_t *plat_get_next_bl_params(void)
|
|||
{
|
||||
int ret;
|
||||
struct morello_plat_info plat_info;
|
||||
struct morello_firmware_version fw_version;
|
||||
|
||||
ret = sds_init();
|
||||
if (ret != SDS_OK) {
|
||||
|
@ -132,6 +183,16 @@ bl_params_t *plat_get_next_bl_params(void)
|
|||
panic();
|
||||
}
|
||||
|
||||
ret = sds_struct_read(MORELLO_SDS_FIRMWARE_VERSION_STRUCT_ID,
|
||||
MORELLO_SDS_FIRMWARE_VERSION_OFFSET,
|
||||
&fw_version,
|
||||
MORELLO_SDS_FIRMWARE_VERSION_SIZE,
|
||||
SDS_ACCESS_MODE_NON_CACHED);
|
||||
if (ret != SDS_OK) {
|
||||
ERROR("Error getting firmware version from SDS. ret:%d\n", ret);
|
||||
panic();
|
||||
}
|
||||
|
||||
/* Validate plat_info SDS */
|
||||
#ifdef TARGET_PLATFORM_FVP
|
||||
if (plat_info.local_ddr_size == 0U) {
|
||||
|
@ -146,7 +207,7 @@ bl_params_t *plat_get_next_bl_params(void)
|
|||
panic();
|
||||
}
|
||||
|
||||
ret = plat_morello_append_config_node(&plat_info);
|
||||
ret = plat_morello_append_config_node(&plat_info, &fw_version);
|
||||
if (ret != 0) {
|
||||
panic();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue