From owner-freebsd-questions@FreeBSD.ORG Fri Aug 4 04:07:44 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5FE1916A4E2 for ; Fri, 4 Aug 2006 04:07:44 +0000 (UTC) (envelope-from fbsd-questions@mawer.org) Received: from mail-ihug.icp-qv1-irony4.iinet.net.au (ihug-mail.icp-qv1-irony4.iinet.net.au [203.59.1.198]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2CC8D43D53 for ; Fri, 4 Aug 2006 04:07:42 +0000 (GMT) (envelope-from fbsd-questions@mawer.org) Received: from 203-206-173-235.perm.iinet.net.au (HELO [127.0.0.1]) ([203.206.173.235]) by mail-ihug.icp-qv1-irony4.iinet.net.au with ESMTP; 04 Aug 2006 12:07:39 +0800 X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAA== X-IronPort-AV: i="4.07,209,1151856000"; d="scan'208"; a="841092057:sNHT4656023508" Message-ID: <44D2C802.9040704@mawer.org> Date: Fri, 04 Aug 2006 14:07:30 +1000 From: Antony Mawer User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: User Freebsd References: <20060728164526.E27679@ganymede.hub.org> <17615.30414.314802.792740@jerusalem.litteratus.org> <20060801223754.U27679@ganymede.hub.org> <20060801230301.Q27679@ganymede.hub.org> <44D09F46.6020300@dial.pipex.com> <44D0F2FE.9020507@dial.pipex.com> <20060802203604.A6529@ganymede.hub.org> <44D153D0.9000304@webanoide.org> <87wt9qzh2i.fsf@photon.homelinux.org> <20060803011653.G6529@ganymede.hub.org> <44D1A866.2030206@mawer.org> <20060803154705.X6529@ganymede.hub.org> <44D29220.1000807@mawer.org> <20060804001908.B25268@ganymede.hub.org> In-Reply-To: <20060804001908.B25268@ganymede.hub.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Xiao-Yong Jin , freebsd-questions@freebsd.org Subject: Re: Gotta start somewhere ... how many of us are really out there? 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: Fri, 04 Aug 2006 04:07:44 -0000 On 4/08/2006 1:31 PM, User Freebsd wrote: > 'k, looking at the above, and comparing it to what I'm getting from > pciconf -l, I'm missing something ... namely: > > none8@pci2:10:0: class=0x020000 card=0x0027a0a0 chip=0x813910ec > rev=0x10 hdr=0x00 > > Translates to: > > none8@pci2:10:0: class=0x020000 card=0x0027a0a0 chip=0x813910ec > rev=0x10 hdr=0x00 > vendor = 'Realtek Semiconductor' > device = 'RT8139 (A/B/C/810x/813x/C+) Fast Ethernet Adapter' > class = network > subclass = ethernet > > > But, the last 4 hex of card/chip aren't teh same ... oh, wait, > re-reading what you stated, is it safe to assume that chip= can be > ignored ... nope, that doesn't follow either ... but I think I see it ... Looking through src/usr.sbin/pciconf/pciconf.c, it looks as though pciconf only translates the chip= for what it displays. The DOS-based PCI identification code that I've worked with in the past typically referred "chip" as "device", and "card" as "sub-device"... Internally, pciconf uses the same references (snipped from the printf statement): (p->pc_subdevice << 16) | p->pc_subvendor, (p->pc_device << 16) | p->pc_vendor, The aforementioned DOS utilities used to display lookups for both (where appropriate); I vaguely recall coming to the conclusion that the sub-device bit was not mandatory, but someone with more knowledge of the ins and outs of the PCI specs may be able to state that more definitively... In short, the "chip" field from pciconf looks like the most important one.. the rev/hdr fields are less important for our needs - as far as I'm aware they're generally used to denominate hardware revisions, so as vendors revise their PCB layouts and components, they can be easily differentiate between them -- this is most important when you're a driver, trying to figure out what how you should treat a specific device... The card one may fall into a "nice-to-know" but not necessary.. > For the above, vendor *should* be Aopen Inc, not Realtek Semiconductor ... > > 'k, so, for the above: > > card=0x0027a0a0 > - Aopen Inc (A0A0) > > chip=0x813910ec > - Realtek Semiconductor (10EC) > - 8139 RT8139 (A/B/C/810x/813x/C+) Fast Ethernet Adapter (8139) > > And the 0027 is actually meaningless in this case ... So in your case, it's a Realtek 8139 adapter, most likely as part of an AOpen motherboard or add-in card... > So, what I'm looking for is vendor->device, but in some card= cases, > there won't be a 'Device' listed ... > > As to class= ... what table am I supposed to be seeing at that URL? The class= line is a combination of two fields (the same as chip and card are a combination of vendor and device fields) -- the class, and subclass, of the device. The URL http://fxr.watson.org/fxr/source/dev/pci/pci.c#L1340 shows the C source for this table that's used to match them up... for instance: CLASS SUBCLASS DESCRIPTION {PCIC_NETWORK, -1, "network"}, {PCIC_NETWORK, PCIS_NETWORK_ETHERNET, "ethernet"}, {PCIC_NETWORK, PCIS_NETWORK_TOKENRING, "token ring"}, {PCIC_NETWORK, PCIS_NETWORK_FDDI, "fddi"}, {PCIC_NETWORK, PCIS_NETWORK_ATM, "ATM"}, {PCIC_NETWORK, PCIS_NETWORK_ISDN, "ISDN"}, The first line of the above defines the "network" device class; then it defines several of the sub-classes of class "network"... ethernet, token ring, etc. These are defined here: http://fxr.watson.org/fxr/source/dev/pci/pcireg.h#L218 So this line: {PCIC_NETWORK, PCIS_NETWORK_ETHERNET, "ethernet"}, actually reads: {0x02, 0x00, "ethernet"}, So our class line: class=0x020000 Is made up of 2 hex digits for the device class, and 4 hex digits for the device sub-class... Savvy? ;-) -Antony