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
Subject: Re: [PATCH 1/2] [RFC] PCI: read revision ID by default
Date: Sat, 9 Jun 2007 00:59:53 -0600 [thread overview]
Message-ID: <20070609065953.GA1747@colo.lackof.org> (raw)
In-Reply-To: <20070608224630.31777.17807.stgit@localhost.localdomain>
On Fri, Jun 08, 2007 at 03:46:30PM -0700, Auke Kok wrote:
> Currently there are 97 occurrences where drivers need the pci
> revision ID. We can do this once for all devices. Even the pci
> subsystem needs the revision several times for quirks. The extra
> u8 member pads out nicely in the pci_dev struct.
Good idea. I always wondered why we read the invariants so often
in the code.
>
> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
> ---
>
> drivers/pci/probe.c | 3 +++
> include/linux/pci.h | 1 +
> 2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index e48fcf0..0fdb71d 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -918,6 +918,9 @@ 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);
probe.c:pci_setup_device() is also reading this byte but discards it:
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
class >>= 8; /* upper 3 bytes */
dev->class = class;
Can you use "class & 0xff"? Or is pci_setup_device() too late?
Or can you read the whole 32-bits in pci_scan_device() and remove
the pci_read_config() in pci_setup_device()?
> +
> /* 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;
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index fbf3766..9847936 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -138,6 +138,7 @@ struct pci_dev {
> unsigned short subsystem_vendor;
> unsigned short subsystem_device;
> unsigned int class; /* 3 bytes: (base,sub,prog-if) */
> + u8 revision; /* PCI revision, low byte of class word */
If anyone doesn't want to add this, "class" really only uses 24 bits.
ie could be packed together with revision field like they are in
PCI configuration header.
thanks,
grant
> u8 hdr_type; /* PCI header type (`multi' flag masked out) */
> u8 rom_base_reg; /* which config register controls the ROM */
> u8 pin; /* which interrupt pin this device uses */
next prev parent reply other threads:[~2007-06-09 7:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-08 22:46 [PATCH 1/2] [RFC] PCI: read revision ID by default Auke Kok
2007-06-08 22:46 ` [PATCH 2/2] [RFC] PCI: Change all drivers to use pci_device->revision Auke Kok
2007-06-11 15:19 ` Dave Jones
2007-06-09 6:59 ` Grant Grundler [this message]
2007-06-09 8:02 ` [PATCH 1/2] [RFC] PCI: read revision ID by default David Miller
2007-06-09 19:31 ` Kok, Auke
2007-06-09 19:48 ` Kok, Auke
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=20070609065953.GA1747@colo.lackof.org \
--to=grundler@parisc-linux.org \
--cc=auke-jan.h.kok@intel.com \
--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 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.