diff options
author | jimharris <jimharris@FreeBSD.org> | 2012-10-25 17:22:37 +0000 |
---|---|---|
committer | jimharris <jimharris@FreeBSD.org> | 2012-10-25 17:22:37 +0000 |
commit | e85387fbf1e08197b1b399092b2d71c41d1e0adb (patch) | |
tree | 29846eb1b21c68f2e558c6f40a8b67fd1a6bc113 | |
parent | c79636c277bb1672903667176fdb1db9c05f42e4 (diff) | |
download | FreeBSD-src-e85387fbf1e08197b1b399092b2d71c41d1e0adb.zip FreeBSD-src-e85387fbf1e08197b1b399092b2d71c41d1e0adb.tar.gz |
For PCI Express capability, if max link width is greater than zero, print
the current and max link speed.
Sponsored by: Intel
Discussed with: jhb
MFC after: 1 week
-rw-r--r-- | usr.sbin/pciconf/cap.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c index 4d3fab9..ce184dd 100644 --- a/usr.sbin/pciconf/cap.c +++ b/usr.sbin/pciconf/cap.c @@ -363,6 +363,22 @@ cap_subvendor(int fd, struct pci_conf *p, uint8_t ptr) #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) { @@ -418,6 +434,16 @@ cap_express(int fd, struct pci_conf *p, uint8_t ptr) 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 |