]> mj.ucw.cz Git - pciutils.git/log
pciutils.git
8 months agolibpci: ecam: Cache ACPI MCFG table between detect() and init() phase
Pali Rohár [Thu, 18 May 2023 19:40:44 +0000 (21:40 +0200)]
libpci: ecam: Cache ACPI MCFG table between detect() and init() phase

This will speed up listing devices by lspci as it is not needed to scan
BIOS memory two times.

8 months agolibpci: ecam: Fix detect sequence when addresses are not specified
Pali Rohár [Mon, 8 May 2023 19:25:36 +0000 (21:25 +0200)]
libpci: ecam: Fix detect sequence when addresses are not specified

Search for ACPI MCFG table in detect sequence, so on failure we can move to
the next pci access method.

8 months agolibpci: Enable POSIX physmem also on Solaris, Haiku nad BeOS
Pali Rohár [Mon, 8 May 2023 19:19:27 +0000 (21:19 +0200)]
libpci: Enable POSIX physmem also on Solaris, Haiku nad BeOS

Solaris can access physical memory via mmap() of /dev/xsvc device and
Haiku + BeOS of /dev/misc/mem device.

8 months agolibpci: physmem-posix: Fix OFF_MAX definition
Pali Rohár [Sat, 20 Jan 2024 11:30:08 +0000 (12:30 +0100)]
libpci: physmem-posix: Fix OFF_MAX definition

Expression ((1 << n) - 1) for n=31 has undefined behavior and gcc 11
already evaluates it to zero.

Fix definition of OFF_MAX to prevent signed integer overflow.

8 months agolibpci: Move physical memory mapping mmap() code from ecam/mmio-ports to physmem...
Pali Rohár [Mon, 8 May 2023 19:15:07 +0000 (21:15 +0200)]
libpci: Move physical memory mapping mmap() code from ecam/mmio-ports to physmem-posix.c file

This deduplicates physical memory mapping mmap() code found in ecam and
mmio-ports backends into common functions with new physmem API.

This new physmem API allows to implement also non-mmap() variants of
physical memory mapping.

8 months agopcilmr: Fix compilation for windows and djgpp
Pali Rohár [Sun, 18 Feb 2024 13:50:54 +0000 (14:50 +0100)]
pcilmr: Fix compilation for windows and djgpp

8 months agowindows: Fix setting permissions in grant_process_token_dacl_permissions()
Pali Rohár [Wed, 14 Jun 2023 15:43:21 +0000 (17:43 +0200)]
windows: Fix setting permissions in grant_process_token_dacl_permissions()

Rewrite function to always add a new allow granting permissions at first
position in DACL. Normally all deny permissions are before allow
permissions, so previously allow permission could have been overridden by
explicit deny permission. With this change, our newly added allow
permission override any possible deny permission and always grant access
for asked process user.

Also properly handle automatic inheritance model which is in use since
Windows 2000 and handle also special case when DACL is not present which
gives allow access to everyone.

8 months agowindows: Move win32_call_func_with_tcb_privilege() from i386-io-windows.h to win32...
Pali Rohár [Wed, 24 May 2023 18:28:38 +0000 (20:28 +0200)]
windows: Move win32_call_func_with_tcb_privilege() from i386-io-windows.h to win32-helpers.c

8 months agowindows: Move common non-I/O port code from i386-io-windows.h to win32-helpers.c
Pali Rohár [Mon, 8 May 2023 12:04:40 +0000 (14:04 +0200)]
windows: Move common non-I/O port code from i386-io-windows.h to win32-helpers.c

8 months agowindows: Deduplicate code and move helper functions to new file win32-helpers.c
Pali Rohár [Sun, 7 May 2023 14:40:28 +0000 (16:40 +0200)]
windows: Deduplicate code and move helper functions to new file win32-helpers.c

Function win32_strerror() was duplicated in two different files:
win32-cfgmgr32.c and win32-kldbg.c. Now there is only one in
win32-helpers.c.

8 months agowindows: Translate NT status to Win32 error
Pali Rohár [Sun, 7 May 2023 15:05:42 +0000 (17:05 +0200)]
windows: Translate NT status to Win32 error

8 months agowindows: Split code for enabling Tcb privilege and calling ProcessUserModeIOPL
Pali Rohár [Sun, 7 May 2023 11:32:54 +0000 (13:32 +0200)]
windows: Split code for enabling Tcb privilege and calling ProcessUserModeIOPL

Code for enabling Tcb privilege is split from SetProcessUserModeIOPL() into
new function CallFuncWithTcbPrivilege().

