From patchwork Tue Feb 26 15:25:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 2186001 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B8D5EDF215 for ; Tue, 26 Feb 2013 15:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759646Ab3BZPbf (ORCPT ); Tue, 26 Feb 2013 10:31:35 -0500 Received: from mail-da0-f51.google.com ([209.85.210.51]:49963 "EHLO mail-da0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759685Ab3BZPbd (ORCPT ); Tue, 26 Feb 2013 10:31:33 -0500 Received: by mail-da0-f51.google.com with SMTP id n15so2069561dad.10 for ; Tue, 26 Feb 2013 07:31:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=m3zJ7nl25wC/GdB6Yv89KVacszTFSCMbg3xIS0sT7qA=; b=wT/qY1jJMgE1QHC+yAvDVcrg6n0A3Jl/C7InyogyayrJJPcV9eZt8iQsZhvOL7DFH6 dyqKbI8fSma0ZSQoDwohw3EY48iCBcOLnQafHgNlj8GLpPehSiAXatk4tPSq+i5BaSgj IDQDdNmzgBT4IWgpnBKgAexHjs2pga3r48IPXZ5wPCC1eYnfGpYb89YeANkERZrQMOih I8YKOaulMVS9FYxjPbv9zUeHePQawIgALtfd72diW5RlqlR1ovf6P1e50ZTc7wG7irsC jvbISM1ZBVbKsNqO6GJbqvw1vo5vCOGsVFNvcIMWl93JH2qUe26oOcCnOAN+GPuIqFBy MIhw== X-Received: by 10.68.197.202 with SMTP id iw10mr23848692pbc.207.1361892692820; Tue, 26 Feb 2013 07:31:32 -0800 (PST) Received: from localhost.localdomain ([114.250.77.63]) by mx.google.com with ESMTPS id gg7sm1229055pbc.45.2013.02.26.07.31.19 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Feb 2013 07:31:32 -0800 (PST) From: Jiang Liu To: Bjorn Helgaas , "Rafael J . Wysocki" Cc: Jiang Liu , Yinghai Lu , Yijing Wang , Jiang Liu , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Greg Kroah-Hartman , ACPI Devel Maling List , Toshi Kani , Myron Stowe , "Rafael J. Wysocki" , Tony Luck , Fenghua Yu , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , linux-ia64@vger.kernel.org, x86@kernel.org Subject: [PATCH v8 06/13] PCI, ACPI: prepare stub functions to handle ACPI PCI (hotplug) slots Date: Tue, 26 Feb 2013 23:25:46 +0800 Message-Id: <1361892353-14786-7-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361892353-14786-1-git-send-email-jiang.liu@huawei.com> References: <1361892353-14786-1-git-send-email-jiang.liu@huawei.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Prepare two stub functions to handle ACPI PCI slots and ACPI PCI hotplug slots, which will be invoked by the PCI core when creating/destroying PCI buses. It will be used to get rid of ACPI PCI subdrivers for pci_slot and acpiphp, and eventually remove the ACPI PCI subdriver mechanism. And it will also be used to handle ACPI PCI (hotplug) slots in a unified way, both at boot time and for PCI hotplug operations. Signed-off-by: Jiang Liu Signed-off-by: Yijing Wang Cc: Yinghai Lu Cc: "Rafael J. Wysocki" Cc: Toshi Kani Cc: Tony Luck Cc: Fenghua Yu Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Myron Stowe Cc: linux-pci@vger.kernel.org Cc: linux-ia64@vger.kernel.org Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/pci/pci-acpi.c | 24 ++++++++++++++++++++++++ include/linux/pci-acpi.h | 8 +++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index c685ff5..99878ac 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -287,6 +287,30 @@ static struct pci_platform_pm_ops acpi_pci_platform_pm = { .run_wake = acpi_pci_run_wake, }; +void acpi_pci_add_bus(struct pci_bus *bus) +{ + acpi_handle handle = NULL; + + if (bus->bridge) + handle = ACPI_HANDLE(bus->bridge); + if (acpi_pci_disabled || handle == NULL) + return; + + /* TODO: add PCI slots and acpiphp hotplug slots */ +} + +void acpi_pci_remove_bus(struct pci_bus *bus) +{ + /* + * bus->bridge->acpi_node.handle has already been reset to NULL + * when acpi_pci_remove_bus() is called, so don't check ACPI handle. + */ + if (acpi_pci_disabled) + return; + + /* TODO: remove PCI slots and acpiphp hotplug slots */ +} + /* ACPI bus type */ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) { diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 9a22b5e..2b1743c 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -41,7 +41,13 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) return DEVICE_ACPI_HANDLE(dev); } -#endif + +void acpi_pci_add_bus(struct pci_bus *bus); +void acpi_pci_remove_bus(struct pci_bus *bus); +#else /* CONFIG_ACPI */ +static inline void acpi_pci_add_bus(struct pci_bus *bus) { } +static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } +#endif /* CONFIG_ACPI */ #ifdef CONFIG_ACPI_APEI extern bool aer_acpi_firmware_first(void);