From patchwork Wed Jun 15 15:34:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Covington X-Patchwork-Id: 9178803 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 CD85C60776 for ; Wed, 15 Jun 2016 15:36:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCE7A27BFF for ; Wed, 15 Jun 2016 15:36:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B18B327EED; Wed, 15 Jun 2016 15:36:53 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 6FE2A27BFF for ; Wed, 15 Jun 2016 15:36:53 +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 1bDCqr-0005wV-BA; Wed, 15 Jun 2016 15:35:33 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bDCqo-0005kn-MH for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2016 15:35:31 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6BB3561443; Wed, 15 Jun 2016 15:35:10 +0000 (UTC) Received: from illium.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cov@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C348061369; Wed, 15 Jun 2016 15:35:07 +0000 (UTC) From: Christopher Covington To: Tomasz Nowicki , Duc Dang , Dongdong Liu Subject: [RFC PATCH v3 2/2] ARM64/PCI: Start using quirks handling for ACPI based PCI host controller Date: Wed, 15 Jun 2016 11:34:11 -0400 Message-Id: <1466004851-10214-2-git-send-email-cov@codeaurora.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1466004851-10214-1-git-send-email-cov@codeaurora.org> References: <1466004851-10214-1-git-send-email-cov@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160615_083530_762467_F92C96B0 X-CRM114-Status: GOOD ( 13.13 ) 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: Lorenzo Pieralisi , Jayachandran C , Gabriele Paoloni , Jeff Hugo , Jon Masters , Will Deacon , David Daney , linux-kernel@vger.kernel.org, Sinan Kaya , Robert Richter , Hanjun Guo , Suravee Suthikulpanit , Mark Salter , Bjorn Helgaas , Ganapatrao Kulkarni , Catalin Marinas , linux-arm-kernel@lists.infradead.org, Christopher Covington 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 From: Tomasz Nowicki 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 94cd43c..a891bda 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -139,6 +139,7 @@ pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root) struct pci_config_window *cfg; struct resource cfgres; unsigned int bsz; + struct pci_ecam_ops *ops; /* Use address from _CBA if present, otherwise lookup MCFG */ if (!root->mcfg_addr) @@ -150,12 +151,12 @@ pci_acpi_setup_ecam_mapping(struct acpi_pci_root *root) return NULL; } - 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)) { dev_err(&root->device->dev, "%04x:%pR error %ld mapping ECAM\n", seg, bus_res, PTR_ERR(cfg));