diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2013-09-25 12:27:43 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-10-24 17:16:57 +0200 |
commit | 69db3b5e850d0cac543d8523cbde17a4729f8990 (patch) | |
tree | d2883079d4c7472f3c58987903e7ea2db479e159 /arch/s390/pci/pci.c | |
parent | e258d719ff28ecc7a048eb8f78380e68c4b3a3f0 (diff) | |
download | linux-69db3b5e850d0cac543d8523cbde17a4729f8990.tar.gz linux-69db3b5e850d0cac543d8523cbde17a4729f8990.tar.bz2 linux-69db3b5e850d0cac543d8523cbde17a4729f8990.zip |
s390/pci: implement hibernation hooks
Implement architecture-specific functionality when a PCI device is
doing a hibernate transition.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/pci/pci.c')
-rw-r--r-- | arch/s390/pci/pci.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index f17a8343e360..206186c44ade 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -708,6 +708,47 @@ void pcibios_disable_device(struct pci_dev *pdev) zdev->pdev = NULL; } +#ifdef CONFIG_HIBERNATE_CALLBACKS +static int zpci_restore(struct device *dev) +{ + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); + int ret = 0; + + if (zdev->state != ZPCI_FN_STATE_ONLINE) + goto out; + + ret = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES); + if (ret) + goto out; + + zpci_map_resources(zdev); + zpci_register_ioat(zdev, 0, zdev->start_dma + PAGE_OFFSET, + zdev->start_dma + zdev->iommu_size - 1, + (u64) zdev->dma_table); + +out: + return ret; +} + +static int zpci_freeze(struct device *dev) +{ + struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); + + if (zdev->state != ZPCI_FN_STATE_ONLINE) + return 0; + + zpci_unregister_ioat(zdev, 0); + return clp_disable_fh(zdev); +} + +struct dev_pm_ops pcibios_pm_ops = { + .thaw_noirq = zpci_restore, + .freeze_noirq = zpci_freeze, + .restore_noirq = zpci_restore, + .poweroff_noirq = zpci_freeze, +}; +#endif /* CONFIG_HIBERNATE_CALLBACKS */ + static int zpci_scan_bus(struct zpci_dev *zdev) { struct resource *res; |