From owner-svn-src-stable@FreeBSD.ORG Thu Nov 1 20:47:19 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 065338E0; Thu, 1 Nov 2012 20:47:19 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1C588FC12; Thu, 1 Nov 2012 20:47:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id qA1KlIYt073339; Thu, 1 Nov 2012 20:47:18 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id qA1KlIwV073337; Thu, 1 Nov 2012 20:47:18 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201211012047.qA1KlIwV073337@svn.freebsd.org> From: Jim Harris Date: Thu, 1 Nov 2012 20:47:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r242457 - stable/8/usr.sbin/pciconf X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Nov 2012 20:47:19 -0000 Author: jimharris Date: Thu Nov 1 20:47:18 2012 New Revision: 242457 URL: http://svn.freebsd.org/changeset/base/242457 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/8/usr.sbin/pciconf/cap.c Directory Properties: stable/8/usr.sbin/pciconf/ (props changed) Modified: stable/8/usr.sbin/pciconf/cap.c ============================================================================== --- stable/8/usr.sbin/pciconf/cap.c Thu Nov 1 20:46:48 2012 (r242456) +++ stable/8/usr.sbin/pciconf/cap.c Thu Nov 1 20:47:18 2012 (r242457) @@ -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