Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Aug 2006 14:07:30 +1000
From:      Antony Mawer <fbsd-questions@mawer.org>
To:        User Freebsd <freebsd@hub.org>
Cc:        Xiao-Yong Jin <xj2106@columbia.edu>, freebsd-questions@freebsd.org
Subject:   Re: Gotta start somewhere ... how many of us are really out there?
Message-ID:  <44D2C802.9040704@mawer.org>
In-Reply-To: <20060804001908.B25268@ganymede.hub.org>
References:  <20060728164526.E27679@ganymede.hub.org>	<17615.30414.314802.792740@jerusalem.litteratus.org>	<ef10de9a0608011037w3609b5a6k1709aea61d43ed0f@mail.gmail.com>	<20060801223754.U27679@ganymede.hub.org>	<ef10de9a0608011859q45bdd636o757fb4aba2d3404d@mail.gmail.com>	<20060801230301.Q27679@ganymede.hub.org>	<df9ac37c0608012122q196a6434jf849cc7bd8c1156@mail.gmail.com>	<44D09F46.6020300@dial.pipex.com>	<ef10de9a0608021047u553a812fpbcf09c8c26df09b6@mail.gmail.com>	<44D0F2FE.9020507@dial.pipex.com>	<ef10de9a0608021216u455099a9yf66ea2d1698f4d19@mail.gmail.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>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44D2C802.9040704>