diff options
Diffstat (limited to 'plat/imx/common')
-rw-r--r-- | plat/imx/common/aarch32/imx_uart_console.S | 8 | ||||
-rw-r--r-- | plat/imx/common/imx_ehf.c | 22 | ||||
-rw-r--r-- | plat/imx/common/imx_sdei.c | 32 | ||||
-rw-r--r-- | plat/imx/common/imx_sip_handler.c | 36 | ||||
-rw-r--r-- | plat/imx/common/imx_sip_svc.c | 3 | ||||
-rw-r--r-- | plat/imx/common/imx_uart_console.S | 9 | ||||
-rw-r--r-- | plat/imx/common/include/imx8_iomux.h | 28 | ||||
-rw-r--r-- | plat/imx/common/include/imx8_lpuart.h | 7 | ||||
-rw-r--r-- | plat/imx/common/include/imx_sip_svc.h | 5 | ||||
-rw-r--r-- | plat/imx/common/include/imx_uart.h | 7 | ||||
-rw-r--r-- | plat/imx/common/lpuart_console.S | 9 | ||||
-rw-r--r-- | plat/imx/common/plat_imx8_gic.c | 4 |
12 files changed, 130 insertions, 40 deletions
diff --git a/plat/imx/common/aarch32/imx_uart_console.S b/plat/imx/common/aarch32/imx_uart_console.S index 1c729b1d7..1a1229aab 100644 --- a/plat/imx/common/aarch32/imx_uart_console.S +++ b/plat/imx/common/aarch32/imx_uart_console.S @@ -20,7 +20,7 @@ func console_imx_uart_register mov r4, r3 cmp r4, #0 beq register_fail - str r0, [r4, #CONSOLE_T_DRVDATA] + str r0, [r4, #CONSOLE_T_BASE] bl console_imx_uart_core_init cmp r0, #0 @@ -35,16 +35,16 @@ register_fail: endfunc console_imx_uart_register func console_imx_uart_putc - ldr r1, [r1, #CONSOLE_T_DRVDATA] + ldr r1, [r1, #CONSOLE_T_BASE] b console_imx_uart_core_putc endfunc console_imx_uart_putc func console_imx_uart_getc - ldr r0, [r0, #CONSOLE_T_DRVDATA] + ldr r0, [r0, #CONSOLE_T_BASE] b console_imx_uart_core_getc endfunc console_imx_uart_getc func console_imx_uart_flush - ldr r0, [r0, #CONSOLE_T_DRVDATA] + ldr r0, [r0, #CONSOLE_T_BASE] b console_imx_uart_core_flush endfunc console_imx_uart_flush diff --git a/plat/imx/common/imx_ehf.c b/plat/imx/common/imx_ehf.c new file mode 100644 index 000000000..a9396cd5e --- /dev/null +++ b/plat/imx/common/imx_ehf.c @@ -0,0 +1,22 @@ +/* + * Copyright 2020 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <bl31/ehf.h> + +#include <platform_def.h> + +ehf_pri_desc_t imx_exceptions[] = { +#if SDEI_SUPPORT + /* Critical priority SDEI */ + EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_SDEI_CRITICAL_PRI), + + /* Normal priority SDEI */ + EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_SDEI_NORMAL_PRI), +#endif +}; + +/* Plug in ARM exceptions to Exception Handling Framework. */ +EHF_REGISTER_PRIORITIES(imx_exceptions, ARRAY_SIZE(imx_exceptions), PLAT_PRI_BITS); diff --git a/plat/imx/common/imx_sdei.c b/plat/imx/common/imx_sdei.c new file mode 100644 index 000000000..4b6033fb6 --- /dev/null +++ b/plat/imx/common/imx_sdei.c @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. + * Copyright 2020 NXP + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/* SDEI configuration for ARM platforms */ + +#include <bl31/ehf.h> +#include <common/debug.h> +#include <services/sdei.h> +#include <lib/utils_def.h> + +#include <platform_def.h> + +/* Private event mappings */ +static sdei_ev_map_t imx_sdei_private[] = { + SDEI_DEFINE_EVENT_0(PLAT_SDEI_SGI_PRIVATE), +}; + +/* Shared event mappings */ +static sdei_ev_map_t imx_sdei_shared[] = { +}; + +void plat_sdei_setup(void) +{ + INFO("SDEI platform setup\n"); +} + +/* Export ARM SDEI events */ +REGISTER_SDEI_MAP(imx_sdei_private, imx_sdei_shared); diff --git a/plat/imx/common/imx_sip_handler.c b/plat/imx/common/imx_sip_handler.c index 62048b696..f9f5577c4 100644 --- a/plat/imx/common/imx_sip_handler.c +++ b/plat/imx/common/imx_sip_handler.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include <arch.h> #include <stdlib.h> #include <stdint.h> #include <services/std_svc.h> @@ -12,6 +13,7 @@ #include <common/debug.h> #include <common/runtime_svc.h> #include <imx_sip_svc.h> +#include <lib/el3_runtime/context_mgmt.h> #include <sci/sci.h> #if defined(PLAT_imx8qm) || defined(PLAT_imx8qx) @@ -185,3 +187,37 @@ uint64_t imx_buildinfo_handler(uint32_t smc_fid, return ret; } + +int imx_kernel_entry_handler(uint32_t smc_fid, + u_register_t x1, + u_register_t x2, + u_register_t x3, + u_register_t x4) +{ + static entry_point_info_t bl33_image_ep_info; + entry_point_info_t *next_image_info; + unsigned int mode; + + if (x1 < (PLAT_NS_IMAGE_OFFSET & 0xF0000000)) + return SMC_UNK; + + mode = MODE32_svc; + + next_image_info = &bl33_image_ep_info; + + next_image_info->pc = x1; + + next_image_info->spsr = SPSR_MODE32(mode, SPSR_T_ARM, SPSR_E_LITTLE, + (DAIF_FIQ_BIT | DAIF_IRQ_BIT | DAIF_ABT_BIT)); + + next_image_info->args.arg0 = 0; + next_image_info->args.arg1 = 0; + next_image_info->args.arg2 = x3; + + SET_SECURITY_STATE(next_image_info->h.attr, NON_SECURE); + + cm_init_my_context(next_image_info); + cm_prepare_el3_exit(NON_SECURE); + + return 0; +} diff --git a/plat/imx/common/imx_sip_svc.c b/plat/imx/common/imx_sip_svc.c index 4893b9fa5..20e1479fb 100644 --- a/plat/imx/common/imx_sip_svc.c +++ b/plat/imx/common/imx_sip_svc.c @@ -26,6 +26,9 @@ static uintptr_t imx_sip_handler(unsigned int smc_fid, u_register_t flags) { switch (smc_fid) { + case IMX_SIP_AARCH32: + SMC_RET1(handle, imx_kernel_entry_handler(smc_fid, x1, x2, x3, x4)); + break; #if defined(PLAT_imx8mq) case IMX_SIP_GET_SOC_INFO: SMC_RET1(handle, imx_soc_info_handler(smc_fid, x1, x2, x3)); diff --git a/plat/imx/common/imx_uart_console.S b/plat/imx/common/imx_uart_console.S index 3bdeea26c..ceeb3a76c 100644 --- a/plat/imx/common/imx_uart_console.S +++ b/plat/imx/common/imx_uart_console.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -25,7 +25,7 @@ func console_imx_uart_register mov x7, x30 mov x6, x3 cbz x6, register_fail - str x0, [x6, #CONSOLE_T_DRVDATA] + str x0, [x6, #CONSOLE_T_BASE] bl console_imx_uart_init cbz x0, register_fail @@ -44,7 +44,7 @@ func console_imx_uart_init endfunc console_imx_uart_init func console_imx_uart_putc - ldr x1, [x1, #CONSOLE_T_DRVDATA] + ldr x1, [x1, #CONSOLE_T_BASE] cbz x1, putc_error /* Prepare '\r' to '\n' */ @@ -68,7 +68,7 @@ putc_error: endfunc console_imx_uart_putc func console_imx_uart_getc - ldr x0, [x0, #CONSOLE_T_DRVDATA] + ldr x0, [x0, #CONSOLE_T_BASE] cbz x0, getc_error 1: ldr w1, [x0, #UTS] @@ -84,6 +84,5 @@ getc_error: endfunc console_imx_uart_getc func console_imx_uart_flush - mov x0, #0 ret endfunc console_imx_uart_flush diff --git a/plat/imx/common/include/imx8_iomux.h b/plat/imx/common/include/imx8_iomux.h index 0e93d9800..264c295bb 100644 --- a/plat/imx/common/include/imx8_iomux.h +++ b/plat/imx/common/include/imx8_iomux.h @@ -7,19 +7,19 @@ #ifndef IMX8_IOMUX_H #define IMX8_IOMUX_H -#define PADRING_IFMUX_EN_SHIFT 31 -#define PADRING_IFMUX_EN_MASK (1 << PADRING_IFMUX_EN_SHIFT) -#define PADRING_GP_EN_SHIFT 30 -#define PADRING_GP_EN_MASK (1 << PADRING_GP_EN_SHIFT) -#define PADRING_IFMUX_SHIFT 27 -#define PADRING_IFMUX_MASK (0x7 << PADRING_IFMUX_SHIFT) -#define PADRING_CONFIG_SHIFT 25 -#define PADRING_CONFIG_MASK (0x3 << PADRING_CONFIG_SHIFT) -#define PADRING_LPCONFIG_SHIFT 23 -#define PADRING_LPCONFIG_MASK (0x3 << PADRING_LPCONFIG_SHIFT) -#define PADRING_PULL_SHIFT 5 -#define PADRING_PULL_MASK (0x3 << PADRING_PULL_SHIFT) -#define PADRING_DSE_SHIFT 0 -#define PADRING_DSE_MASK (0x7 << PADRING_DSE_SHIFT) +#define PADRING_IFMUX_EN_SHIFT U(31) +#define PADRING_IFMUX_EN_MASK (U(0x1) << PADRING_IFMUX_EN_SHIFT) +#define PADRING_GP_EN_SHIFT U(30) +#define PADRING_GP_EN_MASK (U(0x1) << PADRING_GP_EN_SHIFT) +#define PADRING_IFMUX_SHIFT U(27) +#define PADRING_IFMUX_MASK (U(0x7) << PADRING_IFMUX_SHIFT) +#define PADRING_CONFIG_SHIFT U(25) +#define PADRING_CONFIG_MASK (U(0x3) << PADRING_CONFIG_SHIFT) +#define PADRING_LPCONFIG_SHIFT U(23) +#define PADRING_LPCONFIG_MASK (U(0x3) << PADRING_LPCONFIG_SHIFT) +#define PADRING_PULL_SHIFT U(5) +#define PADRING_PULL_MASK (U(0x3) << PADRING_PULL_SHIFT) +#define PADRING_DSE_SHIFT U(0) +#define PADRING_DSE_MASK (U(0x7) << PADRING_DSE_SHIFT) #endif /* IMX8_IOMUX_H */ diff --git a/plat/imx/common/include/imx8_lpuart.h b/plat/imx/common/include/imx8_lpuart.h index 0ea284fdf..26470e040 100644 --- a/plat/imx/common/include/imx8_lpuart.h +++ b/plat/imx/common/include/imx8_lpuart.h @@ -54,13 +54,8 @@ #include <stdint.h> -typedef struct { - console_t console; - uintptr_t base; -} console_lpuart_t; - int console_lpuart_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud, - console_lpuart_t *console); + console_t *console); #endif /*__ASSEMBLER__*/ #endif /* IMX8_LPUART_H */ diff --git a/plat/imx/common/include/imx_sip_svc.h b/plat/imx/common/include/imx_sip_svc.h index 5898f7a81..0a2d750f9 100644 --- a/plat/imx/common/include/imx_sip_svc.h +++ b/plat/imx/common/include/imx_sip_svc.h @@ -28,6 +28,11 @@ #define IMX_SIP_MISC_SET_TEMP 0xC200000C +#define IMX_SIP_AARCH32 0xC20000FD + +int imx_kernel_entry_handler(uint32_t smc_fid, u_register_t x1, + u_register_t x2, u_register_t x3, + u_register_t x4); #if defined(PLAT_imx8mq) int imx_soc_info_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, u_register_t x3); diff --git a/plat/imx/common/include/imx_uart.h b/plat/imx/common/include/imx_uart.h index cc1b5318e..6c4d62f57 100644 --- a/plat/imx/common/include/imx_uart.h +++ b/plat/imx/common/include/imx_uart.h @@ -11,13 +11,8 @@ #ifndef __ASSEMBLER__ -typedef struct { - console_t console; - uintptr_t base; -} console_uart_t; - int console_imx_uart_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud, - console_uart_t *console); + console_t *console); #endif /*__ASSEMBLER__*/ #endif /* IMX_UART_H */ diff --git a/plat/imx/common/lpuart_console.S b/plat/imx/common/lpuart_console.S index d8dac2cea..ff01e3551 100644 --- a/plat/imx/common/lpuart_console.S +++ b/plat/imx/common/lpuart_console.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -20,7 +20,7 @@ func console_lpuart_register mov x7, x30 mov x6, x3 cbz x6, register_fail - str x0, [x6, #CONSOLE_T_DRVDATA] + str x0, [x6, #CONSOLE_T_BASE] bl console_lpuart_init cbz x0, register_fail @@ -39,7 +39,7 @@ func console_lpuart_init endfunc console_lpuart_init func console_lpuart_putc - ldr x1, [x1, #CONSOLE_T_DRVDATA] + ldr x1, [x1, #CONSOLE_T_BASE] cbz x1, putc_error /* Prepare '\r' to '\n' */ cmp w0, #0xA @@ -62,7 +62,7 @@ putc_error: endfunc console_lpuart_putc func console_lpuart_getc - ldr x0, [x0, #CONSOLE_T_DRVDATA] + ldr x0, [x0, #CONSOLE_T_BASE] cbz x0, getc_error /* Check if the receive FIFO state */ ret @@ -72,6 +72,5 @@ getc_error: endfunc console_lpuart_getc func console_lpuart_flush - mov x0, #0 ret endfunc console_lpuart_flush diff --git a/plat/imx/common/plat_imx8_gic.c b/plat/imx/common/plat_imx8_gic.c index afb9d1f1a..150e81e7d 100644 --- a/plat/imx/common/plat_imx8_gic.c +++ b/plat/imx/common/plat_imx8_gic.c @@ -22,6 +22,10 @@ uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT]; static const interrupt_prop_t g01s_interrupt_props[] = { INTR_PROP_DESC(8, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP0, GIC_INTR_CFG_LEVEL), +#if SDEI_SUPPORT + INTR_PROP_DESC(PLAT_SDEI_SGI_PRIVATE, PLAT_SDEI_NORMAL_PRI, + INTR_GROUP0, GIC_INTR_CFG_LEVEL), +#endif }; static unsigned int plat_imx_mpidr_to_core_pos(unsigned long mpidr) |