Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Sep 2012 12:32:04 -0700
From:      Devin Teske <devin.teske@fisglobal.com>
To:        saeedeh motlagh <saeedeh.motlagh@gmail.com>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: find slot number and number of ports for each card
Message-ID:  <D4CF89CB-4E1B-48EB-B420-D5328FC7D807@fisglobal.com>
In-Reply-To: <CAN%2BS=WAZ1VP06_HytYx9xVQ0eu949QRoB1Y7Yp0zgYDYP2nYJg@mail.gmail.com>
References:  <CAN%2BS=WAZ1VP06_HytYx9xVQ0eu949QRoB1Y7Yp0zgYDYP2nYJg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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

> hello all
>=20
> 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"=85

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=3D" portion of the line.
The "chip=3D" 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@pci0:2:9:0:	class=3D0x030000 card=3D0x00081002 chip=3D0x47521002 re=
v=3D0x27 hdr=3D0x00

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

In the above line, see "chip=3D0x47521002".
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 pcidatabase.com 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.

However!

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.
--=20
Devin


>  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.
>=20
> please let me know if there is any command to give these information
> to me directly.
>=20
> thanks
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o=
rg"

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D4CF89CB-4E1B-48EB-B420-D5328FC7D807>