diff options
Diffstat (limited to 'plat/arm/board/morello/morello_bl31_setup.c')
-rw-r--r-- | plat/arm/board/morello/morello_bl31_setup.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/plat/arm/board/morello/morello_bl31_setup.c b/plat/arm/board/morello/morello_bl31_setup.c index 5b91e87e1b..59dd37b170 100644 --- a/plat/arm/board/morello/morello_bl31_setup.c +++ b/plat/arm/board/morello/morello_bl31_setup.c @@ -8,6 +8,7 @@ #include <drivers/arm/css/css_mhu_doorbell.h> #include <drivers/arm/css/scmi.h> #include <drivers/arm/css/sds.h> +#include <lib/cassert.h> #include <plat/arm/common/plat_arm.h> #include "morello_def.h" @@ -17,18 +18,21 @@ * Platform information structure stored in SDS. * This structure holds information about platform's DDR * size which is an information about multichip setup - * - multichip mode - * - slave_count - * - Local DDR size in GB, DDR memory in master board - * - Remote DDR size in GB, DDR memory in slave board + * - Local DDR size in bytes, DDR memory in master board + * - Remote DDR size in bytes, DDR memory in slave board + * - slave_count + * - multichip mode */ struct morello_plat_info { - bool multichip_mode; + uint64_t local_ddr_size; + uint64_t remote_ddr_size; uint8_t slave_count; - uint8_t local_ddr_size; - uint8_t remote_ddr_size; + bool multichip_mode; } __packed; +/* Compile time assertion to ensure the size of structure is 18 bytes */ +CASSERT(sizeof(struct morello_plat_info) == MORELLO_SDS_PLATFORM_INFO_SIZE, + assert_invalid_plat_info_size); /* * BL33 image information structure stored in SDS. * This structure holds the source & destination addresses and @@ -80,6 +84,7 @@ void bl31_platform_setup(void) int ret; struct morello_plat_info plat_info; struct morello_bl33_info bl33_info; + struct morello_plat_info *copy_dest; ret = sds_init(); if (ret != SDS_OK) { @@ -99,8 +104,8 @@ void bl31_platform_setup(void) /* Validate plat_info SDS */ if ((plat_info.local_ddr_size == 0U) - || (plat_info.local_ddr_size > MORELLO_MAX_DDR_CAPACITY_GB) - || (plat_info.remote_ddr_size > MORELLO_MAX_DDR_CAPACITY_GB) + || (plat_info.local_ddr_size > MORELLO_MAX_DDR_CAPACITY) + || (plat_info.remote_ddr_size > MORELLO_MAX_DDR_CAPACITY) || (plat_info.slave_count > MORELLO_MAX_SLAVE_COUNT)) { ERROR("platform info SDS is corrupted\n"); panic(); @@ -127,5 +132,6 @@ void bl31_platform_setup(void) * and platform information should be passed to BL33 using NT_FW_CONFIG * passing mechanism. */ - mmio_write_32(MORELLO_PLATFORM_INFO_BASE, *(uint32_t *)&plat_info); + copy_dest = (struct morello_plat_info *)MORELLO_PLATFORM_INFO_BASE; + *copy_dest = plat_info; } |