GK SDK 源码库: XMIPCLinuxV100R005C00SPC030 (kernel/tools/open_source excluded)
This commit is contained in:
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <arch.h>
|
||||
#include <asm_macros.S>
|
||||
#include <cpu_macros.S>
|
||||
#include <rainier.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
.globl plat_arm_calc_core_pos
|
||||
.globl plat_reset_handler
|
||||
|
||||
/* -----------------------------------------------------
|
||||
* unsigned int plat_arm_calc_core_pos(u_register_t mpidr)
|
||||
*
|
||||
* Helper function to calculate the core position.
|
||||
* ((ChipId * MORELLO_MAX_CLUSTERS_PER_CHIP + ClusterId) *
|
||||
* MORELLO_MAX_CPUS_PER_CLUSTER * MORELLO_MAX_PE_PER_CPU) +
|
||||
* (CPUId * MORELLO_MAX_PE_PER_CPU) + ThreadId
|
||||
*
|
||||
* which can be simplified as:
|
||||
*
|
||||
* (((ChipId * MORELLO_MAX_CLUSTERS_PER_CHIP + ClusterId) *
|
||||
* MORELLO_MAX_CPUS_PER_CLUSTER + CPUId) * MORELLO_MAX_PE_PER_CPU) +
|
||||
* ThreadId
|
||||
* ------------------------------------------------------
|
||||
*/
|
||||
|
||||
func plat_arm_calc_core_pos
|
||||
mov x4, x0
|
||||
|
||||
/*
|
||||
* The MT bit in MPIDR is always set for morello and the
|
||||
* affinity level 0 corresponds to thread affinity level.
|
||||
*/
|
||||
|
||||
/* Extract individual affinity fields from MPIDR */
|
||||
ubfx x0, x4, #MPIDR_AFF0_SHIFT, #MPIDR_AFFINITY_BITS
|
||||
ubfx x1, x4, #MPIDR_AFF1_SHIFT, #MPIDR_AFFINITY_BITS
|
||||
ubfx x2, x4, #MPIDR_AFF2_SHIFT, #MPIDR_AFFINITY_BITS
|
||||
ubfx x3, x4, #MPIDR_AFF3_SHIFT, #MPIDR_AFFINITY_BITS
|
||||
|
||||
/* Compute linear position */
|
||||
mov x4, #MORELLO_MAX_CLUSTERS_PER_CHIP
|
||||
madd x2, x3, x4, x2
|
||||
mov x4, #MORELLO_MAX_CPUS_PER_CLUSTER
|
||||
madd x1, x2, x4, x1
|
||||
mov x4, #MORELLO_MAX_PE_PER_CPU
|
||||
madd x0, x1, x4, x0
|
||||
ret
|
||||
endfunc plat_arm_calc_core_pos
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <common/tbbr/tbbr_img_def.h>
|
||||
|
||||
/dts-v1/;
|
||||
/ {
|
||||
dtb-registry {
|
||||
compatible = "fconf,dyn_cfg-dtb_registry";
|
||||
|
||||
tb_fw-config {
|
||||
load-address = <0x0 0x4001300>;
|
||||
max-size = <0x200>;
|
||||
id = <TB_FW_CONFIG_ID>;
|
||||
};
|
||||
|
||||
nt_fw-config {
|
||||
load-address = <0x0 0xFEF00000>;
|
||||
max-size = <0x0100000>;
|
||||
id = <NT_FW_CONFIG_ID>;
|
||||
};
|
||||
};
|
||||
};
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/ {
|
||||
/* compatible string */
|
||||
compatible = "arm,morello";
|
||||
|
||||
/*
|
||||
* Place holder for platform-info node with default values.
|
||||
* The values will be set to the correct values during
|
||||
* the BL2 stage of boot.
|
||||
*/
|
||||
platform-info {
|
||||
local-ddr-size = <0x0 0x0>;
|
||||
#ifdef TARGET_PLATFORM_SOC
|
||||
remote-ddr-size = <0x0 0x0>;
|
||||
remote-chip-count = <0x0>;
|
||||
multichip-mode = <0x0>;
|
||||
scc-config = <0x0>;
|
||||
#endif
|
||||
};
|
||||
};
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
/ {
|
||||
tb_fw-config {
|
||||
compatible = "arm,tb_fw";
|
||||
|
||||
/* Disable authentication for development */
|
||||
disable_auth = <0x0>;
|
||||
|
||||
/*
|
||||
* The following two entries are placeholders for Mbed TLS
|
||||
* heap information. The default values don't matter since
|
||||
* they will be overwritten by BL1.
|
||||
* In case of having shared Mbed TLS heap between BL1 and BL2,
|
||||
* BL1 will populate these two properties with the respective
|
||||
* info about the shared heap. This info will be available for
|
||||
* BL2 in order to locate and re-use the heap.
|
||||
*/
|
||||
mbedtls_heap_addr = <0x0 0x0>;
|
||||
mbedtls_heap_size = <0x0>;
|
||||
};
|
||||
};
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef PLAT_MACROS_S
|
||||
#define PLAT_MACROS_S
|
||||
|
||||
#include <css_macros.S>
|
||||
|
||||
/* ---------------------------------------------
|
||||
* The below required platform porting macro
|
||||
* prints out relevant platform registers
|
||||
* whenever an unhandled exception is taken in
|
||||
* BL31.
|
||||
*
|
||||
* There are currently no platform specific regs
|
||||
* to print.
|
||||
* ---------------------------------------------
|
||||
*/
|
||||
.macro plat_crash_print_regs
|
||||
.endm
|
||||
|
||||
#endif /* PLAT_MACROS_S */
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_DEF_H
|
||||
#define PLATFORM_DEF_H
|
||||
|
||||
#include <plat/arm/board/common/v2m_def.h>
|
||||
#include <plat/arm/common/arm_def.h>
|
||||
#include <plat/arm/css/common/css_def.h>
|
||||
|
||||
/* UART related constants */
|
||||
#define PLAT_ARM_BOOT_UART_BASE ULL(0x2A400000)
|
||||
#define PLAT_ARM_BOOT_UART_CLK_IN_HZ U(50000000)
|
||||
|
||||
/* IOFPGA UART0 */
|
||||
#define PLAT_ARM_RUN_UART_BASE ULL(0x1C090000)
|
||||
#define PLAT_ARM_RUN_UART_CLK_IN_HZ U(24000000)
|
||||
|
||||
#define PLAT_ARM_CRASH_UART_BASE PLAT_ARM_RUN_UART_BASE
|
||||
#define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_ARM_RUN_UART_CLK_IN_HZ
|
||||
|
||||
#define PLAT_ARM_DRAM2_BASE ULL(0x8080000000)
|
||||
#define PLAT_ARM_DRAM2_SIZE ULL(0xF80000000)
|
||||
|
||||
#define MAX_IO_DEVICES U(3)
|
||||
#define MAX_IO_HANDLES U(4)
|
||||
|
||||
#define PLAT_ARM_FLASH_IMAGE_BASE ULL(0x1A000000)
|
||||
#define PLAT_ARM_FLASH_IMAGE_MAX_SIZE ULL(0x01000000)
|
||||
|
||||
#define PLAT_ARM_NVM_BASE ULL(0x1A000000)
|
||||
#define PLAT_ARM_NVM_SIZE ULL(0x01000000)
|
||||
|
||||
#if defined NS_BL1U_BASE
|
||||
#undef NS_BL1U_BASE
|
||||
#define NS_BL1U_BASE (PLAT_ARM_NVM_BASE + UL(0x00800000))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* There are no non-volatile counters in morello, these macros points
|
||||
* to unused addresses.
|
||||
*/
|
||||
#define SOC_TRUSTED_NVCTR_BASE ULL(0x7FE70000)
|
||||
#define TFW_NVCTR_BASE (SOC_TRUSTED_NVCTR_BASE + U(0x0000))
|
||||
#define TFW_NVCTR_SIZE U(4)
|
||||
#define NTFW_CTR_BASE (SOC_TRUSTED_NVCTR_BASE + U(0x0004))
|
||||
#define NTFW_CTR_SIZE U(4)
|
||||
|
||||
/*
|
||||
* To access the complete DDR memory along with remote chip's DDR memory,
|
||||
* which is at 4 TB offset, physical and virtual address space limits are
|
||||
* extended to 43-bits.
|
||||
*/
|
||||
#define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 43)
|
||||
#define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 43)
|
||||
|
||||
#if CSS_USE_SCMI_SDS_DRIVER
|
||||
#define MORELLO_SCMI_PAYLOAD_BASE ULL(0x45400000)
|
||||
#else
|
||||
#define PLAT_CSS_SCP_COM_SHARED_MEM_BASE ULL(0x45400000)
|
||||
#endif
|
||||
|
||||
#define PLAT_ARM_TRUSTED_SRAM_SIZE UL(0x00080000)
|
||||
|
||||
/*
|
||||
* PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
|
||||
* plus a little space for growth.
|
||||
*/
|
||||
#define PLAT_ARM_MAX_BL1_RW_SIZE UL(0xC000)
|
||||
|
||||
/*
|
||||
* PLAT_ARM_MAX_ROMLIB_RW_SIZE is define to use a full page
|
||||
*/
|
||||
|
||||
#if USE_ROMLIB
|
||||
#define PLAT_ARM_MAX_ROMLIB_RW_SIZE UL(0x1000)
|
||||
#define PLAT_ARM_MAX_ROMLIB_RO_SIZE UL(0xE000)
|
||||
#else
|
||||
#define PLAT_ARM_MAX_ROMLIB_RW_SIZE U(0)
|
||||
#define PLAT_ARM_MAX_ROMLIB_RO_SIZE U(0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
|
||||
* little space for growth.
|
||||
*/
|
||||
#if TRUSTED_BOARD_BOOT
|
||||
# define PLAT_ARM_MAX_BL2_SIZE UL(0x1D000)
|
||||
#else
|
||||
# define PLAT_ARM_MAX_BL2_SIZE UL(0x14000)
|
||||
#endif
|
||||
|
||||
#define PLAT_ARM_MAX_BL31_SIZE UL(0x3B000)
|
||||
|
||||
/*******************************************************************************
|
||||
* MORELLO topology related constants
|
||||
******************************************************************************/
|
||||
#define MORELLO_MAX_CPUS_PER_CLUSTER U(2)
|
||||
#define PLAT_ARM_CLUSTER_COUNT U(2)
|
||||
#define PLAT_MORELLO_CHIP_COUNT U(1)
|
||||
#define MORELLO_MAX_CLUSTERS_PER_CHIP U(2)
|
||||
#define MORELLO_MAX_PE_PER_CPU U(1)
|
||||
|
||||
#define PLATFORM_CORE_COUNT (PLAT_MORELLO_CHIP_COUNT * \
|
||||
PLAT_ARM_CLUSTER_COUNT * \
|
||||
MORELLO_MAX_CPUS_PER_CLUSTER * \
|
||||
MORELLO_MAX_PE_PER_CPU)
|
||||
|
||||
/* System power domain level */
|
||||
#define CSS_SYSTEM_PWR_DMN_LVL ARM_PWR_LVL3
|
||||
|
||||
/*
|
||||
* PLAT_ARM_MMAP_ENTRIES depends on the number of entries in the
|
||||
* plat_arm_mmap array defined for each BL stage.
|
||||
*/
|
||||
#if IMAGE_BL1 || IMAGE_BL31
|
||||
# define PLAT_ARM_MMAP_ENTRIES U(6)
|
||||
# define MAX_XLAT_TABLES U(7)
|
||||
#else
|
||||
# define PLAT_ARM_MMAP_ENTRIES U(5)
|
||||
# define MAX_XLAT_TABLES U(6)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Size of cacheable stacks
|
||||
*/
|
||||
#if defined(IMAGE_BL1)
|
||||
# if TRUSTED_BOARD_BOOT
|
||||
# define PLATFORM_STACK_SIZE UL(0x1000)
|
||||
# else
|
||||
# define PLATFORM_STACK_SIZE UL(0x440)
|
||||
# endif
|
||||
#elif defined(IMAGE_BL2)
|
||||
# if TRUSTED_BOARD_BOOT
|
||||
# define PLATFORM_STACK_SIZE UL(0x1000)
|
||||
# else
|
||||
# define PLATFORM_STACK_SIZE UL(0x400)
|
||||
# endif
|
||||
#elif defined(IMAGE_BL2U)
|
||||
# define PLATFORM_STACK_SIZE UL(0x400)
|
||||
#elif defined(IMAGE_BL31)
|
||||
# if SPM_MM
|
||||
# define PLATFORM_STACK_SIZE UL(0x500)
|
||||
# else
|
||||
# define PLATFORM_STACK_SIZE UL(0x400)
|
||||
# endif
|
||||
#elif defined(IMAGE_BL32)
|
||||
# define PLATFORM_STACK_SIZE UL(0x440)
|
||||
#endif
|
||||
|
||||
#define PLAT_ARM_NSTIMER_FRAME_ID U(0)
|
||||
|
||||
#define PLAT_ARM_TRUSTED_ROM_BASE U(0x0)
|
||||
#define PLAT_ARM_TRUSTED_ROM_SIZE UL(0x00020000) /* 128KB */
|
||||
|
||||
#define PLAT_ARM_NSRAM_BASE ULL(0x06000000)
|
||||
#define PLAT_ARM_NSRAM_SIZE UL(0x00010000) /* 64KB */
|
||||
|
||||
#define PLAT_CSS_MHU_BASE UL(0x45000000)
|
||||
#define PLAT_MHUV2_BASE PLAT_CSS_MHU_BASE
|
||||
#define PLAT_MAX_PWR_LVL U(2)
|
||||
|
||||
#define PLAT_ARM_G1S_IRQ_PROPS(grp) CSS_G1S_IRQ_PROPS(grp)
|
||||
#define PLAT_ARM_G0_IRQ_PROPS(grp) ARM_G0_IRQ_PROPS(grp)
|
||||
|
||||
#define MORELLO_DEVICE_BASE ULL(0x08000000)
|
||||
#define MORELLO_DEVICE_SIZE ULL(0x48000000)
|
||||
|
||||
/*Secure Watchdog Constants */
|
||||
#define SBSA_SECURE_WDOG_BASE UL(0x2A480000)
|
||||
#define SBSA_SECURE_WDOG_TIMEOUT UL(1000)
|
||||
|
||||
#define MORELLO_MAP_DEVICE MAP_REGION_FLAT( \
|
||||
MORELLO_DEVICE_BASE, \
|
||||
MORELLO_DEVICE_SIZE, \
|
||||
MT_DEVICE | MT_RW | MT_SECURE)
|
||||
|
||||
#define ARM_MAP_DRAM1 MAP_REGION_FLAT( \
|
||||
ARM_DRAM1_BASE, \
|
||||
ARM_DRAM1_SIZE, \
|
||||
MT_MEMORY | MT_RW | MT_NS)
|
||||
|
||||
/* GIC related constants */
|
||||
#define PLAT_ARM_GICD_BASE UL(0x30000000)
|
||||
#define PLAT_ARM_GICC_BASE UL(0x2C000000)
|
||||
#define PLAT_ARM_GICR_BASE UL(0x300C0000)
|
||||
|
||||
/* Number of SCMI channels on the platform */
|
||||
#define PLAT_ARM_SCMI_CHANNEL_COUNT U(1)
|
||||
|
||||
#endif /* PLATFORM_DEF_H */
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
|
||||
/*******************************************************************************
|
||||
* Perform any BL1 specific platform actions.
|
||||
******************************************************************************/
|
||||
|
||||
void soc_css_init_nic400(void)
|
||||
{
|
||||
}
|
||||
|
||||
void soc_css_init_pcie(void)
|
||||
{
|
||||
}
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <common/debug.h>
|
||||
#include <drivers/arm/css/sds.h>
|
||||
#include <lib/mmio.h>
|
||||
#include <lib/utils.h>
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
|
||||
#include "morello_def.h"
|
||||
#include <platform_def.h>
|
||||
|
||||
#ifdef TARGET_PLATFORM_FVP
|
||||
/*
|
||||
* Platform information structure stored in SDS.
|
||||
* This structure holds information about platform's DDR
|
||||
* size
|
||||
* - Local DDR size in bytes, DDR memory in main board
|
||||
*/
|
||||
struct morello_plat_info {
|
||||
uint64_t local_ddr_size;
|
||||
} __packed;
|
||||
#else
|
||||
/*
|
||||
* Platform information structure stored in SDS.
|
||||
* This structure holds information about platform's DDR
|
||||
* size which is an information about multichip setup
|
||||
* - Local DDR size in bytes, DDR memory in main board
|
||||
* - Remote DDR size in bytes, DDR memory in remote board
|
||||
* - remote_chip_count
|
||||
* - multichip mode
|
||||
* - scc configuration
|
||||
*/
|
||||
struct morello_plat_info {
|
||||
uint64_t local_ddr_size;
|
||||
uint64_t remote_ddr_size;
|
||||
uint8_t remote_chip_count;
|
||||
bool multichip_mode;
|
||||
uint32_t scc_config;
|
||||
} __packed;
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
|
||||
#ifdef TARGET_PLATFORM_SOC
|
||||
/*
|
||||
* Morello platform supports RDIMMs with ECC capability. To use the ECC
|
||||
* capability, the entire DDR memory space has to be zeroed out before
|
||||
* enabling the ECC bits in DMC-Bing. Zeroing out several gigabytes of
|
||||
* memory from SCP is quite time consuming so the following function
|
||||
* is added to zero out the DDR memory from application processor which is
|
||||
* much faster compared to SCP.
|
||||
*/
|
||||
|
||||
static void dmc_ecc_setup(struct morello_plat_info *plat_info)
|
||||
{
|
||||
uint64_t dram2_size;
|
||||
uint32_t val;
|
||||
uint64_t tag_mem_base;
|
||||
uint64_t usable_mem_size;
|
||||
|
||||
INFO("Total DIMM size: %uGB\n",
|
||||
(uint32_t)(plat_info->local_ddr_size / 0x40000000));
|
||||
|
||||
assert(plat_info->local_ddr_size > ARM_DRAM1_SIZE);
|
||||
dram2_size = plat_info->local_ddr_size - ARM_DRAM1_SIZE;
|
||||
|
||||
INFO("Zeroing DDR memory range 0x80000000 - 0xFFFFFFFF\n");
|
||||
zero_normalmem((void *)ARM_DRAM1_BASE, ARM_DRAM1_SIZE);
|
||||
flush_dcache_range(ARM_DRAM1_BASE, ARM_DRAM1_SIZE);
|
||||
|
||||
INFO("Zeroing DDR memory range 0x%llx - 0x%llx\n",
|
||||
ARM_DRAM2_BASE, ARM_DRAM2_BASE + dram2_size);
|
||||
zero_normalmem((void *)ARM_DRAM2_BASE, dram2_size);
|
||||
flush_dcache_range(ARM_DRAM2_BASE, dram2_size);
|
||||
|
||||
/* Clear previous ECC errors while zeroing out the memory */
|
||||
val = mmio_read_32(MORELLO_DMC0_ERR2STATUS_REG);
|
||||
mmio_write_32(MORELLO_DMC0_ERR2STATUS_REG, val);
|
||||
|
||||
val = mmio_read_32(MORELLO_DMC1_ERR2STATUS_REG);
|
||||
mmio_write_32(MORELLO_DMC1_ERR2STATUS_REG, val);
|
||||
|
||||
/* Set DMCs to CONFIG state before writing ERR0CTLR0 register */
|
||||
mmio_write_32(MORELLO_DMC0_MEMC_CMD_REG, MORELLO_DMC_MEMC_CMD_CONFIG);
|
||||
mmio_write_32(MORELLO_DMC1_MEMC_CMD_REG, MORELLO_DMC_MEMC_CMD_CONFIG);
|
||||
|
||||
while ((mmio_read_32(MORELLO_DMC0_MEMC_STATUS_REG) &
|
||||
MORELLO_DMC_MEMC_STATUS_MASK) !=
|
||||
MORELLO_DMC_MEMC_CMD_CONFIG) {
|
||||
continue;
|
||||
}
|
||||
|
||||
while ((mmio_read_32(MORELLO_DMC1_MEMC_STATUS_REG) &
|
||||
MORELLO_DMC_MEMC_STATUS_MASK) !=
|
||||
MORELLO_DMC_MEMC_CMD_CONFIG) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Configure Bing client/server mode based on SCC configuration */
|
||||
if (plat_info->scc_config & MORELLO_SCC_CLIENT_MODE_MASK) {
|
||||
INFO("Configuring DMC Bing in client mode\n");
|
||||
usable_mem_size = plat_info->local_ddr_size -
|
||||
(plat_info->local_ddr_size / 128ULL);
|
||||
|
||||
/* Linear DDR address */
|
||||
tag_mem_base = usable_mem_size;
|
||||
tag_mem_base = tag_mem_base / 4;
|
||||
|
||||
/* Reverse translation */
|
||||
if (tag_mem_base < ARM_DRAM1_BASE) {
|
||||
tag_mem_base += ARM_DRAM1_BASE;
|
||||
} else {
|
||||
tag_mem_base = tag_mem_base - ARM_DRAM1_BASE +
|
||||
ARM_DRAM2_BASE;
|
||||
}
|
||||
|
||||
mmio_write_32(MORELLO_DMC0_CAP_CTRL_REG, 0x1);
|
||||
mmio_write_32(MORELLO_DMC1_CAP_CTRL_REG, 0x1);
|
||||
mmio_write_32(MORELLO_DMC0_TAG_CACHE_CFG, 0x1);
|
||||
mmio_write_32(MORELLO_DMC1_TAG_CACHE_CFG, 0x1);
|
||||
|
||||
if (plat_info->scc_config & MORELLO_SCC_C1_TAG_CACHE_EN_MASK) {
|
||||
mmio_setbits_32(MORELLO_DMC0_TAG_CACHE_CFG, 0x2);
|
||||
mmio_setbits_32(MORELLO_DMC1_TAG_CACHE_CFG, 0x2);
|
||||
INFO("C1 Tag Cache Enabled\n");
|
||||
}
|
||||
|
||||
if (plat_info->scc_config & MORELLO_SCC_C2_TAG_CACHE_EN_MASK) {
|
||||
mmio_setbits_32(MORELLO_DMC0_TAG_CACHE_CFG, 0x4);
|
||||
mmio_setbits_32(MORELLO_DMC1_TAG_CACHE_CFG, 0x4);
|
||||
INFO("C2 Tag Cache Enabled\n");
|
||||
}
|
||||
|
||||
mmio_write_32(MORELLO_DMC0_MEM_ADDR_CTL,
|
||||
(uint32_t)tag_mem_base);
|
||||
mmio_write_32(MORELLO_DMC1_MEM_ADDR_CTL,
|
||||
(uint32_t)tag_mem_base);
|
||||
mmio_write_32(MORELLO_DMC0_MEM_ADDR_CTL2,
|
||||
(uint32_t)(tag_mem_base >> 32));
|
||||
mmio_write_32(MORELLO_DMC1_MEM_ADDR_CTL2,
|
||||
(uint32_t)(tag_mem_base >> 32));
|
||||
|
||||
mmio_setbits_32(MORELLO_DMC0_MEM_ACCESS_CTL,
|
||||
MORELLO_DMC_MEM_ACCESS_DIS);
|
||||
mmio_setbits_32(MORELLO_DMC1_MEM_ACCESS_CTL,
|
||||
MORELLO_DMC_MEM_ACCESS_DIS);
|
||||
|
||||
INFO("Tag base set to 0x%lx\n", tag_mem_base);
|
||||
plat_info->local_ddr_size = usable_mem_size;
|
||||
} else {
|
||||
INFO("Configuring DMC Bing in server mode\n");
|
||||
mmio_write_32(MORELLO_DMC0_CAP_CTRL_REG, 0x0);
|
||||
mmio_write_32(MORELLO_DMC1_CAP_CTRL_REG, 0x0);
|
||||
}
|
||||
|
||||
INFO("Enabling ECC on DMCs\n");
|
||||
/* Enable ECC in DMCs */
|
||||
mmio_setbits_32(MORELLO_DMC0_ERR0CTLR0_REG,
|
||||
MORELLO_DMC_ERR0CTLR0_ECC_EN);
|
||||
mmio_setbits_32(MORELLO_DMC1_ERR0CTLR0_REG,
|
||||
MORELLO_DMC_ERR0CTLR0_ECC_EN);
|
||||
|
||||
/* Set DMCs to READY state */
|
||||
mmio_write_32(MORELLO_DMC0_MEMC_CMD_REG, MORELLO_DMC_MEMC_CMD_READY);
|
||||
mmio_write_32(MORELLO_DMC1_MEMC_CMD_REG, MORELLO_DMC_MEMC_CMD_READY);
|
||||
|
||||
while ((mmio_read_32(MORELLO_DMC0_MEMC_STATUS_REG) &
|
||||
MORELLO_DMC_MEMC_STATUS_MASK) !=
|
||||
MORELLO_DMC_MEMC_CMD_READY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
while ((mmio_read_32(MORELLO_DMC1_MEMC_STATUS_REG) &
|
||||
MORELLO_DMC_MEMC_STATUS_MASK) !=
|
||||
MORELLO_DMC_MEMC_CMD_READY) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void bl2_platform_setup(void)
|
||||
{
|
||||
int ret;
|
||||
struct morello_plat_info plat_info;
|
||||
|
||||
ret = sds_init();
|
||||
if (ret != SDS_OK) {
|
||||
ERROR("SDS initialization failed. ret:%d\n", ret);
|
||||
panic();
|
||||
}
|
||||
|
||||
ret = sds_struct_read(MORELLO_SDS_PLATFORM_INFO_STRUCT_ID,
|
||||
MORELLO_SDS_PLATFORM_INFO_OFFSET,
|
||||
&plat_info,
|
||||
MORELLO_SDS_PLATFORM_INFO_SIZE,
|
||||
SDS_ACCESS_MODE_NON_CACHED);
|
||||
if (ret != SDS_OK) {
|
||||
ERROR("Error getting platform info from SDS. ret:%d\n", ret);
|
||||
panic();
|
||||
}
|
||||
|
||||
/* Validate plat_info SDS */
|
||||
#ifdef TARGET_PLATFORM_FVP
|
||||
if (plat_info.local_ddr_size == 0U) {
|
||||
#else
|
||||
if ((plat_info.local_ddr_size == 0U)
|
||||
|| (plat_info.local_ddr_size > MORELLO_MAX_DDR_CAPACITY)
|
||||
|| (plat_info.remote_ddr_size > MORELLO_MAX_DDR_CAPACITY)
|
||||
|| (plat_info.remote_chip_count > MORELLO_MAX_REMOTE_CHIP_COUNT)
|
||||
) {
|
||||
#endif
|
||||
ERROR("platform info SDS is corrupted\n");
|
||||
panic();
|
||||
}
|
||||
|
||||
#ifdef TARGET_PLATFORM_SOC
|
||||
dmc_ecc_setup(&plat_info);
|
||||
#endif
|
||||
arm_bl2_platform_setup();
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2022, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <drivers/arm/css/css_mhu_doorbell.h>
|
||||
#include <drivers/arm/css/scmi.h>
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
|
||||
#include "morello_def.h"
|
||||
#include <platform_def.h>
|
||||
|
||||
static scmi_channel_plat_info_t morello_scmi_plat_info = {
|
||||
.scmi_mbx_mem = MORELLO_SCMI_PAYLOAD_BASE,
|
||||
.db_reg_addr = PLAT_CSS_MHU_BASE + CSS_SCMI_MHU_DB_REG_OFF,
|
||||
.db_preserve_mask = 0xfffffffe,
|
||||
.db_modify_mask = 0x1,
|
||||
.ring_doorbell = &mhu_ring_doorbell
|
||||
};
|
||||
|
||||
scmi_channel_plat_info_t *plat_css_get_scmi_info(int channel_id)
|
||||
{
|
||||
return &morello_scmi_plat_info;
|
||||
}
|
||||
|
||||
const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops)
|
||||
{
|
||||
return css_scmi_override_pm_ops(ops);
|
||||
}
|
||||
|
||||
void bl31_platform_setup(void)
|
||||
{
|
||||
arm_bl31_platform_setup();
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef MORELLO_DEF_H
|
||||
#define MORELLO_DEF_H
|
||||
|
||||
/* Non-secure SRAM MMU mapping */
|
||||
#define MORELLO_NS_SRAM_BASE UL(0x06000000)
|
||||
#define MORELLO_NS_SRAM_SIZE UL(0x00010000)
|
||||
#define MORELLO_MAP_NS_SRAM MAP_REGION_FLAT( \
|
||||
MORELLO_NS_SRAM_BASE, \
|
||||
MORELLO_NS_SRAM_SIZE, \
|
||||
MT_DEVICE | MT_RW | MT_SECURE)
|
||||
|
||||
/* SDS Platform information defines */
|
||||
#define MORELLO_SDS_PLATFORM_INFO_STRUCT_ID U(8)
|
||||
#define MORELLO_SDS_PLATFORM_INFO_OFFSET U(0)
|
||||
#ifdef TARGET_PLATFORM_FVP
|
||||
# define MORELLO_SDS_PLATFORM_INFO_SIZE U(8)
|
||||
#else
|
||||
# define MORELLO_SDS_PLATFORM_INFO_SIZE U(22)
|
||||
#endif
|
||||
#define MORELLO_MAX_DDR_CAPACITY U(0x1000000000)
|
||||
#define MORELLO_MAX_REMOTE_CHIP_COUNT U(16)
|
||||
|
||||
#define MORELLO_SCC_SERVER_MODE U(0)
|
||||
#define MORELLO_SCC_CLIENT_MODE_MASK U(1)
|
||||
#define MORELLO_SCC_C1_TAG_CACHE_EN_MASK U(4)
|
||||
#define MORELLO_SCC_C2_TAG_CACHE_EN_MASK U(8)
|
||||
|
||||
/* Base address of non-secure SRAM where Platform information will be filled */
|
||||
#define MORELLO_PLATFORM_INFO_BASE UL(0x06000000)
|
||||
|
||||
/* DMC memory status registers */
|
||||
#define MORELLO_DMC0_MEMC_STATUS_REG UL(0x4E000000)
|
||||
#define MORELLO_DMC1_MEMC_STATUS_REG UL(0x4E100000)
|
||||
|
||||
#define MORELLO_DMC_MEMC_STATUS_MASK U(7)
|
||||
|
||||
/* DMC memory command registers */
|
||||
#define MORELLO_DMC0_MEMC_CMD_REG UL(0x4E000008)
|
||||
#define MORELLO_DMC1_MEMC_CMD_REG UL(0x4E100008)
|
||||
|
||||
/* DMC capability control register */
|
||||
#define MORELLO_DMC0_CAP_CTRL_REG UL(0x4E000D00)
|
||||
#define MORELLO_DMC1_CAP_CTRL_REG UL(0x4E100D00)
|
||||
|
||||
/* DMC tag cache control register */
|
||||
#define MORELLO_DMC0_TAG_CACHE_CTL UL(0x4E000D04)
|
||||
#define MORELLO_DMC1_TAG_CACHE_CTL UL(0x4E100D04)
|
||||
|
||||
/* DMC tag cache config register */
|
||||
#define MORELLO_DMC0_TAG_CACHE_CFG UL(0x4E000D08)
|
||||
#define MORELLO_DMC1_TAG_CACHE_CFG UL(0x4E100D08)
|
||||
|
||||
/* DMC memory access control register */
|
||||
#define MORELLO_DMC0_MEM_ACCESS_CTL UL(0x4E000D0C)
|
||||
#define MORELLO_DMC1_MEM_ACCESS_CTL UL(0x4E100D0C)
|
||||
|
||||
#define MORELLO_DMC_MEM_ACCESS_DIS (1UL << 16)
|
||||
|
||||
/* DMC memory address control register */
|
||||
#define MORELLO_DMC0_MEM_ADDR_CTL UL(0x4E000D10)
|
||||
#define MORELLO_DMC1_MEM_ADDR_CTL UL(0x4E100D10)
|
||||
|
||||
/* DMC memory address control 2 register */
|
||||
#define MORELLO_DMC0_MEM_ADDR_CTL2 UL(0x4E000D14)
|
||||
#define MORELLO_DMC1_MEM_ADDR_CTL2 UL(0x4E100D14)
|
||||
|
||||
/* DMC special control register */
|
||||
#define MORELLO_DMC0_SPL_CTL_REG UL(0x4E000D18)
|
||||
#define MORELLO_DMC1_SPL_CTL_REG UL(0x4E100D18)
|
||||
|
||||
/* DMC ERR0CTLR0 registers */
|
||||
#define MORELLO_DMC0_ERR0CTLR0_REG UL(0x4E000708)
|
||||
#define MORELLO_DMC1_ERR0CTLR0_REG UL(0x4E100708)
|
||||
|
||||
/* DMC ECC in ERR0CTLR0 register */
|
||||
#define MORELLO_DMC_ERR0CTLR0_ECC_EN U(9)
|
||||
|
||||
/* DMC ERR2STATUS register */
|
||||
#define MORELLO_DMC0_ERR2STATUS_REG UL(0x4E000790)
|
||||
#define MORELLO_DMC1_ERR2STATUS_REG UL(0x4E100790)
|
||||
|
||||
/* DMC memory commands */
|
||||
#define MORELLO_DMC_MEMC_CMD_CONFIG U(0)
|
||||
#define MORELLO_DMC_MEMC_CMD_READY U(3)
|
||||
|
||||
#endif /* MORELLO_DEF_H */
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
|
||||
/*
|
||||
* morello error handler
|
||||
*/
|
||||
void __dead2 plat_arm_error_handler(int err)
|
||||
{
|
||||
while (true) {
|
||||
wfi();
|
||||
}
|
||||
}
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <arch_helpers.h>
|
||||
#include <common/debug.h>
|
||||
#include <common/desc_image_load.h>
|
||||
#include <drivers/arm/css/sds.h>
|
||||
#include <libfdt.h>
|
||||
|
||||
#include "morello_def.h"
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
#include <plat/common/platform.h>
|
||||
|
||||
#ifdef TARGET_PLATFORM_FVP
|
||||
/*
|
||||
* Platform information structure stored in SDS.
|
||||
* This structure holds information about platform's DDR
|
||||
* size which is an information about multichip setup
|
||||
* - Local DDR size in bytes, DDR memory in main board
|
||||
*/
|
||||
struct morello_plat_info {
|
||||
uint64_t local_ddr_size;
|
||||
} __packed;
|
||||
#else
|
||||
/*
|
||||
* Platform information structure stored in SDS.
|
||||
* This structure holds information about platform's DDR
|
||||
* size which is an information about multichip setup
|
||||
* - Local DDR size in bytes, DDR memory in main board
|
||||
* - Remote DDR size in bytes, DDR memory in remote board
|
||||
* - remote_chip_count
|
||||
* - multichip mode
|
||||
* - scc configuration
|
||||
*/
|
||||
struct morello_plat_info {
|
||||
uint64_t local_ddr_size;
|
||||
uint64_t remote_ddr_size;
|
||||
uint8_t remote_chip_count;
|
||||
bool multichip_mode;
|
||||
uint32_t scc_config;
|
||||
} __packed;
|
||||
#endif
|
||||
|
||||
/* In client mode, a part of the DDR memory is reserved for Tag bits.
|
||||
* Calculate the usable memory size after subtracting the Tag memory.
|
||||
*/
|
||||
static inline uint64_t get_mem_client_mode(uint64_t size)
|
||||
{
|
||||
return (size - (size / 128ULL));
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* This function inserts Platform information via device tree nodes as,
|
||||
* platform-info {
|
||||
* local-ddr-size = <0x0 0x0>;
|
||||
*#ifdef TARGET_PLATFORM_SOC
|
||||
* remote-ddr-size = <0x0 0x0>;
|
||||
* remote-chip-count = <0x0>;
|
||||
* multichip-mode = <0x0>;
|
||||
* scc-config = <0x0>;
|
||||
*#endif
|
||||
* };
|
||||
******************************************************************************/
|
||||
static int plat_morello_append_config_node(struct morello_plat_info *plat_info)
|
||||
{
|
||||
bl_mem_params_node_t *mem_params;
|
||||
void *fdt;
|
||||
int nodeoffset, err;
|
||||
uint64_t usable_mem_size;
|
||||
|
||||
usable_mem_size = plat_info->local_ddr_size;
|
||||
|
||||
mem_params = get_bl_mem_params_node(NT_FW_CONFIG_ID);
|
||||
if (mem_params == NULL) {
|
||||
ERROR("NT_FW CONFIG base address is NULL\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fdt = (void *)(mem_params->image_info.image_base);
|
||||
|
||||
/* Check the validity of the fdt */
|
||||
if (fdt_check_header(fdt) != 0) {
|
||||
ERROR("Invalid NT_FW_CONFIG DTB passed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
nodeoffset = fdt_subnode_offset(fdt, 0, "platform-info");
|
||||
if (nodeoffset < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to get platform-info node offset\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef TARGET_PLATFORM_SOC
|
||||
err = fdt_setprop_u64(fdt, nodeoffset, "remote-ddr-size",
|
||||
plat_info->remote_ddr_size);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set remote-ddr-size\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset, "remote-chip-count",
|
||||
plat_info->remote_chip_count);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set remote-chip-count\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset, "multichip-mode",
|
||||
plat_info->multichip_mode);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set multichip-mode\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
err = fdt_setprop_u32(fdt, nodeoffset, "scc-config",
|
||||
plat_info->scc_config);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set scc-config\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (plat_info->scc_config & MORELLO_SCC_CLIENT_MODE_MASK) {
|
||||
usable_mem_size = get_mem_client_mode(plat_info->local_ddr_size);
|
||||
}
|
||||
#endif
|
||||
err = fdt_setprop_u64(fdt, nodeoffset, "local-ddr-size",
|
||||
usable_mem_size);
|
||||
if (err < 0) {
|
||||
ERROR("NT_FW_CONFIG: Failed to set local-ddr-size\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
flush_dcache_range((uintptr_t)fdt, mem_params->image_info.image_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* This function returns the list of executable images.
|
||||
******************************************************************************/
|
||||
bl_params_t *plat_get_next_bl_params(void)
|
||||
{
|
||||
int ret;
|
||||
struct morello_plat_info plat_info;
|
||||
|
||||
ret = sds_init();
|
||||
if (ret != SDS_OK) {
|
||||
ERROR("SDS initialization failed. ret:%d\n", ret);
|
||||
panic();
|
||||
}
|
||||
|
||||
ret = sds_struct_read(MORELLO_SDS_PLATFORM_INFO_STRUCT_ID,
|
||||
MORELLO_SDS_PLATFORM_INFO_OFFSET,
|
||||
&plat_info,
|
||||
MORELLO_SDS_PLATFORM_INFO_SIZE,
|
||||
SDS_ACCESS_MODE_NON_CACHED);
|
||||
if (ret != SDS_OK) {
|
||||
ERROR("Error getting platform info from SDS. ret:%d\n", ret);
|
||||
panic();
|
||||
}
|
||||
|
||||
/* Validate plat_info SDS */
|
||||
#ifdef TARGET_PLATFORM_FVP
|
||||
if (plat_info.local_ddr_size == 0U) {
|
||||
#else
|
||||
if ((plat_info.local_ddr_size == 0U)
|
||||
|| (plat_info.local_ddr_size > MORELLO_MAX_DDR_CAPACITY)
|
||||
|| (plat_info.remote_ddr_size > MORELLO_MAX_DDR_CAPACITY)
|
||||
|| (plat_info.remote_chip_count > MORELLO_MAX_REMOTE_CHIP_COUNT)
|
||||
){
|
||||
#endif
|
||||
ERROR("platform info SDS is corrupted\n");
|
||||
panic();
|
||||
}
|
||||
|
||||
ret = plat_morello_append_config_node(&plat_info);
|
||||
if (ret != 0) {
|
||||
panic();
|
||||
}
|
||||
|
||||
return arm_get_next_bl_params();
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* For MORELLO which supports FCM (with automatic interconnect enter/exit),
|
||||
* we should not do anything in these interface functions.
|
||||
* They are used to override the weak functions in cci drivers.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* Helper function to initialize ARM interconnect driver.
|
||||
*****************************************************************************/
|
||||
void plat_arm_interconnect_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Helper function to place current master into coherency
|
||||
*****************************************************************************/
|
||||
void plat_arm_interconnect_enter_coherency(void)
|
||||
{
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Helper function to remove current master from coherency
|
||||
*****************************************************************************/
|
||||
void plat_arm_interconnect_exit_coherency(void)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2022, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <drivers/arm/sbsa.h>
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
|
||||
#include "morello_def.h"
|
||||
|
||||
/*
|
||||
* Table of regions to map using the MMU.
|
||||
* Replace or extend the below regions as required
|
||||
*/
|
||||
#if IMAGE_BL1
|
||||
const mmap_region_t plat_arm_mmap[] = {
|
||||
ARM_MAP_SHARED_RAM,
|
||||
MORELLO_MAP_DEVICE,
|
||||
MORELLO_MAP_NS_SRAM,
|
||||
ARM_MAP_DRAM1,
|
||||
ARM_MAP_DRAM2,
|
||||
{0}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if IMAGE_BL31
|
||||
const mmap_region_t plat_arm_mmap[] = {
|
||||
ARM_MAP_SHARED_RAM,
|
||||
MORELLO_MAP_DEVICE,
|
||||
MORELLO_MAP_NS_SRAM,
|
||||
{0}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if IMAGE_BL2
|
||||
const mmap_region_t plat_arm_mmap[] = {
|
||||
ARM_MAP_SHARED_RAM,
|
||||
MORELLO_MAP_DEVICE,
|
||||
MORELLO_MAP_NS_SRAM,
|
||||
ARM_MAP_DRAM1,
|
||||
ARM_MAP_DRAM2,
|
||||
#if TRUSTED_BOARD_BOOT && !BL2_AT_EL3
|
||||
ARM_MAP_BL1_RW,
|
||||
#endif
|
||||
{0}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if TRUSTED_BOARD_BOOT
|
||||
int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size)
|
||||
{
|
||||
assert(heap_addr != NULL);
|
||||
assert(heap_size != NULL);
|
||||
|
||||
return arm_get_mbedtls_heap(heap_addr, heap_size);
|
||||
}
|
||||
#endif
|
||||
|
||||
void plat_arm_secure_wdt_start(void)
|
||||
{
|
||||
sbsa_wdog_start(SBSA_SECURE_WDOG_BASE, SBSA_SECURE_WDOG_TIMEOUT);
|
||||
}
|
||||
|
||||
void plat_arm_secure_wdt_stop(void)
|
||||
{
|
||||
sbsa_wdog_stop(SBSA_SECURE_WDOG_BASE);
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
/*
|
||||
* TZC programming is currently not done.
|
||||
*/
|
||||
void plat_arm_security_setup(void)
|
||||
{
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <lib/cassert.h>
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
|
||||
/* Compile time assertion to ensure the core count is 4 */
|
||||
CASSERT(PLATFORM_CORE_COUNT == 4U, assert_invalid_platform_core_count);
|
||||
|
||||
/* Topology */
|
||||
typedef struct morello_topology {
|
||||
const unsigned char *power_tree;
|
||||
unsigned int plat_cluster_core_count;
|
||||
} morello_topology_t;
|
||||
|
||||
/*
|
||||
* The power domain tree descriptor. The cluster power domains are
|
||||
* arranged so that when the PSCI generic code creates the power domain tree,
|
||||
* the indices of the CPU power domain nodes it allocates match the linear
|
||||
* indices returned by plat_core_pos_by_mpidr().
|
||||
*/
|
||||
const unsigned char morello_pd_tree_desc[] = {
|
||||
PLAT_MORELLO_CHIP_COUNT,
|
||||
PLAT_ARM_CLUSTER_COUNT,
|
||||
MORELLO_MAX_CPUS_PER_CLUSTER,
|
||||
MORELLO_MAX_CPUS_PER_CLUSTER,
|
||||
};
|
||||
|
||||
/* Topology configuration for morello */
|
||||
const morello_topology_t morello_topology = {
|
||||
.power_tree = morello_pd_tree_desc,
|
||||
.plat_cluster_core_count = MORELLO_MAX_CPUS_PER_CLUSTER
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
* This function returns the topology tree information.
|
||||
******************************************************************************/
|
||||
const unsigned char *plat_get_power_domain_tree_desc(void)
|
||||
{
|
||||
return morello_topology.power_tree;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* This function returns the core count within the cluster corresponding to
|
||||
* `mpidr`.
|
||||
******************************************************************************/
|
||||
unsigned int plat_arm_get_cluster_core_count(u_register_t mpidr)
|
||||
{
|
||||
return morello_topology.plat_cluster_core_count;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* The array mapping platform core position (implemented by plat_my_core_pos())
|
||||
* to the SCMI power domain ID implemented by SCP.
|
||||
******************************************************************************/
|
||||
const uint32_t plat_css_core_pos_to_scmi_dmn_id_map[PLATFORM_CORE_COUNT] = {
|
||||
0, 1, 2, 3};
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Arm Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
|
||||
/*
|
||||
* Return the non-volatile counter value stored in the platform. The cookie
|
||||
* will contain the OID of the counter in the certificate.
|
||||
*
|
||||
* Return: 0 = success, Otherwise = error
|
||||
*/
|
||||
int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr)
|
||||
{
|
||||
*nv_ctr = MORELLO_FW_NVCTR_VAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store a new non-volatile counter value. By default on ARM development
|
||||
* platforms, the non-volatile counters are RO and cannot be modified. We expect
|
||||
* the values in the certificates to always match the RO values so that this
|
||||
* function is never called.
|
||||
*
|
||||
* Return: 0 = success, Otherwise = error
|
||||
*/
|
||||
int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the ROTPK hash in the following ASN.1 structure in DER format:
|
||||
*
|
||||
* AlgorithmIdentifier ::= SEQUENCE {
|
||||
* algorithm OBJECT IDENTIFIER,
|
||||
* parameters ANY DEFINED BY algorithm OPTIONAL
|
||||
* }
|
||||
*
|
||||
* DigestInfo ::= SEQUENCE {
|
||||
* digestAlgorithm AlgorithmIdentifier,
|
||||
* digest OCTET STRING
|
||||
* }
|
||||
*/
|
||||
int plat_get_rotpk_info(void *cookie, void **key_ptr, unsigned int *key_len,
|
||||
unsigned int *flags)
|
||||
{
|
||||
return arm_get_rotpk_info(cookie, key_ptr, key_len, flags);
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
#
|
||||
# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
# Making sure the Morello platform type is specified
|
||||
ifeq ($(filter ${TARGET_PLATFORM}, fvp soc),)
|
||||
$(error TARGET_PLATFORM must be fvp or soc)
|
||||
endif
|
||||
|
||||
MORELLO_BASE := plat/arm/board/morello
|
||||
|
||||
INTERCONNECT_SOURCES := ${MORELLO_BASE}/morello_interconnect.c
|
||||
|
||||
PLAT_INCLUDES := -I${MORELLO_BASE}/include
|
||||
|
||||
MORELLO_CPU_SOURCES := lib/cpus/aarch64/rainier.S
|
||||
|
||||
# GIC-600 configuration
|
||||
GICV3_SUPPORT_GIC600 := 1
|
||||
|
||||
# Include GICv3 driver files
|
||||
include drivers/arm/gic/v3/gicv3.mk
|
||||
|
||||
MORELLO_GIC_SOURCES := ${GICV3_SOURCES} \
|
||||
plat/common/plat_gicv3.c \
|
||||
plat/arm/common/arm_gicv3.c \
|
||||
|
||||
PLAT_BL_COMMON_SOURCES := ${MORELLO_BASE}/morello_plat.c \
|
||||
${MORELLO_BASE}/aarch64/morello_helper.S
|
||||
|
||||
BL1_SOURCES := ${MORELLO_CPU_SOURCES} \
|
||||
${INTERCONNECT_SOURCES} \
|
||||
${MORELLO_BASE}/morello_err.c \
|
||||
${MORELLO_BASE}/morello_trusted_boot.c \
|
||||
${MORELLO_BASE}/morello_bl1_setup.c \
|
||||
drivers/arm/sbsa/sbsa.c
|
||||
|
||||
BL2_SOURCES := ${MORELLO_BASE}/morello_security.c \
|
||||
${MORELLO_BASE}/morello_err.c \
|
||||
${MORELLO_BASE}/morello_trusted_boot.c \
|
||||
${MORELLO_BASE}/morello_bl2_setup.c \
|
||||
${MORELLO_BASE}/morello_image_load.c \
|
||||
lib/utils/mem_region.c \
|
||||
drivers/arm/css/sds/sds.c
|
||||
|
||||
BL31_SOURCES := ${MORELLO_CPU_SOURCES} \
|
||||
${INTERCONNECT_SOURCES} \
|
||||
${MORELLO_GIC_SOURCES} \
|
||||
${MORELLO_BASE}/morello_bl31_setup.c \
|
||||
${MORELLO_BASE}/morello_topology.c \
|
||||
${MORELLO_BASE}/morello_security.c \
|
||||
drivers/arm/css/sds/sds.c
|
||||
|
||||
FDT_SOURCES += fdts/morello-${TARGET_PLATFORM}.dts \
|
||||
${MORELLO_BASE}/fdts/morello_fw_config.dts \
|
||||
${MORELLO_BASE}/fdts/morello_tb_fw_config.dts \
|
||||
${MORELLO_BASE}/fdts/morello_nt_fw_config.dts
|
||||
|
||||
FW_CONFIG := ${BUILD_PLAT}/fdts/morello_fw_config.dtb
|
||||
TB_FW_CONFIG := ${BUILD_PLAT}/fdts/morello_tb_fw_config.dtb
|
||||
NT_FW_CONFIG := ${BUILD_PLAT}/fdts/morello_nt_fw_config.dtb
|
||||
|
||||
# Add the FW_CONFIG to FIP and specify the same to certtool
|
||||
$(eval $(call TOOL_ADD_PAYLOAD,${FW_CONFIG},--fw-config,${FW_CONFIG}))
|
||||
# Add the TB_FW_CONFIG to FIP and specify the same to certtool
|
||||
$(eval $(call TOOL_ADD_PAYLOAD,${TB_FW_CONFIG},--tb-fw-config,${TB_FW_CONFIG}))
|
||||
# Add the NT_FW_CONFIG to FIP and specify the same to certtool
|
||||
$(eval $(call TOOL_ADD_PAYLOAD,${NT_FW_CONFIG},--nt-fw-config,${NT_FW_CONFIG}))
|
||||
|
||||
MORELLO_FW_NVCTR_VAL := 0
|
||||
TFW_NVCTR_VAL := ${MORELLO_FW_NVCTR_VAL}
|
||||
NTFW_NVCTR_VAL := ${MORELLO_FW_NVCTR_VAL}
|
||||
|
||||
# TF-A not required to load the SCP Images
|
||||
override CSS_LOAD_SCP_IMAGES := 0
|
||||
|
||||
override NEED_BL2U := no
|
||||
|
||||
# 32 bit mode not supported
|
||||
override CTX_INCLUDE_AARCH32_REGS := 0
|
||||
|
||||
override ARM_PLAT_MT := 1
|
||||
|
||||
override ARM_BL31_IN_DRAM := 1
|
||||
|
||||
# Errata workarounds:
|
||||
ERRATA_N1_1868343 := 1
|
||||
|
||||
# Select SCMI/SDS drivers instead of SCPI/BOM driver for communicating with the
|
||||
# SCP during power management operations and for SCP RAM Firmware transfer.
|
||||
CSS_USE_SCMI_SDS_DRIVER := 1
|
||||
|
||||
# System coherency is managed in hardware
|
||||
HW_ASSISTED_COHERENCY := 1
|
||||
|
||||
# When building for systems with hardware-assisted coherency, there's no need to
|
||||
# use USE_COHERENT_MEM. Require that USE_COHERENT_MEM must be set to 0 too.
|
||||
USE_COHERENT_MEM := 0
|
||||
|
||||
# Add TARGET_PLATFORM to differentiate between Morello FVP and Morello SoC platform
|
||||
$(eval $(call add_define,TARGET_PLATFORM_$(call uppercase,${TARGET_PLATFORM})))
|
||||
|
||||
# Add MORELLO_FW_NVCTR_VAL
|
||||
$(eval $(call add_define,MORELLO_FW_NVCTR_VAL))
|
||||
|
||||
include plat/arm/common/arm_common.mk
|
||||
include plat/arm/css/common/css_common.mk
|
||||
include plat/arm/board/common/board_common.mk
|
||||
Reference in New Issue
Block a user