diff mbox

[05/12] PCI: Add standard PCIe Capability Link ASPM field names

Message ID 20121205205745.13851.5032.stgit@bhelgaas.mtv.corp.google.com
State Accepted
Headers show

Commit Message

Bjorn Helgaas Dec. 5, 2012, 8:57 p.m. UTC
Add standard #defines for ASPM fields in PCI Express Link Capability and
Link Control registers.

Previously we used PCIE_LINK_STATE_L0S and PCIE_LINK_STATE_L1 directly, but
these are defined for the Linux ASPM interfaces, e.g.,
pci_disable_link_state(), and only coincidentally match the actual register
bits.  PCIE_LINK_STATE_CLKPM, also part of that interface, does not match
the register bit.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
CC: Shaohua Li <shaohua.li@intel.com>
---
 drivers/pci/pcie/aspm.c       |   11 ++++++-----
 include/uapi/linux/pci_regs.h |    2 ++
 2 files changed, 8 insertions(+), 5 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Kenji Kaneshige Dec. 6, 2012, 2:29 a.m. UTC | #1
UmV2aWV3ZWQtYnk6IEtlbmppIEthbmVzaGlnZSA8a2FuZXNoaWdlLmtlbmppQGpwLmZ1aml0c3Uu
Y29tPg0KQWNrZWQtYnk6IEtlbmppIEthbmVzaGlnZSA8a2FuZXNoaWdlLmtlbmppQGpwLmZ1aml0
c3UuY29tPg0KDQpSZWdhcmRzLA0KS2VuamkgS2FuZXNoaWdlDQoNCj4gLS0tLS1PcmlnaW5hbCBN
ZXNzYWdlLS0tLS0NCj4gRnJvbTogQmpvcm4gSGVsZ2FhcyBbbWFpbHRvOmJoZWxnYWFzQGdvb2ds
ZS5jb21dDQo+IFNlbnQ6IFRodXJzZGF5LCBEZWNlbWJlciAwNiwgMjAxMiA1OjU4IEFNDQo+IFRv
OiBsaW51eC1wY2lAdmdlci5rZXJuZWwub3JnDQo+IENjOiBTaGFvaHVhIExpOyBLYW5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AQCAtNDY5LDYgKzQ2OSw4IEBADQo+ICAjZGVmaW5lICBQQ0lfRVhQX0xOS0NBUF9QTgkweGZm
MDAwMDAwIC8qIFBvcnQgTnVtYmVyICovDQo+ICAjZGVmaW5lIFBDSV9FWFBfTE5LQ1RMCQkxNgkv
KiBMaW5rIENvbnRyb2wgKi8NCj4gICNkZWZpbmUgIFBDSV9FWFBfTE5LQ1RMX0FTUE1DCTB4MDAw
MwkvKiBBU1BNIENvbnRyb2wgKi8NCj4gKyNkZWZpbmUgIFBDSV9FWFBfTE5LQ1RMX0FTUE1fTDBT
ICAweDAxCS8qIEwwcyBFbmFibGUgKi8NCj4gKyNkZWZpbmUgIFBDSV9FWFBfTE5LQ1RMX0FTUE1f
TDEgICAweDAyCS8qIEwxIEVuYWJsZSAqLw0KPiAgI2RlZmluZSAgUENJX0VYUF9MTktDVExfUkNC
CTB4MDAwOAkvKiBSZWFkIENvbXBsZXRpb24gQm91bmRhcnkgKi8NCj4gICNkZWZpbmUgIFBDSV9F
WFBfTE5LQ1RMX0xECTB4MDAxMAkvKiBMaW5rIERpc2FibGUgKi8NCj4gICNkZWZpbmUgIFBDSV9F
WFBfTE5LQ1RMX1JMCTB4MDAyMAkvKiBSZXRyYWluIExpbmsgKi8NCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 213753b..c2faf9d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -427,7 +427,8 @@  static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
 
 static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val)
 {
-	pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL, 0x3, val);
+	pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL,
+					   PCI_EXP_LNKCTL_ASPMC, val);
 }
 
 static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state)
@@ -442,12 +443,12 @@  static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state)
 		return;
 	/* Convert ASPM state to upstream/downstream ASPM register state */
 	if (state & ASPM_STATE_L0S_UP)
-		dwstream |= PCIE_LINK_STATE_L0S;
+		dwstream |= PCI_EXP_LNKCTL_ASPM_L0S;
 	if (state & ASPM_STATE_L0S_DW)
-		upstream |= PCIE_LINK_STATE_L0S;
+		upstream |= PCI_EXP_LNKCTL_ASPM_L0S;
 	if (state & ASPM_STATE_L1) {
-		upstream |= PCIE_LINK_STATE_L1;
-		dwstream |= PCIE_LINK_STATE_L1;
+		upstream |= PCI_EXP_LNKCTL_ASPM_L1;
+		dwstream |= PCI_EXP_LNKCTL_ASPM_L1;
 	}
 	/*
 	 * Spec 2.0 suggests all functions should be configured the
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 4cca834..0b6dbe4 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -469,6 +469,8 @@ 
 #define  PCI_EXP_LNKCAP_PN	0xff000000 /* Port Number */
 #define PCI_EXP_LNKCTL		16	/* Link Control */
 #define  PCI_EXP_LNKCTL_ASPMC	0x0003	/* ASPM Control */
+#define  PCI_EXP_LNKCTL_ASPM_L0S  0x01	/* L0s Enable */
+#define  PCI_EXP_LNKCTL_ASPM_L1   0x02	/* L1 Enable */
 #define  PCI_EXP_LNKCTL_RCB	0x0008	/* Read Completion Boundary */
 #define  PCI_EXP_LNKCTL_LD	0x0010	/* Link Disable */
 #define  PCI_EXP_LNKCTL_RL	0x0020	/* Retrain Link */