summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>1998-11-12 00:22:30 +0000
committerken <ken@FreeBSD.org>1998-11-12 00:22:30 +0000
commit0a5629342320bff180a7842a0d6b212c66f307d4 (patch)
tree791a873eebeac7a60c197805462ad616dbd7a3e1 /usr.sbin
parent72d94f3752451e5e09da0e1a432eadf2bdb38c7e (diff)
downloadFreeBSD-src-0a5629342320bff180a7842a0d6b212c66f307d4.zip
FreeBSD-src-0a5629342320bff180a7842a0d6b212c66f307d4.tar.gz
Modify pciconf(8) so that it will print out PCI devices that have no driver
configured in the kernel. It gives them a device name of "none" and monotonically incrementing unit numbers. (starting at 0) Before, pciconf would just skip over unconfigured devices. (unconfigured devices can be detected because they have a null string for a device name) Update the man page to reflect the new pciconf output. Unfortunately, this causes the sample 'pciconf -l' output lines to wrap, but I'm not sure what to do about that really. If anyone presents a reasonable case for printing out something other than "none1" for unconfigured devices, I'm willing to listen.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pciconf/pciconf.818
-rw-r--r--usr.sbin/pciconf/pciconf.c10
2 files changed, 19 insertions, 9 deletions
diff --git a/usr.sbin/pciconf/pciconf.8 b/usr.sbin/pciconf/pciconf.8
index a7d6ac4..97ea040 100644
--- a/usr.sbin/pciconf/pciconf.8
+++ b/usr.sbin/pciconf/pciconf.8
@@ -1,4 +1,4 @@
-.\" $Id: pciconf.8,v 1.2 1997/02/22 16:09:06 peter Exp $
+.\" $Id: pciconf.8,v 1.3 1997/10/06 11:38:29 charnier Exp $
.\" Copyright (c) 1997
.\" Stefan Esser <se@freebsd.org>. All rights reserved.
.\"
@@ -50,14 +50,22 @@ With the
.Fl l
option, it lists all devices found by the boot probe in the following format:
.Bd -literal
-pci0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 hdr=0x00
-pci0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 hdr=0x00
-pci0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 hdr=0x00
+foo0@pci0:4:0: class=0x010000 card=0x00000000 chip=0x000f1000 rev=0x01 hdr=0x00
+bar0@pci0:5:0: class=0x000100 card=0x00000000 chip=0x88c15333 rev=0x00 hdr=0x00
+none0@pci0:6:0: class=0x020000 card=0x00000000 chip=0x802910ec rev=0x00 hdr=0x00
.Ed
.Pp
The first column gives the
+device name, unit number, and
+.Ar selector .
+If there is no device configured in the kernel for the
+.Tn PCI
+device in question, the device name will be
+.Dq none .
+Unit numbers for unconfigured devices start at zero and are incremented for
+each unconfigured device that is encountered. The
.Ar selector
-in a form which may directly be used for the other forms of the command.
+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
diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c
index 2f2979a..1d7954d 100644
--- a/usr.sbin/pciconf/pciconf.c
+++ b/usr.sbin/pciconf/pciconf.c
@@ -29,7 +29,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: pciconf.c,v 1.5 1997/10/06 11:38:30 charnier Exp $";
+ "$Id: pciconf.c,v 1.6 1998/09/15 08:21:13 gibbs Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -134,6 +134,7 @@ list_devs(void)
int fd;
struct pci_conf_io pc;
struct pci_conf conf[255], *p;
+ int none_count = 0;
fd = open(_PATH_DEVPCI, O_RDWR, 0);
if (fd < 0)
@@ -167,12 +168,13 @@ list_devs(void)
return;
}
for (p = conf; p < &conf[pc.num_matches]; p++) {
- if ((p->pd_name == NULL) || (*p->pd_name == '\0'))
- continue;
printf("%s%d@pci%d:%d:%d:\tclass=0x%06x card=0x%08lx "
"chip=0x%08lx rev=0x%02x hdr=0x%02x\n",
- p->pd_name, p->pd_unit,
+ (p->pd_name && *p->pd_name) ? p->pd_name :
+ "none",
+ (p->pd_name && *p->pd_name) ? p->pd_unit :
+ none_count++,
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,
OpenPOWER on IntegriCloud