summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pciconf/pciconf.c
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/pciconf/pciconf.c
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/pciconf/pciconf.c')
-rw-r--r--usr.sbin/pciconf/pciconf.c10
1 files changed, 6 insertions, 4 deletions
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