aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/quirks.c
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2007-06-08 18:46:36 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:10 -0400
commit44c10138fd4bbc4b6d6bff0873c24902f2a9da65 (patch)
tree6e16d3ec80c87490dc743f72da086356f2906ace /drivers/pci/quirks.c
parentb8a3a5214d7cc115f1ca3a3967b7229d97c46f4a (diff)
PCI: Change all drivers to use pci_device->revision
Instead of all drivers reading pci config space to get the revision ID, they can now use the pci_device->revision member. This exposes some issues where drivers where reading a word or a dword for the revision number, and adding useless error-handling around the read. Some drivers even just read it for no purpose of all. In devices where the revision ID is being copied over and used in what appears to be the equivalent of hotpath, I have left the copy code and the cached copy as not to influence the driver's performance. Compile tested with make all{yes,mod}config on x86_64 and i386. Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Acked-by: Dave Jones <davej@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/quirks.c')
-rw-r--r--drivers/pci/quirks.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 75bd6a8648f6..f75ade6f0602 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -587,10 +587,7 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, quirk_via_v
587 */ 587 */
588static void __devinit quirk_amd_ioapic(struct pci_dev *dev) 588static void __devinit quirk_amd_ioapic(struct pci_dev *dev)
589{ 589{
590 u8 rev; 590 if (dev->revision >= 0x02) {
591
592 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
593 if (rev >= 0x02) {
594 printk(KERN_WARNING "I/O APIC: AMD Erratum #22 may be present. In the event of instability try\n"); 591 printk(KERN_WARNING "I/O APIC: AMD Erratum #22 may be present. In the event of instability try\n");
595 printk(KERN_WARNING " : booting with the \"noapic\" option.\n"); 592 printk(KERN_WARNING " : booting with the \"noapic\" option.\n");
596 } 593 }
@@ -610,13 +607,12 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI, PCI_ANY_ID, quirk_ioapic_rmw );
610#define AMD8131_NIOAMODE_BIT 0 607#define AMD8131_NIOAMODE_BIT 0
611static void quirk_amd_8131_ioapic(struct pci_dev *dev) 608static void quirk_amd_8131_ioapic(struct pci_dev *dev)
612{ 609{
613 unsigned char revid, tmp; 610 unsigned char tmp;
614 611
615 if (nr_ioapics == 0) 612 if (nr_ioapics == 0)
616 return; 613 return;
617 614
618 pci_read_config_byte(dev, PCI_REVISION_ID, &revid); 615 if (dev->revision == AMD8131_revA0 || dev->revision == AMD8131_revB0) {
619 if (revid == AMD8131_revA0 || revid == AMD8131_revB0) {
620 printk(KERN_INFO "Fixing up AMD8131 IOAPIC mode\n"); 616 printk(KERN_INFO "Fixing up AMD8131 IOAPIC mode\n");
621 pci_read_config_byte( dev, AMD8131_MISC, &tmp); 617 pci_read_config_byte( dev, AMD8131_MISC, &tmp);
622 tmp &= ~(1 << AMD8131_NIOAMODE_BIT); 618 tmp &= ~(1 << AMD8131_NIOAMODE_BIT);
@@ -859,10 +855,8 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, qu
859static void quirk_disable_pxb(struct pci_dev *pdev) 855static void quirk_disable_pxb(struct pci_dev *pdev)
860{ 856{
861 u16 config; 857 u16 config;
862 u8 rev;
863 858
864 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); 859 if (pdev->revision != 0x04) /* Only C0 requires this */
865 if (rev != 0x04) /* Only C0 requires this */
866 return; 860 return;
867 pci_read_config_word(pdev, 0x40, &config); 861 pci_read_config_word(pdev, 0x40, &config);
868 if (config & (1<<6)) { 862 if (config & (1<<6)) {