public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.4.21 Interrupt polarity fix
@ 2003-07-31  4:53 Takayoshi Kochi
  2003-08-05 22:16 ` Bjorn Helgaas
  2003-08-06  1:22 ` Takayoshi Kochi
  0 siblings, 2 replies; 3+ messages in thread
From: Takayoshi Kochi @ 2003-07-31  4:53 UTC (permalink / raw)
  To: linux-ia64

[-- Attachment #1: Type: Text/Plain, Size: 1093 bytes --]

Hi Bjorn,

It seems that acpi_register_intr (in arch/ia64/kernel/acpi.c)
takes an interrupt polarity/trigger in opposite way.
Attached patch fixes this.  Please apply.

drivers/acpi/resource/rsirq.c decodes ACPI extended irq
resource and stores in edge_level and active_high_low members
of a structure (BTW, I think the names of these members
are source of confusion ;).

And this logic in acpi.c inverts both polarity and trigger.

vector = iosapic_register_intr(gsi,
	polarity ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
	mode ? IOSAPIC_EDGE : IOSAPIC_LEVEL);

       ACPI -> rsirq.c -> serial.c -> acpi.c            -> iosapic.c
High      0         0           0      IOSAPIC_POL_LOW
Low       1         1           1      IOSAPIC_POL_HIGH
Edge      1         0           0      IOSAPIC_LEVEL
Level     0         1           1      IOSAPIC_EDGE

As ACPI_ACTIVE_{HIGH,LOW} and ACPI_{LEVEL,EDGE}_SENSITIVE are
defined in acpi subsystem, it should be safer to use these symbols.

---
1st Computer Software Division, NEC Corporation
Takayoshi Kochi <kochi@hpc.bs1.fc.nec.co.jp/t-kochi@bq.jp.nec.com>

[-- Attachment #2: acpi-int-pol.patch --]
[-- Type: Text/Plain, Size: 525 bytes --]

--- linux-2.4.21.orig/arch/ia64/kernel/acpi.c	Thu Jul 31 13:14:21 2003
+++ linux-2.4.21/arch/ia64/kernel/acpi.c	Thu Jul 31 13:42:36 2003
@@ -643,8 +643,9 @@
 		return 0;
 
 	/* Turn it on */
-	vector = iosapic_register_intr(gsi, polarity ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-			mode ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+	vector = iosapic_register_intr(gsi,
+		       	(polarity == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
+			(mode == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
 	return vector;
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 2.4.21 Interrupt polarity fix
  2003-07-31  4:53 [PATCH] 2.4.21 Interrupt polarity fix Takayoshi Kochi
@ 2003-08-05 22:16 ` Bjorn Helgaas
  2003-08-06  1:22 ` Takayoshi Kochi
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2003-08-05 22:16 UTC (permalink / raw)
  To: linux-ia64

On Wednesday 30 July 2003 10:53 pm, Takayoshi Kochi wrote:
> It seems that acpi_register_intr (in arch/ia64/kernel/acpi.c)
> takes an interrupt polarity/trigger in opposite way.
> Attached patch fixes this.  Please apply.

Thanks.  This was indeed very confusing.  I applied the
following patch for 2.4.  The corresponding patch you
posted on August 4 for 2.6 appears functionally identical
but reverses the sense of the polarity test for no good
reason.  Can you send David a revised patch that does
it the same was as the one below?

Bjorn

#### AUTHOR kochi@hpc.bs1.fc.nec.co.jp
#### COMMENT START
### Comments for ChangeSet
ia64: Fix ACPI interrupt polarity/trigger interpretation

It seems that acpi_register_intr (in arch/ia64/kernel/acpi.c)
takes an interrupt polarity/trigger in opposite way.
Attached patch fixes this.  Please apply.

drivers/acpi/resource/rsirq.c decodes ACPI extended irq
resource and stores in edge_level and active_high_low members
of a structure (BTW, I think the names of these members
are source of confusion ;).

And this logic in acpi.c inverts both polarity and trigger.

vector = iosapic_register_intr(gsi,
        polarity ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
        mode ? IOSAPIC_EDGE : IOSAPIC_LEVEL);

       ACPI -> rsirq.c -> serial.c -> acpi.c            -> iosapic.c
High      0         0           0      IOSAPIC_POL_LOW
Low       1         1           1      IOSAPIC_POL_HIGH
Edge      1         0           0      IOSAPIC_LEVEL
Level     0         1           1      IOSAPIC_EDGE

As ACPI_ACTIVE_{HIGH,LOW} and ACPI_{LEVEL,EDGE}_SENSITIVE are
defined in acpi subsystem, it should be safer to use these symbols.
### Comments for arch/ia64/kernel/acpi.c
Fix ACPI interrupt polarity/trigger interpretation
#### COMMENT END

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1060  -> 1.1061 
#	arch/ia64/kernel/acpi.c	1.16    -> 1.17   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/08/05	bjorn.helgaas@hp.com	1.1061
# find intrs
# --------------------------------------------
#
diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
--- a/arch/ia64/kernel/acpi.c	Tue Aug  5 17:00:35 2003
+++ b/arch/ia64/kernel/acpi.c	Tue Aug  5 17:00:35 2003
@@ -643,8 +643,9 @@
 		return 0;
 
 	/* Turn it on */
-	vector = iosapic_register_intr(gsi, polarity ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
-			mode ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
+	vector = iosapic_register_intr(gsi,
+		       	(polarity = ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
+			(mode = ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
 	return vector;
 }
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 2.4.21 Interrupt polarity fix
  2003-07-31  4:53 [PATCH] 2.4.21 Interrupt polarity fix Takayoshi Kochi
  2003-08-05 22:16 ` Bjorn Helgaas
@ 2003-08-06  1:22 ` Takayoshi Kochi
  1 sibling, 0 replies; 3+ messages in thread
From: Takayoshi Kochi @ 2003-08-06  1:22 UTC (permalink / raw)
  To: linux-ia64

[-- Attachment #1: Type: Text/Plain, Size: 866 bytes --]

From: Bjorn Helgaas <bjorn.helgaas@hp.com>
Subject: Re: [PATCH] 2.4.21 Interrupt polarity fix
Date: Tue, 5 Aug 2003 16:16:07 -0600

> On Wednesday 30 July 2003 10:53 pm, Takayoshi Kochi wrote:
> > It seems that acpi_register_intr (in arch/ia64/kernel/acpi.c)
> > takes an interrupt polarity/trigger in opposite way.
> > Attached patch fixes this.  Please apply.
> 
> Thanks.  This was indeed very confusing.  I applied the
> following patch for 2.4.  The corresponding patch you
> posted on August 4 for 2.6 appears functionally identical
> but reverses the sense of the polarity test for no good
> reason.  Can you send David a revised patch that does
> it the same was as the one below?

Thanks for the comment.  The revised patch is attached.

---
1st Computer Software Division, NEC Corporation
Takayoshi Kochi <kochi@hpc.bs1.fc.nec.co.jp/t-kochi@bq.jp.nec.com>

[-- Attachment #2: ia64-acpi.c.2.diff --]
[-- Type: Text/Plain, Size: 679 bytes --]

Index: dcm-260t2/arch/ia64/kernel/acpi.c
===================================================================
RCS file: /data/cvsroot/lia64-2.5/arch/ia64/kernel/acpi.c,v
retrieving revision 1.1.1.19
diff -u -r1.1.1.19 acpi.c
--- dcm-260t2/arch/ia64/kernel/acpi.c	29 Jul 2003 10:33:17 -0000	1.1.1.19
+++ dcm-260t2/arch/ia64/kernel/acpi.c	6 Aug 2003 01:19:11 -0000
@@ -727,7 +727,9 @@
 		return 0;
 
 	/* Turn it on */
-	vector = iosapic_register_intr (gsi, polarity, trigger);
+	vector = iosapic_register_intr (gsi,
+			(polarity == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
+			(trigger == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
 	return vector;
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-06  1:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-31  4:53 [PATCH] 2.4.21 Interrupt polarity fix Takayoshi Kochi
2003-08-05 22:16 ` Bjorn Helgaas
2003-08-06  1:22 ` Takayoshi Kochi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox