]> mj.ucw.cz Git - pciutils.git/commitdiff
- Added a man page and updated README
authorMartin Mares <mj@ucw.cz>
Sun, 8 Feb 1998 10:58:51 +0000 (10:58 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 5 May 2006 12:09:29 +0000 (14:09 +0200)
- Makefile: Recognize architecture by calling uname and pass it as ARCH_xxx
  to all the C sources. This should eliminate problems with 32-bit compilers
  on sparc64.

- Partially implemented header type 2.

- Released as version 1.0.

ChangeLog [new file with mode: 0644]
Makefile
README
lspci.8 [new file with mode: 0644]
lspci.c
pciutils.lsm

diff --git a/ChangeLog b/ChangeLog
new file mode 100644 (file)
index 0000000..e18cf27
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,19 @@
+Sat Feb  7 15:15:46 1998  Martin Mares  <mj@albireo.ucw.cz>
+
+       * README: Updated.
+
+       * lspci.8: Created a man page.
+
+       * Releasing as version 1.0.
+
+Tue Feb  3 20:56:00 1998  Martin Mares  <mj@albireo.ucw.cz>
+
+       * Makefile: Recognize architecture by calling uname and pass it as ARCH_xxx
+       to all the C sources. This should eliminate problems with 32-bit compilers
+       on sparc64.
+
+       * lspci.c (show_verbose): Recognize CardBus bridge header type.
+       (show_htype2): Stub routine.
+       (scan_config): Write sensible error message if the kernel denies reading of
+       upper part of the PCI config space.
+
index c1e45b15c9c796a8620e65d993cfd7aac744b83a..323e700d4cc7525d92c0bbad17ff4457bee03352 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,10 @@
-# $Id: Makefile,v 1.4 1998/01/27 11:50:07 mj Exp $
+# $Id: Makefile,v 1.5 1998/02/08 10:58:52 mj Exp $
 # Makefile for Linux PCI Utilities
-# (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+# (c) 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
 
+ARCH=$(shell uname -m | sed -e 's/i.86/i386/' -e 's/sun4u/sparc64/' | tr 'a-z' 'A-Z')
 OPT=-O2 -fomit-frame-pointer
-CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wno-unused -Werror
+CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wno-unused -Werror -DARCH_$(ARCH)
 
 PREFIX=/
 
@@ -21,6 +22,7 @@ clean:
 install: all
        install -o root -g root -m 755 -s lspci $(PREFIX)/sbin
        install -o root -g root -m 644 pci.ids $(PREFIX)/etc
+       install -o root -g root -m 644 lspci.8 $(PREFIX)/man/man8
 
 dist: clean
        sh -c 'X=`pwd` ; X=`basename $$X` ; cd .. ; tar czvvf /tmp/$$X.tar.gz $$X --exclude CVS --exclude tmp'
diff --git a/README b/README
index 831667830150d26a0d7884517e88defc696251bc..5c47c7250dd6ab935b41077ce74c17f3fc476d11 100644 (file)
--- a/README
+++ b/README
@@ -1,2 +1,34 @@
-This is an experimental version of the Linux PCI Utilities package.
-Maintained by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+This package contains the Linux PCI Utilities, version 1.0.
+
+Copyright (c) 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+
+All files in this package can be freely distributed and used according
+to the terms of the GNU General Public License, either version 2 or
+(at your opinion) any newer version. This is the same distribution
+policy as for the Linux kernel itself -- see /usr/src/linux/COPYING
+for details.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+   The Linux PCI Utilities currently contain only one utility -- lspci,
+indented for displaying of detailed information about all PCI busses and
+devices in the system, replacing the original /proc/pci interface. See
+the manual page (lspci.8) for more details.
+
+   If you have any bug reports or suggestions, send them to the author.
+
+   If you want, subscribe to linux-pci@atrey.karlin.mff.cuni.cz (send
+"subscribe linux-pci Your Full Name" to listproc@atrey.karlin.mff.cuni.cz).
+Release notes about new versions will be send to the list and problems with
+the Linux PCI support will be probably discussed there, too.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+TODO:
+
+       - Work-around the PIIX4 ACPI crash?
+
+       - Better displaying of IRQ's generated by both PCI and CardBus bridges.
+
+       - Full displaying of CardBus bridge configuration. (Has anyone seen
+         full specs of the CardBus bridge / header type 2?)
diff --git a/lspci.8 b/lspci.8
new file mode 100644 (file)
index 0000000..91a483e
--- /dev/null
+++ b/lspci.8
@@ -0,0 +1,100 @@
+.TH lspci 8 "7 February 98" "pciutils-0.92" "Linux PCI Utilities"
+.IX lspci
+.SH NAME
+lspci \- list all PCI devices
+.SH SYNOPSIS
+.B lspci
+.RB [ options ]
+.SH DESCRIPTION
+.B lspci
+is a utility for displaying information about all PCI busses in the system and
+all devices connected to them. It requires Linux kernel 2.1.82 or newer and
+supersedes the original /proc/pci interface found in earlier kernels.
+
+If you are going to report bugs in PCI device drivers or in
+.I lspci
+itself, please include output of "lspci -vvx".
+
+.SH OPTIONS
+.TP
+.B -v
+Tells
+.I lspci
+to be verbose and display detailed information about all devices.
+.TP
+.B -vv
+Tells
+.I lspci
+to be very verbose and display even more information (actually everything the
+PCI device is able to tell). The exact meaning of these data is not explained
+in this manual page, if you want to know more, consult
+.B /usr/include/linux/pci.h
+or the PCI specs.
+.TP
+.B -n
+Show PCI vendor and device codes as numbers instead of looking them up in the
+PCI ID database.
+.TP
+.B -x
+Show hexadecimal dump of first 64 bytes of the PCI configuration space (the standard
+header). Useful for debugging of drivers and
+.I lspci
+itself.
+.TP
+.B -xx
+Show hexadecimal dump of whole PCI configuration space. Available only for root
+as several PCI devices crash when you try to read undefined portions of the config
+space (although this directly violates the PCI standard).
+.TP
+.B -b
+Bus-centric view. Show all IRQ numbers and addresses as seen by the cards on the
+PCI bus instead of as seen by the kernel.
+.TP
+.B -t
+Show a tree-like diagram containing all busses, bridges, devices and connections
+between them.
+.TP
+.B -B <bus>
+Show only devices on specified bus.
+.TP
+.B -S <slot>
+Show only devices in specified slot number.
+.TP
+.B -F <func>
+Show only specified function number of all devices (you can mix it with
+.B -B
+and
+.B -S
+to select single device).
+.TP
+.B -V <vendor>
+Show only devices having specified vendor ID.
+.TP
+.B -D <devid>
+Show only devices having specified device ID.
+.TP
+.B -i <file>
+Use
+.B
+<file>
+as PCI ID database instead of /etc/pci.ids.
+.TP
+.B -p <dir>
+Use
+.B <dir>
+as directory containing PCI bus information instead of /proc/bus/pci.
+
+.SH FILES
+.TP
+.B /etc/pci.ids
+A list of all known PCI ID's (vendors, devices, classes and subclasses).
+.TP
+.B /proc/bus/pci
+An interface to PCI bus configuration space provided by the kernel. Contains
+per-bus subdirectories with per-card config space files and a
+.I
+devices
+file containing a list of all PCI devices.
+
+.SH AUTHOR
+The Linux PCI Utilities are maintained by Martin Mares <mj@atrey.karlin.mff.cuni.cz>.
diff --git a/lspci.c b/lspci.c
index 29d5f192e83bf00ec3205377a321c9bddb4c3b01..2dc6ae4bd24e8f13f3a212858113feed96cfa365 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -1,5 +1,5 @@
 /*
- *     $Id: lspci.c,v 1.5 1998/01/27 11:50:08 mj Exp $
+ *     $Id: lspci.c,v 1.6 1998/02/08 10:58:54 mj Exp $
  *
  *     Linux PCI Utilities -- List All PCI Devices
  *
@@ -47,7 +47,7 @@ Usage: lspci [<switches>]\n\
 
 /* Format strings used for IRQ numbers */
 
-#ifdef __sparc_v9__
+#ifdef ARCH_SPARC64
 #define IRQ_FORMAT "%08x"
 #else
 #define IRQ_FORMAT "%d"
@@ -148,7 +148,7 @@ scan_config(void)
 {
   struct device *d;
   char name[64];
-  int fd;
+  int fd, res;
   int how_much = (show_hex > 1) ? 256 : 64;
 
   for(d=first_dev; d; d=d->next)
@@ -159,11 +159,17 @@ scan_config(void)
          fprintf(stderr, "lspci: Unable to open %s: %m\n", name);
          exit(1);
        }
-      if (read(fd, d->config, how_much) != how_much)
+      res = read(fd, d->config, how_much);
+      if (res < 0)
        {
          fprintf(stderr, "lspci: Error reading %s: %m\n", name);
          exit(1);
        }
+      if (res != how_much)
+       {
+         fprintf(stderr, "lspci: Only %d bytes of config space available to you\n", res);
+         exit(1);
+       }
       close(fd);
     }
 }
