Re: [PATCH] PCI: save and restore PCIe 2.0 registers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jesse,

Can you please pick up this fix? It's necessary for the latest PCIe 2.0
plafforms to support the S0/S3.

Thanks,
Yu

On Mon, Feb 16, 2009 at 02:55:47AM +0800, Zhao, Yu wrote:
> 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@xxxxxxxxx>
> ---
>  drivers/pci/pci.c        |   11 ++++++++++-
>  include/linux/pci_regs.h |    2 ++
>  2 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index f791dcf..9376763 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -645,6 +645,8 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
>  
>  EXPORT_SYMBOL(pci_choose_state);
>  
> +#define PCI_EXP_SAVE_REGS	7
> +
>  static int pci_save_pcie_state(struct pci_dev *dev)
>  {
>  	int pos, i = 0;
> @@ -666,6 +668,9 @@ static int pci_save_pcie_state(struct pci_dev *dev)
>  	pci_read_config_word(dev, pos + PCI_EXP_LNKCTL, &cap[i++]);
>  	pci_read_config_word(dev, pos + PCI_EXP_SLTCTL, &cap[i++]);
>  	pci_read_config_word(dev, pos + PCI_EXP_RTCTL, &cap[i++]);
> +	pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &cap[i++]);
> +	pci_read_config_word(dev, pos + PCI_EXP_LNKCTL2, &cap[i++]);
> +	pci_read_config_word(dev, pos + PCI_EXP_SLTCTL2, &cap[i++]);
>  
>  	return 0;
>  }
> @@ -686,6 +691,9 @@ static void pci_restore_pcie_state(struct pci_dev *dev)
>  	pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]);
>  	pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]);
>  	pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]);
> +	pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, cap[i++]);
> +	pci_write_config_word(dev, pos + PCI_EXP_LNKCTL2, cap[i++]);
> +	pci_write_config_word(dev, pos + PCI_EXP_SLTCTL2, cap[i++]);
>  }
>  
>  
> @@ -1370,7 +1378,8 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev)
>  {
>  	int error;
>  
> -	error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP, 4 * sizeof(u16));
> +	error = pci_add_cap_save_buffer(dev, PCI_CAP_ID_EXP,
> +					PCI_EXP_SAVE_REGS * sizeof(u16));
>  	if (error)
>  		dev_err(&dev->dev,
>  			"unable to preallocate PCI Express save buffer\n");
> diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
> index 4ce5eb0..196e202 100644
> --- a/include/linux/pci_regs.h
> +++ b/include/linux/pci_regs.h
> @@ -488,6 +488,8 @@
>  #define  PCI_EXP_DEVCAP2_ARI	0x20	/* Alternative Routing-ID */
>  #define PCI_EXP_DEVCTL2		40	/* Device Control 2 */
>  #define  PCI_EXP_DEVCTL2_ARI	0x20	/* Alternative Routing-ID */
> +#define PCI_EXP_LNKCTL2		48	/* Link Control 2 */
> +#define PCI_EXP_SLTCTL2		56	/* Slot Control 2 */
>  
>  /* Extended Capabilities (PCI-X 2.0 and Express) */
>  #define PCI_EXT_CAP_ID(header)		(header & 0x0000ffff)
> -- 
> 1.5.6.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux