From bb8718d308c7b117ce021185aaef364d75b95335 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 6 Dec 2023 10:51:13 -0500 Subject: [PATCH] arch: arm: do not call arm_gic intc directly, abstract with arch_irq To allow other interrupt controllers to be called. Signed-off-by: Anas Nashif --- arch/arm/core/cortex_a_r/irq_manage.c | 10 ++++++++++ arch/arm/core/cortex_a_r/isr_wrapper.S | 4 ++-- arch/arm64/core/irq_manage.c | 12 ++++++++++++ arch/arm64/core/isr_wrapper.S | 2 +- include/zephyr/arch/arm/irq.h | 10 +++++++--- include/zephyr/arch/arm64/irq.h | 5 ++++- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/arch/arm/core/cortex_a_r/irq_manage.c b/arch/arm/core/cortex_a_r/irq_manage.c index 9a393283f10db8..3d852bf219b119 100644 --- a/arch/arm/core/cortex_a_r/irq_manage.c +++ b/arch/arm/core/cortex_a_r/irq_manage.c @@ -55,6 +55,16 @@ int arch_irq_is_enabled(unsigned int irq) return arm_gic_irq_is_enabled(irq); } +unsigned int arch_irq_get_active(void) +{ + return arm_gic_get_active(); +} + +void arch_irq_eoi(unsigned int intid) +{ + return arm_gic_eoi(intid); +} + /** * @internal * diff --git a/arch/arm/core/cortex_a_r/isr_wrapper.S b/arch/arm/core/cortex_a_r/isr_wrapper.S index 9e79297f053f63..69fa112bd44093 100644 --- a/arch/arm/core/cortex_a_r/isr_wrapper.S +++ b/arch/arm/core/cortex_a_r/isr_wrapper.S @@ -177,7 +177,7 @@ _idle_state_cleared: /* Get active IRQ number from the interrupt controller */ #if !defined(CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER) - bl arm_gic_get_active + bl arch_irq_get_active #else bl platform_irq_get_active #endif /* !CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER */ @@ -289,7 +289,7 @@ _idle_state_cleared: /* Get active IRQ number from the interrupt controller */ #if !defined(CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER) - bl arm_gic_get_active + bl arch_irq_get_active #else bl platform_irq_get_active #endif /* !CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER */ diff --git a/arch/arm64/core/irq_manage.c b/arch/arm64/core/irq_manage.c index 3a9833511b149f..0a1b7187b606f0 100644 --- a/arch/arm64/core/irq_manage.c +++ b/arch/arm64/core/irq_manage.c @@ -51,6 +51,18 @@ void arch_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags) { arm_gic_irq_set_priority(irq, prio, flags); } + +unsigned int arch_irq_get_active(void) +{ + return arm_gic_get_active(); +} + +void arch_irq_eoi(unsigned int intid) +{ + return arm_gic_eoi(intid); +} + + #endif /* !CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER */ #ifdef CONFIG_DYNAMIC_INTERRUPTS diff --git a/arch/arm64/core/isr_wrapper.S b/arch/arm64/core/isr_wrapper.S index 76ee9d000c649c..6209168842ec7a 100644 --- a/arch/arm64/core/isr_wrapper.S +++ b/arch/arm64/core/isr_wrapper.S @@ -59,7 +59,7 @@ SECTION_FUNC(TEXT, _isr_wrapper) /* Get active IRQ number from the interrupt controller */ #if !defined(CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER) - bl arm_gic_get_active + bl arch_irq_get_active #else bl platform_irq_get_active #endif /* !CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER */ diff --git a/include/zephyr/arch/arm/irq.h b/include/zephyr/arch/arm/irq.h index 1c27d05f23a96f..64642b891ed492 100644 --- a/include/zephyr/arch/arm/irq.h +++ b/include/zephyr/arch/arm/irq.h @@ -28,6 +28,8 @@ GTEXT(z_arm_int_exit); GTEXT(arch_irq_enable) GTEXT(arch_irq_disable) GTEXT(arch_irq_is_enabled) +GTEXT(arch_irq_get_active) +GTEXT(arch_irq_eoi) #if defined(CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER) GTEXT(platform_irq_get_active) GTEXT(platform_irq_eoi) @@ -39,8 +41,10 @@ GTEXT(platform_irq_eoi) extern void arch_irq_enable(unsigned int irq); extern void arch_irq_disable(unsigned int irq); extern int arch_irq_is_enabled(unsigned int irq); +unsigned int arch_irq_get_active(void); +void arch_irq_eoi(unsigned int intid); -/* internal routine documented in C file, needed by IRQ_CONNECT() macro */ +/* needed by IRQ_CONNECT() macro */ extern void arch_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags); @@ -55,9 +59,7 @@ void platform_irq_init(void); void platform_irq_enable(unsigned int irq); void platform_irq_disable(unsigned int irq); int platform_irq_is_enabled(unsigned int irq); - void platform_irq_priority_set(unsigned int irq, unsigned int prio, unsigned int flags); - unsigned int platform_irq_get_active(void); void platform_irq_eoi(unsigned int irq); @@ -69,6 +71,8 @@ void platform_irq_eoi(unsigned int irq); #define arch_irq_priority_set(irq, prio, flags) \ platform_irq_priority_set(irq, prio, flags) +#define arch_irq_get_active() platform_irq_get_active() + #endif /* !CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER */ extern void z_arm_int_exit(void); diff --git a/include/zephyr/arch/arm64/irq.h b/include/zephyr/arch/arm64/irq.h index b7c65972c23035..7d096737a13770 100644 --- a/include/zephyr/arch/arm64/irq.h +++ b/include/zephyr/arch/arm64/irq.h @@ -27,6 +27,8 @@ extern "C" { GTEXT(arch_irq_enable) GTEXT(arch_irq_disable) GTEXT(arch_irq_is_enabled) +GTEXT(arch_irq_get_active) +GTEXT(arch_irq_eoi) #if defined(CONFIG_PLATFORM_HAS_CUSTOM_INTERRUPT_CONTROLLER) GTEXT(platform_irq_get_active) GTEXT(platform_irq_eoi) @@ -40,7 +42,8 @@ extern void arch_irq_disable(unsigned int irq); extern int arch_irq_is_enabled(unsigned int irq); extern void arch_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags); - +unsigned int arch_irq_get_active(void); +void arch_irq_eoi(unsigned int intid); #else /*