Skip to content

Commit

Permalink
arch: arm: do not call arm_gic intc directly, abstract with arch_irq
Browse files Browse the repository at this point in the history
To allow other interrupt controllers to be called.

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif committed Dec 13, 2023
1 parent 8409aaa commit bb8718d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
10 changes: 10 additions & 0 deletions arch/arm/core/cortex_a_r/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/core/cortex_a_r/isr_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
12 changes: 12 additions & 0 deletions arch/arm64/core/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/core/isr_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
10 changes: 7 additions & 3 deletions include/zephyr/arch/arm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);
Expand Down
5 changes: 4 additions & 1 deletion include/zephyr/arch/arm64/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

/*
Expand Down

0 comments on commit bb8718d

Please sign in to comment.