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.
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>
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.
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.
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.
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.
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>
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.
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.
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]":
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.
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.
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.
Fix device_class calculatoin for non-root FreeBSD users
libpci uses PCIOCGETCONF for non-privileged access to /dev/pci
and calculates device_class value based on pc_class/pc_subclass
fields expecting the former to be higher 8 bits of the target value. 0f3d0ca73ecedaba180bf4607bb57fb8abe6d405 errorneously swapped
order of class/subclass during calculations.
Daniel Schaefer [Sun, 14 Oct 2018 20:48:57 +0000 (22:48 +0200)]
Enable setpci to target n-th capability of id
Because a capability can exist multiple times with the same id,
there needs to be a way to target a specific one. Instead of
the current behaviour which always targets the first one.
Now you can optionally add `@number` (e.g `@1`) after the width to
choose which one to target.
Masanobu SAITOH [Thu, 4 Oct 2018 08:33:21 +0000 (17:33 +0900)]
Print Root complex related registers on RCEC, too
PCIe spec says root ports and root complex event collectors must implement
root CAP, STAT and CTRL registers, so call cap_express_root() not only for
PCI_EXP_TYPE_ROOT_PORT but also for PCI_EXP_TYPE_ROOT_EC.
Martin Mares [Sun, 12 Aug 2018 09:13:05 +0000 (11:13 +0200)]
Tree: Detect bridges properly
Previously, only PCI_CLASS_BRIDGE_PCI was considered, which excluded
CardBus bridges. We now accept anything of the base class "bridge"
with the proper header type.