All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: linux-pci@atrey.karlin.mff.cuni.cz, linux-arch@vger.kernel.org,
	Russell King <rmk@arm.linux.org.uk>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Kyle McMartin <kyle@parisc-linux.org>,
	Matthew Wilcox <matthew@wil.cx>,
	Grant Grundler <grundler@parisc-linux.org>,
	linux-parisc@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
	linuxppc-dev@ozlabs.org, Chris Zankel <chris@zankel.net>
Subject: Re: [patch 1/4] PCI: split pcibios_enable_resources() out of pcibios_enable_device()
Date: Tue, 19 Feb 2008 17:27:14 +1100	[thread overview]
Message-ID: <1203402434.6740.90.camel@pasglop> (raw)
In-Reply-To: <20080219044307.157131373@ldl.fc.hp.com>


On Mon, 2008-02-18 at 21:39 -0700, Bjorn Helgaas wrote:
> plain text document attachment (make-pcibios_enable_resources)
> On x86, pcibios_enable_device() is factored into
> pcibios_enable_resources() and pcibios_enable_irq().  On several other
> architectures, the functional equivalent of pcibios_enable_resources()
> is expanded directly inside pcibios_enable_device().
> 
> This splits these pcibios_enable_device() implementations to make them
> more similar to the x86 implementation.
> 
> There should be no functional change from this patch.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> 
> ---
>  arch/alpha/kernel/pci.c          |    8 +++++++-
>  arch/arm/kernel/bios32.c         |    9 +++++++--
>  arch/parisc/kernel/pci.c         |    6 +++++-
>  arch/powerpc/kernel/pci-common.c |   14 +++++++++-----
>  arch/sh/drivers/pci/pci.c        |    7 ++++++-
>  arch/sparc64/kernel/pci.c        |    7 ++++++-
>  arch/v850/kernel/rte_mb_a_pci.c  |    7 ++++++-
>  7 files changed, 46 insertions(+), 12 deletions(-)
> 
> Index: work6/arch/alpha/kernel/pci.c
> ===================================================================
> --- work6.orig/arch/alpha/kernel/pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/alpha/kernel/pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -370,7 +370,7 @@
>  #endif
>  
>  int
> -pcibios_enable_device(struct pci_dev *dev, int mask)
> +pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, oldcmd;
>  	int i;
> @@ -396,6 +396,12 @@
>  	return 0;
>  }
>  
> +int
> +pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  /*
>   *  If we set up a device for bus mastering, we need to check the latency
>   *  timer as certain firmware forgets to set it properly, as seen
> Index: work6/arch/arm/kernel/bios32.c
> ===================================================================
> --- work6.orig/arch/arm/kernel/bios32.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/arm/kernel/bios32.c	2008-02-18 10:45:14.000000000 -0700
> @@ -655,10 +655,10 @@
>  }
>  
>  /**
> - * pcibios_enable_device - Enable I/O and memory.
> + * pcibios_enable_resources - Enable I/O and memory.
>   * @dev: PCI device to be enabled
>   */
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, old_cmd;
>  	int idx;
> @@ -697,6 +697,11 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
>  			enum pci_mmap_state mmap_state, int write_combine)
>  {
> Index: work6/arch/parisc/kernel/pci.c
> ===================================================================
> --- work6.orig/arch/parisc/kernel/pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/parisc/kernel/pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -285,7 +285,7 @@
>   * Drivers that do not need parity (eg graphics and possibly networking)
>   * can clear these bits if they want.
>   */
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd;
>  	int idx;
> @@ -317,6 +317,10 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
>  
>  /* PA-RISC specific */
>  void pcibios_register_hba(struct pci_hba_data *hba)
> Index: work6/arch/powerpc/kernel/pci-common.c
> ===================================================================
> --- work6.orig/arch/powerpc/kernel/pci-common.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/powerpc/kernel/pci-common.c	2008-02-18 10:45:14.000000000 -0700
> @@ -1153,16 +1153,12 @@
>  EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
>  #endif /* CONFIG_HOTPLUG */
>  
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, old_cmd;
>  	int idx;
>  	struct resource *r;
>  
> -	if (ppc_md.pcibios_enable_device_hook)
> -		if (ppc_md.pcibios_enable_device_hook(dev))
> -			return -EINVAL;
> -
>  	pci_read_config_word(dev, PCI_COMMAND, &cmd);
>  	old_cmd = cmd;
>  	for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
> @@ -1193,3 +1189,11 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	if (ppc_md.pcibios_enable_device_hook)
> +		if (ppc_md.pcibios_enable_device_hook(dev))
> +			return -EINVAL;
> +
> +	return pcibios_enable_resources(dev, mask);
> +}
> Index: work6/arch/sh/drivers/pci/pci.c
> ===================================================================
> --- work6.orig/arch/sh/drivers/pci/pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/sh/drivers/pci/pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -131,7 +131,7 @@
>  	}
>  }
>  
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, old_cmd;
>  	int idx;
> @@ -163,6 +163,11 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  /*
>   *  If we set up a device for bus mastering, we need to check and set
>   *  the latency timer as it may not be properly set.
> Index: work6/arch/sparc64/kernel/pci.c
> ===================================================================
> --- work6.orig/arch/sparc64/kernel/pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/sparc64/kernel/pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -946,7 +946,7 @@
>  {
>  }
>  
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, oldcmd;
>  	int i;
> @@ -976,6 +976,11 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region,
>  			     struct resource *res)
>  {
> Index: work6/arch/v850/kernel/rte_mb_a_pci.c
> ===================================================================
> --- work6.orig/arch/v850/kernel/rte_mb_a_pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/v850/kernel/rte_mb_a_pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -217,7 +217,7 @@
>  }
>  
>  \f
> -int __nomods_init pcibios_enable_device (struct pci_dev *dev, int mask)
> +int __nomods_init pcibios_enable_resources (struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, old_cmd;
>  	int idx;
> @@ -245,6 +245,11 @@
>  	return 0;
>  }
>  
> +int __nomods_init pcibios_enable_device (struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  \f
>  /* Resource allocation.  */
>  static void __devinit pcibios_assign_resources (void)
> 


WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: linux-arch@vger.kernel.org, Chris Zankel <chris@zankel.net>,
	Grant Grundler <grundler@parisc-linux.org>,
	linux-parisc@vger.kernel.org, Matthew Wilcox <matthew@wil.cx>,
	Kyle McMartin <kyle@parisc-linux.org>,
	linuxppc-dev@ozlabs.org, Paul Mackerras <paulus@samba.org>,
	linux-pci@atrey.karlin.mff.cuni.cz,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Russell King <rmk@arm.linux.org.uk>
Subject: Re: [patch 1/4] PCI: split pcibios_enable_resources() out of pcibios_enable_device()
Date: Tue, 19 Feb 2008 17:27:14 +1100	[thread overview]
Message-ID: <1203402434.6740.90.camel@pasglop> (raw)
In-Reply-To: <20080219044307.157131373@ldl.fc.hp.com>


On Mon, 2008-02-18 at 21:39 -0700, Bjorn Helgaas wrote:
> plain text document attachment (make-pcibios_enable_resources)
> On x86, pcibios_enable_device() is factored into
> pcibios_enable_resources() and pcibios_enable_irq().  On several other
> architectures, the functional equivalent of pcibios_enable_resources()
> is expanded directly inside pcibios_enable_device().
> 
> This splits these pcibios_enable_device() implementations to make them
> more similar to the x86 implementation.
> 
> There should be no functional change from this patch.
> 
> Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> 
> ---
>  arch/alpha/kernel/pci.c          |    8 +++++++-
>  arch/arm/kernel/bios32.c         |    9 +++++++--
>  arch/parisc/kernel/pci.c         |    6 +++++-
>  arch/powerpc/kernel/pci-common.c |   14 +++++++++-----
>  arch/sh/drivers/pci/pci.c        |    7 ++++++-
>  arch/sparc64/kernel/pci.c        |    7 ++++++-
>  arch/v850/kernel/rte_mb_a_pci.c  |    7 ++++++-
>  7 files changed, 46 insertions(+), 12 deletions(-)
> 
> Index: work6/arch/alpha/kernel/pci.c
> ===================================================================
> --- work6.orig/arch/alpha/kernel/pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/alpha/kernel/pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -370,7 +370,7 @@
>  #endif
>  
>  int
> -pcibios_enable_device(struct pci_dev *dev, int mask)
> +pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, oldcmd;
>  	int i;
> @@ -396,6 +396,12 @@
>  	return 0;
>  }
>  
> +int
> +pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  /*
>   *  If we set up a device for bus mastering, we need to check the latency
>   *  timer as certain firmware forgets to set it properly, as seen
> Index: work6/arch/arm/kernel/bios32.c
> ===================================================================
> --- work6.orig/arch/arm/kernel/bios32.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/arm/kernel/bios32.c	2008-02-18 10:45:14.000000000 -0700
> @@ -655,10 +655,10 @@
>  }
>  
>  /**
> - * pcibios_enable_device - Enable I/O and memory.
> + * pcibios_enable_resources - Enable I/O and memory.
>   * @dev: PCI device to be enabled
>   */
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, old_cmd;
>  	int idx;
> @@ -697,6 +697,11 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
>  			enum pci_mmap_state mmap_state, int write_combine)
>  {
> Index: work6/arch/parisc/kernel/pci.c
> ===================================================================
> --- work6.orig/arch/parisc/kernel/pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/parisc/kernel/pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -285,7 +285,7 @@
>   * Drivers that do not need parity (eg graphics and possibly networking)
>   * can clear these bits if they want.
>   */
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd;
>  	int idx;
> @@ -317,6 +317,10 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
>  
>  /* PA-RISC specific */
>  void pcibios_register_hba(struct pci_hba_data *hba)
> Index: work6/arch/powerpc/kernel/pci-common.c
> ===================================================================
> --- work6.orig/arch/powerpc/kernel/pci-common.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/powerpc/kernel/pci-common.c	2008-02-18 10:45:14.000000000 -0700
> @@ -1153,16 +1153,12 @@
>  EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
>  #endif /* CONFIG_HOTPLUG */
>  
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, old_cmd;
>  	int idx;
>  	struct resource *r;
>  
> -	if (ppc_md.pcibios_enable_device_hook)
> -		if (ppc_md.pcibios_enable_device_hook(dev))
> -			return -EINVAL;
> -
>  	pci_read_config_word(dev, PCI_COMMAND, &cmd);
>  	old_cmd = cmd;
>  	for (idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
> @@ -1193,3 +1189,11 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	if (ppc_md.pcibios_enable_device_hook)
> +		if (ppc_md.pcibios_enable_device_hook(dev))
> +			return -EINVAL;
> +
> +	return pcibios_enable_resources(dev, mask);
> +}
> Index: work6/arch/sh/drivers/pci/pci.c
> ===================================================================
> --- work6.orig/arch/sh/drivers/pci/pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/sh/drivers/pci/pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -131,7 +131,7 @@
>  	}
>  }
>  
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, old_cmd;
>  	int idx;
> @@ -163,6 +163,11 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  /*
>   *  If we set up a device for bus mastering, we need to check and set
>   *  the latency timer as it may not be properly set.
> Index: work6/arch/sparc64/kernel/pci.c
> ===================================================================
> --- work6.orig/arch/sparc64/kernel/pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/sparc64/kernel/pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -946,7 +946,7 @@
>  {
>  }
>  
> -int pcibios_enable_device(struct pci_dev *dev, int mask)
> +int pcibios_enable_resources(struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, oldcmd;
>  	int i;
> @@ -976,6 +976,11 @@
>  	return 0;
>  }
>  
> +int pcibios_enable_device(struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  void pcibios_resource_to_bus(struct pci_dev *pdev, struct pci_bus_region *region,
>  			     struct resource *res)
>  {
> Index: work6/arch/v850/kernel/rte_mb_a_pci.c
> ===================================================================
> --- work6.orig/arch/v850/kernel/rte_mb_a_pci.c	2008-02-18 10:43:50.000000000 -0700
> +++ work6/arch/v850/kernel/rte_mb_a_pci.c	2008-02-18 10:45:14.000000000 -0700
> @@ -217,7 +217,7 @@
>  }
>  
>  \f
> -int __nomods_init pcibios_enable_device (struct pci_dev *dev, int mask)
> +int __nomods_init pcibios_enable_resources (struct pci_dev *dev, int mask)
>  {
>  	u16 cmd, old_cmd;
>  	int idx;
> @@ -245,6 +245,11 @@
>  	return 0;
>  }
>  
> +int __nomods_init pcibios_enable_device (struct pci_dev *dev, int mask)
> +{
> +	return pcibios_enable_resources(dev, mask);
> +}
> +
>  \f
>  /* Resource allocation.  */
>  static void __devinit pcibios_assign_resources (void)
> 

  reply	other threads:[~2008-02-19  6:29 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19  4:39 [patch 0/4] RFC: PCI: consolidate several pcibios_enable_resources() implementations Bjorn Helgaas
2008-02-19  4:39 ` Bjorn Helgaas
2008-02-19  4:39 ` [patch 1/4] PCI: split pcibios_enable_resources() out of pcibios_enable_device() Bjorn Helgaas
2008-02-19  4:39   ` Bjorn Helgaas
2008-02-19  6:27   ` Benjamin Herrenschmidt [this message]
2008-02-19  6:27     ` Benjamin Herrenschmidt
2008-02-19  4:39 ` [patch 2/4] ppc: make pcibios_enable_device() use pcibios_enable_resources() Bjorn Helgaas
2008-02-19  4:39   ` Bjorn Helgaas
2008-02-19  6:26   ` Benjamin Herrenschmidt
2008-02-19  6:26     ` Benjamin Herrenschmidt
2008-02-19  4:39 ` [patch 3/4] xtensa: " Bjorn Helgaas
2008-02-19  4:39   ` Bjorn Helgaas
2008-02-19  4:39 ` [patch 4/4] RFC: PCI: consolidate several pcibios_enable_resources() implementations Bjorn Helgaas
2008-02-19  4:39   ` Bjorn Helgaas
2008-02-19  6:31   ` Benjamin Herrenschmidt
2008-02-19  6:31     ` Benjamin Herrenschmidt
2008-02-19 16:11     ` Bjorn Helgaas
2008-02-19 16:11       ` Bjorn Helgaas
2008-02-19 17:08       ` Ivan Kokshaysky
2008-02-19 17:08         ` Ivan Kokshaysky
2008-02-19 20:21       ` Benjamin Herrenschmidt
2008-02-19 20:21         ` Benjamin Herrenschmidt
2008-02-19  6:33   ` Benjamin Herrenschmidt
2008-02-19  6:33     ` Benjamin Herrenschmidt
2008-02-19  7:03   ` Kyle McMartin
2008-02-19  7:03     ` Kyle McMartin
2008-02-19  6:11 ` [patch 0/4] " Kyle McMartin
2008-02-19  6:11   ` Kyle McMartin
2008-02-19  8:09 ` Russell King
2008-02-19  8:09   ` Russell King
2008-02-19 10:08   ` Benjamin Herrenschmidt
2008-02-19 10:08     ` Benjamin Herrenschmidt
2008-02-19 18:02     ` Bjorn Helgaas
2008-02-19 18:02       ` Bjorn Helgaas
2008-02-20  6:24 ` Grant Grundler
2008-02-20  6:24   ` Grant Grundler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1203402434.6740.90.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=bjorn.helgaas@hp.com \
    --cc=chris@zankel.net \
    --cc=grundler@parisc-linux.org \
    --cc=kyle@parisc-linux.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=matthew@wil.cx \
    --cc=paulus@samba.org \
    --cc=rmk@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.