Merge changes from topic "DPE" into integration

* changes:
  feat(tc): add RSS SDS region right after SCMI payload
  refactor(n1sdp): update SDS driver calls
  refactor(morello): update SDS driver calls
  refactor(juno): update SDS driver calls
  refactor(sgi): update SDS driver calls
  refactor(css): support multiple SDS regions
This commit is contained in:
Manish V Badarkhe 2024-02-14 10:34:19 +01:00 committed by TrustedFirmware Code Review
commit 514d022fda
23 changed files with 254 additions and 91 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2014-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -20,7 +20,7 @@ int css_scp_boot_image_xfer(void *image, unsigned int image_size)
int ret; int ret;
unsigned int image_offset, image_flags; unsigned int image_offset, image_flags;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SCP SDS initialization failed\n"); ERROR("SCP SDS initialization failed\n");
panic(); panic();
@ -28,13 +28,15 @@ int css_scp_boot_image_xfer(void *image, unsigned int image_size)
VERBOSE("Writing SCP image metadata\n"); VERBOSE("Writing SCP image metadata\n");
image_offset = (uintptr_t) image - ARM_TRUSTED_SRAM_BASE; image_offset = (uintptr_t) image - ARM_TRUSTED_SRAM_BASE;
ret = sds_struct_write(SDS_SCP_IMG_STRUCT_ID, SDS_SCP_IMG_ADDR_OFFSET, ret = sds_struct_write(SDS_SCP_AP_REGION_ID,
SDS_SCP_IMG_STRUCT_ID, SDS_SCP_IMG_ADDR_OFFSET,
&image_offset, SDS_SCP_IMG_ADDR_SIZE, &image_offset, SDS_SCP_IMG_ADDR_SIZE,
SDS_ACCESS_MODE_NON_CACHED); SDS_ACCESS_MODE_NON_CACHED);
if (ret != SDS_OK) if (ret != SDS_OK)
goto sds_fail; goto sds_fail;
ret = sds_struct_write(SDS_SCP_IMG_STRUCT_ID, SDS_SCP_IMG_SIZE_OFFSET, ret = sds_struct_write(SDS_SCP_AP_REGION_ID,
SDS_SCP_IMG_STRUCT_ID, SDS_SCP_IMG_SIZE_OFFSET,
&image_size, SDS_SCP_IMG_SIZE_SIZE, &image_size, SDS_SCP_IMG_SIZE_SIZE,
SDS_ACCESS_MODE_NON_CACHED); SDS_ACCESS_MODE_NON_CACHED);
if (ret != SDS_OK) if (ret != SDS_OK)
@ -42,7 +44,8 @@ int css_scp_boot_image_xfer(void *image, unsigned int image_size)
VERBOSE("Marking SCP image metadata as valid\n"); VERBOSE("Marking SCP image metadata as valid\n");
image_flags = SDS_SCP_IMG_VALID_FLAG_BIT; image_flags = SDS_SCP_IMG_VALID_FLAG_BIT;
ret = sds_struct_write(SDS_SCP_IMG_STRUCT_ID, SDS_SCP_IMG_FLAG_OFFSET, ret = sds_struct_write(SDS_SCP_AP_REGION_ID,
SDS_SCP_IMG_STRUCT_ID, SDS_SCP_IMG_FLAG_OFFSET,
&image_flags, SDS_SCP_IMG_FLAG_SIZE, &image_flags, SDS_SCP_IMG_FLAG_SIZE,
SDS_ACCESS_MODE_NON_CACHED); SDS_ACCESS_MODE_NON_CACHED);
if (ret != SDS_OK) if (ret != SDS_OK)
@ -68,7 +71,8 @@ int css_scp_boot_ready(void)
/* Wait for the SCP RAM Firmware to complete its initialization process */ /* Wait for the SCP RAM Firmware to complete its initialization process */
while (retry > 0) { while (retry > 0) {
ret = sds_struct_read(SDS_FEATURE_AVAIL_STRUCT_ID, 0, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
SDS_FEATURE_AVAIL_STRUCT_ID, 0,
&scp_feature_availability_flags, &scp_feature_availability_flags,
SDS_FEATURE_AVAIL_SIZE, SDS_FEATURE_AVAIL_SIZE,
SDS_ACCESS_MODE_NON_CACHED); SDS_ACCESS_MODE_NON_CACHED);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -15,40 +15,39 @@
#include "sds_private.h" #include "sds_private.h"
/* /* Array of SDS memory region descriptions */
* Variables used to track and maintain the state of the memory region reserved static sds_region_desc_t *sds_regions;
* for usage by the SDS framework.
*/
/* Pointer to the base of the SDS memory region */ /* Total count of SDS memory regions */
static uintptr_t sds_mem_base; static unsigned int sds_region_cnt;
/* Size of the SDS memory region in bytes */
static size_t sds_mem_size;
/* /*
* Perform some non-exhaustive tests to determine whether any of the fields * Perform some non-exhaustive tests to determine whether any of the fields
* within a Structure Header contain obviously invalid data. * within a Structure Header contain obviously invalid data.
* Returns SDS_OK on success, SDS_ERR_FAIL on error. * Returns SDS_OK on success, SDS_ERR_FAIL on error.
*/ */
static int sds_struct_is_valid(uintptr_t header) static int sds_struct_is_valid(unsigned int region_id, uintptr_t header)
{ {
size_t struct_size = GET_SDS_HEADER_STRUCT_SIZE(header); size_t struct_size = GET_SDS_HEADER_STRUCT_SIZE(header);
/* Zero is not a valid identifier */ /* Zero is not a valid identifier */
if (GET_SDS_HEADER_ID(header) == 0) if (GET_SDS_HEADER_ID(header) == 0) {
return SDS_ERR_FAIL; return SDS_ERR_FAIL;
}
/* Check SDS Schema version */ /* Check SDS Schema version */
if (GET_SDS_HEADER_VERSION(header) == SDS_REGION_SCH_VERSION) if (GET_SDS_HEADER_VERSION(header) == SDS_REGION_SCH_VERSION) {
return SDS_ERR_FAIL; return SDS_ERR_FAIL;
}
/* The SDS Structure sizes have to be multiple of 8 */ /* The SDS Structure sizes have to be multiple of 8 */
if ((struct_size == 0) || ((struct_size % 8) != 0)) if ((struct_size == 0) || ((struct_size % 8) != 0)) {
return SDS_ERR_FAIL; return SDS_ERR_FAIL;
}
if (struct_size > sds_mem_size) if (struct_size > sds_regions[region_id].size) {
return SDS_ERR_FAIL; return SDS_ERR_FAIL;
}
return SDS_OK; return SDS_OK;
} }
@ -57,10 +56,11 @@ static int sds_struct_is_valid(uintptr_t header)
* Validate the SDS structure headers. * Validate the SDS structure headers.
* Returns SDS_OK on success, SDS_ERR_FAIL on error. * Returns SDS_OK on success, SDS_ERR_FAIL on error.
*/ */
static int validate_sds_struct_headers(void) static int validate_sds_struct_headers(unsigned int region_id)
{ {
unsigned int i, structure_count; unsigned int i, structure_count;
uintptr_t header; uintptr_t header;
uintptr_t sds_mem_base = sds_regions[region_id].base;
structure_count = GET_SDS_REGION_STRUCTURE_COUNT(sds_mem_base); structure_count = GET_SDS_REGION_STRUCTURE_COUNT(sds_mem_base);
@ -71,7 +71,7 @@ static int validate_sds_struct_headers(void)
/* Iterate over structure headers and validate each one */ /* Iterate over structure headers and validate each one */
for (i = 0; i < structure_count; i++) { for (i = 0; i < structure_count; i++) {
if (sds_struct_is_valid(header) != SDS_OK) { if (sds_struct_is_valid(region_id, header) != SDS_OK) {
WARN("SDS: Invalid structure header detected\n"); WARN("SDS: Invalid structure header detected\n");
return SDS_ERR_FAIL; return SDS_ERR_FAIL;
} }
@ -84,10 +84,12 @@ static int validate_sds_struct_headers(void)
* Get the structure header pointer corresponding to the structure ID. * Get the structure header pointer corresponding to the structure ID.
* Returns SDS_OK on success, SDS_ERR_STRUCT_NOT_FOUND on error. * Returns SDS_OK on success, SDS_ERR_STRUCT_NOT_FOUND on error.
*/ */
static int get_struct_header(uint32_t structure_id, struct_header_t **header) static int get_struct_header(unsigned int region_id, uint32_t structure_id,
struct_header_t **header)
{ {
unsigned int i, structure_count; unsigned int i, structure_count;
uintptr_t current_header; uintptr_t current_header;
uintptr_t sds_mem_base = sds_regions[region_id].base;
assert(header); assert(header);
@ -116,12 +118,14 @@ static int get_struct_header(uint32_t structure_id, struct_header_t **header)
* Returns SDS_OK if structure header exists else SDS_ERR_STRUCT_NOT_FOUND * Returns SDS_OK if structure header exists else SDS_ERR_STRUCT_NOT_FOUND
* if not found. * if not found.
*/ */
int sds_struct_exists(unsigned int structure_id) int sds_struct_exists(unsigned int region_id, unsigned int structure_id)
{ {
struct_header_t *header = NULL; struct_header_t *header = NULL;
int ret; int ret;
ret = get_struct_header(structure_id, &header); assert(region_id < sds_region_cnt);
ret = get_struct_header(region_id, structure_id, &header);
if (ret == SDS_OK) { if (ret == SDS_OK) {
assert(header); assert(header);
} }
@ -136,18 +140,21 @@ int sds_struct_exists(unsigned int structure_id)
* The `data` is the pointer to store the read data of size specified by `size`. * The `data` is the pointer to store the read data of size specified by `size`.
* Returns SDS_OK on success or corresponding error codes on failure. * Returns SDS_OK on success or corresponding error codes on failure.
*/ */
int sds_struct_read(uint32_t structure_id, unsigned int fld_off, int sds_struct_read(unsigned int region_id, uint32_t structure_id,
void *data, size_t size, sds_access_mode_t mode) unsigned int fld_off, void *data, size_t size,
sds_access_mode_t mode)
{ {
int status; int status;
uintptr_t field_base; uintptr_t field_base;
struct_header_t *header = NULL; struct_header_t *header = NULL;
assert(region_id < sds_region_cnt);
if (!data) if (!data)
return SDS_ERR_INVALID_PARAMS; return SDS_ERR_INVALID_PARAMS;
/* Check if a structure with this ID exists */ /* Check if a structure with this ID exists */
status = get_struct_header(structure_id, &header); status = get_struct_header(region_id, structure_id, &header);
if (status != SDS_OK) if (status != SDS_OK)
return status; return status;
@ -182,18 +189,21 @@ int sds_struct_read(uint32_t structure_id, unsigned int fld_off,
* The `data` is the pointer to data of size specified by `size`. * The `data` is the pointer to data of size specified by `size`.
* Returns SDS_OK on success or corresponding error codes on failure. * Returns SDS_OK on success or corresponding error codes on failure.
*/ */
int sds_struct_write(uint32_t structure_id, unsigned int fld_off, int sds_struct_write(unsigned int region_id, uint32_t structure_id,
void *data, size_t size, sds_access_mode_t mode) unsigned int fld_off, void *data, size_t size,
sds_access_mode_t mode)
{ {
int status; int status;
uintptr_t field_base; uintptr_t field_base;
struct_header_t *header = NULL; struct_header_t *header = NULL;
assert(region_id < sds_region_cnt);
if (!data) if (!data)
return SDS_ERR_INVALID_PARAMS; return SDS_ERR_INVALID_PARAMS;
/* Check if a structure with this ID exists */ /* Check if a structure with this ID exists */
status = get_struct_header(structure_id, &header); status = get_struct_header(region_id, structure_id, &header);
if (status != SDS_OK) if (status != SDS_OK)
return status; return status;
@ -226,12 +236,18 @@ int sds_struct_write(uint32_t structure_id, unsigned int fld_off,
/* /*
* Initialize the SDS driver. Also verifies the SDS version and sanity of * Initialize the SDS driver. Also verifies the SDS version and sanity of
* the SDS structure headers. * the SDS structure headers in the given SDS region.
* Returns SDS_OK on success, SDS_ERR_FAIL on error. * Returns SDS_OK on success, SDS_ERR_FAIL on error.
*/ */
int sds_init(void) int sds_init(unsigned int region_id)
{ {
sds_mem_base = (uintptr_t)PLAT_ARM_SDS_MEM_BASE; if (sds_regions == NULL) {
sds_regions = plat_sds_get_regions(&sds_region_cnt);
}
assert(region_id < sds_region_cnt);
uintptr_t sds_mem_base = sds_regions[region_id].base;
if (!IS_SDS_REGION_VALID(sds_mem_base)) { if (!IS_SDS_REGION_VALID(sds_mem_base)) {
WARN("SDS: No valid SDS Memory Region found\n"); WARN("SDS: No valid SDS Memory Region found\n");
@ -244,15 +260,16 @@ int sds_init(void)
return SDS_ERR_FAIL; return SDS_ERR_FAIL;
} }
sds_mem_size = GET_SDS_REGION_SIZE(sds_mem_base); sds_regions[region_id].size = GET_SDS_REGION_SIZE(sds_mem_base);
if (sds_mem_size > PLAT_ARM_SDS_MEM_SIZE_MAX) { if (sds_regions[region_id].size > PLAT_ARM_SDS_MEM_SIZE_MAX) {
WARN("SDS: SDS Memory Region exceeds size limit\n"); WARN("SDS: SDS Memory Region exceeds size limit\n");
return SDS_ERR_FAIL; return SDS_ERR_FAIL;
} }
INFO("SDS: Detected SDS Memory Region (%zu bytes)\n", sds_mem_size); INFO("SDS: Detected SDS Memory Region (%zu bytes)\n",
sds_regions[region_id].size);
if (validate_sds_struct_headers() != SDS_OK) if (validate_sds_struct_headers(region_id) != SDS_OK)
return SDS_ERR_FAIL; return SDS_ERR_FAIL;
return SDS_OK; return SDS_OK;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -79,12 +79,33 @@ typedef enum {
SDS_ACCESS_MODE_CACHED, SDS_ACCESS_MODE_CACHED,
} sds_access_mode_t; } sds_access_mode_t;
int sds_init(void); /*
int sds_struct_exists(unsigned int structure_id); * The following structure describes a SDS memory region. Its items are used
int sds_struct_read(uint32_t structure_id, unsigned int fld_off, void *data, * to track and maintain the state of the memory region reserved for usage
size_t size, sds_access_mode_t mode); * by the SDS framework.
int sds_struct_write(uint32_t structure_id, unsigned int fld_off, void *data, *
size_t size, sds_access_mode_t mode); * The base address of the SDS memory region is platform specific. The
* SDS description structure must already contain the address when it is
* returned by the plat_sds_get_regions() platform API during SDS region
* initialization.
* The size of the SDS memory region is dynamically discovered during the
* initialization of the region and written into the 'size' item of the
* SDS description structure.
*/
typedef struct {
uintptr_t base; /* Pointer to the base of the SDS memory region */
size_t size; /* Size of the SDS memory region in bytes */
} sds_region_desc_t;
/* API to get the platform specific SDS region description(s) */
sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count);
int sds_init(unsigned int region_id);
int sds_struct_exists(unsigned int region_id, unsigned int structure_id);
int sds_struct_read(unsigned int region_id, uint32_t structure_id,
unsigned int fld_off, void *data, size_t size, sds_access_mode_t mode);
int sds_struct_write(unsigned int region_id, uint32_t structure_id,
unsigned int fld_off, void *data, size_t size, sds_access_mode_t mode);
#endif /*__ASSEMBLER__ */ #endif /*__ASSEMBLER__ */
#endif /* SDS_H */ #endif /* SDS_H */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -75,6 +75,7 @@
* The SCMI Channel is placed right after the SDS region * The SCMI Channel is placed right after the SDS region
*/ */
#define CSS_SCMI_PAYLOAD_BASE (PLAT_ARM_SDS_MEM_BASE + PLAT_ARM_SDS_MEM_SIZE_MAX) #define CSS_SCMI_PAYLOAD_BASE (PLAT_ARM_SDS_MEM_BASE + PLAT_ARM_SDS_MEM_SIZE_MAX)
#define CSS_SCMI_PAYLOAD_SIZE_MAX 0x100 /* 2x128 bytes for bidirectional communication */
#define CSS_SCMI_MHU_DB_REG_OFF MHU_CPU_INTR_S_SET_OFFSET #define CSS_SCMI_MHU_DB_REG_OFF MHU_CPU_INTR_S_SET_OFFSET
/* Trusted mailbox base address common to all CSS */ /* Trusted mailbox base address common to all CSS */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014-2023, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2014-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -246,12 +246,14 @@
/* MHU related constants */ /* MHU related constants */
#define PLAT_CSS_MHU_BASE UL(0x2b1f0000) #define PLAT_CSS_MHU_BASE UL(0x2b1f0000)
#if CSS_USE_SCMI_SDS_DRIVER
/* Index of SDS region used in the communication between AP and SCP */
#define SDS_SCP_AP_REGION_ID U(0)
#else
/* /*
* Base address of the first memory region used for communication between AP * Base address of the first memory region used for communication between AP
* and SCP. Used by the BOM and SCPI protocols. * and SCP. Used by the BOM and SCPI protocols.
*/ *
#if !CSS_USE_SCMI_SDS_DRIVER
/*
* Note that this is located at the same address as SCP_BOOT_CFG_ADDR, which * Note that this is located at the same address as SCP_BOOT_CFG_ADDR, which
* means the SCP/AP configuration data gets overwritten when the AP initiates * means the SCP/AP configuration data gets overwritten when the AP initiates
* communication with the SCP. The configuration data is expected to be a * communication with the SCP. The configuration data is expected to be a
@ -261,7 +263,7 @@
#define PLAT_CSS_SCP_COM_SHARED_MEM_BASE (ARM_TRUSTED_SRAM_BASE + UL(0x80)) #define PLAT_CSS_SCP_COM_SHARED_MEM_BASE (ARM_TRUSTED_SRAM_BASE + UL(0x80))
#define PLAT_CSS_PRIMARY_CPU_SHIFT 8 #define PLAT_CSS_PRIMARY_CPU_SHIFT 8
#define PLAT_CSS_PRIMARY_CPU_BIT_WIDTH 4 #define PLAT_CSS_PRIMARY_CPU_BIT_WIDTH 4
#endif #endif /* CSS_USE_SCMI_SDS_DRIVER */
/* /*
* SCP_BL2 uses up whatever remaining space is available as it is loaded before * SCP_BL2 uses up whatever remaining space is available as it is loaded before

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -32,13 +32,14 @@ static int is_watchdog_reset(void)
int ret; int ret;
uint32_t scp_reset_synd_flags; uint32_t scp_reset_synd_flags;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SCP SDS initialization failed\n"); ERROR("SCP SDS initialization failed\n");
panic(); panic();
} }
ret = sds_struct_read(SDS_RESET_SYNDROME_STRUCT_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
SDS_RESET_SYNDROME_STRUCT_ID,
SDS_RESET_SYNDROME_OFFSET, SDS_RESET_SYNDROME_OFFSET,
&scp_reset_synd_flags, &scp_reset_synd_flags,
SDS_RESET_SYNDROME_SIZE, SDS_RESET_SYNDROME_SIZE,

View file

@ -1,14 +1,16 @@
/* /*
* Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <drivers/arm/css/sds.h>
#include <lib/smccc.h> #include <lib/smccc.h>
#include <platform_def.h> #include <lib/utils_def.h>
#include <services/arm_arch_svc.h> #include <services/arm_arch_svc.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <platform_def.h>
/* /*
* Table of memory regions for different BL stages to map using the MMU. * Table of memory regions for different BL stages to map using the MMU.
@ -138,3 +140,16 @@ int32_t plat_get_soc_revision(void)
return (int32_t)(((sys_id >> V2M_SYS_ID_REV_SHIFT) & return (int32_t)(((sys_id >> V2M_SYS_ID_REV_SHIFT) &
V2M_SYS_ID_REV_MASK) & SOC_ID_REV_MASK); V2M_SYS_ID_REV_MASK) & SOC_ID_REV_MASK);
} }
#if CSS_USE_SCMI_SDS_DRIVER
static sds_region_desc_t juno_sds_regions[] = {
{ .base = PLAT_ARM_SDS_MEM_BASE },
};
sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
{
*region_count = ARRAY_SIZE(juno_sds_regions);
return juno_sds_regions;
}
#endif /* CSS_USE_SCMI_SDS_DRIVER */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2023, Arm Limited. All rights reserved. * Copyright (c) 2020-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -59,6 +59,10 @@
#if CSS_USE_SCMI_SDS_DRIVER #if CSS_USE_SCMI_SDS_DRIVER
#define MORELLO_SCMI_PAYLOAD_BASE ULL(0x45400000) #define MORELLO_SCMI_PAYLOAD_BASE ULL(0x45400000)
/*
* Index of SDS region used in the communication with SCP
*/
#define SDS_SCP_AP_REGION_ID U(0)
#else #else
#define PLAT_CSS_SCP_COM_SHARED_MEM_BASE ULL(0x45400000) #define PLAT_CSS_SCP_COM_SHARED_MEM_BASE ULL(0x45400000)
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021-2023, Arm Limited. All rights reserved. * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -155,13 +155,14 @@ void bl2_platform_setup(void)
int ret; int ret;
struct morello_plat_info plat_info; struct morello_plat_info plat_info;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SDS initialization failed. ret:%d\n", ret); ERROR("SDS initialization failed. ret:%d\n", ret);
panic(); panic();
} }
ret = sds_struct_read(MORELLO_SDS_PLATFORM_INFO_STRUCT_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
MORELLO_SDS_PLATFORM_INFO_STRUCT_ID,
MORELLO_SDS_PLATFORM_INFO_OFFSET, MORELLO_SDS_PLATFORM_INFO_OFFSET,
&plat_info, &plat_info,
MORELLO_SDS_PLATFORM_INFO_SIZE, MORELLO_SDS_PLATFORM_INFO_SIZE,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2023, Arm Limited. All rights reserved. * Copyright (c) 2020-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -43,13 +43,14 @@ void bl31_platform_setup(void)
#ifdef TARGET_PLATFORM_SOC #ifdef TARGET_PLATFORM_SOC
int ret; int ret;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SDS initialization failed. ret:%d\n", ret); ERROR("SDS initialization failed. ret:%d\n", ret);
panic(); panic();
} }
ret = sds_struct_read(MORELLO_SDS_PLATFORM_INFO_STRUCT_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
MORELLO_SDS_PLATFORM_INFO_STRUCT_ID,
MORELLO_SDS_PLATFORM_INFO_OFFSET, MORELLO_SDS_PLATFORM_INFO_OFFSET,
&plat_info, &plat_info,
MORELLO_SDS_PLATFORM_INFO_SIZE, MORELLO_SDS_PLATFORM_INFO_SIZE,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021-2023, Arm Limited. All rights reserved. * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -13,6 +13,7 @@
#include "morello_def.h" #include "morello_def.h"
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <platform_def.h>
/* In client mode, a part of the DDR memory is reserved for Tag bits. /* In client mode, a part of the DDR memory is reserved for Tag bits.
* Calculate the usable memory size after subtracting the Tag memory. * Calculate the usable memory size after subtracting the Tag memory.
@ -167,13 +168,14 @@ bl_params_t *plat_get_next_bl_params(void)
struct morello_plat_info plat_info; struct morello_plat_info plat_info;
struct morello_firmware_version fw_version; struct morello_firmware_version fw_version;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SDS initialization failed. ret:%d\n", ret); ERROR("SDS initialization failed. ret:%d\n", ret);
panic(); panic();
} }
ret = sds_struct_read(MORELLO_SDS_PLATFORM_INFO_STRUCT_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
MORELLO_SDS_PLATFORM_INFO_STRUCT_ID,
MORELLO_SDS_PLATFORM_INFO_OFFSET, MORELLO_SDS_PLATFORM_INFO_OFFSET,
&plat_info, &plat_info,
MORELLO_SDS_PLATFORM_INFO_SIZE, MORELLO_SDS_PLATFORM_INFO_SIZE,
@ -183,7 +185,8 @@ bl_params_t *plat_get_next_bl_params(void)
panic(); panic();
} }
ret = sds_struct_read(MORELLO_SDS_FIRMWARE_VERSION_STRUCT_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
MORELLO_SDS_FIRMWARE_VERSION_STRUCT_ID,
MORELLO_SDS_FIRMWARE_VERSION_OFFSET, MORELLO_SDS_FIRMWARE_VERSION_OFFSET,
&fw_version, &fw_version,
MORELLO_SDS_FIRMWARE_VERSION_SIZE, MORELLO_SDS_FIRMWARE_VERSION_SIZE,

View file

@ -1,12 +1,14 @@
/* /*
* Copyright (c) 2020-2023, Arm Limited. All rights reserved. * Copyright (c) 2020-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <assert.h> #include <assert.h>
#include <drivers/arm/css/sds.h>
#include <drivers/arm/sbsa.h> #include <drivers/arm/sbsa.h>
#include <lib/utils_def.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include "morello_def.h" #include "morello_def.h"
@ -68,3 +70,16 @@ void plat_arm_secure_wdt_stop(void)
{ {
sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE); sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE);
} }
#if CSS_USE_SCMI_SDS_DRIVER
static sds_region_desc_t morello_sds_regions[] = {
{ .base = PLAT_ARM_SDS_MEM_BASE },
};
sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
{
*region_count = ARRAY_SIZE(morello_sds_regions);
return morello_sds_regions;
}
#endif /* CSS_USE_SCMI_SDS_DRIVER */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2023, Arm Limited. All rights reserved. * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -77,6 +77,10 @@
#if CSS_USE_SCMI_SDS_DRIVER #if CSS_USE_SCMI_SDS_DRIVER
#define N1SDP_SCMI_PAYLOAD_BASE 0x45400000 #define N1SDP_SCMI_PAYLOAD_BASE 0x45400000
/*
* Index of SDS region used in the communication with SCP
*/
#define SDS_SCP_AP_REGION_ID U(0)
#else #else
#define PLAT_CSS_SCP_COM_SHARED_MEM_BASE 0x45400000 #define PLAT_CSS_SCP_COM_SHARED_MEM_BASE 0x45400000
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, Arm Limited. All rights reserved. * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -11,6 +11,7 @@
#include "n1sdp_def.h" #include "n1sdp_def.h"
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <platform_def.h>
struct n1sdp_plat_info { struct n1sdp_plat_info {
bool multichip_mode; bool multichip_mode;
@ -60,13 +61,14 @@ void bl2_platform_setup(void)
int ret; int ret;
struct n1sdp_plat_info plat_info; struct n1sdp_plat_info plat_info;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SDS initialization failed\n"); ERROR("SDS initialization failed\n");
panic(); panic();
} }
ret = sds_struct_read(N1SDP_SDS_PLATFORM_INFO_STRUCT_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
N1SDP_SDS_PLATFORM_INFO_STRUCT_ID,
N1SDP_SDS_PLATFORM_INFO_OFFSET, N1SDP_SDS_PLATFORM_INFO_OFFSET,
&plat_info, &plat_info,
N1SDP_SDS_PLATFORM_INFO_SIZE, N1SDP_SDS_PLATFORM_INFO_SIZE,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2023, Arm Limited. All rights reserved. * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -127,13 +127,14 @@ void bl31_platform_setup(void)
int ret; int ret;
struct n1sdp_plat_info plat_info; struct n1sdp_plat_info plat_info;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SDS initialization failed\n"); ERROR("SDS initialization failed\n");
panic(); panic();
} }
ret = sds_struct_read(N1SDP_SDS_PLATFORM_INFO_STRUCT_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
N1SDP_SDS_PLATFORM_INFO_STRUCT_ID,
N1SDP_SDS_PLATFORM_INFO_OFFSET, N1SDP_SDS_PLATFORM_INFO_OFFSET,
&plat_info, &plat_info,
N1SDP_SDS_PLATFORM_INFO_SIZE, N1SDP_SDS_PLATFORM_INFO_SIZE,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2022, Arm Limited. All rights reserved. * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -13,6 +13,7 @@
#include "n1sdp_def.h" #include "n1sdp_def.h"
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <platform_def.h>
/* /*
* Platform information structure stored in SDS. * Platform information structure stored in SDS.
@ -108,13 +109,14 @@ bl_params_t *plat_get_next_bl_params(void)
int ret; int ret;
struct n1sdp_plat_info plat_info; struct n1sdp_plat_info plat_info;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SDS initialization failed. ret:%d\n", ret); ERROR("SDS initialization failed. ret:%d\n", ret);
panic(); panic();
} }
ret = sds_struct_read(N1SDP_SDS_PLATFORM_INFO_STRUCT_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
N1SDP_SDS_PLATFORM_INFO_STRUCT_ID,
N1SDP_SDS_PLATFORM_INFO_OFFSET, N1SDP_SDS_PLATFORM_INFO_OFFSET,
&plat_info, &plat_info,
N1SDP_SDS_PLATFORM_INFO_SIZE, N1SDP_SDS_PLATFORM_INFO_SIZE,

View file

@ -1,12 +1,14 @@
/* /*
* Copyright (c) 2018-2023, Arm Limited. All rights reserved. * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <assert.h> #include <assert.h>
#include <drivers/arm/css/sds.h>
#include <drivers/arm/sbsa.h> #include <drivers/arm/sbsa.h>
#include <lib/utils_def.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include "n1sdp_def.h" #include "n1sdp_def.h"
@ -71,3 +73,16 @@ void plat_arm_secure_wdt_stop(void)
{ {
sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE); sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE);
} }
#if CSS_USE_SCMI_SDS_DRIVER
static sds_region_desc_t n1sdp_sds_regions[] = {
{ .base = PLAT_ARM_SDS_MEM_BASE },
};
sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
{
*region_count = ARRAY_SIZE(n1sdp_sds_regions);
return n1sdp_sds_regions;
}
#endif /* CSS_USE_SCMI_SDS_DRIVER */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2023, Arm Limited. All rights reserved. * Copyright (c) 2020-2024, Arm Limited. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -240,6 +240,17 @@
#define PLAT_ARM_SCMI_CHANNEL_COUNT 1 #define PLAT_ARM_SCMI_CHANNEL_COUNT 1
/* Index of SDS region used in the communication with SCP */
#define SDS_SCP_AP_REGION_ID U(0)
/* Index of SDS region used in the communication with RSS */
#define SDS_RSS_AP_REGION_ID U(1)
/*
* Memory region for RSS's shared data storage (SDS)
* It is placed right after the SCMI payload area.
*/
#define PLAT_ARM_RSS_AP_SDS_MEM_BASE (CSS_SCMI_PAYLOAD_BASE + \
CSS_SCMI_PAYLOAD_SIZE_MAX)
#define PLAT_ARM_CLUSTER_COUNT U(1) #define PLAT_ARM_CLUSTER_COUNT U(1)
#define PLAT_MAX_CPUS_PER_CLUSTER U(8) #define PLAT_MAX_CPUS_PER_CLUSTER U(8)
#define PLAT_MAX_PE_PER_CPU U(1) #define PLAT_MAX_PE_PER_CPU U(1)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved. * Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -12,6 +12,8 @@
#include <common/bl_common.h> #include <common/bl_common.h>
#include <common/debug.h> #include <common/debug.h>
#include <drivers/arm/ccn.h> #include <drivers/arm/ccn.h>
#include <drivers/arm/css/sds.h>
#include <lib/utils_def.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <drivers/arm/sbsa.h> #include <drivers/arm/sbsa.h>
@ -159,3 +161,15 @@ void plat_arm_secure_wdt_refresh(void)
{ {
sbsa_wdog_refresh(SBSA_SECURE_WDOG_REFRESH_BASE); sbsa_wdog_refresh(SBSA_SECURE_WDOG_REFRESH_BASE);
} }
static sds_region_desc_t tc_sds_regions[] = {
{ .base = PLAT_ARM_SDS_MEM_BASE },
{ .base = PLAT_ARM_RSS_AP_SDS_MEM_BASE },
};
sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
{
*region_count = ARRAY_SIZE(tc_sds_regions);
return tc_sds_regions;
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2023, Arm Limited and Contributors. All rights reserved. * Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -298,6 +298,8 @@
#endif #endif
/* Index of SDS region used in the communication with SCP */
#define SDS_SCP_AP_REGION_ID U(0)
/* SDS ID for unusable CPU MPID list structure */ /* SDS ID for unusable CPU MPID list structure */
#define SDS_ISOLATED_CPU_LIST_ID U(128) #define SDS_ISOLATED_CPU_LIST_ID U(128)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2022, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -30,13 +30,14 @@ void plat_arm_sgi_get_isolated_cpu_list(struct isolated_cpu_mpid_list *list)
{ {
int ret; int ret;
ret = sds_init(); ret = sds_init(SDS_SCP_AP_REGION_ID);
if (ret != SDS_OK) { if (ret != SDS_OK) {
ERROR("SDS initialization failed, error: %d\n", ret); ERROR("SDS initialization failed, error: %d\n", ret);
panic(); panic();
} }
ret = sds_struct_read(SDS_ISOLATED_CPU_LIST_ID, 0, &list->num_entries, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
SDS_ISOLATED_CPU_LIST_ID, 0, &list->num_entries,
sizeof(list->num_entries), SDS_ACCESS_MODE_CACHED); sizeof(list->num_entries), SDS_ACCESS_MODE_CACHED);
if (ret != SDS_OK) { if (ret != SDS_OK) {
INFO("SDS CPU num elements read failed, error: %d\n", ret); INFO("SDS CPU num elements read failed, error: %d\n", ret);
@ -54,7 +55,8 @@ void plat_arm_sgi_get_isolated_cpu_list(struct isolated_cpu_mpid_list *list)
return; return;
} }
ret = sds_struct_read(SDS_ISOLATED_CPU_LIST_ID, ret = sds_struct_read(SDS_SCP_AP_REGION_ID,
SDS_ISOLATED_CPU_LIST_ID,
sizeof(list->num_entries), sizeof(list->num_entries),
&list->mpid_list, &list->mpid_list,
sizeof(list->mpid_list[0]) * list->num_entries, sizeof(list->mpid_list[0]) * list->num_entries,
@ -152,4 +154,3 @@ bl_params_t *plat_get_next_bl_params(void)
return arm_get_next_bl_params(); return arm_get_next_bl_params();
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018-2023, Arm Limited and Contributors. All rights reserved. * Copyright (c) 2018-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -11,6 +11,8 @@
#include <common/bl_common.h> #include <common/bl_common.h>
#include <common/debug.h> #include <common/debug.h>
#include <drivers/arm/ccn.h> #include <drivers/arm/ccn.h>
#include <drivers/arm/css/sds.h>
#include <lib/utils_def.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <drivers/arm/sbsa.h> #include <drivers/arm/sbsa.h>
@ -174,3 +176,14 @@ void plat_arm_secure_wdt_stop(void)
{ {
sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE); sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE);
} }
static sds_region_desc_t sgi_sds_regions[] = {
{ .base = PLAT_ARM_SDS_MEM_BASE },
};
sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
{
*region_count = ARRAY_SIZE(sgi_sds_regions);
return sgi_sds_regions;
}

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021-2023, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -8,9 +8,11 @@
#include <platform_def.h> #include <platform_def.h>
#include <lib/utils_def.h>
#include <drivers/arm/css/sds.h>
#include <drivers/arm/sbsa.h>
#include <plat/arm/common/plat_arm.h> #include <plat/arm/common/plat_arm.h>
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <drivers/arm/sbsa.h>
#if SPM_MM #if SPM_MM
#include <services/spm_mm_partition.h> #include <services/spm_mm_partition.h>
@ -176,3 +178,14 @@ void plat_arm_secure_wdt_stop(void)
{ {
sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE); sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE);
} }
static sds_region_desc_t sgi_sds_regions[] = {
{ .base = PLAT_ARM_SDS_MEM_BASE },
};
sds_region_desc_t *plat_sds_get_regions(unsigned int *region_count)
{
*region_count = ARRAY_SIZE(sgi_sds_regions);
return sgi_sds_regions;
}