Improve PCI config space writeback.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: Dave Jones <[email protected]>


--- linux-2.6.16.noarch/drivers/pci/pci.c~	2006-04-16 17:36:34.000000000 -0500
+++ linux-2.6.16.noarch/drivers/pci/pci.c	2006-04-16 17:37:42.000000000 -0500
@@ -461,9 +461,17 @@ int 
 pci_restore_state(struct pci_dev *dev)
 {
 	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_msix_state(dev);
 	return 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux