]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Retry BARs restoration for Type 0 headers only
authorRafael J. Wysocki <rjw@sisk.pl>
Mon, 16 Apr 2012 21:07:50 +0000 (23:07 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 17 Apr 2012 01:33:35 +0000 (18:33 -0700)
commita7ff27ab5d096913c9f0f0bc43c2b21009040874
treefb3fc13b4b58e010b1b08c1ae89df810382063dc
parentfe0388b11b1a817fd9a64e2fe07cb33b9bd88177
PCI: Retry BARs restoration for Type 0 headers only

Some shortcomings introduced into pci_restore_state() by commit
b446fce748f0 ("PCI: check for pci bar restore completion and retry")
have been fixed by recent commit b8d6f0a8f15ea ("PCI: Fix regression in
pci_restore_state(), v3"), but that commit treats all PCI devices as
those with Type 0 configuration headers.

That is not entirely correct, because Type 1 and Type 2 headers have
different layouts.  In particular, the area occupied by BARs in Type 0
config headers contains the secondary status register in Type 1 ones and
it doesn't make sense to retry the restoration of that register even if
the value read back from it after a write is not the same as the written
one (it very well may be different).

For this reason, make pci_restore_state() only retry the restoration
of BARs for Type 0 config headers.  This effectively makes it behave
as before commit b446fce748f0 for all header types except for Type 0.

Tested-by: Mikko Vinni <mmvinni@yahoo.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/pci/pci.c