From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: anemo@mba.sphere.ne.jp
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Import updates from i386's i8259.c
Date: Wed, 06 Dec 2006 16:17:29 +0300 [thread overview]
Message-ID: <4576C2E9.4060900@ru.mvista.com> (raw)
In-Reply-To: <20061206.133836.89067271.nemoto@toshiba-tops.co.jp>
Hello.
anemo@mba.sphere.ne.jp wrote:
> Import many updates from i386's i8259.c, especially genirq
> transitions.
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> ---
> diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
> index 2526c0c..85ca2a9 100644
> --- a/arch/mips/kernel/i8259.c
> +++ b/arch/mips/kernel/i8259.c
[...]
> @@ -31,23 +28,16 @@ void disable_8259A_irq(unsigned int irq)
> * moves to arch independent land
> */
>
> +static int i8259A_auto_eoi;
> DEFINE_SPINLOCK(i8259A_lock);
> -
> -static void end_8259A_irq (unsigned int irq)
> -{
> - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)) &&
> - irq_desc[irq].action)
> - enable_8259A_irq(irq);
> -}
> -
> +/* some platforms call this... */
> void mask_and_ack_8259A(unsigned int);
>
> -static struct irq_chip i8259A_irq_type = {
> - .typename = "XT-PIC",
> - .enable = enable_8259A_irq,
> - .disable = disable_8259A_irq,
> - .ack = mask_and_ack_8259A,
> - .end = end_8259A_irq,
> +static struct irq_chip i8259A_chip = {
> + .name = "XT-PIC",
> + .mask = disable_8259A_irq,
> + .unmask = enable_8259A_irq,
> + .mask_ack = mask_and_ack_8259A,
> };
I wonder whose idea was to call this device XT-PIC. XT never had dual
8259A PICs and so was capable of handling only 8 IRQs. Dual 8259A was first
used in the AT class machines...
> @@ -84,23 +74,23 @@ void enable_8259A_irq(unsigned int irq)
> spin_lock_irqsave(&i8259A_lock, flags);
> cached_irq_mask &= mask;
> if (irq & 8)
> - outb(cached_A1,0xA1);
> + outb(cached_slave_mask, PIC_SLAVE_IMR);
> else
> - outb(cached_21,0x21);
> + outb(cached_master_mask, PIC_MASTER_IMR);
> spin_unlock_irqrestore(&i8259A_lock, flags);
> }
>
> int i8259A_irq_pending(unsigned int irq)
> {
> - unsigned int mask = 1 << irq;
> + unsigned int mask = 1<<irq;
Unnecassary, to say the least.
> @@ -109,7 +99,8 @@ int i8259A_irq_pending(unsigned int irq)
> void make_8259A_irq(unsigned int irq)
> {
> disable_irq_nosync(irq);
> - set_irq_chip(irq, &i8259A_irq_type);
> + set_irq_chip_and_handler_name(irq, &i8259A_chip, handle_level_irq,
> + "XT");
No! Do not evoke the memory of XT anymore, let it rest in peace at last!
Call it 8259A, please.
> @@ -122,17 +113,17 @@ void make_8259A_irq(unsigned int irq)
> static inline int i8259A_irq_real(unsigned int irq)
> {
> int value;
> - int irqmask = 1 << irq;
> + int irqmask = 1<<irq;
Unnecessary too.
> @@ -214,15 +207,52 @@ spurious_8259A_irq:
> }
> }
>
> +static char irq_trigger[2];
> +/**
> + * ELCR registers (0x4d0, 0x4d1) control edge/level of IRQ
> + */
> +static void restore_ELCR(char *trigger)
> +{
> + outb(trigger[0], 0x4d0);
> + outb(trigger[1], 0x4d1);
> +}
> +
> +static void save_ELCR(char *trigger)
> +{
> + /* IRQ 0,1,2,8,13 are marked as reserved */
> + trigger[0] = inb(0x4d0) & 0xF8;
> + trigger[1] = inb(0x4d1) & 0xDE;
Erm, the bits should be zero, why mask them out I wonder...
WBR, Sergei
next prev parent reply other threads:[~2006-12-06 13:15 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-05 16:23 [PATCH] Import updates from i386's i8259.c Atsushi Nemoto
2006-12-05 16:50 ` Franck Bui-Huu
2006-12-05 16:52 ` Ralf Baechle
2006-12-05 17:10 ` Franck Bui-Huu
2006-12-06 1:28 ` Atsushi Nemoto
2006-12-06 1:45 ` Ralf Baechle
2006-12-05 19:49 ` Ralf Baechle
2006-12-05 19:57 ` Ralf Baechle
2006-12-06 1:39 ` Atsushi Nemoto
2006-12-06 1:58 ` Ralf Baechle
2006-12-06 2:56 ` Atsushi Nemoto
2006-12-06 4:38 ` anemo
2006-12-06 13:17 ` Sergei Shtylyov [this message]
2006-12-06 13:48 ` Maciej W. Rozycki
2006-12-06 13:53 ` Sergei Shtylyov
2006-12-06 14:41 ` Maciej W. Rozycki
2006-12-06 15:12 ` Sergei Shtylyov
2006-12-06 15:43 ` Maciej W. Rozycki
2006-12-06 15:48 ` Sergei Shtylyov
2006-12-06 19:00 ` Maciej W. Rozycki
2006-12-06 17:03 ` Atsushi Nemoto
2006-12-06 20:32 ` Ralf Baechle
2006-12-06 12:07 ` Ralf Baechle
2006-12-06 8:40 ` Franck Bui-Huu
2006-12-07 3:17 ` Atsushi Nemoto
2006-12-07 7:34 ` Franck Bui-Huu
2006-12-07 11:50 ` Ralf Baechle
2006-12-07 13:32 ` Maciej W. Rozycki
2006-12-07 13:37 ` Ralf Baechle
2006-12-07 13:51 ` Sergei Shtylyov
2006-12-07 15:03 ` Maciej W. Rozycki
2006-12-07 15:09 ` Ralf Baechle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4576C2E9.4060900@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=anemo@mba.sphere.ne.jp \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.