From patchwork Thu Jun 2 08:41:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9149543 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E2A176074E for ; Thu, 2 Jun 2016 08:42:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3998263DC for ; Thu, 2 Jun 2016 08:42:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8772271FD; Thu, 2 Jun 2016 08:42:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0C6E263DC for ; Thu, 2 Jun 2016 08:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752759AbcFBImF (ORCPT ); Thu, 2 Jun 2016 04:42:05 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:32781 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752502AbcFBImA (ORCPT ); Thu, 2 Jun 2016 04:42:00 -0400 Received: by mail-lf0-f50.google.com with SMTP id s64so29211838lfe.0 for ; Thu, 02 Jun 2016 01:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vF7/VJwc4oe7lLXtAztJLYBJ/hamxH0n/N3x65ery4Y=; b=pAGA7TodDQHwSydAzhDs7K/YJBgBEryJdSIXdLE84sT9xZ0Qj4IIZfgVgO8AmP9kdp YjTljx0nlbkpbeawHoP/9EUCj+8r2RI0Mj0gpWVSWuC5HqZR9vl0nPYuDS0FsBCR2vQ2 EMTpL1Hcgvp96dFKPQySyjlLKnI1a9IC8nM/LSUnke0NkPgwNuqSlEmJ3SDsxDExvTRT Kuwhx7k2XS1hafHKC+PMndE4IX4kBHmbYz/dkIPKivaRXy4wba/v0r/l7DTkmmQfo4kE eaFjtwU1Z1rQ32FDpgJtm8Y2WLDc717BpDqxWST7bl2Fz3QkOpI5geYep0rD3hwTaxcZ mJgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vF7/VJwc4oe7lLXtAztJLYBJ/hamxH0n/N3x65ery4Y=; b=It/5igtxepayrxCQvNHFuxDgiVT9WoFVOvZg0X+HK7StYtWGPE72IVbM/3cQseIweB SQ3g+DkpNhSWvB8zVp+w9XDvmG4t0T0F23RxfNOym1LsSL18z8QDHvaY/nrCGt//a++5 MI2sPuZPjAgSC7oujuPsYoOQgegYuo95xHVV7rSufhBdi6RasTnD/D6PyOin/vkJJUKD tWm8frHQy0+ptv4CrnRw4psj6vFowtjC+mrPPhgAk29xVlcaPL5D7nB7y6+XYPnLsSji hB4FM3Z99LBa/EBvYAPvzs4fiNC5jkLnHsylhXWYfKHOF4dY94Di5FwZ2FM62wO71Vf+ Qg6g== X-Gm-Message-State: ALyK8tKXhZR5FXxZVCTLLIS6U/9kIjxVbxglF/GjUWtEVU+ByqVQrz4ijeDwPSZQ3Yulxw== X-Received: by 10.25.31.130 with SMTP id f124mr3139740lff.177.1464856918907; Thu, 02 Jun 2016 01:41:58 -0700 (PDT) Received: from tn-HP-4.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h23sm3972815lji.23.2016.06.02.01.41.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Jun 2016 01:41:58 -0700 (PDT) From: Tomasz Nowicki To: helgaas@kernel.org, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rafael@kernel.org, hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com, okaya@codeaurora.org, jchandra@broadcom.com Cc: robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, wangyijing@huawei.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, jcm@redhat.com, andrea.gallo@linaro.org, dhdang@apm.com, jeremy.linton@arm.com, liudongdong3@huawei.com, cov@codeaurora.org, Tomasz Nowicki Subject: [RFC PATCH 2/3] arm64, pci: Start using quirks handling for ACPI based PCI host controller. Date: Thu, 2 Jun 2016 10:41:02 +0200 Message-Id: <1464856864-18049-3-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464856864-18049-1-git-send-email-tn@semihalf.com> References: <1464856864-18049-1-git-send-email-tn@semihalf.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP pci_generic_ecam_ops is used by default. Since there are platforms which have non-compliant ECAM space we need to overwrite these accessors prior to PCI buses enumeration. In order to do that we call pci_mcfg_get_ops to retrieve pci_ecam_ops structure so that we can use proper PCI config space accessors and bus_shift. pci_generic_ecam_ops is still used for platforms free from quirks. Signed-off-by: Tomasz Nowicki --- arch/arm64/kernel/pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 39f2a40..3a83c28 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -140,6 +140,7 @@ static int pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root, struct resource cfgres; unsigned int bsz; int err; + struct pci_ecam_ops *ops; err = pci_mcfg_lookup(root); if (err) { @@ -147,12 +148,12 @@ static int pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root, return err; } - bsz = 1 << pci_generic_ecam_ops.bus_shift; + ops = pci_mcfg_get_ops(root); + bsz = 1 << ops->bus_shift; cfgres.start = root->mcfg_addr + bus_res->start * bsz; cfgres.end = cfgres.start + resource_size(bus_res) * bsz - 1; cfgres.flags = IORESOURCE_MEM; - cfg = pci_ecam_create(&root->device->dev, &cfgres, bus_res, - &pci_generic_ecam_ops); + cfg = pci_ecam_create(&root->device->dev, &cfgres, bus_res, ops); if (IS_ERR(cfg)) { pr_err("%04x:%pR error %ld mapping CAM\n", seg, bus_res, PTR_ERR(cfg));