diff mbox series

[U-Boot,1/2] x86: Wrap calls to 8259 with CONFIG_I8259_PIC

Message ID 1542624586-30855-1-git-send-email-bmeng.cn@gmail.com
State Superseded
Delegated to: Bin Meng
Headers show
Series [U-Boot,1/2] x86: Wrap calls to 8259 with CONFIG_I8259_PIC | expand

Commit Message

Bin Meng Nov. 19, 2018, 10:49 a.m. UTC
mask_irq(), unmask_irq() and specific_eoi() are provided by the
i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/x86/lib/interrupts.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Hannes Schmelzer Nov. 19, 2018, 10:57 a.m. UTC | #1
On 11/19/18 11:49 AM, Bin Meng wrote:
> mask_irq(), unmask_irq() and specific_eoi() are provided by the
> i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>   arch/x86/lib/interrupts.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/lib/interrupts.c b/arch/x86/lib/interrupts.c
> index 297067d..b1dc6e1 100644
> --- a/arch/x86/lib/interrupts.c
> +++ b/arch/x86/lib/interrupts.c
> @@ -64,7 +64,9 @@ void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
>   	irq_handlers[irq].arg = arg;
>   	irq_handlers[irq].count = 0;
>   
> +#if CONFIG_IS_ENABLED(I8259_PIC)
>   	unmask_irq(irq);
> +#endif
>   
>   	if (status)
>   		enable_interrupts();
> @@ -83,7 +85,9 @@ void irq_free_handler(int irq)
>   
>   	status = disable_interrupts();
>   
> +#if CONFIG_IS_ENABLED(I8259_PIC)
>   	mask_irq(irq);
> +#endif
>   
>   	irq_handlers[irq].handler = NULL;
>   	irq_handlers[irq].arg = NULL;
> @@ -104,14 +108,17 @@ void do_irq(int hw_irq)
>   	}
>   
>   	if (irq_handlers[irq].handler) {
> +#if CONFIG_IS_ENABLED(I8259_PIC)
>   		mask_irq(irq);
> +#endif
>   
>   		irq_handlers[irq].handler(irq_handlers[irq].arg);
>   		irq_handlers[irq].count++;
>   
> +#if CONFIG_IS_ENABLED(I8259_PIC)
>   		unmask_irq(irq);
>   		specific_eoi(irq);
> -
> +#endif
>   	} else {
>   		if ((irq & 7) != 7) {
>   			spurious_irq_cnt++;

Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>

Hi Bin,
thanks for this patch. This is working for my board.

With this we may drop my X86-noirq patch.

cheers,
Hannes
Simon Glass Nov. 27, 2018, 1:02 a.m. UTC | #2
Hi Bin,

On Mon, 19 Nov 2018 at 03:44, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> mask_irq(), unmask_irq() and specific_eoi() are provided by the
> i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  arch/x86/lib/interrupts.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Is it possible to use if() instead of #if ?

Regards,
Simon
Bin Meng Nov. 27, 2018, 1:32 a.m. UTC | #3
Hi Simon,

On Tue, Nov 27, 2018 at 9:02 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Bin,
>
> On Mon, 19 Nov 2018 at 03:44, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > mask_irq(), unmask_irq() and specific_eoi() are provided by the
> > i8259 PIC driver and should be wrapped with CONFIG_I8259_PIC.
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  arch/x86/lib/interrupts.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
>
> Is it possible to use if() instead of #if ?
>

Yes, I think so.

Regards,
Bin
diff mbox series

Patch

diff --git a/arch/x86/lib/interrupts.c b/arch/x86/lib/interrupts.c
index 297067d..b1dc6e1 100644
--- a/arch/x86/lib/interrupts.c
+++ b/arch/x86/lib/interrupts.c
@@ -64,7 +64,9 @@  void irq_install_handler(int irq, interrupt_handler_t *handler, void *arg)
 	irq_handlers[irq].arg = arg;
 	irq_handlers[irq].count = 0;
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
 	unmask_irq(irq);
+#endif
 
 	if (status)
 		enable_interrupts();
@@ -83,7 +85,9 @@  void irq_free_handler(int irq)
 
 	status = disable_interrupts();
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
 	mask_irq(irq);
+#endif
 
 	irq_handlers[irq].handler = NULL;
 	irq_handlers[irq].arg = NULL;
@@ -104,14 +108,17 @@  void do_irq(int hw_irq)
 	}
 
 	if (irq_handlers[irq].handler) {
+#if CONFIG_IS_ENABLED(I8259_PIC)
 		mask_irq(irq);
+#endif
 
 		irq_handlers[irq].handler(irq_handlers[irq].arg);
 		irq_handlers[irq].count++;
 
+#if CONFIG_IS_ENABLED(I8259_PIC)
 		unmask_irq(irq);
 		specific_eoi(irq);
-
+#endif
 	} else {
 		if ((irq & 7) != 7) {
 			spurious_irq_cnt++;