From: Martin Mares Date: Sun, 28 Feb 1999 20:23:05 +0000 (+0000) Subject: o Don't assume unsigned long to be 64-bit on 64-bit platforms. Introduced X-Git-Tag: v3.0.0~291 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=f3395cc50b6d4b1a6d7be7b9e0e775268341e659;p=pciutils.git o Don't assume unsigned long to be 64-bit on 64-bit platforms. Introduced 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. --- diff --git a/ChangeLog b/ChangeLog index 0e11501..da3c622 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +Sun Feb 28 22:26:21 1999 Martin Mares + + * 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 + + * 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 + +Tue Feb 9 15:54:39 1999 Martin Mares + + * 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 * Released as 1.99.4. diff --git a/Makefile b/Makefile index c8b8f11..cda5429 100644 --- 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 @@ -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 3f53ea7..8a1fdd3 100644 --- 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. diff --git a/lib/configure b/lib/configure index eb72fb1..1858269 100755 --- a/lib/configure +++ b/lib/configure @@ -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 diff --git a/lib/generic.c b/lib/generic.c index b586c95..daecb54 100644 --- a/lib/generic.c +++ b/lib/generic.c @@ -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) { diff --git a/lib/pci.h b/lib/pci.h index 71154df..da01896 100644 --- 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 c18a1b9..9c89da2 100644 --- 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; ibase_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) ? "" : ""); } @@ -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 a95b340..c3ad3dc 100644 --- a/pci.ids +++ b/pci.ids @@ -4,7 +4,7 @@ # Maintained by Martin Mares # 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. @@ -210,7 +210,7 @@ 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 @@ -501,6 +501,7 @@ 10b4 STB Systems Inc 10b5 PLX Technology, Inc. 9036 9036 + 9050 PCI <-> IOBus Bridge 9060 9060 906e 9060ES 9080 9080 @@ -609,6 +610,7 @@ 10de Nvidia Corporation 0008 NV1 0009 DAC64 + 0020 Riva TNT 10df Emulex Corporation 10e0 Integrated Micro Solutions Inc. 5026 IMS5026/27/28 @@ -1443,6 +1445,7 @@ 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