aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-12 16:40:57 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-12 16:40:57 -0400
commit21ba0f88ae56da82a3a15fe54d729208b64c4f4b (patch)
tree17ce67f276fe3ea7284c3dc730bdd6a2ec7dfe2f /drivers
parentdc690d8ef842b464f1c429a376ca16cb8dbee6ae (diff)
parent36e235901f90fb83215be43cbd8f1ca14661ea40 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (34 commits) PCI: Only build PCI syscalls on architectures that want them PCI: limit pci_get_bus_and_slot to domain 0 PCI: hotplug: acpiphp: avoid acpiphp "cannot get bridge info" PCI hotplug failure PCI: hotplug: acpiphp: remove hot plug parameter write to PCI host bridge PCI: hotplug: acpiphp: fix slot poweroff problem on systems without _PS3 PCI: hotplug: pciehp: wait for 1 second after power off slot PCI: pci_set_power_state(): check for PM capabilities earlier PCI: cpci_hotplug: Convert to use the kthread API PCI: add pci_try_set_mwi PCI: pcie: remove SPIN_LOCK_UNLOCKED PCI: ROUND_UP macro cleanup in drivers/pci PCI: remove pci_dac_dma_... APIs PCI: pci-x-pci-express-read-control-interfaces cleanups PCI: Fix typo in include/linux/pci.h PCI: pci_ids, remove double or more empty lines PCI: pci_ids, add atheros and 3com_2 vendors PCI: pci_ids, reorder some entries PCI: i386: traps, change VENDOR to DEVICE PCI: ATM: lanai, change VENDOR to DEVICE PCI: Change all drivers to use pci_device->revision ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/processor_core.c7
-rw-r--r--drivers/ata/ata_piix.c6
-rw-r--r--drivers/ata/pata_ali.c34
-rw-r--r--drivers/ata/pata_amd.c4
-rw-r--r--drivers/ata/pata_cs5530.c2
-rw-r--r--drivers/ata/pata_it821x.c3
-rw-r--r--drivers/ata/pata_serverworks.c5
-rw-r--r--drivers/ata/pata_sis.c8
-rw-r--r--drivers/ata/pata_sl82c105.c5
-rw-r--r--drivers/ata/pata_via.c6
-rw-r--r--drivers/ata/sata_mv.c20
-rw-r--r--drivers/atm/eni.c9
-rw-r--r--drivers/atm/idt77252.c13
-rw-r--r--drivers/atm/iphase.c11
-rw-r--r--drivers/atm/lanai.c27
-rw-r--r--drivers/atm/zatm.c6
-rw-r--r--drivers/char/agp/amd-k7-agp.c4
-rw-r--r--drivers/char/agp/amd64-agp.c6
-rw-r--r--drivers/clocksource/acpi_pm.c5
-rw-r--r--drivers/i2c/busses/i2c-viapro.c3
-rw-r--r--drivers/ide/pci/alim15x3.c2
-rw-r--r--drivers/ide/pci/amd74xx.c8
-rw-r--r--drivers/ide/pci/cmd64x.c9
-rw-r--r--drivers/ide/pci/cs5530.c2
-rw-r--r--drivers/ide/pci/hpt366.c20
-rw-r--r--drivers/ide/pci/piix.c6
-rw-r--r--drivers/ide/pci/serverworks.c13
-rw-r--r--drivers/ide/pci/sis5513.c8
-rw-r--r--drivers/ide/pci/sl82c105.c4
-rw-r--r--drivers/ide/pci/via82cxxx.c9
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c9
-rw-r--r--drivers/isdn/hisax/bkm_a8.c4
-rw-r--r--drivers/media/radio/radio-gemtek-pci.c4
-rw-r--r--drivers/media/video/meye.c4
-rw-r--r--drivers/net/8139cp.c7
-rw-r--r--drivers/net/8139too.c7
-rw-r--r--drivers/net/atl1/atl1.h1
-rw-r--r--drivers/net/atl1/atl1_main.c4
-rw-r--r--drivers/net/bnx2.c5
-rw-r--r--drivers/net/cassini.c12
-rw-r--r--drivers/net/dl2k.c3
-rw-r--r--drivers/net/dl2k.h1
-rw-r--r--drivers/net/e100.c8
-rw-r--r--drivers/net/e1000/e1000_main.c3
-rw-r--r--drivers/net/forcedeth.c4
-rw-r--r--drivers/net/netxen/netxen_nic_main.c7
-rw-r--r--drivers/net/s2io.c25
-rw-r--r--drivers/net/s2io.h1
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/sundance.c7
-rw-r--r--drivers/net/sunhme.c8
-rw-r--r--drivers/net/tg3.c6
-rw-r--r--drivers/net/tlan.c5
-rw-r--r--drivers/net/tulip/de4x5.c8
-rw-r--r--drivers/net/tulip/dmfe.c26
-rw-r--r--drivers/net/tulip/tulip_core.c15
-rw-r--r--drivers/net/tulip/xircom_cb.c5
-rw-r--r--drivers/net/tulip/xircom_tulip_cb.c4
-rw-r--r--drivers/net/typhoon.c7
-rw-r--r--drivers/net/via-rhine.c13
-rw-r--r--drivers/net/via-velocity.c3
-rw-r--r--drivers/net/wan/pc300_drv.c4
-rw-r--r--drivers/net/wan/pc300too.c2
-rw-r--r--drivers/net/wan/pci200syn.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c6
-rw-r--r--drivers/net/wireless/hostap/hostap_pci.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_plx.c3
-rw-r--r--drivers/net/wireless/prism54/islpci_hotplug.c4
-rw-r--r--drivers/pci/Makefile4
-rw-r--r--drivers/pci/hotplug/acpiphp.h1
-rw-r--r--drivers/pci/hotplug/acpiphp_core.c6
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c53
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_core.c66
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_pci.c2
-rw-r--r--drivers/pci/hotplug/cpqphp_core.c12
-rw-r--r--drivers/pci/hotplug/pciehp.h1
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c12
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c191
-rw-r--r--drivers/pci/pci-acpi.c8
-rw-r--r--drivers/pci/pci-sysfs.c11
-rw-r--r--drivers/pci/pci.c200
-rw-r--r--drivers/pci/pcie/aer/Kconfig2
-rw-r--r--drivers/pci/pcie/aer/Makefile3
-rw-r--r--drivers/pci/pcie/aer/aerdrv.c2
-rw-r--r--drivers/pci/pcie/aer/aerdrv.h14
-rw-r--r--drivers/pci/pcie/aer/aerdrv_acpi.c36
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c34
-rw-r--r--drivers/pci/probe.c3
-rw-r--r--drivers/pci/proc.c1
-rw-r--r--drivers/pci/quirks.c30
-rw-r--r--drivers/pci/search.c7
-rw-r--r--drivers/pci/setup-bus.c8
-rw-r--r--drivers/pci/syscall.c20
-rw-r--r--drivers/scsi/aic94xx/aic94xx_init.c9
-rw-r--r--drivers/scsi/ipr.c22
-rw-r--r--drivers/scsi/ips.c9
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c5
-rw-r--r--drivers/scsi/nsp32.c10
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c2
-rw-r--r--drivers/serial/jsm/jsm_driver.c2
-rw-r--r--drivers/usb/gadget/net2280.c2
-rw-r--r--drivers/usb/host/ehci-pci.c3
-rw-r--r--drivers/video/kyro/STG4000InitDevice.c5
-rw-r--r--drivers/video/matrox/matroxfb_base.c4
-rw-r--r--drivers/video/sis/sis_main.c2
-rw-r--r--drivers/video/sstfb.c2
-rw-r--r--drivers/video/tgafb.c3
107 files changed, 652 insertions, 661 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index f7de02a6f497..e1ca86dfdd66 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -115,7 +115,6 @@ struct acpi_processor_errata errata __read_mostly;
115 115
116static int acpi_processor_errata_piix4(struct pci_dev *dev) 116static int acpi_processor_errata_piix4(struct pci_dev *dev)
117{ 117{
118 u8 rev = 0;
119 u8 value1 = 0; 118 u8 value1 = 0;
120 u8 value2 = 0; 119 u8 value2 = 0;
121 120
@@ -127,9 +126,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
127 * Note that 'dev' references the PIIX4 ACPI Controller. 126 * Note that 'dev' references the PIIX4 ACPI Controller.
128 */ 127 */
129 128
130 pci_read_config_byte(dev, PCI_REVISION_ID, &rev); 129 switch (dev->revision) {
131
132 switch (rev) {
133 case 0: 130 case 0:
134 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n")); 131 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found PIIX4 A-step\n"));
135 break; 132 break;
@@ -147,7 +144,7 @@ static int acpi_processor_errata_piix4(struct pci_dev *dev)
147 break; 144 break;
148 } 145 }
149 146
150 switch (rev) { 147 switch (dev->revision) {
151 148
152 case 0: /* PIIX4 A-step */ 149 case 0: /* PIIX4 A-step */
153 case 1: /* PIIX4 B-step */ 150 case 1: /* PIIX4 B-step */
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 21a7ca4936b4..d9fa329fd157 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -928,20 +928,18 @@ static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev)
928{ 928{
929 struct pci_dev *pdev = NULL; 929 struct pci_dev *pdev = NULL;
930 u16 cfg; 930 u16 cfg;
931 u8 rev;
932 int no_piix_dma = 0; 931 int no_piix_dma = 0;
933 932
934 while((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL) 933 while((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL)
935 { 934 {
936 /* Look for 450NX PXB. Check for problem configurations 935 /* Look for 450NX PXB. Check for problem configurations
937 A PCI quirk checks bit 6 already */ 936 A PCI quirk checks bit 6 already */
938 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
939 pci_read_config_word(pdev, 0x41, &cfg); 937 pci_read_config_word(pdev, 0x41, &cfg);
940 /* Only on the original revision: IDE DMA can hang */ 938 /* Only on the original revision: IDE DMA can hang */
941 if (rev == 0x00) 939 if (pdev->revision == 0x00)
942 no_piix_dma = 1; 940 no_piix_dma = 1;
943 /* On all revisions below 5 PXB bus lock must be disabled for IDE */ 941 /* On all revisions below 5 PXB bus lock must be disabled for IDE */
944 else if (cfg & (1<<14) && rev < 5) 942 else if (cfg & (1<<14) && pdev->revision < 5)
945 no_piix_dma = 2; 943 no_piix_dma = 2;
946 } 944 }
947 if (no_piix_dma) 945 if (no_piix_dma)
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 30c4276ec882..010436795d20 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -455,23 +455,21 @@ static struct ata_port_operations ali_c5_port_ops = {
455 455
456static void ali_init_chipset(struct pci_dev *pdev) 456static void ali_init_chipset(struct pci_dev *pdev)
457{ 457{
458 u8 rev, tmp; 458 u8 tmp;
459 struct pci_dev *north, *isa_bridge; 459 struct pci_dev *north, *isa_bridge;
460 460
461 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
462
463 /* 461 /*
464 * The chipset revision selects the driver operations and 462 * The chipset revision selects the driver operations and
465 * mode data. 463 * mode data.
466 */ 464 */
467 465
468 if (rev >= 0x20 && rev < 0xC2) { 466 if (pdev->revision >= 0x20 && pdev->revision < 0xC2) {
469 /* 1543-E/F, 1543C-C, 1543C-D, 1543C-E */ 467 /* 1543-E/F, 1543C-C, 1543C-D, 1543C-E */
470 pci_read_config_byte(pdev, 0x4B, &tmp); 468 pci_read_config_byte(pdev, 0x4B, &tmp);
471 /* Clear CD-ROM DMA write bit */ 469 /* Clear CD-ROM DMA write bit */
472 tmp &= 0x7F; 470 tmp &= 0x7F;
473 pci_write_config_byte(pdev, 0x4B, tmp); 471 pci_write_config_byte(pdev, 0x4B, tmp);
474 } else if (rev >= 0xC2) { 472 } else if (pdev->revision >= 0xC2) {
475 /* Enable cable detection logic */ 473 /* Enable cable detection logic */
476 pci_read_config_byte(pdev, 0x4B, &tmp); 474 pci_read_config_byte(pdev, 0x4B, &tmp);
477 pci_write_config_byte(pdev, 0x4B, tmp | 0x08); 475 pci_write_config_byte(pdev, 0x4B, tmp | 0x08);
@@ -483,21 +481,21 @@ static void ali_init_chipset(struct pci_dev *pdev)
483 /* Configure the ALi bridge logic. For non ALi rely on BIOS. 481 /* Configure the ALi bridge logic. For non ALi rely on BIOS.
484 Set the south bridge enable bit */ 482 Set the south bridge enable bit */
485 pci_read_config_byte(isa_bridge, 0x79, &tmp); 483 pci_read_config_byte(isa_bridge, 0x79, &tmp);
486 if (rev == 0xC2) 484 if (pdev->revision == 0xC2)
487 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04); 485 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04);
488 else if (rev > 0xC2 && rev < 0xC5) 486 else if (pdev->revision > 0xC2 && pdev->revision < 0xC5)
489 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02); 487 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02);
490 } 488 }
491 if (rev >= 0x20) { 489 if (pdev->revision >= 0x20) {
492 /* 490 /*
493 * CD_ROM DMA on (0x53 bit 0). Enable this even if we want 491 * CD_ROM DMA on (0x53 bit 0). Enable this even if we want
494 * to use PIO. 0x53 bit 1 (rev 20 only) - enable FIFO control 492 * to use PIO. 0x53 bit 1 (rev 20 only) - enable FIFO control
495 * via 0x54/55. 493 * via 0x54/55.
496 */ 494 */
497 pci_read_config_byte(pdev, 0x53, &tmp); 495 pci_read_config_byte(pdev, 0x53, &tmp);
498 if (rev <= 0x20) 496 if (pdev->revision <= 0x20)
499 tmp &= ~0x02; 497 tmp &= ~0x02;
500 if (rev >= 0xc7) 498 if (pdev->revision >= 0xc7)
501 tmp |= 0x03; 499 tmp |= 0x03;
502 else 500 else
503 tmp |= 0x01; /* CD_ROM enable for DMA */ 501 tmp |= 0x01; /* CD_ROM enable for DMA */
@@ -579,25 +577,23 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
579 }; 577 };
580 578
581 const struct ata_port_info *ppi[] = { NULL, NULL }; 579 const struct ata_port_info *ppi[] = { NULL, NULL };
582 u8 rev, tmp; 580 u8 tmp;
583 struct pci_dev *isa_bridge; 581 struct pci_dev *isa_bridge;
584 582
585 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
586
587 /* 583 /*
588 * The chipset revision selects the driver operations and 584 * The chipset revision selects the driver operations and
589 * mode data. 585 * mode data.
590 */ 586 */
591 587
592 if (rev < 0x20) { 588 if (pdev->revision < 0x20) {
593 ppi[0] = &info_early; 589 ppi[0] = &info_early;
594 } else if (rev < 0xC2) { 590 } else if (pdev->revision < 0xC2) {
595 ppi[0] = &info_20; 591 ppi[0] = &info_20;
596 } else if (rev == 0xC2) { 592 } else if (pdev->revision == 0xC2) {
597 ppi[0] = &info_c2; 593 ppi[0] = &info_c2;
598 } else if (rev == 0xC3) { 594 } else if (pdev->revision == 0xC3) {
599 ppi[0] = &info_c3; 595 ppi[0] = &info_c3;
600 } else if (rev == 0xC4) { 596 } else if (pdev->revision == 0xC4) {
601 ppi[0] = &info_c4; 597 ppi[0] = &info_c4;
602 } else 598 } else
603 ppi[0] = &info_c5; 599 ppi[0] = &info_c5;
@@ -605,7 +601,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
605 ali_init_chipset(pdev); 601 ali_init_chipset(pdev);
606 602
607 isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); 603 isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
608 if (isa_bridge && rev >= 0x20 && rev < 0xC2) { 604 if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) {
609 /* Are we paired with a UDMA capable chip */ 605 /* Are we paired with a UDMA capable chip */
610 pci_read_config_byte(isa_bridge, 0x5E, &tmp); 606 pci_read_config_byte(isa_bridge, 0x5E, &tmp);
611 if ((tmp & 0x1E) == 0x12) 607 if ((tmp & 0x1E) == 0x12)
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index b9c44c575ce3..b09facad63e1 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -623,17 +623,15 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
623 const struct ata_port_info *ppi[] = { NULL, NULL }; 623 const struct ata_port_info *ppi[] = { NULL, NULL };
624 static int printed_version; 624 static int printed_version;
625 int type = id->driver_data; 625 int type = id->driver_data;
626 u8 rev;
627 u8 fifo; 626 u8 fifo;
628 627
629 if (!printed_version++) 628 if (!printed_version++)
630 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 629 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
631 630
632 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
633 pci_read_config_byte(pdev, 0x41, &fifo); 631 pci_read_config_byte(pdev, 0x41, &fifo);
634 632
635 /* Check for AMD7409 without swdma errata and if found adjust type */ 633 /* Check for AMD7409 without swdma errata and if found adjust type */
636 if (type == 1 && rev > 0x7) 634 if (type == 1 && pdev->revision > 0x7)
637 type = 2; 635 type = 2;
638 636
639 /* Check for AMD7411 */ 637 /* Check for AMD7411 */
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 3fca5898642b..68f150a1e2f4 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -266,7 +266,7 @@ static int cs5530_init_chip(void)
266 } 266 }
267 267
268 pci_set_master(cs5530_0); 268 pci_set_master(cs5530_0);
269 pci_set_mwi(cs5530_0); 269 pci_try_set_mwi(cs5530_0);
270 270
271 /* 271 /*
272 * Set PCI CacheLineSize to 16-bytes: 272 * Set PCI CacheLineSize to 16-bytes:
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index b67bbf6516ba..430673be1df7 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -587,8 +587,7 @@ static int it821x_port_start(struct ata_port *ap)
587 itdev->want[1][1] = ATA_ANY; 587 itdev->want[1][1] = ATA_ANY;
588 itdev->last_device = -1; 588 itdev->last_device = -1;
589 589
590 pci_read_config_byte(pdev, PCI_REVISION_ID, &conf); 590 if (pdev->revision == 0x11) {
591 if (conf == 0x10) {
592 itdev->timing10 = 1; 591 itdev->timing10 = 1;
593 /* Need to disable ATAPI DMA for this case */ 592 /* Need to disable ATAPI DMA for this case */
594 if (!itdev->smart) 593 if (!itdev->smart)
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index 0231aba51ca4..89691541fe59 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -410,11 +410,8 @@ static int serverworks_fixup_osb4(struct pci_dev *pdev)
410 410
411static int serverworks_fixup_csb(struct pci_dev *pdev) 411static int serverworks_fixup_csb(struct pci_dev *pdev)
412{ 412{
413 u8 rev;
414 u8 btr; 413 u8 btr;
415 414
416 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
417
418 /* Third Channel Test */ 415 /* Third Channel Test */
419 if (!(PCI_FUNC(pdev->devfn) & 1)) { 416 if (!(PCI_FUNC(pdev->devfn) & 1)) {
420 struct pci_dev * findev = NULL; 417 struct pci_dev * findev = NULL;
@@ -456,7 +453,7 @@ static int serverworks_fixup_csb(struct pci_dev *pdev)
456 if (!(PCI_FUNC(pdev->devfn) & 1)) 453 if (!(PCI_FUNC(pdev->devfn) & 1))
457 btr |= 0x2; 454 btr |= 0x2;
458 else 455 else
459 btr |= (rev >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2; 456 btr |= (pdev->revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2;
460 pci_write_config_byte(pdev, 0x5A, btr); 457 pci_write_config_byte(pdev, 0x5A, btr);
461 458
462 return btr; 459 return btr;
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 657b1ee2f5c1..9a829a7cbc60 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -931,9 +931,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
931 if (host != NULL) { 931 if (host != NULL) {
932 chipset = sets; /* Match found */ 932 chipset = sets; /* Match found */
933 if (sets->device == 0x630) { /* SIS630 */ 933 if (sets->device == 0x630) { /* SIS630 */
934 u8 host_rev; 934 if (host->revision >= 0x30) /* 630 ET */
935 pci_read_config_byte(host, PCI_REVISION_ID, &host_rev);
936 if (host_rev >= 0x30) /* 630 ET */
937 chipset = &sis100_early; 935 chipset = &sis100_early;
938 } 936 }
939 break; 937 break;
@@ -977,7 +975,6 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
977 u16 trueid; 975 u16 trueid;
978 u8 prefctl; 976 u8 prefctl;
979 u8 idecfg; 977 u8 idecfg;
980 u8 sbrev;
981 978
982 /* Try the second unmasking technique */ 979 /* Try the second unmasking technique */
983 pci_read_config_byte(pdev, 0x4a, &idecfg); 980 pci_read_config_byte(pdev, 0x4a, &idecfg);
@@ -990,11 +987,10 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
990 lpc_bridge = pci_get_slot(pdev->bus, 0x10); /* Bus 0 Dev 2 Fn 0 */ 987 lpc_bridge = pci_get_slot(pdev->bus, 0x10); /* Bus 0 Dev 2 Fn 0 */
991 if (lpc_bridge == NULL) 988 if (lpc_bridge == NULL)
992 break; 989 break;
993 pci_read_config_byte(lpc_bridge, PCI_REVISION_ID, &sbrev);
994 pci_read_config_byte(pdev, 0x49, &prefctl); 990 pci_read_config_byte(pdev, 0x49, &prefctl);
995 pci_dev_put(lpc_bridge); 991 pci_dev_put(lpc_bridge);
996 992
997 if (sbrev == 0x10 && (prefctl & 0x80)) { 993 if (lpc_bridge->revision == 0x10 && (prefctl & 0x80)) {
998 chipset = &sis133_early; 994 chipset = &sis133_early;
999 break; 995 break;
1000 } 996 }
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index bde734189623..8c2813aa6cdb 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -270,7 +270,6 @@ static struct ata_port_operations sl82c105_port_ops = {
270static int sl82c105_bridge_revision(struct pci_dev *pdev) 270static int sl82c105_bridge_revision(struct pci_dev *pdev)
271{ 271{
272 struct pci_dev *bridge; 272 struct pci_dev *bridge;
273 u8 rev;
274 273
275 /* 274 /*
276 * The bridge should be part of the same device, but function 0. 275 * The bridge should be part of the same device, but function 0.
@@ -292,10 +291,8 @@ static int sl82c105_bridge_revision(struct pci_dev *pdev)
292 /* 291 /*
293 * We need to find function 0's revision, not function 1 292 * We need to find function 0's revision, not function 1
294 */ 293 */
295 pci_read_config_byte(bridge, PCI_REVISION_ID, &rev);
296
297 pci_dev_put(bridge); 294 pci_dev_put(bridge);
298 return rev; 295 return bridge->revision;
299} 296}
300 297
301 298
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index f0cadbe6aa11..f645fe22cd1e 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -506,7 +506,6 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
506 struct pci_dev *isa = NULL; 506 struct pci_dev *isa = NULL;
507 const struct via_isa_bridge *config; 507 const struct via_isa_bridge *config;
508 static int printed_version; 508 static int printed_version;
509 u8 t;
510 u8 enable; 509 u8 enable;
511 u32 timing; 510 u32 timing;
512 511
@@ -520,9 +519,8 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
520 !!(config->flags & VIA_BAD_ID), 519 !!(config->flags & VIA_BAD_ID),
521 config->id, NULL))) { 520 config->id, NULL))) {
522 521
523 pci_read_config_byte(isa, PCI_REVISION_ID, &t); 522 if (isa->revision >= config->rev_min &&
524 if (t >= config->rev_min && 523 isa->revision <= config->rev_max)
525 t <= config->rev_max)
526 break; 524 break;
527 pci_dev_put(isa); 525 pci_dev_put(isa);
528 } 526 }
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 8a77a0ae83ad..5d576435fccc 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1765,12 +1765,9 @@ static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
1765 1765
1766static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio) 1766static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio)
1767{ 1767{
1768 u8 rev_id;
1769 int early_5080; 1768 int early_5080;
1770 1769
1771 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); 1770 early_5080 = (pdev->device == 0x5080) && (pdev->revision == 0);
1772
1773 early_5080 = (pdev->device == 0x5080) && (rev_id == 0);
1774 1771
1775 if (!early_5080) { 1772 if (!early_5080) {
1776 u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); 1773 u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL);
@@ -2387,17 +2384,14 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2387{ 2384{
2388 struct pci_dev *pdev = to_pci_dev(host->dev); 2385 struct pci_dev *pdev = to_pci_dev(host->dev);
2389 struct mv_host_priv *hpriv = host->private_data; 2386 struct mv_host_priv *hpriv = host->private_data;
2390 u8 rev_id;
2391 u32 hp_flags = hpriv->hp_flags; 2387 u32 hp_flags = hpriv->hp_flags;
2392 2388
2393 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
2394
2395 switch(board_idx) { 2389 switch(board_idx) {
2396 case chip_5080: 2390 case chip_5080:
2397 hpriv->ops = &mv5xxx_ops; 2391 hpriv->ops = &mv5xxx_ops;
2398 hp_flags |= MV_HP_GEN_I; 2392 hp_flags |= MV_HP_GEN_I;
2399 2393
2400 switch (rev_id) { 2394 switch (pdev->revision) {
2401 case 0x1: 2395 case 0x1:
2402 hp_flags |= MV_HP_ERRATA_50XXB0; 2396 hp_flags |= MV_HP_ERRATA_50XXB0;
2403 break; 2397 break;
@@ -2417,7 +2411,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2417 hpriv->ops = &mv5xxx_ops; 2411 hpriv->ops = &mv5xxx_ops;
2418 hp_flags |= MV_HP_GEN_I; 2412 hp_flags |= MV_HP_GEN_I;
2419 2413
2420 switch (rev_id) { 2414 switch (pdev->revision) {
2421 case 0x0: 2415 case 0x0:
2422 hp_flags |= MV_HP_ERRATA_50XXB0; 2416 hp_flags |= MV_HP_ERRATA_50XXB0;
2423 break; 2417 break;
@@ -2437,7 +2431,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2437 hpriv->ops = &mv6xxx_ops; 2431 hpriv->ops = &mv6xxx_ops;
2438 hp_flags |= MV_HP_GEN_II; 2432 hp_flags |= MV_HP_GEN_II;
2439 2433
2440 switch (rev_id) { 2434 switch (pdev->revision) {
2441 case 0x7: 2435 case 0x7:
2442 hp_flags |= MV_HP_ERRATA_60X1B2; 2436 hp_flags |= MV_HP_ERRATA_60X1B2;
2443 break; 2437 break;
@@ -2457,7 +2451,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2457 hpriv->ops = &mv6xxx_ops; 2451 hpriv->ops = &mv6xxx_ops;
2458 hp_flags |= MV_HP_GEN_IIE; 2452 hp_flags |= MV_HP_GEN_IIE;
2459 2453
2460 switch (rev_id) { 2454 switch (pdev->revision) {
2461 case 0x0: 2455 case 0x0:
2462 hp_flags |= MV_HP_ERRATA_XX42A0; 2456 hp_flags |= MV_HP_ERRATA_XX42A0;
2463 break; 2457 break;
@@ -2585,14 +2579,12 @@ static void mv_print_info(struct ata_host *host)
2585{ 2579{
2586 struct pci_dev *pdev = to_pci_dev(host->dev); 2580 struct pci_dev *pdev = to_pci_dev(host->dev);
2587 struct mv_host_priv *hpriv = host->private_data; 2581 struct mv_host_priv *hpriv = host->private_data;
2588 u8 rev_id, scc; 2582 u8 scc;
2589 const char *scc_s, *gen; 2583 const char *scc_s, *gen;
2590 2584
2591 /* Use this to determine the HW stepping of the chip so we know 2585 /* Use this to determine the HW stepping of the chip so we know
2592 * what errata to workaround 2586 * what errata to workaround
2593 */ 2587 */
2594 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
2595
2596 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &scc); 2588 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &scc);
2597 if (scc == 0) 2589 if (scc == 0)
2598 scc_s = "SCSI"; 2590 scc_s = "SCSI";
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 0d3a38b1cb0b..77637e780d41 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1704,7 +1704,6 @@ static int __devinit eni_do_init(struct atm_dev *dev)
1704 struct pci_dev *pci_dev; 1704 struct pci_dev *pci_dev;
1705 unsigned long real_base; 1705 unsigned long real_base;
1706 void __iomem *base; 1706 void __iomem *base;
1707 unsigned char revision;
1708 int error,i,last; 1707 int error,i,last;
1709 1708
1710 DPRINTK(">eni_init\n"); 1709 DPRINTK(">eni_init\n");
@@ -1715,12 +1714,6 @@ static int __devinit eni_do_init(struct atm_dev *dev)
1715 pci_dev = eni_dev->pci_dev; 1714 pci_dev = eni_dev->pci_dev;
1716 real_base = pci_resource_start(pci_dev, 0); 1715 real_base = pci_resource_start(pci_dev, 0);
1717 eni_dev->irq = pci_dev->irq; 1716 eni_dev->irq = pci_dev->irq;
1718 error = pci_read_config_byte(pci_dev,PCI_REVISION_ID,&revision);
1719 if (error) {
1720 printk(KERN_ERR DEV_LABEL "(itf %d): init error 0x%02x\n",
1721 dev->number,error);
1722 return -EINVAL;
1723 }
1724 if ((error = pci_write_config_word(pci_dev,PCI_COMMAND, 1717 if ((error = pci_write_config_word(pci_dev,PCI_COMMAND,
1725 PCI_COMMAND_MEMORY | 1718 PCI_COMMAND_MEMORY |
1726 (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) { 1719 (eni_dev->asic ? PCI_COMMAND_PARITY | PCI_COMMAND_SERR : 0)))) {
@@ -1729,7 +1722,7 @@ static int __devinit eni_do_init(struct atm_dev *dev)
1729 return -EIO; 1722 return -EIO;
1730 } 1723 }
1731 printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d,base=0x%lx,irq=%d,", 1724 printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d,base=0x%lx,irq=%d,",
1732 dev->number,revision,real_base,eni_dev->irq); 1725 dev->number,pci_dev->revision,real_base,eni_dev->irq);
1733 if (!(base = ioremap_nocache(real_base,MAP_MAX_SIZE))) { 1726 if (!(base = ioremap_nocache(real_base,MAP_MAX_SIZE))) {
1734 printk("\n"); 1727 printk("\n");
1735 printk(KERN_ERR DEV_LABEL "(itf %d): can't set up page " 1728 printk(KERN_ERR DEV_LABEL "(itf %d): can't set up page "
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 3800bc0cb2ef..8f995ce8d73b 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -3679,7 +3679,6 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
3679 unsigned long membase, srambase; 3679 unsigned long membase, srambase;
3680 struct idt77252_dev *card; 3680 struct idt77252_dev *card;
3681 struct atm_dev *dev; 3681 struct atm_dev *dev;
3682 ushort revision = 0;
3683 int i, err; 3682 int i, err;
3684 3683
3685 3684
@@ -3688,19 +3687,13 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
3688 return err; 3687 return err;
3689 } 3688 }
3690 3689
3691 if (pci_read_config_word(pcidev, PCI_REVISION_ID, &revision)) {
3692 printk("idt77252-%d: can't read PCI_REVISION_ID\n", index);
3693 err = -ENODEV;
3694 goto err_out_disable_pdev;
3695 }
3696
3697 card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL); 3690 card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL);
3698 if (!card) { 3691 if (!card) {
3699 printk("idt77252-%d: can't allocate private data\n", index); 3692 printk("idt77252-%d: can't allocate private data\n", index);
3700 err = -ENOMEM; 3693 err = -ENOMEM;
3701 goto err_out_disable_pdev; 3694 goto err_out_disable_pdev;
3702 } 3695 }
3703 card->revision = revision; 3696 card->revision = pcidev->revision;
3704 card->index = index; 3697 card->index = index;
3705 card->pcidev = pcidev; 3698 card->pcidev = pcidev;
3706 sprintf(card->name, "idt77252-%d", card->index); 3699 sprintf(card->name, "idt77252-%d", card->index);
@@ -3762,8 +3755,8 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
3762 } 3755 }
3763 3756
3764 printk("%s: ABR SAR (Rev %c): MEM %08lx SRAM %08lx [%u KB]\n", 3757 printk("%s: ABR SAR (Rev %c): MEM %08lx SRAM %08lx [%u KB]\n",
3765 card->name, ((revision > 1) && (revision < 25)) ? 3758 card->name, ((card->revision > 1) && (card->revision < 25)) ?
3766 'A' + revision - 1 : '?', membase, srambase, 3759 'A' + card->revision - 1 : '?', membase, srambase,
3767 card->sramsize / 1024); 3760 card->sramsize / 1024);
3768 3761
3769 if (init_card(dev)) { 3762 if (init_card(dev)) {
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index bb7ef570514c..a3b605a0ca17 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2290,7 +2290,6 @@ static int __devinit ia_init(struct atm_dev *dev)
2290 unsigned long real_base; 2290 unsigned long real_base;
2291 void __iomem *base; 2291 void __iomem *base;
2292 unsigned short command; 2292 unsigned short command;
2293 unsigned char revision;
2294 int error, i; 2293 int error, i;
2295 2294
2296 /* The device has been identified and registered. Now we read 2295 /* The device has been identified and registered. Now we read
@@ -2305,16 +2304,14 @@ static int __devinit ia_init(struct atm_dev *dev)
2305 real_base = pci_resource_start (iadev->pci, 0); 2304 real_base = pci_resource_start (iadev->pci, 0);
2306 iadev->irq = iadev->pci->irq; 2305 iadev->irq = iadev->pci->irq;
2307 2306
2308 if ((error = pci_read_config_word(iadev->pci, PCI_COMMAND,&command)) 2307 error = pci_read_config_word(iadev->pci, PCI_COMMAND, &command);
2309 || (error = pci_read_config_byte(iadev->pci, 2308 if (error) {
2310 PCI_REVISION_ID,&revision)))
2311 {
2312 printk(KERN_ERR DEV_LABEL "(itf %d): init error 0x%x\n", 2309 printk(KERN_ERR DEV_LABEL "(itf %d): init error 0x%x\n",
2313 dev->number,error); 2310 dev->number,error);
2314 return -EINVAL; 2311 return -EINVAL;
2315 } 2312 }
2316 IF_INIT(printk(DEV_LABEL "(itf %d): rev.%d,realbase=0x%lx,irq=%d\n", 2313 IF_INIT(printk(DEV_LABEL "(itf %d): rev.%d,realbase=0x%lx,irq=%d\n",
2317 dev->number, revision, real_base, iadev->irq);) 2314 dev->number, iadev->pci->revision, real_base, iadev->irq);)
2318 2315
2319 /* find mapping size of board */ 2316 /* find mapping size of board */
2320 2317
@@ -2353,7 +2350,7 @@ static int __devinit ia_init(struct atm_dev *dev)
2353 return error; 2350 return error;
2354 } 2351 }
2355 IF_INIT(printk(DEV_LABEL " (itf %d): rev.%d,base=%p,irq=%d\n", 2352 IF_INIT(printk(DEV_LABEL " (itf %d): rev.%d,base=%p,irq=%d\n",
2356 dev->number, revision, base, iadev->irq);) 2353 dev->number, iadev->pci->revision, base, iadev->irq);)
2357 2354
2358 /* filling the iphase dev structure */ 2355 /* filling the iphase dev structure */
2359 iadev->mem = iadev->pci_map_size /2; 2356 iadev->mem = iadev->pci_map_size /2;
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 09f477d4237a..0e2c1ae650e7 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -246,8 +246,8 @@ struct lanai_vcc {
246}; 246};
247 247
248enum lanai_type { 248enum lanai_type {
249 lanai2 = PCI_VENDOR_ID_EF_ATM_LANAI2, 249 lanai2 = PCI_DEVICE_ID_EF_ATM_LANAI2,
250 lanaihb = PCI_VENDOR_ID_EF_ATM_LANAIHB 250 lanaihb = PCI_DEVICE_ID_EF_ATM_LANAIHB
251}; 251};
252 252
253struct lanai_dev_stats { 253struct lanai_dev_stats {
@@ -293,7 +293,6 @@ struct lanai_dev {
293 struct atm_vcc *cbrvcc; 293 struct atm_vcc *cbrvcc;
294 int number; 294 int number;
295 int board_rev; 295 int board_rev;
296 u8 pci_revision;
297/* TODO - look at race conditions with maintence of conf1/conf2 */ 296/* TODO - look at race conditions with maintence of conf1/conf2 */
298/* TODO - transmit locking: should we use _irq not _irqsave? */ 297/* TODO - transmit locking: should we use _irq not _irqsave? */
299/* TODO - organize above in some rational fashion (see <asm/cache.h>) */ 298/* TODO - organize above in some rational fashion (see <asm/cache.h>) */
@@ -1969,14 +1968,6 @@ static int __devinit lanai_pci_start(struct lanai_dev *lanai)
1969 "(itf %d): No suitable DMA available.\n", lanai->number); 1968 "(itf %d): No suitable DMA available.\n", lanai->number);
1970 return -EBUSY; 1969 return -EBUSY;
1971 } 1970 }
1972 /* Get the pci revision byte */
1973 result = pci_read_config_byte(pci, PCI_REVISION_ID,
1974 &lanai->pci_revision);
1975 if (result != PCIBIOS_SUCCESSFUL) {
1976 printk(KERN_ERR DEV_LABEL "(itf %d): can't read "
1977 "PCI_REVISION_ID: %d\n", lanai->number, result);
1978 return -EINVAL;
1979 }
1980 result = pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &w); 1971 result = pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &w);
1981 if (result != PCIBIOS_SUCCESSFUL) { 1972 if (result != PCIBIOS_SUCCESSFUL) {
1982 printk(KERN_ERR DEV_LABEL "(itf %d): can't read " 1973 printk(KERN_ERR DEV_LABEL "(itf %d): can't read "
@@ -2254,7 +2245,7 @@ static int __devinit lanai_dev_open(struct atm_dev *atmdev)
2254 lanai_timed_poll_start(lanai); 2245 lanai_timed_poll_start(lanai);
2255 printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d, base=0x%lx, irq=%u " 2246 printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d, base=0x%lx, irq=%u "
2256 "(%02X-%02X-%02X-%02X-%02X-%02X)\n", lanai->number, 2247 "(%02X-%02X-%02X-%02X-%02X-%02X)\n", lanai->number,
2257 (int) lanai->pci_revision, (unsigned long) lanai->base, 2248 (int) lanai->pci->revision, (unsigned long) lanai->base,
2258 lanai->pci->irq, 2249 lanai->pci->irq,
2259 atmdev->esi[0], atmdev->esi[1], atmdev->esi[2], 2250 atmdev->esi[0], atmdev->esi[1], atmdev->esi[2],
2260 atmdev->esi[3], atmdev->esi[4], atmdev->esi[5]); 2251 atmdev->esi[3], atmdev->esi[4], atmdev->esi[5]);
@@ -2491,7 +2482,7 @@ static int lanai_proc_read(struct atm_dev *atmdev, loff_t *pos, char *page)
2491 (unsigned int) lanai->magicno, lanai->num_vci); 2482 (unsigned int) lanai->magicno, lanai->num_vci);
2492 if (left-- == 0) 2483 if (left-- == 0)
2493 return sprintf(page, "revision: board=%d, pci_if=%d\n", 2484 return sprintf(page, "revision: board=%d, pci_if=%d\n",
2494 lanai->board_rev, (int) lanai->pci_revision); 2485 lanai->board_rev, (int) lanai->pci->revision);
2495 if (left-- == 0) 2486 if (left-- == 0)
2496 return sprintf(page, "EEPROM ESI: " 2487 return sprintf(page, "EEPROM ESI: "
2497 "%02X:%02X:%02X:%02X:%02X:%02X\n", 2488 "%02X:%02X:%02X:%02X:%02X:%02X\n",
@@ -2631,14 +2622,8 @@ static int __devinit lanai_init_one(struct pci_dev *pci,
2631} 2622}
2632 2623
2633static struct pci_device_id lanai_pci_tbl[] = { 2624static struct pci_device_id lanai_pci_tbl[] = {
2634 { 2625 { PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_LANAI2) },
2635 PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAI2, 2626 { PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_LANAIHB) },
2636 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
2637 },
2638 {
2639 PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAIHB,
2640 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
2641 },
2642 { 0, } /* terminal entry */ 2627 { 0, } /* terminal entry */
2643}; 2628};
2644MODULE_DEVICE_TABLE(pci, lanai_pci_tbl); 2629MODULE_DEVICE_TABLE(pci, lanai_pci_tbl);
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index 2ad2527cf5b3..020a87a476c8 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -1182,7 +1182,6 @@ static int __devinit zatm_init(struct atm_dev *dev)
1182 struct zatm_dev *zatm_dev; 1182 struct zatm_dev *zatm_dev;
1183 struct pci_dev *pci_dev; 1183 struct pci_dev *pci_dev;
1184 unsigned short command; 1184 unsigned short command;
1185 unsigned char revision;
1186 int error,i,last; 1185 int error,i,last;
1187 unsigned long t0,t1,t2; 1186 unsigned long t0,t1,t2;
1188 1187
@@ -1192,8 +1191,7 @@ static int __devinit zatm_init(struct atm_dev *dev)
1192 pci_dev = zatm_dev->pci_dev; 1191 pci_dev = zatm_dev->pci_dev;
1193 zatm_dev->base = pci_resource_start(pci_dev, 0); 1192 zatm_dev->base = pci_resource_start(pci_dev, 0);
1194 zatm_dev->irq = pci_dev->irq; 1193 zatm_dev->irq = pci_dev->irq;
1195 if ((error = pci_read_config_word(pci_dev,PCI_COMMAND,&command)) || 1194 if ((error = pci_read_config_word(pci_dev,PCI_COMMAND,&command))) {
1196 (error = pci_read_config_byte(pci_dev,PCI_REVISION_ID,&revision))) {
1197 printk(KERN_ERR DEV_LABEL "(itf %d): init error 0x%02x\n", 1195 printk(KERN_ERR DEV_LABEL "(itf %d): init error 0x%02x\n",
1198 dev->number,error); 1196 dev->number,error);
1199 return -EINVAL; 1197 return -EINVAL;
@@ -1206,7 +1204,7 @@ static int __devinit zatm_init(struct atm_dev *dev)
1206 } 1204 }
1207 eprom_get_esi(dev); 1205 eprom_get_esi(dev);
1208 printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d,base=0x%x,irq=%d,", 1206 printk(KERN_NOTICE DEV_LABEL "(itf %d): rev.%d,base=0x%x,irq=%d,",
1209 dev->number,revision,zatm_dev->base,zatm_dev->irq); 1207 dev->number,pci_dev->revision,zatm_dev->base,zatm_dev->irq);
1210 /* reset uPD98401 */ 1208 /* reset uPD98401 */
1211 zout(0,SWR); 1209 zout(0,SWR);
1212 while (!(zin(GSR) & uPD98401_INT_IND)); 1210 while (!(zin(GSR) & uPD98401_INT_IND));
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index e6c534e62846..df0ddf14b85c 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -462,9 +462,7 @@ static int __devinit agp_amdk7_probe(struct pci_dev *pdev,
462 * erratum 46: Setup violation on AGP SBA pins - Disable side band addressing. 462 * erratum 46: Setup violation on AGP SBA pins - Disable side band addressing.
463 * With this lot disabled, we should prevent lockups. */ 463 * With this lot disabled, we should prevent lockups. */
464 if (agp_bridge->dev->device == PCI_DEVICE_ID_AMD_FE_GATE_700E) { 464 if (agp_bridge->dev->device == PCI_DEVICE_ID_AMD_FE_GATE_700E) {
465 u8 revision=0; 465 if (pdev->revision == 0x10 || pdev->revision == 0x11) {
466 pci_read_config_byte(pdev, PCI_REVISION_ID, &revision);
467 if (revision == 0x10 || revision == 0x11) {
468 agp_bridge->flags = AGP_ERRATA_FASTWRITES; 466 agp_bridge->flags = AGP_ERRATA_FASTWRITES;
469 agp_bridge->flags |= AGP_ERRATA_SBA; 467 agp_bridge->flags |= AGP_ERRATA_SBA;
470 agp_bridge->flags |= AGP_ERRATA_1X; 468 agp_bridge->flags |= AGP_ERRATA_1X;
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 801abdd29066..d95662e96326 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -367,10 +367,8 @@ static __devinit int cache_nbs (struct pci_dev *pdev, u32 cap_ptr)
367static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data *bridge) 367static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data *bridge)
368{ 368{
369 char *revstring; 369 char *revstring;
370 u8 rev_id;
371 370
372 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); 371 switch (pdev->revision) {
373 switch (rev_id) {
374 case 0x01: revstring="A0"; break; 372 case 0x01: revstring="A0"; break;
375 case 0x02: revstring="A1"; break; 373 case 0x02: revstring="A1"; break;
376 case 0x11: revstring="B0"; break; 374 case 0x11: revstring="B0"; break;
@@ -386,7 +384,7 @@ static void __devinit amd8151_init(struct pci_dev *pdev, struct agp_bridge_data
386 * Work around errata. 384 * Work around errata.
387 * Chips before B2 stepping incorrectly reporting v3.5 385 * Chips before B2 stepping incorrectly reporting v3.5
388 */ 386 */
389 if (rev_id < 0x13) { 387 if (pdev->revision < 0x13) {
390 printk (KERN_INFO PFX "Correcting AGP revision (reports 3.5, is really 3.0)\n"); 388 printk (KERN_INFO PFX "Correcting AGP revision (reports 3.5, is really 3.0)\n");
391 bridge->major_version = 3; 389 bridge->major_version = 3;
392 bridge->minor_version = 0; 390 bridge->minor_version = 0;
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 5cfcff532545..e783dbf0f162 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -105,14 +105,11 @@ static inline void acpi_pm_need_workaround(void)
105 */ 105 */
106static void __devinit acpi_pm_check_blacklist(struct pci_dev *dev) 106static void __devinit acpi_pm_check_blacklist(struct pci_dev *dev)
107{ 107{
108 u8 rev;
109
110 if (acpi_pm_good) 108 if (acpi_pm_good)
111 return; 109 return;
112 110
113 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
114 /* the bug has been fixed in PIIX4M */ 111 /* the bug has been fixed in PIIX4M */
115 if (rev < 3) { 112 if (dev->revision < 3) {
116 printk(KERN_WARNING "* Found PM-Timer Bug on the chipset." 113 printk(KERN_WARNING "* Found PM-Timer Bug on the chipset."
117 " Due to workarounds for a bug,\n" 114 " Due to workarounds for a bug,\n"
118 "* this clock source is slow. Consider trying" 115 "* this clock source is slow. Consider trying"
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index a0f7e4a303b5..edc275002f80 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -397,8 +397,7 @@ found:
397 case PCI_DEVICE_ID_VIA_82C686_4: 397 case PCI_DEVICE_ID_VIA_82C686_4:
398 /* The VT82C686B (rev 0x40) does support I2C block 398 /* The VT82C686B (rev 0x40) does support I2C block
399 transactions, but the VT82C686A (rev 0x30) doesn't */ 399 transactions, but the VT82C686A (rev 0x30) doesn't */
400 if (!pci_read_config_byte(pdev, PCI_REVISION_ID, &temp) 400 if (pdev->revision >= 0x40)
401 && temp >= 0x40)
402 vt596_features |= FEATURE_I2CBLOCK; 401 vt596_features |= FEATURE_I2CBLOCK;
403 break; 402 break;
404 } 403 }
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 8a6b27b3bcc3..ba0fb92b0417 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -508,7 +508,7 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
508 u8 tmpbyte; 508 u8 tmpbyte;
509 struct pci_dev *north = pci_get_slot(dev->bus, PCI_DEVFN(0,0)); 509 struct pci_dev *north = pci_get_slot(dev->bus, PCI_DEVFN(0,0));
510 510
511 pci_read_config_byte(dev, PCI_REVISION_ID, &m5229_revision); 511 m5229_revision = dev->revision;
512 512
513 isa_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); 513 isa_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
514 514
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 84ed30cdb324..8d30b99a54d8 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -123,8 +123,7 @@ static int amd74xx_get_info(char *buffer, char **addr, off_t offset, int count)
123 amd_print("Driver Version: 2.13"); 123 amd_print("Driver Version: 2.13");
124 amd_print("South Bridge: %s", pci_name(bmide_dev)); 124 amd_print("South Bridge: %s", pci_name(bmide_dev));
125 125
126 pci_read_config_byte(dev, PCI_REVISION_ID, &t); 126 amd_print("Revision: IDE %#x", dev->revision);
127 amd_print("Revision: IDE %#x", t);
128 amd_print("Highest DMA rate: UDMA%s", amd_dma[fls(amd_config->udma_mask) - 1]); 127 amd_print("Highest DMA rate: UDMA%s", amd_dma[fls(amd_config->udma_mask) - 1]);
129 128
130 amd_print("BM-DMA base: %#lx", amd_base); 129 amd_print("BM-DMA base: %#lx", amd_base);
@@ -312,8 +311,7 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
312 */ 311 */
313 312
314 if (amd_config->flags & AMD_CHECK_SWDMA) { 313 if (amd_config->flags & AMD_CHECK_SWDMA) {
315 pci_read_config_byte(dev, PCI_REVISION_ID, &t); 314 if (dev->revision <= 7)
316 if (t <= 7)
317 amd_config->flags |= AMD_BAD_SWDMA; 315 amd_config->flags |= AMD_BAD_SWDMA;
318 } 316 }
319 317
@@ -383,7 +381,7 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
383 381
384 pci_read_config_byte(dev, PCI_REVISION_ID, &t); 382 pci_read_config_byte(dev, PCI_REVISION_ID, &t);
385 printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n", 383 printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n",
386 amd_chipset->name, pci_name(dev), t, 384 amd_chipset->name, pci_name(dev), dev->revision,
387 amd_dma[fls(amd_config->udma_mask) - 1]); 385 amd_dma[fls(amd_config->udma_mask) - 1]);
388 386
389/* 387/*
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 8631b6c8aa15..1e89dd6e5bbf 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -88,7 +88,6 @@ static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index)
88 u8 reg72 = 0, reg73 = 0; /* primary */ 88 u8 reg72 = 0, reg73 = 0; /* primary */
89 u8 reg7a = 0, reg7b = 0; /* secondary */ 89 u8 reg7a = 0, reg7b = 0; /* secondary */
90 u8 reg50 = 1, reg51 = 1, reg57 = 0, reg71 = 0; /* extra */ 90 u8 reg50 = 1, reg51 = 1, reg57 = 0, reg71 = 0; /* extra */
91 u8 rev = 0;
92 91
93 p += sprintf(p, "\nController: %d\n", index); 92 p += sprintf(p, "\nController: %d\n", index);
94 p += sprintf(p, "PCI-%x Chipset.\n", dev->device); 93 p += sprintf(p, "PCI-%x Chipset.\n", dev->device);
@@ -103,9 +102,8 @@ static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index)
103 (void) pci_read_config_byte(dev, UDIDETCR1, &reg7b); 102 (void) pci_read_config_byte(dev, UDIDETCR1, &reg7b);
104 103
105 /* PCI0643/6 originally didn't have the primary channel enable bit */ 104 /* PCI0643/6 originally didn't have the primary channel enable bit */
106 (void) pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
107 if ((dev->device == PCI_DEVICE_ID_CMD_643) || 105 if ((dev->device == PCI_DEVICE_ID_CMD_643) ||
108 (dev->device == PCI_DEVICE_ID_CMD_646 && rev < 3)) 106 (dev->device == PCI_DEVICE_ID_CMD_646 && dev->revision < 3))
109 reg51 |= CNTRL_ENA_1ST; 107 reg51 |= CNTRL_ENA_1ST;
110 108
111 p += sprintf(p, "---------------- Primary Channel " 109 p += sprintf(p, "---------------- Primary Channel "
@@ -604,14 +602,11 @@ static int __devinit init_setup_cmd64x(struct pci_dev *dev, ide_pci_device_t *d)
604 602
605static int __devinit init_setup_cmd646(struct pci_dev *dev, ide_pci_device_t *d) 603static int __devinit init_setup_cmd646(struct pci_dev *dev, ide_pci_device_t *d)
606{ 604{
607 u8 rev = 0;
608
609 /* 605 /*
610 * The original PCI0646 didn't have the primary channel enable bit, 606 * The original PCI0646 didn't have the primary channel enable bit,
611 * it appeared starting with PCI0646U (i.e. revision ID 3). 607 * it appeared starting with PCI0646U (i.e. revision ID 3).
612 */ 608 */
613 pci_read_config_byte(dev, PCI_REVISION_ID, &rev); 609 if (dev->revision < 3)
614 if (rev < 3)
615 d->enablebits[0].reg = 0; 610 d->enablebits[0].reg = 0;
616 611
617 return ide_setup_pci_device(dev, d); 612 return ide_setup_pci_device(dev, d);
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 1eec1f308d16..b5c00d15a704 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -236,7 +236,7 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
236 */ 236 */
237 237
238 pci_set_master(cs5530_0); 238 pci_set_master(cs5530_0);
239 pci_set_mwi(cs5530_0); 239 pci_try_set_mwi(cs5530_0);
240 240
241 /* 241 /*
242 * Set PCI CacheLineSize to 16-bytes: 242 * Set PCI CacheLineSize to 16-bytes:
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 4b6bae8eee82..e9b07a97c340 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1413,11 +1413,9 @@ static int __devinit init_setup_hpt372n(struct pci_dev *dev, ide_pci_device_t *d
1413static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d) 1413static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d)
1414{ 1414{
1415 struct hpt_info *info; 1415 struct hpt_info *info;
1416 u8 rev = 0, mcr1 = 0; 1416 u8 mcr1 = 0;
1417 1417
1418 pci_read_config_byte(dev, PCI_REVISION_ID, &rev); 1418 if (dev->revision > 1) {
1419
1420 if (rev > 1) {
1421 d->name = "HPT371N"; 1419 d->name = "HPT371N";
1422 1420
1423 info = &hpt371n; 1421 info = &hpt371n;
@@ -1442,11 +1440,8 @@ static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d)
1442static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d) 1440static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d)
1443{ 1441{
1444 struct hpt_info *info; 1442 struct hpt_info *info;
1445 u8 rev = 0;
1446
1447 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
1448 1443
1449 if (rev > 1) { 1444 if (dev->revision > 1) {
1450 d->name = "HPT372N"; 1445 d->name = "HPT372N";
1451 1446
1452 info = &hpt372n; 1447 info = &hpt372n;
@@ -1460,11 +1455,8 @@ static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d
1460static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d) 1455static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d)
1461{ 1456{
1462 struct hpt_info *info; 1457 struct hpt_info *info;
1463 u8 rev = 0;
1464 1458
1465 pci_read_config_byte(dev, PCI_REVISION_ID, &rev); 1459 if (dev->revision > 1) {
1466
1467 if (rev > 1) {
1468 d->name = "HPT302N"; 1460 d->name = "HPT302N";
1469 1461
1470 info = &hpt302n; 1462 info = &hpt302n;
@@ -1478,7 +1470,7 @@ static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d)
1478static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) 1470static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
1479{ 1471{
1480 struct pci_dev *dev2; 1472 struct pci_dev *dev2;
1481 u8 rev = 0; 1473 u8 rev = dev->revision;
1482 static char *chipset_names[] = { "HPT366", "HPT366", "HPT368", 1474 static char *chipset_names[] = { "HPT366", "HPT366", "HPT368",
1483 "HPT370", "HPT370A", "HPT372", 1475 "HPT370", "HPT370A", "HPT372",
1484 "HPT372N" }; 1476 "HPT372N" };
@@ -1489,8 +1481,6 @@ static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d)
1489 if (PCI_FUNC(dev->devfn) & 1) 1481 if (PCI_FUNC(dev->devfn) & 1)
1490 return -ENODEV; 1482 return -ENODEV;
1491 1483
1492 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
1493
1494 switch (rev) { 1484 switch (rev) {
1495 case 0: 1485 case 0:
1496 case 1: 1486 case 1:
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 2e0b29ef596a..1372c35be035 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -572,18 +572,16 @@ static void __devinit piix_check_450nx(void)
572{ 572{
573 struct pci_dev *pdev = NULL; 573 struct pci_dev *pdev = NULL;
574 u16 cfg; 574 u16 cfg;
575 u8 rev;
576 while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL) 575 while((pdev=pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev))!=NULL)
577 { 576 {
578 /* Look for 450NX PXB. Check for problem configurations 577 /* Look for 450NX PXB. Check for problem configurations
579 A PCI quirk checks bit 6 already */ 578 A PCI quirk checks bit 6 already */
580 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
581 pci_read_config_word(pdev, 0x41, &cfg); 579 pci_read_config_word(pdev, 0x41, &cfg);
582 /* Only on the original revision: IDE DMA can hang */ 580 /* Only on the original revision: IDE DMA can hang */
583 if(rev == 0x00) 581 if (pdev->revision == 0x00)
584 no_piix_dma = 1; 582 no_piix_dma = 1;
585 /* On all revisions below 5 PXB bus lock must be disabled for IDE */ 583 /* On all revisions below 5 PXB bus lock must be disabled for IDE */
586 else if(cfg & (1<<14) && rev < 5) 584 else if (cfg & (1<<14) && pdev->revision < 5)
587 no_piix_dma = 2; 585 no_piix_dma = 2;
588 } 586 }
589 if(no_piix_dma) 587 if(no_piix_dma)
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 1371b5bf6bf0..ed04e0c8dd4c 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -55,7 +55,6 @@ static const char *svwks_bad_ata100[] = {
55 NULL 55 NULL
56}; 56};
57 57
58static u8 svwks_revision = 0;
59static struct pci_dev *isa_dev; 58static struct pci_dev *isa_dev;
60 59
61static int check_in_drive_lists (ide_drive_t *drive, const char **list) 60static int check_in_drive_lists (ide_drive_t *drive, const char **list)
@@ -71,9 +70,6 @@ static u8 svwks_udma_filter(ide_drive_t *drive)
71 struct pci_dev *dev = HWIF(drive)->pci_dev; 70 struct pci_dev *dev = HWIF(drive)->pci_dev;
72 u8 mask = 0; 71 u8 mask = 0;
73 72
74 if (!svwks_revision)
75 pci_read_config_byte(dev, PCI_REVISION_ID, &svwks_revision);
76
77 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) 73 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE)
78 return 0x1f; 74 return 0x1f;
79 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { 75 if (dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) {
@@ -88,9 +84,9 @@ static u8 svwks_udma_filter(ide_drive_t *drive)
88 return 0; 84 return 0;
89 /* Check the OSB4 DMA33 enable bit */ 85 /* Check the OSB4 DMA33 enable bit */
90 return ((reg & 0x00004000) == 0x00004000) ? 0x07 : 0; 86 return ((reg & 0x00004000) == 0x00004000) ? 0x07 : 0;
91 } else if (svwks_revision < SVWKS_CSB5_REVISION_NEW) { 87 } else if (dev->revision < SVWKS_CSB5_REVISION_NEW) {
92 return 0x07; 88 return 0x07;
93 } else if (svwks_revision >= SVWKS_CSB5_REVISION_NEW) { 89 } else if (dev->revision >= SVWKS_CSB5_REVISION_NEW) {
94 u8 btr = 0, mode; 90 u8 btr = 0, mode;
95 pci_read_config_byte(dev, 0x5A, &btr); 91 pci_read_config_byte(dev, 0x5A, &btr);
96 mode = btr & 0x3; 92 mode = btr & 0x3;
@@ -234,9 +230,6 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
234 unsigned int reg; 230 unsigned int reg;
235 u8 btr; 231 u8 btr;
236 232
237 /* save revision id to determine DMA capability */
238 pci_read_config_byte(dev, PCI_REVISION_ID, &svwks_revision);
239
240 /* force Master Latency Timer value to 64 PCICLKs */ 233 /* force Master Latency Timer value to 64 PCICLKs */
241 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x40); 234 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x40);
242 235
@@ -315,7 +308,7 @@ static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const cha
315 if (!(PCI_FUNC(dev->devfn) & 1)) 308 if (!(PCI_FUNC(dev->devfn) & 1))
316 btr |= 0x2; 309 btr |= 0x2;
317 else 310 else
318 btr |= (svwks_revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2; 311 btr |= (dev->revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2;
319 pci_write_config_byte(dev, 0x5A, btr); 312 pci_write_config_byte(dev, 0x5A, btr);
320 } 313 }
321 /* Setup HT1000 SouthBridge Controller - Single Channel Only */ 314 /* Setup HT1000 SouthBridge Controller - Single Channel Only */
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index f875183ac8d9..756a9b6eb462 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -659,9 +659,7 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c
659 659
660 /* Special case for SiS630 : 630S/ET is ATA_100a */ 660 /* Special case for SiS630 : 630S/ET is ATA_100a */
661 if (SiSHostChipInfo[i].host_id == PCI_DEVICE_ID_SI_630) { 661 if (SiSHostChipInfo[i].host_id == PCI_DEVICE_ID_SI_630) {
662 u8 hostrev; 662 if (host->revision >= 0x30)
663 pci_read_config_byte(host, PCI_REVISION_ID, &hostrev);
664 if (hostrev >= 0x30)
665 chipset_family = ATA_100a; 663 chipset_family = ATA_100a;
666 } 664 }
667 pci_dev_put(host); 665 pci_dev_put(host);
@@ -702,7 +700,6 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c
702 u16 trueid; 700 u16 trueid;
703 u8 prefctl; 701 u8 prefctl;
704 u8 idecfg; 702 u8 idecfg;
705 u8 sbrev;
706 703
707 pci_read_config_byte(dev, 0x4a, &idecfg); 704 pci_read_config_byte(dev, 0x4a, &idecfg);
708 pci_write_config_byte(dev, 0x4a, idecfg | 0x10); 705 pci_write_config_byte(dev, 0x4a, idecfg | 0x10);
@@ -712,11 +709,10 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c
712 if (trueid == 0x5517) { /* SiS 961/961B */ 709 if (trueid == 0x5517) { /* SiS 961/961B */
713 710
714 lpc_bridge = pci_get_slot(dev->bus, 0x10); /* Bus 0, Dev 2, Fn 0 */ 711 lpc_bridge = pci_get_slot(dev->bus, 0x10); /* Bus 0, Dev 2, Fn 0 */
715 pci_read_config_byte(lpc_bridge, PCI_REVISION_ID, &sbrev);
716 pci_read_config_byte(dev, 0x49, &prefctl); 712 pci_read_config_byte(dev, 0x49, &prefctl);
717 pci_dev_put(lpc_bridge); 713 pci_dev_put(lpc_bridge);
718 714
719 if (sbrev == 0x10 && (prefctl & 0x80)) { 715 if (lpc_bridge->revision == 0x10 && (prefctl & 0x80)) {
720 printk(KERN_INFO "SIS5513: SiS 961B MuTIOL IDE UDMA133 controller\n"); 716 printk(KERN_INFO "SIS5513: SiS 961B MuTIOL IDE UDMA133 controller\n");
721 chipset_family = ATA_133a; 717 chipset_family = ATA_133a;
722 } else { 718 } else {
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 487879842af4..a7323d278c49 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -338,7 +338,6 @@ static void sl82c105_tune_drive(ide_drive_t *drive, u8 pio)
338static unsigned int sl82c105_bridge_revision(struct pci_dev *dev) 338static unsigned int sl82c105_bridge_revision(struct pci_dev *dev)
339{ 339{
340 struct pci_dev *bridge; 340 struct pci_dev *bridge;
341 u8 rev;
342 341
343 /* 342 /*
344 * The bridge should be part of the same device, but function 0. 343 * The bridge should be part of the same device, but function 0.
@@ -360,10 +359,9 @@ static unsigned int sl82c105_bridge_revision(struct pci_dev *dev)
360 /* 359 /*
361 * We need to find function 0's revision, not function 1 360 * We need to find function 0's revision, not function 1
362 */ 361 */
363 pci_read_config_byte(bridge, PCI_REVISION_ID, &rev);
364 pci_dev_put(bridge); 362 pci_dev_put(bridge);
365 363
366 return rev; 364 return bridge->revision;
367} 365}
368 366
369/* 367/*
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index d21dd2e7eeb3..27e92fb9f95e 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -237,16 +237,14 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive)
237static struct via_isa_bridge *via_config_find(struct pci_dev **isa) 237static struct via_isa_bridge *via_config_find(struct pci_dev **isa)
238{ 238{
239 struct via_isa_bridge *via_config; 239 struct via_isa_bridge *via_config;
240 u8 t;
241 240
242 for (via_config = via_isa_bridges; via_config->id; via_config++) 241 for (via_config = via_isa_bridges; via_config->id; via_config++)
243 if ((*isa = pci_get_device(PCI_VENDOR_ID_VIA + 242 if ((*isa = pci_get_device(PCI_VENDOR_ID_VIA +
244 !!(via_config->flags & VIA_BAD_ID), 243 !!(via_config->flags & VIA_BAD_ID),
245 via_config->id, NULL))) { 244 via_config->id, NULL))) {
246 245
247 pci_read_config_byte(*isa, PCI_REVISION_ID, &t); 246 if ((*isa)->revision >= via_config->rev_min &&
248 if (t >= via_config->rev_min && 247 (*isa)->revision <= via_config->rev_max)
249 t <= via_config->rev_max)
250 break; 248 break;
251 pci_dev_put(*isa); 249 pci_dev_put(*isa);
252 } 250 }
@@ -404,10 +402,9 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const
404 * Print the boot message. 402 * Print the boot message.
405 */ 403 */
406 404
407 pci_read_config_byte(isa, PCI_REVISION_ID, &t);
408 printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s " 405 printk(KERN_INFO "VP_IDE: VIA %s (rev %02x) IDE %sDMA%s "
409 "controller on pci%s\n", 406 "controller on pci%s\n",
410 via_config->name, t, 407 via_config->name, isa->revision,
411 via_config->udma_mask ? "U" : "MW", 408 via_config->udma_mask ? "U" : "MW",
412 via_dma[via_config->udma_mask ? 409 via_dma[via_config->udma_mask ?
413 (fls(via_config->udma_mask) - 1) : 0], 410 (fls(via_config->udma_mask) - 1) : 0],
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index e3a223209710..834e86f6c04e 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -270,7 +270,6 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
270 struct ipath_devdata *dd; 270 struct ipath_devdata *dd;
271 unsigned long long addr; 271 unsigned long long addr;
272 u32 bar0 = 0, bar1 = 0; 272 u32 bar0 = 0, bar1 = 0;
273 u8 rev;
274 273
275 dd = ipath_alloc_devdata(pdev); 274 dd = ipath_alloc_devdata(pdev);
276 if (IS_ERR(dd)) { 275 if (IS_ERR(dd)) {
@@ -432,13 +431,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev,
432 dd->ipath_deviceid = ent->device; /* save for later use */ 431 dd->ipath_deviceid = ent->device; /* save for later use */
433 dd->ipath_vendorid = ent->vendor; 432 dd->ipath_vendorid = ent->vendor;
434 433
435 ret = pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); 434 dd->ipath_pcirev = pdev->revision;
436 if (ret) {
437 ipath_dev_err(dd, "Failed to read PCI revision ID unit "
438 "%u: err %d\n", dd->ipath_unit, -ret);
439 goto bail_regions; /* shouldn't ever happen */
440 }
441 dd->ipath_pcirev = rev;
442 435
443#if defined(__powerpc__) 436#if defined(__powerpc__)
444 /* There isn't a generic way to specify writethrough mappings */ 437 /* There isn't a generic way to specify writethrough mappings */
diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c
index 340310645346..6339bb443f62 100644
--- a/drivers/isdn/hisax/bkm_a8.c
+++ b/drivers/isdn/hisax/bkm_a8.c
@@ -287,7 +287,6 @@ setup_sct_quadro(struct IsdnCard *card)
287#ifdef CONFIG_PCI 287#ifdef CONFIG_PCI
288 struct IsdnCardState *cs = card->cs; 288 struct IsdnCardState *cs = card->cs;
289 char tmp[64]; 289 char tmp[64];
290 u_char pci_rev_id;
291 u_int found = 0; 290 u_int found = 0;
292 u_int pci_ioaddr1, pci_ioaddr2, pci_ioaddr3, pci_ioaddr4, pci_ioaddr5; 291 u_int pci_ioaddr1, pci_ioaddr2, pci_ioaddr3, pci_ioaddr4, pci_ioaddr5;
293 292
@@ -335,8 +334,7 @@ setup_sct_quadro(struct IsdnCard *card)
335 } 334 }
336#ifdef ATTEMPT_PCI_REMAPPING 335#ifdef ATTEMPT_PCI_REMAPPING
337/* HACK: PLX revision 1 bug: PLX address bit 7 must not be set */ 336/* HACK: PLX revision 1 bug: PLX address bit 7 must not be set */
338 pci_read_config_byte(dev_a8, PCI_REVISION_ID, &pci_rev_id); 337 if ((pci_ioaddr1 & 0x80) && (dev_a8->revision == 1)) {
339 if ((pci_ioaddr1 & 0x80) && (pci_rev_id == 1)) {
340 printk(KERN_WARNING "HiSax: %s (%s): PLX rev 1, remapping required!\n", 338 printk(KERN_WARNING "HiSax: %s (%s): PLX rev 1, remapping required!\n",
341 CardType[card->typ], 339 CardType[card->typ],
342 sct_quadro_subtypes[cs->subtyp]); 340 sct_quadro_subtypes[cs->subtyp]);
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
index fdf5d6e46eac..5e6f17df204b 100644
--- a/drivers/media/radio/radio-gemtek-pci.c
+++ b/drivers/media/radio/radio-gemtek-pci.c
@@ -94,7 +94,6 @@ struct gemtek_pci_card {
94 94
95 u32 iobase; 95 u32 iobase;
96 u32 length; 96 u32 length;
97 u8 chiprev;
98 u16 model; 97 u16 model;
99 98
100 u32 current_frequency; 99 u32 current_frequency;
@@ -415,7 +414,6 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
415 goto err_pci; 414 goto err_pci;
416 } 415 }
417 416
418 pci_read_config_byte( pci_dev, PCI_REVISION_ID, &card->chiprev );
419 pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model ); 417 pci_read_config_word( pci_dev, PCI_SUBSYSTEM_ID, &card->model );
420 418
421 pci_set_drvdata( pci_dev, card ); 419 pci_set_drvdata( pci_dev, card );
@@ -436,7 +434,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
436 gemtek_pci_mute( card ); 434 gemtek_pci_mute( card );
437 435
438 printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", 436 printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n",
439 card->chiprev, card->iobase, card->iobase + card->length - 1 ); 437 pci_dev->revision, card->iobase, card->iobase + card->length - 1 );
440 438
441 return 0; 439 return 0;
442 440
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 664aba8b4d85..7533fc203319 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -1809,7 +1809,6 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
1809{ 1809{
1810 int ret = -EBUSY; 1810 int ret = -EBUSY;
1811 unsigned long mchip_adr; 1811 unsigned long mchip_adr;
1812 u8 revision;
1813 1812
1814 if (meye.mchip_dev != NULL) { 1813 if (meye.mchip_dev != NULL) {
1815 printk(KERN_ERR "meye: only one device allowed!\n"); 1814 printk(KERN_ERR "meye: only one device allowed!\n");
@@ -1885,7 +1884,6 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
1885 goto outreqirq; 1884 goto outreqirq;
1886 } 1885 }
1887 1886
1888 pci_read_config_byte(meye.mchip_dev, PCI_REVISION_ID, &revision);
1889 pci_write_config_byte(meye.mchip_dev, PCI_CACHE_LINE_SIZE, 8); 1887 pci_write_config_byte(meye.mchip_dev, PCI_CACHE_LINE_SIZE, 8);
1890 pci_write_config_byte(meye.mchip_dev, PCI_LATENCY_TIMER, 64); 1888 pci_write_config_byte(meye.mchip_dev, PCI_LATENCY_TIMER, 64);
1891 1889
@@ -1939,7 +1937,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
1939 printk(KERN_INFO "meye: Motion Eye Camera Driver v%s.\n", 1937 printk(KERN_INFO "meye: Motion Eye Camera Driver v%s.\n",
1940 MEYE_DRIVER_VERSION); 1938 MEYE_DRIVER_VERSION);
1941 printk(KERN_INFO "meye: mchip KL5A72002 rev. %d, base %lx, irq %d\n", 1939 printk(KERN_INFO "meye: mchip KL5A72002 rev. %d, base %lx, irq %d\n",
1942 revision, mchip_adr, meye.mchip_irq); 1940 meye.mchip_dev->revision, mchip_adr, meye.mchip_irq);
1943 1941
1944 return 0; 1942 return 0;
1945 1943
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 58bbc3e6d0de..807e6992e614 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1799,7 +1799,6 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1799 void __iomem *regs; 1799 void __iomem *regs;
1800 resource_size_t pciaddr; 1800 resource_size_t pciaddr;
1801 unsigned int addr_len, i, pci_using_dac; 1801 unsigned int addr_len, i, pci_using_dac;
1802 u8 pci_rev;
1803 1802
1804#ifndef MODULE 1803#ifndef MODULE
1805 static int version_printed; 1804 static int version_printed;
@@ -1807,13 +1806,11 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1807 printk("%s", version); 1806 printk("%s", version);
1808#endif 1807#endif
1809 1808
1810 pci_read_config_byte(pdev, PCI_REVISION_ID, &pci_rev);
1811
1812 if (pdev->vendor == PCI_VENDOR_ID_REALTEK && 1809 if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
1813 pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev < 0x20) { 1810 pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision < 0x20) {
1814 dev_err(&pdev->dev, 1811 dev_err(&pdev->dev,
1815 "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip\n", 1812 "This (id %04x:%04x rev %02x) is not an 8139C+ compatible chip\n",
1816 pdev->vendor, pdev->device, pci_rev); 1813 pdev->vendor, pdev->device, pdev->revision);
1817 dev_err(&pdev->dev, "Try the \"8139too\" driver instead.\n"); 1814 dev_err(&pdev->dev, "Try the \"8139too\" driver instead.\n");
1818 return -ENODEV; 1815 return -ENODEV;
1819 } 1816 }
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 21a6ccbf92e0..327eaa7b4999 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -931,7 +931,6 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
931 int i, addr_len, option; 931 int i, addr_len, option;
932 void __iomem *ioaddr; 932 void __iomem *ioaddr;
933 static int board_idx = -1; 933 static int board_idx = -1;
934 u8 pci_rev;
935 934
936 assert (pdev != NULL); 935 assert (pdev != NULL);
937 assert (ent != NULL); 936 assert (ent != NULL);
@@ -949,13 +948,11 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
949 } 948 }
950#endif 949#endif
951 950
952 pci_read_config_byte(pdev, PCI_REVISION_ID, &pci_rev);
953
954 if (pdev->vendor == PCI_VENDOR_ID_REALTEK && 951 if (pdev->vendor == PCI_VENDOR_ID_REALTEK &&
955 pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pci_rev >= 0x20) { 952 pdev->device == PCI_DEVICE_ID_REALTEK_8139 && pdev->revision >= 0x20) {
956 dev_info(&pdev->dev, 953 dev_info(&pdev->dev,
957 "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n", 954 "This (id %04x:%04x rev %02x) is an enhanced 8139C+ chip\n",
958 pdev->vendor, pdev->device, pci_rev); 955 pdev->vendor, pdev->device, pdev->revision);
959 dev_info(&pdev->dev, 956 dev_info(&pdev->dev,
960 "Use the \"8139cp\" driver for improved performance and stability.\n"); 957 "Use the \"8139cp\" driver for improved performance and stability.\n");
961 } 958 }
diff --git a/drivers/net/atl1/atl1.h b/drivers/net/atl1/atl1.h
index b1c6034e68fa..df4c1a0071aa 100644
--- a/drivers/net/atl1/atl1.h
+++ b/drivers/net/atl1/atl1.h
@@ -210,7 +210,6 @@ struct atl1_hw {
210 u16 phy_spd_default; 210 u16 phy_spd_default;
211 211
212 u16 dev_rev; 212 u16 dev_rev;
213 u8 revision_id;
214 213
215 /* spi flash */ 214 /* spi flash */
216 u8 flash_vendor; 215 u8 flash_vendor;
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 3bb40dd4a410..501919eb7f5e 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -118,10 +118,6 @@ static int __devinit atl1_sw_init(struct atl1_adapter *adapter)
118{ 118{
119 struct atl1_hw *hw = &adapter->hw; 119 struct atl1_hw *hw = &adapter->hw;
120 struct net_device *netdev = adapter->netdev; 120 struct net_device *netdev = adapter->netdev;
121 struct pci_dev *pdev = adapter->pdev;
122
123 /* PCI config space info */
124 pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
125 121
126 hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE; 122 hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
127 hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE; 123 hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index d681903c592d..02e994b1b028 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6736,10 +6736,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6736 while ((amd_8132 = pci_get_device(PCI_VENDOR_ID_AMD, 6736 while ((amd_8132 = pci_get_device(PCI_VENDOR_ID_AMD,
6737 PCI_DEVICE_ID_AMD_8132_BRIDGE, 6737 PCI_DEVICE_ID_AMD_8132_BRIDGE,
6738 amd_8132))) { 6738 amd_8132))) {
6739 u8 rev;
6740 6739
6741 pci_read_config_byte(amd_8132, PCI_REVISION_ID, &rev); 6740 if (amd_8132->revision >= 0x10 &&
6742 if (rev >= 0x10 && rev <= 0x13) { 6741 amd_8132->revision <= 0x13) {
6743 disable_msi = 1; 6742 disable_msi = 1;
6744 pci_dev_put(amd_8132); 6743 pci_dev_put(amd_8132);
6745 break; 6744 break;
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 59b9943b077d..f6e4030c73d1 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -3422,21 +3422,19 @@ done:
3422static void cas_check_pci_invariants(struct cas *cp) 3422static void cas_check_pci_invariants(struct cas *cp)
3423{ 3423{
3424 struct pci_dev *pdev = cp->pdev; 3424 struct pci_dev *pdev = cp->pdev;
3425 u8 rev;
3426 3425
3427 cp->cas_flags = 0; 3426 cp->cas_flags = 0;
3428 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
3429 if ((pdev->vendor == PCI_VENDOR_ID_SUN) && 3427 if ((pdev->vendor == PCI_VENDOR_ID_SUN) &&
3430 (pdev->device == PCI_DEVICE_ID_SUN_CASSINI)) { 3428 (pdev->device == PCI_DEVICE_ID_SUN_CASSINI)) {
3431 if (rev >= CAS_ID_REVPLUS) 3429 if (pdev->revision >= CAS_ID_REVPLUS)
3432 cp->cas_flags |= CAS_FLAG_REG_PLUS; 3430 cp->cas_flags |= CAS_FLAG_REG_PLUS;
3433 if (rev < CAS_ID_REVPLUS02u) 3431 if (pdev->revision < CAS_ID_REVPLUS02u)
3434 cp->cas_flags |= CAS_FLAG_TARGET_ABORT; 3432 cp->cas_flags |= CAS_FLAG_TARGET_ABORT;
3435 3433
3436 /* Original Cassini supports HW CSUM, but it's not 3434 /* Original Cassini supports HW CSUM, but it's not
3437 * enabled by default as it can trigger TX hangs. 3435 * enabled by default as it can trigger TX hangs.
3438 */ 3436 */
3439 if (rev < CAS_ID_REV2) 3437 if (pdev->revision < CAS_ID_REV2)
3440 cp->cas_flags |= CAS_FLAG_NO_HW_CSUM; 3438 cp->cas_flags |= CAS_FLAG_NO_HW_CSUM;
3441 } else { 3439 } else {
3442 /* Only sun has original cassini chips. */ 3440 /* Only sun has original cassini chips. */
@@ -4919,13 +4917,13 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
4919 pci_cmd &= ~PCI_COMMAND_SERR; 4917 pci_cmd &= ~PCI_COMMAND_SERR;
4920 pci_cmd |= PCI_COMMAND_PARITY; 4918 pci_cmd |= PCI_COMMAND_PARITY;
4921 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); 4919 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
4922 if (pci_set_mwi(pdev)) 4920 if (pci_try_set_mwi(pdev))
4923 printk(KERN_WARNING PFX "Could not enable MWI for %s\n", 4921 printk(KERN_WARNING PFX "Could not enable MWI for %s\n",
4924 pci_name(pdev)); 4922 pci_name(pdev));
4925 4923
4926 /* 4924 /*
4927 * On some architectures, the default cache line size set 4925 * On some architectures, the default cache line size set
4928 * by pci_set_mwi reduces perforamnce. We have to increase 4926 * by pci_try_set_mwi reduces perforamnce. We have to increase
4929 * it for this case. To start, we'll print some configuration 4927 * it for this case. To start, we'll print some configuration
4930 * data. 4928 * data.
4931 */ 4929 */
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index a4ace071f1cb..04e3710c9082 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -250,7 +250,6 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
250 np->an_enable = 1; 250 np->an_enable = 1;
251 mii_set_media (dev); 251 mii_set_media (dev);
252 } 252 }
253 pci_read_config_byte(pdev, PCI_REVISION_ID, &np->pci_rev_id);
254 253
255 err = register_netdev (dev); 254 err = register_netdev (dev);
256 if (err) 255 if (err)
@@ -879,7 +878,7 @@ receive_packet (struct net_device *dev)
879 skb->protocol = eth_type_trans (skb, dev); 878 skb->protocol = eth_type_trans (skb, dev);
880#if 0 879#if 0
881 /* Checksum done by hw, but csum value unavailable. */ 880 /* Checksum done by hw, but csum value unavailable. */
882 if (np->pci_rev_id >= 0x0c && 881 if (np->pdev->pci_rev_id >= 0x0c &&
883 !(frame_status & (TCPError | UDPError | IPError))) { 882 !(frame_status & (TCPError | UDPError | IPError))) {
884 skb->ip_summed = CHECKSUM_UNNECESSARY; 883 skb->ip_summed = CHECKSUM_UNNECESSARY;
885 } 884 }
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index 814c449c359f..e443065a452e 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -668,7 +668,6 @@ struct netdev_private {
668 unsigned int rx_flow:1; /* Rx flow control enable */ 668 unsigned int rx_flow:1; /* Rx flow control enable */
669 unsigned int phy_media:1; /* 1: fiber, 0: copper */ 669 unsigned int phy_media:1; /* 1: fiber, 0: copper */
670 unsigned int link_status:1; /* Current link status */ 670 unsigned int link_status:1; /* Current link status */
671 unsigned char pci_rev_id; /* PCI revision ID */
672 struct netdev_desc *last_tx; /* Last Tx descriptor used. */ 671 struct netdev_desc *last_tx; /* Last Tx descriptor used. */
673 unsigned long cur_rx, old_rx; /* Producer/consumer ring indices */ 672 unsigned long cur_rx, old_rx; /* Producer/consumer ring indices */
674 unsigned long cur_tx, old_tx; 673 unsigned long cur_tx, old_tx;
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 74ea6373c7cd..6b6401e9304e 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -583,7 +583,6 @@ struct nic {
583 u32 rx_tco_frames; 583 u32 rx_tco_frames;
584 u32 rx_over_length_errors; 584 u32 rx_over_length_errors;
585 585
586 u8 rev_id;
587 u16 leds; 586 u16 leds;
588 u16 eeprom_wc; 587 u16 eeprom_wc;
589 u16 eeprom[256]; 588 u16 eeprom[256];
@@ -937,9 +936,8 @@ static void e100_get_defaults(struct nic *nic)
937 struct param_range rfds = { .min = 16, .max = 256, .count = 256 }; 936 struct param_range rfds = { .min = 16, .max = 256, .count = 256 };
938 struct param_range cbs = { .min = 64, .max = 256, .count = 128 }; 937 struct param_range cbs = { .min = 64, .max = 256, .count = 128 };
939 938
940 pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id);
941 /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ 939 /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */
942 nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->rev_id; 940 nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->pdev->revision;
943 if(nic->mac == mac_unknown) 941 if(nic->mac == mac_unknown)
944 nic->mac = mac_82557_D100_A; 942 nic->mac = mac_82557_D100_A;
945 943
@@ -1279,7 +1277,7 @@ static void e100_setup_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb
1279 if (nic->flags & ich) 1277 if (nic->flags & ich)
1280 goto noloaducode; 1278 goto noloaducode;
1281 1279
1282 /* Search for ucode match against h/w rev_id */ 1280 /* Search for ucode match against h/w revision */
1283 for (opts = ucode_opts; opts->mac; opts++) { 1281 for (opts = ucode_opts; opts->mac; opts++) {
1284 int i; 1282 int i;
1285 u32 *ucode = opts->ucode; 1283 u32 *ucode = opts->ucode;
@@ -2238,7 +2236,7 @@ static void e100_get_regs(struct net_device *netdev,
2238 u32 *buff = p; 2236 u32 *buff = p;
2239 int i; 2237 int i;
2240 2238
2241 regs->version = (1 << 24) | nic->rev_id; 2239 regs->version = (1 << 24) | nic->pdev->revision;
2242 buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 | 2240 buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 |
2243 ioread8(&nic->csr->scb.cmd_lo) << 16 | 2241 ioread8(&nic->csr->scb.cmd_lo) << 16 |
2244 ioread16(&nic->csr->scb.status); 2242 ioread16(&nic->csr->scb.status);
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index cf8af928a69c..f48b659e0c2b 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1266,8 +1266,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
1266 hw->device_id = pdev->device; 1266 hw->device_id = pdev->device;
1267 hw->subsystem_vendor_id = pdev->subsystem_vendor; 1267 hw->subsystem_vendor_id = pdev->subsystem_vendor;
1268 hw->subsystem_id = pdev->subsystem_device; 1268 hw->subsystem_id = pdev->subsystem_device;
1269 1269 hw->revision_id = pdev->revision;
1270 pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
1271 1270
1272 pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word); 1271 pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
1273 1272
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 42ba1c012ee2..67046e8c21eb 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5084,15 +5084,13 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5084 np->wolenabled = 0; 5084 np->wolenabled = 0;
5085 5085
5086 if (id->driver_data & DEV_HAS_POWER_CNTRL) { 5086 if (id->driver_data & DEV_HAS_POWER_CNTRL) {
5087 u8 revision_id;
5088 pci_read_config_byte(pci_dev, PCI_REVISION_ID, &revision_id);
5089 5087
5090 /* take phy and nic out of low power mode */ 5088 /* take phy and nic out of low power mode */
5091 powerstate = readl(base + NvRegPowerState2); 5089 powerstate = readl(base + NvRegPowerState2);
5092 powerstate &= ~NVREG_POWERSTATE2_POWERUP_MASK; 5090 powerstate &= ~NVREG_POWERSTATE2_POWERUP_MASK;
5093 if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 || 5091 if ((id->device == PCI_DEVICE_ID_NVIDIA_NVENET_12 ||
5094 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_13) && 5092 id->device == PCI_DEVICE_ID_NVIDIA_NVENET_13) &&
5095 revision_id >= 0xA3) 5093 pci_dev->revision >= 0xA3)
5096 powerstate |= NVREG_POWERSTATE2_POWERUP_REV_A3; 5094 powerstate |= NVREG_POWERSTATE2_POWERUP_REV_A3;
5097 writel(powerstate, base + NvRegPowerState2); 5095 writel(powerstate, base + NvRegPowerState2);
5098 } 5096 }
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 56f8197b953b..b703ccfe040b 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -54,8 +54,6 @@ static char netxen_nic_driver_string[] = "NetXen Network Driver version "
54#define NETXEN_ADAPTER_UP_MAGIC 777 54#define NETXEN_ADAPTER_UP_MAGIC 777
55#define NETXEN_NIC_PEG_TUNE 0 55#define NETXEN_NIC_PEG_TUNE 0
56 56
57u8 nx_p2_id = NX_P2_C0;
58
59#define DMA_32BIT_MASK 0x00000000ffffffffULL 57#define DMA_32BIT_MASK 0x00000000ffffffffULL
60#define DMA_35BIT_MASK 0x00000007ffffffffULL 58#define DMA_35BIT_MASK 0x00000007ffffffffULL
61 59
@@ -307,8 +305,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
307 goto err_out_disable_pdev; 305 goto err_out_disable_pdev;
308 306
309 pci_set_master(pdev); 307 pci_set_master(pdev);
310 pci_read_config_byte(pdev, PCI_REVISION_ID, &nx_p2_id); 308 if (pdev->revision == NX_P2_C1 &&
311 if (nx_p2_id == NX_P2_C1 &&
312 (pci_set_dma_mask(pdev, DMA_35BIT_MASK) == 0) && 309 (pci_set_dma_mask(pdev, DMA_35BIT_MASK) == 0) &&
313 (pci_set_consistent_dma_mask(pdev, DMA_35BIT_MASK) == 0)) { 310 (pci_set_consistent_dma_mask(pdev, DMA_35BIT_MASK) == 0)) {
314 pci_using_dac = 1; 311 pci_using_dac = 1;
@@ -552,7 +549,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
552 INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); 549 INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task);
553 adapter->ahw.pdev = pdev; 550 adapter->ahw.pdev = pdev;
554 adapter->proc_cmd_buf_counter = 0; 551 adapter->proc_cmd_buf_counter = 0;
555 adapter->ahw.revision_id = nx_p2_id; 552 adapter->ahw.revision_id = pdev->revision;
556 553
557 /* make sure Window == 1 */ 554 /* make sure Window == 1 */
558 netxen_nic_pci_change_crbwindow(adapter, 1); 555 netxen_nic_pci_change_crbwindow(adapter, 1);
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index fa29a403a247..58bbfdd4f901 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -1135,7 +1135,7 @@ static int init_nic(struct s2io_nic *nic)
1135 * SXE-008 TRANSMIT DMA ARBITRATION ISSUE. 1135 * SXE-008 TRANSMIT DMA ARBITRATION ISSUE.
1136 */ 1136 */
1137 if ((nic->device_type == XFRAME_I_DEVICE) && 1137 if ((nic->device_type == XFRAME_I_DEVICE) &&
1138 (get_xena_rev_id(nic->pdev) < 4)) 1138 (nic->pdev->revision < 4))
1139 writeq(PCC_ENABLE_FOUR, &bar0->pcc_enable); 1139 writeq(PCC_ENABLE_FOUR, &bar0->pcc_enable);
1140 1140
1141 val64 = readq(&bar0->tx_fifo_partition_0); 1141 val64 = readq(&bar0->tx_fifo_partition_0);
@@ -1873,7 +1873,7 @@ static int verify_pcc_quiescent(struct s2io_nic *sp, int flag)
1873 herc = (sp->device_type == XFRAME_II_DEVICE); 1873 herc = (sp->device_type == XFRAME_II_DEVICE);
1874 1874
1875 if (flag == FALSE) { 1875 if (flag == FALSE) {
1876 if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) { 1876 if ((!herc && (sp->pdev->revision >= 4)) || herc) {
1877 if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE)) 1877 if (!(val64 & ADAPTER_STATUS_RMAC_PCC_IDLE))
1878 ret = 1; 1878 ret = 1;
1879 } else { 1879 } else {
@@ -1881,7 +1881,7 @@ static int verify_pcc_quiescent(struct s2io_nic *sp, int flag)
1881 ret = 1; 1881 ret = 1;
1882 } 1882 }
1883 } else { 1883 } else {
1884 if ((!herc && (get_xena_rev_id(sp->pdev) >= 4)) || herc) { 1884 if ((!herc && (sp->pdev->revision >= 4)) || herc) {
1885 if (((val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) == 1885 if (((val64 & ADAPTER_STATUS_RMAC_PCC_IDLE) ==
1886 ADAPTER_STATUS_RMAC_PCC_IDLE)) 1886 ADAPTER_STATUS_RMAC_PCC_IDLE))
1887 ret = 1; 1887 ret = 1;
@@ -7076,23 +7076,6 @@ static void s2io_link(struct s2io_nic * sp, int link)
7076} 7076}
7077 7077
7078/** 7078/**
7079 * get_xena_rev_id - to identify revision ID of xena.
7080 * @pdev : PCI Dev structure
7081 * Description:
7082 * Function to identify the Revision ID of xena.
7083 * Return value:
7084 * returns the revision ID of the device.
7085 */
7086
7087static int get_xena_rev_id(struct pci_dev *pdev)
7088{
7089 u8 id = 0;
7090 int ret;
7091 ret = pci_read_config_byte(pdev, PCI_REVISION_ID, (u8 *) & id);
7092 return id;
7093}
7094
7095/**
7096 * s2io_init_pci -Initialization of PCI and PCI-X configuration registers . 7079 * s2io_init_pci -Initialization of PCI and PCI-X configuration registers .
7097 * @sp : private member of the device structure, which is a pointer to the 7080 * @sp : private member of the device structure, which is a pointer to the
7098 * s2io_nic structure. 7081 * s2io_nic structure.
@@ -7550,7 +7533,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7550 s2io_vpd_read(sp); 7533 s2io_vpd_read(sp);
7551 DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2007 Neterion Inc.\n"); 7534 DBG_PRINT(ERR_DBG, "Copyright(c) 2002-2007 Neterion Inc.\n");
7552 DBG_PRINT(ERR_DBG, "%s: Neterion %s (rev %d)\n",dev->name, 7535 DBG_PRINT(ERR_DBG, "%s: Neterion %s (rev %d)\n",dev->name,
7553 sp->product_name, get_xena_rev_id(sp->pdev)); 7536 sp->product_name, pdev->revision);
7554 DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name, 7537 DBG_PRINT(ERR_DBG, "%s: Driver version %s\n", dev->name,
7555 s2io_driver_version); 7538 s2io_driver_version);
7556 DBG_PRINT(ERR_DBG, "%s: MAC ADDR: " 7539 DBG_PRINT(ERR_DBG, "%s: MAC ADDR: "
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 58592780f519..3887fe63a908 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -1033,7 +1033,6 @@ static void s2io_set_link(struct work_struct *work);
1033static int s2io_set_swapper(struct s2io_nic * sp); 1033static int s2io_set_swapper(struct s2io_nic * sp);
1034static void s2io_card_down(struct s2io_nic *nic); 1034static void s2io_card_down(struct s2io_nic *nic);
1035static int s2io_card_up(struct s2io_nic *nic); 1035static int s2io_card_up(struct s2io_nic *nic);
1036static int get_xena_rev_id(struct pci_dev *pdev);
1037static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit, 1036static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
1038 int bit_state); 1037 int bit_state);
1039static int s2io_add_isr(struct s2io_nic * sp); 1038static int s2io_add_isr(struct s2io_nic * sp);
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index f2e101967204..8b6478663a56 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -740,7 +740,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
740 pci_set_master(pdev); 740 pci_set_master(pdev);
741 741
742 /* enable MWI -- it vastly improves Rx performance on sparc64 */ 742 /* enable MWI -- it vastly improves Rx performance on sparc64 */
743 pci_set_mwi(pdev); 743 pci_try_set_mwi(pdev);
744 744
745#ifdef ZEROCOPY 745#ifdef ZEROCOPY
746 /* Starfire can do TCP/UDP checksumming */ 746 /* Starfire can do TCP/UDP checksumming */
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index c8ba534c17bf..af0c9831074c 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -397,7 +397,6 @@ struct netdev_private {
397 unsigned char phys[MII_CNT]; /* MII device addresses, only first one used. */ 397 unsigned char phys[MII_CNT]; /* MII device addresses, only first one used. */
398 struct pci_dev *pci_dev; 398 struct pci_dev *pci_dev;
399 void __iomem *base; 399 void __iomem *base;
400 unsigned char pci_rev_id;
401}; 400};
402 401
403/* The station address location in the EEPROM. */ 402/* The station address location in the EEPROM. */
@@ -544,8 +543,6 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
544 dev->change_mtu = &change_mtu; 543 dev->change_mtu = &change_mtu;
545 pci_set_drvdata(pdev, dev); 544 pci_set_drvdata(pdev, dev);
546 545
547 pci_read_config_byte(pdev, PCI_REVISION_ID, &np->pci_rev_id);
548
549 i = register_netdev(dev); 546 i = register_netdev(dev);
550 if (i) 547 if (i)
551 goto err_out_unmap_rx; 548 goto err_out_unmap_rx;
@@ -828,7 +825,7 @@ static int netdev_open(struct net_device *dev)
828 iowrite8(100, ioaddr + RxDMAPollPeriod); 825 iowrite8(100, ioaddr + RxDMAPollPeriod);
829 iowrite8(127, ioaddr + TxDMAPollPeriod); 826 iowrite8(127, ioaddr + TxDMAPollPeriod);
830 /* Fix DFE-580TX packet drop issue */ 827 /* Fix DFE-580TX packet drop issue */
831 if (np->pci_rev_id >= 0x14) 828 if (np->pci_dev->revision >= 0x14)
832 iowrite8(0x01, ioaddr + DebugCtrl1); 829 iowrite8(0x01, ioaddr + DebugCtrl1);
833 netif_start_queue(dev); 830 netif_start_queue(dev);
834 831
@@ -1194,7 +1191,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1194 hw_frame_id = ioread8(ioaddr + TxFrameId); 1191 hw_frame_id = ioread8(ioaddr + TxFrameId);
1195 } 1192 }
1196 1193
1197 if (np->pci_rev_id >= 0x14) { 1194 if (np->pci_dev->revision >= 0x14) {
1198 spin_lock(&np->lock); 1195 spin_lock(&np->lock);
1199 for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) { 1196 for (; np->cur_tx - np->dirty_tx > 0; np->dirty_tx++) {
1200 int entry = np->dirty_tx % TX_RING_SIZE; 1197 int entry = np->dirty_tx % TX_RING_SIZE;
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 15146a119230..8b35f13318ea 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -3095,12 +3095,8 @@ static int __devinit happy_meal_pci_probe(struct pci_dev *pdev,
3095 3095
3096#ifdef CONFIG_SPARC 3096#ifdef CONFIG_SPARC
3097 hp->hm_revision = of_getintprop_default(dp, "hm-rev", 0xff); 3097 hp->hm_revision = of_getintprop_default(dp, "hm-rev", 0xff);
3098 if (hp->hm_revision == 0xff) { 3098 if (hp->hm_revision == 0xff)
3099 unsigned char prev; 3099 hp->hm_revision = 0xc0 | (pdev->revision & 0x0f);
3100
3101 pci_read_config_byte(pdev, PCI_REVISION_ID, &prev);
3102 hp->hm_revision = 0xc0 | (prev & 0x0f);
3103 }
3104#else 3100#else
3105 /* works with this on non-sparc hosts */ 3101 /* works with this on non-sparc hosts */
3106 hp->hm_revision = 0x20; 3102 hp->hm_revision = 0x20;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 3245f16baabc..32e4037dcb50 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -10551,11 +10551,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10551 continue; 10551 continue;
10552 } 10552 }
10553 if (pci_id->rev != PCI_ANY_ID) { 10553 if (pci_id->rev != PCI_ANY_ID) {
10554 u8 rev; 10554 if (bridge->revision > pci_id->rev)
10555
10556 pci_read_config_byte(bridge, PCI_REVISION_ID,
10557 &rev);
10558 if (rev > pci_id->rev)
10559 continue; 10555 continue;
10560 } 10556 }
10561 if (bridge->subordinate && 10557 if (bridge->subordinate &&
diff --git a/drivers/net/tlan.c b/drivers/net/tlan.c
index 106dc1ef0acb..74eb12107e68 100644
--- a/drivers/net/tlan.c
+++ b/drivers/net/tlan.c
@@ -533,7 +533,6 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
533 533
534 struct net_device *dev; 534 struct net_device *dev;
535 TLanPrivateInfo *priv; 535 TLanPrivateInfo *priv;
536 u8 pci_rev;
537 u16 device_id; 536 u16 device_id;
538 int reg, rc = -ENODEV; 537 int reg, rc = -ENODEV;
539 538
@@ -577,8 +576,6 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
577 goto err_out_free_dev; 576 goto err_out_free_dev;
578 } 577 }
579 578
580 pci_read_config_byte ( pdev, PCI_REVISION_ID, &pci_rev);
581
582 for ( reg= 0; reg <= 5; reg ++ ) { 579 for ( reg= 0; reg <= 5; reg ++ ) {
583 if (pci_resource_flags(pdev, reg) & IORESOURCE_IO) { 580 if (pci_resource_flags(pdev, reg) & IORESOURCE_IO) {
584 pci_io_base = pci_resource_start(pdev, reg); 581 pci_io_base = pci_resource_start(pdev, reg);
@@ -595,7 +592,7 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
595 592
596 dev->base_addr = pci_io_base; 593 dev->base_addr = pci_io_base;
597 dev->irq = pdev->irq; 594 dev->irq = pdev->irq;
598 priv->adapterRev = pci_rev; 595 priv->adapterRev = pdev->revision;
599 pci_set_master(pdev); 596 pci_set_master(pdev);
600 pci_set_drvdata(pdev, dev); 597 pci_set_drvdata(pdev, dev);
601 598
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 42fca26afc50..09902891a6e6 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -2134,7 +2134,7 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2134 u_short vendor, status; 2134 u_short vendor, status;
2135 u_int irq = 0, device; 2135 u_int irq = 0, device;
2136 u_long iobase = 0; /* Clear upper 32 bits in Alphas */ 2136 u_long iobase = 0; /* Clear upper 32 bits in Alphas */
2137 int i, j, cfrv; 2137 int i, j;
2138 struct de4x5_private *lp = netdev_priv(dev); 2138 struct de4x5_private *lp = netdev_priv(dev);
2139 struct list_head *walk; 2139 struct list_head *walk;
2140 2140
@@ -2150,7 +2150,6 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2150 2150
2151 /* Get the chip configuration revision register */ 2151 /* Get the chip configuration revision register */
2152 pb = this_dev->bus->number; 2152 pb = this_dev->bus->number;
2153 pci_read_config_dword(this_dev, PCI_REVISION_ID, &cfrv);
2154 2153
2155 /* Set the device number information */ 2154 /* Set the device number information */
2156 lp->device = PCI_SLOT(this_dev->devfn); 2155 lp->device = PCI_SLOT(this_dev->devfn);
@@ -2158,7 +2157,8 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2158 2157
2159 /* Set the chipset information */ 2158 /* Set the chipset information */
2160 if (is_DC2114x) { 2159 if (is_DC2114x) {
2161 device = ((cfrv & CFRV_RN) < DC2114x_BRK ? DC21142 : DC21143); 2160 device = ((this_dev->revision & CFRV_RN) < DC2114x_BRK
2161 ? DC21142 : DC21143);
2162 } 2162 }
2163 lp->chipset = device; 2163 lp->chipset = device;
2164 2164
@@ -2254,7 +2254,7 @@ static int __devinit de4x5_pci_probe (struct pci_dev *pdev,
2254 } 2254 }
2255 2255
2256 /* Get the chip configuration revision register */ 2256 /* Get the chip configuration revision register */
2257 pci_read_config_dword(pdev, PCI_REVISION_ID, &lp->cfrv); 2257 lp->cfrv = pdev->revision;
2258 2258
2259 /* Set the device number information */ 2259 /* Set the device number information */
2260 lp->device = dev_num; 2260 lp->device = dev_num;
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
index 4ed67ff0e81e..dab74feb44bc 100644
--- a/drivers/net/tulip/dmfe.c
+++ b/drivers/net/tulip/dmfe.c
@@ -181,11 +181,12 @@
181 udelay(5); 181 udelay(5);
182 182
183#define __CHK_IO_SIZE(pci_id, dev_rev) \ 183#define __CHK_IO_SIZE(pci_id, dev_rev) \
184 (( ((pci_id)==PCI_DM9132_ID) || ((dev_rev) >= 0x02000030) ) ? \ 184 (( ((pci_id)==PCI_DM9132_ID) || ((dev_rev) >= 0x30) ) ? \
185 DM9102A_IO_SIZE: DM9102_IO_SIZE) 185 DM9102A_IO_SIZE: DM9102_IO_SIZE)
186 186
187#define CHK_IO_SIZE(pci_dev, dev_rev) \ 187#define CHK_IO_SIZE(pci_dev) \
188 (__CHK_IO_SIZE(((pci_dev)->device << 16) | (pci_dev)->vendor, dev_rev)) 188 (__CHK_IO_SIZE(((pci_dev)->device << 16) | (pci_dev)->vendor, \
189 (pci_dev)->revision))
189 190
190/* Sten Check */ 191/* Sten Check */
191#define DEVICE net_device 192#define DEVICE net_device
@@ -205,7 +206,7 @@ struct rx_desc {
205 206
206struct dmfe_board_info { 207struct dmfe_board_info {
207 u32 chip_id; /* Chip vendor/Device ID */ 208 u32 chip_id; /* Chip vendor/Device ID */
208 u32 chip_revision; /* Chip revision */ 209 u8 chip_revision; /* Chip revision */
209 struct DEVICE *next_dev; /* next device */ 210 struct DEVICE *next_dev; /* next device */
210 struct pci_dev *pdev; /* PCI device */ 211 struct pci_dev *pdev; /* PCI device */
211 spinlock_t lock; 212 spinlock_t lock;
@@ -359,7 +360,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
359{ 360{
360 struct dmfe_board_info *db; /* board information structure */ 361 struct dmfe_board_info *db; /* board information structure */
361 struct net_device *dev; 362 struct net_device *dev;
362 u32 dev_rev, pci_pmr; 363 u32 pci_pmr;
363 int i, err; 364 int i, err;
364 365
365 DMFE_DBUG(0, "dmfe_init_one()", 0); 366 DMFE_DBUG(0, "dmfe_init_one()", 0);
@@ -392,10 +393,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
392 goto err_out_disable; 393 goto err_out_disable;
393 } 394 }
394 395
395 /* Read Chip revision */ 396 if (pci_resource_len(pdev, 0) < (CHK_IO_SIZE(pdev)) ) {
396 pci_read_config_dword(pdev, PCI_REVISION_ID, &dev_rev);
397
398 if (pci_resource_len(pdev, 0) < (CHK_IO_SIZE(pdev, dev_rev)) ) {
399 printk(KERN_ERR DRV_NAME ": Allocated I/O size too small\n"); 397 printk(KERN_ERR DRV_NAME ": Allocated I/O size too small\n");
400 err = -ENODEV; 398 err = -ENODEV;
401 goto err_out_disable; 399 goto err_out_disable;
@@ -433,7 +431,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
433 431
434 db->chip_id = ent->driver_data; 432 db->chip_id = ent->driver_data;
435 db->ioaddr = pci_resource_start(pdev, 0); 433 db->ioaddr = pci_resource_start(pdev, 0);
436 db->chip_revision = dev_rev; 434 db->chip_revision = pdev->revision;
437 db->wol_mode = 0; 435 db->wol_mode = 0;
438 436
439 db->pdev = pdev; 437 db->pdev = pdev;
@@ -455,7 +453,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev,
455 453
456 pci_read_config_dword(pdev, 0x50, &pci_pmr); 454 pci_read_config_dword(pdev, 0x50, &pci_pmr);
457 pci_pmr &= 0x70000; 455 pci_pmr &= 0x70000;
458 if ( (pci_pmr == 0x10000) && (dev_rev == 0x02000031) ) 456 if ( (pci_pmr == 0x10000) && (db->chip_revision == 0x31) )
459 db->chip_type = 1; /* DM9102A E3 */ 457 db->chip_type = 1; /* DM9102A E3 */
460 else 458 else
461 db->chip_type = 0; 459 db->chip_type = 0;
@@ -553,7 +551,7 @@ static int dmfe_open(struct DEVICE *dev)
553 551
554 /* CR6 operation mode decision */ 552 /* CR6 operation mode decision */
555 if ( !chkmode || (db->chip_id == PCI_DM9132_ID) || 553 if ( !chkmode || (db->chip_id == PCI_DM9132_ID) ||
556 (db->chip_revision >= 0x02000030) ) { 554 (db->chip_revision >= 0x30) ) {
557 db->cr6_data |= DMFE_TXTH_256; 555 db->cr6_data |= DMFE_TXTH_256;
558 db->cr0_data = CR0_DEFAULT; 556 db->cr0_data = CR0_DEFAULT;
559 db->dm910x_chk_mode=4; /* Enter the normal mode */ 557 db->dm910x_chk_mode=4; /* Enter the normal mode */
@@ -1199,9 +1197,9 @@ static void dmfe_timer(unsigned long data)
1199 tmp_cr12 = inb(db->ioaddr + DCR12); /* DM9102/DM9102A */ 1197 tmp_cr12 = inb(db->ioaddr + DCR12); /* DM9102/DM9102A */
1200 1198
1201 if ( ((db->chip_id == PCI_DM9102_ID) && 1199 if ( ((db->chip_id == PCI_DM9102_ID) &&
1202 (db->chip_revision == 0x02000030)) || 1200 (db->chip_revision == 0x30)) ||
1203 ((db->chip_id == PCI_DM9132_ID) && 1201 ((db->chip_id == PCI_DM9132_ID) &&
1204 (db->chip_revision == 0x02000010)) ) { 1202 (db->chip_revision == 0x10)) ) {
1205 /* DM9102A Chip */ 1203 /* DM9102A Chip */
1206 if (tmp_cr12 & 2) 1204 if (tmp_cr12 & 2)
1207 link_ok = 0; 1205 link_ok = 0;
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 041af63f2811..7dcd138b0fed 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -1155,7 +1155,7 @@ static void __devinit tulip_mwi_config (struct pci_dev *pdev,
1155 /* set or disable MWI in the standard PCI command bit. 1155 /* set or disable MWI in the standard PCI command bit.
1156 * Check for the case where mwi is desired but not available 1156 * Check for the case where mwi is desired but not available
1157 */ 1157 */
1158 if (csr0 & MWI) pci_set_mwi(pdev); 1158 if (csr0 & MWI) pci_try_set_mwi(pdev);
1159 else pci_clear_mwi(pdev); 1159 else pci_clear_mwi(pdev);
1160 1160
1161 /* read result from hardware (in case bit refused to enable) */ 1161 /* read result from hardware (in case bit refused to enable) */
@@ -1238,7 +1238,6 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1238 }; 1238 };
1239 static int last_irq; 1239 static int last_irq;
1240 static int multiport_cnt; /* For four-port boards w/one EEPROM */ 1240 static int multiport_cnt; /* For four-port boards w/one EEPROM */
1241 u8 chip_rev;
1242 int i, irq; 1241 int i, irq;
1243 unsigned short sum; 1242 unsigned short sum;
1244 unsigned char *ee_data; 1243 unsigned char *ee_data;
@@ -1274,10 +1273,8 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1274 1273
1275 if (pdev->vendor == 0x1282 && pdev->device == 0x9100) 1274 if (pdev->vendor == 0x1282 && pdev->device == 0x9100)
1276 { 1275 {
1277 u32 dev_rev;
1278 /* Read Chip revision */ 1276 /* Read Chip revision */
1279 pci_read_config_dword(pdev, PCI_REVISION_ID, &dev_rev); 1277 if (pdev->revision < 0x02000030)
1280 if(dev_rev < 0x02000030)
1281 { 1278 {
1282 printk(KERN_ERR PFX "skipping early DM9100 with Crc bug (use dmfe)\n"); 1279 printk(KERN_ERR PFX "skipping early DM9100 with Crc bug (use dmfe)\n");
1283 return -ENODEV; 1280 return -ENODEV;
@@ -1360,8 +1357,6 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1360 if (!ioaddr) 1357 if (!ioaddr)
1361 goto err_out_free_res; 1358 goto err_out_free_res;
1362 1359
1363 pci_read_config_byte (pdev, PCI_REVISION_ID, &chip_rev);
1364
1365 /* 1360 /*
1366 * initialize private data structure 'tp' 1361 * initialize private data structure 'tp'
1367 * it is zeroed and aligned in alloc_etherdev 1362 * it is zeroed and aligned in alloc_etherdev
@@ -1382,7 +1377,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1382 tp->flags = tulip_tbl[chip_idx].flags; 1377 tp->flags = tulip_tbl[chip_idx].flags;
1383 tp->pdev = pdev; 1378 tp->pdev = pdev;
1384 tp->base_addr = ioaddr; 1379 tp->base_addr = ioaddr;
1385 tp->revision = chip_rev; 1380 tp->revision = pdev->revision;
1386 tp->csr0 = csr0; 1381 tp->csr0 = csr0;
1387 spin_lock_init(&tp->lock); 1382 spin_lock_init(&tp->lock);
1388 spin_lock_init(&tp->mii_lock); 1383 spin_lock_init(&tp->mii_lock);
@@ -1399,7 +1394,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1399 tulip_mwi_config (pdev, dev); 1394 tulip_mwi_config (pdev, dev);
1400#else 1395#else
1401 /* MWI is broken for DC21143 rev 65... */ 1396 /* MWI is broken for DC21143 rev 65... */
1402 if (chip_idx == DC21143 && chip_rev == 65) 1397 if (chip_idx == DC21143 && pdev->revision == 65)
1403 tp->csr0 &= ~MWI; 1398 tp->csr0 &= ~MWI;
1404#endif 1399#endif
1405 1400
@@ -1640,7 +1635,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
1640#else 1635#else
1641 "Port" 1636 "Port"
1642#endif 1637#endif
1643 " %#llx,", dev->name, chip_name, chip_rev, 1638 " %#llx,", dev->name, chip_name, pdev->revision,
1644 (unsigned long long) pci_resource_start(pdev, TULIP_BAR)); 1639 (unsigned long long) pci_resource_start(pdev, TULIP_BAR));
1645 pci_set_drvdata(pdev, dev); 1640 pci_set_drvdata(pdev, dev);
1646 1641
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 37e35cd277a1..16a54e6b8d4f 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -205,7 +205,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
205{ 205{
206 struct net_device *dev = NULL; 206 struct net_device *dev = NULL;
207 struct xircom_private *private; 207 struct xircom_private *private;
208 unsigned char chip_rev;
209 unsigned long flags; 208 unsigned long flags;
210 unsigned short tmp16; 209 unsigned short tmp16;
211 enter("xircom_probe"); 210 enter("xircom_probe");
@@ -224,8 +223,6 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
224 pci_read_config_word (pdev,PCI_STATUS, &tmp16); 223 pci_read_config_word (pdev,PCI_STATUS, &tmp16);
225 pci_write_config_word (pdev, PCI_STATUS,tmp16); 224 pci_write_config_word (pdev, PCI_STATUS,tmp16);
226 225
227 pci_read_config_byte(pdev, PCI_REVISION_ID, &chip_rev);
228
229 if (!request_region(pci_resource_start(pdev, 0), 128, "xircom_cb")) { 226 if (!request_region(pci_resource_start(pdev, 0), 128, "xircom_cb")) {
230 printk(KERN_ERR "xircom_probe: failed to allocate io-region\n"); 227 printk(KERN_ERR "xircom_probe: failed to allocate io-region\n");
231 return -ENODEV; 228 return -ENODEV;
@@ -286,7 +283,7 @@ static int __devinit xircom_probe(struct pci_dev *pdev, const struct pci_device_
286 goto reg_fail; 283 goto reg_fail;
287 } 284 }
288 285
289 printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, chip_rev, pdev->irq); 286 printk(KERN_INFO "%s: Xircom cardbus revision %i at irq %i \n", dev->name, pdev->revision, pdev->irq);
290 /* start the transmitter to get a heartbeat */ 287 /* start the transmitter to get a heartbeat */
291 /* TODO: send 2 dummy packets here */ 288 /* TODO: send 2 dummy packets here */
292 transceiver_voodoo(private); 289 transceiver_voodoo(private);
diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c
index f984fbde8b23..fc439f333350 100644
--- a/drivers/net/tulip/xircom_tulip_cb.c
+++ b/drivers/net/tulip/xircom_tulip_cb.c
@@ -524,7 +524,6 @@ static int __devinit xircom_init_one(struct pci_dev *pdev, const struct pci_devi
524 int chip_idx = id->driver_data; 524 int chip_idx = id->driver_data;
525 long ioaddr; 525 long ioaddr;
526 int i; 526 int i;
527 u8 chip_rev;
528 527
529/* when built into the kernel, we only print version if device is found */ 528/* when built into the kernel, we only print version if device is found */
530#ifndef MODULE 529#ifndef MODULE
@@ -620,9 +619,8 @@ static int __devinit xircom_init_one(struct pci_dev *pdev, const struct pci_devi
620 if (register_netdev(dev)) 619 if (register_netdev(dev))
621 goto err_out_cleardev; 620 goto err_out_cleardev;
622 621
623 pci_read_config_byte(pdev, PCI_REVISION_ID, &chip_rev);
624 printk(KERN_INFO "%s: %s rev %d at %#3lx,", 622 printk(KERN_INFO "%s: %s rev %d at %#3lx,",
625 dev->name, xircom_tbl[chip_idx].chip_name, chip_rev, ioaddr); 623 dev->name, xircom_tbl[chip_idx].chip_name, pdev->revision, ioaddr);
626 for (i = 0; i < 6; i++) 624 for (i = 0; i < 6; i++)
627 printk("%c%2.2X", i ? ':' : ' ', dev->dev_addr[i]); 625 printk("%c%2.2X", i ? ':' : ' ', dev->dev_addr[i]);
628 printk(", IRQ %d.\n", dev->irq); 626 printk(", IRQ %d.\n", dev->irq);
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index df524548d531..03587205546e 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -2267,12 +2267,6 @@ need_resume:
2267 typhoon_resume(pdev); 2267 typhoon_resume(pdev);
2268 return -EBUSY; 2268 return -EBUSY;
2269} 2269}
2270
2271static int
2272typhoon_enable_wake(struct pci_dev *pdev, pci_power_t state, int enable)
2273{
2274 return pci_enable_wake(pdev, state, enable);
2275}
2276#endif 2270#endif
2277 2271
2278static int __devinit 2272static int __devinit
@@ -2636,7 +2630,6 @@ static struct pci_driver typhoon_driver = {
2636#ifdef CONFIG_PM 2630#ifdef CONFIG_PM
2637 .suspend = typhoon_suspend, 2631 .suspend = typhoon_suspend,
2638 .resume = typhoon_resume, 2632 .resume = typhoon_resume,
2639 .enable_wake = typhoon_enable_wake,
2640#endif 2633#endif
2641}; 2634};
2642 2635
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 565f6cc185ce..f51c2c138f10 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -622,7 +622,6 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
622 struct net_device *dev; 622 struct net_device *dev;
623 struct rhine_private *rp; 623 struct rhine_private *rp;
624 int i, rc; 624 int i, rc;
625 u8 pci_rev;
626 u32 quirks; 625 u32 quirks;
627 long pioaddr; 626 long pioaddr;
628 long memaddr; 627 long memaddr;
@@ -642,27 +641,25 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
642 printk(version); 641 printk(version);
643#endif 642#endif
644 643
645 pci_read_config_byte(pdev, PCI_REVISION_ID, &pci_rev);
646
647 io_size = 256; 644 io_size = 256;
648 phy_id = 0; 645 phy_id = 0;
649 quirks = 0; 646 quirks = 0;
650 name = "Rhine"; 647 name = "Rhine";
651 if (pci_rev < VTunknown0) { 648 if (pdev->revision < VTunknown0) {
652 quirks = rqRhineI; 649 quirks = rqRhineI;
653 io_size = 128; 650 io_size = 128;
654 } 651 }
655 else if (pci_rev >= VT6102) { 652 else if (pdev->revision >= VT6102) {
656 quirks = rqWOL | rqForceReset; 653 quirks = rqWOL | rqForceReset;
657 if (pci_rev < VT6105) { 654 if (pdev->revision < VT6105) {
658 name = "Rhine II"; 655 name = "Rhine II";
659 quirks |= rqStatusWBRace; /* Rhine-II exclusive */ 656 quirks |= rqStatusWBRace; /* Rhine-II exclusive */
660 } 657 }
661 else { 658 else {
662 phy_id = 1; /* Integrated PHY, phy_id fixed to 1 */ 659 phy_id = 1; /* Integrated PHY, phy_id fixed to 1 */
663 if (pci_rev >= VT6105_B0) 660 if (pdev->revision >= VT6105_B0)
664 quirks |= rq6patterns; 661 quirks |= rq6patterns;
665 if (pci_rev < VT6105M) 662 if (pdev->revision < VT6105M)
666 name = "Rhine III"; 663 name = "Rhine III";
667 else 664 else
668 name = "Rhine III (Management Adapter)"; 665 name = "Rhine III (Management Adapter)";
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index b670b97bcfde..f331843d1102 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -890,8 +890,7 @@ static void __devinit velocity_init_info(struct pci_dev *pdev,
890 890
891static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pci_dev *pdev) 891static int __devinit velocity_get_pci_info(struct velocity_info *vptr, struct pci_dev *pdev)
892{ 892{
893 if (pci_read_config_byte(pdev, PCI_REVISION_ID, &vptr->rev_id) < 0) 893 vptr->rev_id = pdev->revision;
894 return -EIO;
895 894
896 pci_set_master(pdev); 895 pci_set_master(pdev);
897 896
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c
index 999bf71937ca..ec1c556a47ca 100644
--- a/drivers/net/wan/pc300_drv.c
+++ b/drivers/net/wan/pc300_drv.c
@@ -3439,7 +3439,6 @@ static int __devinit
3439cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) 3439cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3440{ 3440{
3441 static int first_time = 1; 3441 static int first_time = 1;
3442 ucchar cpc_rev_id;
3443 int err, eeprom_outdated = 0; 3442 int err, eeprom_outdated = 0;
3444 ucshort device_id; 3443 ucshort device_id;
3445 pc300_t *card; 3444 pc300_t *card;
@@ -3480,7 +3479,6 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3480 card->hw.falcsize = pci_resource_len(pdev, 4); 3479 card->hw.falcsize = pci_resource_len(pdev, 4);
3481 card->hw.plxphys = pci_resource_start(pdev, 5); 3480 card->hw.plxphys = pci_resource_start(pdev, 5);
3482 card->hw.plxsize = pci_resource_len(pdev, 5); 3481 card->hw.plxsize = pci_resource_len(pdev, 5);
3483 pci_read_config_byte(pdev, PCI_REVISION_ID, &cpc_rev_id);
3484 3482
3485 switch (device_id) { 3483 switch (device_id) {
3486 case PCI_DEVICE_ID_PC300_RX_1: 3484 case PCI_DEVICE_ID_PC300_RX_1:
@@ -3498,7 +3496,7 @@ cpc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3498 } 3496 }
3499#ifdef PC300_DEBUG_PCI 3497#ifdef PC300_DEBUG_PCI
3500 printk("cpc (bus=0x0%x,pci_id=0x%x,", pdev->bus->number, pdev->devfn); 3498 printk("cpc (bus=0x0%x,pci_id=0x%x,", pdev->bus->number, pdev->devfn);
3501 printk("rev_id=%d) IRQ%d\n", cpc_rev_id, card->hw.irq); 3499 printk("rev_id=%d) IRQ%d\n", pdev->revision, card->hw.irq);
3502 printk("cpc:found ramaddr=0x%08lx plxaddr=0x%08lx " 3500 printk("cpc:found ramaddr=0x%08lx plxaddr=0x%08lx "
3503 "ctladdr=0x%08lx falcaddr=0x%08lx\n", 3501 "ctladdr=0x%08lx falcaddr=0x%08lx\n",
3504 card->hw.ramphys, card->hw.plxphys, card->hw.scaphys, 3502 card->hw.ramphys, card->hw.plxphys, card->hw.scaphys,
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index aff05dba720a..dfbd3b00f03b 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -311,7 +311,6 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
311 const struct pci_device_id *ent) 311 const struct pci_device_id *ent)
312{ 312{
313 card_t *card; 313 card_t *card;
314 u8 rev_id;
315 u32 __iomem *p; 314 u32 __iomem *p;
316 int i; 315 int i;
317 u32 ramsize; 316 u32 ramsize;
@@ -366,7 +365,6 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
366 return -ENOMEM; 365 return -ENOMEM;
367 } 366 }
368 367
369 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
370 if (pci_resource_len(pdev, 0) != PC300_PLX_SIZE || 368 if (pci_resource_len(pdev, 0) != PC300_PLX_SIZE ||
371 pci_resource_len(pdev, 2) != PC300_SCA_SIZE || 369 pci_resource_len(pdev, 2) != PC300_SCA_SIZE ||
372 pci_resource_len(pdev, 3) < 16384) { 370 pci_resource_len(pdev, 3) < 16384) {
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c
index ca06a00d9d86..7f720de2e9f0 100644
--- a/drivers/net/wan/pci200syn.c
+++ b/drivers/net/wan/pci200syn.c
@@ -289,7 +289,6 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
289 const struct pci_device_id *ent) 289 const struct pci_device_id *ent)
290{ 290{
291 card_t *card; 291 card_t *card;
292 u8 rev_id;
293 u32 __iomem *p; 292 u32 __iomem *p;
294 int i; 293 int i;
295 u32 ramsize; 294 u32 ramsize;
@@ -330,7 +329,6 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
330 return -ENOMEM; 329 return -ENOMEM;
331 } 330 }
332 331
333 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
334 if (pci_resource_len(pdev, 0) != PCI200SYN_PLX_SIZE || 332 if (pci_resource_len(pdev, 0) != PCI200SYN_PLX_SIZE ||
335 pci_resource_len(pdev, 2) != PCI200SYN_SCA_SIZE || 333 pci_resource_len(pdev, 2) != PCI200SYN_SCA_SIZE ||
336 pci_resource_len(pdev, 3) < 16384) { 334 pci_resource_len(pdev, 3) < 16384) {
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index ef6b253a92ce..c5d6753a55ea 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -3741,10 +3741,8 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
3741 &bcm->board_type); 3741 &bcm->board_type);
3742 if (err) 3742 if (err)
3743 goto err_iounmap; 3743 goto err_iounmap;
3744 err = bcm43xx_pci_read_config16(bcm, PCI_REVISION_ID, 3744
3745 &bcm->board_revision); 3745 bcm->board_revision = bcm->pci_dev->revision;
3746 if (err)
3747 goto err_iounmap;
3748 3746
3749 err = bcm43xx_chipset_attach(bcm); 3747 err = bcm43xx_chipset_attach(bcm);
3750 if (err) 3748 if (err)
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c
index 0cd48d151f5e..7da3664b8515 100644
--- a/drivers/net/wireless/hostap/hostap_pci.c
+++ b/drivers/net/wireless/hostap/hostap_pci.c
@@ -453,8 +453,6 @@ static struct pci_driver prism2_pci_drv_id = {
453 .suspend = prism2_pci_suspend, 453 .suspend = prism2_pci_suspend,
454 .resume = prism2_pci_resume, 454 .resume = prism2_pci_resume,
455#endif /* CONFIG_PM */ 455#endif /* CONFIG_PM */
456 /* Linux 2.4.6 added save_state and enable_wake that are not used here
457 */
458}; 456};
459 457
460 458
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
index 0183df757b3e..040dc3e36410 100644
--- a/drivers/net/wireless/hostap/hostap_plx.c
+++ b/drivers/net/wireless/hostap/hostap_plx.c
@@ -613,9 +613,6 @@ static struct pci_driver prism2_plx_drv_id = {
613 .id_table = prism2_plx_id_table, 613 .id_table = prism2_plx_id_table,
614 .probe = prism2_plx_probe, 614 .probe = prism2_plx_probe,
615 .remove = prism2_plx_remove, 615 .remove = prism2_plx_remove,
616 .suspend = NULL,
617 .resume = NULL,
618 .enable_wake = NULL
619}; 616};
620 617
621 618
diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c
index 3dcb13bb7d57..af2e4f2405f2 100644
--- a/drivers/net/wireless/prism54/islpci_hotplug.c
+++ b/drivers/net/wireless/prism54/islpci_hotplug.c
@@ -87,7 +87,6 @@ static struct pci_driver prism54_driver = {
87 .remove = prism54_remove, 87 .remove = prism54_remove,
88 .suspend = prism54_suspend, 88 .suspend = prism54_suspend,
89 .resume = prism54_resume, 89 .resume = prism54_resume,
90 /* .enable_wake ; we don't support this yet */
91}; 90};
92 91
93/****************************************************************************** 92/******************************************************************************
@@ -167,8 +166,7 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
167 pci_set_master(pdev); 166 pci_set_master(pdev);
168 167
169 /* enable MWI */ 168 /* enable MWI */
170 if (!pci_set_mwi(pdev)) 169 pci_try_set_mwi(pdev);
171 printk(KERN_INFO "%s: pci_set_mwi(pdev) succeeded\n", DRV_NAME);
172 170
173 /* setup the network device interface and its structure */ 171 /* setup the network device interface and its structure */
174 if (!(ndev = islpci_setup(pdev))) { 172 if (!(ndev = islpci_setup(pdev))) {
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index e3beb784406f..006054a40995 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -41,9 +41,7 @@ obj-$(CONFIG_ACPI) += pci-acpi.o
41# Cardbus & CompactPCI use setup-bus 41# Cardbus & CompactPCI use setup-bus
42obj-$(CONFIG_HOTPLUG) += setup-bus.o 42obj-$(CONFIG_HOTPLUG) += setup-bus.o
43 43
44ifndef CONFIG_X86 44obj-$(CONFIG_PCI_SYSCALL) += syscall.o
45obj-y += syscall.o
46endif
47 45
48ifeq ($(CONFIG_PCI_DEBUG),y) 46ifeq ($(CONFIG_PCI_DEBUG),y)
49EXTRA_CFLAGS += -DDEBUG 47EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h
index ddbadd95387e..f6cc0c5b5657 100644
--- a/drivers/pci/hotplug/acpiphp.h
+++ b/drivers/pci/hotplug/acpiphp.h
@@ -211,6 +211,7 @@ typedef int (*acpiphp_callback)(struct acpiphp_slot *slot, void *data);
211 211
212extern int acpiphp_enable_slot (struct acpiphp_slot *slot); 212extern int acpiphp_enable_slot (struct acpiphp_slot *slot);
213extern int acpiphp_disable_slot (struct acpiphp_slot *slot); 213extern int acpiphp_disable_slot (struct acpiphp_slot *slot);
214extern int acpiphp_eject_slot (struct acpiphp_slot *slot);
214extern u8 acpiphp_get_power_status (struct acpiphp_slot *slot); 215extern u8 acpiphp_get_power_status (struct acpiphp_slot *slot);
215extern u8 acpiphp_get_attention_status (struct acpiphp_slot *slot); 216extern u8 acpiphp_get_attention_status (struct acpiphp_slot *slot);
216extern u8 acpiphp_get_latch_status (struct acpiphp_slot *slot); 217extern u8 acpiphp_get_latch_status (struct acpiphp_slot *slot);
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
index fa5c0197d571..a0ca63adad5a 100644
--- a/drivers/pci/hotplug/acpiphp_core.c
+++ b/drivers/pci/hotplug/acpiphp_core.c
@@ -156,11 +156,15 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
156static int disable_slot(struct hotplug_slot *hotplug_slot) 156static int disable_slot(struct hotplug_slot *hotplug_slot)
157{ 157{
158 struct slot *slot = hotplug_slot->private; 158 struct slot *slot = hotplug_slot->private;
159 int retval;
159 160
160 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); 161 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
161 162
162 /* disable the specified slot */ 163 /* disable the specified slot */
163 return acpiphp_disable_slot(slot->acpi_slot); 164 retval = acpiphp_disable_slot(slot->acpi_slot);
165 if (!retval)
166 retval = acpiphp_eject_slot(slot->acpi_slot);
167 return retval;
164} 168}
165 169
166 170
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 9ef4e989afc4..1e125b56c9a9 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -1282,7 +1282,7 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
1282/** 1282/**
1283 * acpiphp_eject_slot - physically eject the slot 1283 * acpiphp_eject_slot - physically eject the slot
1284 */ 1284 */
1285static int acpiphp_eject_slot(struct acpiphp_slot *slot) 1285int acpiphp_eject_slot(struct acpiphp_slot *slot)
1286{ 1286{
1287 acpi_status status; 1287 acpi_status status;
1288 struct acpiphp_func *func; 1288 struct acpiphp_func *func;
@@ -1368,6 +1368,9 @@ static void program_hpp(struct pci_dev *dev, struct acpiphp_bridge *bridge)
1368 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI))) 1368 (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI)))
1369 return; 1369 return;
1370 1370
1371 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST)
1372 return;
1373
1371 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 1374 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
1372 bridge->hpp.t0->cache_line_size); 1375 bridge->hpp.t0->cache_line_size);
1373 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 1376 pci_write_config_byte(dev, PCI_LATENCY_TIMER,
@@ -1502,6 +1505,37 @@ static void handle_bridge_insertion(acpi_handle handle, u32 type)
1502 * ACPI event handlers 1505 * ACPI event handlers
1503 */ 1506 */
1504 1507
1508static acpi_status
1509count_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
1510{
1511 int *count = (int *)context;
1512 struct acpiphp_bridge *bridge;
1513
1514 bridge = acpiphp_handle_to_bridge(handle);
1515 if (bridge)
1516 (*count)++;
1517 return AE_OK ;
1518}
1519
1520static acpi_status
1521check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
1522{
1523 struct acpiphp_bridge *bridge;
1524 char objname[64];
1525 struct acpi_buffer buffer = { .length = sizeof(objname),
1526 .pointer = objname };
1527
1528 bridge = acpiphp_handle_to_bridge(handle);
1529 if (bridge) {
1530 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
1531 dbg("%s: re-enumerating slots under %s\n",
1532 __FUNCTION__, objname);
1533 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
1534 acpiphp_check_bridge(bridge);
1535 }
1536 return AE_OK ;
1537}
1538
1505/** 1539/**
1506 * handle_hotplug_event_bridge - handle ACPI event on bridges 1540 * handle_hotplug_event_bridge - handle ACPI event on bridges
1507 * 1541 *
@@ -1519,6 +1553,7 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
1519 struct acpi_buffer buffer = { .length = sizeof(objname), 1553 struct acpi_buffer buffer = { .length = sizeof(objname),
1520 .pointer = objname }; 1554 .pointer = objname };
1521 struct acpi_device *device; 1555 struct acpi_device *device;
1556 int num_sub_bridges = 0;
1522 1557
1523 if (acpi_bus_get_device(handle, &device)) { 1558 if (acpi_bus_get_device(handle, &device)) {
1524 /* This bridge must have just been physically inserted */ 1559 /* This bridge must have just been physically inserted */
@@ -1527,7 +1562,12 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
1527 } 1562 }
1528 1563
1529 bridge = acpiphp_handle_to_bridge(handle); 1564 bridge = acpiphp_handle_to_bridge(handle);
1530 if (!bridge) { 1565 if (type == ACPI_NOTIFY_BUS_CHECK) {
1566 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, ACPI_UINT32_MAX,
1567 count_sub_bridges, &num_sub_bridges, NULL);
1568 }
1569
1570 if (!bridge && !num_sub_bridges) {
1531 err("cannot get bridge info\n"); 1571 err("cannot get bridge info\n");
1532 return; 1572 return;
1533 } 1573 }
@@ -1538,7 +1578,14 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
1538 case ACPI_NOTIFY_BUS_CHECK: 1578 case ACPI_NOTIFY_BUS_CHECK:
1539 /* bus re-enumerate */ 1579 /* bus re-enumerate */
1540 dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname); 1580 dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname);
1541 acpiphp_check_bridge(bridge); 1581 if (bridge) {
1582 dbg("%s: re-enumerating slots under %s\n",
1583 __FUNCTION__, objname);
1584 acpiphp_check_bridge(bridge);
1585 }
1586 if (num_sub_bridges)
1587 acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
1588 ACPI_UINT32_MAX, check_sub_bridges, NULL, NULL);
1542 break; 1589 break;
1543 1590
1544 case ACPI_NOTIFY_DEVICE_CHECK: 1591 case ACPI_NOTIFY_DEVICE_CHECK:
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c
index 684551559d44..ed4d44e3332c 100644
--- a/drivers/pci/hotplug/cpci_hotplug_core.c
+++ b/drivers/pci/hotplug/cpci_hotplug_core.c
@@ -35,6 +35,7 @@
35#include <linux/smp_lock.h> 35#include <linux/smp_lock.h>
36#include <asm/atomic.h> 36#include <asm/atomic.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/kthread.h>
38#include "cpci_hotplug.h" 39#include "cpci_hotplug.h"
39 40
40#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>" 41#define DRIVER_AUTHOR "Scott Murray <scottm@somanetworks.com>"
@@ -59,9 +60,8 @@ static int slots;
59static atomic_t extracting; 60static atomic_t extracting;
60int cpci_debug; 61int cpci_debug;
61static struct cpci_hp_controller *controller; 62static struct cpci_hp_controller *controller;
62static struct semaphore event_semaphore; /* mutex for process loop (up if something to process) */ 63static struct task_struct *cpci_thread;
63static struct semaphore thread_exit; /* guard ensure thread has exited before calling it quits */ 64static int thread_finished;
64static int thread_finished = 1;
65 65
66static int enable_slot(struct hotplug_slot *slot); 66static int enable_slot(struct hotplug_slot *slot);
67static int disable_slot(struct hotplug_slot *slot); 67static int disable_slot(struct hotplug_slot *slot);
@@ -357,9 +357,7 @@ cpci_hp_intr(int irq, void *data)
357 controller->ops->disable_irq(); 357 controller->ops->disable_irq();
358 358
359 /* Trigger processing by the event thread */ 359 /* Trigger processing by the event thread */
360 dbg("Signal event_semaphore"); 360 wake_up_process(cpci_thread);
361 up(&event_semaphore);
362 dbg("exited cpci_hp_intr");
363 return IRQ_HANDLED; 361 return IRQ_HANDLED;
364} 362}
365 363
@@ -521,17 +519,12 @@ event_thread(void *data)
521{ 519{
522 int rc; 520 int rc;
523 521
524 lock_kernel();
525 daemonize("cpci_hp_eventd");
526 unlock_kernel();
527
528 dbg("%s - event thread started", __FUNCTION__); 522 dbg("%s - event thread started", __FUNCTION__);
529 while (1) { 523 while (1) {
530 dbg("event thread sleeping"); 524 dbg("event thread sleeping");
531 down_interruptible(&event_semaphore); 525 set_current_state(TASK_INTERRUPTIBLE);
532 dbg("event thread woken, thread_finished = %d", 526 schedule();
533 thread_finished); 527 if (kthread_should_stop())
534 if (thread_finished || signal_pending(current))
535 break; 528 break;
536 do { 529 do {
537 rc = check_slots(); 530 rc = check_slots();
@@ -541,18 +534,17 @@ event_thread(void *data)
541 } else if (rc < 0) { 534 } else if (rc < 0) {
542 dbg("%s - error checking slots", __FUNCTION__); 535 dbg("%s - error checking slots", __FUNCTION__);
543 thread_finished = 1; 536 thread_finished = 1;
544 break; 537 goto out;
545 } 538 }
546 } while (atomic_read(&extracting) && !thread_finished); 539 } while (atomic_read(&extracting) && !kthread_should_stop());
547 if (thread_finished) 540 if (kthread_should_stop())
548 break; 541 break;
549 542
550 /* Re-enable ENUM# interrupt */ 543 /* Re-enable ENUM# interrupt */
551 dbg("%s - re-enabling irq", __FUNCTION__); 544 dbg("%s - re-enabling irq", __FUNCTION__);
552 controller->ops->enable_irq(); 545 controller->ops->enable_irq();
553 } 546 }
554 dbg("%s - event thread signals exit", __FUNCTION__); 547 out:
555 up(&thread_exit);
556 return 0; 548 return 0;
557} 549}
558 550
@@ -562,12 +554,8 @@ poll_thread(void *data)
562{ 554{
563 int rc; 555 int rc;
564 556
565 lock_kernel();
566 daemonize("cpci_hp_polld");
567 unlock_kernel();
568
569 while (1) { 557 while (1) {
570 if (thread_finished || signal_pending(current)) 558 if (kthread_should_stop() || signal_pending(current))
571 break; 559 break;
572 if (controller->ops->query_enum()) { 560 if (controller->ops->query_enum()) {
573 do { 561 do {
@@ -578,48 +566,36 @@ poll_thread(void *data)
578 } else if (rc < 0) { 566 } else if (rc < 0) {
579 dbg("%s - error checking slots", __FUNCTION__); 567 dbg("%s - error checking slots", __FUNCTION__);
580 thread_finished = 1; 568 thread_finished = 1;
581 break; 569 goto out;
582 } 570 }
583 } while (atomic_read(&extracting) && !thread_finished); 571 } while (atomic_read(&extracting) && !kthread_should_stop());
584 } 572 }
585 msleep(100); 573 msleep(100);
586 } 574 }
587 dbg("poll thread signals exit"); 575 out:
588 up(&thread_exit);
589 return 0; 576 return 0;
590} 577}
591 578
592static int 579static int
593cpci_start_thread(void) 580cpci_start_thread(void)
594{ 581{
595 int pid;
596
597 /* initialize our semaphores */
598 init_MUTEX_LOCKED(&event_semaphore);
599 init_MUTEX_LOCKED(&thread_exit);
600 thread_finished = 0;
601
602 if (controller->irq) 582 if (controller->irq)
603 pid = kernel_thread(event_thread, NULL, 0); 583 cpci_thread = kthread_run(event_thread, NULL, "cpci_hp_eventd");
604 else 584 else
605 pid = kernel_thread(poll_thread, NULL, 0); 585 cpci_thread = kthread_run(poll_thread, NULL, "cpci_hp_polld");
606 if (pid < 0) { 586 if (IS_ERR(cpci_thread)) {
607 err("Can't start up our thread"); 587 err("Can't start up our thread");
608 return -1; 588 return PTR_ERR(cpci_thread);
609 } 589 }
610 dbg("Our thread pid = %d", pid); 590 thread_finished = 0;
611 return 0; 591 return 0;
612} 592}
613 593
614static void 594static void
615cpci_stop_thread(void) 595cpci_stop_thread(void)
616{ 596{
597 kthread_stop(cpci_thread);
617 thread_finished = 1; 598 thread_finished = 1;
618 dbg("thread finish command given");
619 if (controller->irq)
620 up(&event_semaphore);
621 dbg("wait for thread to exit");
622 down(&thread_exit);
623} 599}
624 600
625int 601int
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 7b1beaad2752..5e9be44817cb 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -45,8 +45,6 @@ extern int cpci_debug;
45#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg) 45#define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## arg)
46#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg) 46#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , ## arg)
47 47
48#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
49
50 48
51u8 cpci_get_attention_status(struct slot* slot) 49u8 cpci_get_attention_status(struct slot* slot)
52{ 50{
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c
index 5617cfdadc5c..d590a99930fa 100644
--- a/drivers/pci/hotplug/cpqphp_core.c
+++ b/drivers/pci/hotplug/cpqphp_core.c
@@ -796,7 +796,6 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
796 u8 num_of_slots = 0; 796 u8 num_of_slots = 0;
797 u8 hp_slot = 0; 797 u8 hp_slot = 0;
798 u8 device; 798 u8 device;
799 u8 rev;
800 u8 bus_cap; 799 u8 bus_cap;
801 u16 temp_word; 800 u16 temp_word;
802 u16 vendor_id; 801 u16 vendor_id;
@@ -823,9 +822,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
823 } 822 }
824 dbg("Vendor ID: %x\n", vendor_id); 823 dbg("Vendor ID: %x\n", vendor_id);
825 824
826 rc = pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); 825 dbg("revision: %d\n", pdev->revision);
827 dbg("revision: %d\n", rev); 826 if ((vendor_id == PCI_VENDOR_ID_COMPAQ) && (!pdev->revision)) {
828 if (rc || ((vendor_id == PCI_VENDOR_ID_COMPAQ) && (!rev))) {
829 err(msg_HPC_rev_error); 827 err(msg_HPC_rev_error);
830 rc = -ENODEV; 828 rc = -ENODEV;
831 goto err_disable_device; 829 goto err_disable_device;
@@ -836,7 +834,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
836 * For Intel, each SSID bit identifies a PHP capability. 834 * For Intel, each SSID bit identifies a PHP capability.
837 * Also Intel HPC's may have RID=0. 835 * Also Intel HPC's may have RID=0.
838 */ 836 */
839 if ((rev > 2) || (vendor_id == PCI_VENDOR_ID_INTEL)) { 837 if ((pdev->revision > 2) || (vendor_id == PCI_VENDOR_ID_INTEL)) {
840 // TODO: This code can be made to support non-Compaq or Intel subsystem IDs 838 // TODO: This code can be made to support non-Compaq or Intel subsystem IDs
841 rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid); 839 rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid);
842 if (rc) { 840 if (rc) {
@@ -870,7 +868,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
870 868
871 switch (subsystem_vid) { 869 switch (subsystem_vid) {
872 case PCI_VENDOR_ID_COMPAQ: 870 case PCI_VENDOR_ID_COMPAQ:
873 if (rev >= 0x13) { /* CIOBX */ 871 if (pdev->revision >= 0x13) { /* CIOBX */
874 ctrl->push_flag = 1; 872 ctrl->push_flag = 1;
875 ctrl->slot_switch_type = 1; 873 ctrl->slot_switch_type = 1;
876 ctrl->push_button = 1; 874 ctrl->push_button = 1;
@@ -1075,7 +1073,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1075 memcpy(ctrl->pci_bus, pdev->bus, sizeof(*ctrl->pci_bus)); 1073 memcpy(ctrl->pci_bus, pdev->bus, sizeof(*ctrl->pci_bus));
1076 1074
1077 ctrl->bus = pdev->bus->number; 1075 ctrl->bus = pdev->bus->number;
1078 ctrl->rev = rev; 1076 ctrl->rev = pdev->revision;
1079 dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, 1077 dbg("bus device function rev: %d %d %d %d\n", ctrl->bus,
1080 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev); 1078 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev);
1081 1079
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index ccc57627201e..7959c222dc24 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -103,6 +103,7 @@ struct controller {
103 u8 cap_base; 103 u8 cap_base;
104 struct timer_list poll_timer; 104 struct timer_list poll_timer;
105 volatile int cmd_busy; 105 volatile int cmd_busy;
106 spinlock_t lock;
106}; 107};
107 108
108#define INT_BUTTON_IGNORE 0 109#define INT_BUTTON_IGNORE 0
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
index 7f22caa70178..98e541ffef3d 100644
--- a/drivers/pci/hotplug/pciehp_ctrl.c
+++ b/drivers/pci/hotplug/pciehp_ctrl.c
@@ -197,6 +197,12 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot)
197 __FUNCTION__); 197 __FUNCTION__);
198 return; 198 return;
199 } 199 }
200 /*
201 * After turning power off, we must wait for at least
202 * 1 second before taking any action that relies on
203 * power having been removed from the slot/adapter.
204 */
205 msleep(1000);
200 } 206 }
201} 207}
202 208
@@ -615,6 +621,12 @@ int pciehp_disable_slot(struct slot *p_slot)
615 mutex_unlock(&p_slot->ctrl->crit_sect); 621 mutex_unlock(&p_slot->ctrl->crit_sect);
616 return -EINVAL; 622 return -EINVAL;
617 } 623 }
624 /*
625 * After turning power off, we must wait for at least
626 * 1 second before taking any action that relies on
627 * power having been removed from the slot/adapter.
628 */
629 msleep(1000);
618 } 630 }
619 631
620 ret = remove_board(p_slot); 632 ret = remove_board(p_slot);
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 9aac6a87eb53..016eea94a8a5 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -275,11 +275,19 @@ static inline int pcie_wait_cmd(struct controller *ctrl)
275 return retval; 275 return retval;
276} 276}
277 277
278static int pcie_write_cmd(struct slot *slot, u16 cmd) 278/**
279 * pcie_write_cmd - Issue controller command
280 * @slot: slot to which the command is issued
281 * @cmd: command value written to slot control register
282 * @mask: bitmask of slot control register to be modified
283 */
284static int pcie_write_cmd(struct slot *slot, u16 cmd, u16 mask)
279{ 285{
280 struct controller *ctrl = slot->ctrl; 286 struct controller *ctrl = slot->ctrl;
281 int retval = 0; 287 int retval = 0;
282 u16 slot_status; 288 u16 slot_status;
289 u16 slot_ctrl;
290 unsigned long flags;
283 291
284 DBG_ENTER_ROUTINE 292 DBG_ENTER_ROUTINE
285 293
@@ -299,17 +307,29 @@ static int pcie_write_cmd(struct slot *slot, u16 cmd)
299 __FUNCTION__); 307 __FUNCTION__);
300 } 308 }
301 309
302 ctrl->cmd_busy = 1; 310 spin_lock_irqsave(&ctrl->lock, flags);
303 retval = pciehp_writew(ctrl, SLOTCTRL, (cmd | CMD_CMPL_INTR_ENABLE)); 311 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl);
304 if (retval) { 312 if (retval) {
305 err("%s: Cannot write to SLOTCTRL register\n", __FUNCTION__); 313 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__);
306 goto out; 314 goto out_spin_unlock;
307 } 315 }
308 316
317 slot_ctrl &= ~mask;
318 slot_ctrl |= ((cmd & mask) | CMD_CMPL_INTR_ENABLE);
319
320 ctrl->cmd_busy = 1;
321 retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl);
322 if (retval)
323 err("%s: Cannot write to SLOTCTRL register\n", __FUNCTION__);
324
325 out_spin_unlock:
326 spin_unlock_irqrestore(&ctrl->lock, flags);
327
309 /* 328 /*
310 * Wait for command completion. 329 * Wait for command completion.
311 */ 330 */
312 retval = pcie_wait_cmd(ctrl); 331 if (!retval)
332 retval = pcie_wait_cmd(ctrl);
313 out: 333 out:
314 mutex_unlock(&ctrl->ctrl_lock); 334 mutex_unlock(&ctrl->ctrl_lock);
315 DBG_LEAVE_ROUTINE 335 DBG_LEAVE_ROUTINE
@@ -502,25 +522,20 @@ static int hpc_get_emi_status(struct slot *slot, u8 *status)
502 522
503static int hpc_toggle_emi(struct slot *slot) 523static int hpc_toggle_emi(struct slot *slot)
504{ 524{
505 struct controller *ctrl = slot->ctrl; 525 u16 slot_cmd;
506 u16 slot_cmd = 0; 526 u16 cmd_mask;
507 u16 slot_ctrl; 527 int rc;
508 int rc = 0;
509 528
510 DBG_ENTER_ROUTINE 529 DBG_ENTER_ROUTINE
511 530
512 rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 531 slot_cmd = EMI_CTRL;
513 if (rc) { 532 cmd_mask = EMI_CTRL;
514 err("%s : hp_register_read_word SLOT_CTRL failed\n", 533 if (!pciehp_poll_mode) {
515 __FUNCTION__);
516 return rc;
517 }
518
519 slot_cmd = (slot_ctrl | EMI_CTRL);
520 if (!pciehp_poll_mode)
521 slot_cmd = slot_cmd | HP_INTR_ENABLE; 534 slot_cmd = slot_cmd | HP_INTR_ENABLE;
535 cmd_mask = cmd_mask | HP_INTR_ENABLE;
536 }
522 537
523 pcie_write_cmd(slot, slot_cmd); 538 rc = pcie_write_cmd(slot, slot_cmd, cmd_mask);
524 slot->last_emi_toggle = get_seconds(); 539 slot->last_emi_toggle = get_seconds();
525 DBG_LEAVE_ROUTINE 540 DBG_LEAVE_ROUTINE
526 return rc; 541 return rc;
@@ -529,35 +544,32 @@ static int hpc_toggle_emi(struct slot *slot)
529static int hpc_set_attention_status(struct slot *slot, u8 value) 544static int hpc_set_attention_status(struct slot *slot, u8 value)
530{ 545{
531 struct controller *ctrl = slot->ctrl; 546 struct controller *ctrl = slot->ctrl;
532 u16 slot_cmd = 0; 547 u16 slot_cmd;
533 u16 slot_ctrl; 548 u16 cmd_mask;
534 int rc = 0; 549 int rc;
535 550
536 DBG_ENTER_ROUTINE 551 DBG_ENTER_ROUTINE
537 552
538 rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 553 cmd_mask = ATTN_LED_CTRL;
539 if (rc) {
540 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__);
541 return rc;
542 }
543
544 switch (value) { 554 switch (value) {
545 case 0 : /* turn off */ 555 case 0 : /* turn off */
546 slot_cmd = (slot_ctrl & ~ATTN_LED_CTRL) | 0x00C0; 556 slot_cmd = 0x00C0;
547 break; 557 break;
548 case 1: /* turn on */ 558 case 1: /* turn on */
549 slot_cmd = (slot_ctrl & ~ATTN_LED_CTRL) | 0x0040; 559 slot_cmd = 0x0040;
550 break; 560 break;
551 case 2: /* turn blink */ 561 case 2: /* turn blink */
552 slot_cmd = (slot_ctrl & ~ATTN_LED_CTRL) | 0x0080; 562 slot_cmd = 0x0080;
553 break; 563 break;
554 default: 564 default:
555 return -1; 565 return -1;
556 } 566 }
557 if (!pciehp_poll_mode) 567 if (!pciehp_poll_mode) {
558 slot_cmd = slot_cmd | HP_INTR_ENABLE; 568 slot_cmd = slot_cmd | HP_INTR_ENABLE;
569 cmd_mask = cmd_mask | HP_INTR_ENABLE;
570 }
559 571
560 pcie_write_cmd(slot, slot_cmd); 572 rc = pcie_write_cmd(slot, slot_cmd, cmd_mask);
561 dbg("%s: SLOTCTRL %x write cmd %x\n", 573 dbg("%s: SLOTCTRL %x write cmd %x\n",
562 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 574 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd);
563 575
@@ -570,21 +582,18 @@ static void hpc_set_green_led_on(struct slot *slot)
570{ 582{
571 struct controller *ctrl = slot->ctrl; 583 struct controller *ctrl = slot->ctrl;
572 u16 slot_cmd; 584 u16 slot_cmd;
573 u16 slot_ctrl; 585 u16 cmd_mask;
574 int rc = 0;
575 586
576 DBG_ENTER_ROUTINE 587 DBG_ENTER_ROUTINE
577 588
578 rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 589 slot_cmd = 0x0100;
579 if (rc) { 590 cmd_mask = PWR_LED_CTRL;
580 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 591 if (!pciehp_poll_mode) {
581 return; 592 slot_cmd = slot_cmd | HP_INTR_ENABLE;
593 cmd_mask = cmd_mask | HP_INTR_ENABLE;
582 } 594 }
583 slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0100;
584 if (!pciehp_poll_mode)
585 slot_cmd = slot_cmd | HP_INTR_ENABLE;
586 595
587 pcie_write_cmd(slot, slot_cmd); 596 pcie_write_cmd(slot, slot_cmd, cmd_mask);
588 597
589 dbg("%s: SLOTCTRL %x write cmd %x\n", 598 dbg("%s: SLOTCTRL %x write cmd %x\n",
590 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 599 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd);
@@ -596,22 +605,18 @@ static void hpc_set_green_led_off(struct slot *slot)
596{ 605{
597 struct controller *ctrl = slot->ctrl; 606 struct controller *ctrl = slot->ctrl;
598 u16 slot_cmd; 607 u16 slot_cmd;
599 u16 slot_ctrl; 608 u16 cmd_mask;
600 int rc = 0;
601 609
602 DBG_ENTER_ROUTINE 610 DBG_ENTER_ROUTINE
603 611
604 rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 612 slot_cmd = 0x0300;
605 if (rc) { 613 cmd_mask = PWR_LED_CTRL;
606 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 614 if (!pciehp_poll_mode) {
607 return; 615 slot_cmd = slot_cmd | HP_INTR_ENABLE;
616 cmd_mask = cmd_mask | HP_INTR_ENABLE;
608 } 617 }
609 618
610 slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0300; 619 pcie_write_cmd(slot, slot_cmd, cmd_mask);
611
612 if (!pciehp_poll_mode)
613 slot_cmd = slot_cmd | HP_INTR_ENABLE;
614 pcie_write_cmd(slot, slot_cmd);
615 dbg("%s: SLOTCTRL %x write cmd %x\n", 620 dbg("%s: SLOTCTRL %x write cmd %x\n",
616 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 621 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd);
617 622
@@ -623,22 +628,18 @@ static void hpc_set_green_led_blink(struct slot *slot)
623{ 628{
624 struct controller *ctrl = slot->ctrl; 629 struct controller *ctrl = slot->ctrl;
625 u16 slot_cmd; 630 u16 slot_cmd;
626 u16 slot_ctrl; 631 u16 cmd_mask;
627 int rc = 0;
628 632
629 DBG_ENTER_ROUTINE 633 DBG_ENTER_ROUTINE
630 634
631 rc = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 635 slot_cmd = 0x0200;
632 if (rc) { 636 cmd_mask = PWR_LED_CTRL;
633 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__); 637 if (!pciehp_poll_mode) {
634 return; 638 slot_cmd = slot_cmd | HP_INTR_ENABLE;
639 cmd_mask = cmd_mask | HP_INTR_ENABLE;
635 } 640 }
636 641
637 slot_cmd = (slot_ctrl & ~PWR_LED_CTRL) | 0x0200; 642 pcie_write_cmd(slot, slot_cmd, cmd_mask);
638
639 if (!pciehp_poll_mode)
640 slot_cmd = slot_cmd | HP_INTR_ENABLE;
641 pcie_write_cmd(slot, slot_cmd);
642 643
643 dbg("%s: SLOTCTRL %x write cmd %x\n", 644 dbg("%s: SLOTCTRL %x write cmd %x\n",
644 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd); 645 __FUNCTION__, ctrl->cap_base + SLOTCTRL, slot_cmd);
@@ -669,7 +670,8 @@ static int hpc_power_on_slot(struct slot * slot)
669{ 670{
670 struct controller *ctrl = slot->ctrl; 671 struct controller *ctrl = slot->ctrl;
671 u16 slot_cmd; 672 u16 slot_cmd;
672 u16 slot_ctrl, slot_status; 673 u16 cmd_mask;
674 u16 slot_status;
673 int retval = 0; 675 int retval = 0;
674 676
675 DBG_ENTER_ROUTINE 677 DBG_ENTER_ROUTINE
@@ -692,23 +694,23 @@ static int hpc_power_on_slot(struct slot * slot)
692 } 694 }
693 } 695 }
694 696
695 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 697 slot_cmd = POWER_ON;
696 if (retval) { 698 cmd_mask = PWR_CTRL;
697 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__);
698 return retval;
699 }
700
701 slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_ON;
702
703 /* Enable detection that we turned off at slot power-off time */ 699 /* Enable detection that we turned off at slot power-off time */
704 if (!pciehp_poll_mode) 700 if (!pciehp_poll_mode) {
705 slot_cmd = slot_cmd | 701 slot_cmd = slot_cmd |
706 PWR_FAULT_DETECT_ENABLE | 702 PWR_FAULT_DETECT_ENABLE |
707 MRL_DETECT_ENABLE | 703 MRL_DETECT_ENABLE |
708 PRSN_DETECT_ENABLE | 704 PRSN_DETECT_ENABLE |
709 HP_INTR_ENABLE; 705 HP_INTR_ENABLE;
706 cmd_mask = cmd_mask |
707 PWR_FAULT_DETECT_ENABLE |
708 MRL_DETECT_ENABLE |
709 PRSN_DETECT_ENABLE |
710 HP_INTR_ENABLE;
711 }
710 712
711 retval = pcie_write_cmd(slot, slot_cmd); 713 retval = pcie_write_cmd(slot, slot_cmd, cmd_mask);
712 714
713 if (retval) { 715 if (retval) {
714 err("%s: Write %x command failed!\n", __FUNCTION__, slot_cmd); 716 err("%s: Write %x command failed!\n", __FUNCTION__, slot_cmd);
@@ -726,21 +728,15 @@ static int hpc_power_off_slot(struct slot * slot)
726{ 728{
727 struct controller *ctrl = slot->ctrl; 729 struct controller *ctrl = slot->ctrl;
728 u16 slot_cmd; 730 u16 slot_cmd;
729 u16 slot_ctrl; 731 u16 cmd_mask;
730 int retval = 0; 732 int retval = 0;
731 733
732 DBG_ENTER_ROUTINE 734 DBG_ENTER_ROUTINE
733 735
734 dbg("%s: slot->hp_slot %x\n", __FUNCTION__, slot->hp_slot); 736 dbg("%s: slot->hp_slot %x\n", __FUNCTION__, slot->hp_slot);
735 737
736 retval = pciehp_readw(ctrl, SLOTCTRL, &slot_ctrl); 738 slot_cmd = POWER_OFF;
737 if (retval) { 739 cmd_mask = PWR_CTRL;
738 err("%s: Cannot read SLOTCTRL register\n", __FUNCTION__);
739 return retval;
740 }
741
742 slot_cmd = (slot_ctrl & ~PWR_CTRL) | POWER_OFF;
743
744 /* 740 /*
745 * If we get MRL or presence detect interrupts now, the isr 741 * If we get MRL or presence detect interrupts now, the isr
746 * will notice the sticky power-fault bit too and issue power 742 * will notice the sticky power-fault bit too and issue power
@@ -748,14 +744,19 @@ static int hpc_power_off_slot(struct slot * slot)
748 * of command completions, since the power-fault bit remains on 744 * of command completions, since the power-fault bit remains on
749 * till the slot is powered on again. 745 * till the slot is powered on again.
750 */ 746 */
751 if (!pciehp_poll_mode) 747 if (!pciehp_poll_mode) {
752 slot_cmd = (slot_cmd & 748 slot_cmd = (slot_cmd &
753 ~PWR_FAULT_DETECT_ENABLE & 749 ~PWR_FAULT_DETECT_ENABLE &
754 ~MRL_DETECT_ENABLE & 750 ~MRL_DETECT_ENABLE &
755 ~PRSN_DETECT_ENABLE) | HP_INTR_ENABLE; 751 ~PRSN_DETECT_ENABLE) | HP_INTR_ENABLE;
752 cmd_mask = cmd_mask |
753 PWR_FAULT_DETECT_ENABLE |
754 MRL_DETECT_ENABLE |
755 PRSN_DETECT_ENABLE |
756 HP_INTR_ENABLE;
757 }
756 758
757 retval = pcie_write_cmd(slot, slot_cmd); 759 retval = pcie_write_cmd(slot, slot_cmd, cmd_mask);
758
759 if (retval) { 760 if (retval) {
760 err("%s: Write command failed!\n", __FUNCTION__); 761 err("%s: Write command failed!\n", __FUNCTION__);
761 return -1; 762 return -1;
@@ -775,6 +776,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
775 u16 temp_word; 776 u16 temp_word;
776 int hp_slot = 0; /* only 1 slot per PCI Express port */ 777 int hp_slot = 0; /* only 1 slot per PCI Express port */
777 int rc = 0; 778 int rc = 0;
779 unsigned long flags;
778 780
779 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 781 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
780 if (rc) { 782 if (rc) {
@@ -794,10 +796,12 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
794 dbg("%s: intr_loc %x\n", __FUNCTION__, intr_loc); 796 dbg("%s: intr_loc %x\n", __FUNCTION__, intr_loc);
795 /* Mask Hot-plug Interrupt Enable */ 797 /* Mask Hot-plug Interrupt Enable */
796 if (!pciehp_poll_mode) { 798 if (!pciehp_poll_mode) {
799 spin_lock_irqsave(&ctrl->lock, flags);
797 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); 800 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word);
798 if (rc) { 801 if (rc) {
799 err("%s: Cannot read SLOT_CTRL register\n", 802 err("%s: Cannot read SLOT_CTRL register\n",
800 __FUNCTION__); 803 __FUNCTION__);
804 spin_unlock_irqrestore(&ctrl->lock, flags);
801 return IRQ_NONE; 805 return IRQ_NONE;
802 } 806 }
803 807
@@ -808,8 +812,10 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
808 if (rc) { 812 if (rc) {
809 err("%s: Cannot write to SLOTCTRL register\n", 813 err("%s: Cannot write to SLOTCTRL register\n",
810 __FUNCTION__); 814 __FUNCTION__);
815 spin_unlock_irqrestore(&ctrl->lock, flags);
811 return IRQ_NONE; 816 return IRQ_NONE;
812 } 817 }
818 spin_unlock_irqrestore(&ctrl->lock, flags);
813 819
814 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 820 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
815 if (rc) { 821 if (rc) {
@@ -859,10 +865,12 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
859 } 865 }
860 /* Unmask Hot-plug Interrupt Enable */ 866 /* Unmask Hot-plug Interrupt Enable */
861 if (!pciehp_poll_mode) { 867 if (!pciehp_poll_mode) {
868 spin_lock_irqsave(&ctrl->lock, flags);
862 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word); 869 rc = pciehp_readw(ctrl, SLOTCTRL, &temp_word);
863 if (rc) { 870 if (rc) {
864 err("%s: Cannot read SLOTCTRL register\n", 871 err("%s: Cannot read SLOTCTRL register\n",
865 __FUNCTION__); 872 __FUNCTION__);
873 spin_unlock_irqrestore(&ctrl->lock, flags);
866 return IRQ_NONE; 874 return IRQ_NONE;
867 } 875 }
868 876
@@ -873,8 +881,10 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
873 if (rc) { 881 if (rc) {
874 err("%s: Cannot write to SLOTCTRL register\n", 882 err("%s: Cannot write to SLOTCTRL register\n",
875 __FUNCTION__); 883 __FUNCTION__);
884 spin_unlock_irqrestore(&ctrl->lock, flags);
876 return IRQ_NONE; 885 return IRQ_NONE;
877 } 886 }
887 spin_unlock_irqrestore(&ctrl->lock, flags);
878 888
879 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 889 rc = pciehp_readw(ctrl, SLOTSTATUS, &slot_status);
880 if (rc) { 890 if (rc) {
@@ -1237,6 +1247,7 @@ int pcie_init(struct controller * ctrl, struct pcie_device *dev)
1237 1247
1238 mutex_init(&ctrl->crit_sect); 1248 mutex_init(&ctrl->crit_sect);
1239 mutex_init(&ctrl->ctrl_lock); 1249 mutex_init(&ctrl->ctrl_lock);
1250 spin_lock_init(&ctrl->lock);
1240 1251
1241 /* setup wait queue */ 1252 /* setup wait queue */
1242 init_waitqueue_head(&ctrl->queue); 1253 init_waitqueue_head(&ctrl->queue);
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index b5ac810404c0..c8062494009f 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -55,8 +55,6 @@ acpi_query_osc (
55 55
56 status = acpi_evaluate_object(handle, "_OSC", &input, &output); 56 status = acpi_evaluate_object(handle, "_OSC", &input, &output);
57 if (ACPI_FAILURE (status)) { 57 if (ACPI_FAILURE (status)) {
58 printk(KERN_DEBUG
59 "Evaluate _OSC Set fails. Status = 0x%04x\n", status);
60 *ret_status = status; 58 *ret_status = status;
61 return status; 59 return status;
62 } 60 }
@@ -124,11 +122,9 @@ acpi_run_osc (
124 in_params[3].buffer.pointer = (u8 *)context; 122 in_params[3].buffer.pointer = (u8 *)context;
125 123
126 status = acpi_evaluate_object(handle, "_OSC", &input, &output); 124 status = acpi_evaluate_object(handle, "_OSC", &input, &output);
127 if (ACPI_FAILURE (status)) { 125 if (ACPI_FAILURE (status))
128 printk(KERN_DEBUG
129 "Evaluate _OSC Set fails. Status = 0x%04x\n", status);
130 return status; 126 return status;
131 } 127
132 out_obj = output.pointer; 128 out_obj = output.pointer;
133 if (out_obj->type != ACPI_TYPE_BUFFER) { 129 if (out_obj->type != ACPI_TYPE_BUFFER) {
134 printk(KERN_DEBUG 130 printk(KERN_DEBUG
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 6543cbe83be5..10dbdec80416 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -603,6 +603,11 @@ static struct bin_attribute pcie_config_attr = {
603 .write = pci_write_config, 603 .write = pci_write_config,
604}; 604};
605 605
606int __attribute__ ((weak)) pcibios_add_platform_entries(struct pci_dev *dev)
607{
608 return 0;
609}
610
606int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) 611int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
607{ 612{
608 struct bin_attribute *rom_attr = NULL; 613 struct bin_attribute *rom_attr = NULL;
@@ -642,10 +647,14 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
642 } 647 }
643 } 648 }
644 /* add platform-specific attributes */ 649 /* add platform-specific attributes */
645 pcibios_add_platform_entries(pdev); 650 if (pcibios_add_platform_entries(pdev))
651 goto err_rom_file;
646 652
647 return 0; 653 return 0;
648 654
655err_rom_file:
656 if (pci_resource_len(pdev, PCI_ROM_RESOURCE))
657 sysfs_remove_bin_file(&pdev->dev.kobj, rom_attr);
649err_rom: 658err_rom:
650 kfree(rom_attr); 659 kfree(rom_attr);
651err_resource_files: 660err_resource_files:
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index fd47ac0c4730..03fd59e80fef 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -406,6 +406,13 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
406 if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev)) 406 if ((state == PCI_D1 || state == PCI_D2) && pci_no_d1d2(dev))
407 return 0; 407 return 0;
408 408
409 /* find PCI PM capability in list */
410 pm = pci_find_capability(dev, PCI_CAP_ID_PM);
411
412 /* abort if the device doesn't support PM capabilities */
413 if (!pm)
414 return -EIO;
415
409 /* Validate current state: 416 /* Validate current state:
410 * Can enter D0 from any state, but if we can only go deeper 417 * Can enter D0 from any state, but if we can only go deeper
411 * to sleep if we're already in a low power state 418 * to sleep if we're already in a low power state
@@ -418,13 +425,6 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
418 return 0; /* we're already there */ 425 return 0; /* we're already there */
419 426
420 427
421 /* find PCI PM capability in list */
422 pm = pci_find_capability(dev, PCI_CAP_ID_PM);
423
424 /* abort if the device doesn't support PM capabilities */
425 if (!pm)
426 return -EIO;
427
428 pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc); 428 pci_read_config_word(dev,pm + PCI_PM_PMC,&pmc);
429 if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { 429 if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
430 printk(KERN_DEBUG 430 printk(KERN_DEBUG
@@ -1186,6 +1186,11 @@ int pci_set_mwi(struct pci_dev *dev)
1186 return 0; 1186 return 0;
1187} 1187}
1188 1188
1189int pci_try_set_mwi(struct pci_dev *dev)
1190{
1191 return 0;
1192}
1193
1189void pci_clear_mwi(struct pci_dev *dev) 1194void pci_clear_mwi(struct pci_dev *dev)
1190{ 1195{
1191} 1196}
@@ -1242,9 +1247,7 @@ pci_set_cacheline_size(struct pci_dev *dev)
1242 * pci_set_mwi - enables memory-write-invalidate PCI transaction 1247 * pci_set_mwi - enables memory-write-invalidate PCI transaction
1243 * @dev: the PCI device for which MWI is enabled 1248 * @dev: the PCI device for which MWI is enabled
1244 * 1249 *
1245 * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND, 1250 * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
1246 * and then calls @pcibios_set_mwi to do the needed arch specific
1247 * operations or a generic mwi-prep function.
1248 * 1251 *
1249 * RETURNS: An appropriate -ERRNO error value on error, or zero for success. 1252 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
1250 */ 1253 */
@@ -1260,7 +1263,8 @@ pci_set_mwi(struct pci_dev *dev)
1260 1263
1261 pci_read_config_word(dev, PCI_COMMAND, &cmd); 1264 pci_read_config_word(dev, PCI_COMMAND, &cmd);
1262 if (! (cmd & PCI_COMMAND_INVALIDATE)) { 1265 if (! (cmd & PCI_COMMAND_INVALIDATE)) {
1263 pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n", pci_name(dev)); 1266 pr_debug("PCI: Enabling Mem-Wr-Inval for device %s\n",
1267 pci_name(dev));
1264 cmd |= PCI_COMMAND_INVALIDATE; 1268 cmd |= PCI_COMMAND_INVALIDATE;
1265 pci_write_config_word(dev, PCI_COMMAND, cmd); 1269 pci_write_config_word(dev, PCI_COMMAND, cmd);
1266 } 1270 }
@@ -1269,6 +1273,21 @@ pci_set_mwi(struct pci_dev *dev)
1269} 1273}
1270 1274
1271/** 1275/**
1276 * pci_try_set_mwi - enables memory-write-invalidate PCI transaction
1277 * @dev: the PCI device for which MWI is enabled
1278 *
1279 * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
1280 * Callers are not required to check the return value.
1281 *
1282 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
1283 */
1284int pci_try_set_mwi(struct pci_dev *dev)
1285{
1286 int rc = pci_set_mwi(dev);
1287 return rc;
1288}
1289
1290/**
1272 * pci_clear_mwi - disables Memory-Write-Invalidate for device dev 1291 * pci_clear_mwi - disables Memory-Write-Invalidate for device dev
1273 * @dev: the PCI device to disable 1292 * @dev: the PCI device to disable
1274 * 1293 *
@@ -1375,6 +1394,164 @@ pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
1375#endif 1394#endif
1376 1395
1377/** 1396/**
1397 * pcix_get_max_mmrbc - get PCI-X maximum designed memory read byte count
1398 * @dev: PCI device to query
1399 *
1400 * Returns mmrbc: maximum designed memory read count in bytes
1401 * or appropriate error value.
1402 */
1403int pcix_get_max_mmrbc(struct pci_dev *dev)
1404{
1405 int err, cap;
1406 u32 stat;
1407
1408 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
1409 if (!cap)
1410 return -EINVAL;
1411
1412 err = pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat);
1413 if (err)
1414 return -EINVAL;
1415
1416 return (stat & PCI_X_STATUS_MAX_READ) >> 12;
1417}
1418EXPORT_SYMBOL(pcix_get_max_mmrbc);
1419
1420/**
1421 * pcix_get_mmrbc - get PCI-X maximum memory read byte count
1422 * @dev: PCI device to query
1423 *
1424 * Returns mmrbc: maximum memory read count in bytes
1425 * or appropriate error value.
1426 */
1427int pcix_get_mmrbc(struct pci_dev *dev)
1428{
1429 int ret, cap;
1430 u32 cmd;
1431
1432 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
1433 if (!cap)
1434 return -EINVAL;
1435
1436 ret = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd);
1437 if (!ret)
1438 ret = 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2);
1439
1440 return ret;
1441}
1442EXPORT_SYMBOL(pcix_get_mmrbc);
1443
1444/**
1445 * pcix_set_mmrbc - set PCI-X maximum memory read byte count
1446 * @dev: PCI device to query
1447 * @mmrbc: maximum memory read count in bytes
1448 * valid values are 512, 1024, 2048, 4096
1449 *
1450 * If possible sets maximum memory read byte count, some bridges have erratas
1451 * that prevent this.
1452 */
1453int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc)
1454{
1455 int cap, err = -EINVAL;
1456 u32 stat, cmd, v, o;
1457
1458 if (mmrbc < 512 || mmrbc > 4096 || (mmrbc & (mmrbc-1)))
1459 goto out;
1460
1461 v = ffs(mmrbc) - 10;
1462
1463 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
1464 if (!cap)
1465 goto out;
1466
1467 err = pci_read_config_dword(dev, cap + PCI_X_STATUS, &stat);
1468 if (err)
1469 goto out;
1470
1471 if (v > (stat & PCI_X_STATUS_MAX_READ) >> 21)
1472 return -E2BIG;
1473
1474 err = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd);
1475 if (err)
1476 goto out;
1477
1478 o = (cmd & PCI_X_CMD_MAX_READ) >> 2;
1479 if (o != v) {
1480 if (v > o && dev->bus &&
1481 (dev->bus->bus_flags & PCI_BUS_FLAGS_NO_MMRBC))
1482 return -EIO;
1483
1484 cmd &= ~PCI_X_CMD_MAX_READ;
1485 cmd |= v << 2;
1486 err = pci_write_config_dword(dev, cap + PCI_X_CMD, cmd);
1487 }
1488out:
1489 return err;
1490}
1491EXPORT_SYMBOL(pcix_set_mmrbc);
1492
1493/**
1494 * pcie_get_readrq - get PCI Express read request size
1495 * @dev: PCI device to query
1496 *
1497 * Returns maximum memory read request in bytes
1498 * or appropriate error value.
1499 */
1500int pcie_get_readrq(struct pci_dev *dev)
1501{
1502 int ret, cap;
1503 u16 ctl;
1504
1505 cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
1506 if (!cap)
1507 return -EINVAL;
1508
1509 ret = pci_read_config_word(dev, cap + PCI_EXP_DEVCTL, &ctl);
1510 if (!ret)
1511 ret = 128 << ((ctl & PCI_EXP_DEVCTL_READRQ) >> 12);
1512
1513 return ret;
1514}
1515EXPORT_SYMBOL(pcie_get_readrq);
1516
1517/**
1518 * pcie_set_readrq - set PCI Express maximum memory read request
1519 * @dev: PCI device to query
1520 * @count: maximum memory read count in bytes
1521 * valid values are 128, 256, 512, 1024, 2048, 4096
1522 *
1523 * If possible sets maximum read byte count
1524 */
1525int pcie_set_readrq(struct pci_dev *dev, int rq)
1526{
1527 int cap, err = -EINVAL;
1528 u16 ctl, v;
1529
1530 if (rq < 128 || rq > 4096 || (rq & (rq-1)))
1531 goto out;
1532
1533 v = (ffs(rq) - 8) << 12;
1534
1535 cap = pci_find_capability(dev, PCI_CAP_ID_EXP);
1536 if (!cap)
1537 goto out;
1538
1539 err = pci_read_config_word(dev, cap + PCI_EXP_DEVCTL, &ctl);
1540 if (err)
1541 goto out;
1542
1543 if ((ctl & PCI_EXP_DEVCTL_READRQ) != v) {
1544 ctl &= ~PCI_EXP_DEVCTL_READRQ;
1545 ctl |= v;
1546 err = pci_write_config_dword(dev, cap + PCI_EXP_DEVCTL, ctl);
1547 }
1548
1549out:
1550 return err;
1551}
1552EXPORT_SYMBOL(pcie_set_readrq);
1553
1554/**
1378 * pci_select_bars - Make BAR mask from the type of resource 1555 * pci_select_bars - Make BAR mask from the type of resource
1379 * @dev: the PCI device for which BAR mask is made 1556 * @dev: the PCI device for which BAR mask is made
1380 * @flags: resource type mask to be selected 1557 * @flags: resource type mask to be selected
@@ -1442,6 +1619,7 @@ EXPORT_SYMBOL(pci_release_selected_regions);
1442EXPORT_SYMBOL(pci_request_selected_regions); 1619EXPORT_SYMBOL(pci_request_selected_regions);
1443EXPORT_SYMBOL(pci_set_master); 1620EXPORT_SYMBOL(pci_set_master);
1444EXPORT_SYMBOL(pci_set_mwi); 1621EXPORT_SYMBOL(pci_set_mwi);
1622EXPORT_SYMBOL(pci_try_set_mwi);
1445EXPORT_SYMBOL(pci_clear_mwi); 1623EXPORT_SYMBOL(pci_clear_mwi);
1446EXPORT_SYMBOL_GPL(pci_intx); 1624EXPORT_SYMBOL_GPL(pci_intx);
1447EXPORT_SYMBOL(pci_set_dma_mask); 1625EXPORT_SYMBOL(pci_set_dma_mask);
diff --git a/drivers/pci/pcie/aer/Kconfig b/drivers/pci/pcie/aer/Kconfig
index 3f37a60a6438..c3bde588aa13 100644
--- a/drivers/pci/pcie/aer/Kconfig
+++ b/drivers/pci/pcie/aer/Kconfig
@@ -4,7 +4,7 @@
4 4
5config PCIEAER 5config PCIEAER
6 boolean "Root Port Advanced Error Reporting support" 6 boolean "Root Port Advanced Error Reporting support"
7 depends on PCIEPORTBUS && ACPI 7 depends on PCIEPORTBUS
8 default y 8 default y
9 help 9 help
10 This enables PCI Express Root Port Advanced Error Reporting 10 This enables PCI Express Root Port Advanced Error Reporting
diff --git a/drivers/pci/pcie/aer/Makefile b/drivers/pci/pcie/aer/Makefile
index 15a4f40d520b..8da3bd8455a8 100644
--- a/drivers/pci/pcie/aer/Makefile
+++ b/drivers/pci/pcie/aer/Makefile
@@ -4,5 +4,6 @@
4 4
5obj-$(CONFIG_PCIEAER) += aerdriver.o 5obj-$(CONFIG_PCIEAER) += aerdriver.o
6 6
7aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o aerdrv_acpi.o 7aerdriver-objs := aerdrv_errprint.o aerdrv_core.o aerdrv.o
8aerdriver-$(CONFIG_ACPI) += aerdrv_acpi.o
8 9
diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index db6ad8e763ac..6846fb42b399 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -157,7 +157,7 @@ static struct aer_rpc* aer_alloc_rpc(struct pcie_device *dev)
157 * Initialize Root lock access, e_lock, to Root Error Status Reg, 157 * Initialize Root lock access, e_lock, to Root Error Status Reg,
158 * Root Error ID Reg, and Root error producer/consumer index. 158 * Root Error ID Reg, and Root error producer/consumer index.
159 */ 159 */
160 rpc->e_lock = SPIN_LOCK_UNLOCKED; 160 spin_lock_init(&rpc->e_lock);
161 161
162 rpc->rpd = dev; 162 rpc->rpd = dev;
163 INIT_WORK(&rpc->dpc_handler, aer_isr); 163 INIT_WORK(&rpc->dpc_handler, aer_isr);
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h
index 5cca394d5999..c7ad68b6c6d6 100644
--- a/drivers/pci/pcie/aer/aerdrv.h
+++ b/drivers/pci/pcie/aer/aerdrv.h
@@ -19,10 +19,6 @@
19#define AER_ERROR_MASK 0x001fffff 19#define AER_ERROR_MASK 0x001fffff
20#define AER_ERROR(d) (d & AER_ERROR_MASK) 20#define AER_ERROR(d) (d & AER_ERROR_MASK)
21 21
22#define OSC_METHOD_RUN_SUCCESS 0
23#define OSC_METHOD_NOT_SUPPORTED 1
24#define OSC_METHOD_RUN_FAILURE 2
25
26/* Root Error Status Register Bits */ 22/* Root Error Status Register Bits */
27#define ROOT_ERR_STATUS_MASKS 0x0f 23#define ROOT_ERR_STATUS_MASKS 0x0f
28 24
@@ -121,6 +117,14 @@ extern void aer_delete_rootport(struct aer_rpc *rpc);
121extern int aer_init(struct pcie_device *dev); 117extern int aer_init(struct pcie_device *dev);
122extern void aer_isr(struct work_struct *work); 118extern void aer_isr(struct work_struct *work);
123extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); 119extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info);
124extern int aer_osc_setup(struct pci_dev *dev); 120
121#ifdef CONFIG_ACPI
122extern int aer_osc_setup(struct pcie_device *pciedev);
123#else
124static inline int aer_osc_setup(struct pcie_device *pciedev)
125{
126 return 0;
127}
128#endif
125 129
126#endif //_AERDRV_H_ 130#endif //_AERDRV_H_
diff --git a/drivers/pci/pcie/aer/aerdrv_acpi.c b/drivers/pci/pcie/aer/aerdrv_acpi.c
index fa68e89ebec9..1a1eb45a779e 100644
--- a/drivers/pci/pcie/aer/aerdrv_acpi.c
+++ b/drivers/pci/pcie/aer/aerdrv_acpi.c
@@ -20,19 +20,18 @@
20 20
21/** 21/**
22 * aer_osc_setup - run ACPI _OSC method 22 * aer_osc_setup - run ACPI _OSC method
23 * @pciedev: pcie_device which AER is being enabled on
23 * 24 *
24 * Return: 25 * @return: Zero on success. Nonzero otherwise.
25 * Zero if success. Nonzero for otherwise.
26 * 26 *
27 * Invoked when PCIE bus loads AER service driver. To avoid conflict with 27 * Invoked when PCIE bus loads AER service driver. To avoid conflict with
28 * BIOS AER support requires BIOS to yield AER control to OS native driver. 28 * BIOS AER support requires BIOS to yield AER control to OS native driver.
29 **/ 29 **/
30int aer_osc_setup(struct pci_dev *dev) 30int aer_osc_setup(struct pcie_device *pciedev)
31{ 31{
32 int retval = OSC_METHOD_RUN_SUCCESS; 32 acpi_status status = AE_NOT_FOUND;
33 acpi_status status; 33 struct pci_dev *pdev = pciedev->port;
34 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 34 acpi_handle handle = DEVICE_ACPI_HANDLE(&pdev->dev);
35 struct pci_dev *pdev = dev;
36 struct pci_bus *parent; 35 struct pci_bus *parent;
37 36
38 while (!handle) { 37 while (!handle) {
@@ -50,19 +49,20 @@ int aer_osc_setup(struct pci_dev *dev)
50 pdev = parent->self; 49 pdev = parent->self;
51 } 50 }
52 51
53 if (!handle) 52 if (handle) {
54 return OSC_METHOD_NOT_SUPPORTED; 53 pci_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
54 status = pci_osc_control_set(handle,
55 OSC_PCI_EXPRESS_AER_CONTROL |
56 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
57 }
55 58
56 pci_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
57 status = pci_osc_control_set(handle, OSC_PCI_EXPRESS_AER_CONTROL |
58 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
59 if (ACPI_FAILURE(status)) { 59 if (ACPI_FAILURE(status)) {
60 if (status == AE_SUPPORT) 60 printk(KERN_DEBUG "AER service couldn't init device %s - %s\n",
61 retval = OSC_METHOD_NOT_SUPPORTED; 61 pciedev->device.bus_id,
62 else 62 (status == AE_SUPPORT || status == AE_NOT_FOUND) ?
63 retval = OSC_METHOD_RUN_FAILURE; 63 "no _OSC support" : "Run ACPI _OSC fails");
64 return -1;
64 } 65 }
65 66
66 return retval; 67 return 0;
67} 68}
68
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index 08e13033ced8..92a8469b21ba 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -22,8 +22,6 @@
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/suspend.h> 24#include <linux/suspend.h>
25#include <linux/acpi.h>
26#include <linux/pci-acpi.h>
27#include <linux/delay.h> 25#include <linux/delay.h>
28#include "aerdrv.h" 26#include "aerdrv.h"
29 27
@@ -119,6 +117,21 @@ int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
119 return 0; 117 return 0;
120} 118}
121 119
120int pci_cleanup_aer_correct_error_status(struct pci_dev *dev)
121{
122 int pos;
123 u32 status;
124
125 pos = pci_find_aer_capability(dev);
126 if (!pos)
127 return -EIO;
128
129 pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, &status);
130 pci_write_config_dword(dev, pos + PCI_ERR_COR_STATUS, status);
131
132 return 0;
133}
134
122static int find_device_iter(struct device *device, void *data) 135static int find_device_iter(struct device *device, void *data)
123{ 136{
124 struct pci_dev *dev; 137 struct pci_dev *dev;
@@ -733,20 +746,8 @@ void aer_delete_rootport(struct aer_rpc *rpc)
733 **/ 746 **/
734int aer_init(struct pcie_device *dev) 747int aer_init(struct pcie_device *dev)
735{ 748{
736 int status; 749 if (aer_osc_setup(dev) && !forceload)
737 750 return -ENXIO;
738 /* Run _OSC Method */
739 status = aer_osc_setup(dev->port);
740
741 if(status != OSC_METHOD_RUN_SUCCESS) {
742 printk(KERN_DEBUG "%s: AER service init fails - %s\n",
743 __FUNCTION__,
744 (status == OSC_METHOD_NOT_SUPPORTED) ?
745 "No ACPI _OSC support" : "Run ACPI _OSC fails");
746
747 if (!forceload)
748 return status;
749 }
750 751
751 return AER_SUCCESS; 752 return AER_SUCCESS;
752} 753}
@@ -755,4 +756,5 @@ EXPORT_SYMBOL_GPL(pci_find_aer_capability);
755EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting); 756EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting);
756EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting); 757EXPORT_SYMBOL_GPL(pci_disable_pcie_error_reporting);
757EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status); 758EXPORT_SYMBOL_GPL(pci_cleanup_aer_uncorrect_error_status);
759EXPORT_SYMBOL_GPL(pci_cleanup_aer_correct_error_status);
758 760
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 08783bd381f5..a7bce75c6732 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -654,7 +654,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
654 pcibios_assign_all_busses() ? " " : 654 pcibios_assign_all_busses() ? " " :
655 " (try 'pci=assign-busses')"); 655 " (try 'pci=assign-busses')");
656 printk(KERN_WARNING "Please report the result to " 656 printk(KERN_WARNING "Please report the result to "
657 "linux-kernel to fix this permanently\n"); 657 "<bk@suse.de> to fix this permanently\n");
658 } 658 }
659 bus = bus->parent; 659 bus = bus->parent;
660 } 660 }
@@ -700,6 +700,7 @@ static int pci_setup_device(struct pci_dev * dev)
700 dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); 700 dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
701 701
702 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class); 702 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
703 dev->revision = class & 0xff;
703 class >>= 8; /* upper 3 bytes */ 704 class >>= 8; /* upper 3 bytes */
704 dev->class = class; 705 dev->class = class;
705 class >>= 8; 706 class >>= 8;
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 0425a7b7350d..cfa0dfe61b1a 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -480,7 +480,6 @@ static int __init pci_proc_init(void)
480__initcall(pci_proc_init); 480__initcall(pci_proc_init);
481 481
482#ifdef CONFIG_HOTPLUG 482#ifdef CONFIG_HOTPLUG
483EXPORT_SYMBOL(pci_proc_attach_device);
484EXPORT_SYMBOL(pci_proc_detach_bus); 483EXPORT_SYMBOL(pci_proc_detach_bus);
485#endif 484#endif
486 485
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 01d8f8a8843c..c559085c89a5 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);
@@ -627,6 +623,22 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_
627DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic); 623DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_ioapic);
628#endif /* CONFIG_X86_IO_APIC */ 624#endif /* CONFIG_X86_IO_APIC */
629 625
626/*
627 * Some settings of MMRBC can lead to data corruption so block changes.
628 * See AMD 8131 HyperTransport PCI-X Tunnel Revision Guide
629 */
630static void __init quirk_amd_8131_mmrbc(struct pci_dev *dev)
631{
632 unsigned char revid;
633
634 pci_read_config_byte(dev, PCI_REVISION_ID, &revid);
635 if (dev->subordinate && revid <= 0x12) {
636 printk(KERN_INFO "AMD8131 rev %x detected, disabling PCI-X "
637 "MMRBC\n", revid);
638 dev->subordinate->bus_flags |= PCI_BUS_FLAGS_NO_MMRBC;
639 }
640}
641DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_amd_8131_mmrbc);
630 642
631/* 643/*
632 * FIXME: it is questionable that quirk_via_acpi 644 * FIXME: it is questionable that quirk_via_acpi
@@ -843,10 +855,8 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, qu
843static void quirk_disable_pxb(struct pci_dev *pdev) 855static void quirk_disable_pxb(struct pci_dev *pdev)
844{ 856{
845 u16 config; 857 u16 config;
846 u8 rev;
847 858
848 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); 859 if (pdev->revision != 0x04) /* Only C0 requires this */
849 if (rev != 0x04) /* Only C0 requires this */
850 return; 860 return;
851 pci_read_config_word(pdev, 0x40, &config); 861 pci_read_config_word(pdev, 0x40, &config);
852 if (config & (1<<6)) { 862 if (config & (1<<6)) {
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index c13232435dc0..9f7090fa8771 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -139,12 +139,14 @@ struct pci_dev * pci_get_slot(struct pci_bus *bus, unsigned int devfn)
139} 139}
140 140
141/** 141/**
142 * pci_get_bus_and_slot - locate PCI device from a given PCI slot 142 * pci_get_bus_and_slot - locate PCI device from a given PCI bus & slot
143 * @bus: number of PCI bus on which desired PCI device resides 143 * @bus: number of PCI bus on which desired PCI device resides
144 * @devfn: encodes number of PCI slot in which the desired PCI 144 * @devfn: encodes number of PCI slot in which the desired PCI
145 * device resides and the logical device number within that slot 145 * device resides and the logical device number within that slot
146 * in case of multi-function devices. 146 * in case of multi-function devices.
147 * 147 *
148 * Note: the bus/slot search is limited to PCI domain (segment) 0.
149 *
148 * Given a PCI bus and slot/function number, the desired PCI device 150 * Given a PCI bus and slot/function number, the desired PCI device
149 * is located in system global list of PCI devices. If the device 151 * is located in system global list of PCI devices. If the device
150 * is found, a pointer to its data structure is returned. If no 152 * is found, a pointer to its data structure is returned. If no
@@ -157,7 +159,8 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
157 struct pci_dev *dev = NULL; 159 struct pci_dev *dev = NULL;
158 160
159 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 161 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
160 if (dev->bus->number == bus && dev->devfn == devfn) 162 if (pci_domain_nr(dev->bus) == 0 &&
163 (dev->bus->number == bus && dev->devfn == devfn))
161 return dev; 164 return dev;
162 } 165 }
163 return NULL; 166 return NULL;
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 5ec297d7a5b4..5e5191ec8de6 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -34,8 +34,6 @@
34#define DBG(x...) 34#define DBG(x...)
35#endif 35#endif
36 36
37#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
38
39static void pbus_assign_resources_sorted(struct pci_bus *bus) 37static void pbus_assign_resources_sorted(struct pci_bus *bus)
40{ 38{
41 struct pci_dev *dev; 39 struct pci_dev *dev;
@@ -310,7 +308,7 @@ static void pbus_size_io(struct pci_bus *bus)
310#if defined(CONFIG_ISA) || defined(CONFIG_EISA) 308#if defined(CONFIG_ISA) || defined(CONFIG_EISA)
311 size = (size & 0xff) + ((size & ~0xffUL) << 2); 309 size = (size & 0xff) + ((size & ~0xffUL) << 2);
312#endif 310#endif
313 size = ROUND_UP(size + size1, 4096); 311 size = ALIGN(size + size1, 4096);
314 if (!size) { 312 if (!size) {
315 b_res->flags = 0; 313 b_res->flags = 0;
316 return; 314 return;
@@ -378,11 +376,11 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long
378 376
379 if (!align) 377 if (!align)
380 min_align = align1; 378 min_align = align1;
381 else if (ROUND_UP(align + min_align, min_align) < align1) 379 else if (ALIGN(align + min_align, min_align) < align1)
382 min_align = align1 >> 1; 380 min_align = align1 >> 1;
383 align += aligns[order]; 381 align += aligns[order];
384 } 382 }
385 size = ROUND_UP(size, min_align); 383 size = ALIGN(size, min_align);
386 if (!size) { 384 if (!size) {
387 b_res->flags = 0; 385 b_res->flags = 0;
388 return 1; 386 return 1;
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
index 9d37fec27f24..2ac050d7f8cf 100644
--- a/drivers/pci/syscall.c
+++ b/drivers/pci/syscall.c
@@ -23,14 +23,14 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn,
23 u8 byte; 23 u8 byte;
24 u16 word; 24 u16 word;
25 u32 dword; 25 u32 dword;
26 long err, cfg_ret; 26 long err;
27 long cfg_ret;
27 28
28 err = -EPERM;
29 if (!capable(CAP_SYS_ADMIN)) 29 if (!capable(CAP_SYS_ADMIN))
30 goto error; 30 return -EPERM;
31 31
32 err = -ENODEV; 32 err = -ENODEV;
33 dev = pci_find_slot(bus, dfn); 33 dev = pci_get_bus_and_slot(bus, dfn);
34 if (!dev) 34 if (!dev)
35 goto error; 35 goto error;
36 36
@@ -66,7 +66,8 @@ sys_pciconfig_read(unsigned long bus, unsigned long dfn,
66 case 4: 66 case 4:
67 err = put_user(dword, (unsigned int __user *)buf); 67 err = put_user(dword, (unsigned int __user *)buf);
68 break; 68 break;
69 }; 69 }
70 pci_dev_put(dev);
70 return err; 71 return err;
71 72
72error: 73error:
@@ -83,7 +84,8 @@ error:
83 case 4: 84 case 4:
84 put_user(-1, (unsigned int __user *)buf); 85 put_user(-1, (unsigned int __user *)buf);
85 break; 86 break;
86 }; 87 }
88 pci_dev_put(dev);
87 return err; 89 return err;
88} 90}
89 91
@@ -101,7 +103,7 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
101 if (!capable(CAP_SYS_ADMIN)) 103 if (!capable(CAP_SYS_ADMIN))
102 return -EPERM; 104 return -EPERM;
103 105
104 dev = pci_find_slot(bus, dfn); 106 dev = pci_get_bus_and_slot(bus, dfn);
105 if (!dev) 107 if (!dev)
106 return -ENODEV; 108 return -ENODEV;
107 109
@@ -137,8 +139,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
137 default: 139 default:
138 err = -EINVAL; 140 err = -EINVAL;
139 break; 141 break;
140 }; 142 }
141 unlock_kernel(); 143 unlock_kernel();
142 144 pci_dev_put(dev);
143 return err; 145 return err;
144} 146}
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 27852b43b904..1c0d7578e791 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -223,13 +223,8 @@ static int __devinit asd_common_setup(struct asd_ha_struct *asd_ha)
223{ 223{
224 int err, i; 224 int err, i;
225 225
226 err = pci_read_config_byte(asd_ha->pcidev, PCI_REVISION_ID, 226 asd_ha->revision_id = asd_ha->pcidev->revision;
227 &asd_ha->revision_id); 227
228 if (err) {
229 asd_printk("couldn't read REVISION ID register of %s\n",
230 pci_name(asd_ha->pcidev));
231 goto Err;
232 }
233 err = -ENODEV; 228 err = -ENODEV;
234 if (asd_ha->revision_id < AIC9410_DEV_REV_B0) { 229 if (asd_ha->revision_id < AIC9410_DEV_REV_B0) {
235 asd_printk("%s is revision %s (%X), which is not supported\n", 230 asd_printk("%s is revision %s (%X), which is not supported\n",
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 4a3083ea59d5..b3bf77f1ec05 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5373,18 +5373,12 @@ static const u16 ipr_blocked_processors[] = {
5373 **/ 5373 **/
5374static int ipr_invalid_adapter(struct ipr_ioa_cfg *ioa_cfg) 5374static int ipr_invalid_adapter(struct ipr_ioa_cfg *ioa_cfg)
5375{ 5375{
5376 u8 rev_id;
5377 int i; 5376 int i;
5378 5377
5379 if (ioa_cfg->type == 0x5702) { 5378 if ((ioa_cfg->type == 0x5702) && (ioa_cfg->pdev->revision < 4)) {
5380 if (pci_read_config_byte(ioa_cfg->pdev, PCI_REVISION_ID, 5379 for (i = 0; i < ARRAY_SIZE(ipr_blocked_processors); i++){
5381 &rev_id) == PCIBIOS_SUCCESSFUL) { 5380 if (__is_processor(ipr_blocked_processors[i]))
5382 if (rev_id < 4) { 5381 return 1;
5383 for (i = 0; i < ARRAY_SIZE(ipr_blocked_processors); i++){
5384 if (__is_processor(ipr_blocked_processors[i]))
5385 return 1;
5386 }
5387 }
5388 } 5382 }
5389 } 5383 }
5390 return 0; 5384 return 0;
@@ -7541,13 +7535,7 @@ static int __devinit ipr_probe_ioa(struct pci_dev *pdev,
7541 else 7535 else
7542 ioa_cfg->transop_timeout = IPR_OPERATIONAL_TIMEOUT; 7536 ioa_cfg->transop_timeout = IPR_OPERATIONAL_TIMEOUT;
7543 7537
7544 rc = pci_read_config_byte(pdev, PCI_REVISION_ID, &ioa_cfg->revid); 7538 ioa_cfg->revid = pdev->revision;
7545
7546 if (rc != PCIBIOS_SUCCESSFUL) {
7547 dev_err(&pdev->dev, "Failed to read PCI revision ID\n");
7548 rc = -EIO;
7549 goto out_scsi_host_put;
7550 }
7551 7539
7552 ipr_regs_pci = pci_resource_start(pdev, 0); 7540 ipr_regs_pci = pci_resource_start(pdev, 0);
7553 7541
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 8b704f73055a..40f148e0833f 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -7148,7 +7148,6 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
7148 uint32_t mem_addr; 7148 uint32_t mem_addr;
7149 uint32_t io_len; 7149 uint32_t io_len;
7150 uint32_t mem_len; 7150 uint32_t mem_len;
7151 uint8_t revision_id;
7152 uint8_t bus; 7151 uint8_t bus;
7153 uint8_t func; 7152 uint8_t func;
7154 uint8_t irq; 7153 uint8_t irq;
@@ -7227,12 +7226,6 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
7227 } 7226 }
7228 } 7227 }
7229 7228
7230 /* get the revision ID */
7231 if (pci_read_config_byte(pci_dev, PCI_REVISION_ID, &revision_id)) {
7232 IPS_PRINTK(KERN_WARNING, pci_dev, "Can't get revision id.\n");
7233 return -1;
7234 }
7235
7236 subdevice_id = pci_dev->subsystem_device; 7229 subdevice_id = pci_dev->subsystem_device;
7237 7230
7238 /* found a controller */ 7231 /* found a controller */
@@ -7258,7 +7251,7 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
7258 ha->mem_ptr = mem_ptr; 7251 ha->mem_ptr = mem_ptr;
7259 ha->ioremap_ptr = ioremap_ptr; 7252 ha->ioremap_ptr = ioremap_ptr;
7260 ha->host_num = (uint32_t) index; 7253 ha->host_num = (uint32_t) index;
7261 ha->revision_id = revision_id; 7254 ha->revision_id = pci_dev->revision;
7262 ha->slot_num = PCI_SLOT(pci_dev->devfn); 7255 ha->slot_num = PCI_SLOT(pci_dev->devfn);
7263 ha->device_id = pci_dev->device; 7256 ha->device_id = pci_dev->device;
7264 ha->subdevice_id = subdevice_id; 7257 ha->subdevice_id = subdevice_id;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index dcb4ba0ecee1..955b2e48d041 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1578,10 +1578,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1578 INIT_LIST_HEAD(&phba->fc_nodes); 1578 INIT_LIST_HEAD(&phba->fc_nodes);
1579 1579
1580 pci_set_master(pdev); 1580 pci_set_master(pdev);
1581 retval = pci_set_mwi(pdev); 1581 pci_try_set_mwi(pdev);
1582 if (retval)
1583 dev_printk(KERN_WARNING, &pdev->dev,
1584 "Warning: pci_set_mwi returned %d\n", retval);
1585 1582
1586 if (pci_set_dma_mask(phba->pcidev, DMA_64BIT_MASK) != 0) 1583 if (pci_set_dma_mask(phba->pcidev, DMA_64BIT_MASK) != 0)
1587 if (pci_set_dma_mask(phba->pcidev, DMA_32BIT_MASK) != 0) 1584 if (pci_set_dma_mask(phba->pcidev, DMA_32BIT_MASK) != 0)
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index f6f561d26bf0..3e9765f0281d 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -3487,15 +3487,6 @@ static int nsp32_resume(struct pci_dev *pdev)
3487 return 0; 3487 return 0;
3488} 3488}
3489 3489
3490/* Enable wake event */
3491static int nsp32_enable_wake(struct pci_dev *pdev, pci_power_t state, int enable)
3492{
3493 struct Scsi_Host *host = pci_get_drvdata(pdev);
3494
3495 nsp32_msg(KERN_INFO, "pci-enable_wake: stub, pdev=0x%p, enable=%d, slot=%s, host=0x%p", pdev, enable, pci_name(pdev), host);
3496
3497 return 0;
3498}
3499#endif 3490#endif
3500 3491
3501/************************************************************************ 3492/************************************************************************
@@ -3571,7 +3562,6 @@ static struct pci_driver nsp32_driver = {
3571#ifdef CONFIG_PM 3562#ifdef CONFIG_PM
3572 .suspend = nsp32_suspend, 3563 .suspend = nsp32_suspend,
3573 .resume = nsp32_resume, 3564 .resume = nsp32_resume,
3574 .enable_wake = nsp32_enable_wake,
3575#endif 3565#endif
3576}; 3566};
3577 3567
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2a45aec4ff29..cf94f8636ba5 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -296,7 +296,7 @@ qla24xx_pci_config(scsi_qla_host_t *ha)
296 d &= ~PCI_ROM_ADDRESS_ENABLE; 296 d &= ~PCI_ROM_ADDRESS_ENABLE;
297 pci_write_config_dword(ha->pdev, PCI_ROM_ADDRESS, d); 297 pci_write_config_dword(ha->pdev, PCI_ROM_ADDRESS, d);
298 298
299 pci_read_config_word(ha->pdev, PCI_REVISION_ID, &ha->chip_revision); 299 ha->chip_revision = ha->pdev->revision;
300 300
301 /* Get PCI bus information. */ 301 /* Get PCI bus information. */
302 spin_lock_irqsave(&ha->hardware_lock, flags); 302 spin_lock_irqsave(&ha->hardware_lock, flags);
diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index 81792e6eeb2d..6767ee381cd1 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -88,7 +88,7 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
88 spin_lock_init(&brd->bd_intr_lock); 88 spin_lock_init(&brd->bd_intr_lock);
89 89
90 /* store which revision we have */ 90 /* store which revision we have */
91 pci_read_config_byte(pdev, PCI_REVISION_ID, &brd->rev); 91 brd->rev = pdev->revision;
92 92
93 brd->irq = pdev->irq; 93 brd->irq = pdev->irq;
94 94
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index d975ecf18e00..00fda334dc72 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2964,7 +2964,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
2964 , &dev->pci->pcimstctl); 2964 , &dev->pci->pcimstctl);
2965 /* erratum 0115 shouldn't appear: Linux inits PCI_LATENCY_TIMER */ 2965 /* erratum 0115 shouldn't appear: Linux inits PCI_LATENCY_TIMER */
2966 pci_set_master (pdev); 2966 pci_set_master (pdev);
2967 pci_set_mwi (pdev); 2967 pci_try_set_mwi (pdev);
2968 2968
2969 /* ... also flushes any posted pci writes */ 2969 /* ... also flushes any posted pci writes */
2970 dev->chiprev = get_idx_reg (dev->regs, REG_CHIPREV) & 0xffff; 2970 dev->chiprev = get_idx_reg (dev->regs, REG_CHIPREV) & 0xffff;
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 12edc723ec73..966965f72338 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -149,8 +149,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
149 * fixed in newer silicon. 149 * fixed in newer silicon.
150 */ 150 */
151 case 0x0068: 151 case 0x0068:
152 pci_read_config_dword(pdev, PCI_REVISION_ID, &temp); 152 if (pdev->revision < 0xa4)
153 if ((temp & 0xff) < 0xa4)
154 ehci->no_selective_suspend = 1; 153 ehci->no_selective_suspend = 1;
155 break; 154 break;
156 } 155 }
diff --git a/drivers/video/kyro/STG4000InitDevice.c b/drivers/video/kyro/STG4000InitDevice.c
index ab5285a7f1d6..1d3f2080aa6f 100644
--- a/drivers/video/kyro/STG4000InitDevice.c
+++ b/drivers/video/kyro/STG4000InitDevice.c
@@ -247,7 +247,6 @@ int SetCoreClockPLL(volatile STG4000REG __iomem *pSTGReg, struct pci_dev *pDev)
247 u32 ulCoreClock; 247 u32 ulCoreClock;
248 u32 tmp; 248 u32 tmp;
249 u32 ulChipSpeed; 249 u32 ulChipSpeed;
250 u8 rev;
251 250
252 STG_WRITE_REG(IntMask, 0xFFFF); 251 STG_WRITE_REG(IntMask, 0xFFFF);
253 252
@@ -276,9 +275,9 @@ int SetCoreClockPLL(volatile STG4000REG __iomem *pSTGReg, struct pci_dev *pDev)
276 PMX2_SOFTRESET_ROM_RST); 275 PMX2_SOFTRESET_ROM_RST);
277 276
278 pci_read_config_word(pDev, PCI_CONFIG_SUBSYS_ID, &sub); 277 pci_read_config_word(pDev, PCI_CONFIG_SUBSYS_ID, &sub);
279 pci_read_config_byte(pDev, PCI_REVISION_ID, &rev);
280 278
281 ulChipSpeed = InitSDRAMRegisters(pSTGReg, (u32)sub, (u32)rev); 279 ulChipSpeed = InitSDRAMRegisters(pSTGReg, (u32)sub,
280 (u32)pDev->revision);
282 281
283 if (ulChipSpeed == 0) 282 if (ulChipSpeed == 0)
284 return -EINVAL; 283 return -EINVAL;
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index c8559a756b75..886e475f22f2 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -1994,7 +1994,6 @@ static void matroxfb_unregister_device(struct matrox_fb_info* minfo) {
1994 1994
1995static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dummy) { 1995static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dummy) {
1996 struct board* b; 1996 struct board* b;
1997 u_int8_t rev;
1998 u_int16_t svid; 1997 u_int16_t svid;
1999 u_int16_t sid; 1998 u_int16_t sid;
2000 struct matrox_fb_info* minfo; 1999 struct matrox_fb_info* minfo;
@@ -2005,11 +2004,10 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm
2005#endif 2004#endif
2006 DBG(__FUNCTION__) 2005 DBG(__FUNCTION__)
2007 2006
2008 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
2009 svid = pdev->subsystem_vendor; 2007 svid = pdev->subsystem_vendor;
2010 sid = pdev->subsystem_device; 2008 sid = pdev->subsystem_device;
2011 for (b = dev_list; b->vendor; b++) { 2009 for (b = dev_list; b->vendor; b++) {
2012 if ((b->vendor != pdev->vendor) || (b->device != pdev->device) || (b->rev < rev)) continue; 2010 if ((b->vendor != pdev->vendor) || (b->device != pdev->device) || (b->rev < pdev->revision)) continue;
2013 if (b->svid) 2011 if (b->svid)
2014 if ((b->svid != svid) || (b->sid != sid)) continue; 2012 if ((b->svid != svid) || (b->sid != sid)) continue;
2015 break; 2013 break;
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index a30e1e13d8be..93d07ef85276 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -5789,7 +5789,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5789 ivideo->warncount = 0; 5789 ivideo->warncount = 0;
5790 ivideo->chip_id = pdev->device; 5790 ivideo->chip_id = pdev->device;
5791 ivideo->chip_vendor = pdev->vendor; 5791 ivideo->chip_vendor = pdev->vendor;
5792 pci_read_config_byte(pdev, PCI_REVISION_ID, &ivideo->revision_id); 5792 ivideo->revision_id = pdev->revision;
5793 ivideo->SiS_Pr.ChipRevision = ivideo->revision_id; 5793 ivideo->SiS_Pr.ChipRevision = ivideo->revision_id;
5794 pci_read_config_word(pdev, PCI_COMMAND, &reg16); 5794 pci_read_config_word(pdev, PCI_COMMAND, &reg16);
5795 ivideo->sisvga_enabled = reg16 & 0x01; 5795 ivideo->sisvga_enabled = reg16 & 0x01;
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c
index 62fa5500361d..5eff28ce4f4d 100644
--- a/drivers/video/sstfb.c
+++ b/drivers/video/sstfb.c
@@ -1348,7 +1348,7 @@ static int __devinit sstfb_probe(struct pci_dev *pdev,
1348 f_ddprintk("found device : %s\n", spec->name); 1348 f_ddprintk("found device : %s\n", spec->name);
1349 1349
1350 par->dev = pdev; 1350 par->dev = pdev;
1351 pci_read_config_byte(pdev, PCI_REVISION_ID, &par->revision); 1351 par->revision = pdev->revision;
1352 1352
1353 fix->mmio_start = pci_resource_start(pdev,0); 1353 fix->mmio_start = pci_resource_start(pdev,0);
1354 fix->mmio_len = 0x400000; 1354 fix->mmio_len = 0x400000;
diff --git a/drivers/video/tgafb.c b/drivers/video/tgafb.c
index f0fde6ea7c36..5c0dab628099 100644
--- a/drivers/video/tgafb.c
+++ b/drivers/video/tgafb.c
@@ -1625,8 +1625,7 @@ tgafb_register(struct device *dev)
1625 par->tga_regs_base = mem_base + TGA_REGS_OFFSET; 1625 par->tga_regs_base = mem_base + TGA_REGS_OFFSET;
1626 par->tga_type = tga_type; 1626 par->tga_type = tga_type;
1627 if (tga_bus_pci) 1627 if (tga_bus_pci)
1628 pci_read_config_byte(to_pci_dev(dev), PCI_REVISION_ID, 1628 par->tga_chip_rev = (to_pci_dev(dev))->revision;
1629 &par->tga_chip_rev);
1630 if (tga_bus_tc) 1629 if (tga_bus_tc)
1631 par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff; 1630 par->tga_chip_rev = TGA_READ_REG(par, TGA_START_REG) & 0xff;
1632 1631