linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Extend interfaces to access PCIe capabilities registers
@ 2013-01-26  0:55 Myron Stowe
  2013-01-26  0:55 ` [PATCH 1/2] PCI: introduce accessor to retrieve PCIe Capabilities Register Myron Stowe
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Myron Stowe @ 2013-01-26  0:55 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, jiang.liu, mcgrof, mcgrof, linux-kernel

This series is a minor extension to Jiang Liu's recent efforts - [PATCH v3
00/32] provide interfaces to access PCIe capabilities registers - which
adds an additional PCI Express accessor for obtaining a device's
Capabilities Register.

Reference: https://lkml.org/lkml/2012/8/1/253
---

Myron Stowe (2):
      PCI: Use PCI Express Capability accessors
      PCI: introduce accessor to retrieve PCIe Capabilities Register


 drivers/pci/access.c            |    4 ++--
 drivers/pci/pcie/portdrv_core.c |    2 +-
 include/linux/pci.h             |   11 ++++++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

-- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] PCI: introduce accessor to retrieve PCIe Capabilities Register
  2013-01-26  0:55 [PATCH 0/2] Extend interfaces to access PCIe capabilities registers Myron Stowe
@ 2013-01-26  0:55 ` Myron Stowe
  2013-01-26  0:55 ` [PATCH 2/2] PCI: Use PCI Express Capability accessors Myron Stowe
  2013-01-31  4:29 ` [PATCH 0/2] Extend interfaces to access PCIe capabilities registers Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Myron Stowe @ 2013-01-26  0:55 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, jiang.liu, mcgrof, mcgrof, linux-kernel

Provide an accessor to retrieve the PCI Express device's Capabilities
Register.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
---

 include/linux/pci.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 15472d6..78581e1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1693,6 +1693,15 @@ static inline bool pci_is_pcie(struct pci_dev *dev)
 }
 
 /**
+ * pcie_caps_reg - get the PCIe Capabilities Register
+ * @dev: PCI device
+ */
+static inline u16 pcie_caps_reg(const struct pci_dev *dev)
+{
+	return dev->pcie_flags_reg;
+}
+
+/**
  * pci_pcie_type - get the PCIe device/port type
  * @dev: PCI device
  */


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] PCI: Use PCI Express Capability accessors
  2013-01-26  0:55 [PATCH 0/2] Extend interfaces to access PCIe capabilities registers Myron Stowe
  2013-01-26  0:55 ` [PATCH 1/2] PCI: introduce accessor to retrieve PCIe Capabilities Register Myron Stowe
@ 2013-01-26  0:55 ` Myron Stowe
  2013-01-31  4:29 ` [PATCH 0/2] Extend interfaces to access PCIe capabilities registers Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Myron Stowe @ 2013-01-26  0:55 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, jiang.liu, mcgrof, mcgrof, linux-kernel

Use PCI Express Capability access functions to simplify device
Capabilities Register usages.

Signed-off-by: Myron Stowe <myron.stowe@redhat.com>
---

 drivers/pci/access.c            |    4 ++--
 drivers/pci/pcie/portdrv_core.c |    2 +-
 include/linux/pci.h             |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 3af0478..5278ac6 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -472,7 +472,7 @@ EXPORT_SYMBOL_GPL(pci_cfg_access_unlock);
 
 static inline int pcie_cap_version(const struct pci_dev *dev)
 {
-	return dev->pcie_flags_reg & PCI_EXP_FLAGS_VERS;
+	return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS;
 }
 
 static inline bool pcie_cap_has_devctl(const struct pci_dev *dev)
@@ -497,7 +497,7 @@ static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
 	return pcie_cap_version(dev) > 1 ||
 	       type == PCI_EXP_TYPE_ROOT_PORT ||
 	       (type == PCI_EXP_TYPE_DOWNSTREAM &&
-		dev->pcie_flags_reg & PCI_EXP_FLAGS_SLOT);
+		pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT);
 }
 
 static inline bool pcie_cap_has_rtctl(const struct pci_dev *dev)
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index b42133a..31063ac 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -272,7 +272,7 @@ static int get_port_device_capability(struct pci_dev *dev)
 
 	/* Hot-Plug Capable */
 	if ((cap_mask & PCIE_PORT_SERVICE_HP) &&
-	    dev->pcie_flags_reg & PCI_EXP_FLAGS_SLOT) {
+	    pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT) {
 		pcie_capability_read_dword(dev, PCI_EXP_SLTCAP, &reg32);
 		if (reg32 & PCI_EXP_SLTCAP_HPC) {
 			services |= PCIE_PORT_SERVICE_HP;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 78581e1..63b3628 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1707,7 +1707,7 @@ static inline u16 pcie_caps_reg(const struct pci_dev *dev)
  */
 static inline int pci_pcie_type(const struct pci_dev *dev)
 {
-	return (dev->pcie_flags_reg & PCI_EXP_FLAGS_TYPE) >> 4;
+	return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
 }
 
 void pci_request_acs(void);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Extend interfaces to access PCIe capabilities registers
  2013-01-26  0:55 [PATCH 0/2] Extend interfaces to access PCIe capabilities registers Myron Stowe
  2013-01-26  0:55 ` [PATCH 1/2] PCI: introduce accessor to retrieve PCIe Capabilities Register Myron Stowe
  2013-01-26  0:55 ` [PATCH 2/2] PCI: Use PCI Express Capability accessors Myron Stowe
@ 2013-01-31  4:29 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2013-01-31  4:29 UTC (permalink / raw)
  To: Myron Stowe; +Cc: linux-pci, jiang.liu, mcgrof, mcgrof, linux-kernel

On Fri, Jan 25, 2013 at 5:55 PM, Myron Stowe <myron.stowe@redhat.com> wrote:
> This series is a minor extension to Jiang Liu's recent efforts - [PATCH v3
> 00/32] provide interfaces to access PCIe capabilities registers - which
> adds an additional PCI Express accessor for obtaining a device's
> Capabilities Register.
>
> Reference: https://lkml.org/lkml/2012/8/1/253
> ---
>
> Myron Stowe (2):
>       PCI: Use PCI Express Capability accessors
>       PCI: introduce accessor to retrieve PCIe Capabilities Register
>
>
>  drivers/pci/access.c            |    4 ++--
>  drivers/pci/pcie/portdrv_core.c |    2 +-
>  include/linux/pci.h             |   11 ++++++++++-
>  3 files changed, 13 insertions(+), 4 deletions(-)

I applied these to pci/misc for v3.9.  Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-31  4:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-26  0:55 [PATCH 0/2] Extend interfaces to access PCIe capabilities registers Myron Stowe
2013-01-26  0:55 ` [PATCH 1/2] PCI: introduce accessor to retrieve PCIe Capabilities Register Myron Stowe
2013-01-26  0:55 ` [PATCH 2/2] PCI: Use PCI Express Capability accessors Myron Stowe
2013-01-31  4:29 ` [PATCH 0/2] Extend interfaces to access PCIe capabilities registers Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).