svn commit: r353462 - head/usr.sbin/pciconf

Scott Long scottl at FreeBSD.org
Sun Oct 13 05:11:55 UTC 2019


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 at pci0:0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 \
-hdr=0x00
-bar0 at pci0:0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 \
-hdr=0x00
-none0 at pci0:0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 \
-hdr=0x00
+foo0 at pci0:0:4:0: class=0x010000 rev=0x01 hdr=0x00 vendor=0x1000 device=0x000f \
+subvendor=0x0000 subdevice=0x0000
+bar0 at pci0:0:5:0: class=0x000100 rev=0x00 hdr=0x00 vendor=0x88c1 device=0x5333 \
+subvendor=0x0000 subdevice=0x0000
+none0 at 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 at 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 at 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)


More information about the svn-src-all mailing list