From owner-svn-src-all@freebsd.org Sun Oct 13 05:11:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19EA3E4F14; Sun, 13 Oct 2019 05:11:55 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46rVDB6zD4z4XVq; Sun, 13 Oct 2019 05:11:54 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D31BD18179; Sun, 13 Oct 2019 05:11:54 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9D5BsUl083314; Sun, 13 Oct 2019 05:11:54 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9D5BsPT083310; Sun, 13 Oct 2019 05:11:54 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201910130511.x9D5BsPT083310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 13 Oct 2019 05:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353462 - head/usr.sbin/pciconf X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/usr.sbin/pciconf X-SVN-Commit-Revision: 353462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2019 05:11:55 -0000 Author: scottl Date: Sun Oct 13 05:11:53 2019 New Revision: 353462 URL: https://svnweb.freebsd.org/changeset/base/353462 Log: Fix the botched field ordering in the last commit. While here, fix whitespace, and also reorder the fields so they are easier to read on an 80 column display (the lines wrapped even before these changes). Also fix non-standard nomenclature in the Caps code, and update the man page. Reported by: rpokala Modified: head/usr.sbin/pciconf/cap.c head/usr.sbin/pciconf/pciconf.8 head/usr.sbin/pciconf/pciconf.c Modified: head/usr.sbin/pciconf/cap.c ============================================================================== --- head/usr.sbin/pciconf/cap.c Sun Oct 13 04:25:16 2019 (r353461) +++ head/usr.sbin/pciconf/cap.c Sun Oct 13 05:11:53 2019 (r353462) @@ -371,9 +371,12 @@ static void cap_subvendor(int fd, struct pci_conf *p, uint8_t ptr) { uint32_t id; + uint16_t ssid, ssvid; id = read_config(fd, &p->pc_sel, ptr + PCIR_SUBVENDCAP_ID, 4); - printf("PCI Bridge card=0x%08x", id); + ssid = id >> 16; + ssvid = id & 0xffff; + printf("PCI Bridge subvendor=0x%04x subdevice=0x%04x", ssvid, ssid); } #define MAX_PAYLOAD(field) (128 << (field)) Modified: head/usr.sbin/pciconf/pciconf.8 ============================================================================== --- head/usr.sbin/pciconf/pciconf.8 Sun Oct 13 04:25:16 2019 (r353461) +++ head/usr.sbin/pciconf/pciconf.8 Sun Oct 13 05:11:53 2019 (r353462) @@ -60,16 +60,16 @@ option, .Nm lists PCI devices in the following format: .Bd -literal -foo0@pci0:0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 \ -hdr=0x00 -bar0@pci0:0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 \ -hdr=0x00 -none0@pci0:0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 \ -hdr=0x00 +foo0@pci0:0:4:0: class=0x010000 rev=0x01 hdr=0x00 vendor=0x1000 device=0x000f \ +subvendor=0x0000 subdevice=0x0000 +bar0@pci0:0:5:0: class=0x000100 rev=0x00 hdr=0x00 vendor=0x88c1 device=0x5333 \ +subvendor=0x0000 subdevice=0x0000 +none0@pci0:0:6:0: class=0x020000 rev=0x00 hdr=0x00 vendor=0x10ec device=0x8029 \ +subvendor=0x0000 subdevice=0x0000 .Ed .Pp The first column gives the -driver name, unit number, and selector . +driver name, unit number, and selector. If there is no driver attached to the .Tn PCI device in question, the driver name will be @@ -80,21 +80,10 @@ The selector is in a form which may directly be used for the other forms of the command. The second column is the class code, with the class byte printed as two hex digits, followed by the sub-class and the interface bytes. -The third column gives the contents of the subvendorid register, introduced -in revision 2.1 of the -.Tn PCI -standard. -Note that it will be 0 for older cards. -The field consists of the card ID in the upper -half and the card vendor ID in the lower half of the value. +The third column prints the device's revision. +The fourth column describes the header type. .Pp -The fourth column contains the chip device ID, which identifies the chip -this card is based on. -It consists of two fields, identifying the chip and -its vendor, as above. -The fifth column prints the chip's revision. -The sixth column describes the header type. -Currently assigned header types include 0 for most devices, +Currently assigned header types include 0 for standard devices, 1 for .Tn PCI to @@ -112,6 +101,14 @@ device, it is a .Em multi-function device, which contains several (similar or independent) functions on one chip. +.Pp +The sixth and seventh columns contain the vendor ID and the device ID of the +device. +The eigth and ninth columns contain subvendor and subdevice IDs, introduced +in revision 2.1 of the +.Tn PCI +standard. +Note that they will be 0 for older cards. .Pp If the .Fl B Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Sun Oct 13 04:25:16 2019 (r353461) +++ head/usr.sbin/pciconf/pciconf.c Sun Oct 13 05:11:53 2019 (r353462) @@ -261,8 +261,10 @@ list_devs(const char *name, int verbose, int bars, int return; } for (p = conf; p < &conf[pc.num_matches]; p++) { - printf("%s%d@pci%d:%d:%d:%d:\tclass=0x%06x subvendor=0x%04x subdevice=0x%04x " - "vendor=0x%04x device=0x%04x rev=0x%02x hdr=0x%02x\n", + printf("%s%d@pci%d:%d:%d:%d:" + "\tclass=0x%06x rev=0x%02x hdr=0x%02x " + "vendor=0x%04x device=0x%04x " + "subvendor=0x%04x subdevice=0x%04x\n", *p->pd_name ? p->pd_name : "none", *p->pd_name ? (int)p->pd_unit : @@ -270,9 +272,9 @@ list_devs(const char *name, int verbose, int bars, int p->pc_sel.pc_bus, p->pc_sel.pc_dev, p->pc_sel.pc_func, (p->pc_class << 16) | (p->pc_subclass << 8) | p->pc_progif, - p->pc_subdevice, p->pc_subvendor, - p->pc_device, p->pc_vendor, - p->pc_revid, p->pc_hdr); + p->pc_revid, p->pc_hdr, + p->pc_vendor, p->pc_device, + p->pc_subvendor, p->pc_subdevice); if (verbose) list_verbose(p); if (bars)