diff --git a/plat/arm/board/sgi575/fdts/sgi575.dts b/plat/arm/board/sgi575/fdts/sgi575.dts new file mode 100644 index 0000000000000000000000000000000000000000..1e1ea14b0ee7a705441aa9837e1f2f22c535f764 --- /dev/null +++ b/plat/arm/board/sgi575/fdts/sgi575.dts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/dts-v1/; +/ { + /* compatible string */ + 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>; + }; +}; diff --git a/plat/arm/css/sgi/fdts/sgi575_tb_fw_config.dts b/plat/arm/board/sgi575/fdts/sgi575_tb_fw_config.dts similarity index 100% rename from plat/arm/css/sgi/fdts/sgi575_tb_fw_config.dts rename to plat/arm/board/sgi575/fdts/sgi575_tb_fw_config.dts diff --git a/plat/arm/board/sgi575/include/platform_def.h b/plat/arm/board/sgi575/include/platform_def.h new file mode 100644 index 0000000000000000000000000000000000000000..1870fc78aed86a1e830d8d8c7702b62fb2327006 --- /dev/null +++ b/plat/arm/board/sgi575/include/platform_def.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef PLATFORM_DEF_H +#define PLATFORM_DEF_H + +#include <sgi_base_platform_def.h> + +#define PLAT_ARM_CLUSTER_COUNT 2 +#define CSS_SGI_MAX_CPUS_PER_CLUSTER 4 +#define CSS_SGI_MAX_PE_PER_CPU 1 + +#define PLAT_CSS_MHU_BASE 0x45000000 + +#endif /* PLATFORM_DEF_H */ diff --git a/plat/arm/board/sgi575/platform.mk b/plat/arm/board/sgi575/platform.mk index 078f393c96208ae180cc4123eccd0fa27f54358a..8df8b1292a1764400bfee12c1d136d20a143b2df 100644 --- a/plat/arm/board/sgi575/platform.mk +++ b/plat/arm/board/sgi575/platform.mk @@ -6,9 +6,31 @@ include plat/arm/css/sgi/sgi-common.mk +SGI575_BASE = plat/arm/board/sgi575 + +PLAT_INCLUDES += -I${SGI575_BASE}/include/ + +SGI_CPU_SOURCES := lib/cpus/aarch64/cortex_a75.S + +BL1_SOURCES += ${SGI_CPU_SOURCES} + BL2_SOURCES += lib/utils/mem_region.c \ plat/arm/common/arm_nor_psci_mem_protect.c -BL31_SOURCES += drivers/cfi/v2m/v2m_flash.c \ +BL31_SOURCES += ${SGI_CPU_SOURCES} \ + drivers/cfi/v2m/v2m_flash.c \ lib/utils/mem_region.c \ plat/arm/common/arm_nor_psci_mem_protect.c + +# Add the FDT_SOURCES and options for Dynamic Config +FDT_SOURCES += ${SGI575_BASE}/fdts/${PLAT}_tb_fw_config.dts +TB_FW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb + +# Add the TB_FW_CONFIG to FIP and specify the same to certtool +$(eval $(call TOOL_ADD_PAYLOAD,${TB_FW_CONFIG},--tb-fw-config)) + +FDT_SOURCES += ${SGI575_BASE}/fdts/${PLAT}.dts +HW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}.dtb + +# Add the HW_CONFIG to FIP and specify the same to certtool +$(eval $(call TOOL_ADD_PAYLOAD,${HW_CONFIG},--hw-config)) diff --git a/plat/arm/css/sgi/fdts/sgi575.dts b/plat/arm/css/sgi/fdts/sgi575.dts deleted file mode 100644 index be9920cbc8aaf30b782c96762a3616ff6e0d0b0c..0000000000000000000000000000000000000000 --- a/plat/arm/css/sgi/fdts/sgi575.dts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -/dts-v1/; -/ { - /* compatible string */ - compatible = "arm,sgi575"; -}; diff --git a/plat/arm/css/sgi/include/platform_def.h b/plat/arm/css/sgi/include/sgi_base_platform_def.h similarity index 96% rename from plat/arm/css/sgi/include/platform_def.h rename to plat/arm/css/sgi/include/sgi_base_platform_def.h index 629749056f836d2e37754a688025c5f427651658..90eb3360b7b73616792d1e291962a335ff182ebd 100644 --- a/plat/arm/css/sgi/include/platform_def.h +++ b/plat/arm/css/sgi/include/sgi_base_platform_def.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef PLATFORM_DEF_H -#define PLATFORM_DEF_H +#ifndef SGI_BASE_PLATFORM_DEF_H +#define SGI_BASE_PLATFORM_DEF_H #include <arm_def.h> #include <arm_spm_def.h> @@ -17,11 +17,6 @@ #include <v2m_def.h> #include <xlat_tables_defs.h> -#define CSS_SGI_MAX_CPUS_PER_CLUSTER 4 - -/* CPU topology */ -#define PLAT_ARM_CLUSTER_COUNT 2 -#define CSS_SGI_MAX_PE_PER_CPU 1 #define PLATFORM_CORE_COUNT (PLAT_ARM_CLUSTER_COUNT * \ CSS_SGI_MAX_CPUS_PER_CLUSTER * \ CSS_SGI_MAX_PE_PER_CPU) @@ -118,8 +113,6 @@ #define PLAT_ARM_NSTIMER_FRAME_ID 0 -#define PLAT_CSS_MHU_BASE 0x45000000 - #define PLAT_ARM_TRUSTED_ROM_BASE 0x0 #define PLAT_ARM_TRUSTED_ROM_SIZE 0x00080000 /* 512KB */ @@ -216,4 +209,4 @@ V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE) -#endif /* PLATFORM_DEF_H */ +#endif /* SGI_BASE_PLATFORM_DEF_H */ diff --git a/plat/arm/css/sgi/include/sgi_plat_config.h b/plat/arm/css/sgi/include/sgi_plat_config.h deleted file mode 100644 index 9b29d74e4ecfba99ef9054eb3e6c16fec21cca4e..0000000000000000000000000000000000000000 --- a/plat/arm/css/sgi/include/sgi_plat_config.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef __SGI_PLAT_CONFIG_H__ -#define __SGI_PLAT_CONFIG_H__ - -#include <ccn.h> -#include <gicv3.h> - -/* The type of interconnect */ -typedef enum { - ARM_CCI = 0, - ARM_CCN, - ARM_CMN -} css_inteconn_type_t; - -typedef ccn_desc_t inteconn_desc_t; - -/* Interconnect configurations */ -typedef struct css_inteconn_config { - css_inteconn_type_t ip_type; - const inteconn_desc_t *plat_inteconn_desc; -} css_inteconn_config_t; - -/* Topology configurations */ -typedef struct css_topology { - const unsigned char *power_tree; - unsigned int plat_cluster_core_count; -} css_topology_t; - -typedef struct css_plat_config { - const gicv3_driver_data_t *gic_data; - const css_inteconn_config_t *inteconn; - const css_topology_t *topology; -} css_plat_config_t; - -void plat_config_init(void); -css_plat_config_t *get_plat_config(void); - -#endif /* __SGI_PLAT_CONFIG_H__ */ diff --git a/plat/arm/css/sgi/sgi-common.mk b/plat/arm/css/sgi/sgi-common.mk index 24f03dd4b0edc2b3b8bf1eb9409d77481a2894bf..d6e5448de1542cc22c054fbd9f41ff2284ca6f4c 100644 --- a/plat/arm/css/sgi/sgi-common.mk +++ b/plat/arm/css/sgi/sgi-common.mk @@ -22,8 +22,6 @@ INTERCONNECT_SOURCES := ${CSS_ENT_BASE}/sgi_interconnect.c PLAT_INCLUDES += -I${CSS_ENT_BASE}/include -ENT_CPU_SOURCES := lib/cpus/aarch64/cortex_a75.S - ENT_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \ drivers/arm/gic/v3/gicv3_main.c \ drivers/arm/gic/v3/gicv3_helpers.c \ @@ -35,38 +33,20 @@ ENT_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \ PLAT_BL_COMMON_SOURCES += ${CSS_ENT_BASE}/sgi_plat.c \ ${CSS_ENT_BASE}/aarch64/sgi_helper.S -BL1_SOURCES += ${INTERCONNECT_SOURCES} \ - ${ENT_CPU_SOURCES} \ - ${CSS_ENT_BASE}/sgi_bl1_setup.c \ - ${CSS_ENT_BASE}/sgi_plat_config.c +BL1_SOURCES += ${INTERCONNECT_SOURCES} BL2_SOURCES += ${CSS_ENT_BASE}/sgi_security.c \ ${CSS_ENT_BASE}/sgi_image_load.c -BL31_SOURCES += ${ENT_CPU_SOURCES} \ - ${INTERCONNECT_SOURCES} \ +BL31_SOURCES += ${INTERCONNECT_SOURCES} \ ${ENT_GIC_SOURCES} \ ${CSS_ENT_BASE}/sgi_bl31_setup.c \ - ${CSS_ENT_BASE}/sgi_topology.c \ - ${CSS_ENT_BASE}/sgi_plat_config.c + ${CSS_ENT_BASE}/sgi_topology.c ifeq (${RAS_EXTENSION},1) BL31_SOURCES += ${CSS_ENT_BASE}/sgi_ras.c endif -# Add the FDT_SOURCES and options for Dynamic Config -FDT_SOURCES += ${CSS_ENT_BASE}/fdts/${PLAT}_tb_fw_config.dts -TB_FW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}_tb_fw_config.dtb - -# Add the TB_FW_CONFIG to FIP and specify the same to certtool -$(eval $(call TOOL_ADD_PAYLOAD,${TB_FW_CONFIG},--tb-fw-config)) - -FDT_SOURCES += ${CSS_ENT_BASE}/fdts/${PLAT}.dts -HW_CONFIG := ${BUILD_PLAT}/fdts/${PLAT}.dtb - -# Add the HW_CONFIG to FIP and specify the same to certtool -$(eval $(call TOOL_ADD_PAYLOAD,${HW_CONFIG},--hw-config)) - ifneq (${RESET_TO_BL31},0) $(error "Using BL31 as the reset vector is not supported on ${PLATFORM} platform. \ Please set RESET_TO_BL31 to 0.") diff --git a/plat/arm/css/sgi/sgi_bl1_setup.c b/plat/arm/css/sgi/sgi_bl1_setup.c deleted file mode 100644 index d3d98d92a05465aadc7d6b7db0d4c7b35c7723a4..0000000000000000000000000000000000000000 --- a/plat/arm/css/sgi/sgi_bl1_setup.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <bl_common.h> -#include <debug.h> -#include <plat_arm.h> -#include <sgi_plat_config.h> -#include <soc_css.h> - -void bl1_early_platform_setup(void) -{ - /* Initialize the platform configuration structure */ - plat_config_init(); - - arm_bl1_early_platform_setup(); -} diff --git a/plat/arm/css/sgi/sgi_bl31_setup.c b/plat/arm/css/sgi/sgi_bl31_setup.c index 3b651f3dcb4b7e8fb56bf9b335173f3829ffcf35..a16343cf0b653319a95eb5ed85409e89ca420212 100644 --- a/plat/arm/css/sgi/sgi_bl31_setup.c +++ b/plat/arm/css/sgi/sgi_bl31_setup.c @@ -7,7 +7,6 @@ #include <bl_common.h> #include <debug.h> #include <plat_arm.h> -#include <sgi_plat_config.h> #include <sgi_ras.h> #include "../../css/drivers/scmi/scmi.h" #include "../../css/drivers/mhu/css_mhu_doorbell.h" @@ -28,9 +27,6 @@ scmi_channel_plat_info_t *plat_css_get_scmi_info() void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) { - /* Initialize the platform configuration structure */ - plat_config_init(); - arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3); } diff --git a/plat/arm/css/sgi/sgi_image_load.c b/plat/arm/css/sgi/sgi_image_load.c index 09403f8846ee8136fc8d2a9edc099de6eff843fc..52dcf889e07607a79baf1227567c69cbf9ad2cc2 100644 --- a/plat/arm/css/sgi/sgi_image_load.c +++ b/plat/arm/css/sgi/sgi_image_load.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include <arch_helpers.h> #include <debug.h> #include <desc_image_load.h> #include <libfdt.h> @@ -13,6 +14,7 @@ * This function inserts Platform information via device tree nodes as, * system-id { * platform-id = <0>; + * config-id = <0>; * } ******************************************************************************/ 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; void *fdt; int nodeoffset, err; - unsigned int platid = 0; + unsigned int platid = 0, platcfg = 0; char *platform_name; mem_params = get_bl_mem_params_node(HW_CONFIG_ID); @@ -45,31 +47,34 @@ static int plat_sgi_append_config_node(void) } 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 { WARN("Invalid platform\n"); return -1; } - /* Increase DTB blob by 512 byte */ - err = fdt_open_into(fdt, fdt, mem_params->image_info.image_size + 512); - if (err < 0) { - ERROR("Failed to open HW_CONFIG DTB\n"); + nodeoffset = fdt_subnode_offset(fdt, 0, "system-id"); + if (nodeoffset < 0) { + ERROR("Failed to get system-id node offset\n"); return -1; } - /* Create "/system-id" node */ - nodeoffset = fdt_add_subnode(fdt, 0, "system-id"); - if (nodeoffset < 0) { - ERROR("Failed to add node system-id\n"); + err = fdt_setprop_u32(fdt, nodeoffset, "platform-id", platid); + if (err < 0) { + ERROR("Failed to set platform-id\n"); return -1; } - err = fdt_setprop_u32(fdt, nodeoffset, "platform-id", platid); + err = fdt_setprop_u32(fdt, nodeoffset, "config-id", platcfg); if (err < 0) { - ERROR("Failed to add node platform-id\n"); + ERROR("Failed to set config-id\n"); return -1; } + + flush_dcache_range((uintptr_t)fdt, mem_params->image_info.image_size); + return 0; } diff --git a/plat/arm/css/sgi/sgi_interconnect.c b/plat/arm/css/sgi/sgi_interconnect.c index 325b5b1523e5ce8496fd6a1ec44cfaa30e164aa2..074f8a2745726a1875d21409857fc65f887ff216 100644 --- a/plat/arm/css/sgi/sgi_interconnect.c +++ b/plat/arm/css/sgi/sgi_interconnect.c @@ -6,7 +6,6 @@ #include <arch_helpers.h> #include <debug.h> -#include <sgi_plat_config.h> /* * For SGI575 which support FCM (with automatic interconnect enter/exit), diff --git a/plat/arm/css/sgi/sgi_plat_config.c b/plat/arm/css/sgi/sgi_plat_config.c deleted file mode 100644 index 29b99a3c26339f856d5ee97f50d73447fde9f331..0000000000000000000000000000000000000000 --- a/plat/arm/css/sgi/sgi_plat_config.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <assert.h> -#include <debug.h> -#include <plat_arm.h> -#include <platform_def.h> -#include <sgi_variant.h> -#include <sgi_plat_config.h> -#include <string.h> - -static css_plat_config_t *css_plat_info; - -/* GIC */ -/* The GICv3 driver only needs to be initialized in EL3 */ -uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT]; - -/* Interconnect configuration for SGI575 */ -const css_inteconn_config_t sgi575_inteconn = { - .ip_type = ARM_CMN, - .plat_inteconn_desc = NULL -}; - -/* Configuration structure for SGI575 */ -css_plat_config_t sgi575_config = { - .inteconn = &sgi575_inteconn, -}; - -/******************************************************************************* - * This function initializes the platform sturcture. - ******************************************************************************/ -void plat_config_init(void) -{ - /* Get the platform configurations */ - switch (GET_SGI_PART_NUM) { - case SGI575_SSC_VER_PART_NUM: - css_plat_info = &sgi575_config; - break; - default: - ERROR("Not a valid sgi variant!\n"); - panic(); - } -} - -/******************************************************************************* - * This function returns the platform structure pointer. - ******************************************************************************/ -css_plat_config_t *get_plat_config(void) -{ - assert(css_plat_info != NULL); - return css_plat_info; -} diff --git a/plat/arm/css/sgi/sgi_topology.c b/plat/arm/css/sgi/sgi_topology.c index 3f6357bd1a96e5e55eb3588f0e071ef3cc171334..3b7a57ad2169c41774a45464c6bb24d676a207f7 100644 --- a/plat/arm/css/sgi/sgi_topology.c +++ b/plat/arm/css/sgi/sgi_topology.c @@ -5,7 +5,6 @@ */ #include <plat_arm.h> -#include <sgi_plat_config.h> /* Topology */ /* @@ -20,18 +19,12 @@ const unsigned char sgi_pd_tree_desc[] = { CSS_SGI_MAX_CPUS_PER_CLUSTER }; -/* Topology configuration for sgi platform */ -const css_topology_t sgi_topology = { - .power_tree = sgi_pd_tree_desc, - .plat_cluster_core_count = CSS_SGI_MAX_CPUS_PER_CLUSTER -}; - /******************************************************************************* * This function returns the topology tree information. ******************************************************************************/ const unsigned char *plat_get_power_domain_tree_desc(void) { - return sgi_topology.power_tree; + return sgi_pd_tree_desc; } /******************************************************************************* @@ -40,7 +33,7 @@ const unsigned char *plat_get_power_domain_tree_desc(void) ******************************************************************************/ unsigned int plat_arm_get_cluster_core_count(u_register_t mpidr) { - return sgi_topology.plat_cluster_core_count; + return CSS_SGI_MAX_CPUS_PER_CLUSTER; } /*******************************************************************************