Skip to content

Commit e89bdfc

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 8288218 commit e89bdfc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/pci/pci.c

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

0 commit comments

Comments
 (0)