Skip to content

Commit f156052

Browse files
torvaldshnaz
authored andcommitted
pci: test for unexpectedly disabled bridges
The all-ones value is not just a "device didn't exist" case, it's also potentially a quite valid value, so not restoring it would be wrong. What *would* be interesting is to hear where the bad values came from in the first place. It sounds like the device state is saved after the PCI bus controller in front of the device has been crapped on, resulting in the PCI config cycles never reaching the device at all. Something along this patch (together with suspend/resume debugging output) migth help pinpoint it. But it really sounds like something totally brokenly turned off the PCI bridge (some ACPI shutdown crud? I wouldn't be entirely surprised) Cc: Greg KH <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3b9d609 commit f156052

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/pci/pci.c

+9
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,15 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
10941094
int pci_save_state(struct pci_dev *dev)
10951095
{
10961096
int i;
1097+
u32 val;
1098+
1099+
/* Unable to read PCI device/manufacturer state? Something is seriously wrong! */
1100+
if (pci_read_config_dword(dev, 0, &val) || val == 0xffffffff) {
1101+
printk("Broken read from PCI device %s\n", pci_name(dev));
1102+
WARN_ON(1);
1103+
return -1;
1104+
}
1105+
10971106
/* XXX: 100% dword access ok here? */
10981107
for (i = 0; i < 16; i++)
10991108
pci_read_config_dword(dev, i * 4, &dev->saved_config_space[i]);

0 commit comments

Comments
 (0)