Page 1 of 1
PCI devices and enumeration
Posted: Tue Apr 28, 2009 1:44 pm
by johnsa
Hey,
For anyone that is interested while building up my pci vendor device id db, i've used the linux code base as well as pcidatabase.com.. (which isn't very complete).. I found another site.. listing.driveragent.com/[vendorid]/ which provides a more extensive detailed list of device ids... quite helpful.
Re: PCI devices and enumeration
Posted: Tue Apr 28, 2009 1:54 pm
by johnsa
Re: PCI devices and enumeration
Posted: Tue Apr 28, 2009 2:24 pm
by johnsa
I have some questions regarding the pci config mechanism, for some reason the multi-function bit never seems to work.. if i manually probe all 8 functions per device everything is 100%, i can tell exactly which functions are implemented and their device id/vendor ids.. but it seems silly to have to do that when i should be able to check the MF flag first? anyone had issues with that?
Also, how would one tell if the device is pcie or x as opposed to pci std, as all types respond to the normal i/o config mechanism and as well through the mcfg enhanced mechanism, you'd need to know what type it is?
Re: PCI devices and enumeration
Posted: Tue Apr 28, 2009 5:05 pm
by geppyfx
PCIe & PCI-X are found thru "Capabilities pointer" at offset 34h.
I enumerate all 8 functions too and you don't need additional code to check Multi function devs. But you better ask BIOS whats the largest bus number.
<pointers for illegal downloads removed -Combuster> - you get the idea.
Re: PCI devices and enumeration
Posted: Wed Apr 29, 2009 1:29 am
by johnsa
Thanks,
I'm just enumerating all 255 busses as the whole process is still sub-second, I'm not sure if there's anything wrong with doing that?
Eventually I'll need to add support to check for multi-segment pci too.. but I've not found a machine that uses more than 256 busses
Re: PCI devices and enumeration
Posted: Wed Apr 29, 2009 2:16 am
by johnsa
Once enumerated are there any other steps that need to happen before being able to read the BAR(n) registers to get the mem and io space addresses? (for now I don't need to re-map these) - Im guessing that the BAR registers should already have been configured by post/bios ? - When i try read them all i get is 0000 0000
Re: PCI devices and enumeration
Posted: Wed Apr 29, 2009 2:25 am
by einsteinjunior
Are you sure you are doing it the right way?
All should be fine from there i think so....
Re: PCI devices and enumeration
Posted: Wed Apr 29, 2009 3:08 am
by johnsa
I think so, I can read any of the values up to 0ch..
so |class code| subclass | revision id| returns correctly.. and the |bist|header|latency timer|cache size| then from 10h up everything I read is 0...
Re: PCI devices and enumeration
Posted: Wed Apr 29, 2009 4:49 am
by johnsa
I think it seems to be working, the devices I was looking at don't seem to use any resources, so no mem ranges or io ranges.. (they were mostly hubs / ctrls etc).
When I ran it on the real h/w all the devices like network, video, sound all come back with proper values for mem-ranges and io.