Commit Graph

43 Commits

Author SHA1 Message Date
Navdeep Parhar
118cfb829f pciconf(8): Decode ACS extended capability.
MFC after:	1 week
Sponsored by:	Chelsio Communications
Reviewed by:	kib@
Differential Revision:	https://reviews.freebsd.org/D37271
2022-11-07 13:20:22 -08:00
David Bright
2f176a2b20 pciconf: Fix up pciconf -lc output
The pciconf command fails to emit newlines when particular ecap field
values are seen. Fix them up. This has been seen on several systems at
$JOB. The documentation for PCI capabilities says that capability
type 0 should not be used once the spec for PCI capabilities was
published, but that seems more wishful-thinking than reality. pciconf
also chooses not to print fields related to field values that are
zero, but it seems several of these fields are zero on actual
hardware.

Reviewed by:	vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com)
Sponsored by:	Dell EMC Isilon
Submitted by:	Robert Herndon (Robert.Herndon@dell.com)
Differential Revision: https://reviews.freebsd.org/D30441
2021-06-01 10:55:44 -05:00
Konstantin Belousov
96128185f6 pciconf: print PCIe CTL max read request.
To not complicate existing parsers, the value is printed on a new
output line.

Sponsored by:	Mellanox Technologies/NVIDIA Networking
MFC after:	1 week
2020-09-30 21:12:14 +00:00
Scott Long
e1ae0ee172 When printing out the contents of the VSEC, include the contents of the
headers.  Device documentation often times give offsets relative to the
start of the entire VSEC, not just the post-header data area, so this
change makes it easier to correlate offsets.
2020-03-20 23:26:37 +00:00
Konstantin Belousov
f1bbdf8709 Print out some newly added PCIe extended capabilities and subclasses.
Taken from
https://pcisig.com/sites/default/files/files/PCI_Code-ID_r_1_11__v24_Jan_2019.pdf

Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2020-02-20 17:10:25 +00:00
Konstantin Belousov
3b7a70d990 pciconf: List names of all known extended PCIe capabilities.
Some ids are redundand because the list_ecaps() function decodes them
by explicit switch case.  But listing them all makes it easier to not
miss ecaps, while not changing the functionality.

Initial submission by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2020-02-17 13:31:30 +00:00
Scott Long
97faa4c470 Add accessors for the Vendor Specific Extended Capability (VSEC)
Parse out the VSEC.  If the user invokes a second -c command line option,
do a hex dump of the vendor data.

Reviewed by:	imp
MFC after:	3 days
Sponsored by:	Intel
Differential Revision:	http://reviews.freebsd.org/D22808
2019-12-13 23:46:59 +00:00
Scott Long
fe1c359603 Fix the botched field ordering in the last commit. While here, fix
whitespace, and also reorder the fields so they are easier to read on
an 80 column display (the lines wrapped even before these changes).
Also fix non-standard nomenclature in the Caps code, and update the
man page.

Reported by:	rpokala
2019-10-13 05:11:53 +00:00
Alexander Motin
5469a751a2 Report Clock Power Management support and status.
Since we already report ASPM, why not to go further.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2019-08-23 15:17:04 +00:00
Andrew Gallatin
e1d8b631f6 pciconf: report PCI Gen4 speeds
PCIe gen4 runs at 16GT/s.  Report this as
the speed of Gen4 links.

Reviewed by:	imp
MFC after:	7 days
Sponsored by:	Netflix
2019-07-23 16:28:17 +00:00
Warner Losh
e96d5d7bb3 Remove dead code (comma is either 0 or 1 for sure, no need to test).
Close /dev/pci when we're done with it.

CID: 1007450, 1007449, 1008615, 1008614
2018-01-05 07:29:02 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Eric van Gyzen
a1566487db Fix some logic in PCIe HotPlug; display EI status
The interpretation of the Electromechanical Interlock Status was
inverted, so we disengaged the EI if a card was inserted.
Fix it to engage the EI if a card is inserted.

When displaying the slot capabilites/status with pciconf:

- We inverted the sense of the Power Controller Control bit,
  saying the power was off when it was really on (according to
  this bit).  Fix that.

- Display the status of the Electromechanical Interlock:
        EI(engaged)
        EI(disengaged)

Reviewed by:	jhb
MFC after:	3 days
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D7426
2016-08-05 23:23:48 +00:00
John Baldwin
0b03514943 Output information about PCI-e devices with slots.
In particular this includes additional information on HotPlug capable
slots.
2016-04-02 01:59:53 +00:00
John Baldwin
c36c6e72c6 Various updates to the PCI-express capability output.
- Group the output so that it follows the capability register set more
  closely.  The first line now contains device information and the
  second line contains link information.  As a result, ARI status is now
  output on the first line, and the link width is moved down to the second
  line of link information.
- Only read the DEVICE_CAP2 register to check for ARI if the capability
  version is >= 2.
- Don't output any link information if the link capability and status
  registers are zero.
- Label the MSI interrupt index value as "MSI" instead of "IRQ".
2016-04-02 01:55:43 +00:00
Pedro F. Giffuni
733191a56c pciconf: Silence a GCC warning.
Fix the build on sparc64 and powerpc.

Taken from:	wma
2016-02-26 23:12:59 +00:00
Wojciech Macek
98179b624c Change format string in pciconf EA to jx
Fix compilation error introduced by r296081
2016-02-26 10:24:24 +00:00
Wojciech Macek
a2862b1169 Add support for Enhanced Allocation in pciconf
* Modified pciconf to print EA capability structure
 * Added register description to pcireg.h

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           jhb
Differential revision: https://reviews.freebsd.org/D5440
2016-02-26 08:35:04 +00:00
Stefan Eßer
873e155c03 Use __unused instead of casting to void to silence the unused parameter
warning.

Fix the indentation of 2 lines to conform with the style of this file.

Submitted by:	jhb
2016-02-18 20:20:36 +00:00
Stefan Eßer
a4ed9e4f78 Make WARNS=6 safe.
Tested with Clang 3.7.1, GCC 4.2.1 and GCC 4.8.5 on amd64.
2016-02-18 15:23:25 +00:00
John Baldwin
34f2f73c84 Note if relaxed ordering or no snoop is enabled for each PCI-express device.
MFC after:	1 week
2015-11-05 20:24:56 +00:00
Ryan Stone
7fdbba5e46 Teach pciconf how to dump out SR-IOV capability
Differential Revision:	https://reviews.freebsd.org/D1639
Reviewed by:		jhb
MFC after:		1 month
Sponsored by:		Sandvine Inc.
2015-03-01 00:59:35 +00:00
Ryan Stone
4cf825f637 Print status of ARI capability in pciconf -c
Teach pciconf how to print out the status (enabled/disabled) of the ARI
capability on PCI Root Complexes and Downstream Ports.

MFC after:	2 months
Sponsored by:	Sandvine Inc.
2014-04-01 16:03:52 +00:00
Jung-uk Kim
43a716a640 Decode PCIe ASPM capability and status. 2013-07-18 20:59:58 +00:00
Konstantin Belousov
5d6787cfb2 Decode new HT 3.00 and 3.10 capabilities.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2013-05-17 14:05:31 +00:00
Neel Natu
609933c61b Display MSI-X table and PBA offsets when displaying information about MSI-X
capability.

Reviewed by:	jhb, jimharris (initial version)
2013-02-01 19:24:16 +00:00
Jim Harris
ff473561da For PCI Express capability, if max link width is greater than zero, print
the current and max link speed.

Sponsored by:	Intel
Discussed with:	jhb
MFC after:	1 week
2012-10-25 17:22:37 +00:00
Warner Losh
db85bb0492 Indent ecaps the same way we indent caps.
MFC after:	3 days
2012-10-19 22:48:22 +00:00
Gavin Atkinson
389c8bd51e Align the PCI Express #defines with the style used for the PCI-X
#defines.  This also has the advantage that it makes the names more
compact, iand also allows us to correct the non-uniform naming of
the PCIM_LINK_* defines, making them all consistent amongst themselves.

This is a mostly mechanical rename:
  s/PCIR_EXPRESS_/PCIER_/g
  s/PCIM_EXP_/PCIEM_/g
  s/PCIM_LINK_/PCIEM_LINK_/g

When this is MFC'd, #defines will be added for the old names to assist
out-of-tree drivers.

Discussed with:	jhb
MFC after:	1 week
2012-09-18 22:04:59 +00:00
John Baldwin
60149b5cce - Denote PCI-e endpoints that support FLR.
- Make parsing of PCI-e extended capabilities assume that future version
  numbers are backwards compatible.
- Add new AER error descriptions.
- Add descriptions for more PCI-e extended capabilities.

MFC after:	1 week
2012-09-13 19:08:31 +00:00
Gavin Atkinson
c4edfee458 - If the PCIe "SLOT" flag is set, include this in the capability output
- Fix printing of PCIe interrupt number, the shift was incorrect.

MFC after:	1 week
2012-09-05 18:27:45 +00:00
John Baldwin
b6de005505 Add a new -e flag to pciconf(8)'s list mode to display PCI error details.
Currently this dumps the status of any error bits in the PCI status register
and PCI-express device status register.  It also lists any errors indicated
by version 1 of PCI-express Advanced Error Reporting (AER).

MFC after:	1 week
2012-06-01 18:33:40 +00:00
John Baldwin
770e4c5bc0 Only attempt to list extended capabilities for devices that have a
PCI-express capabilities.  Non-PCI-express PCI devices may simply ignore
the upper bits in a config register address effectively aliasing the
device ID register to 0x100 rather than returning 0xFFFFFFFF.  Previously
the code relied on these reads returning 0xFFFFFFFF.

MFC after:	3 days
2010-09-16 16:03:12 +00:00
John Baldwin
64393db3d1 - Use 'sta' to hold the PCIR_STATUS register value instead of 'cmd' when
walking the capability list.
- Use constants for PCI header types instead of magic numbers.

MFC after:	1 week
2010-09-09 18:29:48 +00:00
John Baldwin
79c2de35b5 - Add register definitions related to extended capability IDs in
PCI-express.  I used PCIZ_* for ID constants (plain capability IDs use
  PCIY_*).
- Add register definitions for the Advanced Error Reporting, Virtual
  Channels, and Device Serial Number extended capabilities.
- Teach pciconf -c to list extended as well as plain capabilities.   Adds
  more detailed parsing for AER, VC, and device serial numbers.

MFC after:	2 weeks
2010-09-08 17:53:34 +00:00
John Baldwin
a28b3fc741 - Add a few more register defintions for the PCI express capability
registers.
- Cleanup PCI-X capability printf to not leave a dangling "supports" for
  some PCI-X bridges.
- Display additional PCI express details including the negotiated and max
  link width and the actual and maximum supported max payload.

MFC after:	1 month
2009-04-17 19:07:44 +00:00
Alexander Motin
f8dacb0467 Tune output to remove trailing space.
Submitted by:	Christoph Mallon
2009-02-15 10:41:42 +00:00
Alexander Motin
8e6f99f648 Add SATA and PCI Advanced Features capabilities reporting. 2009-02-15 09:56:47 +00:00
John Birrell
305274cee8 Include agpreg.h from it's new location. 2007-11-13 01:30:40 +00:00
John Baldwin
cbf964029b Update copyright attribution.
MFC after:	3 days
2007-10-31 16:14:30 +00:00
John Baldwin
4d6c5bef39 Missed in the previous commit to this file:
Actually support the new HT capability type from HT 2.00b.

MFC after:	3 days
2007-10-27 13:16:25 +00:00
John Baldwin
d68b1825b7 - HT 2.00b added a new flag to the MSI mapping HT capability to indicate
that the MSI mapping window is fixed at 0xfee00000 and the capability
  does not include two more dwords used to program the address.  Supporting
  this mostly results in quieting spurious warnings during boot about
  non-default MSI mapping windows.
- HT 2.00b also added a new HT capability type, so support that in pciconf.

MFC after:	3 days
Tested by:	jmg
2007-04-25 14:45:46 +00:00
John Baldwin
8866f04eb1 - Teach pciconf(8) to list the PCI capabilities supported by each device
via a new -c flag to be used with -l.  Some simple parsing code is
  present for the following capabilities: Power Management, AGP, VPD,
  MSI, PCI-X, HyperTransport, Vendor-specific, EHCI Debug Port, PCI-PCI
  bridge subvendor ID, PCI-express, and MSI-X.
- Fix a few warnings in pciconf.c.
- Update some cruft in pciconf(8):
  - PCI 2.1 is no longer a revolutionary standard, and subvendor ID's are
    fairly common at this point, so reflect that.
  - Header type 2 is used for PCI-CardBus bridges.
  - Describe the -v option for -l after completing the basic -l description
    instead of disrupting the flow in the middle.

Reviewed by:	imp (partially)
MFC after:	1 week
2007-02-02 19:54:17 +00:00