From: Stephen Hemminger <shemminger@osdl.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [RFC 1/2] irq: record edge-level setting
Date: Mon, 24 Apr 2006 14:22:43 -0700 [thread overview]
Message-ID: <20060424142243.519d61f1@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.64.0604241354200.3701@g5.osdl.org>
Record the level vs edge-triggered status of IRQ to allow for error checks later.
Note: this is only done fir i386/x86_64.
--- irq.orig/arch/i386/kernel/i8259.c
+++ irq/arch/i386/kernel/i8259.c
@@ -128,11 +128,22 @@ int i8259A_irq_pending(unsigned int irq)
return ret;
}
+static int i8259A_trigger(unsigned int irq)
+{
+ if (irq & 8)
+ return inb(0x4d1) & (1<< (irq-8));
+ else
+ return inb(0x4d0) & (1<<irq);
+}
+
+
void make_8259A_irq(unsigned int irq)
{
disable_irq_nosync(irq);
io_apic_irqs &= ~(1<<irq);
irq_desc[irq].handler = &i8259A_irq_type;
+ if (i8259A_trigger(irq))
+ irq_desc[irq].status |= IRQ_LEVEL;
enable_irq(irq);
}
--- irq.orig/arch/i386/kernel/io_apic.c
+++ irq/arch/i386/kernel/io_apic.c
@@ -1186,17 +1186,23 @@ static inline void ioapic_register_intr(
{
if (use_pci_vector() && !platform_legacy_irq(irq)) {
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
- trigger == IOAPIC_LEVEL)
+ trigger == IOAPIC_LEVEL) {
irq_desc[vector].handler = &ioapic_level_type;
- else
+ irq_desc[vector].status |= IRQ_LEVEL;
+ } else {
irq_desc[vector].handler = &ioapic_edge_type;
+ irq_desc[vector].status &= ~IRQ_LEVEL;
+ }
set_intr_gate(vector, interrupt[vector]);
} else {
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
- trigger == IOAPIC_LEVEL)
+ trigger == IOAPIC_LEVEL) {
irq_desc[irq].handler = &ioapic_level_type;
- else
+ irq_desc[irq].status |= IRQ_LEVEL;
+ } else {
irq_desc[irq].handler = &ioapic_edge_type;
+ irq_desc[irq].status &= ~IRQ_LEVEL;
+ }
set_intr_gate(vector, interrupt[irq]);
}
}
--- irq.orig/arch/x86_64/kernel/i8259.c
+++ irq/arch/x86_64/kernel/i8259.c
@@ -231,11 +231,22 @@ int i8259A_irq_pending(unsigned int irq)
return ret;
}
+static int i8259A_trigger(unsigned int irq)
+{
+ if (irq & 8)
+ return inb(0x4d1) & (1<< (irq-8));
+ else
+ return inb(0x4d0) & (1<<irq);
+}
+
+
void make_8259A_irq(unsigned int irq)
{
disable_irq_nosync(irq);
io_apic_irqs &= ~(1<<irq);
irq_desc[irq].handler = &i8259A_irq_type;
+ if (i8259A_trigger(irq))
+ irq_desc[irq].status |= IRQ_LEVEL;
enable_irq(irq);
}
--- irq.orig/arch/x86_64/kernel/io_apic.c
+++ irq/arch/x86_64/kernel/io_apic.c
@@ -848,17 +848,23 @@ static inline void ioapic_register_intr(
{
if (use_pci_vector() && !platform_legacy_irq(irq)) {
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
- trigger == IOAPIC_LEVEL)
+ trigger == IOAPIC_LEVEL) {
irq_desc[vector].handler = &ioapic_level_type;
- else
+ irq_desc[vector].status |= IRQ_LEVEL;
+ } else {
irq_desc[vector].handler = &ioapic_edge_type;
+ irq_desc[vector].status &= ~IRQ_LEVEL;
+ }
set_intr_gate(vector, interrupt[vector]);
} else {
if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
- trigger == IOAPIC_LEVEL)
+ trigger == IOAPIC_LEVEL) {
irq_desc[irq].handler = &ioapic_level_type;
- else
+ irq_desc[irq].status |= IRQ_LEVEL;
+ } else {
irq_desc[irq].handler = &ioapic_edge_type;
+ irq_desc[irq].status &= ~IRQ_LEVEL;
+ }
set_intr_gate(vector, interrupt[irq]);
}
}
next prev parent reply other threads:[~2006-04-24 21:22 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-24 18:41 better leve triggered IRQ management needed Stephen Hemminger
2006-04-24 18:59 ` linux-os (Dick Johnson)
2006-04-24 19:02 ` Linus Torvalds
2006-04-24 19:08 ` Linus Torvalds
2006-04-24 19:53 ` Arjan van de Ven
2006-04-24 20:16 ` Alan Cox
2006-04-24 20:43 ` Arjan van de Ven
2006-04-24 21:07 ` Linus Torvalds
2006-04-24 21:20 ` Alan Cox
2006-04-24 22:26 ` Linus Torvalds
2006-04-24 21:22 ` Stephen Hemminger [this message]
2006-04-24 21:49 ` [RFC 1/2] irq: record edge-level setting Alan Cox
2006-04-24 21:41 ` Stephen Hemminger
2006-04-24 22:34 ` Linus Torvalds
2006-04-24 22:58 ` Stephen Hemminger
[not found] ` <20060424141926.3872f921@localhost.localdomain>
2006-04-24 21:22 ` [RFC 2/2] warn on shared edge-triggered irq Stephen Hemminger
2006-04-25 15:23 ` better leve triggered IRQ management needed Michael Buesch
2006-04-24 19:15 ` Russell King
2006-04-24 20:18 ` Linus Torvalds
2006-04-24 19:25 ` Stephen Hemminger
2006-04-24 19:35 ` linux-os (Dick Johnson)
2006-04-24 20:19 ` Linus Torvalds
2006-04-24 20:50 ` linux-os (Dick Johnson)
2006-04-24 21:09 ` Linus Torvalds
2006-04-29 21:25 ` Alan Cox
2006-04-29 21:58 ` Linus Torvalds
2006-04-30 4:48 ` Neil Brown
2006-04-30 5:19 ` Linus Torvalds
2006-04-30 6:13 ` Neil Brown
2006-04-30 6:59 ` Linus Torvalds
2006-05-02 5:10 ` Neil Brown
2006-05-02 15:05 ` Linus Torvalds
2006-04-30 7:36 ` Arjan van de Ven
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=20060424142243.519d61f1@localhost.localdomain \
--to=shemminger@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).