aboutsummaryrefslogtreecommitdiffstats
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
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 ...
-rw-r--r--Documentation/DMA-mapping.txt103
-rw-r--r--Documentation/pci.txt8
-rw-r--r--Documentation/power/pci.txt37
-rw-r--r--MAINTAINERS5
-rw-r--r--arch/alpha/Kconfig3
-rw-r--r--arch/alpha/kernel/pci_iommu.c32
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c6
-rw-r--r--arch/i386/kernel/cpu/cpufreq/gx-suspmod.c4
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-ich.c4
-rw-r--r--arch/i386/mach-visws/traps.c4
-rw-r--r--arch/i386/pci/fixup.c9
-rw-r--r--arch/ia64/Kconfig6
-rw-r--r--arch/mips/pci/Makefile2
-rw-r--r--arch/mips/pci/fixup-cobalt.c10
-rw-r--r--arch/mips/pci/pci-dac.c79
-rw-r--r--arch/powerpc/Kconfig6
-rw-r--r--arch/powerpc/kernel/pci_32.c4
-rw-r--r--arch/powerpc/kernel/pci_64.c6
-rw-r--r--arch/ppc/Kconfig6
-rw-r--r--arch/ppc/kernel/pci.c6
-rw-r--r--arch/sparc/Kconfig3
-rw-r--r--arch/sparc64/Kconfig6
-rw-r--r--arch/sparc64/kernel/pci.c1
-rw-r--r--arch/x86_64/kernel/pci-dma.c3
-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
-rw-r--r--include/asm-alpha/pci.h29
-rw-r--r--include/asm-arm/pci.h9
-rw-r--r--include/asm-cris/pci.h36
-rw-r--r--include/asm-frv/pci.h7
-rw-r--r--include/asm-h8300/pci.h4
-rw-r--r--include/asm-i386/pci.h37
-rw-r--r--include/asm-ia64/pci.h12
-rw-r--r--include/asm-m68k/pci.h4
-rw-r--r--include/asm-m68knommu/pci.h10
-rw-r--r--include/asm-mips/pci.h18
-rw-r--r--include/asm-parisc/pci.h7
-rw-r--r--include/asm-powerpc/dma-mapping.h1
-rw-r--r--include/asm-powerpc/pci.h20
-rw-r--r--include/asm-ppc/pci.h8
-rw-r--r--include/asm-sh/pci.h9
-rw-r--r--include/asm-sh64/pci.h9
-rw-r--r--include/asm-sparc/pci.h6
-rw-r--r--include/asm-sparc64/pci.h47
-rw-r--r--include/asm-v850/pci.h4
-rw-r--r--include/asm-v850/rte_cb.h1
-rw-r--r--include/asm-x86_64/pci.h44
-rw-r--r--include/asm-xtensa/pci.h7
-rw-r--r--include/linux/aer.h10
-rw-r--r--include/linux/pci.h16
-rw-r--r--include/linux/pci_ids.h74
-rw-r--r--sound/oss/emu10k1/main.c2
-rw-r--r--sound/oss/es1371.c2
-rw-r--r--sound/pci/ali5451/ali5451.c2
-rw-r--r--sound/pci/atiixp.c6
-rw-r--r--sound/pci/atiixp_modem.c5
-rw-r--r--sound/pci/au88x0/au88x0.c6
-rw-r--r--sound/pci/ca0106/ca0106.h1
-rw-r--r--sound/pci/ca0106/ca0106_main.c5
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c4
-rw-r--r--sound/pci/emu10k1/emu10k1x.c2
-rw-r--r--sound/pci/ens1370.c4
-rw-r--r--sound/pci/fm801.c4
-rw-r--r--sound/pci/via82xx.c14
-rw-r--r--sound/pci/via82xx_modem.c4
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c2
172 files changed, 760 insertions, 1401 deletions
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt
index 028614cdd062..e07f2530326b 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/DMA-mapping.txt
@@ -664,109 +664,6 @@ It is that simple.
664Well, not for some odd devices. See the next section for information 664Well, not for some odd devices. See the next section for information
665about that. 665about that.
666 666
667 DAC Addressing for Address Space Hungry Devices
668
669There exists a class of devices which do not mesh well with the PCI
670DMA mapping API. By definition these "mappings" are a finite
671resource. The number of total available mappings per bus is platform
672specific, but there will always be a reasonable amount.
673
674What is "reasonable"? Reasonable means that networking and block I/O
675devices need not worry about using too many mappings.
676
677As an example of a problematic device, consider compute cluster cards.
678They can potentially need to access gigabytes of memory at once via
679DMA. Dynamic mappings are unsuitable for this kind of access pattern.
680
681To this end we've provided a small API by which a device driver
682may use DAC cycles to directly address all of physical memory.
683Not all platforms support this, but most do. It is easy to determine
684whether the platform will work properly at probe time.
685
686First, understand that there may be a SEVERE performance penalty for
687using these interfaces on some platforms. Therefore, you MUST only
688use these interfaces if it is absolutely required. %99 of devices can
689use the normal APIs without any problems.
690
691Note that for streaming type mappings you must either use these
692interfaces, or the dynamic mapping interfaces above. You may not mix
693usage of both for the same device. Such an act is illegal and is
694guaranteed to put a banana in your tailpipe.
695
696However, consistent mappings may in fact be used in conjunction with
697these interfaces. Remember that, as defined, consistent mappings are
698always going to be SAC addressable.
699
700The first thing your driver needs to do is query the PCI platform
701layer if it is capable of handling your devices DAC addressing
702capabilities:
703
704 int pci_dac_dma_supported(struct pci_dev *hwdev, u64 mask);
705
706You may not use the following interfaces if this routine fails.
707
708Next, DMA addresses using this API are kept track of using the
709dma64_addr_t type. It is guaranteed to be big enough to hold any
710DAC address the platform layer will give to you from the following
711routines. If you have consistent mappings as well, you still
712use plain dma_addr_t to keep track of those.
713
714All mappings obtained here will be direct. The mappings are not
715translated, and this is the purpose of this dialect of the DMA API.
716
717All routines work with page/offset pairs. This is the _ONLY_ way to
718portably refer to any piece of memory. If you have a cpu pointer
719(which may be validly DMA'd too) you may easily obtain the page
720and offset using something like this:
721
722 struct page *page = virt_to_page(ptr);
723 unsigned long offset = offset_in_page(ptr);
724
725Here are the interfaces:
726
727 dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
728 struct page *page,
729 unsigned long offset,
730 int direction);
731
732The DAC address for the tuple PAGE/OFFSET are returned. The direction
733argument is the same as for pci_{map,unmap}_single(). The same rules
734for cpu/device access apply here as for the streaming mapping
735interfaces. To reiterate:
736
737 The cpu may touch the buffer before pci_dac_page_to_dma.
738 The device may touch the buffer after pci_dac_page_to_dma
739 is made, but the cpu may NOT.
740
741When the DMA transfer is complete, invoke:
742
743 void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
744 dma64_addr_t dma_addr,
745 size_t len, int direction);
746
747This must be done before the CPU looks at the buffer again.
748This interface behaves identically to pci_dma_sync_{single,sg}_for_cpu().
749
750And likewise, if you wish to let the device get back at the buffer after
751the cpu has read/written it, invoke:
752
753 void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
754 dma64_addr_t dma_addr,
755 size_t len, int direction);
756
757before letting the device access the DMA area again.
758
759If you need to get back to the PAGE/OFFSET tuple from a dma64_addr_t
760the following interfaces are provided:
761
762 struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
763 dma64_addr_t dma_addr);
764 unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
765 dma64_addr_t dma_addr);
766
767This is possible with the DAC interfaces purely because they are
768not translated in any way.
769
770 Optimizing Unmap State Space Consumption 667 Optimizing Unmap State Space Consumption
771 668
772On many platforms, pci_unmap_{single,page}() is simply a nop. 669On many platforms, pci_unmap_{single,page}() is simply a nop.
diff --git a/Documentation/pci.txt b/Documentation/pci.txt
index d38261b67905..7754f5aea4e9 100644
--- a/Documentation/pci.txt
+++ b/Documentation/pci.txt
@@ -113,9 +113,6 @@ initialization with a pointer to a structure describing the driver
113 (Please see Documentation/power/pci.txt for descriptions 113 (Please see Documentation/power/pci.txt for descriptions
114 of PCI Power Management and the related functions.) 114 of PCI Power Management and the related functions.)
115 115
116 enable_wake Enable device to generate wake events from a low power
117 state.
118
119 shutdown Hook into reboot_notifier_list (kernel/sys.c). 116 shutdown Hook into reboot_notifier_list (kernel/sys.c).
120 Intended to stop any idling DMA operations. 117 Intended to stop any idling DMA operations.
121 Useful for enabling wake-on-lan (NIC) or changing 118 Useful for enabling wake-on-lan (NIC) or changing
@@ -299,7 +296,10 @@ If the PCI device can use the PCI Memory-Write-Invalidate transaction,
299call pci_set_mwi(). This enables the PCI_COMMAND bit for Mem-Wr-Inval 296call pci_set_mwi(). This enables the PCI_COMMAND bit for Mem-Wr-Inval
300and also ensures that the cache line size register is set correctly. 297and also ensures that the cache line size register is set correctly.
301Check the return value of pci_set_mwi() as not all architectures 298Check the return value of pci_set_mwi() as not all architectures
302or chip-sets may support Memory-Write-Invalidate. 299or chip-sets may support Memory-Write-Invalidate. Alternatively,
300if Mem-Wr-Inval would be nice to have but is not required, call
301pci_try_set_mwi() to have the system do its best effort at enabling
302Mem-Wr-Inval.
303 303
304 304
3053.2 Request MMIO/IOP resources 3053.2 Request MMIO/IOP resources
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
index e00b099a4b86..dd8fe43888d3 100644
--- a/Documentation/power/pci.txt
+++ b/Documentation/power/pci.txt
@@ -164,7 +164,6 @@ struct pci_driver:
164 164
165 int (*suspend) (struct pci_dev *dev, pm_message_t state); 165 int (*suspend) (struct pci_dev *dev, pm_message_t state);
166 int (*resume) (struct pci_dev *dev); 166 int (*resume) (struct pci_dev *dev);
167 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable);
168 167
169 168
170suspend 169suspend
@@ -251,42 +250,6 @@ The driver should update the current_state field in its pci_dev structure in
251this function, except for PM-capable devices when pci_set_power_state is used. 250this function, except for PM-capable devices when pci_set_power_state is used.
252 251
253 252
254enable_wake
255-----------
256
257Usage:
258
259if (dev->driver && dev->driver->enable_wake)
260 dev->driver->enable_wake(dev,state,enable);
261
262This callback is generally only relevant for devices that support the PCI PM
263spec and have the ability to generate a PME# (Power Management Event Signal)
264to wake the system up. (However, it is possible that a device may support
265some non-standard way of generating a wake event on sleep.)
266
267Bits 15:11 of the PMC (Power Mgmt Capabilities) Register in a device's
268PM Capabilities describe what power states the device supports generating a
269wake event from:
270
271+------------------+
272| Bit | State |
273+------------------+
274| 11 | D0 |
275| 12 | D1 |
276| 13 | D2 |
277| 14 | D3hot |
278| 15 | D3cold |
279+------------------+
280
281A device can use this to enable wake events:
282
283 pci_enable_wake(dev,state,enable);
284
285Note that to enable PME# from D3cold, a value of 4 should be passed to
286pci_enable_wake (since it uses an index into a bitmask). If a driver gets
287a request to enable wake events from D3, two calls should be made to
288pci_enable_wake (one for both D3hot and D3cold).
289
290 253
291A reference implementation 254A reference implementation
292------------------------- 255-------------------------
diff --git a/MAINTAINERS b/MAINTAINERS
index cba5f4df0e21..b2c541591e4f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2814,11 +2814,6 @@ P: Kristen Carlson Accardi
2814M: kristen.c.accardi@intel.com 2814M: kristen.c.accardi@intel.com
2815S: Supported 2815S: Supported
2816 2816
2817PCI HOTPLUG COMPAQ DRIVER
2818P: Greg Kroah-Hartman
2819M: greg@kroah.com
2820S: Maintained
2821
2822PCIE HOTPLUG DRIVER 2817PCIE HOTPLUG DRIVER
2823P: Kristen Carlson Accardi 2818P: Kristen Carlson Accardi
2824M: kristen.c.accardi@intel.com 2819M: kristen.c.accardi@intel.com
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 79c6e5a24456..2a85dc33907c 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -327,6 +327,9 @@ config PCI_DOMAINS
327 bool 327 bool
328 default y 328 default y
329 329
330config PCI_SYSCALL
331 def_bool PCI
332
330config ALPHA_CORE_AGP 333config ALPHA_CORE_AGP
331 bool 334 bool
332 depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL 335 depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 28c84e55feb9..6b07f89a72c7 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -207,6 +207,10 @@ iommu_arena_free(struct pci_iommu_arena *arena, long ofs, long n)
207 p[i] = 0; 207 p[i] = 0;
208} 208}
209 209
210/* True if the machine supports DAC addressing, and DEV can
211 make use of it given MASK. */
212static int pci_dac_dma_supported(struct pci_dev *hwdev, u64 mask);
213
210/* Map a single buffer of the indicated size for PCI DMA in streaming 214/* Map a single buffer of the indicated size for PCI DMA in streaming
211 mode. The 32-bit PCI bus mastering address to use is returned. 215 mode. The 32-bit PCI bus mastering address to use is returned.
212 Once the device is given the dma address, the device owns this memory 216 Once the device is given the dma address, the device owns this memory
@@ -897,7 +901,7 @@ iommu_unbind(struct pci_iommu_arena *arena, long pg_start, long pg_count)
897/* True if the machine supports DAC addressing, and DEV can 901/* True if the machine supports DAC addressing, and DEV can
898 make use of it given MASK. */ 902 make use of it given MASK. */
899 903
900int 904static int
901pci_dac_dma_supported(struct pci_dev *dev, u64 mask) 905pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
902{ 906{
903 dma64_addr_t dac_offset = alpha_mv.pci_dac_offset; 907 dma64_addr_t dac_offset = alpha_mv.pci_dac_offset;
@@ -917,32 +921,6 @@ pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
917 921
918 return ok; 922 return ok;
919} 923}
920EXPORT_SYMBOL(pci_dac_dma_supported);
921
922dma64_addr_t
923pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page,
924 unsigned long offset, int direction)
925{
926 return (alpha_mv.pci_dac_offset
927 + __pa(page_address(page))
928 + (dma64_addr_t) offset);
929}
930EXPORT_SYMBOL(pci_dac_page_to_dma);
931
932struct page *
933pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
934{
935 unsigned long paddr = (dma_addr & PAGE_MASK) - alpha_mv.pci_dac_offset;
936 return virt_to_page(__va(paddr));
937}
938EXPORT_SYMBOL(pci_dac_dma_to_page);
939
940unsigned long
941pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
942{
943 return (dma_addr & ~PAGE_MASK);
944}
945EXPORT_SYMBOL(pci_dac_dma_to_offset);
946 924
947/* Helper for generic DMA-mapping functions. */ 925/* Helper for generic DMA-mapping functions. */
948 926
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 50d9f3e4e0f1..482d33f9ce5b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -531,6 +531,9 @@ config PCI
531 information about which PCI hardware does work under Linux and which 531 information about which PCI hardware does work under Linux and which
532 doesn't. 532 doesn't.
533 533
534config PCI_SYSCALL
535 def_bool PCI
536
534# Select the host bridge type 537# Select the host bridge type
535config PCI_HOST_VIA82C505 538config PCI_HOST_VIA82C505
536 bool 539 bool
diff --git a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
index 0d49d73d1b71..66acd5039918 100644
--- a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
+++ b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
@@ -391,8 +391,6 @@ static struct cpufreq_driver nforce2_driver = {
391 */ 391 */
392static unsigned int nforce2_detect_chipset(void) 392static unsigned int nforce2_detect_chipset(void)
393{ 393{
394 u8 revision;
395
396 nforce2_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_NVIDIA, 394 nforce2_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_NVIDIA,
397 PCI_DEVICE_ID_NVIDIA_NFORCE2, 395 PCI_DEVICE_ID_NVIDIA_NFORCE2,
398 PCI_ANY_ID, PCI_ANY_ID, NULL); 396 PCI_ANY_ID, PCI_ANY_ID, NULL);
@@ -400,10 +398,8 @@ static unsigned int nforce2_detect_chipset(void)
400 if (nforce2_chipset_dev == NULL) 398 if (nforce2_chipset_dev == NULL)
401 return -ENODEV; 399 return -ENODEV;
402 400
403 pci_read_config_byte(nforce2_chipset_dev, PCI_REVISION_ID, &revision);
404
405 printk(KERN_INFO "cpufreq: Detected nForce2 chipset revision %X\n", 401 printk(KERN_INFO "cpufreq: Detected nForce2 chipset revision %X\n",
406 revision); 402 nforce2_chipset_dev->revision);
407 printk(KERN_INFO 403 printk(KERN_INFO
408 "cpufreq: FSB changing is maybe unstable and can lead to crashes and data loss.\n"); 404 "cpufreq: FSB changing is maybe unstable and can lead to crashes and data loss.\n");
409 405
diff --git a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
index 6667e9cceb9f..194144539a6f 100644
--- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
@@ -115,7 +115,6 @@ struct gxfreq_params {
115 u8 pci_suscfg; 115 u8 pci_suscfg;
116 u8 pci_pmer1; 116 u8 pci_pmer1;
117 u8 pci_pmer2; 117 u8 pci_pmer2;
118 u8 pci_rev;
119 struct pci_dev *cs55x0; 118 struct pci_dev *cs55x0;
120}; 119};
121 120
@@ -276,7 +275,7 @@ static void gx_set_cpuspeed(unsigned int khz)
276 pci_write_config_byte(gx_params->cs55x0, PCI_VIDTC, 100);/* typical 50 to 100ms */ 275 pci_write_config_byte(gx_params->cs55x0, PCI_VIDTC, 100);/* typical 50 to 100ms */
277 pci_write_config_byte(gx_params->cs55x0, PCI_PMER1, pmer1); 276 pci_write_config_byte(gx_params->cs55x0, PCI_PMER1, pmer1);
278 277
279 if (gx_params->pci_rev < 0x10) { /* CS5530(rev 1.2, 1.3) */ 278 if (gx_params->cs55x0->revision < 0x10) { /* CS5530(rev 1.2, 1.3) */
280 suscfg = gx_params->pci_suscfg | SUSMOD; 279 suscfg = gx_params->pci_suscfg | SUSMOD;
281 } else { /* CS5530A,B.. */ 280 } else { /* CS5530A,B.. */
282 suscfg = gx_params->pci_suscfg | SUSMOD | PWRSVE; 281 suscfg = gx_params->pci_suscfg | SUSMOD | PWRSVE;
@@ -471,7 +470,6 @@ static int __init cpufreq_gx_init(void)
471 pci_read_config_byte(params->cs55x0, PCI_PMER2, &(params->pci_pmer2)); 470 pci_read_config_byte(params->cs55x0, PCI_PMER2, &(params->pci_pmer2));
472 pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration)); 471 pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration));
473 pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration)); 472 pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration));
474 pci_read_config_byte(params->cs55x0, PCI_REVISION_ID, &params->pci_rev);
475 473
476 if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) { 474 if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) {
477 kfree(params); 475 kfree(params);
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
index 698f980eb443..a5b2346faf1f 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
@@ -205,7 +205,6 @@ static unsigned int speedstep_detect_chipset (void)
205 * host brige. Abort on these systems. 205 * host brige. Abort on these systems.
206 */ 206 */
207 static struct pci_dev *hostbridge; 207 static struct pci_dev *hostbridge;
208 u8 rev = 0;
209 208
210 hostbridge = pci_get_subsys(PCI_VENDOR_ID_INTEL, 209 hostbridge = pci_get_subsys(PCI_VENDOR_ID_INTEL,
211 PCI_DEVICE_ID_INTEL_82815_MC, 210 PCI_DEVICE_ID_INTEL_82815_MC,
@@ -216,8 +215,7 @@ static unsigned int speedstep_detect_chipset (void)
216 if (!hostbridge) 215 if (!hostbridge)
217 return 2; /* 2-M */ 216 return 2; /* 2-M */
218 217
219 pci_read_config_byte(hostbridge, PCI_REVISION_ID, &rev); 218 if (hostbridge->revision < 5) {
220 if (rev < 5) {
221 dprintk("hostbridge does not support speedstep\n"); 219 dprintk("hostbridge does not support speedstep\n");
222 speedstep_chipset_dev = NULL; 220 speedstep_chipset_dev = NULL;
223 pci_dev_put(hostbridge); 221 pci_dev_put(hostbridge);
diff --git a/arch/i386/mach-visws/traps.c b/arch/i386/mach-visws/traps.c
index 5199bd03254a..843b67acf43b 100644
--- a/arch/i386/mach-visws/traps.c
+++ b/arch/i386/mach-visws/traps.c
@@ -23,13 +23,13 @@ static __init void lithium_init(void)
23 set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS); 23 set_fixmap(FIX_LI_PCIB, LI_PCI_B_PHYS);
24 24
25 if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) || 25 if ((li_pcia_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
26 (li_pcia_read16(PCI_DEVICE_ID) != PCI_VENDOR_ID_SGI_LITHIUM)) { 26 (li_pcia_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) {
27 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A'); 27 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'A');
28 panic("This machine is not SGI Visual Workstation 320/540"); 28 panic("This machine is not SGI Visual Workstation 320/540");
29 } 29 }
30 30
31 if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) || 31 if ((li_pcib_read16(PCI_VENDOR_ID) != PCI_VENDOR_ID_SGI) ||
32 (li_pcib_read16(PCI_DEVICE_ID) != PCI_VENDOR_ID_SGI_LITHIUM)) { 32 (li_pcib_read16(PCI_DEVICE_ID) != PCI_DEVICE_ID_SGI_LITHIUM)) {
33 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B'); 33 printk(KERN_EMERG "Lithium hostbridge %c not found\n", 'B');
34 panic("This machine is not SGI Visual Workstation 320/540"); 34 panic("This machine is not SGI Visual Workstation 320/540");
35 } 35 }
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index b95b42950ed4..e7306dbf6c42 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -118,12 +118,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, pci
118static void pci_fixup_via_northbridge_bug(struct pci_dev *d) 118static void pci_fixup_via_northbridge_bug(struct pci_dev *d)
119{ 119{
120 u8 v; 120 u8 v;
121 u8 revision;
122 int where = 0x55; 121 int where = 0x55;
123 int mask = 0x1f; /* clear bits 5, 6, 7 by default */ 122 int mask = 0x1f; /* clear bits 5, 6, 7 by default */
124 123
125 pci_read_config_byte(d, PCI_REVISION_ID, &revision);
126
127 if (d->device == PCI_DEVICE_ID_VIA_8367_0) { 124 if (d->device == PCI_DEVICE_ID_VIA_8367_0) {
128 /* fix pci bus latency issues resulted by NB bios error 125 /* fix pci bus latency issues resulted by NB bios error
129 it appears on bug free^Wreduced kt266x's bios forces 126 it appears on bug free^Wreduced kt266x's bios forces
@@ -133,8 +130,8 @@ static void pci_fixup_via_northbridge_bug(struct pci_dev *d)
133 where = 0x95; /* the memory write queue timer register is 130 where = 0x95; /* the memory write queue timer register is
134 different for the KT266x's: 0x95 not 0x55 */ 131 different for the KT266x's: 0x95 not 0x55 */
135 } else if (d->device == PCI_DEVICE_ID_VIA_8363_0 && 132 } else if (d->device == PCI_DEVICE_ID_VIA_8363_0 &&
136 (revision == VIA_8363_KL133_REVISION_ID || 133 (d->revision == VIA_8363_KL133_REVISION_ID ||
137 revision == VIA_8363_KM133_REVISION_ID)) { 134 d->revision == VIA_8363_KM133_REVISION_ID)) {
138 mask = 0x3f; /* clear only bits 6 and 7; clearing bit 5 135 mask = 0x3f; /* clear only bits 6 and 7; clearing bit 5
139 causes screen corruption on the KL133/KM133 */ 136 causes screen corruption on the KL133/KM133 */
140 } 137 }
@@ -142,7 +139,7 @@ static void pci_fixup_via_northbridge_bug(struct pci_dev *d)
142 pci_read_config_byte(d, where, &v); 139 pci_read_config_byte(d, where, &v);
143 if (v & ~mask) { 140 if (v & ~mask) {
144 printk(KERN_WARNING "Disabling VIA memory write queue (PCI ID %04x, rev %02x): [%02x] %02x & %02x -> %02x\n", \ 141 printk(KERN_WARNING "Disabling VIA memory write queue (PCI ID %04x, rev %02x): [%02x] %02x & %02x -> %02x\n", \
145 d->device, revision, where, v, mask, v & mask); 142 d->device, d->revision, where, v, mask, v & mask);
146 v &= mask; 143 v &= mask;
147 pci_write_config_byte(d, where, v); 144 pci_write_config_byte(d, where, v);
148 } 145 }
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index de1bff659969..db9ddff95841 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -520,8 +520,10 @@ config PCI
520 here unless you are using a simulator without PCI support. 520 here unless you are using a simulator without PCI support.
521 521
522config PCI_DOMAINS 522config PCI_DOMAINS
523 bool 523 def_bool PCI
524 default PCI 524
525config PCI_SYSCALL
526 def_bool PCI
525 527
526source "drivers/pci/pcie/Kconfig" 528source "drivers/pci/pcie/Kconfig"
527 529
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index f26ede001a0b..c58bd3d036f4 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the PCI specific kernel interface routines under Linux. 2# Makefile for the PCI specific kernel interface routines under Linux.
3# 3#
4 4
5obj-y += pci.o pci-dac.o 5obj-y += pci.o
6 6
7# 7#
8# PCI bus host bridge specific code 8# PCI bus host bridge specific code
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
index 7fc475f7eae5..76b4f0ffb1e5 100644
--- a/arch/mips/pci/fixup-cobalt.c
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -58,8 +58,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1,
58 58
59static void qube_raq_galileo_fixup(struct pci_dev *dev) 59static void qube_raq_galileo_fixup(struct pci_dev *dev)
60{ 60{
61 unsigned short galileo_id;
62
63 if (dev->devfn != PCI_DEVFN(0, 0)) 61 if (dev->devfn != PCI_DEVFN(0, 0))
64 return; 62 return;
65 63
@@ -84,16 +82,14 @@ static void qube_raq_galileo_fixup(struct pci_dev *dev)
84 * Therefore we must set the disconnect/retry cycle values to 82 * Therefore we must set the disconnect/retry cycle values to
85 * something sensible when using the new Galileo. 83 * something sensible when using the new Galileo.
86 */ 84 */
87 pci_read_config_word(dev, PCI_REVISION_ID, &galileo_id);
88 galileo_id &= 0xff; /* mask off class info */
89 85
90 printk(KERN_INFO "Galileo: revision %u\n", galileo_id); 86 printk(KERN_INFO "Galileo: revision %u\n", dev->revision);
91 87
92#if 0 88#if 0
93 if (galileo_id >= 0x10) { 89 if (dev->revision >= 0x10) {
94 /* New Galileo, assumes PCI stop line to VIA is connected. */ 90 /* New Galileo, assumes PCI stop line to VIA is connected. */
95 GT_WRITE(GT_PCI0_TOR_OFS, 0x4020); 91 GT_WRITE(GT_PCI0_TOR_OFS, 0x4020);
96 } else if (galileo_id == 0x1 || galileo_id == 0x2) 92 } else if (dev->revision == 0x1 || dev->revision == 0x2)
97#endif 93#endif
98 { 94 {
99 signed int timeo; 95 signed int timeo;
diff --git a/arch/mips/pci/pci-dac.c b/arch/mips/pci/pci-dac.c
deleted file mode 100644
index 0f0ea1b7d4dd..000000000000
--- a/arch/mips/pci/pci-dac.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000 Ani Joshi <ajoshi@unixbox.com>
7 * Copyright (C) 2000, 2001, 06 Ralf Baechle <ralf@linux-mips.org>
8 * swiped from i386, and cloned for MIPS by Geert, polished by Ralf.
9 */
10
11#include <linux/types.h>
12#include <linux/dma-mapping.h>
13#include <linux/mm.h>
14#include <linux/module.h>
15#include <linux/string.h>
16
17#include <asm/cache.h>
18#include <asm/io.h>
19
20#include <dma-coherence.h>
21
22#include <linux/pci.h>
23
24dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
25 struct page *page, unsigned long offset, int direction)
26{
27 struct device *dev = &pdev->dev;
28
29 BUG_ON(direction == DMA_NONE);
30
31 if (!plat_device_is_coherent(dev)) {
32 unsigned long addr;
33
34 addr = (unsigned long) page_address(page) + offset;
35 dma_cache_wback_inv(addr, PAGE_SIZE);
36 }
37
38 return plat_map_dma_mem_page(dev, page) + offset;
39}
40
41EXPORT_SYMBOL(pci_dac_page_to_dma);
42
43struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
44 dma64_addr_t dma_addr)
45{
46 return pfn_to_page(plat_dma_addr_to_phys(dma_addr) >> PAGE_SHIFT);
47}
48
49EXPORT_SYMBOL(pci_dac_dma_to_page);
50
51unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
52 dma64_addr_t dma_addr)
53{
54 return dma_addr & ~PAGE_MASK;
55}
56
57EXPORT_SYMBOL(pci_dac_dma_to_offset);
58
59void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
60 dma64_addr_t dma_addr, size_t len, int direction)
61{
62 BUG_ON(direction == PCI_DMA_NONE);
63
64 if (!plat_device_is_coherent(&pdev->dev))
65 dma_cache_wback_inv(dma_addr + PAGE_OFFSET, len);
66}
67
68EXPORT_SYMBOL(pci_dac_dma_sync_single_for_cpu);
69
70void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
71 dma64_addr_t dma_addr, size_t len, int direction)
72{
73 BUG_ON(direction == PCI_DMA_NONE);
74
75 if (!plat_device_is_coherent(&pdev->dev))
76 dma_cache_wback_inv(dma_addr + PAGE_OFFSET, len);
77}
78
79EXPORT_SYMBOL(pci_dac_dma_sync_single_for_device);
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 5eaeafd30bdf..6beee32144c0 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -698,8 +698,10 @@ config PCI
698 infrastructure code to support PCI bus devices. 698 infrastructure code to support PCI bus devices.
699 699
700config PCI_DOMAINS 700config PCI_DOMAINS
701 bool 701 def_bool PCI
702 default PCI 702
703config PCI_SYSCALL
704 def_bool PCI
703 705
704config PCI_QSPAN 706config PCI_QSPAN
705 bool "QSpan PCI" 707 bool "QSpan PCI"
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index e66064b5093a..86982112b0dd 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -1047,10 +1047,10 @@ void pcibios_make_OF_bus_map(void)
1047#endif /* CONFIG_PPC_OF */ 1047#endif /* CONFIG_PPC_OF */
1048 1048
1049/* Add sysfs properties */ 1049/* Add sysfs properties */
1050void pcibios_add_platform_entries(struct pci_dev *pdev) 1050int pcibios_add_platform_entries(struct pci_dev *pdev)
1051{ 1051{
1052#ifdef CONFIG_PPC_OF 1052#ifdef CONFIG_PPC_OF
1053 device_create_file(&pdev->dev, &dev_attr_devspec); 1053 return device_create_file(&pdev->dev, &dev_attr_devspec);
1054#endif /* CONFIG_PPC_OF */ 1054#endif /* CONFIG_PPC_OF */
1055} 1055}
1056 1056
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 249cca27a9b8..e3009a43ac56 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -367,8 +367,10 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
367 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), 367 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
368 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); 368 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
369 dev->class = get_int_prop(node, "class-code", 0); 369 dev->class = get_int_prop(node, "class-code", 0);
370 dev->revision = get_int_prop(node, "revision-id", 0);
370 371
371 DBG(" class: 0x%x\n", dev->class); 372 DBG(" class: 0x%x\n", dev->class);
373 DBG(" revision: 0x%x\n", dev->revision);
372 374
373 dev->current_state = 4; /* unknown power state */ 375 dev->current_state = 4; /* unknown power state */
374 dev->error_state = pci_channel_io_normal; 376 dev->error_state = pci_channel_io_normal;
@@ -876,9 +878,9 @@ static ssize_t pci_show_devspec(struct device *dev,
876} 878}
877static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL); 879static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
878 880
879void pcibios_add_platform_entries(struct pci_dev *pdev) 881int pcibios_add_platform_entries(struct pci_dev *pdev)
880{ 882{
881 device_create_file(&pdev->dev, &dev_attr_devspec); 883 return device_create_file(&pdev->dev, &dev_attr_devspec);
882} 884}
883 885
884#define ISA_SPACE_MASK 0x1 886#define ISA_SPACE_MASK 0x1
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index ccce2a4a1522..6bdeeb70b157 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -1237,8 +1237,10 @@ config PCI
1237 infrastructure code to support PCI bus devices. 1237 infrastructure code to support PCI bus devices.
1238 1238
1239config PCI_DOMAINS 1239config PCI_DOMAINS
1240 bool 1240 def_bool PCI
1241 default PCI 1241
1242config PCI_SYSCALL
1243 def_bool PCI
1242 1244
1243config MPC83xx_PCI2 1245config MPC83xx_PCI2
1244 bool "Support for 2nd PCI host controller" 1246 bool "Support for 2nd PCI host controller"
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index 5e723c4c2571..c2ec13bea006 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -633,12 +633,6 @@ void pcibios_make_OF_bus_map(void)
633{ 633{
634} 634}
635 635
636/* Add sysfs properties */
637void pcibios_add_platform_entries(struct pci_dev *pdev)
638{
639}
640
641
642static int __init 636static int __init
643pcibios_init(void) 637pcibios_init(void)
644{ 638{
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index fbcc00c6c06e..8567cc901942 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -210,6 +210,9 @@ config PCI
210 CP-1200, JavaEngine-1, Corona, Red October, and Serengeti SGSC. 210 CP-1200, JavaEngine-1, Corona, Red October, and Serengeti SGSC.
211 All of these platforms are extremely obscure, so say N if unsure. 211 All of these platforms are extremely obscure, so say N if unsure.
212 212
213config PCI_SYSCALL
214 def_bool PCI
215
213source "drivers/pci/Kconfig" 216source "drivers/pci/Kconfig"
214 217
215endif 218endif
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 89a1b469b93d..6566d13db04f 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -320,8 +320,10 @@ config PCI
320 doesn't. 320 doesn't.
321 321
322config PCI_DOMAINS 322config PCI_DOMAINS
323 bool 323 def_bool PCI
324 default PCI 324
325config PCI_SYSCALL
326 def_bool PCI
325 327
326source "drivers/pci/Kconfig" 328source "drivers/pci/Kconfig"
327 329
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 81f4a5ea05f7..55ad1b899bb8 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -448,6 +448,7 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
448 */ 448 */
449 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class); 449 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
450 dev->class = class >> 8; 450 dev->class = class >> 8;
451 dev->revision = class & 0xff;
451 452
452 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), 453 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
453 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); 454 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 9f80aad3fe2d..90f6315d02d4 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -22,8 +22,7 @@ EXPORT_SYMBOL(bad_dma_address);
22int iommu_bio_merge __read_mostly = 0; 22int iommu_bio_merge __read_mostly = 0;
23EXPORT_SYMBOL(iommu_bio_merge); 23EXPORT_SYMBOL(iommu_bio_merge);
24 24
25int iommu_sac_force __read_mostly = 0; 25static int iommu_sac_force __read_mostly = 0;
26EXPORT_SYMBOL(iommu_sac_force);
27 26
28int no_iommu __read_mostly; 27int no_iommu __read_mostly;
29#ifdef CONFIG_IOMMU_DEBUG 28#ifdef CONFIG_IOMMU_DEBUG
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
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index 85aa1127c903..30ee7669b19f 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -199,30 +199,6 @@ pci_dma_sync_sg_for_device(struct pci_dev *dev, struct scatterlist *sg,
199 199
200extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask); 200extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask);
201 201
202/* True if the machine supports DAC addressing, and DEV can
203 make use of it given MASK. */
204extern int pci_dac_dma_supported(struct pci_dev *hwdev, u64 mask);
205
206/* Convert to/from DAC dma address and struct page. */
207extern dma64_addr_t pci_dac_page_to_dma(struct pci_dev *, struct page *,
208 unsigned long, int);
209extern struct page *pci_dac_dma_to_page(struct pci_dev *, dma64_addr_t);
210extern unsigned long pci_dac_dma_to_offset(struct pci_dev *, dma64_addr_t);
211
212static inline void
213pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr,
214 size_t len, int direction)
215{
216 /* Nothing to do. */
217}
218
219static inline void
220pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr,
221 size_t len, int direction)
222{
223 /* Nothing to do. */
224}
225
226#ifdef CONFIG_PCI 202#ifdef CONFIG_PCI
227static inline void pci_dma_burst_advice(struct pci_dev *pdev, 203static inline void pci_dma_burst_advice(struct pci_dev *pdev,
228 enum pci_dma_burst_strategy *strat, 204 enum pci_dma_burst_strategy *strat,
@@ -275,11 +251,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
275 return hose->need_domain_info; 251 return hose->need_domain_info;
276} 252}
277 253
278static inline void
279pcibios_add_platform_entries(struct pci_dev *dev)
280{
281}
282
283struct pci_dev *alpha_gendev_to_pci(struct device *dev); 254struct pci_dev *alpha_gendev_to_pci(struct device *dev);
284 255
285#endif /* __KERNEL__ */ 256#endif /* __KERNEL__ */
diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h
index f21abd4ddac6..ed3f898191f4 100644
--- a/include/asm-arm/pci.h
+++ b/include/asm-arm/pci.h
@@ -26,11 +26,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
26#define PCI_DMA_BUS_IS_PHYS (0) 26#define PCI_DMA_BUS_IS_PHYS (0)
27 27
28/* 28/*
29 * We don't support DAC DMA cycles.
30 */
31#define pci_dac_dma_supported(pci_dev, mask) (0)
32
33/*
34 * Whether pci_unmap_{single,page} is a nop depends upon the 29 * Whether pci_unmap_{single,page} is a nop depends upon the
35 * configuration. 30 * configuration.
36 */ 31 */
@@ -76,10 +71,6 @@ pcibios_select_root(struct pci_dev *pdev, struct resource *res)
76 return root; 71 return root;
77} 72}
78 73
79static inline void pcibios_add_platform_entries(struct pci_dev *dev)
80{
81}
82
83#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
84 75
85#endif 76#endif
diff --git a/include/asm-cris/pci.h b/include/asm-cris/pci.h
index b2ac8a331da1..730ce40fdd0f 100644
--- a/include/asm-cris/pci.h
+++ b/include/asm-cris/pci.h
@@ -52,47 +52,11 @@ struct pci_dev;
52#define pci_unmap_len(PTR, LEN_NAME) (0) 52#define pci_unmap_len(PTR, LEN_NAME) (0)
53#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 53#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
54 54
55/* This is always fine. */
56#define pci_dac_dma_supported(pci_dev, mask) (1)
57
58static inline dma64_addr_t
59pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
60{
61 return ((dma64_addr_t) page_to_phys(page) +
62 (dma64_addr_t) offset);
63}
64
65static inline struct page *
66pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
67{
68 return pfn_to_page(dma_addr >> PAGE_SHIFT);
69}
70
71static inline unsigned long
72pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
73{
74 return (dma_addr & ~PAGE_MASK);
75}
76
77static inline void
78pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
79{
80}
81
82static inline void
83pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
84{
85}
86
87#define HAVE_PCI_MMAP 55#define HAVE_PCI_MMAP
88extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 56extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
89 enum pci_mmap_state mmap_state, int write_combine); 57 enum pci_mmap_state mmap_state, int write_combine);
90 58
91 59
92static inline void pcibios_add_platform_entries(struct pci_dev *dev)
93{
94}
95
96#endif /* __KERNEL__ */ 60#endif /* __KERNEL__ */
97 61
98/* implement the pci_ DMA API in terms of the generic device dma_ one */ 62/* implement the pci_ DMA API in terms of the generic device dma_ one */
diff --git a/include/asm-frv/pci.h b/include/asm-frv/pci.h
index f35a4511e7b9..585d9b49949a 100644
--- a/include/asm-frv/pci.h
+++ b/include/asm-frv/pci.h
@@ -22,10 +22,6 @@ struct pci_dev;
22 22
23#define pcibios_assign_all_busses() 0 23#define pcibios_assign_all_busses() 0
24 24
25static inline void pcibios_add_platform_entries(struct pci_dev *dev)
26{
27}
28
29extern void pcibios_set_master(struct pci_dev *dev); 25extern void pcibios_set_master(struct pci_dev *dev);
30 26
31extern void pcibios_penalize_isa_irq(int irq); 27extern void pcibios_penalize_isa_irq(int irq);
@@ -44,9 +40,6 @@ extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
44extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, 40extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
45 void *vaddr, dma_addr_t dma_handle); 41 void *vaddr, dma_addr_t dma_handle);
46 42
47/* This is always fine. */
48#define pci_dac_dma_supported(pci_dev, mask) (1)
49
50/* Return the index of the PCI controller for device PDEV. */ 43/* Return the index of the PCI controller for device PDEV. */
51#define pci_controller_num(PDEV) (0) 44#define pci_controller_num(PDEV) (0)
52 45
diff --git a/include/asm-h8300/pci.h b/include/asm-h8300/pci.h
index 0c771b05fdd5..97389b35aa35 100644
--- a/include/asm-h8300/pci.h
+++ b/include/asm-h8300/pci.h
@@ -22,8 +22,4 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
22 22
23#define PCI_DMA_BUS_IS_PHYS (1) 23#define PCI_DMA_BUS_IS_PHYS (1)
24 24
25static inline void pcibios_add_platform_entries(struct pci_dev *dev)
26{
27}
28
29#endif /* _ASM_H8300_PCI_H */ 25#endif /* _ASM_H8300_PCI_H */
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index 64b6d0baedbc..392d3fe5d45e 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -56,48 +56,11 @@ struct pci_dev;
56#define pci_unmap_len(PTR, LEN_NAME) (0) 56#define pci_unmap_len(PTR, LEN_NAME) (0)
57#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 57#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
58 58
59/* This is always fine. */
60#define pci_dac_dma_supported(pci_dev, mask) (1)
61
62static inline dma64_addr_t
63pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
64{
65 return ((dma64_addr_t) page_to_phys(page) +
66 (dma64_addr_t) offset);
67}
68
69static inline struct page *
70pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
71{
72 return pfn_to_page(dma_addr >> PAGE_SHIFT);
73}
74
75static inline unsigned long
76pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
77{
78 return (dma_addr & ~PAGE_MASK);
79}
80
81static inline void
82pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
83{
84}
85
86static inline void
87pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
88{
89 flush_write_buffers();
90}
91
92#define HAVE_PCI_MMAP 59#define HAVE_PCI_MMAP
93extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 60extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
94 enum pci_mmap_state mmap_state, int write_combine); 61 enum pci_mmap_state mmap_state, int write_combine);
95 62
96 63
97static inline void pcibios_add_platform_entries(struct pci_dev *dev)
98{
99}
100
101#ifdef CONFIG_PCI 64#ifdef CONFIG_PCI
102static inline void pci_dma_burst_advice(struct pci_dev *pdev, 65static inline void pci_dma_burst_advice(struct pci_dev *pdev,
103 enum pci_dma_burst_strategy *strat, 66 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index 5a5d1c2ce39d..3523d2584598 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -71,14 +71,6 @@ pcibios_penalize_isa_irq (int irq, int active)
71#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ 71#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
72 (((PTR)->LEN_NAME) = (VAL)) 72 (((PTR)->LEN_NAME) = (VAL))
73 73
74/* The ia64 platform always supports 64-bit addressing. */
75#define pci_dac_dma_supported(pci_dev, mask) (1)
76#define pci_dac_page_to_dma(dev,pg,off,dir) ((dma_addr_t) page_to_bus(pg) + (off))
77#define pci_dac_dma_to_page(dev,dma_addr) (virt_to_page(bus_to_virt(dma_addr)))
78#define pci_dac_dma_to_offset(dev,dma_addr) offset_in_page(dma_addr)
79#define pci_dac_dma_sync_single_for_cpu(dev,dma_addr,len,dir) do { } while (0)
80#define pci_dac_dma_sync_single_for_device(dev,dma_addr,len,dir) do { mb(); } while (0)
81
82#ifdef CONFIG_PCI 74#ifdef CONFIG_PCI
83static inline void pci_dma_burst_advice(struct pci_dev *pdev, 75static inline void pci_dma_burst_advice(struct pci_dev *pdev,
84 enum pci_dma_burst_strategy *strat, 76 enum pci_dma_burst_strategy *strat,
@@ -143,10 +135,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
143 return (pci_domain_nr(bus) != 0); 135 return (pci_domain_nr(bus) != 0);
144} 136}
145 137
146static inline void pcibios_add_platform_entries(struct pci_dev *dev)
147{
148}
149
150extern void pcibios_resource_to_bus(struct pci_dev *dev, 138extern void pcibios_resource_to_bus(struct pci_dev *dev,
151 struct pci_bus_region *region, struct resource *res); 139 struct pci_bus_region *region, struct resource *res);
152 140
diff --git a/include/asm-m68k/pci.h b/include/asm-m68k/pci.h
index 9d2c07abe44f..678cb0b52314 100644
--- a/include/asm-m68k/pci.h
+++ b/include/asm-m68k/pci.h
@@ -54,8 +54,4 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
54 */ 54 */
55#define PCI_DMA_BUS_IS_PHYS (1) 55#define PCI_DMA_BUS_IS_PHYS (1)
56 56
57static inline void pcibios_add_platform_entries(struct pci_dev *dev)
58{
59}
60
61#endif /* _ASM_M68K_PCI_H */ 57#endif /* _ASM_M68K_PCI_H */
diff --git a/include/asm-m68knommu/pci.h b/include/asm-m68knommu/pci.h
index e04c77e1184d..a13f3cc87451 100644
--- a/include/asm-m68knommu/pci.h
+++ b/include/asm-m68knommu/pci.h
@@ -24,16 +24,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
24 return 1; 24 return 1;
25} 25}
26 26
27/*
28 * Not supporting more than 32-bit PCI bus addresses now, but
29 * must satisfy references to this function. Change if needed.
30 */
31#define pci_dac_dma_supported(pci_dev, mask) (0)
32
33static inline void pcibios_add_platform_entries(struct pci_dev *dev)
34{
35}
36
37#endif /* CONFIG_COMEMPCI */ 27#endif /* CONFIG_COMEMPCI */
38 28
39#endif /* M68KNOMMU_PCI_H */ 29#endif /* M68KNOMMU_PCI_H */
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index a59d54749eef..4fcc185cb2d1 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -121,20 +121,6 @@ extern unsigned int PCI_DMA_BUS_IS_PHYS;
121 121
122#endif /* CONFIG_DMA_NEED_PCI_MAP_STATE */ 122#endif /* CONFIG_DMA_NEED_PCI_MAP_STATE */
123 123
124/* This is always fine. */
125#define pci_dac_dma_supported(pci_dev, mask) (1)
126
127extern dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
128 struct page *page, unsigned long offset, int direction);
129extern struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
130 dma64_addr_t dma_addr);
131extern unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
132 dma64_addr_t dma_addr);
133extern void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
134 dma64_addr_t dma_addr, size_t len, int direction);
135extern void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
136 dma64_addr_t dma_addr, size_t len, int direction);
137
138#ifdef CONFIG_PCI 124#ifdef CONFIG_PCI
139static inline void pci_dma_burst_advice(struct pci_dev *pdev, 125static inline void pci_dma_burst_advice(struct pci_dev *pdev,
140 enum pci_dma_burst_strategy *strat, 126 enum pci_dma_burst_strategy *strat,
@@ -181,10 +167,6 @@ static inline int pci_proc_domain(struct pci_bus *bus)
181/* implement the pci_ DMA API in terms of the generic device dma_ one */ 167/* implement the pci_ DMA API in terms of the generic device dma_ one */
182#include <asm-generic/pci-dma-compat.h> 168#include <asm-generic/pci-dma-compat.h>
183 169
184static inline void pcibios_add_platform_entries(struct pci_dev *dev)
185{
186}
187
188/* Do platform specific device initialization at pci_enable_device() time */ 170/* Do platform specific device initialization at pci_enable_device() time */
189extern int pcibios_plat_dev_init(struct pci_dev *dev); 171extern int pcibios_plat_dev_init(struct pci_dev *dev);
190 172
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index 7b3be9ac0dda..61fbd57a8323 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -238,9 +238,6 @@ extern inline void pcibios_register_hba(struct pci_hba_data *x)
238#define PCIBIOS_MIN_IO 0x10 238#define PCIBIOS_MIN_IO 0x10
239#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */ 239#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */
240 240
241/* Don't support DAC yet. */
242#define pci_dac_dma_supported(pci_dev, mask) (0)
243
244/* export the pci_ DMA API in terms of the dma_ one */ 241/* export the pci_ DMA API in terms of the dma_ one */
245#include <asm-generic/pci-dma-compat.h> 242#include <asm-generic/pci-dma-compat.h>
246 243
@@ -284,10 +281,6 @@ pcibios_select_root(struct pci_dev *pdev, struct resource *res)
284 return root; 281 return root;
285} 282}
286 283
287static inline void pcibios_add_platform_entries(struct pci_dev *dev)
288{
289}
290
291static inline void pcibios_penalize_isa_irq(int irq, int active) 284static inline void pcibios_penalize_isa_irq(int irq, int active)
292{ 285{
293 /* We don't need to penalize isa irq's */ 286 /* We don't need to penalize isa irq's */
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index a19a6f1a1cf1..f6bd804d9090 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -61,7 +61,6 @@ struct dma_mapping_ops {
61 void (*unmap_sg)(struct device *dev, struct scatterlist *sg, 61 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
62 int nents, enum dma_data_direction direction); 62 int nents, enum dma_data_direction direction);
63 int (*dma_supported)(struct device *dev, u64 mask); 63 int (*dma_supported)(struct device *dev, u64 mask);
64 int (*dac_dma_supported)(struct device *dev, u64 mask);
65 int (*set_dma_mask)(struct device *dev, u64 dma_mask); 64 int (*set_dma_mask)(struct device *dev, u64 dma_mask);
66}; 65};
67 66
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index ce0f13e8eb14..e16e7bc9ab5c 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -74,18 +74,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
74extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops); 74extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
75extern struct dma_mapping_ops *get_pci_dma_ops(void); 75extern struct dma_mapping_ops *get_pci_dma_ops(void);
76 76
77/* For DAC DMA, we currently don't support it by default, but
78 * we let 64-bit platforms override this.
79 */
80static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
81{
82 struct dma_mapping_ops *d = get_pci_dma_ops();
83
84 if (d && d->dac_dma_supported)
85 return d->dac_dma_supported(&hwdev->dev, mask);
86 return 0;
87}
88
89static inline void pci_dma_burst_advice(struct pci_dev *pdev, 77static inline void pci_dma_burst_advice(struct pci_dev *pdev,
90 enum pci_dma_burst_strategy *strat, 78 enum pci_dma_burst_strategy *strat,
91 unsigned long *strategy_parameter) 79 unsigned long *strategy_parameter)
@@ -124,12 +112,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
124} 112}
125#endif 113#endif
126 114
127/*
128 * At present there are very few 32-bit PPC machines that can have
129 * memory above the 4GB point, and we don't support that.
130 */
131#define pci_dac_dma_supported(pci_dev, mask) (0)
132
133/* Return the index of the PCI controller for device PDEV. */ 115/* Return the index of the PCI controller for device PDEV. */
134#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 116#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
135 117
@@ -243,8 +225,6 @@ extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
243 225
244extern int pci_read_irq_line(struct pci_dev *dev); 226extern int pci_read_irq_line(struct pci_dev *dev);
245 227
246extern void pcibios_add_platform_entries(struct pci_dev *dev);
247
248struct file; 228struct file;
249extern pgprot_t pci_phys_mem_access_prot(struct file *file, 229extern pgprot_t pci_phys_mem_access_prot(struct file *file,
250 unsigned long pfn, 230 unsigned long pfn,
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index 9d162028dab9..d2442cd72a59 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -102,12 +102,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
102} 102}
103#endif 103#endif
104 104
105/*
106 * At present there are very few 32-bit PPC machines that can have
107 * memory above the 4GB point, and we don't support that.
108 */
109#define pci_dac_dma_supported(pci_dev, mask) (0)
110
111/* Return the index of the PCI controller for device PDEV. */ 105/* Return the index of the PCI controller for device PDEV. */
112#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 106#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
113 107
@@ -145,8 +139,6 @@ pcibios_select_root(struct pci_dev *pdev, struct resource *res)
145 return root; 139 return root;
146} 140}
147 141
148extern void pcibios_add_platform_entries(struct pci_dev *dev);
149
150struct file; 142struct file;
151extern pgprot_t pci_phys_mem_access_prot(struct file *file, 143extern pgprot_t pci_phys_mem_access_prot(struct file *file,
152 unsigned long pfn, 144 unsigned long pfn,
diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h
index b1f9a9e0231e..2757ce096ff7 100644
--- a/include/asm-sh/pci.h
+++ b/include/asm-sh/pci.h
@@ -110,11 +110,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
110#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 110#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
111#endif 111#endif
112 112
113/* Not supporting more than 32-bit PCI bus addresses now, but
114 * must satisfy references to this function. Change if needed.
115 */
116#define pci_dac_dma_supported(pci_dev, mask) (0)
117
118#ifdef CONFIG_PCI 113#ifdef CONFIG_PCI
119static inline void pci_dma_burst_advice(struct pci_dev *pdev, 114static inline void pci_dma_burst_advice(struct pci_dev *pdev,
120 enum pci_dma_burst_strategy *strat, 115 enum pci_dma_burst_strategy *strat,
@@ -134,10 +129,6 @@ int pcibios_map_platform_irq(struct pci_dev *dev, u8 slot, u8 pin);
134int pciauto_assign_resources(int busno, struct pci_channel *hose); 129int pciauto_assign_resources(int busno, struct pci_channel *hose);
135#endif 130#endif
136 131
137static inline void pcibios_add_platform_entries(struct pci_dev *dev)
138{
139}
140
141#endif /* __KERNEL__ */ 132#endif /* __KERNEL__ */
142 133
143/* generic pci stuff */ 134/* generic pci stuff */
diff --git a/include/asm-sh64/pci.h b/include/asm-sh64/pci.h
index aa8043089bb6..57a67cf7a5c4 100644
--- a/include/asm-sh64/pci.h
+++ b/include/asm-sh64/pci.h
@@ -72,11 +72,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
72#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 72#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
73#endif 73#endif
74 74
75/* Not supporting more than 32-bit PCI bus addresses now, but
76 * must satisfy references to this function. Change if needed.
77 */
78#define pci_dac_dma_supported(pci_dev, mask) (0)
79
80/* These macros should be used after a pci_map_sg call has been done 75/* These macros should be used after a pci_map_sg call has been done
81 * to get bus addresses of each of the SG entries and their lengths. 76 * to get bus addresses of each of the SG entries and their lengths.
82 * You should only work with the number of sg entries pci_map_sg 77 * You should only work with the number of sg entries pci_map_sg
@@ -104,10 +99,6 @@ extern void pcibios_fixup_irqs(void);
104extern int pciauto_assign_resources(int busno, struct pci_channel *hose); 99extern int pciauto_assign_resources(int busno, struct pci_channel *hose);
105#endif 100#endif
106 101
107static inline void pcibios_add_platform_entries(struct pci_dev *dev)
108{
109}
110
111#endif /* __KERNEL__ */ 102#endif /* __KERNEL__ */
112 103
113/* generic pci stuff */ 104/* generic pci stuff */
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
index a750c688408b..b93b6c79e08f 100644
--- a/include/asm-sparc/pci.h
+++ b/include/asm-sparc/pci.h
@@ -142,8 +142,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
142 return 1; 142 return 1;
143} 143}
144 144
145#define pci_dac_dma_supported(dev, mask) (0)
146
147#ifdef CONFIG_PCI 145#ifdef CONFIG_PCI
148static inline void pci_dma_burst_advice(struct pci_dev *pdev, 146static inline void pci_dma_burst_advice(struct pci_dev *pdev,
149 enum pci_dma_burst_strategy *strat, 147 enum pci_dma_burst_strategy *strat,
@@ -154,10 +152,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
154} 152}
155#endif 153#endif
156 154
157static inline void pcibios_add_platform_entries(struct pci_dev *dev)
158{
159}
160
161#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0) 155#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0)
162 156
163static inline int pci_dma_mapping_error(dma_addr_t dma_addr) 157static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index 47cea16e1bad..e11ac100f043 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -206,49 +206,6 @@ extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask);
206#define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) 206#define PCI64_REQUIRED_MASK (~(dma64_addr_t)0)
207#define PCI64_ADDR_BASE 0xfffc000000000000UL 207#define PCI64_ADDR_BASE 0xfffc000000000000UL
208 208
209/* Usage of the pci_dac_foo interfaces is only valid if this
210 * test passes.
211 */
212#define pci_dac_dma_supported(pci_dev, mask) \
213 ((((mask) & PCI64_REQUIRED_MASK) == PCI64_REQUIRED_MASK) ? 1 : 0)
214
215static inline dma64_addr_t
216pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
217{
218 return (PCI64_ADDR_BASE +
219 __pa(page_address(page)) + offset);
220}
221
222static inline struct page *
223pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
224{
225 unsigned long paddr = (dma_addr & PAGE_MASK) - PCI64_ADDR_BASE;
226
227 return virt_to_page(__va(paddr));
228}
229
230static inline unsigned long
231pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
232{
233 return (dma_addr & ~PAGE_MASK);
234}
235
236static inline void
237pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
238{
239 /* DAC cycle addressing does not make use of the
240 * PCI controller's streaming cache, so nothing to do.
241 */
242}
243
244static inline void
245pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
246{
247 /* DAC cycle addressing does not make use of the
248 * PCI controller's streaming cache, so nothing to do.
249 */
250}
251
252#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0) 209#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0)
253 210
254static inline int pci_dma_mapping_error(dma_addr_t dma_addr) 211static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
@@ -303,10 +260,6 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
303 260
304extern struct resource *pcibios_select_root(struct pci_dev *, struct resource *); 261extern struct resource *pcibios_select_root(struct pci_dev *, struct resource *);
305 262
306static inline void pcibios_add_platform_entries(struct pci_dev *dev)
307{
308}
309
310static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 263static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
311{ 264{
312 return PCI_IRQ_NONE; 265 return PCI_IRQ_NONE;
diff --git a/include/asm-v850/pci.h b/include/asm-v850/pci.h
index 4581826e1cac..de2a7d0a81cc 100644
--- a/include/asm-v850/pci.h
+++ b/include/asm-v850/pci.h
@@ -116,8 +116,4 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
116extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); 116extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
117extern void pci_iounmap (struct pci_dev *dev, void __iomem *addr); 117extern void pci_iounmap (struct pci_dev *dev, void __iomem *addr);
118 118
119static inline void pcibios_add_platform_entries(struct pci_dev *dev)
120{
121}
122
123#endif /* __V850_PCI_H__ */ 119#endif /* __V850_PCI_H__ */
diff --git a/include/asm-v850/rte_cb.h b/include/asm-v850/rte_cb.h
index 9f7f02cb0391..e85d261b79bf 100644
--- a/include/asm-v850/rte_cb.h
+++ b/include/asm-v850/rte_cb.h
@@ -64,7 +64,6 @@
64/* As we don't really support PCI DMA to cpu memory, and use bounce-buffers 64/* As we don't really support PCI DMA to cpu memory, and use bounce-buffers
65 instead, perversely enough, this becomes always true! */ 65 instead, perversely enough, this becomes always true! */
66# define pci_dma_supported(dev, mask) 1 66# define pci_dma_supported(dev, mask) 1
67# define pci_dac_dma_supported(dev, mask) 0
68# define pcibios_assign_all_busses() 1 67# define pcibios_assign_all_busses() 1
69 68
70#endif /* CONFIG_RTE_MB_A_PCI */ 69#endif /* CONFIG_RTE_MB_A_PCI */
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index 49c5e9280598..bda94fd5176f 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -54,14 +54,6 @@ extern int iommu_setup(char *opt);
54 54
55#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU) 55#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
56 56
57/*
58 * x86-64 always supports DAC, but sometimes it is useful to force
59 * devices through the IOMMU to get automatic sg list merging.
60 * Optional right now.
61 */
62extern int iommu_sac_force;
63#define pci_dac_dma_supported(pci_dev, mask) (!iommu_sac_force)
64
65#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 57#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
66 dma_addr_t ADDR_NAME; 58 dma_addr_t ADDR_NAME;
67#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ 59#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
@@ -78,8 +70,6 @@ extern int iommu_sac_force;
78#else 70#else
79/* No IOMMU */ 71/* No IOMMU */
80 72
81#define pci_dac_dma_supported(pci_dev, mask) 1
82
83#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) 73#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
84#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) 74#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
85#define pci_unmap_addr(PTR, ADDR_NAME) (0) 75#define pci_unmap_addr(PTR, ADDR_NAME) (0)
@@ -91,36 +81,6 @@ extern int iommu_sac_force;
91 81
92#include <asm-generic/pci-dma-compat.h> 82#include <asm-generic/pci-dma-compat.h>
93 83
94static inline dma64_addr_t
95pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
96{
97 return ((dma64_addr_t) page_to_phys(page) +
98 (dma64_addr_t) offset);
99}
100
101static inline struct page *
102pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
103{
104 return virt_to_page(__va(dma_addr));
105}
106
107static inline unsigned long
108pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
109{
110 return (dma_addr & ~PAGE_MASK);
111}
112
113static inline void
114pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
115{
116}
117
118static inline void
119pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
120{
121 flush_write_buffers();
122}
123
124#ifdef CONFIG_PCI 84#ifdef CONFIG_PCI
125static inline void pci_dma_burst_advice(struct pci_dev *pdev, 85static inline void pci_dma_burst_advice(struct pci_dev *pdev,
126 enum pci_dma_burst_strategy *strat, 86 enum pci_dma_burst_strategy *strat,
@@ -135,10 +95,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
135extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 95extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
136 enum pci_mmap_state mmap_state, int write_combine); 96 enum pci_mmap_state mmap_state, int write_combine);
137 97
138static inline void pcibios_add_platform_entries(struct pci_dev *dev)
139{
140}
141
142#endif /* __KERNEL__ */ 98#endif /* __KERNEL__ */
143 99
144/* generic pci stuff */ 100/* generic pci stuff */
diff --git a/include/asm-xtensa/pci.h b/include/asm-xtensa/pci.h
index 24eb7fc25da8..66410acf18b4 100644
--- a/include/asm-xtensa/pci.h
+++ b/include/asm-xtensa/pci.h
@@ -64,9 +64,6 @@ struct pci_dev;
64#define pci_ubnmap_len(PTR, LEN_NAME) (0) 64#define pci_ubnmap_len(PTR, LEN_NAME) (0)
65#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 65#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
66 66
67/* We cannot access memory above 4GB */
68#define pci_dac_dma_supported(pci_dev, mask) (0)
69
70/* Map a range of PCI memory or I/O space for a device into user space */ 67/* Map a range of PCI memory or I/O space for a device into user space */
71int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, 68int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
72 enum pci_mmap_state mmap_state, int write_combine); 69 enum pci_mmap_state mmap_state, int write_combine);
@@ -74,10 +71,6 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
74/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ 71/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
75#define HAVE_PCI_MMAP 1 72#define HAVE_PCI_MMAP 1
76 73
77static inline void pcibios_add_platform_entries(struct pci_dev *dev)
78{
79}
80
81#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
82 75
83/* Implement the pci_ DMA API in terms of the generic device dma_ one */ 76/* Implement the pci_ DMA API in terms of the generic device dma_ one */
diff --git a/include/linux/aer.h b/include/linux/aer.h
index 402e178b38eb..509656286e53 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -13,11 +13,13 @@ extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
13extern int pci_find_aer_capability(struct pci_dev *dev); 13extern int pci_find_aer_capability(struct pci_dev *dev);
14extern int pci_disable_pcie_error_reporting(struct pci_dev *dev); 14extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); 15extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
16extern int pci_cleanup_aer_correct_error_status(struct pci_dev *dev);
16#else 17#else
17#define pci_enable_pcie_error_reporting(dev) do { } while (0) 18#define pci_enable_pcie_error_reporting(dev) (-EINVAL)
18#define pci_find_aer_capability(dev) do { } while (0) 19#define pci_find_aer_capability(dev) (0)
19#define pci_disable_pcie_error_reporting(dev) do { } while (0) 20#define pci_disable_pcie_error_reporting(dev) (-EINVAL)
20#define pci_cleanup_aer_uncorrect_error_status(dev) do { } while (0) 21#define pci_cleanup_aer_uncorrect_error_status(dev) (-EINVAL)
22#define pci_cleanup_aer_correct_error_status(dev) (-EINVAL)
21#endif 23#endif
22 24
23#endif //_AER_H_ 25#endif //_AER_H_
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 086a0e5a6318..a5602e26f4dd 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -111,7 +111,8 @@ enum pcie_reset_state {
111 111
112typedef unsigned short __bitwise pci_bus_flags_t; 112typedef unsigned short __bitwise pci_bus_flags_t;
113enum pci_bus_flags { 113enum pci_bus_flags {
114 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, 114 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
115 PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
115}; 116};
116 117
117struct pci_cap_saved_state { 118struct pci_cap_saved_state {
@@ -138,6 +139,7 @@ struct pci_dev {
138 unsigned short subsystem_vendor; 139 unsigned short subsystem_vendor;
139 unsigned short subsystem_device; 140 unsigned short subsystem_device;
140 unsigned int class; /* 3 bytes: (base,sub,prog-if) */ 141 unsigned int class; /* 3 bytes: (base,sub,prog-if) */
142 u8 revision; /* PCI revision, low byte of class word */
141 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 143 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
142 u8 rom_base_reg; /* which config register controls the ROM */ 144 u8 rom_base_reg; /* which config register controls the ROM */
143 u8 pin; /* which interrupt pin this device uses */ 145 u8 pin; /* which interrupt pin this device uses */
@@ -313,7 +315,7 @@ struct pci_dynids {
313 315
314/* ---------------------------------------------------------------- */ 316/* ---------------------------------------------------------------- */
315/** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides 317/** PCI Error Recovery System (PCI-ERS). If a PCI device driver provides
316 * a set fof callbacks in struct pci_error_handlers, then that device driver 318 * a set of callbacks in struct pci_error_handlers, then that device driver
317 * will be notified of PCI bus errors, and will be driven to recovery 319 * will be notified of PCI bus errors, and will be driven to recovery
318 * when an error occurs. 320 * when an error occurs.
319 */ 321 */
@@ -370,7 +372,6 @@ struct pci_driver {
370 int (*suspend_late) (struct pci_dev *dev, pm_message_t state); 372 int (*suspend_late) (struct pci_dev *dev, pm_message_t state);
371 int (*resume_early) (struct pci_dev *dev); 373 int (*resume_early) (struct pci_dev *dev);
372 int (*resume) (struct pci_dev *dev); /* Device woken up */ 374 int (*resume) (struct pci_dev *dev); /* Device woken up */
373 int (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable); /* Enable wake event */
374 void (*shutdown) (struct pci_dev *dev); 375 void (*shutdown) (struct pci_dev *dev);
375 376
376 struct pci_error_handlers *err_handler; 377 struct pci_error_handlers *err_handler;
@@ -475,7 +476,7 @@ extern void pci_sort_breadthfirst(void);
475/* Generic PCI functions exported to card drivers */ 476/* Generic PCI functions exported to card drivers */
476 477
477struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); 478struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from);
478struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn); 479struct pci_dev __deprecated *pci_find_slot (unsigned int bus, unsigned int devfn);
479int pci_find_capability (struct pci_dev *dev, int cap); 480int pci_find_capability (struct pci_dev *dev, int cap);
480int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 481int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap);
481int pci_find_ext_capability (struct pci_dev *dev, int cap); 482int pci_find_ext_capability (struct pci_dev *dev, int cap);
@@ -544,11 +545,16 @@ void pci_set_master(struct pci_dev *dev);
544int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 545int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
545#define HAVE_PCI_SET_MWI 546#define HAVE_PCI_SET_MWI
546int __must_check pci_set_mwi(struct pci_dev *dev); 547int __must_check pci_set_mwi(struct pci_dev *dev);
548int pci_try_set_mwi(struct pci_dev *dev);
547void pci_clear_mwi(struct pci_dev *dev); 549void pci_clear_mwi(struct pci_dev *dev);
548void pci_intx(struct pci_dev *dev, int enable); 550void pci_intx(struct pci_dev *dev, int enable);
549void pci_msi_off(struct pci_dev *dev); 551void pci_msi_off(struct pci_dev *dev);
550int pci_set_dma_mask(struct pci_dev *dev, u64 mask); 552int pci_set_dma_mask(struct pci_dev *dev, u64 mask);
551int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); 553int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
554int pcix_get_max_mmrbc(struct pci_dev *dev);
555int pcix_get_mmrbc(struct pci_dev *dev);
556int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
557int pcie_set_readrq(struct pci_dev *dev, int rq);
552void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 558void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
553int __must_check pci_assign_resource(struct pci_dev *dev, int i); 559int __must_check pci_assign_resource(struct pci_dev *dev, int i);
554int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); 560int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
@@ -876,5 +882,7 @@ extern int pci_pci_problems;
876extern unsigned long pci_cardbus_io_size; 882extern unsigned long pci_cardbus_io_size;
877extern unsigned long pci_cardbus_mem_size; 883extern unsigned long pci_cardbus_mem_size;
878 884
885extern int pcibios_add_platform_entries(struct pci_dev *dev);
886
879#endif /* __KERNEL__ */ 887#endif /* __KERNEL__ */
880#endif /* LINUX_PCI_H */ 888#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 8300001e9078..9366182fffa7 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -133,6 +133,9 @@
133 133
134/* Vendors and devices. Sort key: vendor first, device next. */ 134/* Vendors and devices. Sort key: vendor first, device next. */
135 135
136#define PCI_VENDOR_ID_TTTECH 0x0357
137#define PCI_DEVICE_ID_TTTECH_MC322 0x000a
138
136#define PCI_VENDOR_ID_DYNALINK 0x0675 139#define PCI_VENDOR_ID_DYNALINK 0x0675
137#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702 140#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702
138 141
@@ -733,7 +736,6 @@
733#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 736#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000
734#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 737#define PCI_DEVICE_ID_ELSA_QS3000 0x3000
735 738
736
737#define PCI_VENDOR_ID_BUSLOGIC 0x104B 739#define PCI_VENDOR_ID_BUSLOGIC 0x104B
738#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 740#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140
739#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 741#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040
@@ -779,7 +781,6 @@
779 781
780#define PCI_VENDOR_ID_SONY 0x104d 782#define PCI_VENDOR_ID_SONY 0x104d
781 783
782
783/* Winbond have two vendor IDs! See 0x10ad as well */ 784/* Winbond have two vendor IDs! See 0x10ad as well */
784#define PCI_VENDOR_ID_WINBOND2 0x1050 785#define PCI_VENDOR_ID_WINBOND2 0x1050
785#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a 786#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a
@@ -817,7 +818,6 @@
817#define PCI_DEVICE_ID_PROMISE_20276 0x5275 818#define PCI_DEVICE_ID_PROMISE_20276 0x5275
818#define PCI_DEVICE_ID_PROMISE_20277 0x7275 819#define PCI_DEVICE_ID_PROMISE_20277 0x7275
819 820
820
821#define PCI_VENDOR_ID_UMC 0x1060 821#define PCI_VENDOR_ID_UMC 0x1060
822#define PCI_DEVICE_ID_UMC_UM8673F 0x0101 822#define PCI_DEVICE_ID_UMC_UM8673F 0x0101
823#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a 823#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a
@@ -833,7 +833,6 @@
833#define PCI_DEVICE_ID_MYLEX_DAC960_BA 0xBA56 833#define PCI_DEVICE_ID_MYLEX_DAC960_BA 0xBA56
834#define PCI_DEVICE_ID_MYLEX_DAC960_GEM 0xB166 834#define PCI_DEVICE_ID_MYLEX_DAC960_GEM 0xB166
835 835
836
837#define PCI_VENDOR_ID_APPLE 0x106b 836#define PCI_VENDOR_ID_APPLE 0x106b
838#define PCI_DEVICE_ID_APPLE_BANDIT 0x0001 837#define PCI_DEVICE_ID_APPLE_BANDIT 0x0001
839#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e 838#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e
@@ -869,7 +868,6 @@
869#define PCI_DEVICE_ID_YAMAHA_744 0x0010 868#define PCI_DEVICE_ID_YAMAHA_744 0x0010
870#define PCI_DEVICE_ID_YAMAHA_754 0x0012 869#define PCI_DEVICE_ID_YAMAHA_754 0x0012
871 870
872
873#define PCI_VENDOR_ID_QLOGIC 0x1077 871#define PCI_VENDOR_ID_QLOGIC 0x1077
874#define PCI_DEVICE_ID_QLOGIC_ISP10160 0x1016 872#define PCI_DEVICE_ID_QLOGIC_ISP10160 0x1016
875#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 873#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020
@@ -900,12 +898,9 @@
900#define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103 898#define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103
901#define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104 899#define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104
902 900
903
904
905#define PCI_VENDOR_ID_CONTAQ 0x1080 901#define PCI_VENDOR_ID_CONTAQ 0x1080
906#define PCI_DEVICE_ID_CONTAQ_82C693 0xc693 902#define PCI_DEVICE_ID_CONTAQ_82C693 0xc693
907 903
908
909#define PCI_VENDOR_ID_OLICOM 0x108d 904#define PCI_VENDOR_ID_OLICOM 0x108d
910#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012 905#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012
911#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 906#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013
@@ -937,23 +932,19 @@
937#define PCI_DEVICE_ID_SII_3112 0x3112 932#define PCI_DEVICE_ID_SII_3112 0x3112
938#define PCI_DEVICE_ID_SII_1210SA 0x0240 933#define PCI_DEVICE_ID_SII_1210SA 0x0240
939 934
940
941#define PCI_VENDOR_ID_BROOKTREE 0x109e 935#define PCI_VENDOR_ID_BROOKTREE 0x109e
942#define PCI_DEVICE_ID_BROOKTREE_878 0x0878 936#define PCI_DEVICE_ID_BROOKTREE_878 0x0878
943#define PCI_DEVICE_ID_BROOKTREE_879 0x0879 937#define PCI_DEVICE_ID_BROOKTREE_879 0x0879
944 938
945
946#define PCI_VENDOR_ID_SGI 0x10a9 939#define PCI_VENDOR_ID_SGI 0x10a9
947#define PCI_DEVICE_ID_SGI_IOC3 0x0003 940#define PCI_DEVICE_ID_SGI_IOC3 0x0003
941#define PCI_DEVICE_ID_SGI_LITHIUM 0x1002
948#define PCI_DEVICE_ID_SGI_IOC4 0x100a 942#define PCI_DEVICE_ID_SGI_IOC4 0x100a
949#define PCI_VENDOR_ID_SGI_LITHIUM 0x1002
950
951 943
952#define PCI_VENDOR_ID_WINBOND 0x10ad 944#define PCI_VENDOR_ID_WINBOND 0x10ad
953#define PCI_DEVICE_ID_WINBOND_82C105 0x0105 945#define PCI_DEVICE_ID_WINBOND_82C105 0x0105
954#define PCI_DEVICE_ID_WINBOND_83C553 0x0565 946#define PCI_DEVICE_ID_WINBOND_83C553 0x0565
955 947
956
957#define PCI_VENDOR_ID_PLX 0x10b5 948#define PCI_VENDOR_ID_PLX 0x10b5
958#define PCI_DEVICE_ID_PLX_R685 0x1030 949#define PCI_DEVICE_ID_PLX_R685 0x1030
959#define PCI_DEVICE_ID_PLX_ROMULUS 0x106a 950#define PCI_DEVICE_ID_PLX_ROMULUS 0x106a
@@ -987,7 +978,6 @@
987#define PCI_DEVICE_ID_3COM_3CR990SVR97 0x9909 978#define PCI_DEVICE_ID_3COM_3CR990SVR97 0x9909
988#define PCI_DEVICE_ID_3COM_3CR990SVR 0x990a 979#define PCI_DEVICE_ID_3COM_3CR990SVR 0x990a
989 980
990
991#define PCI_VENDOR_ID_AL 0x10b9 981#define PCI_VENDOR_ID_AL 0x10b9
992#define PCI_DEVICE_ID_AL_M1533 0x1533 982#define PCI_DEVICE_ID_AL_M1533 0x1533
993#define PCI_DEVICE_ID_AL_M1535 0x1535 983#define PCI_DEVICE_ID_AL_M1535 0x1535
@@ -1010,18 +1000,14 @@
1010#define PCI_DEVICE_ID_AL_M5451 0x5451 1000#define PCI_DEVICE_ID_AL_M5451 0x5451
1011#define PCI_DEVICE_ID_AL_M7101 0x7101 1001#define PCI_DEVICE_ID_AL_M7101 0x7101
1012 1002
1013
1014
1015#define PCI_VENDOR_ID_NEOMAGIC 0x10c8 1003#define PCI_VENDOR_ID_NEOMAGIC 0x10c8
1016#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005 1004#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
1017#define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006 1005#define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
1018#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016 1006#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016
1019 1007
1020
1021#define PCI_VENDOR_ID_TCONRAD 0x10da 1008#define PCI_VENDOR_ID_TCONRAD 0x10da
1022#define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508 1009#define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508
1023 1010
1024
1025#define PCI_VENDOR_ID_NVIDIA 0x10de 1011#define PCI_VENDOR_ID_NVIDIA 0x10de
1026#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020 1012#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020
1027#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028 1013#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028
@@ -1242,9 +1228,6 @@
1242#define PCI_DEVICE_ID_IMS_TT128 0x9128 1228#define PCI_DEVICE_ID_IMS_TT128 0x9128
1243#define PCI_DEVICE_ID_IMS_TT3D 0x9135 1229#define PCI_DEVICE_ID_IMS_TT3D 0x9135
1244 1230
1245
1246
1247
1248#define PCI_VENDOR_ID_INTERG 0x10ea 1231#define PCI_VENDOR_ID_INTERG 0x10ea
1249#define PCI_DEVICE_ID_INTERG_1682 0x1682 1232#define PCI_DEVICE_ID_INTERG_1682 0x1682
1250#define PCI_DEVICE_ID_INTERG_2000 0x2000 1233#define PCI_DEVICE_ID_INTERG_2000 0x2000
@@ -1263,7 +1246,6 @@
1263#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5 1246#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
1264#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6 1247#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6
1265 1248
1266
1267#define PCI_VENDOR_ID_INIT 0x1101 1249#define PCI_VENDOR_ID_INIT 0x1101
1268 1250
1269#define PCI_VENDOR_ID_CREATIVE 0x1102 /* duplicate: ECTIVA */ 1251#define PCI_VENDOR_ID_CREATIVE 0x1102 /* duplicate: ECTIVA */
@@ -1358,7 +1340,6 @@
1358#define PCI_VENDOR_ID_SIEMENS 0x110A 1340#define PCI_VENDOR_ID_SIEMENS 0x110A
1359#define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102 1341#define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102
1360 1342
1361
1362#define PCI_VENDOR_ID_VORTEX 0x1119 1343#define PCI_VENDOR_ID_VORTEX 0x1119
1363#define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000 1344#define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000
1364#define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001 1345#define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001
@@ -1384,8 +1365,8 @@
1384#define PCI_VENDOR_ID_EF 0x111a 1365#define PCI_VENDOR_ID_EF 0x111a
1385#define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000 1366#define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000
1386#define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002 1367#define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002
1387#define PCI_VENDOR_ID_EF_ATM_LANAI2 0x0003 1368#define PCI_DEVICE_ID_EF_ATM_LANAI2 0x0003
1388#define PCI_VENDOR_ID_EF_ATM_LANAIHB 0x0005 1369#define PCI_DEVICE_ID_EF_ATM_LANAIHB 0x0005
1389 1370
1390#define PCI_VENDOR_ID_IDT 0x111d 1371#define PCI_VENDOR_ID_IDT 0x111d
1391#define PCI_DEVICE_ID_IDT_IDT77201 0x0001 1372#define PCI_DEVICE_ID_IDT_IDT77201 0x0001
@@ -1393,7 +1374,6 @@
1393#define PCI_VENDOR_ID_FORE 0x1127 1374#define PCI_VENDOR_ID_FORE 0x1127
1394#define PCI_DEVICE_ID_FORE_PCA200E 0x0300 1375#define PCI_DEVICE_ID_FORE_PCA200E 0x0300
1395 1376
1396
1397#define PCI_VENDOR_ID_PHILIPS 0x1131 1377#define PCI_VENDOR_ID_PHILIPS 0x1131
1398#define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 1378#define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146
1399#define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730 1379#define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730
@@ -1412,7 +1392,6 @@
1412#define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 1392#define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550
1413 1393
1414 1394
1415
1416#define PCI_VENDOR_ID_SYSKONNECT 0x1148 1395#define PCI_VENDOR_ID_SYSKONNECT 0x1148
1417#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200 1396#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200
1418#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300 1397#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300
@@ -1420,7 +1399,6 @@
1420#define PCI_DEVICE_ID_SYSKONNECT_9DXX 0x4400 1399#define PCI_DEVICE_ID_SYSKONNECT_9DXX 0x4400
1421#define PCI_DEVICE_ID_SYSKONNECT_9MXX 0x4500 1400#define PCI_DEVICE_ID_SYSKONNECT_9MXX 0x4500
1422 1401
1423
1424#define PCI_VENDOR_ID_DIGI 0x114f 1402#define PCI_VENDOR_ID_DIGI 0x114f
1425#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070 1403#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070
1426#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 1404#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071
@@ -1431,12 +1409,10 @@
1431#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA 1409#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA
1432#define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB 1410#define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB
1433 1411
1434
1435#define PCI_VENDOR_ID_XIRCOM 0x115d 1412#define PCI_VENDOR_ID_XIRCOM 0x115d
1436#define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 1413#define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101
1437#define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103 1414#define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103
1438 1415
1439
1440#define PCI_VENDOR_ID_SERVERWORKS 0x1166 1416#define PCI_VENDOR_ID_SERVERWORKS 0x1166
1441#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 1417#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008
1442#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1418#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
@@ -1505,7 +1481,6 @@
1505#define PCI_DEVICE_ID_ZEITNET_1221 0x0001 1481#define PCI_DEVICE_ID_ZEITNET_1221 0x0001
1506#define PCI_DEVICE_ID_ZEITNET_1225 0x0002 1482#define PCI_DEVICE_ID_ZEITNET_1225 0x0002
1507 1483
1508
1509#define PCI_VENDOR_ID_FUJITSU_ME 0x119e 1484#define PCI_VENDOR_ID_FUJITSU_ME 0x119e
1510#define PCI_DEVICE_ID_FUJITSU_FS155 0x0001 1485#define PCI_DEVICE_ID_FUJITSU_FS155 0x0001
1511#define PCI_DEVICE_ID_FUJITSU_FS50 0x0003 1486#define PCI_DEVICE_ID_FUJITSU_FS50 0x0003
@@ -1523,28 +1498,23 @@
1523#define PCI_DEVICE_ID_V3_V960 0x0001 1498#define PCI_DEVICE_ID_V3_V960 0x0001
1524#define PCI_DEVICE_ID_V3_V351 0x0002 1499#define PCI_DEVICE_ID_V3_V351 0x0002
1525 1500
1526
1527#define PCI_VENDOR_ID_ATT 0x11c1 1501#define PCI_VENDOR_ID_ATT 0x11c1
1528#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480 1502#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480
1529 1503
1530
1531#define PCI_VENDOR_ID_SPECIALIX 0x11cb 1504#define PCI_VENDOR_ID_SPECIALIX 0x11cb
1532#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000 1505#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000
1533#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 1506#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000
1534#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 1507#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004
1535 1508
1536
1537#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4 1509#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4
1538#define PCI_DEVICE_ID_AD1889JS 0x1889 1510#define PCI_DEVICE_ID_AD1889JS 0x1889
1539 1511
1540
1541#define PCI_DEVICE_ID_SEGA_BBA 0x1234 1512#define PCI_DEVICE_ID_SEGA_BBA 0x1234
1542 1513
1543#define PCI_VENDOR_ID_ZORAN 0x11de 1514#define PCI_VENDOR_ID_ZORAN 0x11de
1544#define PCI_DEVICE_ID_ZORAN_36057 0x6057 1515#define PCI_DEVICE_ID_ZORAN_36057 0x6057
1545#define PCI_DEVICE_ID_ZORAN_36120 0x6120 1516#define PCI_DEVICE_ID_ZORAN_36120 0x6120
1546 1517
1547
1548#define PCI_VENDOR_ID_COMPEX 0x11f6 1518#define PCI_VENDOR_ID_COMPEX 0x11f6
1549#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 1519#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112
1550 1520
@@ -1603,8 +1573,6 @@
1603#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005 1573#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005
1604#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 1574#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009
1605 1575
1606
1607
1608#define PCI_VENDOR_ID_AVM 0x1244 1576#define PCI_VENDOR_ID_AVM 0x1244
1609#define PCI_DEVICE_ID_AVM_B1 0x0700 1577#define PCI_DEVICE_ID_AVM_B1 0x0700
1610#define PCI_DEVICE_ID_AVM_C4 0x0800 1578#define PCI_DEVICE_ID_AVM_C4 0x0800
@@ -1613,7 +1581,6 @@
1613#define PCI_DEVICE_ID_AVM_C2 0x1100 1581#define PCI_DEVICE_ID_AVM_C2 0x1100
1614#define PCI_DEVICE_ID_AVM_T1 0x1200 1582#define PCI_DEVICE_ID_AVM_T1 0x1200
1615 1583
1616
1617#define PCI_VENDOR_ID_STALLION 0x124d 1584#define PCI_VENDOR_ID_STALLION 0x124d
1618 1585
1619/* Allied Telesyn */ 1586/* Allied Telesyn */
@@ -1636,7 +1603,6 @@
1636#define PCI_VENDOR_ID_SATSAGEM 0x1267 1603#define PCI_VENDOR_ID_SATSAGEM 0x1267
1637#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016 1604#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016
1638 1605
1639
1640#define PCI_VENDOR_ID_ENSONIQ 0x1274 1606#define PCI_VENDOR_ID_ENSONIQ 0x1274
1641#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880 1607#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880
1642#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000 1608#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000
@@ -1659,7 +1625,6 @@
1659 1625
1660#define PCI_VENDOR_ID_ALTEON 0x12ae 1626#define PCI_VENDOR_ID_ALTEON 0x12ae
1661 1627
1662
1663#define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4 1628#define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4
1664#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001 1629#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001
1665#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002 1630#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002
@@ -1690,7 +1655,6 @@
1690#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 0x0331 1655#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 0x0331
1691#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 0x0332 1656#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 0x0332
1692 1657
1693
1694#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 1658#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2
1695#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 1659#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018
1696 1660
@@ -1800,7 +1764,6 @@
1800#define PCI_DEVICE_ID_LMC_SSI 0x0005 1764#define PCI_DEVICE_ID_LMC_SSI 0x0005
1801#define PCI_DEVICE_ID_LMC_T1 0x0006 1765#define PCI_DEVICE_ID_LMC_T1 0x0006
1802 1766
1803
1804#define PCI_VENDOR_ID_NETGEAR 0x1385 1767#define PCI_VENDOR_ID_NETGEAR 0x1385
1805#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a 1768#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a
1806 1769
@@ -1903,6 +1866,8 @@
1903#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521 1866#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521
1904#define PCI_DEVICE_ID_OXSEMI_16PCI952PP 0x9523 1867#define PCI_DEVICE_ID_OXSEMI_16PCI952PP 0x9523
1905 1868
1869#define PCI_VENDOR_ID_CHELSIO 0x1425
1870
1906#define PCI_VENDOR_ID_SAMSUNG 0x144d 1871#define PCI_VENDOR_ID_SAMSUNG 0x144d
1907 1872
1908#define PCI_VENDOR_ID_MYRICOM 0x14c1 1873#define PCI_VENDOR_ID_MYRICOM 0x14c1
@@ -2011,13 +1976,10 @@
2011#define PCI_DEVICE_ID_ENE_720 0x1421 1976#define PCI_DEVICE_ID_ENE_720 0x1421
2012#define PCI_DEVICE_ID_ENE_722 0x1422 1977#define PCI_DEVICE_ID_ENE_722 0x1422
2013 1978
2014#define PCI_VENDOR_ID_CHELSIO 0x1425
2015
2016#define PCI_SUBVENDOR_ID_PERLE 0x155f 1979#define PCI_SUBVENDOR_ID_PERLE 0x155f
2017#define PCI_SUBDEVICE_ID_PCI_RAS4 0xf001 1980#define PCI_SUBDEVICE_ID_PCI_RAS4 0xf001
2018#define PCI_SUBDEVICE_ID_PCI_RAS8 0xf010 1981#define PCI_SUBDEVICE_ID_PCI_RAS8 0xf010
2019 1982
2020
2021#define PCI_VENDOR_ID_SYBA 0x1592 1983#define PCI_VENDOR_ID_SYBA 0x1592
2022#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 1984#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782
2023#define PCI_DEVICE_ID_SYBA_1P_ECP 0x0783 1985#define PCI_DEVICE_ID_SYBA_1P_ECP 0x0783
@@ -2036,8 +1998,10 @@
2036#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c 1998#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c
2037#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 1999#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274
2038 2000
2039#define PCI_VENDOR_ID_PDC 0x15e9 2001#define PCI_VENDOR_ID_QUICKNET 0x15e2
2002#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500
2040 2003
2004#define PCI_VENDOR_ID_PDC 0x15e9
2041 2005
2042#define PCI_VENDOR_ID_FARSITE 0x1619 2006#define PCI_VENDOR_ID_FARSITE 0x1619
2043#define PCI_DEVICE_ID_FARSITE_T2P 0x0400 2007#define PCI_DEVICE_ID_FARSITE_T2P 0x0400
@@ -2054,6 +2018,8 @@
2054#define PCI_DEVICE_ID_BCM1250_PCI 0x0001 2018#define PCI_DEVICE_ID_BCM1250_PCI 0x0001
2055#define PCI_DEVICE_ID_BCM1250_HT 0x0002 2019#define PCI_DEVICE_ID_BCM1250_HT 0x0002
2056 2020
2021#define PCI_VENDOR_ID_ATHEROS 0x168c
2022
2057#define PCI_VENDOR_ID_NETCELL 0x169c 2023#define PCI_VENDOR_ID_NETCELL 0x169c
2058#define PCI_DEVICE_ID_REVOLUTION 0x0044 2024#define PCI_DEVICE_ID_REVOLUTION 0x0044
2059 2025
@@ -2092,7 +2058,6 @@
2092#define PCI_DEVICE_ID_HERC_WIN 0x5732 2058#define PCI_DEVICE_ID_HERC_WIN 0x5732
2093#define PCI_DEVICE_ID_HERC_UNI 0x5832 2059#define PCI_DEVICE_ID_HERC_UNI 0x5832
2094 2060
2095
2096#define PCI_VENDOR_ID_SITECOM 0x182d 2061#define PCI_VENDOR_ID_SITECOM 0x182d
2097#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 2062#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069
2098 2063
@@ -2128,12 +2093,9 @@
2128#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 2093#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007
2129#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 2094#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009
2130 2095
2131
2132#define PCI_VENDOR_ID_AKS 0x416c 2096#define PCI_VENDOR_ID_AKS 0x416c
2133#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 2097#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
2134 2098
2135
2136
2137#define PCI_VENDOR_ID_S3 0x5333 2099#define PCI_VENDOR_ID_S3 0x5333
2138#define PCI_DEVICE_ID_S3_TRIO 0x8811 2100#define PCI_DEVICE_ID_S3_TRIO 0x8811
2139#define PCI_DEVICE_ID_S3_868 0x8880 2101#define PCI_DEVICE_ID_S3_868 0x8880
@@ -2145,7 +2107,6 @@
2145#define PCI_VENDOR_ID_DUNORD 0x5544 2107#define PCI_VENDOR_ID_DUNORD 0x5544
2146#define PCI_DEVICE_ID_DUNORD_I3000 0x0001 2108#define PCI_DEVICE_ID_DUNORD_I3000 0x0001
2147 2109
2148
2149#define PCI_VENDOR_ID_DCI 0x6666 2110#define PCI_VENDOR_ID_DCI 0x6666
2150#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 2111#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001
2151#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 2112#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002
@@ -2389,7 +2350,6 @@
2389#define PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN 0x0500 2350#define PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN 0x0500
2390#define PCI_DEVICE_ID_ADAPTEC2_SCAMP 0x0503 2351#define PCI_DEVICE_ID_ADAPTEC2_SCAMP 0x0503
2391 2352
2392
2393#define PCI_VENDOR_ID_HOLTEK 0x9412 2353#define PCI_VENDOR_ID_HOLTEK 0x9412
2394#define PCI_DEVICE_ID_HOLTEK_6565 0x6565 2354#define PCI_DEVICE_ID_HOLTEK_6565 0x6565
2395 2355
@@ -2405,6 +2365,8 @@
2405#define PCI_DEVICE_ID_NETMOS_9845 0x9845 2365#define PCI_DEVICE_ID_NETMOS_9845 0x9845
2406#define PCI_DEVICE_ID_NETMOS_9855 0x9855 2366#define PCI_DEVICE_ID_NETMOS_9855 0x9855
2407 2367
2368#define PCI_VENDOR_ID_3COM_2 0xa727
2369
2408#define PCI_SUBVENDOR_ID_EXSYS 0xd84d 2370#define PCI_SUBVENDOR_ID_EXSYS 0xd84d
2409#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 2371#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014
2410#define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055 2372#define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055
@@ -2413,13 +2375,7 @@
2413#define PCI_DEVICE_ID_TIGERJET_300 0x0001 2375#define PCI_DEVICE_ID_TIGERJET_300 0x0001
2414#define PCI_DEVICE_ID_TIGERJET_100 0x0002 2376#define PCI_DEVICE_ID_TIGERJET_100 0x0002
2415 2377
2416#define PCI_VENDOR_ID_TTTECH 0x0357
2417#define PCI_DEVICE_ID_TTTECH_MC322 0x000A
2418
2419#define PCI_VENDOR_ID_XILINX_RME 0xea60 2378#define PCI_VENDOR_ID_XILINX_RME 0xea60
2420#define PCI_DEVICE_ID_RME_DIGI32 0x9896 2379#define PCI_DEVICE_ID_RME_DIGI32 0x9896
2421#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897 2380#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897
2422#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898 2381#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898
2423
2424#define PCI_VENDOR_ID_QUICKNET 0x15E2
2425#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500
diff --git a/sound/oss/emu10k1/main.c b/sound/oss/emu10k1/main.c
index 16ac02540a3f..5058411b7524 100644
--- a/sound/oss/emu10k1/main.c
+++ b/sound/oss/emu10k1/main.c
@@ -1302,7 +1302,7 @@ static int __devinit emu10k1_probe(struct pci_dev *pci_dev, const struct pci_dev
1302 goto err_irq; 1302 goto err_irq;
1303 } 1303 }
1304 1304
1305 pci_read_config_byte(pci_dev, PCI_REVISION_ID, &card->chiprev); 1305 card->chiprev = pci_dev->revision;
1306 pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, &card->model); 1306 pci_read_config_word(pci_dev, PCI_SUBSYSTEM_ID, &card->model);
1307 1307
1308 printk(KERN_INFO "emu10k1: %s rev %d model %#04x found, IO at %#04lx-%#04lx, IRQ %d\n", 1308 printk(KERN_INFO "emu10k1: %s rev %d model %#04x found, IO at %#04lx-%#04lx, IRQ %d\n",
diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c
index 593a3aac12ce..52648573f601 100644
--- a/sound/oss/es1371.c
+++ b/sound/oss/es1371.c
@@ -2894,7 +2894,7 @@ static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_devic
2894 s->irq = pcidev->irq; 2894 s->irq = pcidev->irq;
2895 s->vendor = pcidev->vendor; 2895 s->vendor = pcidev->vendor;
2896 s->device = pcidev->device; 2896 s->device = pcidev->device;
2897 pci_read_config_byte(pcidev, PCI_REVISION_ID, &s->rev); 2897 s->rev = pcidev->revision;
2898 s->codec->private_data = s; 2898 s->codec->private_data = s;
2899 s->codec->id = 0; 2899 s->codec->id = 0;
2900 s->codec->codec_read = rdcodec; 2900 s->codec->codec_read = rdcodec;
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index cb59f994c68f..41543a4933e7 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2218,7 +2218,7 @@ static int __devinit snd_ali_create(struct snd_card *card,
2218 codec->card = card; 2218 codec->card = card;
2219 codec->pci = pci; 2219 codec->pci = pci;
2220 codec->irq = -1; 2220 codec->irq = -1;
2221 pci_read_config_byte(pci, PCI_REVISION_ID, &codec->revision); 2221 codec->revision = pci->revision;
2222 codec->spdif_support = spdif_support; 2222 codec->spdif_support = spdif_support;
2223 2223
2224 if (pcm_streams < 1) 2224 if (pcm_streams < 1)
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 7d8053b5e8d5..89184a424140 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1639,15 +1639,12 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1639{ 1639{
1640 struct snd_card *card; 1640 struct snd_card *card;
1641 struct atiixp *chip; 1641 struct atiixp *chip;
1642 unsigned char revision;
1643 int err; 1642 int err;
1644 1643
1645 card = snd_card_new(index, id, THIS_MODULE, 0); 1644 card = snd_card_new(index, id, THIS_MODULE, 0);
1646 if (card == NULL) 1645 if (card == NULL)
1647 return -ENOMEM; 1646 return -ENOMEM;
1648 1647
1649 pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
1650
1651 strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); 1648 strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA");
1652 strcpy(card->shortname, "ATI IXP"); 1649 strcpy(card->shortname, "ATI IXP");
1653 if ((err = snd_atiixp_create(card, pci, &chip)) < 0) 1650 if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
@@ -1670,7 +1667,8 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1670 snd_atiixp_chip_start(chip); 1667 snd_atiixp_chip_start(chip);
1671 1668
1672 snprintf(card->longname, sizeof(card->longname), 1669 snprintf(card->longname, sizeof(card->longname),
1673 "%s rev %x with %s at %#lx, irq %i", card->shortname, revision, 1670 "%s rev %x with %s at %#lx, irq %i", card->shortname,
1671 pci->revision,
1674 chip->ac97[0] ? snd_ac97_get_short_name(chip->ac97[0]) : "?", 1672 chip->ac97[0] ? snd_ac97_get_short_name(chip->ac97[0]) : "?",
1675 chip->addr, chip->irq); 1673 chip->addr, chip->irq);
1676 1674
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 904023fe4f26..ce752f84457a 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1283,15 +1283,12 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1283{ 1283{
1284 struct snd_card *card; 1284 struct snd_card *card;
1285 struct atiixp_modem *chip; 1285 struct atiixp_modem *chip;
1286 unsigned char revision;
1287 int err; 1286 int err;
1288 1287
1289 card = snd_card_new(index, id, THIS_MODULE, 0); 1288 card = snd_card_new(index, id, THIS_MODULE, 0);
1290 if (card == NULL) 1289 if (card == NULL)
1291 return -ENOMEM; 1290 return -ENOMEM;
1292 1291
1293 pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
1294
1295 strcpy(card->driver, "ATIIXP-MODEM"); 1292 strcpy(card->driver, "ATIIXP-MODEM");
1296 strcpy(card->shortname, "ATI IXP Modem"); 1293 strcpy(card->shortname, "ATI IXP Modem");
1297 if ((err = snd_atiixp_create(card, pci, &chip)) < 0) 1294 if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
@@ -1312,7 +1309,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1312 snd_atiixp_chip_start(chip); 1309 snd_atiixp_chip_start(chip);
1313 1310
1314 sprintf(card->longname, "%s rev %x at 0x%lx, irq %i", 1311 sprintf(card->longname, "%s rev %x at 0x%lx, irq %i",
1315 card->shortname, revision, chip->addr, chip->irq); 1312 card->shortname, pci->revision, chip->addr, chip->irq);
1316 1313
1317 if ((err = snd_card_register(card)) < 0) 1314 if ((err = snd_card_register(card)) < 0)
1318 goto __error; 1315 goto __error;
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index 238154bb7a25..5ec1b6fcd548 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -341,11 +341,7 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
341 snd_card_free(card); 341 snd_card_free(card);
342 return err; 342 return err;
343 } 343 }
344 if ((err = pci_read_config_byte(pci, PCI_REVISION_ID, 344 chip->rev = pci->revision;
345 &(chip->rev))) < 0) {
346 snd_card_free(card);
347 return err;
348 }
349#ifdef CHIP_AU8830 345#ifdef CHIP_AU8830
350 if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) { 346 if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) {
351 printk(KERN_ALERT 347 printk(KERN_ALERT
diff --git a/sound/pci/ca0106/ca0106.h b/sound/pci/ca0106/ca0106.h
index aaac6e5b4767..a0420bc63f0b 100644
--- a/sound/pci/ca0106/ca0106.h
+++ b/sound/pci/ca0106/ca0106.h
@@ -590,7 +590,6 @@ struct snd_ca0106 {
590 struct resource *res_port; 590 struct resource *res_port;
591 int irq; 591 int irq;
592 592
593 unsigned char revision; /* chip revision */
594 unsigned int serial; /* serial number */ 593 unsigned int serial; /* serial number */
595 unsigned short model; /* subsystem id */ 594 unsigned short model; /* subsystem id */
596 595
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 48f3f17c5170..9fd7b8a5b75e 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1293,13 +1293,12 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card,
1293 } 1293 }
1294 1294
1295 pci_set_master(pci); 1295 pci_set_master(pci);
1296 /* read revision & serial */ 1296 /* read serial */
1297 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->revision);
1298 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 1297 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
1299 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 1298 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
1300#if 1 1299#if 1
1301 printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model, 1300 printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model,
1302 chip->revision, chip->serial); 1301 pci->revision, chip->serial);
1303#endif 1302#endif
1304 strcpy(card->driver, "CA0106"); 1303 strcpy(card->driver, "CA0106");
1305 strcpy(card->shortname, "CA0106"); 1304 strcpy(card->shortname, "CA0106");
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index dbc805c33fc4..4a9b59ad8ab1 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1511,7 +1511,6 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1511 struct snd_emu10k1 *emu; 1511 struct snd_emu10k1 *emu;
1512 int idx, err; 1512 int idx, err;
1513 int is_audigy; 1513 int is_audigy;
1514 unsigned char revision;
1515 unsigned int silent_page; 1514 unsigned int silent_page;
1516 const struct snd_emu_chip_details *c; 1515 const struct snd_emu_chip_details *c;
1517 static struct snd_device_ops ops = { 1516 static struct snd_device_ops ops = {
@@ -1543,8 +1542,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1543 emu->synth = NULL; 1542 emu->synth = NULL;
1544 emu->get_synth_voice = NULL; 1543 emu->get_synth_voice = NULL;
1545 /* read revision & serial */ 1544 /* read revision & serial */
1546 pci_read_config_byte(pci, PCI_REVISION_ID, &revision); 1545 emu->revision = pci->revision;
1547 emu->revision = revision;
1548 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial); 1546 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
1549 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model); 1547 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
1550 snd_printdd("vendor=0x%x, device=0x%x, subsystem_vendor_id=0x%x, subsystem_id=0x%x\n",pci->vendor, pci->device, emu->serial, emu->model); 1548 snd_printdd("vendor=0x%x, device=0x%x, subsystem_vendor_id=0x%x, subsystem_id=0x%x\n",pci->vendor, pci->device, emu->serial, emu->model);
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index bb0fec7f7e1b..e4af7a9b808c 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -942,7 +942,7 @@ static int __devinit snd_emu10k1x_create(struct snd_card *card,
942 942
943 pci_set_master(pci); 943 pci_set_master(pci);
944 /* read revision & serial */ 944 /* read revision & serial */
945 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->revision); 945 chip->revision = pci->revision;
946 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 946 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
947 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 947 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
948 snd_printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model, 948 snd_printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model,
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 6a0ddcf00884..7c403965153b 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2110,7 +2110,6 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
2110 struct ensoniq ** rensoniq) 2110 struct ensoniq ** rensoniq)
2111{ 2111{
2112 struct ensoniq *ensoniq; 2112 struct ensoniq *ensoniq;
2113 unsigned char cmdb;
2114 int err; 2113 int err;
2115 static struct snd_device_ops ops = { 2114 static struct snd_device_ops ops = {
2116 .dev_free = snd_ensoniq_dev_free, 2115 .dev_free = snd_ensoniq_dev_free,
@@ -2151,8 +2150,7 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
2151 } 2150 }
2152#endif 2151#endif
2153 pci_set_master(pci); 2152 pci_set_master(pci);
2154 pci_read_config_byte(pci, PCI_REVISION_ID, &cmdb); 2153 ensoniq->rev = pci->revision;
2155 ensoniq->rev = cmdb;
2156#ifdef CHIP1370 2154#ifdef CHIP1370
2157#if 0 2155#if 0
2158 ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE | 2156 ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 6dc578bbeec9..11015178e207 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1369,7 +1369,6 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1369 struct fm801 ** rchip) 1369 struct fm801 ** rchip)
1370{ 1370{
1371 struct fm801 *chip; 1371 struct fm801 *chip;
1372 unsigned char rev;
1373 int err; 1372 int err;
1374 static struct snd_device_ops ops = { 1373 static struct snd_device_ops ops = {
1375 .dev_free = snd_fm801_dev_free, 1374 .dev_free = snd_fm801_dev_free,
@@ -1405,8 +1404,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1405 pci_set_master(pci); 1404 pci_set_master(pci);
1406 } 1405 }
1407 1406
1408 pci_read_config_byte(pci, PCI_REVISION_ID, &rev); 1407 if (pci->revision >= 0xb1) /* FM801-AU */
1409 if (rev >= 0xb1) /* FM801-AU */
1410 chip->multichannel = 1; 1408 chip->multichannel = 1;
1411 1409
1412 snd_fm801_chip_init(chip, 0); 1410 snd_fm801_chip_init(chip, 0);
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index a28992269f5e..50c9f92cfd1b 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2431,7 +2431,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2431{ 2431{
2432 struct snd_card *card; 2432 struct snd_card *card;
2433 struct via82xx *chip; 2433 struct via82xx *chip;
2434 unsigned char revision;
2435 int chip_type = 0, card_type; 2434 int chip_type = 0, card_type;
2436 unsigned int i; 2435 unsigned int i;
2437 int err; 2436 int err;
@@ -2441,18 +2440,17 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2441 return -ENOMEM; 2440 return -ENOMEM;
2442 2441
2443 card_type = pci_id->driver_data; 2442 card_type = pci_id->driver_data;
2444 pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
2445 switch (card_type) { 2443 switch (card_type) {
2446 case TYPE_CARD_VIA686: 2444 case TYPE_CARD_VIA686:
2447 strcpy(card->driver, "VIA686A"); 2445 strcpy(card->driver, "VIA686A");
2448 sprintf(card->shortname, "VIA 82C686A/B rev%x", revision); 2446 sprintf(card->shortname, "VIA 82C686A/B rev%x", pci->revision);
2449 chip_type = TYPE_VIA686; 2447 chip_type = TYPE_VIA686;
2450 break; 2448 break;
2451 case TYPE_CARD_VIA8233: 2449 case TYPE_CARD_VIA8233:
2452 chip_type = TYPE_VIA8233; 2450 chip_type = TYPE_VIA8233;
2453 sprintf(card->shortname, "VIA 823x rev%x", revision); 2451 sprintf(card->shortname, "VIA 823x rev%x", pci->revision);
2454 for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) { 2452 for (i = 0; i < ARRAY_SIZE(via823x_cards); i++) {
2455 if (revision == via823x_cards[i].revision) { 2453 if (pci->revision == via823x_cards[i].revision) {
2456 chip_type = via823x_cards[i].type; 2454 chip_type = via823x_cards[i].type;
2457 strcpy(card->shortname, via823x_cards[i].name); 2455 strcpy(card->shortname, via823x_cards[i].name);
2458 break; 2456 break;
@@ -2460,7 +2458,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2460 } 2458 }
2461 if (chip_type != TYPE_VIA8233A) { 2459 if (chip_type != TYPE_VIA8233A) {
2462 if (dxs_support == VIA_DXS_AUTO) 2460 if (dxs_support == VIA_DXS_AUTO)
2463 dxs_support = check_dxs_list(pci, revision); 2461 dxs_support = check_dxs_list(pci, pci->revision);
2464 /* force to use VIA8233 or 8233A model according to 2462 /* force to use VIA8233 or 8233A model according to
2465 * dxs_support module option 2463 * dxs_support module option
2466 */ 2464 */
@@ -2471,7 +2469,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2471 } 2469 }
2472 if (chip_type == TYPE_VIA8233A) 2470 if (chip_type == TYPE_VIA8233A)
2473 strcpy(card->driver, "VIA8233A"); 2471 strcpy(card->driver, "VIA8233A");
2474 else if (revision >= VIA_REV_8237) 2472 else if (pci->revision >= VIA_REV_8237)
2475 strcpy(card->driver, "VIA8237"); /* no slog assignment */ 2473 strcpy(card->driver, "VIA8237"); /* no slog assignment */
2476 else 2474 else
2477 strcpy(card->driver, "VIA8233"); 2475 strcpy(card->driver, "VIA8233");
@@ -2482,7 +2480,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2482 goto __error; 2480 goto __error;
2483 } 2481 }
2484 2482
2485 if ((err = snd_via82xx_create(card, pci, chip_type, revision, 2483 if ((err = snd_via82xx_create(card, pci, chip_type, pci->revision,
2486 ac97_clock, &chip)) < 0) 2484 ac97_clock, &chip)) < 0)
2487 goto __error; 2485 goto __error;
2488 card->private_data = chip; 2486 card->private_data = chip;
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index b338e15db0d9..8cbf8eba4ae9 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1162,7 +1162,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1162{ 1162{
1163 struct snd_card *card; 1163 struct snd_card *card;
1164 struct via82xx_modem *chip; 1164 struct via82xx_modem *chip;
1165 unsigned char revision;
1166 int chip_type = 0, card_type; 1165 int chip_type = 0, card_type;
1167 unsigned int i; 1166 unsigned int i;
1168 int err; 1167 int err;
@@ -1172,7 +1171,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1172 return -ENOMEM; 1171 return -ENOMEM;
1173 1172
1174 card_type = pci_id->driver_data; 1173 card_type = pci_id->driver_data;
1175 pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
1176 switch (card_type) { 1174 switch (card_type) {
1177 case TYPE_CARD_VIA82XX_MODEM: 1175 case TYPE_CARD_VIA82XX_MODEM:
1178 strcpy(card->driver, "VIA82XX-MODEM"); 1176 strcpy(card->driver, "VIA82XX-MODEM");
@@ -1184,7 +1182,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1184 goto __error; 1182 goto __error;
1185 } 1183 }
1186 1184
1187 if ((err = snd_via82xx_create(card, pci, chip_type, revision, 1185 if ((err = snd_via82xx_create(card, pci, chip_type, pci->revision,
1188 ac97_clock, &chip)) < 0) 1186 ac97_clock, &chip)) < 0)
1189 goto __error; 1187 goto __error;
1190 card->private_data = chip; 1188 card->private_data = chip;
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index ea861bceaddf..ab7a81c35705 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2404,7 +2404,7 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
2404 chip->pci = pci; 2404 chip->pci = pci;
2405 chip->irq = -1; 2405 chip->irq = -1;
2406 chip->device_id = pci->device; 2406 chip->device_id = pci->device;
2407 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->rev); 2407 chip->rev = pci->revision;
2408 chip->reg_area_phys = pci_resource_start(pci, 0); 2408 chip->reg_area_phys = pci_resource_start(pci, 0);
2409 chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000); 2409 chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000);
2410 pci_set_master(pci); 2410 pci_set_master(pci);