@@ -419,6 +425,11 @@ show_htype1(struct device *d)
           (brc & PCI_BRIDGE_CTL_FAST_BACK) ? '+' : '-');
 }
 
+static void
+show_htype2(struct device *d)
+{
+}
+
 static void
 show_verbose(struct device *d)
 {
@@ -432,34 +443,34 @@ show_verbose(struct device *d)
   byte max_lat, min_gnt;
   byte int_pin = get_conf_byte(d, PCI_INTERRUPT_PIN);
   byte int_line = get_conf_byte(d, PCI_INTERRUPT_LINE);
-  unsigned int irq, ex_htype;
+  unsigned int irq;
   word subsys_v, subsys_d;
 
   show_terse(d);
 
-  switch (class)
-    {
-    case PCI_CLASS_BRIDGE_PCI:
-      ex_htype = 1;
-      break;
-    default:
-      ex_htype = 0;
-    }
-  if (ex_htype != htype)
-    {
-      printf("\t!!! Header type %02x doesn't match class code %04x\n", htype, class);
-      return;
-    }
-
   switch (htype)
     {
-    case 0:
+    case PCI_HEADER_TYPE_NORMAL:
+      if (class == PCI_CLASS_BRIDGE_PCI)
+       {
+       badhdr:
+         printf("\t!!! Header type %02x doesn't match class code %04x\n", htype, class);
+         return;
+       }
       max_lat = get_conf_byte(d, PCI_MAX_LAT);
       min_gnt = get_conf_byte(d, PCI_MIN_GNT);
       subsys_v = get_conf_word(d, PCI_SUBSYSTEM_VENDOR_ID);
       subsys_d = get_conf_word(d, PCI_SUBSYSTEM_ID);
       break;
-    case 1:
+    case PCI_HEADER_TYPE_BRIDGE:
+      if (class != PCI_CLASS_BRIDGE_PCI)
+       goto badhdr;
+      irq = int_line = int_pin = min_gnt = max_lat = 0;
+      subsys_v = subsys_d = 0;
+      break;
+    case PCI_HEADER_TYPE_CARDBUS:
+      if ((class >> 8) != PCI_BASE_CLASS_BRIDGE)
+       goto badhdr;
       irq = int_line = int_pin = min_gnt = max_lat = 0;
       subsys_v = subsys_d = 0;
       break;
@@ -555,12 +566,15 @@ show_verbose(struct device *d)
 
   switch (htype)
     {
-    case 0:
+    case PCI_HEADER_TYPE_NORMAL:
       show_htype0(d);
       break;
-    case 1:
+    case PCI_HEADER_TYPE_BRIDGE:
       show_htype1(d);
       break;
+    case PCI_HEADER_TYPE_CARDBUS:
+      show_htype2(d);
+      break;
     }
 }
 
index 20b8a16502a63bb2cb3090fa2ce217d9bed80db1..7178cddbe059f17a6c128af6d0cef8e474bfaa25 100644 (file)
@@ -1,7 +1,7 @@
 Begin3
 Title:          Linux PCI Utilities
-Version:        0.91
-Entered-date:   980127
+Version:        1.0
+Entered-date:   980207
 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/pciutils-0.91.tar.gz
+Primary-site:   atrey.karlin.mff.cuni.cz pub/local/mj/linux/pciutils-1.0.tar.gz
 Alternate-site: sunsite.unc.edu pub/Linux/system/hardware
 Copying-policy: GPL
 End