From patchwork Wed Sep 2 22:50:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 45273 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n82MoXlM026282 for ; Wed, 2 Sep 2009 22:50:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753809AbZIBWu3 (ORCPT ); Wed, 2 Sep 2009 18:50:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753815AbZIBWu3 (ORCPT ); Wed, 2 Sep 2009 18:50:29 -0400 Received: from g5t0006.atlanta.hp.com ([15.192.0.43]:37359 "EHLO g5t0006.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753809AbZIBWu2 (ORCPT ); Wed, 2 Sep 2009 18:50:28 -0400 Received: from g4t0018.houston.hp.com (g4t0018.houston.hp.com [16.234.32.27]) by g5t0006.atlanta.hp.com (Postfix) with ESMTP id 2FEB0C226; Wed, 2 Sep 2009 22:50:31 +0000 (UTC) Received: from ldl (linux.corp.hp.com [15.11.146.101]) by g4t0018.houston.hp.com (Postfix) with ESMTP id F160C10060; Wed, 2 Sep 2009 22:50:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by ldl (Postfix) with ESMTP id E8957CF0038; Wed, 2 Sep 2009 16:50:30 -0600 (MDT) Received: from ldl ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7JlGIP25oy7I; Wed, 2 Sep 2009 16:50:30 -0600 (MDT) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id C36A2CF0011; Wed, 2 Sep 2009 16:50:30 -0600 (MDT) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 95C1726141; Wed, 2 Sep 2009 16:50:35 -0600 (MDT) Subject: [PATCH v3 7/8] PCI hotplug: acpiphp: use generic pci_configure_slot() To: Kristen Carlson Accardi From: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Rolf Eike Beer , Gary Hade , Kenji Kaneshige Date: Wed, 02 Sep 2009 16:50:35 -0600 Message-ID: <20090902225035.12417.6984.stgit@bob.kio> In-Reply-To: <20090902224836.12417.43417.stgit@bob.kio> References: <20090902224836.12417.43417.stgit@bob.kio> User-Agent: StGit/0.14.3.386.gb02d MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Use the generic pci_configure_slot() rather than the acpiphp-specific decode_hpp() and program_hpp(). Unlike the previous acpiphp-specific code, pci_configure_slot() programs PCIe settings when an _HPX method provides them, so acpiphp-managed PCIe devices can now be configured. Signed-off-by: Bjorn Helgaas Reviewed-by: Kenji Kaneshige Acked-by: Kenji Kaneshige --- drivers/pci/hotplug/acpi_pcihp.c | 9 ++-- drivers/pci/hotplug/acpiphp_glue.c | 81 +----------------------------------- include/linux/pci_hotplug.h | 4 -- 3 files changed, 7 insertions(+), 87 deletions(-) -- 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 diff --git a/drivers/pci/hotplug/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c index be3b9be..c53f72b 100644 --- a/drivers/pci/hotplug/acpi_pcihp.c +++ b/drivers/pci/hotplug/acpi_pcihp.c @@ -322,13 +322,12 @@ static acpi_status acpi_run_oshp(acpi_handle handle) return status; } -/* acpi_get_hp_params_from_firmware +/* pci_get_hp_params * * @dev - the pci_dev for which we want parameters * @hpp - allocated by the caller */ -int acpi_get_hp_params_from_firmware(struct pci_dev *dev, - struct hotplug_params *hpp) +int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp) { acpi_status status; acpi_handle handle, phandle; @@ -345,7 +344,7 @@ int acpi_get_hp_params_from_firmware(struct pci_dev *dev, * _HPP settings apply to all child buses, until another _HPP is * encountered. If we don't find an _HPP for the input pci dev, * look for it in the parent device scope since that would apply to - * this pci dev. If we don't find any _HPP, use hardcoded defaults + * this pci dev. */ while (handle) { status = acpi_run_hpx(handle, hpp); @@ -363,7 +362,7 @@ int acpi_get_hp_params_from_firmware(struct pci_dev *dev, } return -ENODEV; } -EXPORT_SYMBOL_GPL(acpi_get_hp_params_from_firmware); +EXPORT_SYMBOL_GPL(pci_get_hp_params); /** * acpi_get_hp_hw_control_from_firmware diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 3dc45e9..050f1af 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -274,29 +274,6 @@ static int detect_ejectable_slots(struct pci_bus *pbus) return found; } - -/* decode ACPI 2.0 _HPP hot plug parameters */ -static void decode_hpp(struct pci_dev *dev, struct hotplug_params *hpp) -{ - int ret; - - ret = acpi_get_hp_params_from_firmware(dev, hpp); - if (ret || !hpp->t0 || (hpp->t0->revision > 1)) { - /* use default numbers */ - printk(KERN_WARNING - "%s: Could not get hotplug parameters. Use defaults\n", - __func__); - hpp->t0 = &hpp->type0_data; - hpp->t0->revision = 0; - hpp->t0->cache_line_size = 0x10; - hpp->t0->latency_timer = 0x40; - hpp->t0->enable_serr = 0; - hpp->t0->enable_perr = 0; - } -} - - - /* initialize miscellaneous stuff for both root and PCI-to-PCI bridge */ static void init_bridge_misc(struct acpiphp_bridge *bridge) { @@ -1290,66 +1267,12 @@ static int acpiphp_check_bridge(struct acpiphp_bridge *bridge) return retval; } -static void program_hpp(struct pci_dev *dev, struct hotplug_params *hpp) -{ - u16 pci_cmd, pci_bctl; - struct pci_dev *cdev; - - /* Program hpp values for this device */ - if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || - (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && - (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI))) - return; - - if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) - return; - - pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, - hpp->t0->cache_line_size); - pci_write_config_byte(dev, PCI_LATENCY_TIMER, - hpp->t0->latency_timer); - pci_read_config_word(dev, PCI_COMMAND, &pci_cmd); - if (hpp->t0->enable_serr) - pci_cmd |= PCI_COMMAND_SERR; - else - pci_cmd &= ~PCI_COMMAND_SERR; - if (hpp->t0->enable_perr) - pci_cmd |= PCI_COMMAND_PARITY; - else - pci_cmd &= ~PCI_COMMAND_PARITY; - pci_write_config_word(dev, PCI_COMMAND, pci_cmd); - - /* Program bridge control value and child devices */ - if ((dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { - pci_write_config_byte(dev, PCI_SEC_LATENCY_TIMER, - hpp->t0->latency_timer); - pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &pci_bctl); - if (hpp->t0->enable_serr) - pci_bctl |= PCI_BRIDGE_CTL_SERR; - else - pci_bctl &= ~PCI_BRIDGE_CTL_SERR; - if (hpp->t0->enable_perr) - pci_bctl |= PCI_BRIDGE_CTL_PARITY; - else - pci_bctl &= ~PCI_BRIDGE_CTL_PARITY; - pci_write_config_word(dev, PCI_BRIDGE_CONTROL, pci_bctl); - if (dev->subordinate) { - list_for_each_entry(cdev, &dev->subordinate->devices, - bus_list) - program_hpp(cdev, hpp); - } - } -} - static void acpiphp_set_hpp_values(struct pci_bus *bus) { struct pci_dev *dev; - struct hotplug_params hpp; - list_for_each_entry(dev, &bus->devices, bus_list) { - decode_hpp(dev, &hpp); - program_hpp(dev, &hpp); - } + list_for_each_entry(dev, &bus->devices, bus_list) + pci_configure_slot(dev); } /* diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 95712ec..1b4db3a 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h @@ -226,12 +226,10 @@ struct hotplug_params { #ifdef CONFIG_ACPI #include #include -int acpi_get_hp_params_from_firmware(struct pci_dev *dev, - struct hotplug_params *hpp); +int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp); int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); int acpi_pci_detect_ejectable(struct pci_bus *pbus); -#define pci_get_hp_params(dev, hpp) acpi_get_hp_params_from_firmware(dev, hpp) #else static inline int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp)