Page MenuHomeFreeBSD

pciconf: extend tree mode to also print numerical IDs
Needs ReviewPublic

Authored by bz on Apr 3 2026, 10:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 6, 3:36 AM
Unknown Object (File)
Sat, Jun 6, 12:54 AM
Unknown Object (File)
Thu, Jun 4, 6:46 AM
Unknown Object (File)
Wed, Jun 3, 8:49 PM
Unknown Object (File)
Sun, May 31, 2:34 PM
Unknown Object (File)
Sat, May 30, 8:44 PM
Unknown Object (File)
Sat, May 30, 8:27 PM
Unknown Object (File)
Thu, May 28, 2:20 PM
Subscribers

Details

Reviewers
jhb
Group Reviewers
manpages
Summary

Also print the vendor/device and subvendor/subdevice IDs in addition
to any strings from the database found if the -v flag is given more
than once.
This helps with device identification if the strings resolve to
identical values for entire product families as well as when the
exact card cannot be determined from the string.
In theory a second call to pciconf could present that information in
non-tree mode but that kind-of defeats the purpose.

Test Plan

I don't know if this is close to whatever it is modelled after
but it really helps here as none of these cards are plain vendor IDs.

|     |--- pcib9 PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch [0x10b5:0x8606 0x19b6:0xd01d]
|     |  `--- pci0:9:0:0 Realtek Semiconductor Co., Ltd. RTL8851BE PCIe 802.11ax Wireless Network Controller [0x10ec:0xb851 0x103c:0x88e7]
|     |--- pcib10 PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch [0x10b5:0x8606 0x19b6:0xd01d]
|     |  `--- pci0:10:0:0 Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter [0x10ec:0xc821 0x103c:0x831a]
|     `--- pcib11 PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch [0x10b5:0x8606 0x19b6:0xd01d]
|        `--- pci0:11:0:0 Realtek Semiconductor Co., Ltd. RTL8822CE 802.11ac PCIe Wireless Network Adapter [0x10ec:0xc822 0x1a3b:0x3750]

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 73090
Build 69973: arc lint + arc unit

Event Timeline

bz requested review of this revision.Apr 3 2026, 10:04 PM

I don't think Linux does this in lspci FWIW, but given it relies on an additional -v that is ok. One oddity perhaps is that we don't print subvendor/subdevice IDs in the fallback below this (and lspci doesn't print those out either IIRC). I'm also not sure you want to present an ID of 0 as '000000' vs 0x0000. The latter is why I used 0x%04x instead.

See:

> printf '%#06x\n' 0
000000

Use 0x%04x instead of %#06x to avoid 000000 when 0x0000 would be better as suggested by @jhb.

Hey bz!

usr.sbin/pciconf/pciconf.8
312–315

We did this in pkg.8, then the reader can search for the flag they want to use (-vv).
Does the rest of the suggestion make sense? What is the found strings?

usr.sbin/pciconf/pciconf.8
312–315

I am not a native speaker but your suggested edit doesn't read fluently. Specify -v twice for ... maybe but...

And (apart from ports.7) we have never documented -vvvv or -ddddd as such in man pages. One can always do -v -d -v -d -v -d or in this case one could use -v -t -v or just -t -v -v; it does not have to be -vv and thus documenting it as such makes little sense unless the continuation is enforced.

Maybe the better wording is a continuation of the paragraph without Fl: "If the option is specified twice, the vendor, device, subvendor, and subdevice IDs are displayed in addition to the found strings." ?