Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci - Modify message of PCIe capability version. Thi...
details: https://anonhg.NetBSD.org/src/rev/cd08be29afa0
branches: trunk
changeset: 332488:cd08be29afa0
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed Sep 24 09:49:49 2014 +0000
description:
- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s
diffstat:
sys/dev/pci/ppb.c | 36 +++++++++++++++++++-----------------
1 files changed, 19 insertions(+), 17 deletions(-)
diffs (83 lines):
diff -r 2807db734c6d -r cd08be29afa0 sys/dev/pci/ppb.c
--- a/sys/dev/pci/ppb.c Wed Sep 24 07:53:06 2014 +0000
+++ b/sys/dev/pci/ppb.c Wed Sep 24 09:49:49 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ppb.c,v 1.52 2013/04/21 19:59:41 msaitoh Exp $ */
+/* $NetBSD: ppb.c,v 1.53 2014/09/24 09:49:49 msaitoh Exp $ */
/*
* Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.52 2013/04/21 19:59:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.53 2014/09/24 09:49:49 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -108,17 +108,17 @@
&off, ®))
return; /* Not a PCIe device */
- aprint_normal_dev(self, "PCI Express ");
+ aprint_normal_dev(self, "PCI Express capability version ");
switch (reg & PCIE_XCAP_VER_MASK) {
case PCIE_XCAP_VER_1_0:
- aprint_normal("1.0");
+ aprint_normal("1");
break;
case PCIE_XCAP_VER_2_0:
- aprint_normal("2.0");
+ aprint_normal("2");
break;
default:
aprint_normal_dev(self,
- "version unsupported (0x%" PRIxMAX ")\n",
+ "unsupported (0x%" PRIxMAX ")\n",
__SHIFTOUT(reg, PCIE_XCAP_VER_MASK));
return;
}
@@ -155,29 +155,31 @@
case PCIE_XCAP_TYPE_ROOT:
case PCIE_XCAP_TYPE_DOWN:
case PCIE_XCAP_TYPE_PCI2PCIE:
- reg = pci_conf_read(sc->sc_pc, sc->sc_tag, off + 0x0c);
- u_int mlw = (reg >> 4) & 0x1f;
- u_int mls = (reg >> 0) & 0x0f;
+ reg = pci_conf_read(sc->sc_pc, sc->sc_tag, off + PCIE_LCAP);
+ u_int mlw = __SHIFTOUT(reg, PCIE_LCAP_MAX_WIDTH);
+ u_int mls = __SHIFTOUT(reg, PCIE_LCAP_MAX_SPEED);
+
if (mls < __arraycount(pcie_linkspeed_strings)) {
- aprint_normal("> x%d @ %sGb/s\n",
+ aprint_normal("> x%d @ %sGT/s\n",
mlw, pcie_linkspeed_strings[mls]);
} else {
- aprint_normal("> x%d @ %d.%dGb/s\n",
+ aprint_normal("> x%d @ %d.%dGT/s\n",
mlw, (mls * 25) / 10, (mls * 25) % 10);
}
- reg = pci_conf_read(sc->sc_pc, sc->sc_tag, off + 0x10);
- if (reg & __BIT(29)) { /* DLLA */
- u_int lw = (reg >> 20) & 0x1f;
- u_int ls = (reg >> 16) & 0x0f;
+ reg = pci_conf_read(sc->sc_pc, sc->sc_tag, off + PCIE_LCSR);
+ if (reg & PCIE_LCSR_DLACTIVE) { /* DLLA */
+ u_int lw = __SHIFTOUT(reg, PCIE_LCSR_NLW);
+ u_int ls = __SHIFTOUT(reg, PCIE_LCSR_LINKSPEED);
+
if (lw != mlw || ls != mls) {
if (ls < __arraycount(pcie_linkspeed_strings)) {
aprint_normal_dev(self,
- "link is x%d @ %sGb/s\n",
+ "link is x%d @ %sGT/s\n",
lw, pcie_linkspeed_strings[ls]);
} else {
aprint_normal_dev(self,
- "link is x%d @ %d.%dGb/s\n",
+ "link is x%d @ %d.%dGT/s\n",
lw, (ls * 25) / 10, (ls * 25) % 10);
}
}
Home |
Main Index |
Thread Index |
Old Index