ia64/linux-2.6.18-xen.hg

changeset 840:5ad6b350e4ab

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>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Mar 19 10:21:21 2009 +0000 (2009-03-19)
parents 3d4c92b97556
children 558c390e3d92
files drivers/pci/pci.c include/linux/pci_regs.h
line diff
     1.1 --- a/drivers/pci/pci.c	Thu Mar 19 10:20:59 2009 +0000
     1.2 +++ b/drivers/pci/pci.c	Thu Mar 19 10:21:21 2009 +0000
     1.3 @@ -428,6 +428,8 @@ pci_power_t pci_choose_state(struct pci_
     1.4  
     1.5  EXPORT_SYMBOL(pci_choose_state);
     1.6  
     1.7 +#define PCI_EXP_SAVE_REGS	7
     1.8 +
     1.9  static int pci_save_pcie_state(struct pci_dev *dev)
    1.10  {
    1.11  	int pos, i = 0;
    1.12 @@ -449,6 +451,9 @@ static int pci_save_pcie_state(struct pc
    1.13  	pci_read_config_word(dev, pos + PCI_EXP_LNKCTL, &cap[i++]);
    1.14  	pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]);
    1.15  	pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]);
    1.16 +	pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]);
    1.17 +	pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]);
    1.18 +	pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]);
    1.19  
    1.20  	return 0;
    1.21  }
    1.22 @@ -469,6 +474,9 @@ static void pci_restore_pcie_state(struc
    1.23  	pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]);
    1.24  	pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]);
    1.25  	pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]);
    1.26 +	pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]);
    1.27 +	pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]);
    1.28 +	pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]);
    1.29  }
    1.30  
    1.31  
    1.32 @@ -739,7 +747,8 @@ void pci_allocate_cap_save_buffers(struc
    1.33  {
    1.34  	int error;
    1.35  
    1.36 -	error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP, 4 * sizeof(u16));
    1.37 +	error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP,
    1.38 +					PCI_EXP_SAVE_REGS * sizeof(u16));
    1.39  	if (error)
    1.40  		dev_err(&dev->dev,
    1.41  			"unable to preallocate PCI Express save buffer\n");
     2.1 --- a/include/linux/pci_regs.h	Thu Mar 19 10:20:59 2009 +0000
     2.2 +++ b/include/linux/pci_regs.h	Thu Mar 19 10:21:21 2009 +0000
     2.3 @@ -383,6 +383,8 @@
     2.4  #define  PCI_EXP_DEVCAP2_ARI	0x20	/* Alternative Routing-ID */
     2.5  #define PCI_EXP_DEVCTL2		40	/* Device Control 2 */
     2.6  #define  PCI_EXP_DEVCTL2_ARI	0x20	/* Alternative Routing-ID */
     2.7 +#define PCI_EXP_LNKCTL2		48	/* Link Control 2 */
     2.8 +#define PCI_EXP_SLTCTL2		56	/* Slot Control 2 */
     2.9  
    2.10  /* Extended Capabilities (PCI-X 2.0 and Express) */
    2.11  #define PCI_EXT_CAP_ID(header)		(header & 0x0000ffff)