From owner-freebsd-questions@FreeBSD.ORG Mon Oct 1 12:06:48 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 468F6106564A for ; Mon, 1 Oct 2012 12:06:48 +0000 (UTC) (envelope-from jamie@kode5.net) Received: from kontrol.kode5.net (kontrol.kode5.net [80.229.5.32]) by mx1.freebsd.org (Postfix) with ESMTP id 923C78FC1A for ; Mon, 1 Oct 2012 12:06:46 +0000 (UTC) Received: from kontrol.kode5.net (localhost [127.0.0.1]) by kontrol.kode5.net (8.14.5/8.14.5) with ESMTP id q91Bm9ql031924 for ; Mon, 1 Oct 2012 12:48:09 +0100 (BST) (envelope-from jamie@kode5.net) Received: (from jamie@localhost) by kontrol.kode5.net (8.14.5/8.14.5/Submit) id q91Bm9pW031923 for freebsd-questions@freebsd.org; Mon, 1 Oct 2012 12:48:09 +0100 (BST) (envelope-from jamie@kode5.net) X-Authentication-Warning: kontrol.kode5.net: jamie set sender to jamie@kode5.net using -f Date: Mon, 1 Oct 2012 12:48:09 +0100 From: Jamie Paul Griffin To: freebsd-questions@freebsd.org Message-ID: <20121001114809.GA44965@kontrol.kode5.net> Mail-Followup-To: freebsd-questions@freebsd.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: x-operating-system: FreeBSD 9.1-PRERELEASE amd64 x-pgp-fingerprint: A4B9 E875 A18C 6E11 F46D B788 BEE6 1251 1D31 DC38 x-pgp-key: 1D31DC38 User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.97.6 at kontrol.kode5.net X-Virus-Status: Clean Subject: Re: find slot number and number of ports for each card X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2012 12:06:48 -0000 [ 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.