Commit 37a12f04 authored by Julius Werner's avatar Julius Werner Committed by TrustedFirmware Code Review
Browse files

Merge "sc7180 platform support" into integration

parents 8ae3a91c 5bd9c17d
/*
* Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2018,2020 The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
#include <platform_def.h>
#include <qti_plat.h>
/* The QTI power domain tree descriptor */
const unsigned char qti_power_domain_tree_desc[] = {
/* One domain to represent PDC */
PLAT_PDC_COUNT,
/* One domain to represent RSC */
PLAT_RSC_COUNT,
/* There is one top-level FCM cluster */
PLAT_CLUSTER_COUNT,
/* No. of cores in the FCM cluster */
PLAT_CLUSTER0_CORE_COUNT
};
/*******************************************************************************
* This function returns the ARM default topology tree information.
******************************************************************************/
const unsigned char *plat_get_power_domain_tree_desc(void)
{
return qti_power_domain_tree_desc;
}
/** Function: plat_core_pos_by_mpidr
* This function implements a part of the critical interface between the psci
* generic layer and the platform that allows the former to query the platform
* to convert an MPIDR to a unique linear index. An error code (-1) is returned
* in case the MPIDR is invalid.
*/
int plat_core_pos_by_mpidr(u_register_t mpidr)
{
int core_linear_index = plat_qti_core_pos_by_mpidr(mpidr);
if (core_linear_index < PLATFORM_CORE_COUNT) {
return core_linear_index;
} else {
return -1;
}
}
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef QTISECLIB_CB_INTERFACE_H
#define QTISECLIB_CB_INTERFACE_H
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <qtiseclib_defs.h>
/* Standard Library API's */
void *qtiseclib_cb_memcpy(void *dst, const void *src, size_t len);
#define QTISECLIB_CB_ERROR(...) qtiseclib_cb_log(QTISECLIB_LOG_LEVEL_ERROR, __VA_ARGS__)
#define QTISECLIB_CB_NOTICE(...) qtiseclib_cb_log(QTISECLIB_LOG_LEVEL_NOTICE, __VA_ARGS__)
#define QTISECLIB_CB_WARN(...) qtiseclib_cb_log(QTISECLIB_LOG_LEVEL_WARNING, __VA_ARGS__)
#define QTISECLIB_CB_INFO(...) qtiseclib_cb_log(QTISECLIB_LOG_LEVEL_INFO, __VA_ARGS__)
void qtiseclib_cb_log(unsigned int loglvl, const char *fmt, ...);
void qtiseclib_cb_spin_lock(qtiseclib_cb_spinlock_t *lock);
void qtiseclib_cb_spin_unlock(qtiseclib_cb_spinlock_t *lock);
unsigned int qtiseclib_cb_plat_my_core_pos(void);
int qtiseclib_cb_plat_core_pos_by_mpidr(u_register_t mpidr);
unsigned int qtiseclib_cb_plat_my_cluster_pos(void);
/* GIC platform wrappers */
void qtiseclib_cb_gic_pcpu_init(void);
void qtiseclib_cb_ic_raise_sgi(int sgi_num, u_register_t target);
void qtiseclib_cb_set_spi_routing(unsigned int id, unsigned int irm,
u_register_t target);
/* Crash reporting api's wrappers */
void qtiseclib_cb_switch_console_to_crash_state(void);
void qtiseclib_cb_udelay(uint32_t usec);
#if QTI_SDI_BUILD
int qtiseclib_cb_mmap_remove_dynamic_region(uintptr_t base_va, size_t size);
int qtiseclib_cb_mmap_add_dynamic_region(unsigned long long base_pa,
size_t size,
qtiseclib_mmap_attr_t attr);
void qtiseclib_cb_flush_dcache_all(void);
void qtiseclib_cb_get_ns_ctx(qtiseclib_dbg_a64_ctxt_regs_type *ns_ctx);
#endif
#endif /* QTISECLIB_CB_INTERFACE_H */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef QTISECLIB_DEFS_H
#define QTISECLIB_DEFS_H
#include <stdint.h>
#ifndef u_register_t
typedef uintptr_t u_register_t;
#endif
/*
* Different Log Level supported in qtiseclib.
* TODO: Currently no filtering done on QTISECLIB logs.
*/
#define QTISECLIB_LOG_LEVEL_NONE 0
#define QTISECLIB_LOG_LEVEL_ERROR 10
#define QTISECLIB_LOG_LEVEL_NOTICE 20
#define QTISECLIB_LOG_LEVEL_WARNING 30
#define QTISECLIB_LOG_LEVEL_INFO 40
#define QTISECLIB_LOG_LEVEL_VERBOSE 50
#define QTI_GICV3_IRM_PE 0
#define QTI_GICV3_IRM_ANY 1
/* Common interrupt number/ID defs. */
#define QTISECLIB_INT_ID_RESET_SGI (0xf)
#define QTISECLIB_INT_ID_CPU_WAKEUP_SGI (0x8)
#define QTISECLIB_INT_INVALID_INT_NUM (0xFFFFFFFFU)
typedef struct qtiseclib_cb_spinlock {
volatile uint32_t lock;
} qtiseclib_cb_spinlock_t;
#if QTI_SDI_BUILD
/* External CPU Dump Structure - 64 bit EL */
typedef struct {
uint64_t x0;
uint64_t x1;
uint64_t x2;
uint64_t x3;
uint64_t x4;
uint64_t x5;
uint64_t x6;
uint64_t x7;
uint64_t x8;
uint64_t x9;
uint64_t x10;
uint64_t x11;
uint64_t x12;
uint64_t x13;
uint64_t x14;
uint64_t x15;
uint64_t x16;
uint64_t x17;
uint64_t x18;
uint64_t x19;
uint64_t x20;
uint64_t x21;
uint64_t x22;
uint64_t x23;
uint64_t x24;
uint64_t x25;
uint64_t x26;
uint64_t x27;
uint64_t x28;
uint64_t x29;
uint64_t x30;
uint64_t pc;
uint64_t currentEL;
uint64_t sp_el3;
uint64_t elr_el3;
uint64_t spsr_el3;
uint64_t sp_el2;
uint64_t elr_el2;
uint64_t spsr_el2;
uint64_t sp_el1;
uint64_t elr_el1;
uint64_t spsr_el1;
uint64_t sp_el0;
uint64_t __reserved1;
uint64_t __reserved2;
uint64_t __reserved3;
uint64_t __reserved4;
uint64_t __reserved5;
uint64_t __reserved6;
uint64_t __reserved7;
uint64_t __reserved8;
} qtiseclib_dbg_a64_ctxt_regs_type;
typedef enum qtiseclib_mmap_attr_s {
QTISECLIB_MAP_NS_RO_XN_DATA = 1,
QTISECLIB_MAP_RW_XN_NC_DATA = 2,
QTISECLIB_MAP_RW_XN_DATA = 3,
} qtiseclib_mmap_attr_t;
#endif /* QTI_SDI_BUILD */
#endif /* QTISECLIB_DEFS_H */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef QTISECLIB_INTERFACE_H
#define QTISECLIB_INTERFACE_H
#include <stdbool.h>
#include <stdint.h>
#include <qtiseclib_defs.h>
typedef struct memprot_ipa_info_s {
uint64_t mem_addr;
uint64_t mem_size;
} memprot_info_t;
typedef struct memprot_dst_vm_perm_info_s {
uint32_t dst_vm;
uint32_t dst_vm_perm;
uint64_t ctx;
uint32_t ctx_size;
} memprot_dst_vm_perm_info_t;
/*
* QTISECLIB Published API's.
*/
/*
* Assembly API's
*/
/*
* CPUSS common reset handler for all CPU wake up (both cold & warm boot).
* Executes on all core. This API assume serialization across CPU
* already taken care before invoking.
*
* Clobbers: x0 - x17, x30
*/
void qtiseclib_cpuss_reset_asm(uint32_t bl31_cold_boot_state);
/*
* Execute CPU (Kryo4 gold) specific reset handler / system initialization.
* This takes care of executing required CPU errata's.
*
* Clobbers: x0 - x16
*/
void qtiseclib_kryo4_gold_reset_asm(void);
/*
* Execute CPU (Kryo4 silver) specific reset handler / system initialization.
* This takes care of executing required CPU errata's.
*
* Clobbers: x0 - x16
*/
void qtiseclib_kryo4_silver_reset_asm(void);
/*
* C Api's
*/
void qtiseclib_bl31_platform_setup(void);
void qtiseclib_invoke_isr(uint32_t irq, void *handle);
void qtiseclib_panic(void);
int qtiseclib_prng_get_data(uint8_t *out, uint32_t out_len);
int qtiseclib_mem_assign(const memprot_info_t *mem_info,
uint32_t mem_info_list_cnt,
const uint32_t *source_vm_list,
uint32_t src_vm_list_cnt,
const memprot_dst_vm_perm_info_t *dest_vm_list,
uint32_t dst_vm_list_cnt);
int qtiseclib_psci_init(uintptr_t warmboot_entry);
int qtiseclib_psci_node_power_on(u_register_t mpidr);
void qtiseclib_psci_node_on_finish(const uint8_t *states);
void qtiseclib_psci_cpu_standby(uint8_t pwr_state);
void qtiseclib_psci_node_power_off(const uint8_t *states);
void qtiseclib_psci_node_suspend(const uint8_t *states);
void qtiseclib_psci_node_suspend_finish(const uint8_t *states);
__attribute__ ((noreturn))
void qtiseclib_psci_system_off(void);
__attribute__ ((noreturn))
void qtiseclib_psci_system_reset(void);
void qtiseclib_disable_cluster_coherency(uint8_t state);
#endif /* QTISECLIB_INTERFACE_H */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef QTISECLIB_DEFS_PLAT_H
#define QTISECLIB_DEFS_PLAT_H
#define QTISECLIB_PLAT_CLUSTER_COUNT 1
#define QTISECLIB_PLAT_CORE_COUNT 8
#define BL31_BASE 0x80b00000
#define BL31_SIZE 0x00100000
/*----------------------------------------------------------------------------*/
/* AOP CMD DB address space for mapping */
/*----------------------------------------------------------------------------*/
#define QTI_AOP_CMD_DB_BASE 0x80820000
#define QTI_AOP_CMD_DB_SIZE 0x00020000
/* Chipset specific secure interrupt number/ID defs. */
#define QTISECLIB_INT_ID_SEC_WDOG_BARK (0x204)
#define QTISECLIB_INT_ID_NON_SEC_WDOG_BITE (0x21)
#define QTISECLIB_INT_ID_VMIDMT_ERR_CLT_SEC (0xE6)
#define QTISECLIB_INT_ID_VMIDMT_ERR_CLT_NONSEC (0xE7)
#define QTISECLIB_INT_ID_VMIDMT_ERR_CFG_SEC (0xE8)
#define QTISECLIB_INT_ID_VMIDMT_ERR_CFG_NONSEC (0xE9)
#define QTISECLIB_INT_ID_XPU_SEC (0xE3)
#define QTISECLIB_INT_ID_XPU_NON_SEC (0xE4)
#define QTISECLIB_INT_ID_A2_NOC_ERROR (0x194)
#define QTISECLIB_INT_ID_CONFIG_NOC_ERROR (0xE2)
#define QTISECLIB_INT_ID_DC_NOC_ERROR (0x122)
#define QTISECLIB_INT_ID_MEM_NOC_ERROR (0x6C)
#define QTISECLIB_INT_ID_SYSTEM_NOC_ERROR (0xC6)
#define QTISECLIB_INT_ID_MMSS_NOC_ERROR (0xBA)
#endif /* QTISECLIB_DEFS_PLAT_H */
/*
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <arch.h>
#include <arch_helpers.h>
#include <bl31/bl31.h>
#include <context.h>
#include <drivers/arm/gicv3.h>
#include <drivers/delay_timer.h>
#include <lib/coreboot.h>
#include <lib/el3_runtime/context_mgmt.h>
#include <lib/spinlock.h>
#include <lib/xlat_tables/xlat_tables_v2.h>
#include <platform.h>
#include <qti_plat.h>
#include <qtiseclib_cb_interface.h>
void *qtiseclib_cb_memcpy(void *dst, const void *src, size_t len)
{
return memcpy(dst, src, len);
}
/* Printing logs below or equal LOG_LEVEL from QTISECLIB. */
void qtiseclib_cb_log(unsigned int loglvl, const char *fmt, ...)
{
if (loglvl <= LOG_LEVEL) {
va_list argp;
static spinlock_t qti_log_lock;
uint64_t uptime = read_cntpct_el0();
va_start(argp, fmt);
spin_lock(&qti_log_lock);
printf("QTISECLIB [%x%08x]",
(uint32_t) ((uptime >> 32) & 0xFFFFFFFF),
(uint32_t) (uptime & 0xFFFFFFFF));
vprintf(fmt, argp);
putchar('\n');
spin_unlock(&qti_log_lock);
va_end(argp);
}
}
void qtiseclib_cb_spin_lock(qtiseclib_cb_spinlock_t *lock)
{
spin_lock((spinlock_t *) lock);
}
void qtiseclib_cb_spin_unlock(qtiseclib_cb_spinlock_t *lock)
{
spin_unlock((spinlock_t *) lock);
}
unsigned int qtiseclib_cb_plat_my_core_pos(void)
{
return plat_my_core_pos();
}
int qtiseclib_cb_plat_core_pos_by_mpidr(u_register_t mpidr)
{
return plat_core_pos_by_mpidr(mpidr);
}
unsigned int qtiseclib_cb_plat_my_cluster_pos(void)
{
return plat_qti_my_cluster_pos();
}
/* GIC platform functions */
void qtiseclib_cb_gic_pcpu_init(void)
{
plat_qti_gic_pcpu_init();
}
void qtiseclib_cb_ic_raise_sgi(int sgi_num, u_register_t target)
{
plat_ic_raise_el3_sgi(sgi_num, target);
}
void qtiseclib_cb_set_spi_routing(unsigned int id, unsigned int irm,
u_register_t target)
{
assert(QTI_GICV3_IRM_PE == GICV3_IRM_PE);
assert(QTI_GICV3_IRM_ANY == GICV3_IRM_ANY);
gic_set_spi_routing(id, irm, target);
}
/* Crash reporting api's wrappers */
void qtiseclib_cb_switch_console_to_crash_state(void)
{
console_switch_state(CONSOLE_FLAG_CRASH);
}
void qtiseclib_cb_udelay(uint32_t usec)
{
udelay(usec);
}
#if QTI_SDI_BUILD
void qtiseclib_cb_get_ns_ctx(qtiseclib_dbg_a64_ctxt_regs_type *qti_ns_ctx)
{
void *ctx;
ctx = cm_get_context(NON_SECURE);
qti_ns_ctx->spsr_el3 =
read_ctx_reg(get_el3state_ctx(ctx), CTX_SPSR_EL3);
qti_ns_ctx->elr_el3 = read_ctx_reg(get_el3state_ctx(ctx), CTX_ELR_EL3);
qti_ns_ctx->spsr_el1 =
read_ctx_reg(get_el1_sysregs_ctx(ctx), CTX_SPSR_EL1);
qti_ns_ctx->elr_el1 =
read_ctx_reg(get_el1_sysregs_ctx(ctx), CTX_ELR_EL1);
qti_ns_ctx->sp_el1 = read_ctx_reg(get_el1_sysregs_ctx(ctx), CTX_SP_EL1);
qti_ns_ctx->x0 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X0);
qti_ns_ctx->x1 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X1);
qti_ns_ctx->x2 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X2);
qti_ns_ctx->x3 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X3);
qti_ns_ctx->x4 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X4);
qti_ns_ctx->x5 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X5);
qti_ns_ctx->x6 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X6);
qti_ns_ctx->x7 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X7);
qti_ns_ctx->x8 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X8);
qti_ns_ctx->x9 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X9);
qti_ns_ctx->x10 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X10);
qti_ns_ctx->x11 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X11);
qti_ns_ctx->x12 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X12);
qti_ns_ctx->x13 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X13);
qti_ns_ctx->x14 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X14);
qti_ns_ctx->x15 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X15);
qti_ns_ctx->x16 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X16);
qti_ns_ctx->x17 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X17);
qti_ns_ctx->x18 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X18);
qti_ns_ctx->x19 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X19);
qti_ns_ctx->x20 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X20);
qti_ns_ctx->x21 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X21);
qti_ns_ctx->x22 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X22);
qti_ns_ctx->x23 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X23);
qti_ns_ctx->x24 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X24);
qti_ns_ctx->x25 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X25);
qti_ns_ctx->x26 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X26);
qti_ns_ctx->x27 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X27);
qti_ns_ctx->x28 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X28);
qti_ns_ctx->x29 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_X29);
qti_ns_ctx->x30 = read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_LR);
qti_ns_ctx->sp_el0 =
read_ctx_reg(get_gpregs_ctx(ctx), CTX_GPREG_SP_EL0);
}
void qtiseclib_cb_flush_dcache_all(void)
{
dcsw_op_all(DCCISW);
}
int qtiseclib_cb_mmap_add_dynamic_region(unsigned long long base_pa,
size_t size,
qtiseclib_mmap_attr_t attr)
{
unsigned int l_attr = 0;
if (attr == QTISECLIB_MAP_NS_RO_XN_DATA) {
l_attr = MT_NS | MT_RO | MT_EXECUTE_NEVER;
} else if (attr == QTISECLIB_MAP_RW_XN_NC_DATA) {
l_attr = MT_RW | MT_NON_CACHEABLE | MT_EXECUTE_NEVER;
} else if (attr == QTISECLIB_MAP_RW_XN_DATA) {
l_attr = MT_RW | MT_EXECUTE_NEVER;
}
return qti_mmap_add_dynamic_region(base_pa, size, l_attr);
}
int qtiseclib_cb_mmap_remove_dynamic_region(uintptr_t base_va, size_t size)
{
return qti_mmap_remove_dynamic_region(base_va, size);
}
#endif
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdbool.h>
#include <stdint.h>
#include <common/debug.h>
#include <qtiseclib_defs.h>
#include <qtiseclib_interface.h>
/*
* This file contains dummy implementation of QTISECLIB Published API's.
* which will be used to compile PLATFORM successfully when
* qtiseclib is not available
*/
/*
* CPUSS common reset handler for all CPU wake up (both cold & warm boot).
* Executes on all core. This API assume serialization across CPU
* already taken care before invoking.
*
* Clobbers: x0 - x17, x30
*/
void qtiseclib_cpuss_reset_asm(uint32_t bl31_cold_boot_state)
{
}
/*
* Execute CPU (Kryo4 gold) specific reset handler / system initialization.
* This takes care of executing required CPU errata's.
*
* Clobbers: x0 - x16
*/
void qtiseclib_kryo4_gold_reset_asm(void)
{
}
/*
* Execute CPU (Kryo4 silver) specific reset handler / system initialization.
* This takes care of executing required CPU errata's.
*
* Clobbers: x0 - x16
*/
void qtiseclib_kryo4_silver_reset_asm(void)
{
}
/*
* C Api's
*/
void qtiseclib_bl31_platform_setup(void)
{
ERROR("Please use QTISECLIB_PATH while building TF-A\n");
ERROR("Please refer docs/plat/qti.rst for more details.\n");
panic();
}
void qtiseclib_invoke_isr(uint32_t irq, void *handle)
{
}
void qtiseclib_panic(void)
{
}
int qtiseclib_prng_get_data(uint8_t *out, uint32_t out_len)
{
/* fill dummy data to avoid assert and print
* stub implementation in setup call
*/
for (int i = 0; i < out_len; i++) {
out[i] = 0x11;
}
return 0;
}
int
qtiseclib_mem_assign(const memprot_info_t *mem_info,
uint32_t mem_info_list_cnt,
const uint32_t *source_vm_list,
uint32_t src_vm_list_cnt,
const memprot_dst_vm_perm_info_t *dest_vm_list,
uint32_t dst_vm_list_cnt)
{
return 0;
}
int qtiseclib_psci_init(uintptr_t warmboot_entry)
{
return 0;
}
int qtiseclib_psci_node_power_on(u_register_t mpidr)
{
return 0;
}
void qtiseclib_psci_node_on_finish(const uint8_t *states)
{
}
void qtiseclib_psci_cpu_standby(uint8_t pwr_state)
{
}
void qtiseclib_psci_node_power_off(const uint8_t *states)
{
}
void qtiseclib_psci_node_suspend(const uint8_t *states)
{
}
void qtiseclib_psci_node_suspend_finish(const uint8_t *states)
{
}
void qtiseclib_psci_system_off(void)
{
while (1) {
};
}
void qtiseclib_psci_system_reset(void)
{
while (1) {
};
}
void qtiseclib_disable_cluster_coherency(uint8_t state)
{
}
/*
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
/* Enable the dynamic translation tables library. */
#define PLAT_XLAT_TABLES_DYNAMIC 1
#include <common_def.h>
#include <qti_board_def.h>
#include <qtiseclib_defs_plat.h>
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*
* MPIDR_PRIMARY_CPU
* You just need to have the correct core_affinity_val i.e. [7:0]
* and cluster_affinity_val i.e. [15:8]
* the other bits will be ignored
*/
/*----------------------------------------------------------------------------*/
#define MPIDR_PRIMARY_CPU 0x0000
/*----------------------------------------------------------------------------*/
#define QTI_PWR_LVL0 MPIDR_AFFLVL0
#define QTI_PWR_LVL1 MPIDR_AFFLVL1
#define QTI_PWR_LVL2 MPIDR_AFFLVL2
#define QTI_PWR_LVL3 MPIDR_AFFLVL3
/*
* Macros for local power states encoded by State-ID field
* within the power-state parameter.
*/
/* Local power state for power domains in Run state. */
#define QTI_LOCAL_STATE_RUN 0
/*
* Local power state for clock-gating. Valid only for CPU and not cluster power
* domains
*/
#define QTI_LOCAL_STATE_STB 1
/*
* Local power state for retention. Valid for CPU and cluster power
* domains
*/
#define QTI_LOCAL_STATE_RET 2
/*
* Local power state for OFF/power down. Valid for CPU, cluster, RSC and PDC
* power domains
*/
#define QTI_LOCAL_STATE_OFF 3
/*
* Local power state for DEEPOFF/power rail down. Valid for CPU, cluster and RSC
* power domains
*/
#define QTI_LOCAL_STATE_DEEPOFF 4
/*
* This macro defines the deepest retention state possible. A higher state
* id will represent an invalid or a power down state.
*/
#define PLAT_MAX_RET_STATE QTI_LOCAL_STATE_RET
/*
* This macro defines the deepest power down states possible. Any state ID
* higher than this is invalid.
*/
#define PLAT_MAX_OFF_STATE QTI_LOCAL_STATE_DEEPOFF
/******************************************************************************
* Required platform porting definitions common to all ARM standard platforms
*****************************************************************************/
/*
* Platform specific page table and MMU setup constants.
*/
#define MAX_MMAP_REGIONS (PLAT_QTI_MMAP_ENTRIES)
#define PLAT_PHY_ADDR_SPACE_SIZE (1ull << 36)
#define PLAT_VIRT_ADDR_SPACE_SIZE (1ull << 36)
#define ARM_CACHE_WRITEBACK_SHIFT 6
/*
* Some data must be aligned on the biggest cache line size in the platform.
* This is known only to the platform as it might have a combination of
* integrated and external caches.
*/
#define CACHE_WRITEBACK_GRANULE (1 << ARM_CACHE_WRITEBACK_SHIFT)
/*
* One cache line needed for bakery locks on ARM platforms
*/
#define PLAT_PERCPU_BAKERY_LOCK_SIZE (1 * CACHE_WRITEBACK_GRANULE)
/*----------------------------------------------------------------------------*/
/* PSCI power domain topology definitions */
/*----------------------------------------------------------------------------*/
/* One domain each to represent RSC and PDC level */
#define PLAT_PDC_COUNT 1
#define PLAT_RSC_COUNT 1
/* There is one top-level FCM cluster */
#define PLAT_CLUSTER_COUNT 1
/* No. of cores in the FCM cluster */
#define PLAT_CLUSTER0_CORE_COUNT 8
#define PLATFORM_CORE_COUNT (PLAT_CLUSTER0_CORE_COUNT)
#define PLAT_NUM_PWR_DOMAINS (PLAT_PDC_COUNT +\
PLAT_RSC_COUNT +\
PLAT_CLUSTER_COUNT +\
PLATFORM_CORE_COUNT)
#define PLAT_MAX_PWR_LVL 3
/*****************************************************************************/
/* Memory mapped Generic timer interfaces */
/*****************************************************************************/
/*----------------------------------------------------------------------------*/
/* GIC-600 constants */
/*----------------------------------------------------------------------------*/
#define BASE_GICD_BASE 0x17A00000
#define BASE_GICR_BASE 0x17A60000
#define BASE_GICC_BASE 0x0
#define BASE_GICH_BASE 0x0
#define BASE_GICV_BASE 0x0
#define QTI_GICD_BASE BASE_GICD_BASE
#define QTI_GICR_BASE BASE_GICR_BASE
#define QTI_GICC_BASE BASE_GICC_BASE
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* UART related constants. */
/*----------------------------------------------------------------------------*/
/* BASE ADDRESS OF DIFFERENT REGISTER SPACES IN HW */
#define GENI4_CFG 0x0
#define GENI4_IMAGE_REGS 0x100
#define GENI4_DATA 0x600
/* COMMON STATUS/CONFIGURATION REGISTERS AND MASKS */
#define GENI_STATUS_REG (GENI4_CFG + 0x00000040)
#define GENI_STATUS_M_GENI_CMD_ACTIVE_MASK (0x1)
#define UART_TX_TRANS_LEN_REG (GENI4_IMAGE_REGS + 0x00000170)
/* MASTER/TX ENGINE REGISTERS */
#define GENI_M_CMD0_REG (GENI4_DATA + 0x00000000)
/* FIFO, STATUS REGISTERS AND MASKS */
#define GENI_TX_FIFOn_REG (GENI4_DATA + 0x00000100)
#define GENI_M_CMD_TX (0x08000000)
/*----------------------------------------------------------------------------*/
/* Device address space for mapping. Excluding starting 4K */
/*----------------------------------------------------------------------------*/
#define QTI_DEVICE_BASE 0x1000
#define QTI_DEVICE_SIZE (0x80000000 - QTI_DEVICE_BASE)
/*******************************************************************************
* BL31 specific defines.
******************************************************************************/
/*
* Put BL31 at DDR as per memory map. BL31_BASE is calculated using the
* current BL31 debug size plus a little space for growth.
*/
#define BL31_LIMIT (BL31_BASE + BL31_SIZE)
#endif /* PLATFORM_DEF_H */
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef QTI_SECURE_IO_CFG_H
#define QTI_SECURE_IO_CFG_H
#include <stdint.h>
/*
* List of peripheral/IO memory areas that are protected from
* non-secure world but not required to be secure.
*/
#define APPS_SMMU_TBU_PWR_STATUS 0x15002204
#define APPS_SMMU_CUSTOM_CFG 0x15002300
#define APPS_SMMU_STATS_SYNC_INV_TBU_ACK 0x150025DC
#define APPS_SMMU_SAFE_SEC_CFG 0x15002648
#define APPS_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR 0x15002670
static const uintptr_t qti_secure_io_allowed_regs[] = {
APPS_SMMU_TBU_PWR_STATUS,
APPS_SMMU_CUSTOM_CFG,
APPS_SMMU_STATS_SYNC_INV_TBU_ACK,
APPS_SMMU_SAFE_SEC_CFG,
APPS_SMMU_MMU2QSS_AND_SAFE_WAIT_CNTR,
};
#endif /* QTI_SECURE_IO_CFG_H */
#
# Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
# Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# Make for SC7180 QTI platform.
QTI_PLAT_PATH := plat/qti
CHIPSET := ${PLAT}
# Turn On Separate code & data.
SEPARATE_CODE_AND_RODATA := 1
USE_COHERENT_MEM := 1
WARMBOOT_ENABLE_DCACHE_EARLY := 1
# Disable the PSCI platform compatibility layer
ENABLE_PLAT_COMPAT := 0
# Enable PSCI v1.0 extended state ID format
PSCI_EXTENDED_STATE_ID := 1
ARM_RECOM_STATE_ID_ENC := 1
COLD_BOOT_SINGLE_CPU := 1
PROGRAMMABLE_RESET_ADDRESS := 1
RESET_TO_BL31 := 0
MULTI_CONSOLE_API := 1
QTI_SDI_BUILD := 0
$(eval $(call assert_boolean,QTI_SDI_BUILD))
$(eval $(call add_define,QTI_SDI_BUILD))
#disable CTX_INCLUDE_AARCH32_REGS to support sc7180 gold cores
override CTX_INCLUDE_AARCH32_REGS := 0
WORKAROUND_CVE_2017_5715 := 0
DYNAMIC_WORKAROUND_CVE_2018_3639 := 1
# Enable stack protector.
ENABLE_STACK_PROTECTOR := strong
QTI_EXTERNAL_INCLUDES := -I${QTI_PLAT_PATH}/${CHIPSET}/inc \
-I${QTI_PLAT_PATH}/common/inc \
-I${QTI_PLAT_PATH}/common/inc/$(ARCH) \
-I${QTI_PLAT_PATH}/qtiseclib/inc \
-I${QTI_PLAT_PATH}/qtiseclib/inc/${CHIPSET} \
QTI_BL31_SOURCES := $(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_helpers.S \
$(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_kryo4_silver.S \
$(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_kryo4_gold.S \
$(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_uart_console.S \
$(QTI_PLAT_PATH)/common/src/qti_stack_protector.c \
$(QTI_PLAT_PATH)/common/src/qti_common.c \
$(QTI_PLAT_PATH)/common/src/qti_bl31_setup.c \
$(QTI_PLAT_PATH)/common/src/qti_gic_v3.c \
$(QTI_PLAT_PATH)/common/src/qti_interrupt_svc.c \
$(QTI_PLAT_PATH)/common/src/qti_syscall.c \
$(QTI_PLAT_PATH)/common/src/qti_topology.c \
$(QTI_PLAT_PATH)/common/src/qti_pm.c \
$(QTI_PLAT_PATH)/qtiseclib/src/qtiseclib_cb_interface.c \
PLAT_INCLUDES := -Iinclude/plat/common/ \
PLAT_INCLUDES += ${QTI_EXTERNAL_INCLUDES}
include lib/xlat_tables_v2/xlat_tables.mk
PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} \
plat/common/aarch64/crash_console_helpers.S \
common/desc_image_load.c \
lib/bl_aux_params/bl_aux_params.c \
include lib/coreboot/coreboot.mk
#PSCI Sources.
PSCI_SOURCES := plat/common/plat_psci_common.c \
# GIC-600 configuration
GICV3_IMPL := GIC600
# Include GICv3 driver files
include drivers/arm/gic/v3/gicv3.mk
#Timer sources
TIMER_SOURCES := drivers/delay_timer/generic_delay_timer.c \
drivers/delay_timer/delay_timer.c \
#GIC sources.
GIC_SOURCES := plat/common/plat_gicv3.c \
${GICV3_SOURCES} \
BL31_SOURCES += ${QTI_BL31_SOURCES} \
${PSCI_SOURCES} \
${GIC_SOURCES} \
${TIMER_SOURCES} \
LIB_QTI_PATH := ${QTI_PLAT_PATH}/qtiseclib/lib/${CHIPSET}
# Override this on the command line to point to the qtiseclib library which
# will be available in coreboot.org
QTISECLIB_PATH ?=
ifeq ($(QTISECLIB_PATH),)
# if No lib then use stub implementation for qtiseclib interface
$(warning QTISECLIB_PATH is not provided while building, using stub implementation. \
Please refer docs/plat/qti.rst for more details \
THIS FIRMWARE WILL NOT BOOT!)
BL31_SOURCES += plat/qti/qtiseclib/src/qtiseclib_interface_stub.c
else
# use library provided by QTISECLIB_PATH
LDFLAGS += -L $(dir $(QTISECLIB_PATH))
LDLIBS += -l$(patsubst lib%.a,%,$(notdir $(QTISECLIB_PATH)))
endif
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