Skip to content

Commit 26f4106

Browse files
yaknellajbarnes993
authored andcommitted
PCI: check for pci bar restore completion and retry
On some OEM systems, pci_restore_state() is called while FLR has not yet completed. As a result, PCI BAR register restore is not successful. This fix reads back the restored value and compares it with saved value and re-tries 10 times before giving up. Signed-off-by: Jean Guyader <[email protected]> Signed-off-by: Eric Chanudet <[email protected]> Signed-off-by: Allen Kay <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent 2debd92 commit 26f4106

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/pci/pci.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ void pci_restore_state(struct pci_dev *dev)
959959
{
960960
int i;
961961
u32 val;
962+
int tries;
962963

963964
if (!dev->state_saved)
964965
return;
@@ -973,12 +974,16 @@ void pci_restore_state(struct pci_dev *dev)
973974
*/
974975
for (i = 15; i >= 0; i--) {
975976
pci_read_config_dword(dev, i * 4, &val);
976-
if (val != dev->saved_config_space[i]) {
977+
tries = 10;
978+
while (tries && val != dev->saved_config_space[i]) {
977979
dev_dbg(&dev->dev, "restoring config "
978980
"space at offset %#x (was %#x, writing %#x)\n",
979981
i, val, (int)dev->saved_config_space[i]);
980982
pci_write_config_dword(dev,i * 4,
981983
dev->saved_config_space[i]);
984+
pci_read_config_dword(dev, i * 4, &val);
985+
mdelay(10);
986+
tries--;
982987
}
983988
}
984989
pci_restore_pcix_state(dev);

0 commit comments

Comments
 (0)