]> mj.ucw.cz Git - pciutils.git/commitdiff
o Don't assume unsigned long to be 64-bit on 64-bit platforms. Introduced
authorMartin Mares <mj@ucw.cz>
Sun, 28 Feb 1999 20:23:05 +0000 (20:23 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 5 May 2006 12:10:05 +0000 (14:10 +0200)
   pciaddr_t which is an integer type capable of holding a PCI address.
   Can anyone with an Ultra test it?

o  lspci scan mode: Don't dump functions 1--7 when scanning a real
   multi-function device. (Several devices don't decode function bits at all).

o  Few pci.ids additions.

ChangeLog
Makefile
README
lib/configure
lib/generic.c
lib/pci.h
lspci.c
pci.ids

index 0e1150114b5fac461990d8830270e18eea9a6e02..da3c62235866d2257ce571aa602e77ec7e7c1e5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Sun Feb 28 22:26:21 1999  Martin Mares  <mj@albireo.ucw.cz>
+
+       * lspci.c (do_map_bus): Don't dump functions 1--7 if not flagged
+       as a multi-function device, because several single-function devices
+       don't decode the function bits at all.
+
+Sun Feb 14 23:48:22 1999  Martin Mares  <mj@albireo.ucw.cz>
+
+       * Makefile (install): Don't use "-o root -g root" for installation
+       since it breaks on machines where programs are not installed by root.
+       Reported by Richard Gooch <rgooch@atnf.csiro.au>
+
+Tue Feb  9 15:54:39 1999  Martin Mares  <mj@albireo.ucw.cz>
+
+       * lspci.c (show_bases): Use new address masking macros and pciaddr_t.
+
+       * lib/pci.h: Using pciaddr_t for bus addresses, which are 32-bit
+       or 64-bit depending on CPU.
+
+       * lib/pci.h (PCI_ADDR_MEM_MASK): Added macros for address masks
+       according to bus address width.
+
 Thu Jan 28 20:54:16 1999  Martin Mares  <mj@albireo.ucw.cz>
 
        * Released as 1.99.4.
index c8b8f113864533d4b5c945beb1efa8907d35bdec..cda5429ecf8d5ba9edab01421b7e58df4401ed1b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.13 1999/01/28 20:16:42 mj Exp $
+# $Id: Makefile,v 1.14 1999/02/28 20:23:05 mj Exp $
 # Makefile for Linux PCI Utilities
 # (c) 1998--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
 
@@ -39,9 +39,9 @@ clean:
        rm -rf dist
 
 install: all
-       install -o root -g root -m 755 -s lspci setpci $(ROOT)/sbin
-       install -o root -g root -m 644 pci.ids $(PREFIX)/share
-       install -o root -g root -m 644 lspci.8 setpci.8 $(PREFIX)/man/man8
+       install -m 755 -s lspci setpci $(ROOT)/sbin
+       install -m 644 pci.ids $(PREFIX)/share
+       install -m 644 lspci.8 setpci.8 $(PREFIX)/man/man8
        # Remove relics from old versions
        rm -f $(ROOT)/etc/pci.ids
 
diff --git a/README b/README
index 3f53ea7605c0c72d3f42a454f96799de5c35a4f3..8a1fdd3a8a0e15ef641f188f9bd5981bbd3e43db 100644 (file)
--- a/README
+++ b/README
@@ -34,6 +34,8 @@ bus in Linux:
 
    See manual pages for more details.
 
+   To compile the package, just run "make". To install it, "make install".
+
    You need kernel 2.1.82 or newer to use all functions of this package.
 For older kernels, only direct hardware access is supported and you must
 be root to use it.
index eb72fb1686fbfb99ab6647e54c5a99c1e0c7c066..1858269c4115378f167dc031e7da7ee7d86d336c 100755 (executable)
@@ -31,7 +31,7 @@ case $cpu in
                        echo >>$c '#define HAVE_PM_SYSCALLS'
                        ok=1
                        ;;
-       alpha|sparc64)  echo >>$c '#define HAVE_64BIT_LONG_INT'
+       alpha|sparc64)  echo >>$c '#define HAVE_64BIT_ADDRESS'
 #                      echo -n " syscalls"
 #                      echo >>$c '#define HAVE_PM_SYSCALLS'
 #                      ok=1
