svn commit: r242456 - stable/9/usr.sbin/pciconf
Jim Harris
jimharris at FreeBSD.org
Thu Nov 1 20:46:49 UTC 2012
Author: jimharris
Date: Thu Nov 1 20:46:48 2012
New Revision: 242456
URL: http://svn.freebsd.org/changeset/base/242456
Log:
MFC r242085:
For PCI Express capability, if max link width is greater than zero, print
the current and max link speed.
Sponsored by: Intel
Modified:
stable/9/usr.sbin/pciconf/cap.c
Directory Properties:
stable/9/usr.sbin/pciconf/ (props changed)
Modified: stable/9/usr.sbin/pciconf/cap.c
==============================================================================
--- stable/9/usr.sbin/pciconf/cap.c Thu Nov 1 20:43:23 2012 (r242455)
+++ stable/9/usr.sbin/pciconf/cap.c Thu Nov 1 20:46:48 2012 (r242456)
@@ -363,6 +363,22 @@ cap_subvendor(int fd, struct pci_conf *p
#define MAX_PAYLOAD(field) (128 << (field))
+static const char *
+link_speed_string(uint8_t speed)
+{
+
+ switch (speed) {
+ case 1:
+ return ("2.5");
+ case 2:
+ return ("5.0");
+ case 3:
+ return ("8.0");
+ default:
+ return ("undef");
+ }
+}
+
static void
cap_express(int fd, struct pci_conf *p, uint8_t ptr)
{
@@ -416,6 +432,16 @@ cap_express(int fd, struct pci_conf *p,
flags = read_config(fd, &p->pc_sel, ptr+ PCIER_LINK_STA, 2);
printf(" link x%d(x%d)", (flags & PCIEM_LINK_STA_WIDTH) >> 4,
(val & PCIEM_LINK_CAP_MAX_WIDTH) >> 4);
+ /*
+ * Only print link speed info if the link's max width is
+ * greater than 0.
+ */
+ if ((val & PCIEM_LINK_CAP_MAX_WIDTH) != 0) {
+ printf("\n speed");
+ printf(" %s(%s)", (flags & PCIEM_LINK_STA_WIDTH) == 0 ?
+ "0.0" : link_speed_string(flags & PCIEM_LINK_STA_SPEED),
+ link_speed_string(val & PCIEM_LINK_CAP_MAX_SPEED));
+ }
}
static void
More information about the svn-src-stable-9
mailing list