8 months agowindows: Comment on MSVC inline asm issues
Martin Mares [Sun, 18 Feb 2024 13:15:06 +0000 (14:15 +0100)]
windows: Comment on MSVC inline asm issues

8 months agowindows: Add strtoull defines for msvc
Pali Rohár [Wed, 24 May 2023 19:45:48 +0000 (21:45 +0200)]
windows: Add strtoull defines for msvc

8 months agowindows: Make msvc __readeflags more readable
Pali Rohár [Sun, 1 Jan 2023 18:52:16 +0000 (19:52 +0100)]
windows: Make msvc __readeflags more readable

Semicolon in msvc __asm block means start of the comment, and not end of
the __asm statement, like it is for all other C statements. Also function
which uses msvc inline assembly cannot be inlined to another function
(compiler reports a warning about it, not a fatal error). So add explicit
curly brackets for __asm block, remove misleading semicolons and do not
declare function as inline.

8 months agoMakefile: Fix dependencies on header files
Martin Mares [Sun, 18 Feb 2024 13:12:10 +0000 (14:12 +0100)]
Makefile: Fix dependencies on header files

8 months agoMaint: Added a script for pushing to both public repos
Martin Mares [Sun, 18 Feb 2024 11:12:01 +0000 (12:12 +0100)]
Maint: Added a script for pushing to both public repos

8 months agoLet us use <getopt.h> everywhere
Martin Mares [Sun, 18 Feb 2024 11:10:21 +0000 (12:10 +0100)]
Let us use <getopt.h> everywhere

It is needed by pcilmr anyway.

If it turns out to be missing on your system, please extend
the condition for use of compat/getopt.h in pciutils.h.

8 months agopcilmr: Avoid strftime with %F and produce proper ISO 8601 time
Martin Mares [Sun, 18 Feb 2024 11:09:19 +0000 (12:09 +0100)]
pcilmr: Avoid strftime with %F and produce proper ISO 8601 time

%F is not portable.

8 months agopcilmr: Clean up includes
Martin Mares [Sun, 18 Feb 2024 11:09:02 +0000 (12:09 +0100)]
pcilmr: Clean up includes

8 months agopcilmr: No need to copy a string passed to filter parsing functions
Martin Mares [Sun, 18 Feb 2024 11:08:21 +0000 (12:08 +0100)]
pcilmr: No need to copy a string passed to filter parsing functions

The parsing is guaranteed to be non-destructive in recent libpci.

8 months agobitops.h moved to root
Martin Mares [Sun, 18 Feb 2024 11:07:50 +0000 (12:07 +0100)]
bitops.h moved to root

It is a part of the utilities, not of libpci.

8 months agolib/types.h makes NULL always available
Martin Mares [Sun, 18 Feb 2024 11:06:03 +0000 (12:06 +0100)]
lib/types.h makes NULL always available

8 months agoSince we already require C99, we can rely on <stdint.h>
Martin Mares [Sun, 18 Feb 2024 11:05:21 +0000 (12:05 +0100)]
Since we already require C99, we can rely on <stdint.h>

8 months agoMakefile: Additions to CFLAGS require an override
Martin Mares [Sun, 18 Feb 2024 11:04:44 +0000 (12:04 +0100)]
Makefile: Additions to CFLAGS require an override

Otherwise, they are ignored when "make CFLAGS=something" is used.

8 months agoMakefile: When linking pcilmr, specify library last
Martin Mares [Sun, 18 Feb 2024 11:04:28 +0000 (12:04 +0100)]
Makefile: When linking pcilmr, specify library last

8 months agoChangeLog: Preparing for release
Martin Mares [Sun, 18 Feb 2024 00:43:57 +0000 (01:43 +0100)]
ChangeLog: Preparing for release

8 months agoManual: Document tilde expansion in net.cache_name
Martin Mares [Sun, 18 Feb 2024 00:42:25 +0000 (01:42 +0100)]
Manual: Document tilde expansion in net.cache_name

8 months agoLocation of name cache now follows XDG base dir specification
Martin Mares [Sun, 18 Feb 2024 00:40:36 +0000 (01:40 +0100)]
Location of name cache now follows XDG base dir specification

We also create parent directories of net.cache_name automatically.

Tilde expansion is performed internally and it does not change
user-specified net.cache_name any longer.

8 months agoNames: Fixed a rare bug in loading of pci.ids
Martin Mares [Sun, 18 Feb 2024 00:37:49 +0000 (01:37 +0100)]
Names: Fixed a rare bug in loading of pci.ids

If the pci.ids file was empty, it was never considered loaded,
so the loading function was called repeatedly and it always flushed
the name cache.

