lspci: Correct Root Capabilities "CRS Software Visibility" bit
lspci incorrectly tests bit 4, not bit 0, for "CRS Software Visibility" in
the Root Capabilities register, so it shows "RootCap: CRSVisible-" even for
devices that do support Software Visibility.
Use the correct definition for PCI_EXP_RTCAP_CRSVIS.
Thomas Renninger [Tue, 28 Jan 2014 07:51:02 +0000 (08:51 +0100)]
lspci: Show device name as exported by BIOS (sysfs label attribute) (V2)
The Device name of a PCI or PCI Express device under OS may be exported via
ACPI _DSM function with function index 7.
This allows to connect a described PCI device in the platform documentation
or as labeled on the chassis with PCI devices shown via lspci.
The kernel already exports this string through sysfs under a PCI device through
the "label" sysfs attribute.
This patch reads the device name if available and shows it to the user.
Real world examples:
Device Name: "USB HS EHCI Controller #2 #3"
Device Name: "USB HS EHCI Controller #1"
Device Name: "SATA Controller #1"
Device Name: "Onboard LAN #1"
Device Name: "Onboard LAN #2"
Device Name: "Onboard Video (PILOT-3)"
Compare with PCI Firmware Spec v3.1 chapter 4.6.7 and
ACPI spec v5.0 chapter 9.14.1
The DeviceName is not shown by default, but starting from first verbose
parameter (-v).
V2: - Free label string if allocated
- Enhance changelog
Signed-off-by: Thomas Renninger <trenn@suse.de> CC: linux-pci@vger.kernel.org
lspci: Decode PCIe LnkCtl "Read Completion Boundary" for PCIe-to-PCI bridges
The PCIe spec (r3.0, Table 7-16) says the Read Completion Boundary is valid
for Root Ports, Endpoints, and Bridges. I only added decoding for PCIe-to-
PCI/PCI-X bridges because the RCB of a Bridge indicates the RCB of the
upstream Root Port, so I don't think it makes sense for PCI-to-PCIe
bridges.
lspci: Clarify "PCIe-to-PCI/PCI-X" desc and Bridge Retry Config Enable
The PCI_EXP_TYPE_PCI_BRIDGE type is a PCIe to PCI/PCI-X bridge, so be a bit
more complete in the comment and printed device type. Also, per PCIe spec
r3.0, Table 7-14, the PCIe Device Control "Bridge Configuration Retry
Enable" bit only applies to PCIe-to-PCI/PCI-X bridges; it does not apply to
PCI-to-PCIe bridges.
lspci: Decode PCIe DevCap "Acceptable Latencies" only for Endpoints
The PCIe Device Capabilities "Endpoint L0s Acceptable Latency" and
"Endpoint L1 Acceptable Latency" are defined only for Endpoint functions,
so don't display them unless this is an endpoint.
lspci: Label PCIe LnkCap "L0s Exit Latency" as "L0s", not "L0"
The PCIe Link Capabilities "L0s Exit Latency" is the latency to exit
L0s, not L0, so label it "L0s" instead of "L0". This matches the
way we label the Device Capabilities "Endpoint L0s Acceptable Latency"
field as "Latency L0s". This also adds "Exit" to the description to
help distinguish it from the "Acceptable Latency" fields in the
Device Capabilities register.
Bjorn Helgaas [Wed, 28 Aug 2013 19:08:34 +0000 (13:08 -0600)]
lspci: Decode PCIe Link registers only for devices with links
Root Complex Integrated Endpoints and Root Complex Event Collectors do not
have links and are not permitted to implement Link or Link 2 registers,
per PCIe spec r3.0, sec 1.3.2.3. Decoding them is useless and misleading.
Bjorn Helgaas [Fri, 17 May 2013 19:48:19 +0000 (13:48 -0600)]
lspci: Fully decode ASPM support from Link Capabilities
The ASPM Support field in Link Capabilities is two bits, and all four
possible encodings are defined as of PCIe spec r3.0. Previously, lspci
only decoded values 1, 2, and 3. This adds 0, so lspci will show "ASPM
not supported" instead of "ASPM unknown".
Martin Mares [Fri, 19 Apr 2013 11:33:52 +0000 (13:33 +0200)]
lspci: Better filtering of duplicate kernel module names
It was implemented only for reading modules.pcimap, but it turned out
that it is necessary for libkmod, too, so we have switched to a common
implementation.
Kevin Pyle [Tue, 31 Jan 2012 15:50:43 +0000 (10:50 -0500)]
install: split out pcilib install to a dedicated target
The "install" target manages one set of files, and the "install-pcilib"
target manages a different set. They both install the pci library though
so if you try to run `make -j install install-pcilib`, things randomly
fail. So split out the commonly installed files into a dedicated target.
Marek Cruz [Tue, 31 Jan 2012 15:50:47 +0000 (10:50 -0500)]
lib/configure: match all freebsd os's
When using targets like "i686-pc-freebsd7.1", the configure script fails
to match for the freebsd target because it only expects "freebsd". Add
a glob to match all freebsd targets.
Ben Hutchings [Thu, 17 May 2012 14:14:16 +0000 (15:14 +0100)]
Only decode defined fields of PCI Express Link Control 2
On a PCI Express multi-function device associated with an upstream
port, all bits of the Link Control 2 register are currently reserved
on functions > 0.
The Selectable De-emphasis field is reserved on all but downstream
ports.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Aaron Sierra [Fri, 25 May 2012 19:11:39 +0000 (14:11 -0500)]
lspci: zero address in IO isn't always unassigned
Zero is a valid address in I/O space, so display it and it's associated
size when IO is enabled in the PCI command register.
From arch/powerpc/kernel/pci-common.c:
/* Here, we are a bit different than memory as typically IO space
* starting at low addresses -is- valid. What we do instead [is] that
* we consider as unassigned anything that doesn't have IO enabled
* in the PCI command register, and that's it.
*/
Bjorn Helgaas [Wed, 11 Jan 2012 21:16:19 +0000 (14:16 -0700)]
Correct the end of CardBus memory windows
The low twelve bits of memory base/limit are assumed to be all zeros
and all ones, respectively. Therefore, a window with base == limit
is a valid 4K window, which we should display by default, and the
true end of the window is ...fff, not ...000. For example,
Martin Mares [Sun, 2 Oct 2011 10:41:07 +0000 (12:41 +0200)]
Truncate names which are too long
When any name turned out too long, we returned "<pci_lookup_name: buffer too small>",
which wasn't very useful. Instead of that, we truncate the name and
we add "..." at the end.
Please note that for simplicity, the truncation happens only on systems with proper
C99 snprintf(). Ancient systems where snprintf() returns a negative number and
promises nothing about the state of the buffer still use the error message.
François Revol [Tue, 30 Nov 2010 21:44:50 +0000 (21:44 +0000)]
BeOS and Haiku ports
The BeOS port uses private syscalls exported by libroot.so to implement the intel access methods.
The Haiku port uses ioctls to the /dev/misc/poke device driver (use originally for debugging with
/bin/poke) to implement the intel access methods. BeOS has non-standard arch names, so we map them
to i386 and powerpc in the configure. Updated README and pcilib.man accordingly.
Martin Mares [Thu, 28 Jan 2010 10:14:40 +0000 (11:14 +0100)]
Improved formatting of PCIe port/slot capabilities
The power limit is now limited to 3 decimal places and it always
includes units (watts), Port# and Slot# are both printed in decimal.
(Previously, the behavior was inconsistent between ports and slots.)
Martin Mares [Sat, 16 Jan 2010 11:10:09 +0000 (12:10 +0100)]
Avoid unaligned accesses to extended capabilities.
The PCIe spec tells that all capabilities must be DWORD aligned and the bottom
2 bits of all capability pointers are reserved for future use and must be
ignored when read.
Matthew Wilcox [Fri, 20 Nov 2009 21:30:50 +0000 (14:30 -0700)]
Improve large BAR display
lspci currently displays anything larger than 2GB as a raw number.
I have a device with a larger BAR and wanted to see that reported as
a multiple of a GB.
I took the opportunity to rewrite this routine to make it easier to add
higher powers in the future. It's also slightly shorter, which is nice.
I also changed it to use the binary prefixes, much as I dislike them
personally.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>