Date: Mon, 1 Oct 2012 12:48:09 +0100 From: Jamie Paul Griffin <jamie@kode5.net> To: freebsd-questions@freebsd.org Subject: Re: find slot number and number of ports for each card Message-ID: <20121001114809.GA44965@kontrol.kode5.net> In-Reply-To: <D4CF89CB-4E1B-48EB-B420-D5328FC7D807@fisglobal.com> References: <CAN%2BS=WAZ1VP06_HytYx9xVQ0eu949QRoB1Y7Yp0zgYDYP2nYJg@mail.gmail.com> <D4CF89CB-4E1B-48EB-B420-D5328FC7D807@fisglobal.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[ Devin Teske wrote on Sat 29.Sep'12 at 12:32:04 -0700 ] > > 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@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 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. > -- > Devin This is interesting. I'm glad this question was raised, because i've noticed i've got two "none@" lines listed when using pciconf -lv. I've been trying to figure out what these are over the last week but to no avail. They must be there for some purpose and I wondered if i'm missing some important driver because of this.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121001114809.GA44965>