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.
This commit is contained in:
parent
8aa83c6653
commit
7f054c59a5
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user