From patchwork Fri Aug 10 06:15:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 1304231 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C67F23FC66 for ; Fri, 10 Aug 2012 06:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754228Ab2HJGPi (ORCPT ); Fri, 10 Aug 2012 02:15:38 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:55424 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754101Ab2HJGPh (ORCPT ); Fri, 10 Aug 2012 02:15:37 -0400 Received: from m3.gw.fujitsu.co.jp (unknown [10.0.50.73]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id 6D3E23EE0C0; Fri, 10 Aug 2012 15:15:36 +0900 (JST) Received: from smail (m3 [127.0.0.1]) by outgoing.m3.gw.fujitsu.co.jp (Postfix) with ESMTP id 4E93B45DEB3; Fri, 10 Aug 2012 15:15:36 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (s3.gw.fujitsu.co.jp [10.0.50.93]) by m3.gw.fujitsu.co.jp (Postfix) with ESMTP id 340C445DEAD; Fri, 10 Aug 2012 15:15:36 +0900 (JST) Received: from s3.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id CFA70E08003; Fri, 10 Aug 2012 15:15:35 +0900 (JST) Received: from m005.s.css.fujitsu.com (m005.s.css.fujitsu.com [10.23.4.35]) by s3.gw.fujitsu.co.jp (Postfix) with ESMTP id 8A5D0E08001; Fri, 10 Aug 2012 15:15:35 +0900 (JST) Received: from m005.css.fujitsu.com (m005 [127.0.0.1]) by m005.s.css.fujitsu.com (Postfix) with ESMTP id B1E6250ECAA; Fri, 10 Aug 2012 15:15:33 +0900 (JST) Received: from DEUCALION (unknown [10.124.101.32]) by m005.s.css.fujitsu.com (Postfix) with SMTP id 2DCEF50ECA6; Fri, 10 Aug 2012 15:15:33 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Date: Fri, 10 Aug 2012 15:15:29 +0900 From: Taku Izumi To: Taku Izumi Cc: linux-pci@vger.kernel.org, bhelgaas@google.com, linux-acpi@vger.kernel.org, kaneshige.kenji@jp.fujitsu.com, yinghai@kernel.org, jiang.liu@huawei.com Subject: [PATCH 7/7][RESEND] ACPI, PCI: add resoruce-assign code for devices under hot-added hostbridge Message-Id: <20120810151529.a92625d2.izumi.taku@jp.fujitsu.com> In-Reply-To: <20120810150955.e4ab3c7f.izumi.taku@jp.fujitsu.com> References: <20120810150955.e4ab3c7f.izumi.taku@jp.fujitsu.com> X-Mailer: Sylpheed 3.1.1 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Devices under hot-added hostbridge have no chance to assign resources and to configure them, so this patch adds such code for hot-added hostbridges at acpi_pci_root_start(). Signed-off-by: Taku Izumi --- drivers/acpi/pci_root.c | 18 ++++++++++++++++++ include/acpi/acpi_bus.h | 1 + 2 files changed, 19 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: Bjorn-next-0808/drivers/acpi/pci_root.c =================================================================== --- Bjorn-next-0808.orig/drivers/acpi/pci_root.c +++ Bjorn-next-0808/drivers/acpi/pci_root.c @@ -39,6 +39,7 @@ #include #include #include +#include #define PREFIX "ACPI: " @@ -462,6 +463,10 @@ static int __devinit acpi_pci_root_add(s if (!root) return -ENOMEM; + if (system_state != SYSTEM_BOOTING) { + root->hot_added = true; + } + segment = 0; status = acpi_evaluate_integer(device->handle, METHOD_NAME__SEG, NULL, &segment); @@ -640,12 +645,25 @@ static int acpi_pci_root_start(struct ac { struct acpi_pci_root *root = acpi_driver_data(device); struct acpi_pci_driver *driver; + struct pci_dev *pdev; mutex_lock(&acpi_pci_root_lock); list_for_each_entry(driver, &acpi_pci_drivers, node) if (driver->add) driver->add(device->handle); + /* + * Devices under hot-added hostbridge have no chance to assign + * resources and to configure them, so do that here + */ + if (root->hot_added) { + pci_bus_size_bridges(root->bus); + pci_bus_assign_resources(root->bus); + list_for_each_entry(pdev, &root->bus->devices, bus_list) + pci_configure_slot(pdev); + pci_enable_bridges(root->bus); + } + pci_bus_add_devices(root->bus); mutex_unlock(&acpi_pci_root_lock); Index: Bjorn-next-0808/include/acpi/acpi_bus.h =================================================================== --- Bjorn-next-0808.orig/include/acpi/acpi_bus.h +++ Bjorn-next-0808/include/acpi/acpi_bus.h @@ -407,6 +407,7 @@ struct acpi_pci_root { u32 osc_support_set; /* _OSC state of support bits */ u32 osc_control_set; /* _OSC state of control bits */ phys_addr_t mcfg_addr; + bool hot_added; }; /* helper */