forked from mirrors/linux
		
	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 <jean.guyader@eu.citrix.com> Signed-off-by: Eric Chanudet <eric.chanudet@citrix.com> Signed-off-by: Allen Kay <allen.m.kay@intel.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
		
							parent
							
								
									2debd92899
								
							
						
					
					
						commit
						26f41062f2
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -959,6 +959,7 @@ void pci_restore_state(struct pci_dev *dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	u32 val;
 | 
						u32 val;
 | 
				
			||||||
 | 
						int tries;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!dev->state_saved)
 | 
						if (!dev->state_saved)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -973,12 +974,16 @@ void pci_restore_state(struct pci_dev *dev)
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	for (i = 15; i >= 0; i--) {
 | 
						for (i = 15; i >= 0; i--) {
 | 
				
			||||||
		pci_read_config_dword(dev, i * 4, &val);
 | 
							pci_read_config_dword(dev, i * 4, &val);
 | 
				
			||||||
		if (val != dev->saved_config_space[i]) {
 | 
							tries = 10;		
 | 
				
			||||||
 | 
							while (tries && val != dev->saved_config_space[i]) {
 | 
				
			||||||
			dev_dbg(&dev->dev, "restoring config "
 | 
								dev_dbg(&dev->dev, "restoring config "
 | 
				
			||||||
				"space at offset %#x (was %#x, writing %#x)\n",
 | 
									"space at offset %#x (was %#x, writing %#x)\n",
 | 
				
			||||||
				i, val, (int)dev->saved_config_space[i]);
 | 
									i, val, (int)dev->saved_config_space[i]);
 | 
				
			||||||
			pci_write_config_dword(dev,i * 4,
 | 
								pci_write_config_dword(dev,i * 4,
 | 
				
			||||||
				dev->saved_config_space[i]);
 | 
									dev->saved_config_space[i]);
 | 
				
			||||||
 | 
								pci_read_config_dword(dev, i * 4, &val);
 | 
				
			||||||
 | 
								mdelay(10);
 | 
				
			||||||
 | 
								tries--;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pci_restore_pcix_state(dev);
 | 
						pci_restore_pcix_state(dev);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue