From patchwork Fri Jan 9 09:26:48 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 1494 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n099NxNt003124 for ; Fri, 9 Jan 2009 01:24:54 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753616AbZAIJ2g (ORCPT ); Fri, 9 Jan 2009 04:28:36 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753903AbZAIJ2f (ORCPT ); Fri, 9 Jan 2009 04:28:35 -0500 Received: from vms173003pub.verizon.net ([206.46.173.3]:44602 "EHLO vms173003pub.verizon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753616AbZAIJ2T (ORCPT ); Fri, 9 Jan 2009 04:28:19 -0500 Received: from localhost.localdomain ([96.237.168.40]) by vms173003.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0KD7004L36AY3Y4D@vms173003.mailsrvcs.net> for linux-acpi@vger.kernel.org; Fri, 09 Jan 2009 03:28:12 -0600 (CST) Received: from localhost.localdomain (d975xbx2 [127.0.0.1]) by localhost.localdomain (8.14.2/8.14.2) with ESMTP id n099SAsf011983; Fri, 09 Jan 2009 04:28:10 -0500 Received: (from lenb@localhost) by localhost.localdomain (8.14.2/8.14.2/Submit) id n099SA8V011982; Fri, 09 Jan 2009 04:28:10 -0500 Date: Fri, 09 Jan 2009 04:26:48 -0500 From: Len Brown Subject: [PATCH 46/94] ACPI: PCI: always use the PCI INTx pin values, not the _PRT ones In-reply-to: <1231493256-11678-1-git-send-email-lenb@kernel.org> In-reply-to: To: linux-acpi@vger.kernel.org Cc: Bjorn Helgaas , Len Brown Message-id: Organization: Intel Open Source Technology Center X-Mailer: git-send-email 1.6.1.76.gc123b References: <1231493256-11678-1-git-send-email-lenb@kernel.org> References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Bjorn Helgaas This patch changes pci_irq.c to always use PCI INTx pin encodings instead of a mix of PCI and _PRT encodings. The PCI INTx pin numbers from the PCI_INTERRUPT_PIN config register are 0=device doesn't use interrupts, 1=INTA, ..., 4=INTD. But the _PRT table uses 0=INTA, ..., 3=INTD. This patch converts the _PRT encoding to the PCI encoding immediately when we add a _PRT entry to the global list. All the rest of the code can then use the PCI encoding consistently. The point of this is to make the interrupt swizzling look the same as on other architectures, so someday we can unify them. Signed-off-by: Bjorn Helgaas Signed-off-by: Len Brown --- drivers/acpi/pci_irq.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 5ce1fcf..2c52cf0 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -62,7 +62,7 @@ static DEFINE_SPINLOCK(acpi_prt_lock); static inline char pin_name(int pin) { - return 'A' + pin; + return 'A' + pin - 1; } /* -------------------------------------------------------------------------- @@ -203,10 +203,15 @@ acpi_pci_irq_add_entry(acpi_handle handle, if (!entry) return -ENOMEM; + /* + * Note that the _PRT uses 0=INTA, 1=INTB, etc, while PCI uses + * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert + * it here. + */ entry->id.segment = segment; entry->id.bus = bus; entry->id.device = (prt->address >> 16) & 0xFFFF; - entry->pin = prt->pin; + entry->pin = prt->pin + 1; do_prt_fixups(entry, prt); @@ -425,7 +430,7 @@ acpi_pci_irq_derive(struct pci_dev *dev, * PCI interrupt routing entry (eg. yenta bridge and add-in card bridge). */ while (irq < 0 && bridge->bus->self) { - pin = (pin + PCI_SLOT(bridge->devfn)) % 4; + pin = (((pin - 1) + PCI_SLOT(bridge->devfn)) % 4) + 1; bridge = bridge->bus->self; if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { @@ -437,8 +442,6 @@ acpi_pci_irq_derive(struct pci_dev *dev, pci_name(bridge))); return -1; } - /* Pin is from 0 to 3 */ - bridge_pin--; pin = bridge_pin; } @@ -483,7 +486,6 @@ int acpi_pci_irq_enable(struct pci_dev *dev) pci_name(dev))); return 0; } - pin--; /* * First we check the PCI IRQ routing table (PRT) for an IRQ. PRT @@ -566,7 +568,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev) pin = dev->pin; if (!pin) return; - pin--; /* * First we check the PCI IRQ routing table (PRT) for an IRQ.