index b586c95131e7a4e44fc568ea836836651bb91d0a..daecb54d996cb953753805bc06c871f90973ce0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *     $Id: generic.c,v 1.3 1999/01/27 14:53:03 mj Exp $
+ *     $Id: generic.c,v 1.4 1999/02/28 20:23:10 mj Exp $
  *
  *     The PCI Library -- Generic Direct Access Functions
  *
@@ -127,8 +127,8 @@ pci_generic_fill_info(struct pci_dev *d, int flags)
                      else
                        {
                          u32 y = pci_read_long(d, PCI_BASE_ADDRESS_0 + (++i)*4);
-#ifdef HAVE_64BIT_LONG_INT
-                         d->base_addr[i-1] |= ((unsigned long) y) << 32;
+#ifdef HAVE_64BIT_ADDRESS
+                         d->base_addr[i-1] |= ((pciaddr_t) y) << 32;
 #else
                          if (y)
                            {
index 71154df59be1ab75c9665cc9a09aed755197185a..da018968f086b7c9ecf5b896d68e815347460354 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -1,5 +1,5 @@
 /*
- *     $Id: pci.h,v 1.2 1999/01/24 21:35:36 mj Exp $
+ *     $Id: pci.h,v 1.3 1999/02/28 20:23:11 mj Exp $
  *
  *     The PCI Library
  *
@@ -31,6 +31,12 @@ typedef __u16 word;
 typedef __u16 u16;
 typedef __u32 u32;
 
+#ifdef HAVE_64BIT_ADDRESS
+typedef unsigned long long pciaddr_t;
+#else
+typedef unsigned long pciaddr_t;
+#endif
+
 /*
  *     PCI Access Structure
  */
@@ -94,8 +100,8 @@ struct pci_dev {
   /* These fields are set by pci_fill_info() */
   word vendor_id, device_id;           /* Identity of the device */
   int irq;                             /* IRQ number */
-  unsigned long base_addr[6];          /* Base addresses */
-  unsigned long rom_base_addr;         /* Expansion ROM base address */
+  pciaddr_t base_addr[6];              /* Base addresses */
+  pciaddr_t rom_base_addr;             /* Expansion ROM base address */
 
   /* Fields used internally: */
   struct pci_access *access;
@@ -107,6 +113,9 @@ struct pci_dev {
   void *aux;                           /* Auxillary data */
 };
 
+#define PCI_ADDR_IO_MASK (~(pciaddr_t) 0x3)
+#define PCI_ADDR_MEM_MASK (~(pciaddr_t) 0xf)
+
 byte pci_read_byte(struct pci_dev *, int pos); /* Access to configuration space */
 word pci_read_word(struct pci_dev *, int pos);
 u32  pci_read_long(struct pci_dev *, int pos);
diff --git a/lspci.c b/lspci.c
index c18a1b99032178947754b1c1f59cff2552f2a7e3..9c89da2499e2237c3286b113aa0af6192dc29d5e 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -1,5 +1,5 @@
 /*
- *     $Id: lspci.c,v 1.22 1999/01/28 20:16:46 mj Exp $
+ *     $Id: lspci.c,v 1.23 1999/02/28 20:23:07 mj Exp $
  *
  *     Linux PCI Utilities -- List All PCI Devices
  *
@@ -56,10 +56,10 @@ static struct pci_access *pacc;
 #define IRQ_FORMAT "%d"
 #endif
 
-#ifdef HAVE_64BIT_LONG_INT
-#define LONG_FORMAT "%016lx"
+#ifdef HAVE_64BIT_ADDRESS
+#define ADDR_FORMAT "%016Lx"
 #else
-#define LONG_FORMAT "%08lx"
+#define ADDR_FORMAT "%08lx"
 #endif
 
 /* Our view of the PCI bus */
@@ -242,9 +242,8 @@ show_bases(struct device *d, int cnt)
 
   for(i=0; i<cnt; i++)
     {
-      unsigned long pos;
-      unsigned int flg = get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i);
-      pos = p->base_addr[i];
+      pciaddr_t pos = p->base_addr[i];
+      u32 flg = get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i);
       if (flg == 0xffffffff)
        flg = 0;
       if (!pos && !flg)
@@ -274,7 +273,7 @@ show_bases(struct device *d, int cnt)
       else
        {
          int t = flg & PCI_BASE_ADDRESS_MEM_TYPE_MASK;
-         unsigned long a = pos & PCI_BASE_ADDRESS_MEM_MASK;
+         pciaddr_t a = pos & PCI_ADDR_MEM_MASK;
          int done = 0;
          u32 z = 0;
 
@@ -303,7 +302,7 @@ show_bases(struct device *d, int cnt)
          if (!done)
            {
              if (a)
-               printf(LONG_FORMAT, a);
+               printf(ADDR_FORMAT, a);
              else
                printf(((flg & PCI_BASE_ADDRESS_MEM_MASK) || z) ? "<ignored>" : "<unassigned>");
            }
@@ -1106,13 +1105,16 @@ do_map_bus(int bus)
   for(dev = 0; dev < 32; dev++)
     if (filter.slot < 0 || filter.slot == dev)
       {
-       for(func = 0; func < 8; func++)
+       int func_limit = 1;
+       for(func = 0; func < func_limit; func++)
          if (filter.func < 0 || filter.func == func)
            {
              struct pci_dev *p = pci_get_dev(pacc, bus, dev, func);
              u16 vendor = pci_read_word(p, PCI_VENDOR_ID);
              if (vendor && vendor != 0xffff)
                {
+                 if (!func && (pci_read_byte(p, PCI_HEADER_TYPE) & 0x80))
+                   func_limit = 8;
                  if (verbose)
                    printf("Discovered device %02x:%02x.%d\n", bus, dev, func);
                  bi->exists = 1;
diff --git a/pci.ids b/pci.ids
index a95b3403b17eeb8c7177a8425b7fe2216207af89..c3ad3dc19489df60f4a65b0d48b4e76be513f608 100644 (file)
--- a/pci.ids
+++ b/pci.ids
@@ -4,7 +4,7 @@
 #      Maintained by Martin Mares <pci-ids@ucw.cz>
 #      If you have any new entries, send them to the maintainer.
 #
-#      $Id: pci.ids,v 1.18 1999/01/26 15:00:03 jj Exp $
+#      $Id: pci.ids,v 1.19 1999/02/28 20:23:08 mj Exp $
 #
 
 # Vendors and devices. Please keep sorted.
        051b  MGA 2164W [Millennium II]
        051f  MGA 2164W AGP [Millennium II AGP]
        0520  MGA G200 PCI
-       0521  MGA G200-SD AGP [Millennium G200 SDRAM AGP]
+       0521  MGA G200 AGP [Millennium G200 AGP]
        0d10  MGA Ultima/Impression
        1000  MGA G100 [multi monitor]
        1001  MGA G100 AGP
 10b4  STB Systems Inc
 10b5  PLX Technology, Inc.
        9036  9036
+       9050  PCI <-> IOBus Bridge
        9060  9060
        906e  9060ES
        9080  9080
 10de  Nvidia Corporation
        0008  NV1
        0009  DAC64
+       0020  Riva TNT
 10df  Emulex Corporation
 10e0  Integrated Micro Solutions Inc.
        5026  IMS5026/27/28
 1387  Systran Corp
 1388  Hitachi Information Technology Co Ltd
 1389  Applicom International
+       0001  PCI1500PFB [Intelligent fieldbus adaptor]
 138a  Fusion Micromedia Corp
 138b  Tokimec Inc
 138c  Silicon Reality
@@ -1864,3 +1867,5 @@ C 0C  Serial bus controller
        0003  USB Controller
        0004  Fiber Channel
 
+S 10b4  STB Systems Inc
+       273e  Velocity 4400