I have put together a diagnostic system for my employer using a
stripped-down Gentoo system (2.6.15 kernel). We're testing some PCIe
cards on an ABIT IL8, which has four PCIe slots. Since this is a test
rig, when a card fails a test, we need to know which of the four slots
the card is in. When developing this, I had assumed that the PCI bus
ID would be a function of the slot number, but apparently, it is not.
We can put one card into any of the four slots, and we get the same
bus ID. If we put in four cards, we get a set of ID numbers that
isn't sequential.
I've poked around in /proc, without finding anything. I found
/sys/bus/pci_express, but it's really weird what I see, because it
shows what appears to be some slots repeated and some missing, and
also, there doesn't seem to be a way to associate the slot with the
bus ID (I assume pcie00 is slot zero). Under /sys/bus/pci/devices, I
do see the PCI bus ID of the cards in question, but I cannot figure
out how to associate that with the slot number. The directory
/sys/bus/pci/slots is empty.
Is there some reasonable way for me to be able to determine, given a
bus ID, which physical slot the PCIe card is in?
Note: I am not using a kernel driver for these cards. I'm using
/dev/mem to map mmio, and I'm using libpci to access PCI config space.
Everything works great (besides the slot number issue here).
Thank you very much in advance for your help.
--- Timothy Miller
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
PCI_SLOT(struct pci_dev *) is a macro defined in one of the headers.
Unfortunately, it will not uniquely define a board. Also, the slot number
itself has nothing to do with the physical machine because, upon
startup, the BIOS assigns "slots" in the order devices are found.
But, for a particular configuration, it is possible to uniquely
define a board as long as they don't get moved around! In one
of our devices, I do something like this and it has been good enough
for the service people to find a malfunctioning board.
slot = dev->bus->number << 8) | PCI_SLOT(dev->devfn);
Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.4 on an i686 machine (5592.89 BogoMips).
Warning : 98.36% of all statistics are fiction, book release in April.
_
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to Deliver...@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.