diff options
| author | hubertf <hubertf@NetBSD.org> | 2006-10-01 00:13:27 +0000 |
|---|---|---|
| committer | hubertf <hubertf@NetBSD.org> | 2006-10-01 00:13:27 +0000 |
| commit | fe81bd2f72eb83ca286f4f586562ce73af3d24d6 (patch) | |
| tree | f6ec8183ba69ce07afce5707359ccad3b3215959 | |
| parent | b85065928522efe242bfce7d793bd324beb1f267 (diff) | |
Add "list -n" to print ID and class numerical, instead of resolving to strings:
miyu% pcictl /dev/pci1 list
001:00:0: ATI Technologies Rage Fury MAXX AGP 4x (TMDS) (VGA display)
miyu% pcictl /dev/pci1 list -n
001:00:0: 0x50461002 (0x3000000)
OK'd by thorpej@
| -rw-r--r-- | doc/CHANGES | 4 | ||||
| -rw-r--r-- | usr.sbin/pcictl/pcictl.8 | 10 | ||||
| -rw-r--r-- | usr.sbin/pcictl/pcictl.c | 20 |
3 files changed, 24 insertions, 10 deletions
diff --git a/doc/CHANGES b/doc/CHANGES index 8ddb6e70950..8b5c1a7b3a0 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,4 +1,4 @@ -LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.716 $> +LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.717 $> [Note: This file does not mention every change made to the NetBSD source tree. @@ -93,3 +93,5 @@ Changes from NetBSD 4.0 to NetBSD 5.0: ofctl(8): initial import, formerly known as ofdump2. For macppc, shark, sparc64. Written by Matt Thomas. [macallan 20060929] + pcictl(8): Add "list -n" to print ID and class numerical, instead + of resolving to strings [hubertf 20061001] diff --git a/usr.sbin/pcictl/pcictl.8 b/usr.sbin/pcictl/pcictl.8 index 5df036c8647..77ca313176d 100644 --- a/usr.sbin/pcictl/pcictl.8 +++ b/usr.sbin/pcictl/pcictl.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: pcictl.8,v 1.3 2003/08/18 16:12:58 yyamano Exp $ +.\" $NetBSD: pcictl.8,v 1.4 2006/10/01 00:13:28 hubertf 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 September 12, 2001 +.Dd October 1, 2006 .Os .Dt PCICTL 8 .Sh NAME @@ -55,11 +55,15 @@ on a PCI bus. The following commands are available: .Pp .Nm list +.Op Fl n .Op Fl b Ar bus .Op Fl d Ar device .Op Fl f Ar function .Pp -List the devices in the PCI domain. The bus, device, and function +List the devices in the PCI domain, either as names or if +.Fl n +is given as numbers. +The bus, device, and function numbers may be specified by flags. If the bus is not specified, it defaults to the bus number of the PCI bus specified on the command line. Any other locator not specified defaults diff --git a/usr.sbin/pcictl/pcictl.c b/usr.sbin/pcictl/pcictl.c index 0b41f09827d..ca3926e9db3 100644 --- a/usr.sbin/pcictl/pcictl.c +++ b/usr.sbin/pcictl/pcictl.c @@ -1,4 +1,4 @@ -/* $NetBSD: pcictl.c,v 1.9 2006/08/24 07:30:16 bsh Exp $ */ +/* $NetBSD: pcictl.c,v 1.10 2006/10/01 00:13:28 hubertf Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -74,13 +74,14 @@ const char *dvname; char dvname_store[MAXPATHLEN]; const char *cmdname; const char *argnames; +int print_numbers = 0; void cmd_list(int, char *[]); void cmd_dump(int, char *[]); const struct command commands[] = { { "list", - "[-b bus] [-d device] [-f function]", + "[-n] [-b bus] [-d device] [-f function]", cmd_list, O_RDONLY }, @@ -165,7 +166,7 @@ cmd_list(int argc, char *argv[]) bus = pci_businfo.busno; dev = func = -1; - while ((ch = getopt(argc, argv, "b:d:f:")) != -1) { + while ((ch = getopt(argc, argv, "nb:d:f:")) != -1) { switch (ch) { case 'b': bus = parse_bdf(optarg); @@ -176,6 +177,9 @@ cmd_list(int argc, char *argv[]) case 'f': func = parse_bdf(optarg); break; + case 'n': + print_numbers = 1; + break; default: usage(); } @@ -316,9 +320,13 @@ scan_pci_list(u_int bus, u_int dev, u_int func) if (pcibus_conf_read(pcifd, bus, dev, func, PCI_CLASS_REG, &class) != 0) return; - pci_devinfo(id, class, 1, devinfo, sizeof(devinfo)); - - printf("%03u:%02u:%01u: %s\n", bus, dev, func, devinfo); + printf("%03u:%02u:%01u: ", bus, dev, func); + if (print_numbers) { + printf("0x%x (0x%x)\n", id, class); + } else { + pci_devinfo(id, class, 1, devinfo, sizeof(devinfo)); + printf("%s\n", devinfo); + } } void |
