]> mj.ucw.cz Git - pciutils.git/log
pciutils.git
2 years agolspci: Show Slot Power Limit values above EFh
Pali Rohár [Sun, 26 Dec 2021 23:34:08 +0000 (00:34 +0100)]
lspci: Show Slot Power Limit values above EFh

PCI Express Base Specification rev. 3.0 has the following definition for
the Slot Power Limit Value:

=======================================================================
When the Slot Power Limit Scale field equals 00b (1.0x) and Slot Power
Limit Value exceeds EFh, the following alternative encodings are used:
  F0h = 250 W Slot Power Limit
  F1h = 275 W Slot Power Limit
  F2h = 300 W Slot Power Limit
  F3h to FFh = Reserved for Slot Power Limit values above 300 W
=======================================================================

Replace function power_limit() by show_power_limit() which also prints
power limit value. Show reserved value as string ">300W".

2 years agolibpci: Fix intel_sanity_check() function
Pali Rohár [Sun, 26 Dec 2021 22:47:03 +0000 (23:47 +0100)]
libpci: Fix intel_sanity_check() function

Function intel_sanity_check() calls conf1_read() which access d->domain
field. But intel_sanity_check() does not initialize this field and so
conf1_read() access some random data on stack.

Tests showed that intel_sanity_check() always fails as in d->domain is
stored some non-zero number.

Fix this issue by zeroing struct pci_dev d in intel_sanity_check() as
sanity check is verifying PCI devices at domain 0.

2 years agolspci: Print buses of multibus PCI domain in ascending order
Pali Rohár [Sun, 26 Dec 2021 22:04:03 +0000 (23:04 +0100)]
lspci: Print buses of multibus PCI domain in ascending order

Currently PCI domains are printed in ascending order. Devices on each PCI
bus are also printed in ascending order. PCI buses behind PCI-to-PCI
bridges are also printed in ascending order.

But buses of PCI domain are currently printed in descending order because
function new_bus() puts newly created bus at the beginning of linked list.

In most cases PCI domain contains only one (top level) bus, so in most
cases it is not visible this inconsistency.

Multibus PCI domains (where PCI domain contains more independent top level
PCI buses) are available on ARM devices.

This change fixes print order of multibus PCI domains, so also top level
PCI buses are printed in ascending order, like PCI buses behind PCI-to-PCI
bridges.

2 years agointel_cleanup_io() no longer returns a value
Martin Mares [Sun, 26 Dec 2021 22:02:47 +0000 (23:02 +0100)]
intel_cleanup_io() no longer returns a value

The value was quite misleading, as witnessed by multiple implementations
doing it wrong. In fact, the only return value which ever made sense was -1.

2 years agodump: Allow more leading zeros in dump line number
Pali Rohár [Mon, 20 Dec 2021 15:56:59 +0000 (16:56 +0100)]
dump: Allow more leading zeros in dump line number

U-Boot's "pci display.b" command prints pci config space dump with 8 digits
in line number. So allow up to the 8 digits in line number to easily parse
U-Boot's pci config space dumps.

2 years agoREADME: Update information how to compile Windows port
Pali Rohár [Sun, 26 Dec 2021 21:30:19 +0000 (22:30 +0100)]
README: Update information how to compile Windows port

2 years agowin32: Remove old config.h and config.mk files
Pali Rohár [Sun, 26 Dec 2021 17:48:00 +0000 (18:48 +0100)]
win32: Remove old config.h and config.mk files

These files are old and cannot be used for compiling pcitutils anymore
(e.g. they use non-existent option TOOLPREFIX). As configure script now
works fine also for Windows build, remove these old win32 config files.

2 years agoconfigure: Generate config files for PCI_OS_WINDOWS
Pali Rohár [Sun, 26 Dec 2021 17:47:33 +0000 (18:47 +0100)]
configure: Generate config files for PCI_OS_WINDOWS

This change adds support for using configure script for cross-compiling
pciutils on Linux for Windows platforms.

Following command can be used to compile pcitils for Windows platform:

  make CROSS_COMPILE=i586-mingw32msvc- HOST=i386-windows ZLIB=no IDSDIR=.

PCI_OS_WINDOWS does not support BSD DNS functions, so do not automatically
enable DNS support.

Library ioperm is cygwin specific and is used only for PCI_OS_CYGWIN.

2 years agoMakefile: Add new option COMPAT_GETOPT
Pali Rohár [Sun, 26 Dec 2021 17:44:44 +0000 (18:44 +0100)]
Makefile: Add new option COMPAT_GETOPT

This new option controls if compat/getopt.c should be compiled and linked
into lspci and setpci binaries. Useful for ancient platforms.

For example it is required to set COMPAT_GETOPT=yes for all versions of
MinGW32 with CRTDLL (as this MinGW32 variant does not have linkable
getopt() implementation). And also for MinGW32 with MSVCRT older than 3.0.

2 years agoMakefile: Append EXEEXT variable to executable filename rules
Pali Rohár [Sun, 26 Dec 2021 17:42:35 +0000 (18:42 +0100)]
Makefile: Append EXEEXT variable to executable filename rules

If x86_64-w64-mingw32-gcc compiler is called with -o filename option
without any file extension then compiler automatically appends suffix
".exe" to output filename.

This behavior of x86_64-w64-mingw32-gcc compiler basically breaks pattern
rule of type '%: %.o' as x86_64-w64-mingw32-gcc compiler cannot generate
arbitrary output file via -o option just by stripping .o extension from
filename.

When generating executables by x86_64-w64-mingw32-gcc compiler it is
really the best option to specify .exe suffix in -o option.

So introduce a new makefile variable EXEEXT which will be automatically
appended to any executable filename. For Windows and DOS systems set it
to ".exe". For other systems set it just to empty string "".

GNU automake uses same makefile variable for same purpose.

2 years agoFactored out initialization of name list path
Martin Mares [Sun, 26 Dec 2021 21:41:05 +0000 (22:41 +0100)]
Factored out initialization of name list path

2 years agolibpci: For PCI_OS_WINDOWS allows to load pci.ids from executable directory
Pali Rohár [Sun, 26 Dec 2021 18:06:53 +0000 (19:06 +0100)]
libpci: For PCI_OS_WINDOWS allows to load pci.ids from executable directory

For Windows applications it is common to have all support data files in the
same directory where is stored executable itself, instead of in directory
hardcoded at compile time.

When PCI_PATH_IDS_DIR is set to "." it means that pci.ids file is located
in the current working directory. This is also unsuitable for Windows
command line applications stored in %PATH% because cmd.exe starts in some
default user or system location.

Adds a new option to allow specifying PCI_PATH_IDS_DIR to empty string ""
and for PCI_OS_WINDOWS platform it would mean to locate pci.ids file in the
same directory where is stored currently running executable. On Windows it
is always possible to detected this directory.

2 years agolibpci: i386-io-windows.h: Enable I/O access via native NT ProcessUserModeIOPL syscall
Pali Rohár [Sat, 25 Dec 2021 14:52:20 +0000 (15:52 +0100)]
libpci: i386-io-windows.h: Enable I/O access via native NT ProcessUserModeIOPL syscall

libpci uses WinIo library from http://www.internals.com/ which is archived
at https://web.archive.org/web/20151005172744/http://www.internals.com/

This external WinIo library has two big issues:
1. Library license is incompatible with pciutils license.
2. It silently and automatically installs 3rd-party NT kernel module
   WinIo.sys which is bundled in WinIO.dll binary.

That NT kernel module creates a device file "\\.\WinIo" which can be opened
by any running process. Via this device file can any process (including
unprivileged or those running under Guest account) ask that kernel module
to configure x86 TSS I/O port permissions for access to any I/O port. That
NT kernel module does not implement any permission checks and automatically
accept all requests.

Change in this commit replaces insecure WinIO.dll library and WinIo.sys
kernel module by proper NT system solution: Usage of ProcessUserModeIOPL
syscall (equivalent of iopl(3) on Linux) which is supported directly by NT
kernel. It does not require any external 3rd-party library or NT kernel
module.

This syscall can be invoked by NtSetInformationProcess() function from
ntdll.dll library (which is part of NT system) and for privileged processes
kernel changes x86 IOPL to 3.

Privileged process is that which has SeTcbPrivilege (Act as part of the
operating system privilege) or is running under account from local
Administrators group with SeImpersonatePrivilege (Impersonate a client
after authentication privilege). SeImpersonatePrivilege is enabled by
default for accounts from local Administrators group.

Usage of privileges is not easy operation and needs to call lot of
functions to gain required permissions, achieve thread-safety and follow
suggested guidelines. Hence code is quite long.

Privileges (including SeTcbPrivilege) can be enabled / disabled in User
Accounts settings by local Administrators and change takes effect after
next login, not immediately.

2 years agolibpci: i386-io-windows.h: Fix definitions of I/O port functions for UCRT, CRTDLL...
Pali Rohár [Sat, 25 Dec 2021 12:45:28 +0000 (13:45 +0100)]
libpci: i386-io-windows.h: Fix definitions of I/O port functions for UCRT, CRTDLL and for 64-bit mode

Functions _outp(), _outpw(), _outpd(), _inp(), _inpw() and _inpd() are
available only in 32-bit version of the old MSVCRT library. They are not
available in 64-bit version of old MSVCRT library and neither the oldest
CRTDLL library or in new UCRT library.

Function prototypes for 32-bit mode should be available in <conio.h> header
file. But they are missing in some MinGW toolchains.

For 64-bit mode I/O port functions are defined only as inline functions or
intrinsics macros in <intrin.h> header file but under different names:
__outbyte(), __outword(), __outdword(), __inbyte(), __inword(), __indword()
This header file is available also in UCRT-compatible compilers.

When compiling with the oldest CRTDLL library and not using <intrin.h>
header file, it is required to provide own implementation of these
functions. Do it via inline assembly.

With this change it is possible to compile i386-io-windows.h with all
combination of toolchains, compilers, crt library and arch mode.

The most important is the fix to allow compilation with modern UCRT
library.

2 years agolibpci: i386-io-windows.h: Skip I/O setup on 16/32-bit non-NT systems
Pali Rohár [Sat, 25 Dec 2021 12:45:17 +0000 (13:45 +0100)]
libpci: i386-io-windows.h: Skip I/O setup on 16/32-bit non-NT systems

16/32-bit non-NT systems allow applications to access PCI I/O ports without
any special setup.

2 years agoCleaned up previous commit
Martin Mares [Sun, 26 Dec 2021 21:20:23 +0000 (22:20 +0100)]
Cleaned up previous commit

2 years agoFix the primitive system dependency discovery for Darwin systems
Laurin-Luis Lehning [Thu, 4 Mar 2021 18:55:31 +0000 (19:55 +0100)]
Fix the primitive system dependency discovery for Darwin systems

2 years agoMan pages: clarify pci.ids location
Robert Elliott [Wed, 3 Mar 2021 20:12:25 +0000 (14:12 -0600)]
Man pages: clarify pci.ids location

Include both the path and filename of pci.ids in the pci.ids man page
and the update-pciids man page

2 years agoupdate-pciids man page: add cross-references
Robert Elliott [Wed, 3 Mar 2021 20:11:12 +0000 (14:11 -0600)]
update-pciids man page: add cross-references

Add cross-references to gzip, bzip2, curl, wget, and lynx.

2 years agoman pages: update cross-references to pci.ids
Robert Elliott [Wed, 3 Mar 2021 19:33:12 +0000 (13:33 -0600)]
man pages: update cross-references to pci.ids

In the update-pciids man page:
* remove reference to setpci, since that does not use pci.ids
* add reference to pci.ids

Fixes: ef5b622f488e ("Added a man page for pci.ids")
2 years agoMakefile: Update uninstall target to match all install* targets
Martin Mares [Sun, 26 Dec 2021 21:13:40 +0000 (22:13 +0100)]
Makefile: Update uninstall target to match all install* targets

2 years agoadd missing symlinks to libraries in install-lib target
Alex Domingo [Sat, 12 Dec 2020 14:56:01 +0000 (15:56 +0100)]
add missing symlinks to libraries in install-lib target

2 years agoMakefile: fix for parallel builds (make -j)
Zachary T Welch [Thu, 8 Oct 2020 23:35:43 +0000 (16:35 -0700)]
Makefile: fix for parallel builds (make -j)

2 years agoHWDB: Handle NULL returned by udev_list_entry_get_*
Martin Mares [Sun, 26 Dec 2021 20:52:37 +0000 (21:52 +0100)]
HWDB: Handle NULL returned by udev_list_entry_get_*

Based on a patch by <lixiaokeng@huawei.com>.

2 years agoFix malloc error handling when pci_access is not fully initialized
Martin Mares [Sun, 26 Dec 2021 19:42:53 +0000 (20:42 +0100)]
Fix malloc error handling when pci_access is not fully initialized

There were multiple cases, in which malloc failure was either unchecked,
or a->error was called even though it was NULL.

3 years agolspci: Add PCIe 6.0 data rate (64 GT/s) support
Gustavo Pimentel [Wed, 18 Nov 2020 22:56:52 +0000 (23:56 +0100)]
lspci: Add PCIe 6.0 data rate (64 GT/s) support

This enables "lspci" to show PCIe 6.0 data rate (64 GT/s) properly
according to the contents in register PCI_EXP_LNKCAP, PCI_EXP_LNKSTA
and PCI_EXP_LNKCTL2.

Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
3 years agoHWDB: Fixed memory leak
Martin Mares [Sun, 6 Dec 2020 18:39:00 +0000 (19:39 +0100)]
HWDB: Fixed memory leak

3 years agoMerge branch 'master' of https://github.com/nmoinvaz/pciutils
Martin Mares [Sun, 6 Dec 2020 18:29:51 +0000 (19:29 +0100)]
Merge branch 'master' of https://github.com/nmoinvaz/pciutils

3 years agoMerge branch 'master' of https://github.com/rohit-mundra/pciutils
Martin Mares [Sun, 6 Dec 2020 18:29:14 +0000 (19:29 +0100)]
Merge branch 'master' of https://github.com/rohit-mundra/pciutils

3 years agoMerge branch 'pu/update-pciids' of https://github.com/guillemj/pciutils
Martin Mares [Sun, 6 Dec 2020 18:19:11 +0000 (19:19 +0100)]
Merge branch 'pu/update-pciids' of https://github.com/guillemj/pciutils

3 years agoMerge branch 'pu/buildsys' of https://github.com/guillemj/pciutils
Martin Mares [Sun, 6 Dec 2020 18:17:21 +0000 (19:17 +0100)]
Merge branch 'pu/buildsys' of https://github.com/guillemj/pciutils

3 years agoMerge branch 'pu/typos' of https://github.com/guillemj/pciutils
Martin Mares [Sun, 6 Dec 2020 18:15:13 +0000 (19:15 +0100)]
Merge branch 'pu/typos' of https://github.com/guillemj/pciutils

3 years agoFixed MSAN errnum use-of-uninitialized value warning. gzerror is not guaranteed to...
Nathan Moinvaziri [Fri, 20 Nov 2020 23:14:06 +0000 (15:14 -0800)]
Fixed MSAN errnum use-of-uninitialized value warning. gzerror is not guaranteed to set errnum so we initialized it to 0.

4 years agoAdded five nibbles for domain in dump read
Rohit Mundra [Fri, 30 Oct 2020 03:50:23 +0000 (03:50 +0000)]
Added five nibbles for domain in dump read

Allow five nibbles as valid domain, when reading from a dump file with
domain

4 years agoupdate-pciids: Make the backup with a hardlink instead of a move
Guillem Jover [Wed, 23 Sep 2020 17:56:57 +0000 (19:56 +0200)]
update-pciids: Make the backup with a hardlink instead of a move

If we move the file while making a backup, we can end up with no
pci.ids database in case the next step fails.

4 years agoupdate-pciids: Fix spacing style
Guillem Jover [Wed, 23 Sep 2020 17:55:37 +0000 (19:55 +0200)]
update-pciids: Fix spacing style

Fix code alignment by using a hard-tab instead of 4 spaces. Add a blank
line after set -e.

4 years agoupdate-pciids: Move quiet setting after set -e
Guillem Jover [Wed, 23 Sep 2020 17:54:16 +0000 (19:54 +0200)]
update-pciids: Move quiet setting after set -e

We should set -e as the first thing to catch any errors, so move the
quiet setup after the other variables setup.

4 years agoFix typos
Guillem Jover [Wed, 16 Sep 2020 01:24:46 +0000 (03:24 +0200)]
Fix typos

Signed-off-by: Guillem Jover <guillem@hadrons.org>
4 years agopkgconfig: Fix libpci.pc for static linking
Brice Goglin [Fri, 4 Jan 2013 16:31:14 +0000 (17:31 +0100)]
pkgconfig: Fix libpci.pc for static linking

The libpci.pc file does not seem to be correct for static linking.

  $ pkg-config --libs --static libpci
  -lpci

It brings no dependencies while -lresolv (and likely -lz) seems needed:

  /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/
   libpci.a(names-net.o):function pci_id_net_lookup:
   error: undefined reference to '__res_query'

Something like:

  Libs.private: -lresolv -lz

Signed-off-by: Guillem Jover <guillem@hadrons.org>
4 years agoconfigure: Add support for GNU/Hurd
Damien Zammit [Wed, 16 Sep 2020 01:13:17 +0000 (03:13 +0200)]
configure: Add support for GNU/Hurd

This handles the case when the HOST has not been specified by the user.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
4 years agoconfigure: Support cross-building for GNU/kFreeBSD
Guillem Jover [Wed, 16 Sep 2020 01:10:48 +0000 (03:10 +0200)]
configure: Support cross-building for GNU/kFreeBSD

We need to set a sys variable matching what would be found in the GNU
triplet for the GNU/kFreeBSD architecture, otherwise the later code will
not match correctly.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
4 years agolspci: Decode 10-Bit Tag Requester Enable
Dongdong Liu [Sat, 29 Aug 2020 10:58:42 +0000 (18:58 +0800)]
lspci: Decode 10-Bit Tag Requester Enable

Decode 10-Bit Tag Requester Enable bit in Device Control 2 Register.

Sample output changes:

  - DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- OBFF Disabled, ARIFwd-
  + DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- 10BitTagReq- OBFF Disabled, ARIFwd-

Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
4 years agolspci: Adjust PCI_EXP_DEV2_* to PCI_EXP_DEVCTL2_* macro definition
Dongdong Liu [Sat, 29 Aug 2020 10:58:41 +0000 (18:58 +0800)]
lspci: Adjust PCI_EXP_DEV2_* to PCI_EXP_DEVCTL2_* macro definition

Adjust PCI_EXP_DEV2_* to PCI_EXP_DEVCTL2_* macro definition to keep the
same style between the Linux kernel source [1] and lspci.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/pci_regs.h#n651

Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
4 years agopciutils: Add decode support for RCECs
Sean V Kelley [Wed, 24 Jun 2020 22:39:40 +0000 (15:39 -0700)]
pciutils: Add decode support for RCECs

Root Complex Event Collectors provide support for terminating error
and PME messages from RCiEPs.  This patch provides basic decoding for
the lspci RCEC Endpoint Association Extended Capability. See PCIe 5.0-1,
sec 7.9.10 for further details.

Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sean V Kelley <sean.v.kelley@linux.intel.com>
4 years agoMerge pull request #42 from jlledom/hurd-method-fixes
Martin Mareš [Sat, 6 Jun 2020 18:03:47 +0000 (20:03 +0200)]
Merge pull request #42 from jlledom/hurd-method-fixes

Hurd: bug fixes and compile again

4 years agoHurd: bug fixes and compile again
Joan Lledó [Sat, 6 Jun 2020 17:41:19 +0000 (19:41 +0200)]
Hurd: bug fixes and compile again

4 years agoHurd: Do not identify devices during scan
Martin Mares [Sun, 31 May 2020 10:24:41 +0000 (12:24 +0200)]
Hurd: Do not identify devices during scan

Let us keep the bus scan light-weight. Whoever is interested
in device IDs, still has to call pci_fill_info(PCI_FILL_IDENT),
which handles this in generic way.

4 years agoHurd: Simplification continues
Martin Mares [Sun, 31 May 2020 10:22:53 +0000 (12:22 +0200)]
Hurd: Simplification continues

4 years agoHurd: Simplify config space read and write
Martin Mares [Sun, 31 May 2020 10:18:06 +0000 (12:18 +0200)]
Hurd: Simplify config space read and write

4 years agoHurd: Further simplification
Martin Mares [Sun, 31 May 2020 10:11:45 +0000 (12:11 +0200)]
Hurd: Further simplification

4 years agoMerge remote-tracking branch 'jlledom/hurd-fix-dev-aux'
Martin Mares [Sun, 31 May 2020 09:59:48 +0000 (11:59 +0200)]
Merge remote-tracking branch 'jlledom/hurd-fix-dev-aux'

4 years agoHURD backend should compile again
Martin Mares [Sun, 31 May 2020 09:53:28 +0000 (11:53 +0200)]
HURD backend should compile again

Fixes a bug introduced by commit 82c06b47dea5a38075ce9d56f743360bc47b4c78.

4 years agoHurd: avoid redundant checks for port validity
Joan Lledó [Sun, 31 May 2020 08:28:56 +0000 (10:28 +0200)]
Hurd: avoid redundant checks for port validity

4 years agoHURD: Use MACH_PORT_NULL to initialize the port
Joan Lledó [Sun, 31 May 2020 07:20:33 +0000 (09:20 +0200)]
HURD: Use MACH_PORT_NULL to initialize the port

4 years agoHurd: Fix multiline strings
Joan Lledó [Sun, 31 May 2020 07:15:36 +0000 (09:15 +0200)]
Hurd: Fix multiline strings

4 years agoMaintainer scripts: Fixed a typo in release.pm
Martin Mares [Sat, 30 May 2020 22:19:09 +0000 (00:19 +0200)]
Maintainer scripts: Fixed a typo in release.pm

4 years agoReleased as 3.7.0. v3.7.0
Martin Mares [Sat, 30 May 2020 22:17:56 +0000 (00:17 +0200)]
Released as 3.7.0.

4 years agoUpdated pci.ids to today's snapshot
Martin Mares [Sat, 30 May 2020 22:02:16 +0000 (00:02 +0200)]
Updated pci.ids to today's snapshot

4 years agoCXL: Capability vendor ID changed
Sean V Kelley [Tue, 26 May 2020 20:56:28 +0000 (13:56 -0700)]
CXL: Capability vendor ID changed

Update the cap-dvsec-cxl test to match the new vendor ID.

Signed-off-by: Sean V Kelley <sean.v.kelley@linux.intel.com>
4 years agosysfs: Adjusted handling of PCI_FILL_IOMMU_GROUP to recent flag semantics
Martin Mares [Tue, 26 May 2020 16:13:19 +0000 (18:13 +0200)]
sysfs: Adjusted handling of PCI_FILL_IOMMU_GROUP to recent flag semantics

4 years agolspci: Print IOMMU groups with -v
Alex Xu (Hello71) [Fri, 28 Feb 2020 20:57:01 +0000 (15:57 -0500)]
lspci: Print IOMMU groups with -v

4 years agolspci: Cleaned up printing of resizable BARs
Martin Mares [Mon, 25 May 2020 13:57:39 +0000 (15:57 +0200)]
lspci: Cleaned up printing of resizable BARs

Adjusted the output to better match the rest of lspci.
Made the code more straightforward.

4 years agolspci: Decode the (virtual) resizeble BAR capability
Martin Mares [Mon, 25 May 2020 13:47:04 +0000 (15:47 +0200)]
lspci: Decode the (virtual) resizeble BAR capability

A patch by Paul Blinzer.

4 years agoLibrary: Handle domains in all back-ends
Martin Mares [Mon, 25 May 2020 13:28:33 +0000 (15:28 +0200)]
Library: Handle domains in all back-ends

Even if the back-end does not implement multiple domains, it can
be called on a device in a non-zero domain if the use obtained the
device by calling pci_get_dev() instead of scanning the bus.

In all such cases, report that 0 bytes were read/written.

4 years agoLibrary: Big cleanup of pci_fill_info()
Martin Mares [Mon, 25 May 2020 13:10:07 +0000 (15:10 +0200)]
Library: Big cleanup of pci_fill_info()

There was a lot of minor issues in the implementation of the fill_info
call-back in various back-ends. Most importantly, semantics of pci_dev->
known_fields was not formally defined and it was implemented inconsistently.

We now define known_fields as the set of fields which were already
obtained during the lifetime of the pci_dev. We never consider known
fields which are not supported by the back-end. All fields which are
unsupported by either the back-end, the OS, or the particular device,
are guaranteed to have sensible default values (0 or NULL). Also, bit
masks are always unsigned except for the signature of pci_fill_info()
which should be preferably kept stable.

All back-ends and the pci_generic_fill_info() function have been changed
to follow this semantics.

In the sysfs back-end, we read as few attributes as possible during
device initialization, so applications which use pci_get_dev() are not
slowed down unnecessarily.

In the Hurd back-end, we also respect the buscentric mode.

4 years agoCXL: Capability vendor ID changed
Martin Mares [Mon, 25 May 2020 10:35:14 +0000 (12:35 +0200)]
CXL: Capability vendor ID changed

Reported by Sean V Kelley <sean.v.kelley@linux.intel.com> on the
linux-pci list.

4 years agolspci: Generelized decoding of DVSEC extended capability
Martin Mares [Mon, 25 May 2020 10:26:07 +0000 (12:26 +0200)]
lspci: Generelized decoding of DVSEC extended capability

We decode the DVSEC capability header first. If we recognize the vendor
and ID (and the length is at least the minimum we need), we call
a specific function to interpret the rest of the capability.

4 years agoTests: cap-dvsec was superseded by cap-dvsec-cxl
Martin Mares [Mon, 25 May 2020 10:25:50 +0000 (12:25 +0200)]
Tests: cap-dvsec was superseded by cap-dvsec-cxl

4 years agoTests: cap-dvsec-cxl had tabs erroneously expanded to spaces
Martin Mares [Mon, 25 May 2020 10:25:25 +0000 (12:25 +0200)]
Tests: cap-dvsec-cxl had tabs erroneously expanded to spaces

4 years agopciutils: Decode Compute eXpress Link DVSEC
Sean V Kelley [Mon, 20 Apr 2020 22:14:44 +0000 (15:14 -0700)]
pciutils: Decode Compute eXpress Link DVSEC

Compute eXpress Link[1] is a new CPU interconnect created with
workload accelerators in mind. The interconnect relies on PCIe
electrical and physical interconnect for communication via a Flex Bus
port which allows designs to choose between providing PCIe or CXL.

This patch introduces basic support for lspci decode of CXL and
builds upon the existing Designated Vendor-Specific support in
lspci through identification of a supporting CXL device using DVSEC
Vendor ID and DVSEC ID.

[1] https://www.computeexpresslink.org/

Signed-off-by: Sean V Kelley <sean.v.kelley@linux.intel.com>
4 years agopciutils: Decode available DVSEC details
Sean V Kelley [Mon, 20 Apr 2020 22:14:43 +0000 (15:14 -0700)]
pciutils: Decode available DVSEC details

Instead of current generic 'unknown' output for DVSEC, decode details on
Vendor ID, Rev, etc.

Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sean V Kelley <sean.v.kelley@linux.intel.com>
4 years agolspci: Use commas more consistently
Bjorn Helgaas [Thu, 21 May 2020 22:40:30 +0000 (17:40 -0500)]
lspci: Use commas more consistently

General practice has been to use a comma after a multi-word item, but omit
commas between single-bit flags.  Do this more consistently.

