diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-06-13 20:29:04 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-06-13 20:29:04 -0400 |
commit | b5ed7639c9f502898af4109e778f5613dacbfd9c (patch) | |
tree | abe908c60ce1ea8f201028c9fc830cacd25c724b /drivers/pci | |
parent | 0638dec01e89059c853515ab71c55fd13ba5a8ea (diff) | |
parent | eb35cf60e462491249166182e3e755d3d5d91a28 (diff) |
Merge branch 'master' into upstream
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci-driver.c | 13 | ||||
-rw-r--r-- | drivers/pci/pci.c | 18 |
2 files changed, 24 insertions, 7 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 1456759936c5..10e1a905c144 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -285,9 +285,9 @@ static int pci_device_suspend(struct device * dev, pm_message_t state) | |||
285 | * Default resume method for devices that have no driver provided resume, | 285 | * Default resume method for devices that have no driver provided resume, |
286 | * or not even a driver at all. | 286 | * or not even a driver at all. |
287 | */ | 287 | */ |
288 | static void pci_default_resume(struct pci_dev *pci_dev) | 288 | static int pci_default_resume(struct pci_dev *pci_dev) |
289 | { | 289 | { |
290 | int retval; | 290 | int retval = 0; |
291 | 291 | ||
292 | /* restore the PCI config space */ | 292 | /* restore the PCI config space */ |
293 | pci_restore_state(pci_dev); | 293 | pci_restore_state(pci_dev); |
@@ -297,18 +297,21 @@ static void pci_default_resume(struct pci_dev *pci_dev) | |||
297 | /* if the device was busmaster before the suspend, make it busmaster again */ | 297 | /* if the device was busmaster before the suspend, make it busmaster again */ |
298 | if (pci_dev->is_busmaster) | 298 | if (pci_dev->is_busmaster) |
299 | pci_set_master(pci_dev); | 299 | pci_set_master(pci_dev); |
300 | |||
301 | return retval; | ||
300 | } | 302 | } |
301 | 303 | ||
302 | static int pci_device_resume(struct device * dev) | 304 | static int pci_device_resume(struct device * dev) |
303 | { | 305 | { |
306 | int error; | ||
304 | struct pci_dev * pci_dev = to_pci_dev(dev); | 307 | struct pci_dev * pci_dev = to_pci_dev(dev); |
305 | struct pci_driver * drv = pci_dev->driver; | 308 | struct pci_driver * drv = pci_dev->driver; |
306 | 309 | ||
307 | if (drv && drv->resume) | 310 | if (drv && drv->resume) |
308 | drv->resume(pci_dev); | 311 | error = drv->resume(pci_dev); |
309 | else | 312 | else |
310 | pci_default_resume(pci_dev); | 313 | error = pci_default_resume(pci_dev); |
311 | return 0; | 314 | return error; |
312 | } | 315 | } |
313 | 316 | ||
314 | static void pci_device_shutdown(struct device *dev) | 317 | static void pci_device_shutdown(struct device *dev) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 8d107c6c2c70..fde41cc14734 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -460,9 +460,23 @@ int | |||
460 | pci_restore_state(struct pci_dev *dev) | 460 | pci_restore_state(struct pci_dev *dev) |
461 | { | 461 | { |
462 | int i; | 462 | int i; |
463 | int val; | ||
463 | 464 | ||
464 | for (i = 0; i < 16; i++) | 465 | /* |
465 | pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); | 466 | * The Base Address register should be programmed before the command |
467 | * register(s) | ||
468 | */ | ||
469 | for (i = 15; i >= 0; i--) { | ||
470 | pci_read_config_dword(dev, i * 4, &val); | ||
471 | if (val != dev->saved_config_space[i]) { | ||
472 | printk(KERN_DEBUG "PM: Writing back config space on " | ||
473 | "device %s at offset %x (was %x, writing %x)\n", | ||
474 | pci_name(dev), i, | ||
475 | val, (int)dev->saved_config_space[i]); | ||
476 | pci_write_config_dword(dev,i * 4, | ||
477 | dev->saved_config_space[i]); | ||
478 | } | ||
479 | } | ||
466 | pci_restore_msi_state(dev); | 480 | pci_restore_msi_state(dev); |
467 | pci_restore_msix_state(dev); | 481 | pci_restore_msix_state(dev); |
468 | return 0; | 482 | return 0; |