Page 1 of 1
PCI enumeration results
Posted: Fri May 10, 2013 1:15 pm
by CR
hello! I have another question for you all
some time ago I wrote code for PCI enumeration but now I have the doubt it doesn't find all the devices.
On bochs it finds these 4 devices:
device 0: class 0x6 ; sub class 0x0 ; bus=0 ; device=0 function=0
device 1: class 0x6 ; sub class 0x1 ; bus=0 ; device=1 function=0
device 2: class 0x1 ; sub class 0x1 ; bus=0 ; device=1 function=1
device 3: class 0x6 ; sub class 0x80 ; bus=0 ; device=1 function=3
I tried also on vmware and it finds 42 devices (but 33 of those are PCI to PCI bridges)
In both the emulators I don't get any processor.
I get the same result using the brute force method and the recusrive method.
So here's the question: is this the correct result or I should have found something else?
Re: PCI enumeration results
Posted: Fri May 10, 2013 2:38 pm
by PearOs
CR wrote:hello! I have another question for you all
some time ago I wrote code for PCI enumeration but now I have the doubt it doesn't find all the devices.
On bochs it finds these 4 devices:
device 0: class 0x6 ; sub class 0x0 ; bus=0 ; device=0 function=0
device 1: class 0x6 ; sub class 0x1 ; bus=0 ; device=1 function=0
device 2: class 0x1 ; sub class 0x1 ; bus=0 ; device=1 function=1
device 3: class 0x6 ; sub class 0x80 ; bus=0 ; device=1 function=3
I tried also on vmware and it finds 42 devices (but 33 of those are PCI to PCI bridges)
In both the emulators I don't get any processor.
I get the same result using the brute force method and the recusrive method.
So here's the question: is this the correct result or I should have found something else?
Well I know when I run my PCI Bus scanning code in Bochs, I get only two devices. I was only scanning bus 0 at the time. And found lots of devices were not showing up. So I changed my code and scanned bus 0-7 (8 total) and found the remaining devices. You want to make sure the Vender ID isnt 0xFFFF and the Device ID isnt 0xFFFF. That should help, If you don't check the VenderID and the DeviceID you can get all kinds of weird things. I would also check the wiki:
http://wiki.osdev.org/PCI
Hope it helps, Matt
Now far as finding a processor, I think sometimes there is one and sometimes there isn't one. Oddly enough. I can't remeber if my current code finds the processor in VMWare but I know on my AMD64 FX processor it finds it.
Re: PCI enumeration results
Posted: Fri May 10, 2013 5:14 pm
by DennisCGc
CR wrote:
I tried also on vmware and it finds 42 devices (but 33 of those are PCI to PCI bridges)
Well, it is consistent with what FreeBSD detects when run in VMWare, so I believe it is fine.
Re: PCI enumeration results
Posted: Sat May 11, 2013 8:56 am
by CR
ok, so I assume my code is correct!
thank you!
Re: PCI enumeration results
Posted: Mon May 27, 2013 12:37 am
by Shaun
CR wrote:ok, so I assume my code is correct!
thank you!
oh, no, your code is not correct! sorry...
some pci buses may mirror the device you found, specially for vmware,
say, if you got device id from 1-16, bus may mirror it from 17-32, so you will see totally 32 devices,in fact, it is only 16 device on bus, you should remove the others which was mirrored by bus, these mirrored device was so called ghost device in linux kernel. you can search linux kernel source code and find out the way to fix up your code.
Re: PCI enumeration results
Posted: Mon May 27, 2013 12:43 am
by Combuster
virusest wrote:CR wrote:ok, so I assume my code is correct!
thank you!
oh, no, your code is not correct! sorry...
It is. VMWare just has a huge load of never-used bridge devices. You on the other hand should probably be fixing your code if it has duplicate devices.
Re: PCI enumeration results
Posted: Mon May 27, 2013 11:17 am
by bluemoon
CR wrote:In both the emulators I don't get any processor.
You won't find any normal processor on the PCI, except if you got some special extension board. Even for "system on board" it is not reported as a processor.
You might got mixed up with ACPI, which indeed report processor(s) and cores.