8 months agoGitignore: Add pcilmr
Martin Mares [Sun, 18 Feb 2024 00:36:44 +0000 (01:36 +0100)]
Gitignore: Add pcilmr

8 months agoLibrary: pci_define_param() returns a pointer to the parameter
Martin Mares [Sun, 18 Feb 2024 00:35:59 +0000 (01:35 +0100)]
Library: pci_define_param() returns a pointer to the parameter

This will allow overriding pci_param->malloced.

8 months agobitops.h should not be included from public pci.h
Martin Mares [Sat, 17 Feb 2024 23:07:14 +0000 (00:07 +0100)]
bitops.h should not be included from public pci.h

8 months agoRemoved a forgotten debugging test
Martin Mares [Sat, 17 Feb 2024 23:06:33 +0000 (00:06 +0100)]
Removed a forgotten debugging test

It was introduced by commit 0ce6ff4aafb36a7923511a8da6bbbebb642e3109.

8 months agopcilmr: Add pcilmr man page
Nikita Proshkin [Wed, 27 Dec 2023 09:45:04 +0000 (14:45 +0500)]
pcilmr: Add pcilmr man page

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add handling of situations when device reports its MaxOffset values equal...
Nikita Proshkin [Wed, 27 Dec 2023 09:45:03 +0000 (14:45 +0500)]
pcilmr: Add handling of situations when device reports its MaxOffset values equal to 0

According to spec, for the MaxTimingOffset and MaxVoltageOffset parameters
'A 0 value may be reported if the vendor chooses not to report the offset'.

Use max possible Offset value in such situations and report to the user.

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add option to save margining results in csv form
Nikita Proshkin [Wed, 27 Dec 2023 09:45:02 +0000 (14:45 +0500)]
pcilmr: Add option to save margining results in csv form

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add --scan mode to search for all LMR-capable Links
Nikita Proshkin [Wed, 27 Dec 2023 09:45:01 +0000 (14:45 +0500)]
pcilmr: Add --scan mode to search for all LMR-capable Links

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add the ability to pass multiple links to the utility
Nikita Proshkin [Wed, 27 Dec 2023 09:45:00 +0000 (14:45 +0500)]
pcilmr: Add the ability to pass multiple links to the utility

* Add support for different utility modes;
* Make the default (now --margin) mode capable to accept several
  components and run test for all of them;
* Add --full mode for sequential start of the test on all ready links
  in the system;
* The complication of the main function is due to the need to pre-read the
  parameters of the devices before starting the tests in order to calculate
  Total ETA of the utility.

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add support for unique hardware quirks
Nikita Proshkin [Wed, 27 Dec 2023 09:44:59 +0000 (14:44 +0500)]
pcilmr: Add support for unique hardware quirks

Make it possible to change receiver margining parameters depending on
current hardware specificity.

In our tests Intel Ice Lake CPUs RC ports reported
MaxVoltageOffset = 50 (RxA), which led to results several times bigger
than the results of the hardware debugger.
Looks like in Intel Sapphire Rapids this was fixed, these CPU RC ports
report MaxVoltageOffset = 12 (RxA). To solve the problem it was decided
to hardcode Volt Offset to 12 (120 mV) for Ice Lake RC ports.

In the case of margining a specific link, only information about
Downstream and Upstream ports should be sufficient to decide whether to
use quirks, so the feature was implemented based on a list of devices
(vendor - device - revision triples), whose problems are known.

Back to Ice Lake ports, according to Integrators List on the pci-sig site,
the list of possible RC ports of Ice Lake Xeon's includes at least three
more options (with ids 347B/C/D) besides the one used in this commit, but
we don't have such processors to check the relevance of the MaxVoltageOffset
problem for these ports.

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add utility main function
Nikita Proshkin [Wed, 27 Dec 2023 09:44:58 +0000 (14:44 +0500)]
pcilmr: Add utility main function

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add function for default margining results log
Nikita Proshkin [Wed, 27 Dec 2023 09:44:57 +0000 (14:44 +0500)]
pcilmr: Add function for default margining results log

Lanes are rated according to the minimum/recommended values.
The minimum values are taken from PCIe Base Spec Rev 5.0 section 8.4.4.
30% UI recommended value for timing is taken from NVIDIA presentation
"PCIe 4.0 Mass Electrical Margins Data Collection".

Receiver lanes are called 'Weird' if all results of all receiver lanes
are equal to the spec minimum value.

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add logging functions for margining
Nikita Proshkin [Wed, 27 Dec 2023 09:44:56 +0000 (14:44 +0500)]
pcilmr: Add logging functions for margining

* Implement option to turn on/off logging for margining;
* Support systems with several PCI domains;
* margin_log_margining function prints margining in progress log using
  one line messages for each Receiver in the form:
  "Margining - <direction> - Lanes [<current simultaneous lanes>] - ETA:
  <current direction-lanes margining remaining time> Steps: <current
  margining steps done> Total ETA: <utility run total remaining time>".

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add margining process functions
Nikita Proshkin [Wed, 27 Dec 2023 09:44:55 +0000 (14:44 +0500)]
pcilmr: Add margining process functions

* Implement the margining flow as described in the section "Example
  Software Flow for Lane Margining at Receiver"
  of the PCIe Base Spec Rev 5.0;
* Implement margining commands formation and response parsing according
  to the PCIe Base Spec Rev 5.0 table 4-26;
* Use Receiver margining parameters as described in the
  PCIe Base Spec Rev 5.0 table 8-11;
* Support lane reversal and simultaneous margining of several link lanes.

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agopcilmr: Add functions for device checking and preparations before main margining...
Nikita Proshkin [Wed, 27 Dec 2023 09:44:54 +0000 (14:44 +0500)]
pcilmr: Add functions for device checking and preparations before main margining processes

Follow the checklist from PCIe Base Spec Rev 5.0 section 4.2.13.3
"Receiver Margin Testing Requirements":
* Verify the Link is at 16 GT/s or higher data rate, in DO PM state;
* Verify that Margining Ready bit of the device is set;
* Disable the ASPM and Autonomous Speed/Width features for the duration
  of the test.

Also verify that Upstream Port of the Link is Function 0 of a Device,
according to spec, only it must implement margining registers.

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agolibpci: Add separate file for bit manipulation functions
Nikita Proshkin [Wed, 27 Dec 2023 09:44:53 +0000 (14:44 +0500)]
libpci: Add separate file for bit manipulation functions

Move several macros from lspci and add some more for operations with
bit masks.

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agolspci: Add Lane Margining support to the lspci
Nikita Proshkin [Wed, 27 Dec 2023 09:44:52 +0000 (14:44 +0500)]
lspci: Add Lane Margining support to the lspci

Gather all the info available without writing to the config space.
Without any commands margining capability exposes only 3 status bits to
read through Margining Port Capabilities and Margining Port Status registers.
It makes sense to show them anyway. For example, Margining Ready bit
indicates whether the device is actually ready for the margining process.

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agolibpci: Add constants for Lane Margining at the Receiver Extended Capability
Nikita Proshkin [Wed, 27 Dec 2023 09:44:51 +0000 (14:44 +0500)]
libpci: Add constants for Lane Margining at the Receiver Extended Capability

Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com>
Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
8 months agolspci: Fix unsynchronized caches in lspci struct device and pci struct pci_dev
Nikita Proshkin [Wed, 27 Dec 2023 09:44:50 +0000 (14:44 +0500)]
lspci: Fix unsynchronized caches in lspci struct device and pci struct pci_dev

lspci initializes both caches for the device to the same memory block in
its scan_device function. Latter calls to config_fetch function will
realloc cache in struct device, but not in struct pci_dev leading to
the invalid pointer in the latter. pci_dev cache is used by pci_read_*
functions, what will lead to a possible use-after-free situations.

Example:

With patch:

8 months agoMacOS: An attempt to appease compiler picky about attribute placement
Martin Mares [Sat, 17 Feb 2024 22:30:22 +0000 (23:30 +0100)]
MacOS: An attempt to appease compiler picky about attribute placement

8 months agoMerge pull request #166 from DigitalDJ/master
Martin Mareš [Sat, 17 Feb 2024 22:22:18 +0000 (23:22 +0100)]
Merge pull request #166 from DigitalDJ/master

i386-ports: Add support for OpenBSD

10 months agoi386-ports: Add support for OpenBSD
Grant Pannell [Sat, 30 Dec 2023 15:27:30 +0000 (01:57 +1030)]
i386-ports: Add support for OpenBSD

10 months agolib: Refactor access to x86 I/O ports
Pali Rohár [Sun, 8 Oct 2023 13:10:12 +0000 (15:10 +0200)]
lib: Refactor access to x86 I/O ports

On all systems except BeOS and Haiku are x86 I/O ports accessed in the
standard way by the x86 in/out instructions.

On more systems there are wrapper functions for x86 in/out instructions but
under different names and sometimes even for same system those names
depends on user version of toolchain/compiler. And also some systems have
same function names but switched order of arguments.

Simplify this code, define own wrapper functions for x86 in/out
instructions in new header file i386-io-access.h and use it for every
platform except BeOS and Haiku.

This change simplifies Windows port, duplicated code between SunOS and
Windows and also tons of redefined port functions in every port.

To not conlict with possible system functions included from some header
file, add intel_ prefix for every function included from the file
lib/i386-io-access.h into lib/i386-ports.c

10 months agoRename aux fields in structs pci_access and pci_dev to backend_data
Martin Mares [Fri, 29 Dec 2023 18:33:21 +0000 (19:33 +0100)]
Rename aux fields in structs pci_access and pci_dev to backend_data

This hopefully conveys the purpose much better than just "aux".

10 months agoGet rid of workarounds for Linux systems without pread/pwrite
Martin Mares [Fri, 29 Dec 2023 14:23:00 +0000 (15:23 +0100)]
Get rid of workarounds for Linux systems without pread/pwrite

Many things have changed since we introduced work-arounds for Linux
systems with missing pread/pwrite in 1999 (if you are curious, it was
in commit bc6346df8d89ece4814be7dff951ec1a7d259938).

I believe that it is supported by all reasonably recent Linux systems
now. After all, pread() was already defined by POSIX.1-2001.

This should also fix problems with musl libc mentioned in GitHub
issue #158.

10 months agoConstants for CXL capability should not change
Martin Mares [Fri, 29 Dec 2023 14:16:03 +0000 (15:16 +0100)]
Constants for CXL capability should not change

When CXL capability decoding was upgraded to revision 2 by commit
c0ccce1b4cd5b42b17f2e8f7bae4031c311677ff, the value of PCI_CXL_DEV_LEN
in lib/header.h has changed.

This is probably not a good idea - programs using libpci can depend
on the exact value of this constant.

Let us revert PCI_CXL_DEV_LEN to the original value for revision 1
and add PCI_CXL_DEV_LEN_REV2 for the next revision.

Also, fixed a bug in the decoder which caused it to read past the
end of the buffer for a capability which is declared as revision 2,
but too short.

10 months agolibpci: ecam: Fix big address range mappings
Pali Rohár [Thu, 18 May 2023 19:36:50 +0000 (21:36 +0200)]
libpci: ecam: Fix big address range mappings

If more buses span continuous address space then there can be up to the
256 MB long address range which ecam backend tries to map.

Such huge space cannot be mapped on some memory limited systems. And also
it is not needed to map whole 256 MB long address range because ecam
backend cache uses mapping only for one bus. One bus has maximal mapping
size just 32*8*4096 bytes.

So adjust size calculation when mapping ecam bus.

10 months agolibpci: ecam: Deduplicate get_bus_addr() code for calculating bus address
Pali Rohár [Thu, 18 May 2023 19:34:49 +0000 (21:34 +0200)]
libpci: ecam: Deduplicate get_bus_addr() code for calculating bus address

Move duplicate code block into helper function calculate_bus_addr().

10 months agolibpci: win32-cfgmgr32: Do not use GetWindowsDirectory()
Pali Rohár [Thu, 17 Aug 2023 20:03:19 +0000 (22:03 +0200)]
libpci: win32-cfgmgr32: Do not use GetWindowsDirectory()

GetWindowsDirectory() function returns HOME user folder if application is
running on the Terminal Server. So this function is not suitable.

Instead of use GetSystemDirectory() which returns path to system32 folder
or GetSystemWindowsDirectory() which returns path to Windows folder (but
this is not available on all Windows versions).

10 months agolibpci: win32-kldbg: Fix driver constructing path
Pali Rohár [Thu, 17 Aug 2023 19:15:02 +0000 (21:15 +0200)]
libpci: win32-kldbg: Fix driver constructing path

Get*Directory() functions have strange API. When called with zero buffer
they return length of the required buffer for storing path including
nul-term in TCHAR units (which is 1 for ANSI builds and 2 for UNICODE
builds). When called with non-zero buffer which can store full path they
return length of the path without nul-term (again in TCHAR units).

GetWindowsDirectory() function returns HOME user folder if application is
running on the Terminal Server. So this function is not suitable.

Fix calculation of path buffer for UNICODE builds and instead of usage
GetWindowsDirectory() function with concatenating "\\system32" string, use
function GetSystemDirectory() which returns path directly to system32
folder and which works correctly also on Terminal Server (per KB281316).

10 months agolibpci: i386-io-windows.h: Fix memory leak in grant_process_token_dacl_permissions()
Pali Rohár [Wed, 7 Jun 2023 17:53:32 +0000 (19:53 +0200)]
libpci: i386-io-windows.h: Fix memory leak in grant_process_token_dacl_permissions()

When SetEntriesInAcl() call success then new_dacl allocated by this
function has to be released by LocalFree() call.

10 months agolibpci: i386-io-windows.h: Fix error code in ERROR_PRIVILEGE_NOT_HELD code path
Pali Rohár [Sat, 6 May 2023 16:35:20 +0000 (18:35 +0200)]
libpci: i386-io-windows.h: Fix error code in ERROR_PRIVILEGE_NOT_HELD code path

10 months agolibpci: win32-cfgmgr32: Fix reg key name in warning message
Pali Rohár [Sun, 11 Jun 2023 11:48:07 +0000 (13:48 +0200)]
libpci: win32-cfgmgr32: Fix reg key name in warning message

10 months agolibpci: win32-cfgmgr32: Skip parsing uninterested resources very early
Pali Rohár [Wed, 15 Mar 2023 18:12:05 +0000 (19:12 +0100)]
libpci: win32-cfgmgr32: Skip parsing uninterested resources very early

10 months agolibpci: win32-cfgmgr32: Show type of source in warning message
Pali Rohár [Wed, 15 Mar 2023 18:11:25 +0000 (19:11 +0100)]
libpci: win32-cfgmgr32: Show type of source in warning message

10 months agoFix memory leak when fill flags has PCI_FILL_PARENT.
nsf.cd [Tue, 14 Nov 2023 10:20:22 +0000 (18:20 +0800)]
Fix memory leak when fill flags has PCI_FILL_PARENT.

10 months agoCXL: Fix indentation
Martin Mares [Fri, 8 Dec 2023 18:44:16 +0000 (19:44 +0100)]
CXL: Fix indentation

10 months agoMerge pull request #146 from alexisgrytalms/master
Martin Mareš [Fri, 8 Dec 2023 18:41:49 +0000 (19:41 +0100)]
Merge pull request #146 from alexisgrytalms/master

CXL: DVSEC fixes and CXLCap3

10 months agoMerge pull request #157 from pali/master
Martin Mareš [Fri, 8 Dec 2023 18:38:28 +0000 (19:38 +0100)]
Merge pull request #157 from pali/master

Fix compile warnings about unused variables

10 months agolspci: Add PCIe 6.0 data rate (64 GT/s) also to LnkCap2
Ilpo Järvinen [Fri, 8 Dec 2023 10:13:07 +0000 (12:13 +0200)]
lspci: Add PCIe 6.0 data rate (64 GT/s) also to LnkCap2

