diff options
author | Yu Zhao <yu.zhao@intel.com> | 2009-02-15 13:55:47 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-03-26 19:02:30 -0400 |
commit | 898585172fa729513d8636257b44bd1cfd279096 (patch) | |
tree | 8c2b7305dc95aaac5836a28d8a59efaa743e56ba /drivers/pci/pci.c | |
parent | 7bb2cb3e90dc49be1cd14956c155451499c857a7 (diff) |
PCI: save and restore PCIe 2.0 registers
PCIe 2.0 defines several new registers (Device Control 2, Link Control 2,
and Slot Control 2). Save and retore them in pci_save_pcie_state() and
pci_restore_pcie_state().
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 676bbcbc272b..59569b8cf1d5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -647,6 +647,8 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) | |||
647 | 647 | ||
648 | EXPORT_SYMBOL(pci_choose_state); | 648 | EXPORT_SYMBOL(pci_choose_state); |
649 | 649 | ||
650 | #define PCI_EXP_SAVE_REGS 7 | ||
651 | |||
650 | static int pci_save_pcie_state(struct pci_dev *dev) | 652 | static int pci_save_pcie_state(struct pci_dev *dev) |
651 | { | 653 | { |
652 | int pos, i = 0; | 654 | int pos, i = 0; |
@@ -668,6 +670,9 @@ static int pci_save_pcie_state(struct pci_dev *dev) | |||
668 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL, &cap[i++]); | 670 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL, &cap[i++]); |
669 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]); | 671 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]); |
670 | pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]); | 672 | pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]); |
673 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]); | ||
674 | pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]); | ||
675 | pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]); | ||
671 | 676 | ||
672 | return 0; | 677 | return 0; |
673 | } | 678 | } |
@@ -688,6 +693,9 @@ static void pci_restore_pcie_state(struct pci_dev *dev) | |||
688 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]); | 693 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]); |
689 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); | 694 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); |
690 | pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); | 695 | pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); |
696 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]); | ||
697 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]); | ||
698 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]); | ||
691 | } | 699 | } |
692 | 700 | ||
693 | 701 | ||
@@ -1372,7 +1380,8 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev) | |||
1372 | { | 1380 | { |
1373 | int error; | 1381 | int error; |
1374 | 1382 | ||
1375 | error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP, 4 * sizeof(u16)); | 1383 | error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP, |
1384 | PCI_EXP_SAVE_REGS * sizeof(u16)); | ||
1376 | if (error) | 1385 | if (error) |
1377 | dev_err(&dev->dev, | 1386 | dev_err(&dev->dev, |
1378 | "unable to preallocate PCI Express save buffer\n"); | 1387 | "unable to preallocate PCI Express save buffer\n"); |