public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Grant Grundler <grundler@parisc-linux.org>
To: Auke Kok <auke-jan.h.kok@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz,
	gregkh@suse.de, grundler@parisc-linux.org, davem@davemloft.net
Subject: Re: [PATCH] PCI: also read revision ID for sparc64, ppc, read class at the same time
Date: Sat, 9 Jun 2007 19:54:12 -0600	[thread overview]
Message-ID: <20070610015412.GA26396@colo.lackof.org> (raw)
In-Reply-To: <20070609201221.5868.31948.stgit@localhost.localdomain>

On Sat, Jun 09, 2007 at 01:12:21PM -0700, Auke Kok wrote:
> Since the PCI bus class and revision are in the same dword, we
> can fill in both in the same read.
> 
> Other non-x86 arches use different methods to fill in these values,
> make sure to adjust those too.

Yeah, this looks good to me.

I didn't know ppc  and sparc had their own methods for device discovery.

Acked-by: Grant Grundler <grundler@parisc-linux.org>

thanks,
grant

> 
> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
> ---
> 
>  arch/powerpc/kernel/pci_64.c |    2 ++
>  arch/sparc64/kernel/pci.c    |    1 +
>  drivers/pci/probe.c          |    4 +---
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
> index 249cca2..b2c55ca 100644
> --- a/arch/powerpc/kernel/pci_64.c
> +++ b/arch/powerpc/kernel/pci_64.c
> @@ -367,8 +367,10 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
>  	sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
>  		dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
>  	dev->class = get_int_prop(node, "class-code", 0);
> +	dev->revision = get_int_prop(node, "revision-id", 0);
>  
>  	DBG("    class: 0x%x\n", dev->class);
> +	DBG("    revision: 0x%x\n", dev->revision);
>  
>  	dev->current_state = 4;		/* unknown power state */
>  	dev->error_state = pci_channel_io_normal;
> diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
> index 38a32bc..759cc20 100644
> --- a/arch/sparc64/kernel/pci.c
> +++ b/arch/sparc64/kernel/pci.c
> @@ -448,6 +448,7 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
>  		 */
>  		pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
>  		dev->class = class >> 8;
> +		dev->revision = class & 0xff;
>  
>  		sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
>  			dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 0fdb71d..a574b7f 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -702,6 +702,7 @@ static int pci_setup_device(struct pci_dev * dev)
>  		dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
>  
>  	pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
> +	dev->revision = class & 0xff;
>  	class >>= 8;				    /* upper 3 bytes */
>  	dev->class = class;
>  	class >>= 8;
> @@ -918,9 +919,6 @@ pci_scan_device(struct pci_bus *bus, int devfn)
>  	dev->cfg_size = pci_cfg_space_size(dev);
>  	dev->error_state = pci_channel_io_normal;
>  
> -	/* read the PCI revision: 1 byte */
> -	pci_read_config_byte(dev, PCI_REVISION_ID, &dev->revision);
> -
>  	/* Assume 32-bit PCI; let 64-bit PCI cards (which are far rarer)
>  	   set this higher, assuming the system even supports it.  */
>  	dev->dma_mask = 0xffffffff;

  reply	other threads:[~2007-06-10  1:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-09 20:12 [PATCH] PCI: also read revision ID for sparc64, ppc, read class at the same time Auke Kok
2007-06-10  1:54 ` Grant Grundler [this message]
2007-06-22 17:12   ` Kok, Auke
2007-06-22 19:46     ` Greg KH
2007-06-10 11:24 ` Michael Ellerman
2007-06-10 12:17   ` Segher Boessenkool
2007-06-12  1:10     ` Michael Ellerman

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=20070610015412.GA26396@colo.lackof.org \
    --to=grundler@parisc-linux.org \
    --cc=auke-jan.h.kok@intel.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox