linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew de Quincey <adq_dvb@lidskialf.net>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: torvalds@osdl.org, lkml <linux-kernel@vger.kernel.org>,
	acpi-devel@lists.sourceforge.net, linux-acpi@intel.com
Subject: [PATCH] 2.6.0-test4 ACPI fixes series (2/4)
Date: Sat, 6 Sep 2003 01:57:32 +0100	[thread overview]
Message-ID: <200309060157.32802.adq_dvb@lidskialf.net> (raw)
In-Reply-To: <3F590E28.6090101@pobox.com>

This patch retries IRQ programming with an extended IRQ resource descriptor
if using a standard IRQ descriptor fails.


--- linux-2.6.0-test4.picmode/drivers/acpi/pci_link.c	2003-09-06 00:24:06.666213344 +0100
+++ linux-2.6.0-test4.extirq/drivers/acpi/pci_link.c	2003-09-06 00:26:18.912108912 +0100
@@ -293,7 +293,8 @@
 	struct acpi_buffer	buffer = {sizeof(resource)+1, &resource};
 	int			i = 0;
 	int			valid = 0;
-
+	int			resource_type = 0;
+   
 	ACPI_FUNCTION_TRACE("acpi_pci_link_set");
 
 	if (!link || !irq)
@@ -315,21 +316,33 @@
 			return_VALUE(-EINVAL);
 		}
 	}
+
+	/* If IRQ<=15, first try with a "normal" IRQ descriptor. If that fails, try with
+	 * an extended one */
+	if (irq <= 15) {
+		resource_type = ACPI_RSTYPE_IRQ;
+	} else {
+		resource_type = ACPI_RSTYPE_EXT_IRQ;
+	}
+
+retry_programming:
    
 	memset(&resource, 0, sizeof(resource));
 
 	/* NOTE: PCI interrupts are always level / active_low / shared. But not all
 	   interrupts > 15 are PCI interrupts. Rely on the ACPI IRQ definition for 
 	   parameters */
-	if (irq <= 15) {	
+	switch(resource_type) {
+	case ACPI_RSTYPE_IRQ:
 		resource.res.id = ACPI_RSTYPE_IRQ;
 		resource.res.length = sizeof(struct acpi_resource);
 		resource.res.data.irq.edge_level = link->irq.edge_level;
 		resource.res.data.irq.active_high_low = link->irq.active_high_low;
 		resource.res.data.irq.number_of_interrupts = 1;
 		resource.res.data.irq.interrupts[0] = irq;
-	}
-	else {
+		break;
+	   
+	case ACPI_RSTYPE_EXT_IRQ:
 		resource.res.id = ACPI_RSTYPE_EXT_IRQ;
 		resource.res.length = sizeof(struct acpi_resource);
 		resource.res.data.extended_irq.producer_consumer = ACPI_CONSUMER;
@@ -338,11 +351,22 @@
 		resource.res.data.extended_irq.number_of_interrupts = 1;
 		resource.res.data.extended_irq.interrupts[0] = irq;
 		/* ignore resource_source, it's optional */
+		break;
 	}
 	resource.end.id = ACPI_RSTYPE_END_TAG;
 
 	/* Attempt to set the resource */
 	status = acpi_set_current_resources(link->handle, &buffer);
+   
+
+	/* if we failed and IRQ <= 15, try again with an extended descriptor */
+	if (ACPI_FAILURE(status) && (resource_type == ACPI_RSTYPE_IRQ)) {
+                resource_type = ACPI_RSTYPE_EXT_IRQ;
+                printk(PREFIX "Retrying with extended IRQ descriptor\n");
+                goto retry_programming;
+	}
+  
+	/* check for total failure */
 	if (ACPI_FAILURE(status)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _SRS\n"));
 		return_VALUE(-ENODEV);


  parent reply	other threads:[~2003-09-05 23:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-05 18:58 [PATCH] Next round of ACPI IRQ fixes (VIA ACPI fixed) Andrew de Quincey
2003-09-05 21:35 ` Jeff Garzik
2003-09-05 23:16   ` [ACPI] " Andrew de Quincey
2003-09-05 22:28     ` Jeff Garzik
2003-09-05 22:28       ` Andrew Morton
2003-09-05 22:56         ` Randy.Dunlap
2003-09-06  0:15       ` [PATCH] 2.4.23-pre3 ACPI fixes series (1/3) Andrew de Quincey
2003-09-10 11:45         ` Bernhard Rosenkraenzer
2003-09-10 21:27           ` Andrew de Quincey
2003-09-10 15:31         ` Daniel Egger
2003-09-06  0:15       ` [PATCH] 2.4.23-pre3 ACPI fixes series (2/3) Andrew de Quincey
2003-09-06  0:15       ` [PATCH] 2.4.23-pre3 ACPI fixes series (3/3) Andrew de Quincey
2003-09-06  0:57       ` [PATCH] 2.6.0-test4 ACPI fixes series (1/4) Andrew de Quincey
2003-09-06  0:57       ` Andrew de Quincey [this message]
2003-09-06  0:57       ` [PATCH] 2.6.0-test4 ACPI fixes series (3/4) Andrew de Quincey
2003-09-06  0:57       ` [PATCH] 2.6.0-test4 ACPI fixes series (4/4) Andrew de Quincey
2003-09-06  1:22         ` Jeff Garzik
2003-09-06 12:27           ` [ACPI] " Andrew de Quincey
2003-09-06 13:45             ` Andi Kleen
2003-09-08 19:46           ` Mikael Pettersson
2003-09-06 15:47         ` [ACPI] " Alan Cox
2003-09-07 14:54           ` Andrew de Quincey
2003-09-07 17:59             ` Alan Cox
2003-09-07 20:19               ` Andrew de Quincey
2003-09-06  0:02     ` [ACPI] Re: [PATCH] Next round of ACPI IRQ fixes (VIA ACPI fixed) Chris Wright
2003-09-06  1:21       ` Andrew de Quincey
2003-09-06  0:30         ` Jeff Garzik
2003-09-06  2:03           ` Chris Wright
2003-09-06 12:32             ` Andrew de Quincey
2003-09-11  1:36               ` Chris Wright

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=200309060157.32802.adq_dvb@lidskialf.net \
    --to=adq_dvb@lidskialf.net \
    --cc=acpi-devel@lists.sourceforge.net \
    --cc=jgarzik@pobox.com \
    --cc=linux-acpi@intel.com \
    --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).