From patchwork Fri Jan 29 09:05:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jayachandran C." X-Patchwork-Id: 8160361 Return-Path: X-Original-To: patchwork-xen-devel@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 0A5809F9A0 for ; Fri, 29 Jan 2016 08:44:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 347C42037E for ; Fri, 29 Jan 2016 08:44:09 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D190201D3 for ; Fri, 29 Jan 2016 08:44:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aP4c3-0007dR-Hw; Fri, 29 Jan 2016 08:41:03 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aP4c2-0007dE-4T for xen-devel@lists.xenproject.org; Fri, 29 Jan 2016 08:41:02 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 10/B3-03066-D952BA65; Fri, 29 Jan 2016 08:41:01 +0000 X-Env-Sender: jchandra@broadcom.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1454056859!19092262!1 X-Originating-IP: [216.31.210.64] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13386 invoked from network); 29 Jan 2016 08:41:00 -0000 Received: from mail-gw3-out.broadcom.com (HELO mail-gw3-out.broadcom.com) (216.31.210.64) by server-8.tower-31.messagelabs.com with SMTP; 29 Jan 2016 08:41:00 -0000 X-IronPort-AV: E=Sophos;i="5.22,363,1449561600"; d="scan'208";a="86471033" Received: from irvexchcas06.broadcom.com (HELO IRVEXCHCAS06.corp.ad.broadcom.com) ([10.9.208.53]) by mail-gw3-out.broadcom.com with ESMTP; 29 Jan 2016 01:21:46 -0800 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.3.235.1; Fri, 29 Jan 2016 00:40:59 -0800 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.235.1; Fri, 29 Jan 2016 00:40:58 -0800 Received: from netl-snoppy.ban.broadcom.com (unknown [10.132.128.129]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 5267440FE8; Fri, 29 Jan 2016 00:37:03 -0800 (PST) From: Jayachandran C To: , Bjorn Helgaas , , Arnd Bergmann , , "Rafael J. Wysocki" Date: Fri, 29 Jan 2016 14:35:39 +0530 Message-ID: <1454058340-7904-5-git-send-email-jchandra@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454058340-7904-1-git-send-email-jchandra@broadcom.com> References: <1454058340-7904-1-git-send-email-jchandra@broadcom.com> MIME-Version: 1.0 Cc: Tomasz Nowicki , Lorenzo Pieralisi , Jayachandran C , xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v7 4/5] arm64: pci: Add ACPI support X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 and prepare arm64 for using CONFIG_ACPI_PCI_HOST_GENERIC for the ACPI based PCI controller. pci_acpi_scan_root(), raw_pci_read() and raw_pci_write() are marked as weak so that they can be implemented by the generic ACPI PCI driver. pcibios_enable_device() and pcibios_disable_device() have been added to handle acpi irq enable and disable. pcibios_add_bus() and pcibios_remove_bus() have been added call the corresponding ACPI functions. Signed-off-by: Jayachandran C --- arch/arm64/Kconfig | 3 +++ arch/arm64/kernel/pci.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 8cc6228..6bb21d8 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -234,6 +234,9 @@ config PCI_DOMAINS_GENERIC config PCI_SYSCALL def_bool PCI +config PCI_MMCONFIG + def_bool PCI && ACPI + source "drivers/pci/Kconfig" source "drivers/pci/pcie/Kconfig" source "drivers/pci/hotplug/Kconfig" diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index b3d098b..db0a6a9 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 */ @@ -62,15 +76,15 @@ int pcibios_add_device(struct pci_dev *dev) } /* - * raw_pci_read/write - Platform-specific PCI config space access. + * ACPI uses these - leave it to the generic ACPI PCI driver */ -int raw_pci_read(unsigned int domain, unsigned int bus, +int __weak raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, int reg, int len, u32 *val) { return -ENXIO; } -int raw_pci_write(unsigned int domain, unsigned int bus, +int __weak raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, int reg, int len, u32 val) { return -ENXIO; @@ -78,9 +92,19 @@ 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); +} + #endif