Commit 8c7b55f9 authored by Chandni Cherukuri's avatar Chandni Cherukuri
Browse files

plat/arm/sgi: add system-id node in HW_CONFIG dts



Dynamically populating the 'system-id' node in the HW_CONFIG dts makes
it difficult to enforce memory overlap checks. So add the system-id node
in the HW_CONFIG dts file as a place holder with 'platform-id' and
'config-id' set to zero.

The code at BL2 stage determines the values of 'platform-id' and
'config-id' at runtime and updates the corresponding fields in the
system-id node of HW_CONFIG dts.

Change-Id: I2ca9980b994ac418da8afa0c72716ede10aff68a
Signed-off-by: default avatarChandni Cherukuri <chandni.cherukuri@arm.com>
parent 63197d01
...@@ -8,4 +8,14 @@ ...@@ -8,4 +8,14 @@
/ { / {
/* compatible string */ /* compatible string */
compatible = "arm,sgi575"; compatible = "arm,sgi575";
/*
* Place holder for system-id node with default values. The
* value of platform-id and config-id will be set to the
* correct values during the BL2 stage of boot.
*/
system-id {
platform-id = <0x0>;
config-id = <0x0>;
};
}; };
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <arch_helpers.h>
#include <debug.h> #include <debug.h>
#include <desc_image_load.h> #include <desc_image_load.h>
#include <libfdt.h> #include <libfdt.h>
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
* This function inserts Platform information via device tree nodes as, * This function inserts Platform information via device tree nodes as,
* system-id { * system-id {
* platform-id = <0>; * platform-id = <0>;
* config-id = <0>;
* } * }
******************************************************************************/ ******************************************************************************/
static int plat_sgi_append_config_node(void) static int plat_sgi_append_config_node(void)
...@@ -20,7 +22,7 @@ static int plat_sgi_append_config_node(void) ...@@ -20,7 +22,7 @@ static int plat_sgi_append_config_node(void)
bl_mem_params_node_t *mem_params; bl_mem_params_node_t *mem_params;
void *fdt; void *fdt;
int nodeoffset, err; int nodeoffset, err;
unsigned int platid = 0; unsigned int platid = 0, platcfg = 0;
char *platform_name; char *platform_name;
mem_params = get_bl_mem_params_node(HW_CONFIG_ID); mem_params = get_bl_mem_params_node(HW_CONFIG_ID);
...@@ -45,31 +47,34 @@ static int plat_sgi_append_config_node(void) ...@@ -45,31 +47,34 @@ static int plat_sgi_append_config_node(void)
} }
if (strcmp(platform_name, "arm,sgi575") == 0) { if (strcmp(platform_name, "arm,sgi575") == 0) {
platid = mmio_read_32(SSC_VERSION); platid = mmio_read_32(SSC_VERSION) & SSC_VERSION_PART_NUM_MASK;
platcfg = (mmio_read_32(SSC_VERSION) >> SSC_VERSION_CONFIG_SHIFT)
& SSC_VERSION_CONFIG_MASK;
} else { } else {
WARN("Invalid platform\n"); WARN("Invalid platform\n");
return -1; return -1;
} }
/* Increase DTB blob by 512 byte */ nodeoffset = fdt_subnode_offset(fdt, 0, "system-id");
err = fdt_open_into(fdt, fdt, mem_params->image_info.image_size + 512); if (nodeoffset < 0) {
if (err < 0) { ERROR("Failed to get system-id node offset\n");
ERROR("Failed to open HW_CONFIG DTB\n");
return -1; return -1;
} }
/* Create "/system-id" node */ err = fdt_setprop_u32(fdt, nodeoffset, "platform-id", platid);
nodeoffset = fdt_add_subnode(fdt, 0, "system-id"); if (err < 0) {
if (nodeoffset < 0) { ERROR("Failed to set platform-id\n");
ERROR("Failed to add node system-id\n");
return -1; return -1;
} }
err = fdt_setprop_u32(fdt, nodeoffset, "platform-id", platid); err = fdt_setprop_u32(fdt, nodeoffset, "config-id", platcfg);
if (err < 0) { if (err < 0) {
ERROR("Failed to add node platform-id\n"); ERROR("Failed to set config-id\n");
return -1; return -1;
} }
flush_dcache_range((uintptr_t)fdt, mem_params->image_info.image_size);
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