Merge "fix(zynqmp): handling of type el3 interrrupts" into integration

This commit is contained in:
Joanna Farley 2023-05-26 10:19:10 +02:00 committed by TrustedFirmware Code Review
commit c0d8ee3861
3 changed files with 31 additions and 10 deletions

View file

@ -132,21 +132,29 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
} }
#if ZYNQMP_WDT_RESTART #if ZYNQMP_WDT_RESTART
static interrupt_type_handler_t type_el3_interrupt_table[MAX_INTR_EL3]; static zynmp_intr_info_type_el3_t type_el3_interrupt_table[MAX_INTR_EL3];
int request_intr_type_el3(uint32_t id, interrupt_type_handler_t handler) int request_intr_type_el3(uint32_t id, interrupt_type_handler_t handler)
{ {
static uint32_t index;
uint32_t i;
/* Validate 'handler' and 'id' parameters */ /* Validate 'handler' and 'id' parameters */
if (!handler || id >= MAX_INTR_EL3) { if (!handler || index >= MAX_INTR_EL3) {
return -EINVAL; return -EINVAL;
} }
/* Check if a handler has already been registered */ /* Check if a handler has already been registered */
if (type_el3_interrupt_table[id]) { for (i = 0; i < index; i++) {
if (id == type_el3_interrupt_table[i].id) {
return -EALREADY; return -EALREADY;
} }
}
type_el3_interrupt_table[id] = handler; type_el3_interrupt_table[index].id = id;
type_el3_interrupt_table[index].handler = handler;
index++;
return 0; return 0;
} }
@ -155,12 +163,19 @@ static uint64_t rdo_el3_interrupt_handler(uint32_t id, uint32_t flags,
void *handle, void *cookie) void *handle, void *cookie)
{ {
uint32_t intr_id; uint32_t intr_id;
interrupt_type_handler_t handler; uint32_t i;
interrupt_type_handler_t handler = NULL;
intr_id = plat_ic_get_pending_interrupt_id(); intr_id = plat_ic_get_pending_interrupt_id();
handler = type_el3_interrupt_table[intr_id];
for (i = 0; i < MAX_INTR_EL3; i++) {
if (intr_id == type_el3_interrupt_table[i].id) {
handler = type_el3_interrupt_table[i].handler;
}
}
if (handler != NULL) { if (handler != NULL) {
handler(intr_id, flags, handle, cookie); return handler(intr_id, flags, handle, cookie);
} }
return 0; return 0;

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2014-2020, Arm Limited and Contributors. All rights reserved. * Copyright (c) 2014-2020, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2023, Advanced Micro Devices, Inc. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -21,8 +22,12 @@ uint32_t zynqmp_calc_core_pos(u_register_t mpidr);
uint32_t zynqmp_get_uart_clk(void); uint32_t zynqmp_get_uart_clk(void);
uint32_t zynqmp_get_bootmode(void); uint32_t zynqmp_get_bootmode(void);
#if ZYNQMP_WDT_RESTART #if ZYNQMP_WDT_RESTART
typedef struct zynqmp_intr_info_type_el3 {
uint32_t id;
interrupt_type_handler_t handler;
} zynmp_intr_info_type_el3_t;
/* /*
* Register handler to specific GIC entrance * Register handler to specific GIC entrance
* for INTR_TYPE_EL3 type of interrupt * for INTR_TYPE_EL3 type of interrupt

View file

@ -135,7 +135,8 @@
#define ARM_IRQ_SEC_SGI_6 14 #define ARM_IRQ_SEC_SGI_6 14
#define ARM_IRQ_SEC_SGI_7 15 #define ARM_IRQ_SEC_SGI_7 15
#define MAX_INTR_EL3 128 /* number of interrupt handlers. increase as required */
#define MAX_INTR_EL3 2
/******************************************************************************* /*******************************************************************************
* UART related constants * UART related constants