PCI devices and enumeration

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

PCI devices and enumeration

Post 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.
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

Re: PCI devices and enumeration

Post by johnsa »

johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

Re: PCI devices and enumeration

Post 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?
geppyfx
Member
Member
Posts: 87
Joined: Tue Apr 28, 2009 4:58 pm

Re: PCI devices and enumeration

Post 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.
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

Re: PCI devices and enumeration

Post 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 :)
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

Re: PCI devices and enumeration

Post 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 :)
User avatar
einsteinjunior
Member
Member
Posts: 90
Joined: Tue Sep 11, 2007 6:42 am

Re: PCI devices and enumeration

Post by einsteinjunior »

Are you sure you are doing it the right way?
All should be fine from there i think so....
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

Re: PCI devices and enumeration

Post 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...
johnsa
Member
Member
Posts: 296
Joined: Mon Oct 15, 2007 3:04 pm

Re: PCI devices and enumeration

Post 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.
Post Reply