Commit 04d9c1a1 authored by Dave Jones's avatar Dave Jones Committed by Greg Kroah-Hartman

[PATCH] PCI: Improve PCI config space writeback

At least one laptop blew up on resume from suspend with a black screen due
to a lack of this patch.  By only writing back config space that is
different, we minimise the possibility of accidents like this.
Signed-off-by: default avatarDave Jones <davej@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8d92bc22
...@@ -461,9 +461,19 @@ int ...@@ -461,9 +461,19 @@ int
pci_restore_state(struct pci_dev *dev) pci_restore_state(struct pci_dev *dev)
{ {
int i; int i;
int val;
for (i = 0; i < 16; i++)
pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); for (i = 0; i < 16; i++) {
pci_read_config_dword(dev, i * 4, &val);
if (val != dev->saved_config_space[i]) {
printk(KERN_DEBUG "PM: Writing back config space on "
"device %s at offset %x (was %x, writing %x)\n",
pci_name(dev), i,
val, (int)dev->saved_config_space[i]);
pci_write_config_dword(dev,i * 4,
dev->saved_config_space[i]);
}
}
pci_restore_msi_state(dev); pci_restore_msi_state(dev);
pci_restore_msix_state(dev); pci_restore_msix_state(dev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment