]> mj.ucw.cz Git - pciutils.git/log
pciutils.git
2 years agoSimplified pci_fill_info() and friends fill-info
Martin Mares [Fri, 21 Jan 2022 20:39:18 +0000 (21:39 +0100)]
Simplified pci_fill_info() and friends

Previously, we kept track of which fields were already filled, which
was quite brittle.

Now we keep only the set of already known fields in struct pci_dev.
We check if the current field is needed against this information.

Not only this simplifies the whole thing, but it also enables future
back-ends to call pci_fill_info() recursively as needed.

2 years agoAnother try at choosing the default compiler
Martin Mares [Fri, 21 Jan 2022 13:27:49 +0000 (14:27 +0100)]
Another try at choosing the default compiler

Cross-compilers often provide only "gcc" and not "cc".

So let's try "cc" when building natively and "gcc" when cross-compiling.

2 years agolspci: Improvements to PCIe link speed downgrade reporting
Martin Mares [Fri, 21 Jan 2022 13:16:37 +0000 (14:16 +0100)]
lspci: Improvements to PCIe link speed downgrade reporting

Do not report PCIe link downgrades for downstream ports.

Changed wording so that "overdriven" is reported instead of
"strange" for speeds greater than the maximum supported one.

Also report nothing instead of "ok".

Inspired by patches by Bjorn Helgaas and Matthew Wilcox.

2 years agopci.h: The error callback is now declared with PCI_NONRET
Martin Mares [Fri, 21 Jan 2022 13:09:16 +0000 (14:09 +0100)]
pci.h: The error callback is now declared with PCI_NONRET

Users of the repeatedly complain that the library crashes, which is
usually caused by providing an error hook which returns to the library.
Let's try warning them more explicitly.

2 years agotypes.h: Introduced PCI_NONRET
Martin Mares [Fri, 21 Jan 2022 13:09:04 +0000 (14:09 +0100)]
types.h: Introduced PCI_NONRET

2 years agolspci: Update tests files with VF 10-Bit Tag Requester
Dongdong Liu [Tue, 9 Mar 2021 13:35:19 +0000 (21:35 +0800)]
lspci: Update tests files with VF 10-Bit Tag Requester

Update the tests files with the new field 10BitTagReq
in SR-IOV Capabilities Register.

Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2 years agolspci: Decode VF 10-Bit Tag Requester
Dongdong Liu [Tue, 9 Mar 2021 13:35:18 +0000 (21:35 +0800)]
lspci: Decode VF 10-Bit Tag Requester

Decode VF 10-Bit Tag Requester Supported and Enable bit
in SR-IOV Capabilities Register.

Sample output:
  IOVCap: Migration- 10BitTagReq- Interrupt Message Number: 000
  IOVCtl: Enable+ Migration- Interrupt- MSE+ ARIHierarchy- 10BitTagReq-

Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2 years agolspci: Bus mapping works in non-zero domain
Martin Mares [Fri, 21 Jan 2022 12:58:56 +0000 (13:58 +0100)]
lspci: Bus mapping works in non-zero domain

2 years agoMakefile: don't hardcode gcc
Vladimír Čunát [Thu, 24 Sep 2020 08:28:18 +0000 (10:28 +0200)]
Makefile: don't hardcode gcc

I believe "cc" is a much better default nowadays.
Another approach would be to (also) use "?=" for these variables.

2 years agolibpci: i386-io-windows.h: Mute false-positive warning
Pali Rohár [Fri, 31 Dec 2021 15:43:25 +0000 (16:43 +0100)]
libpci: i386-io-windows.h: Mute false-positive warning

  i386-ports.c: In function ‘conf12_setup_io’:
  i386-io-windows.h:1021: warning: ‘old_token’ may be used uninitialized in this function
  i386-io-windows.h:1021: note: ‘old_token’ was declared here

It is always properly initialized when accessed, just gcc compiler does not see it.

2 years agoi386-ports: Do not mark pci_access in conf12_cleanup() as unused
Pali Rohár [Sat, 1 Jan 2022 13:42:12 +0000 (14:42 +0100)]
i386-ports: Do not mark pci_access in conf12_cleanup() as unused

It is used as argument for intel_cleanup_io() function.

2 years agolib: Fix definition of strcasecmp() for PCI_OS_WINDOWS
Pali Rohár [Sun, 26 Dec 2021 17:18:59 +0000 (18:18 +0100)]
lib: Fix definition of strcasecmp() for PCI_OS_WINDOWS

UCRT, MSVCRT and CRTDLL runtime libraries provides only _strcmpi()
function and not strcmpi().

MinGW32 has static libraries libcoldname.a and libmoldname.a which provides
strcmpi() function (as link-time redirect to _strcmpi()). libcoldname.a is
automatically linked when compiling for CRTDLL runtime and libmoldname.a
for MSVCRT runtime.

MinGW-w64 has only libmoldname.a library with strcmpi() function and it is
linked to final executable only when compiling for MSVCRT runtime.
when linking with MSVCRT.

To prevent dependency on particular linking configuration and MinGW
toolchain, use set strcasecmp() as alias to _strcmpi() function which is
provided by any runtime library.

2 years agocompat/getopt: Fix compatibility with non-GNU C library
Pali Rohár [Sun, 26 Dec 2021 17:19:25 +0000 (18:19 +0100)]
compat/getopt: Fix compatibility with non-GNU C library

Remove "#if defined(__GNU_LIBRARY__)" guard for getopt() function
prototype in compat/getopt.h header file. The only purpose of
compat/getopt.h header is to provide getopt() function prototype for
compatibility purpose on every platform, specially those which do not use
GNU C library (e.g. Windows).

Without this change i586-mingw32msvc-gcc compiler complains that function
getopt() is used without defined prototype.

Also remove inclusion of #include <string.h> header file in compat/getopt.c
source file. Probably due to compatibility purposes compat/getopt.c file
has defined custom prototype for function strncmp() incompatible with C99
(length argument in C99 should be of type size_t). Including C99 prototype
of strncmp() function from MinGW32 <string.h> header file cause compile
errors for i586-mingw32msvc-gcc compiler. Instead of including <stringh>
provides custom and simple my_strncmp() implementation.

Thsi change fixes compilation of compat/getopt.c with i586-mingw32msvc-gcc,
i686-w64-mingw32-gcc, x86_64-w64-mingw32-gcc and also MSVC cl compilers.

2 years agopciutils: Do not include compat/getopt.h on MinGW32 >= 3.0
Pali Rohár [Sun, 26 Dec 2021 17:19:41 +0000 (18:19 +0100)]
pciutils: Do not include compat/getopt.h on MinGW32 >= 3.0

MinGW32 since version 3.0 declares getopt() function prototype in
<unistd.h> header file.

2 years agoAdd PCIe 3.0+ decoding of the LnkCtl2 Compliance Preset/De-emphasis field
Lennert Buytenhek [Fri, 24 Dec 2021 08:48:01 +0000 (10:48 +0200)]
Add PCIe 3.0+ decoding of the LnkCtl2 Compliance Preset/De-emphasis field

As of PCIe 3.0, the LnkCtl2 "Compliance De-emphasis" field has been
renamed to "Compliance Preset/De-emphasis", and there are several new
bit encodings for various de-emphasis and preshoot combinations.

The name of the PCI_EXP_LNKCTL2_COM_DEEMPHASIS() macro is not changed
by this commit, as it is part of the libpci API.

Reported-by: Tim CC Chen(陳志佳) <Tim.CC.Chen@wnc.com.tw>
Signed-off-by: Lennert Buytenhek <buytenh@arista.com>
2 years agols-tree: Fix handling of truncated lines
Martin Mares [Tue, 28 Dec 2021 14:57:07 +0000 (15:57 +0100)]
ls-tree: Fix handling of truncated lines

2 years agoi386-ports: Added missing #include <string.h>
Martin Mares [Tue, 28 Dec 2021 14:56:53 +0000 (15:56 +0100)]
i386-ports: Added missing #include <string.h>

2 years agoMakefile: Add compat/getopt.h into PCIINC dependency list
Pali Rohár [Tue, 28 Dec 2021 14:01:25 +0000 (15:01 +0100)]
Makefile: Add compat/getopt.h into PCIINC dependency list

2 years agoREADME: Add a note on C99
Martin Mares [Mon, 27 Dec 2021 00:10:21 +0000 (01:10 +0100)]
README: Add a note on C99

2 years agoRenamed maint/RELEASE to appease case-insensitive filesystems
Martin Mares [Sun, 26 Dec 2021 23:56:49 +0000 (00:56 +0100)]
Renamed maint/RELEASE to appease case-insensitive filesystems

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.

3 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

3 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.

3 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.

3 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.

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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