From patchwork Thu May 14 14:42:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 6406311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F39989F1CC for ; Thu, 14 May 2015 14:47:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2731F2021B for ; Thu, 14 May 2015 14:47:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3FA4E2025A for ; Thu, 14 May 2015 14:47:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YsuMM-00083P-EE; Thu, 14 May 2015 14:43:38 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YsuLW-0007Fw-PR for linux-arm-kernel@lists.infradead.org; Thu, 14 May 2015 14:42:47 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A8A782A; Thu, 14 May 2015 07:41:50 -0700 (PDT) Received: from red-moon.cambridge.arm.com (red-moon.cambridge.arm.com [10.1.203.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A1E1E3F21B; Thu, 14 May 2015 07:42:25 -0700 (PDT) From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org Subject: [RFC/RFT PATCH 2/2] ARM64: kernel: pci: implement PCI device resources claiming Date: Thu, 14 May 2015 15:42:16 +0100 Message-Id: <1431614537-16136-2-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1431614537-16136-1-git-send-email-lorenzo.pieralisi@arm.com> References: <1431614537-16136-1-git-send-email-lorenzo.pieralisi@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150514_074246_953630_F7678E89 X-CRM114-Status: GOOD ( 11.99 ) X-Spam-Score: -5.0 (-----) Cc: Thomas Petazzoni , Phil Edworthy , Lorenzo Pieralisi , Russell King , Arnd Bergmann , Will Deacon , Jingoo Han , Liviu Dudau , Jayachandran C , Kishon Vijay Abraham I , Jason Gunthorpe , Minghuan Lian , Simon Horman , Krzysztof Halasa , Murali Karicheri , Suravee Suthikulpanit , Bjorn Helgaas , Thierry Reding , Tanmay Inamdar , Lucas Stach X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When a device is scanned and added to the PCI bus, its resources should be claimed to validate the BARs configuration and to assign them a parent resource so that the resource hierarchy can be sanity checked. This patch adds code that carries out PCI device resources claiming to the ARM64 pcibios_add_device implementation so that device resources are claimed by the core PCI layer upon PCI device initialization on ARM64 systems. Signed-off-by: Lorenzo Pieralisi Cc: Arnd Bergmann Cc: Will Deacon Cc: Liviu Dudau Cc: Bjorn Helgaas --- arch/arm64/kernel/pci.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 4095379..c0a88ca 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -43,8 +43,18 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res, */ int pcibios_add_device(struct pci_dev *dev) { + struct resource *res; + int i; + dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); + for (i = 0; i < PCI_NUM_RESOURCES; i++) { + res = &dev->resource[i]; + if (res->parent || !res->flags) + continue; + pci_claim_resource(dev, i); + } + return 0; }