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: 6406271 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B2877C0432 for ; Thu, 14 May 2015 14:42:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB94720444 for ; Thu, 14 May 2015 14:42:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B88AE20412 for ; Thu, 14 May 2015 14:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752305AbbENOma (ORCPT ); Thu, 14 May 2015 10:42:30 -0400 Received: from foss.arm.com ([217.140.101.70]:39511 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750949AbbENOm3 (ORCPT ); Thu, 14 May 2015 10:42:29 -0400 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 Cc: Lorenzo Pieralisi , Arnd Bergmann , Will Deacon , Liviu Dudau , Bjorn Helgaas , Krzysztof Halasa , Phil Edworthy , Jason Gunthorpe , Jingoo Han , Russell King , Lucas Stach , Simon Horman , Minghuan Lian , Murali Karicheri , Tanmay Inamdar , Kishon Vijay Abraham I , Thierry Reding , Thomas Petazzoni , Jayachandran C , Suravee Suthikulpanit 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> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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; }