diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-11 18:28:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-11 18:28:04 -0400 |
commit | dc4967e756021f318d125c9f4fa98b958ae9f2de (patch) | |
tree | 05f6a50d69356ead5e988b214ab5f664389010bd /drivers | |
parent | c0bbbc73d58f1b774cd987b5687a478a027f137c (diff) | |
parent | 8b8c8d280ab2d18fe6e42d671f60d4ffed451cdc (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6:
[PATCH] PCI: reverse pci config space restore order
[PATCH] PCI: Improve PCI config space writeback
[PATCH] PCI: Error handling on PCI device resume
[PATCH] PCI: fix pciehp compile issue when CONFIG_ACPI is not enabled
Diffstat (limited to 'drivers')
-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 2329f941a0dc..12286275b1c8 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -461,9 +461,23 @@ int | |||
461 | pci_restore_state(struct pci_dev *dev) | 461 | pci_restore_state(struct pci_dev *dev) |
462 | { | 462 | { |
463 | int i; | 463 | int i; |
464 | int val; | ||
464 | 465 | ||
465 | for (i = 0; i < 16; i++) | 466 | /* |
466 | pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); | 467 | * The Base Address register should be programmed before the command |
468 | * register(s) | ||
469 | */ | ||
470 | for (i = 15; i >= 0; i--) { | ||
471 | pci_read_config_dword(dev, i * 4, &val); | ||
472 | if (val != dev->saved_config_space[i]) { | ||
473 | printk(KERN_DEBUG "PM: Writing back config space on " | ||
474 | "device %s at offset %x (was %x, writing %x)\n", | ||
475 | pci_name(dev), i, | ||
476 | val, (int)dev->saved_config_space[i]); | ||
477 | pci_write_config_dword(dev,i * 4, | ||
478 | dev->saved_config_space[i]); | ||
479 | } | ||
480 | } | ||
467 | pci_restore_msi_state(dev); | 481 | pci_restore_msi_state(dev); |
468 | pci_restore_msix_state(dev); | 482 | pci_restore_msix_state(dev); |
469 | return 0; | 483 | return 0; |