From 0a33d0ec6a6f41d183347267a2ee4a2cf4fe0f7d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 15 Feb 1998 09:30:37 +0000 Subject: [PATCH] Added machine-readable dump format. pci.ids updates from Jens Maurer. Released as version 1.02. --- ChangeLog | 14 ++++++++++++++ README | 4 +++- lspci.8 | 6 +++++- lspci.c | 44 +++++++++++++++++++++++++++++++++++++++++--- pci.ids | 25 +++++++++++++++++++------ pciutils.lsm | 8 ++++---- 6 files changed, 86 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7206ced..e0c8bd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Sun Feb 15 10:12:25 1998 Martin Mares + + * lspci.c (show_machine): Added non-verbose mode of machine-readable + dump. + + * pci.ids: Updates from Jens Maurer. + + * Released as version 1.02. + +Thu Feb 12 16:53:28 1998 Martin Mares + + * lspci.c: Added a "-m" switch for dumping machine-readable + configuration data (requested by Bjoern Kriews ). + Mon Feb 9 13:17:43 1998 Martin Mares * Makefile, pciutils.h: Include local pci.h instead of diff --git a/README b/README index 0c50684..eb5ce0b 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This package contains the Linux PCI Utilities, version 1.01. +This package contains the Linux PCI Utilities, version 1.02. Copyright (c) 1998 Martin Mares @@ -32,3 +32,5 @@ TODO: - Full displaying of CardBus bridge configuration. (Has anyone seen full specs of the CardBus bridge / header type 2?) + + - Subsystem vendor and device ID? diff --git a/lspci.8 b/lspci.8 index 954f7e8..def2859 100644 --- a/lspci.8 +++ b/lspci.8 @@ -1,4 +1,4 @@ -.TH lspci 8 "9 February 98" "pciutils-1.01" "Linux PCI Utilities" +.TH lspci 8 "15 February 98" "pciutils-1.02" "Linux PCI Utilities" .IX lspci .SH NAME lspci \- list all PCI devices @@ -83,6 +83,10 @@ as PCI ID database instead of /etc/pci.ids. Use .B as directory containing PCI bus information instead of /proc/bus/pci. +.TP +.B -m +Dump PCI device data in machine readable form (both normal and verbose format supported) +for easy parsing by scripts. .SH FILES .TP diff --git a/lspci.c b/lspci.c index fc2db61..ae061a3 100644 --- a/lspci.c +++ b/lspci.c @@ -1,5 +1,5 @@ /* - * $Id: lspci.c,v 1.7 1998/02/09 12:32:54 mj Exp $ + * $Id: lspci.c,v 1.8 1998/02/15 09:30:39 mj Exp $ * * Linux PCI Utilities -- List All PCI Devices * @@ -27,9 +27,10 @@ static int func_filter = -1; static int vend_filter = -1; static int dev_filter = -1; static int show_tree; /* Show bus tree */ +static int machine_readable; /* Generate machine-readable output */ static char *pci_dir = PROC_BUS_PCI; -static char options[] = "nvbxB:S:F:V:D:ti:p:"; +static char options[] = "nvbxB:S:F:V:D:ti:p:m"; static char help_msg[] = "\ Usage: lspci []\n\ @@ -40,6 +41,7 @@ Usage: lspci []\n\ -x\tShow hex-dump of config space (-xx shows full 256 bytes)\n\ -B , -S , -F , -V , -D Show only selected devices\n\ -t\tShow bus tree\n\ +-m\tProduce machine-readable output\n\ -i \tUse specified ID database instead of " ETC_PCI_IDS "\n\ -p \tUse specified bus directory instead of " PROC_BUS_PCI "\n\ "; @@ -593,6 +595,37 @@ show_hex_dump(struct device *d) } } +static void +show_machine(struct device *d) +{ + int c; + + if (verbose) + { + printf("Device:\t%02x:%02x.%x\n", d->bus, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); + printf("Class:\t%s\n", lookup_class(get_conf_word(d, PCI_CLASS_DEVICE))); + printf("Vendor:\t%s\n", lookup_vendor(d->vendid)); + printf("Device:\t%s\n", lookup_device(d->vendid, d->devid)); + if (c = get_conf_byte(d, PCI_REVISION_ID)) + printf("Rev:\t%02x\n", c); + if (c = get_conf_byte(d, PCI_CLASS_PROG)) + printf("ProgIf:\t%02x\n", c); + } + else + { + printf("%02x:%02x.%x ", d->bus, PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); + printf("\"%s\" \"%s\" \"%s\"", + lookup_class(get_conf_word(d, PCI_CLASS_DEVICE)), + lookup_vendor(d->vendid), + lookup_device(d->vendid, d->devid)); + if (c = get_conf_byte(d, PCI_REVISION_ID)) + printf(" -r%02x", c); + if (c = get_conf_byte(d, PCI_CLASS_PROG)) + printf(" -p%02x", c); + putchar('\n'); + } +} + static void show(void) { @@ -600,7 +633,9 @@ show(void) for(d=first_dev; d; d=d->next) { - if (verbose) + if (machine_readable) + show_machine(d); + else if (verbose) show_verbose(d); else show_terse(d); @@ -876,6 +911,9 @@ main(int argc, char **argv) case 'p': pci_dir = optarg; break; + case 'm': + machine_readable++; + break; default: bad: fprintf(stderr, help_msg); diff --git a/pci.ids b/pci.ids index 713f593..86e3ce1 100644 --- a/pci.ids +++ b/pci.ids @@ -1,10 +1,10 @@ # # List of PCI ID's # -# Maintained by Jens Maurer +# Maintained by Jens Maurer # If you have any new entries, send them to the maintainer. # -# $Id: pci.ids,v 1.4 1998/02/08 12:47:07 ecd Exp $ +# $Id: pci.ids,v 1.5 1998/02/15 09:30:40 mj Exp $ # # Vendors and devices. Please keep sorted. @@ -100,6 +100,7 @@ 0016 DGLPB [OPPO] 0019 DECchip 21142/43 0021 DECchip 21052 + 0022 DECchip 21150 0024 DECchip 21152 1012 Micronics Computers Inc 1013 Cirrus Logic @@ -125,7 +126,9 @@ 001d 82G2675 0020 MCA 0022 IBM27-82351 + 002e ServeRAID controller 0036 Miami + 007d MPEG2 1015 LSI Logic Corp of Canada 1016 ICL Personal Systems 1017 SPEA Software AG @@ -153,6 +156,7 @@ 2040 79c974 1023 Trident Microsystems 9320 TGUI 9320 + 9397 Cyber9397 9420 TGUI 9420 9430 TGUI 9430 9440 TGUI 9440 @@ -207,6 +211,7 @@ 0001 SG86C201 0002 SG86C202 0008 85C503 + 0200 5598 0204 82C204 0205 SG86C205 0406 85C501/2 @@ -238,7 +243,7 @@ 3020 Samurai_IDE 1043 Asustek Computer, Inc. 1044 Distributed Processing Technology - a400 PM2124A [SmartCache/Raid] + a400 SmartCache/Raid III or IV 1045 OPTi Inc. c178 92C178 c557 82C557 [Viper-M] @@ -271,6 +276,7 @@ ac12 PCI1130 ac13 PCI1031 ac15 PCI1131 + ac16 PCI-1250 104d Sony Corporation 104e Oak Technology, Inc 0107 OTI107 @@ -422,6 +428,7 @@ 109e Brooktree Corporation 0350 Bt848 0351 Bt849A + 8474 Bt8474 109f Trigem Computer Inc. 10a0 Meidensha Corporation 10a1 Juko Electronics Ind. Co. Ltd @@ -616,13 +623,15 @@ 0585 VT82C585VP [Apollo VP1/VPX] 0586 VT82C586 ISA [Apollo VP] 0595 VT82C595 [Apollo VP2] + 0597 VT82C597 [Apollo VP3] 0926 VT82C926 [Amazon] 1000 82C570MV 1106 82C570MV 1571 VT 82C416MV 1595 VT82C595/97 [Apollo VP2/97] - 3038 82C586_2 [VT82C586B USB] - 3040 82C586_3 [VT82C586B ACPI] + 3038 VT82C586B USB + 3040 VT82C586B ACPI + 8597 VT82C597 [Apollo VP3 AGP] 1107 Stratus Computers 1108 Proteon, Inc. 0100 p1690plus_AA @@ -718,6 +727,7 @@ 113a FWB Inc 113b Network Computing Devices 113c Cyclone Microsystems, Inc. + 0001 PCI-SDK [PCI i960 Evaluation Platform] 0911 PCI-911 [PCI-based i960Jx Intelligent I/O Controller] 0912 PCI-912 [i960CF-based Intelligent I/O Controller] 0913 PCI-913 @@ -798,6 +808,8 @@ 1179 Toshiba America Info Systems 0601 601 060a ToPIC95 + 060f ToPIC97 + 0701 Lucent DSP1645 [Mars] 117b L G Electronics, Inc. 117c Atto Technology 117d Becton & Dickinson @@ -880,7 +892,8 @@ 11be International Microcircuits Inc 11bf Astrodesign, Inc. 11c0 Hewlett Packard -11c1 AT&T Microelectronics +11c1 Lucent Microelectronics + 0440 L56xMF 11c2 Sand Microelectronics 11c4 Document Technologies, Inc 11c5 Shiva Corporation diff --git a/pciutils.lsm b/pciutils.lsm index 7cada1b..48a7904 100644 --- a/pciutils.lsm +++ b/pciutils.lsm @@ -1,7 +1,7 @@ Begin3 Title: Linux PCI Utilities -Version: 1.01 -Entered-date: 980209 +Version: 1.02 +Entered-date: 980215 Description: This package contains various utilities for inspecting and setting of devices connected to the PCI bus. Requires kernel version 2.1.82 or newer (supporting the /proc/bus/pci @@ -9,7 +9,7 @@ Description: This package contains various utilities for inspecting and Keywords: kernel, pci, proc, lspci Author: mj@atrey.karlin.mff.cuni.cz (Martin Mares) Maintained-by: mj@atrey.karlin.mff.cuni.cz (Martin Mares) -Primary-site: atrey.karlin.mff.cuni.cz pub/local/mj/linux/pciutils-1.01.tar.gz -Alternate-site: sunsite.unc.edu pub/Linux/system/hardware/pciutils-1.01.tar.gz +Primary-site: atrey.karlin.mff.cuni.cz pub/local/mj/linux/pciutils-1.02.tar.gz +Alternate-site: sunsite.unc.edu pub/Linux/system/hardware/pciutils-1.02.tar.gz Copying-policy: GPL End -- 2.39.2