Unverified Commit 31abc7c4 authored by Antonio Niño Díaz's avatar Antonio Niño Díaz Committed by GitHub
Browse files

Merge pull request #1638 from chandnich/sgi575-update

Sgi575 update
parents deca6584 8c7b55f9
...@@ -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,16 +4,15 @@ ...@@ -4,16 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <bl_common.h> #ifndef PLATFORM_DEF_H
#include <debug.h> #define PLATFORM_DEF_H
#include <plat_arm.h>
#include <sgi_plat_config.h>
#include <soc_css.h>
void bl1_early_platform_setup(void) #include <sgi_base_platform_def.h>
{
/* Initialize the platform configuration structure */
plat_config_init();
arm_bl1_early_platform_setup(); #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 */
...@@ -6,9 +6,31 @@ ...@@ -6,9 +6,31 @@
include plat/arm/css/sgi/sgi-common.mk 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 \ BL2_SOURCES += lib/utils/mem_region.c \
plat/arm/common/arm_nor_psci_mem_protect.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 \ lib/utils/mem_region.c \
plat/arm/common/arm_nor_psci_mem_protect.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))
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#ifndef PLATFORM_DEF_H #ifndef SGI_BASE_PLATFORM_DEF_H
#define PLATFORM_DEF_H #define SGI_BASE_PLATFORM_DEF_H
#include <arm_def.h> #include <arm_def.h>
#include <arm_spm_def.h> #include <arm_spm_def.h>
...@@ -17,11 +17,6 @@ ...@@ -17,11 +17,6 @@
#include <v2m_def.h> #include <v2m_def.h>
#include <xlat_tables_defs.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 * \ #define PLATFORM_CORE_COUNT (PLAT_ARM_CLUSTER_COUNT * \
CSS_SGI_MAX_CPUS_PER_CLUSTER * \ CSS_SGI_MAX_CPUS_PER_CLUSTER * \
CSS_SGI_MAX_PE_PER_CPU) CSS_SGI_MAX_PE_PER_CPU)
...@@ -118,8 +113,6 @@ ...@@ -118,8 +113,6 @@
#define PLAT_ARM_NSTIMER_FRAME_ID 0 #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_BASE 0x0
#define PLAT_ARM_TRUSTED_ROM_SIZE 0x00080000 /* 512KB */ #define PLAT_ARM_TRUSTED_ROM_SIZE 0x00080000 /* 512KB */
...@@ -216,4 +209,4 @@ ...@@ -216,4 +209,4 @@
V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE) V2M_FLASH0_SIZE - V2M_FLASH_BLOCK_SIZE)
#endif /* PLATFORM_DEF_H */ #endif /* SGI_BASE_PLATFORM_DEF_H */
/*
* 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__ */
...@@ -22,8 +22,6 @@ INTERCONNECT_SOURCES := ${CSS_ENT_BASE}/sgi_interconnect.c ...@@ -22,8 +22,6 @@ INTERCONNECT_SOURCES := ${CSS_ENT_BASE}/sgi_interconnect.c
PLAT_INCLUDES += -I${CSS_ENT_BASE}/include 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 \ ENT_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
drivers/arm/gic/v3/gicv3_main.c \ drivers/arm/gic/v3/gicv3_main.c \
drivers/arm/gic/v3/gicv3_helpers.c \ drivers/arm/gic/v3/gicv3_helpers.c \
...@@ -35,38 +33,20 @@ ENT_GIC_SOURCES := drivers/arm/gic/common/gic_common.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 \ PLAT_BL_COMMON_SOURCES += ${CSS_ENT_BASE}/sgi_plat.c \
${CSS_ENT_BASE}/aarch64/sgi_helper.S ${CSS_ENT_BASE}/aarch64/sgi_helper.S
BL1_SOURCES += ${INTERCONNECT_SOURCES} \ BL1_SOURCES += ${INTERCONNECT_SOURCES}
${ENT_CPU_SOURCES} \
${CSS_ENT_BASE}/sgi_bl1_setup.c \
${CSS_ENT_BASE}/sgi_plat_config.c
BL2_SOURCES += ${CSS_ENT_BASE}/sgi_security.c \ BL2_SOURCES += ${CSS_ENT_BASE}/sgi_security.c \
${CSS_ENT_BASE}/sgi_image_load.c ${CSS_ENT_BASE}/sgi_image_load.c
BL31_SOURCES += ${ENT_CPU_SOURCES} \ BL31_SOURCES += ${INTERCONNECT_SOURCES} \
${INTERCONNECT_SOURCES} \
${ENT_GIC_SOURCES} \ ${ENT_GIC_SOURCES} \
${CSS_ENT_BASE}/sgi_bl31_setup.c \ ${CSS_ENT_BASE}/sgi_bl31_setup.c \
${CSS_ENT_BASE}/sgi_topology.c \ ${CSS_ENT_BASE}/sgi_topology.c
${CSS_ENT_BASE}/sgi_plat_config.c
ifeq (${RAS_EXTENSION},1) ifeq (${RAS_EXTENSION},1)
BL31_SOURCES += ${CSS_ENT_BASE}/sgi_ras.c BL31_SOURCES += ${CSS_ENT_BASE}/sgi_ras.c
endif 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) ifneq (${RESET_TO_BL31},0)
$(error "Using BL31 as the reset vector is not supported on ${PLATFORM} platform. \ $(error "Using BL31 as the reset vector is not supported on ${PLATFORM} platform. \
Please set RESET_TO_BL31 to 0.") Please set RESET_TO_BL31 to 0.")
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <bl_common.h> #include <bl_common.h>
#include <debug.h> #include <debug.h>
#include <plat_arm.h> #include <plat_arm.h>
#include <sgi_plat_config.h>
#include <sgi_ras.h> #include <sgi_ras.h>
#include "../../css/drivers/scmi/scmi.h" #include "../../css/drivers/scmi/scmi.h"
#include "../../css/drivers/mhu/css_mhu_doorbell.h" #include "../../css/drivers/mhu/css_mhu_doorbell.h"
...@@ -28,9 +27,6 @@ scmi_channel_plat_info_t *plat_css_get_scmi_info() ...@@ -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, void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3) 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); arm_bl31_early_platform_setup((void *)arg0, arg1, arg2, (void *)arg3);
} }
......
...@@ -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;
} }
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <arch_helpers.h> #include <arch_helpers.h>
#include <debug.h> #include <debug.h>
#include <sgi_plat_config.h>
/* /*
* For SGI575 which support FCM (with automatic interconnect enter/exit), * For SGI575 which support FCM (with automatic interconnect enter/exit),
......
/*
* 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;
}
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
*/ */
#include <plat_arm.h> #include <plat_arm.h>
#include <sgi_plat_config.h>
/* Topology */ /* Topology */
/* /*
...@@ -20,18 +19,12 @@ const unsigned char sgi_pd_tree_desc[] = { ...@@ -20,18 +19,12 @@ const unsigned char sgi_pd_tree_desc[] = {
CSS_SGI_MAX_CPUS_PER_CLUSTER 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. * This function returns the topology tree information.
******************************************************************************/ ******************************************************************************/
const unsigned char *plat_get_power_domain_tree_desc(void) 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) ...@@ -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) 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;
} }
/******************************************************************************* /*******************************************************************************
......
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