On Mon, Aug 01, 2005 at 09:15:45AM -0400, Will H. Backman wrote:
> Perhaps we could get some insight as to how this ordering happens from
> those who know.  I've never had a problem with it changing on me, but it
> might be nice to know how the kernel decides, and what mistakes we might
> make that could cause it to happen.
> 
> Just an attempt to turn a question into education.
> 

IN THIS CASE...  It goes by PCI bus number and then slot within that
bus.

Many computers have multiple PCI buses.  For example, I have a Dell GX1
here, here's a snipping of the dmesg (and since I'm answering, not
asking, I get to snip.  you don't. :)

fxp0 at pci0 dev 13 function 0 "Intel 82557" rev 0x08, i82559: irq 10, address 
00:02:b3:5e:a2:0d
inphy0 at fxp0 phy 1: i82555 10/100 PHY, rev. 4
fxp1 at pci0 dev 14 function 0 "Intel 82557" rev 0x08, i82559: irq 9, address 
00:02:b3:65:5a:78
inphy1 at fxp1 phy 1: i82555 10/100 PHY, rev. 4
ppb1 at pci0 dev 15 function 0 "DEC 21152 PCI-PCI" rev 0x03
pci2 at ppb1 bus 2
fxp2 at pci2 dev 9 function 0 "Intel 82557" rev 0x08, i82559: irq 11, address 
00:02:b3:5d:86:23
inphy2 at fxp2 phy 1: i82555 10/100 PHY, rev. 4
fxp3 at pci2 dev 10 function 0 "Intel 82557" rev 0x08, i82559: irq 11, address 
00:02:b3:5d:40:94
inphy3 at fxp3 phy 1: i82555 10/100 PHY, rev. 4
fxp4 at pci2 dev 11 function 0 "Intel 82557" rev 0x08, i82559: irq 11, address 
00:90:27:e5:3b:be
inphy4 at fxp4 phy 1: i82555 10/100 PHY, rev. 4

You see, the devices on the pci0 bus get numbered first (by slot), then
the ones on pci2.  In case you were wondering, pci1 in this machine was
used only by the video chip.

Next comes logical slots.  In this machine, the physical to logical slot
mapping is a little strange.  In this machine, the slots are numbered
like this:

top
  4    (pci2)
  3    (pci2)
  2    (pci2)
  0    (pci0)
  1    (pci0)
bottom

Note the bizzare reversal of the 0 and 1.  Obviously, Dell never figured
on someone putting five NICs in this machine and caring which is which.

It can get REALLY fun if your cards also have PCI bridges on them...then
you get priges on top of bridges...  I plugged five quad dc(4) cards
into one of these things at one point, from memory, the numbering was
something like this:

19 18 17 16
17 16 15 14
11 10  9  8
 3  2  1  0
 7  6  5  4

It took me a while to find dc0, I can assure you (I did this config
before I did the five fxp setup, so I didn't know about the odd slot
ordering at the time).

This system is pretty normal for PCI NICs.  ISA NICs follow different
rules, dependent upon the individual driver.  we(4), ne(4) and others
do it by hardware resource settings, ep(4) does it (sorta) by MAC 
address (but not entirely by MAC).

Nick.

Reply via email to