find slot number and number of ports for each card

Devin Teske devin.teske at
Sat Sep 29 19:35:41 UTC 2012

On Sep 29, 2012, at 7:37 AM, saeedeh motlagh wrote:

> hello all
> i want to have statistics about my hardware specially the type of card
> that are installed on my system,

Card characteristics are provided by "pciconf -l".
("pciconf -lv" for verbose listing).

Two important notes about "pciconf -l"…

1. It lists more than just "cards"
2. The "type" can't always be determined by FreeBSD

When looking at the output of "pciconf -l", each line represents a
component (this can be an integrated component on the mother-
board, such as USB port, not necessarily a PCI add-in card).

If the line begins with "none@" then a driver has not attached to
this device (and FreeBSD therefore doesn't know what "type" it is).
In this case, you'll want to look at the "chip=" portion of the line.
The "chip=" portion of the line gives you two very important pieces
of information when it comes to identifying your hardware:

a. The 4-digit hexadecimal identifier for the Model of the device
b. The 4-digit hexadecimal identifier for the Vendor of the device

(in that order from left-to-right)

Let's look at a sample line:

vgapci0 at pci0:2:9:0:	class=0x030000 card=0x00081002 chip=0x47521002 rev=0x27 hdr=0x00

NOTE: That's my graphics card on an ASUSTek P4B533 motherboard

In the above line, see "chip=0x47521002".
In this case, "4752" is the Model identifier
and "1002" is the Vendor identifier.

If you're a human and you want to know what these numbers are,
you hop on over to and punch in the numbers to
find out that this is a [particularly ancient] ATI Rage XL graphics card.

If you're not a human (i.e., a script), you'll instead reference a local
copy of the "pci.ids" (/usr/local/share/pciids/pci.ids for example):

$ grep '1002 4752' /usr/local/share/pciids/pci.ids
		1002 4752  Proliant Rage XL

> the number of ports that each card has

That one is near impossible.

Since every add-in card is going function differently, you really need
a device-specific enumeration method to (for example) count things
like PHYs provided by a single NIC.

Imagine if you will, the case of the card for which there is no driver
loaded in the kernel (where "pciconf -l" shows a "none@" prefix).
There really is no way to enumerate the number of "ports" a card
offers in that circumstance.


You can build logic into your code (if you are scripting something)
that takes the description from the pci.ids file (or just the raw hex IDs)
and extrapolates based on prior-knowledge how many ports a
particular device has.

> and the slot number which cards are installed.

That's provided by pciconf.

Also, it's worth mentioning the excellent "dmidecode" tool from the
ports tree. This too can enumerate the slots themselves (and tell you
whether they are PCI, PCI-X, PCIe, etc. including voltage. Search
for "System Slot Information" in the dmidecode output for this info.

>  i can find the
> slot number by tracing the output of dmesg but it's time consuming
> job. more over, i don't know how to find the number of ports that each
> card has.
> please let me know if there is any command to give these information
> to me directly.
> thanks
> _______________________________________________
> freebsd-questions at mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.

More information about the freebsd-questions mailing list