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: 9149559 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 4B604607D9 for ; Thu, 2 Jun 2016 08:43:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C449263DC for ; Thu, 2 Jun 2016 08:43:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30E5A271FD; Thu, 2 Jun 2016 08:43:57 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE2CA263DC for ; Thu, 2 Jun 2016 08:43:56 +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 1b8OD3-0004qS-K7; Thu, 02 Jun 2016 08:42:33 +0000 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b8OCq-0004m4-OV for linux-arm-kernel@lists.infradead.org; Thu, 02 Jun 2016 08:42:22 +0000 Received: by mail-lf0-x22b.google.com with SMTP id k98so29196814lfi.1 for ; Thu, 02 Jun 2016 01:42:00 -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=Rx3pLzL9V3y/+h+13scSUQ04X349RUkLWnEZTnAq89vy4xxNib57Gr8E3IcY/+Tsmb ldPKJAqkPLrqPiCrN/mWJ8fnMKitDzTmMQK+7EhC89EgiudadeSuxfnuUlAaP9OV1wHN 3IZsQvAOkJzrCsHKPDdgnPapsBeCA2AR8bJl67xFnXRzaBMzVwqm8LF+hIshwb6Uh3Qr Z7cNxXx7Ge4wsW6i0yeO7yJzXocNoNfEhLIf5X7MaxchGTfab2j11CaUPIBfIHnk+eoO w7Qd1JWLa8LGIBoEz18HVdGjceadfd4dR87BfFc7C2K8MJV4EI8UUdFB0gFb7IUYklVn 8qOw== X-Gm-Message-State: ALyK8tKh56cjSnWQzcpSxP3Wub0GUZ2eCZndlaH6JGZ63Qp5NCt34+n+FftWRn/uBUV1Ew== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160602_014221_076079_23173B3F X-CRM114-Status: GOOD ( 12.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jcm@redhat.com, linaro-acpi@lists.linaro.org, linux-pci@vger.kernel.org, dhdang@apm.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, jeremy.linton@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, cov@codeaurora.org, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, wangyijing@huawei.com, Tomasz Nowicki , mw@semihalf.com, andrea.gallo@linaro.org, linux-arm-kernel@lists.infradead.org, liudongdong3@huawei.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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));