Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263026AbTIEX7n (ORCPT ); Fri, 5 Sep 2003 19:59:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S265219AbTIEX7m (ORCPT ); Fri, 5 Sep 2003 19:59:42 -0400 Received: from lidskialf.net ([62.3.233.115]:3789 "EHLO beyond.lidskialf.net") by vger.kernel.org with ESMTP id S263026AbTIEX7G (ORCPT ); Fri, 5 Sep 2003 19:59:06 -0400 From: Andrew de Quincey To: Jeff Garzik Subject: [PATCH] 2.6.0-test4 ACPI fixes series (2/4) Date: Sat, 6 Sep 2003 01:57:32 +0100 User-Agent: KMail/1.5.3 Cc: torvalds@osdl.org, lkml , acpi-devel@lists.sourceforge.net, linux-acpi@intel.com References: <200309051958.02818.adq_dvb@lidskialf.net> <200309060016.16545.adq_dvb@lidskialf.net> <3F590E28.6090101@pobox.com> In-Reply-To: <3F590E28.6090101@pobox.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200309060157.32802.adq_dvb@lidskialf.net> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2717 Lines: 82 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); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/