From patchwork Wed Jul 15 08:23:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 495517 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 87B9A1402BA for ; Wed, 15 Jul 2015 18:24:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=rnfY2AJS; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0A0C44B6BD; Wed, 15 Jul 2015 10:24:32 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qimoDRKc-1px; Wed, 15 Jul 2015 10:24:31 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1D9524B6C6; Wed, 15 Jul 2015 10:24:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 60C124B686 for ; Wed, 15 Jul 2015 10:24:25 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4XVnV-0LXODt for ; Wed, 15 Jul 2015 10:24:25 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ob0-f173.google.com (mail-ob0-f173.google.com [209.85.214.173]) by theia.denx.de (Postfix) with ESMTPS id 1F33B4B65D for ; Wed, 15 Jul 2015 10:24:22 +0200 (CEST) Received: by obre1 with SMTP id e1so21945708obr.1 for ; Wed, 15 Jul 2015 01:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:subject:date:in-reply-to:references:mime-version :content-type; bh=0wcIlaej7KJvwlb9HC9Z2A9SK3WjrTir/kZngVQuJLo=; b=rnfY2AJSuUUyva11fH+tkBr0QTjKBykhJA+lV8TErvkYByBh0PJGD1MWnmB07/Lqmn 0V1sG5Cq1seqQS3RdfgH1fXUYg2ijVgLAKuzs36H4alqtZBiGcgqhgo4zQgA58C2hdtk izJwbyZGpHVAjF+Sc0+zZbsvGckjFUErT7wc90NyKLZPuGgJEkFiuSGPOeRASVBLopTF D8Kx+cFNJUZQRmTInYOmFmkKDNyZMZkdYFpP2TaTmdMhqe9cfhUfGXjYv7VU7BoPq2YO uC02WsQstInrLOyk8pKH4YqxsZhSVtvzjyVYLrvzsHJlIKv/neIWG0gEjSV/HS5Fp4DH hfOw== X-Received: by 10.202.102.7 with SMTP id a7mr2516081oic.62.1436948661319; Wed, 15 Jul 2015 01:24:21 -0700 (PDT) Received: from mail.hotmail.com (blu004-wss1s3.hotmail.com. [134.170.2.218]) by smtp.gmail.com with ESMTPSA id de16sm2036389oec.6.2015.07.15.01.24.20 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Jul 2015 01:24:20 -0700 (PDT) Received: from BLU437-SMTP18 ([134.170.2.215]) by BLU004-WSS1S3.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Wed, 15 Jul 2015 01:24:20 -0700 X-TMN: [ZgsfD8Lz8RbvilnAL16kri8tZGg0Gej0] Message-ID: From: Bin Meng To: Simon Glass , U-Boot Mailing List , Saket Sinha Date: Wed, 15 Jul 2015 16:23:40 +0800 X-Mailer: git-send-email 2.3.2 (Apple Git-55) In-Reply-To: <1436948627-1521-1-git-send-email-bmeng.cn@gmail.com> References: <1436948627-1521-1-git-send-email-bmeng.cn@gmail.com> X-OriginalArrivalTime: 15 Jul 2015 08:24:18.0779 (UTC) FILETIME=[A4EA02B0:01D0BED7] MIME-Version: 1.0 Subject: [U-Boot] [PATCH 03/10] x86: pci: Assign pci irqs to all functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" We need walk through all functions within a PCI device and assign their IRQs accordingly. Signed-off-by: Bin Meng Acked-by: Simon Glass --- arch/x86/cpu/pci.c | 27 +++++++++++++++++---------- arch/x86/include/asm/pci.h | 3 +-- arch/x86/lib/pirq_routing.c | 3 +-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/arch/x86/cpu/pci.c b/arch/x86/cpu/pci.c index c209f15..fdfd5f7 100644 --- a/arch/x86/cpu/pci.c +++ b/arch/x86/cpu/pci.c @@ -152,23 +152,30 @@ int pci_x86_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, return 0; } -void pci_assign_irqs(int bus, int device, int func, u8 irq[4]) +void pci_assign_irqs(int bus, int device, u8 irq[4]) { pci_dev_t bdf; + int func; + u16 vendor; u8 pin, line; - bdf = PCI_BDF(bus, device, func); + for (func = 0; func < 8; func++) { + bdf = PCI_BDF(bus, device, func); + vendor = x86_pci_read_config16(bdf, PCI_VENDOR_ID); + if (vendor == 0xffff || vendor == 0x0000) + continue; - pin = x86_pci_read_config8(bdf, PCI_INTERRUPT_PIN); + pin = x86_pci_read_config8(bdf, PCI_INTERRUPT_PIN); - /* PCI spec says all values except 1..4 are reserved */ - if ((pin < 1) || (pin > 4)) - return; + /* PCI spec says all values except 1..4 are reserved */ + if ((pin < 1) || (pin > 4)) + continue; - line = irq[pin - 1]; + line = irq[pin - 1]; - debug("Assigning IRQ %d to PCI device %d.%x.%d (INT%c)\n", - line, bus, device, func, 'A' + pin - 1); + debug("Assigning IRQ %d to PCI device %d.%x.%d (INT%c)\n", + line, bus, device, func, 'A' + pin - 1); - x86_pci_write_config8(bdf, PCI_INTERRUPT_LINE, line); + x86_pci_write_config8(bdf, PCI_INTERRUPT_LINE, line); + } } diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 56eaa25..f7e968e 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -72,11 +72,10 @@ int pci_x86_write_config(struct udevice *bus, pci_dev_t bdf, uint offset, * * @bus: PCI bus number * @device: PCI device number - * @func: PCI function number * @irq: An array of IRQ numbers that are assigned to INTA through * INTD of this PCI device. */ -void pci_assign_irqs(int bus, int device, int func, u8 irq[4]); +void pci_assign_irqs(int bus, int device, u8 irq[4]); #endif /* __ASSEMBLY__ */ diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c index 7a34dcf..ba41169 100644 --- a/arch/x86/lib/pirq_routing.c +++ b/arch/x86/lib/pirq_routing.c @@ -98,8 +98,7 @@ void pirq_route_irqs(struct irq_info *irq, int num) } /* Bus, device, slots IRQs for {A,B,C,D} */ - pci_assign_irqs(irq->bus, irq->devfn >> 3, irq->devfn & 7, - irq_slot); + pci_assign_irqs(irq->bus, irq->devfn >> 3, irq_slot); irq++; }