add -N option to print the driver name as returned by pci_drvname(3).
This commit is contained in:
parent
0edf2e8fd2
commit
8865fe7c92
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: pcictl.8,v 1.11 2014/08/26 16:21:15 wiz Exp $
|
||||
.\" $NetBSD: pcictl.8,v 1.12 2014/08/31 09:16:54 mrg Exp $
|
||||
.\"
|
||||
.\" Copyright 2001 Wasabi Systems, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -33,7 +33,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd February 25, 2011
|
||||
.Dd August 31, 2014
|
||||
.Dt PCICTL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -56,6 +56,7 @@ The following commands are available:
|
||||
.Pp
|
||||
.Cm list
|
||||
.Op Fl n
|
||||
.Op Fl N
|
||||
.Op Fl b Ar bus
|
||||
.Op Fl d Ar device
|
||||
.Op Fl f Ar function
|
||||
@ -68,6 +69,10 @@ numbers may be specified by flags.
|
||||
Any locator not specified defaults
|
||||
to a wildcard, or may be explicitly wildcarded by specifying
|
||||
.Dq any .
|
||||
If
|
||||
.Fl N
|
||||
is given, the driver name for this PCI device will be listed
|
||||
if any driver is attached.
|
||||
.Pp
|
||||
.Cm dump
|
||||
.Op Fl b Ar bus
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pcictl.c,v 1.18 2011/08/30 20:08:38 joerg Exp $ */
|
||||
/* $NetBSD: pcictl.c,v 1.19 2014/08/31 09:16:54 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001 Wasabi Systems, Inc.
|
||||
@ -73,13 +73,14 @@ static const char *dvname;
|
||||
static char dvname_store[MAXPATHLEN];
|
||||
static const char *cmdname;
|
||||
static int print_numbers = 0;
|
||||
static int print_names = 0;
|
||||
|
||||
static void cmd_list(int, char *[]);
|
||||
static void cmd_dump(int, char *[]);
|
||||
|
||||
static const struct command commands[] = {
|
||||
{ "list",
|
||||
"[-n] [-b bus] [-d device] [-f function]",
|
||||
"[-nN] [-b bus] [-d device] [-f function]",
|
||||
cmd_list,
|
||||
O_RDONLY },
|
||||
|
||||
@ -162,7 +163,7 @@ cmd_list(int argc, char *argv[])
|
||||
bus = -1;
|
||||
dev = func = -1;
|
||||
|
||||
while ((ch = getopt(argc, argv, "nb:d:f:")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "nNb:d:f:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
bus = parse_bdf(optarg);
|
||||
@ -176,6 +177,9 @@ cmd_list(int argc, char *argv[])
|
||||
case 'n':
|
||||
print_numbers = 1;
|
||||
break;
|
||||
case 'N':
|
||||
print_names = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
@ -318,11 +322,17 @@ scan_pci_list(u_int bus, u_int dev, u_int func)
|
||||
|
||||
printf("%03u:%02u:%01u: ", bus, dev, func);
|
||||
if (print_numbers) {
|
||||
printf("0x%08x (0x%08x)\n", id, class);
|
||||
printf("0x%08x (0x%08x)", id, class);
|
||||
} else {
|
||||
pci_devinfo(id, class, 1, devinfo, sizeof(devinfo));
|
||||
printf("%s\n", devinfo);
|
||||
printf("%s", devinfo);
|
||||
}
|
||||
if (print_names) {
|
||||
char drvname[16];
|
||||
if (pci_drvname(pcifd, dev, func, drvname, sizeof drvname) == 0)
|
||||
printf(" [%s]", drvname);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user