Sample output changes:

  - LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- CommClk+
  + LnkCtl: ASPM Disabled; RCB 64 bytes, Disabled- CommClk+

  - DevCap2: Completion Timeout: Not Supported, TimeoutDis-, NROPrPrP-, LTR+
  + DevCap2: Completion Timeout: Not Supported, TimeoutDis- NROPrPrP- LTR+

  -          10BitTagComp-, 10BitTagReq-, OBFF Not Supported, ExtFmt-, EETLPPrefix-
  +          10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt- EETLPPrefix-

  -          FRS-, ARIFwd-
  +          FRS- ARIFwd-

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
4 years agolspci: Decode PCIe Link Capabilities 2, expand Link Status 2
Bjorn Helgaas [Thu, 21 May 2020 22:40:29 +0000 (17:40 -0500)]
lspci: Decode PCIe Link Capabilities 2, expand Link Status 2

Decode Link Capabilities 2, which includes the Supported Link Speeds
Vector, and decode more fields of Link Status 2.

The test case (data from https://bugzilla.kernel.org/show_bug.cgi?id=206837
comment #21) includes a Thunderbolt Downstream Port that advertises
2.5-8GT/s support in Link Capabilities 2.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
4 years agoMaint: Reorganization of my directory structure
Martin Mares [Sun, 29 Mar 2020 20:38:35 +0000 (22:38 +0200)]
Maint: Reorganization of my directory structure

4 years agoHurd: Fix minor indentation problems
Joan Lledó [Sun, 22 Mar 2020 11:04:45 +0000 (12:04 +0100)]
Hurd: Fix minor indentation problems

4 years agoHurd: Fix bug: pci_get_dev() and dev->aux
Joan Lledó [Sun, 22 Mar 2020 10:51:39 +0000 (11:51 +0100)]
Hurd: Fix bug: pci_get_dev() and dev->aux

Allow clients to read and write from a device w/o a bus scan

4 years agosetpci: Added an option to skip the bus scan if possible
Martin Mares [Sun, 23 Feb 2020 15:44:41 +0000 (16:44 +0100)]
setpci: Added an option to skip the bus scan if possible

4 years agopci.h: Explain pci_dev->aux
Martin Mares [Sun, 23 Feb 2020 15:44:31 +0000 (16:44 +0100)]
pci.h: Explain pci_dev->aux

4 years agoReleased version 3.6.4. v3.6.4
Martin Mares [Sat, 25 Jan 2020 19:28:42 +0000 (20:28 +0100)]
Released version 3.6.4.

4 years agoVPD: When printing item IDs, escape non-ASCII characters
Martin Mares [Sat, 25 Jan 2020 19:42:03 +0000 (20:42 +0100)]
VPD: When printing item IDs, escape non-ASCII characters

4 years agoNew access method: Hurd via RPCs
Joan Lledó [Sat, 30 Nov 2019 12:13:25 +0000 (13:13 +0100)]
New access method: Hurd via RPCs

A new module for the Hurd that accesses PCI bus using available RPCs.

4 years agoMakefile: Fixed bugs in distclean v3.6.3
Martin Mares [Wed, 22 Jan 2020 10:42:19 +0000 (11:42 +0100)]
Makefile: Fixed bugs in distclean

This will be the real 3.6.3.

4 years agopciutils.lsm: Updated primary site
Martin Mares [Wed, 22 Jan 2020 10:32:14 +0000 (11:32 +0100)]
pciutils.lsm: Updated primary site

4 years agoReleased as 3.6.3
Martin Mares [Wed, 22 Jan 2020 10:29:26 +0000 (11:29 +0100)]
Released as 3.6.3

4 years agoUpdated pci.ids to today's snapshot.
Martin Mares [Wed, 22 Jan 2020 10:28:25 +0000 (11:28 +0100)]
Updated pci.ids to today's snapshot.

4 years agoChangeLog for 3.6.3
Martin Mares [Wed, 22 Jan 2020 10:27:40 +0000 (11:27 +0100)]
ChangeLog for 3.6.3

4 years agoFixed buffer overflows in ls-tree.c
Martin Mares [Wed, 22 Jan 2020 08:49:18 +0000 (09:49 +0100)]
Fixed buffer overflows in ls-tree.c

As reported in GitHub issue #24, tree dumping mode can smash the stack
if the hierarchy of buses is too deep.

Increased line buffer size to 1024 and switched to use of snprintf
everywhere, so that in the worst case, the line is truncated.

As snprintf can be problematic on obscure platforms, I wrapped it
in tree_printf(), so that we can add #ifdefs should problems arise.

4 years agoCleaned up dumping of expansion ROM regions
Martin Mares [Wed, 22 Jan 2020 08:23:27 +0000 (09:23 +0100)]
Cleaned up dumping of expansion ROM regions

"[virtual]" and "[enhanced]" are now printed after the base address
along with other flags.

4 years agoCleaned up dumping of I/O and memory regions
Martin Mares [Wed, 22 Jan 2020 08:15:29 +0000 (09:15 +0100)]
Cleaned up dumping of I/O and memory regions

Originally, I wanted to fix a bug, which caused 64-bit addresses
with their lower 32 bits zero to be reported as virtual regions.
However, it turned out that the whole function is quite messy,
so I rewrote it.

Also, we now print "[virtual]" and "[enhanced]" after the base address
along other modifiers.

4 years agoMan page: Multiple Module attributes can occur in -vmm format
Martin Mares [Tue, 21 Jan 2020 23:01:52 +0000 (00:01 +0100)]
Man page: Multiple Module attributes can occur in -vmm format

4 years agoAdded a man page for pci.ids
Martin Mares [Tue, 21 Jan 2020 22:56:47 +0000 (23:56 +0100)]
Added a man page for pci.ids

4 years agoVerbosity of Secondary PCI Express cap should not depend on device type
Martin Mares [Tue, 21 Jan 2020 22:07:25 +0000 (23:07 +0100)]
Verbosity of Secondary PCI Express cap should not depend on device type

4 years agonames-net: Avoid buffer overflow warnings by newer gcc
Martin Mares [Tue, 21 Jan 2020 20:51:39 +0000 (21:51 +0100)]
names-net: Avoid buffer overflow warnings by newer gcc

4 years agolspci: Change output for bridge with empty range to "[disabled]"
Kelsey Skunberg [Wed, 19 Jun 2019 16:48:58 +0000 (10:48 -0600)]
lspci: Change output for bridge with empty range to "[disabled]"

Change output displayed for memory behind bridge when the range is
empty to be consistent between each verbosity level. Replace "None" and
"[empty]" with "[disabled]". Old and new output examples listed below
for each verbosity level.

Show_range() is not called unless verbose == true. No output given
unless a verbose argument is provided.

OLD output for -v and -vv which uses "None" and -vvv uses "[empty]":

  Memory behind bridge: None                          # lspci -v
  Memory behind bridge: None                          # lspci -vv
  Memory behind bridge: 0000e000-0000efff [empty]     # lspci -vvv

NEW output for -v, -vv, and -vvv to use "[disabled]":

  Memory behind bridge: [disabled]                       # lspci -v
  Memory behind bridge: [disabled]                       # lspci -vv
  Memory behind bridge: 0000e000-0000efff [disabled]     # lspci -vvv

Advantage is consistent output regardless of verbosity level chosen and
to simplify the code.

Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
4 years agolspci: Remove unnecessary !verbose check in show_range()
Kelsey Skunberg [Wed, 19 Jun 2019 16:48:57 +0000 (10:48 -0600)]
lspci: Remove unnecessary !verbose check in show_range()

Remove 'if (!verbose)' code in show_range() due to not being called.
show_range() will only be called when verbose is true. Additional call
to check for verbosity within show_range() is dead code.

!verbose was used so nothing would print if the range behind a bridge
had a base > limit and verbose == false. Since show_range() will not be
called when verbose == false, not printing bridge information is
still accomplished.

Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
4 years agolspci: Include -vvv option in help
Kelsey Skunberg [Wed, 19 Jun 2019 16:48:56 +0000 (10:48 -0600)]
lspci: Include -vvv option in help

Include -vvv in help message.

Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
4 years agolspci: Reorder Express Root Complex registers to Cap, Ctl, Sta
Bjorn Helgaas [Fri, 17 May 2019 18:40:22 +0000 (13:40 -0500)]
lspci: Reorder Express Root Complex registers to Cap, Ctl, Sta

Registers in the PCI Express Capability come in sets of three (Capability,
Control, Status), and we typically print them in that order.  The Root
Complex-related registers were an exception: we printed them in the
(Control, Capability, Status) order.

Decode the RootCap, RootCtl, and RootSta registers in the usual order.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
5 years agoUpdated pci.ids to today's snapshot
Martin Mares [Wed, 30 Oct 2019 17:31:13 +0000 (18:31 +0100)]
Updated pci.ids to today's snapshot

This includes clarified copyright statement.

5 years agoSwitched to a new primary distribution site
Martin Mares [Thu, 26 Sep 2019 15:38:37 +0000 (17:38 +0200)]
Switched to a new primary distribution site

5 years agolspci: Add PCIe 5.0 data rate (32 GT/s) support
Gustavo Pimentel [Tue, 4 Jun 2019 16:24:46 +0000 (18:24 +0200)]
lspci: Add PCIe 5.0 data rate (32 GT/s) support

This enables "lspci" to show PCIe 5.0 data rate (32 GT/s) properly
according to the contents in register PCI_EXP_LNKCAP, PCI_EXP_LNKSTA
and PCI_EXP_LNKCTL2.

Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>