From patchwork Wed Dec 2 22:24:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jayachandran C." X-Patchwork-Id: 7753581 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 1D4339F1C2 for ; Wed, 2 Dec 2015 22:04:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4784320544 for ; Wed, 2 Dec 2015 22:04:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9D732054A for ; Wed, 2 Dec 2015 22:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756523AbbLBWEB (ORCPT ); Wed, 2 Dec 2015 17:04:01 -0500 Received: from mail-gw1-out.broadcom.com ([216.31.210.62]:13121 "EHLO mail-gw1-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756683AbbLBWDy (ORCPT ); Wed, 2 Dec 2015 17:03:54 -0500 X-IronPort-AV: E=Sophos;i="5.20,375,1444719600"; d="scan'208";a="82281098" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw1-out.broadcom.com with ESMTP; 02 Dec 2015 16:21:40 -0800 Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.3.235.1; Wed, 2 Dec 2015 14:03:53 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.3.235.1; Wed, 2 Dec 2015 14:03:53 -0800 Received: from netl-snoppy.ban.broadcom.com (unknown [10.132.128.129]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id C5B0840FE8; Wed, 2 Dec 2015 14:00:31 -0800 (PST) From: Jayachandran C To: , CC: Jayachandran C Subject: [PATCH 1/3] arm64: pci: Add ACPI support Date: Thu, 3 Dec 2015 03:54:44 +0530 Message-ID: <1449095086-5138-2-git-send-email-jchandra@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449095086-5138-1-git-send-email-jchandra@broadcom.com> References: <1449095086-5138-1-git-send-email-jchandra@broadcom.com> MIME-Version: 1.0 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 Add functions needed for ACPI support. pci_acpi_scan_root(struct acpi_pci_root *root) is marked as weak so that it can be implemented by the generic acpi pci driver. pcibios_root_bridge_prepare assumes that the sysdata is struct acpi_pci_root_info and sets up the domain and ACPI companion The functions pcibios_enable_device and pcibios_disable_device have been update to handle ACPI irq enable and disable. And pcibios_add_bus and pcibios_remove_bus have been added call the corresponding ACPI functions. Signed-off-by: Jayachandran C --- arch/arm64/kernel/pci.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index b3d098b..8597624 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -48,9 +49,22 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) if (pci_has_flag(PCI_PROBE_ONLY)) return 0; +#ifdef CONFIG_ACPI + if (acpi_find_root_bridge_handle(dev)) + acpi_pci_irq_enable(dev); +#endif + return pci_enable_resources(dev, mask); } +void pcibios_disable_device(struct pci_dev *dev) +{ +#ifdef CONFIG_ACPI + if (acpi_find_root_bridge_handle(dev)) + acpi_pci_irq_disable(dev); +#endif +} + /* * Try to assign the IRQ number from DT when adding a new device */ @@ -78,9 +92,38 @@ int raw_pci_write(unsigned int domain, unsigned int bus, #ifdef CONFIG_ACPI /* Root bridge scanning */ -struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) +struct pci_bus *__weak pci_acpi_scan_root(struct acpi_pci_root *root) { - /* TODO: Should be revisited when implementing PCI on ACPI */ return NULL; } + +void pcibios_add_bus(struct pci_bus *bus) +{ + acpi_pci_add_bus(bus); +} + +void pcibios_remove_bus(struct pci_bus *bus) +{ + acpi_pci_remove_bus(bus); +} + +int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) +{ + if (!acpi_disabled) { + struct pci_bus *b = bridge->bus; + struct acpi_pci_root_info *ci = b->sysdata; + + ACPI_COMPANION_SET(&bridge->dev, ci->bridge); + b->domain_nr = ci->root->segment; + } + return 0; +} + +static int __init pcibios_assign_resources(void) +{ + pci_assign_unassigned_resources(); + return 0; +} + +fs_initcall(pcibios_assign_resources); #endif