From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754158AbbAUCcj (ORCPT ); Tue, 20 Jan 2015 21:32:39 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:12952 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753893AbbAUCcf (ORCPT ); Tue, 20 Jan 2015 21:32:35 -0500 From: Yijing Wang To: Bjorn Helgaas CC: Jiang Liu , , Yinghai Lu , , Marc Zyngier , , Russell King , , Thomas Gleixner , Benjamin Herrenschmidt , Rusty Russell , Tony Luck , , "David S. Miller" , "Guan Xuetao" , , , Liviu Dudau , "Arnd Bergmann" , Geert Uytterhoeven , "Yijing Wang" , Yijing Wang , "Fenghua Yu" Subject: [PATCH v2 15/30] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge Date: Wed, 21 Jan 2015 08:30:10 +0800 Message-ID: <1421800225-26230-16-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> References: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.54BF0FBF.019C,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9dfe03f74d8d9251d10a9c98a817ac7e Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yijing Wang Signed-off-by: Yijing Wang CC: Tony Luck CC: Fenghua Yu CC: linux-ia64@vger.kernel.org --- arch/ia64/pci/pci.c | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index e457015..b86b318 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, return 0; } +static int pci_host_bridge_prepare(struct pci_host_bridge *bridge) +{ + struct pci_controller *controller = bridge->bus->sysdata; + + ACPI_COMPANION_SET(&bridge->dev, controller->companion); + return 0; +} + +static struct pci_host_bridge_ops phb_ops = { + .phb_prepare = pci_host_bridge_prepare, +}; + struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) { struct acpi_device *device = root->device; @@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) struct pci_controller *controller; struct pci_root_info *info = NULL; int busnum = root->secondary.start; - struct pci_bus *pbus; + struct pci_host_bridge *host; int ret; controller = alloc_pci_controller(domain); @@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) * should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), - &pci_root_ops, controller, &info->resources); - if (!pbus) { + host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus), + &pci_root_ops, controller, &info->resources, &phb_ops); + if (!host) { pci_free_resource_list(&info->resources); __release_pci_root_info(info); return NULL; } - pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge), - release_pci_root_info, info); - pci_scan_child_bus(pbus); - return pbus; -} - -int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) -{ - struct pci_controller *controller = bridge->bus->sysdata; - - ACPI_COMPANION_SET(&bridge->dev, controller->companion); - return 0; + pci_set_host_bridge_release(host, release_pci_root_info, info); + return host->bus; } static int is_valid_resource(struct pci_dev *dev, int idx) -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga03-in.huawei.com ([119.145.14.66]:12952 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753893AbbAUCcf (ORCPT ); Tue, 20 Jan 2015 21:32:35 -0500 From: Yijing Wang To: Bjorn Helgaas CC: Jiang Liu , , Yinghai Lu , , Marc Zyngier , , Russell King , , Thomas Gleixner , Benjamin Herrenschmidt , Rusty Russell , Tony Luck , , "David S. Miller" , "Guan Xuetao" , , , Liviu Dudau , "Arnd Bergmann" , Geert Uytterhoeven , "Yijing Wang" , Yijing Wang , "Fenghua Yu" Subject: [PATCH v2 15/30] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge Date: Wed, 21 Jan 2015 08:30:10 +0800 Message-ID: <1421800225-26230-16-git-send-email-wangyijing@huawei.com> In-Reply-To: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> References: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-pci-owner@vger.kernel.org List-ID: From: Yijing Wang Signed-off-by: Yijing Wang CC: Tony Luck CC: Fenghua Yu CC: linux-ia64@vger.kernel.org --- arch/ia64/pci/pci.c | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index e457015..b86b318 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, return 0; } +static int pci_host_bridge_prepare(struct pci_host_bridge *bridge) +{ + struct pci_controller *controller = bridge->bus->sysdata; + + ACPI_COMPANION_SET(&bridge->dev, controller->companion); + return 0; +} + +static struct pci_host_bridge_ops phb_ops = { + .phb_prepare = pci_host_bridge_prepare, +}; + struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) { struct acpi_device *device = root->device; @@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) struct pci_controller *controller; struct pci_root_info *info = NULL; int busnum = root->secondary.start; - struct pci_bus *pbus; + struct pci_host_bridge *host; int ret; controller = alloc_pci_controller(domain); @@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) * should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), - &pci_root_ops, controller, &info->resources); - if (!pbus) { + host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus), + &pci_root_ops, controller, &info->resources, &phb_ops); + if (!host) { pci_free_resource_list(&info->resources); __release_pci_root_info(info); return NULL; } - pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge), - release_pci_root_info, info); - pci_scan_child_bus(pbus); - return pbus; -} - -int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) -{ - struct pci_controller *controller = bridge->bus->sysdata; - - ACPI_COMPANION_SET(&bridge->dev, controller->companion); - return 0; + pci_set_host_bridge_release(host, release_pci_root_info, info); + return host->bus; } static int is_valid_resource(struct pci_dev *dev, int idx) -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: wangyijing@huawei.com (Yijing Wang) Date: Wed, 21 Jan 2015 08:30:10 +0800 Subject: [PATCH v2 15/30] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge In-Reply-To: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> References: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> Message-ID: <1421800225-26230-16-git-send-email-wangyijing@huawei.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org From: Yijing Wang Signed-off-by: Yijing Wang CC: Tony Luck CC: Fenghua Yu CC: linux-ia64 at vger.kernel.org --- arch/ia64/pci/pci.c | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index e457015..b86b318 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, return 0; } +static int pci_host_bridge_prepare(struct pci_host_bridge *bridge) +{ + struct pci_controller *controller = bridge->bus->sysdata; + + ACPI_COMPANION_SET(&bridge->dev, controller->companion); + return 0; +} + +static struct pci_host_bridge_ops phb_ops = { + .phb_prepare = pci_host_bridge_prepare, +}; + struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) { struct acpi_device *device = root->device; @@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) struct pci_controller *controller; struct pci_root_info *info = NULL; int busnum = root->secondary.start; - struct pci_bus *pbus; + struct pci_host_bridge *host; int ret; controller = alloc_pci_controller(domain); @@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) * should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), - &pci_root_ops, controller, &info->resources); - if (!pbus) { + host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus), + &pci_root_ops, controller, &info->resources, &phb_ops); + if (!host) { pci_free_resource_list(&info->resources); __release_pci_root_info(info); return NULL; } - pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge), - release_pci_root_info, info); - pci_scan_child_bus(pbus); - return pbus; -} - -int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) -{ - struct pci_controller *controller = bridge->bus->sysdata; - - ACPI_COMPANION_SET(&bridge->dev, controller->companion); - return 0; + pci_set_host_bridge_release(host, release_pci_root_info, info); + return host->bus; } static int is_valid_resource(struct pci_dev *dev, int idx) -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yijing Wang Date: Wed, 21 Jan 2015 00:30:10 +0000 Subject: [PATCH v2 15/30] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge Message-Id: <1421800225-26230-16-git-send-email-wangyijing@huawei.com> List-Id: References: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> In-Reply-To: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bjorn Helgaas Cc: Jiang Liu , linux-pci@vger.kernel.org, Yinghai Lu , linux-kernel@vger.kernel.org, Marc Zyngier , linux-arm-kernel@lists.infradead.org, Russell King , x86@kernel.org, Thomas Gleixner , Benjamin Herrenschmidt , Rusty Russell , Tony Luck , linux-ia64@vger.kernel.org, "David S. Miller" , Guan Xuetao , linux-alpha@vger.kernel.org, linux-m68k@vger.kernel.org, Liviu Dudau , Arnd Bergmann , Geert Uytterhoeven , Yijing Wang , Yijing Wang , Fenghua Yu From: Yijing Wang Signed-off-by: Yijing Wang CC: Tony Luck CC: Fenghua Yu CC: linux-ia64@vger.kernel.org --- arch/ia64/pci/pci.c | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index e457015..b86b318 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, return 0; } +static int pci_host_bridge_prepare(struct pci_host_bridge *bridge) +{ + struct pci_controller *controller = bridge->bus->sysdata; + + ACPI_COMPANION_SET(&bridge->dev, controller->companion); + return 0; +} + +static struct pci_host_bridge_ops phb_ops = { + .phb_prepare = pci_host_bridge_prepare, +}; + struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) { struct acpi_device *device = root->device; @@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) struct pci_controller *controller; struct pci_root_info *info = NULL; int busnum = root->secondary.start; - struct pci_bus *pbus; + struct pci_host_bridge *host; int ret; controller = alloc_pci_controller(domain); @@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) * should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), - &pci_root_ops, controller, &info->resources); - if (!pbus) { + host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus), + &pci_root_ops, controller, &info->resources, &phb_ops); + if (!host) { pci_free_resource_list(&info->resources); __release_pci_root_info(info); return NULL; } - pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge), - release_pci_root_info, info); - pci_scan_child_bus(pbus); - return pbus; -} - -int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) -{ - struct pci_controller *controller = bridge->bus->sysdata; - - ACPI_COMPANION_SET(&bridge->dev, controller->companion); - return 0; + pci_set_host_bridge_release(host, release_pci_root_info, info); + return host->bus; } static int is_valid_resource(struct pci_dev *dev, int idx) -- 1.7.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yijing Wang Subject: [PATCH v2 15/30] PCI/IA64: Refine pci_acpi_scan_root() with generic pci_host_bridge Date: Wed, 21 Jan 2015 08:30:10 +0800 Message-ID: <1421800225-26230-16-git-send-email-wangyijing@huawei.com> References: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> Mime-Version: 1.0 Return-path: In-Reply-To: <1421800225-26230-1-git-send-email-wangyijing@huawei.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bjorn Helgaas Cc: Jiang Liu , linux-pci@vger.kernel.org, Yinghai Lu , linux-kernel@vger.kernel.org, Marc Zyngier , linux-arm-kernel@lists.infradead.org, Russell King , x86@kernel.org, Thomas Gleixner , Benjamin Herrenschmidt , Rusty Russell , Tony Luck , linux-ia64@vger.kernel.org, "David S. Miller" , Guan Xuetao , linux-alpha@vger.kernel.org, linux-m68k@lists.linux-m68k.org, Liviu Dudau , Arnd Bergmann , Geert Uytterhoeven , Yijing Wang , Yijing Wang , Fenghua Yu From: Yijing Wang Signed-off-by: Yijing Wang CC: Tony Luck CC: Fenghua Yu CC: linux-ia64@vger.kernel.org --- arch/ia64/pci/pci.c | 34 ++++++++++++++++++---------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index e457015..b86b318 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -420,6 +420,18 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, return 0; } +static int pci_host_bridge_prepare(struct pci_host_bridge *bridge) +{ + struct pci_controller *controller = bridge->bus->sysdata; + + ACPI_COMPANION_SET(&bridge->dev, controller->companion); + return 0; +} + +static struct pci_host_bridge_ops phb_ops = { + .phb_prepare = pci_host_bridge_prepare, +}; + struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) { struct acpi_device *device = root->device; @@ -428,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) struct pci_controller *controller; struct pci_root_info *info = NULL; int busnum = root->secondary.start; - struct pci_bus *pbus; + struct pci_host_bridge *host; int ret; controller = alloc_pci_controller(domain); @@ -465,26 +477,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) * should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus = pci_create_root_bus(NULL, PCI_DOMBUS(domain, bus), - &pci_root_ops, controller, &info->resources); - if (!pbus) { + host = pci_scan_root_bridge(NULL, PCI_DOMBUS(domain, bus), + &pci_root_ops, controller, &info->resources, &phb_ops); + if (!host) { pci_free_resource_list(&info->resources); __release_pci_root_info(info); return NULL; } - pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge), - release_pci_root_info, info); - pci_scan_child_bus(pbus); - return pbus; -} - -int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) -{ - struct pci_controller *controller = bridge->bus->sysdata; - - ACPI_COMPANION_SET(&bridge->dev, controller->companion); - return 0; + pci_set_host_bridge_release(host, release_pci_root_info, info); + return host->bus; } static int is_valid_resource(struct pci_dev *dev, int idx) -- 1.7.1