While commit 5bdf63b6b1bc ("lspci: Add PCIe 6.0 data rate (64 GT/s)
support") added 64 GT/s support to some registers, LnkCap2 Supported
Link Speeds Vector was not included.

Add PCIe 6.0 data rate bit check also into
cap_express_link2_speed_cap().

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
12 months agoSubject: lspci: Display PASID required attribute in Page Status Register.
Ashok Raj [Wed, 18 Oct 2023 21:34:15 +0000 (14:34 -0700)]
Subject: lspci: Display PASID required attribute in Page Status Register.

Display the PASID required attribute in the Page Request Status Register.
When set, the function expects a PASID on Page Group Response (PRG)
messages when the corresponding page request had a PASID.

Signed-off-by: Ashok Raj <ashok.raj@intel.com>
12 months agosetpci: Fix man page typo
Bjorn Helgaas [Wed, 18 Oct 2023 16:08:36 +0000 (11:08 -0500)]
setpci: Fix man page typo

"Several ways how to identity a register" doesn't read correctly and
misspells "identify".  Reword as "several ways to identify a register".

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 months agolspci: Remove spurious colon (':') from PCIe PTM decoding
Bjorn Helgaas [Wed, 18 Oct 2023 16:08:35 +0000 (11:08 -0500)]
lspci: Remove spurious colon (':') from PCIe PTM decoding

Remove spurious colon from PTM decoding to match other enabled/disabled
decoding.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 months agolspci: Print PCIe Interrupt Message Numbers consistently
Bjorn Helgaas [Wed, 18 Oct 2023 16:08:34 +0000 (11:08 -0500)]
lspci: Print PCIe Interrupt Message Numbers consistently

Several Capabilities include MSI/MSI-X Interrupt Message Numbers, which
were decoded in various ways:

  - MSI %02x                             PCIe Capability
  - IntMsg %d                            AER Capability
  - INT Msg #%d                          DPC Capability
  - Interrupt Message Number %03x        SR-IOV Capability
  - Interrupt Message Number %03x        DOE Capability

Print them all using the same format:

  + IntMsgNum %d

This better matches the "Interrupt Message Number" terminology used in the
spec, e.g., PCIe r6.0, sec 7.5.3.2.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
12 months agolspci: Decode PCIe LnkCtl Link Disable as 'LnkDisable'
Bjorn Helgaas [Wed, 18 Oct 2023 16:08:33 +0000 (11:08 -0500)]
lspci: Decode PCIe LnkCtl Link Disable as 'LnkDisable'

Decode the Link Disable bit as "LnkDisable" (not simply "Disable") to match
the spec terminology (PCIe r6.0, sec 7.5.3.7)

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 months agolspci: Decode PCIe DevCtl2 End-to-End TLP Prefix Blocking
Bjorn Helgaas [Wed, 18 Oct 2023 16:08:32 +0000 (11:08 -0500)]
lspci: Decode PCIe DevCtl2 End-to-End TLP Prefix Blocking

Decode the PCIe DevCtl2 End-to-End TLP Prefix Blocking bit.  The
"EETLPPrefixBlk" format is analogous to the existing "EETLPPrefix" format
used for the corresponding DevCap2 bit.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 months agolspci: Decode PCIe DevCtl2 Emergency Power Reduction Request
Bjorn Helgaas [Wed, 18 Oct 2023 16:08:31 +0000 (11:08 -0500)]
lspci: Decode PCIe DevCtl2 Emergency Power Reduction Request

Decode the PCIe DevCtl2 Emergency Power Reduction Request bit.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 months agolspci: Decode PCIe DevCtl2 ID-Based Ordering Enables
Bjorn Helgaas [Wed, 18 Oct 2023 16:08:30 +0000 (11:08 -0500)]
lspci: Decode PCIe DevCtl2 ID-Based Ordering Enables

Decode the PCIe DevCtl2 ID-Based Ordering Enable bits.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
12 months agolspci: Reorder PCIe DevCtl2 fields to match spec
Bjorn Helgaas [Wed, 18 Oct 2023 16:08:29 +0000 (11:08 -0500)]
lspci: Reorder PCIe DevCtl2 fields to match spec

Decode the PCIe DevCtl2 fields in the same order they're documented in the
PCIe spec.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
13 months agoFix compile warnings about unused variables
Pali Rohár [Sun, 10 Sep 2023 16:48:16 +0000 (18:48 +0200)]
Fix compile warnings about unused variables

sysfs.c: In function 'sysfs_read_vpd':
sysfs.c:569:43: warning: unused parameter 'd' [-Wunused-parameter]
 static int sysfs_read_vpd(struct pci_dev *d, int pos, byte *buf, int len)
                                           ^
sysfs.c:569:50: warning: unused parameter 'pos' [-Wunused-parameter]
 static int sysfs_read_vpd(struct pci_dev *d, int pos, byte *buf, int len)
                                                  ^~~
sysfs.c:569:61: warning: unused parameter 'buf' [-Wunused-parameter]
 static int sysfs_read_vpd(struct pci_dev *d, int pos, byte *buf, int len)
                                                             ^~~
sysfs.c:569:70: warning: unused parameter 'len' [-Wunused-parameter]
 static int sysfs_read_vpd(struct pci_dev *d, int pos, byte *buf, int len)
                                                                      ^~~

14 months agoAdd support for 32.0 GT/s header
Mateusz Nowicki [Fri, 1 Sep 2023 13:41:59 +0000 (15:41 +0200)]
Add support for 32.0 GT/s header

15 months agoupdate-pciids: Report itself as an user agent, version included
Martin Mares [Sun, 23 Jul 2023 13:44:03 +0000 (15:44 +0200)]
update-pciids: Report itself as an user agent, version included

Unfortunately, this leads to the User-Agent not containing version
of curl/wget/lynx we used.

15 months agoupdate-pciids: Re-compress pci.ids if needed
Martin Mares [Sat, 22 Jul 2023 21:47:13 +0000 (23:47 +0200)]
update-pciids: Re-compress pci.ids if needed

Previously, if pciutils were configured with compression of pci.ids,
update-pciids downloaded the gzipped version. Now, it downloads the
most compressed version for which tools are found installed, and
recompresses it to gzip if needed.

15 months agoupdate-pciids: Add support for xz compression
Martin Mares [Sat, 22 Jul 2023 21:36:11 +0000 (23:36 +0200)]
update-pciids: Add support for xz compression

15 months agoMerge remote-tracking branch 'twilfredo/wilfred/fixup-doe-bits'
Martin Mares [Wed, 19 Jul 2023 19:13:59 +0000 (21:13 +0200)]
Merge remote-tracking branch 'twilfredo/wilfred/fixup-doe-bits'

15 months agolspci: Use mangled vendor/device ID when examining vendor caps
David Edmondson [Wed, 19 Jul 2023 14:16:41 +0000 (15:16 +0100)]
lspci: Use mangled vendor/device ID when examining vendor caps

Given that PCI VFs are expected to have a vendor and device ID of
0xffff, when examining vendor capabilities use the mangled vendor and
device IDs (typically copied from the PF) rather than those read from
the VF configuration space.

Signed-off-by: David Edmondson <david.edmondson@oracle.com>
15 months agolib: fixup DOE status register bit
Wilfred Mallawa [Tue, 18 Jul 2023 08:50:28 +0000 (18:50 +1000)]
lib: fixup DOE status register bit

The error bit is specified by the 2nd (zero indexed) bit
in the status register, so the respective bit value is 4 (PCI Base Spec
6.0.1). Let's fix that up.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
16 months agoUpdate license comments and added SPDX license identifiers
Martin Mares [Sun, 18 Jun 2023 12:37:33 +0000 (14:37 +0200)]
Update license comments and added SPDX license identifiers

Previously, the only information about the specific version of GPL
was present in the README and individual source files mentioned only
GPL alone.

Let us update all copyright comments to explicitly say "GPL v2+"
and also include the machine readable SPDX license identifier.

16 months agoCXL3.0: Add DVSEC CXLCtrl3 and missing CXLCtl2
Alexis Gryta [Tue, 6 Jun 2023 06:03:52 +0000 (15:03 +0900)]
CXL3.0: Add DVSEC CXLCtrl3 and missing CXLCtl2

8.1.3 PCIe DVSEC for CXL Devices

16 months agoCXL: Fix Flex Bus DVSEC cap
Alexis Gryta [Mon, 5 Jun 2023 06:06:08 +0000 (15:06 +0900)]
CXL: Fix Flex Bus DVSEC cap

18 months agoFix stripping in cross-compiling mode
Martin Mares [Mon, 1 May 2023 13:44:40 +0000 (15:44 +0200)]
Fix stripping in cross-compiling mode

Fixes 3d7466ef8545d37a4666e185a9f5d65ceb9c8af4.

18 months agoReleased as v3.10.0. v3.10.0
Martin Mares [Mon, 1 May 2023 13:00:27 +0000 (15:00 +0200)]
Released as v3.10.0.

18 months agoMerge remote-tracking branch 'pali/ls-tree-multidomain'
Martin Mares [Mon, 1 May 2023 12:48:14 +0000 (14:48 +0200)]
Merge remote-tracking branch 'pali/ls-tree-multidomain'

18 months agolspci: Allow longer name strings
Martin Mares [Mon, 1 May 2023 12:42:11 +0000 (14:42 +0200)]
lspci: Allow longer name strings

18 months agoMerge pull request #137 from jiladahe1997/master
Martin Mareš [Mon, 1 May 2023 12:39:34 +0000 (14:39 +0200)]
Merge pull request #137 from jiladahe1997/master

Makefile: change STRIP to '--strip-program' when cross-compile

18 months agoMerge pull request #140 from pali/ls-tree
Martin Mareš [Mon, 1 May 2023 12:39:19 +0000 (14:39 +0200)]
Merge pull request #140 from pali/ls-tree

lspci: Fix bridge filter support in tree view

18 months agoAdd test case with multidomain Freescale P2020 PCIe hierarchy
Pali Rohár [Sat, 29 Apr 2023 11:52:11 +0000 (13:52 +0200)]
Add test case with multidomain Freescale P2020 PCIe hierarchy

18 months agols-tree: Print PCI domains in ascending order
Pali Rohár [Sat, 22 Apr 2023 09:48:55 +0000 (11:48 +0200)]
ls-tree: Print PCI domains in ascending order

18 months agols-tree: Fix parsing devices on multidomain PCI system
Pali Rohár [Sat, 22 Apr 2023 09:47:24 +0000 (11:47 +0200)]
ls-tree: Fix parsing devices on multidomain PCI system

Represent each domain as domain bridge under the &host_bridge and put root
bus of each domain under the domain bridge.

With this change lspci in tree view does not show zero bus on domain 0 in
the output if this bus does not exist at all. Root bus in PCIe hierarchy
does not have to be zero and on Freescale PowerPC systems it is common.

Also with this change are separate domain showed in the output separately.

18 months agols-tree: Rename struct bridge member next to prev
Pali Rohár [Mon, 17 Apr 2023 23:53:55 +0000 (01:53 +0200)]
ls-tree: Rename struct bridge member next to prev

It refers to the previous value in linked-list, not to the next.