Hello, i'm trying to enumerate all class codes for existing pci devices.
All i seem to get are 4 devices whose class code is 0x00.. is this normal?
There's my code: http://codepad.org/z05RIkvq
I'm running on bochs.
Enumerating PCI Devices
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Enumerating PCI Devices
You are mixing up words (16 bits) and doublewords (32 bits) on many occasions. Fix that and you'll have a good chance to get rid of the spurious readings. If you end up getting no devices, you might need to enable PCI in the configuration.
Also, don't read functions beyond the first without checking they actually exist.
Also, don't read functions beyond the first without checking they actually exist.
Re: Enumerating PCI Devices
Well i seem to have reduced the number of devices i find, but i still get 2 whose class code is 0x00.
http://pastebin.ca/1883085
And, if i do have to enable pci, how would i do that in bochs?
http://pastebin.ca/1883085
And, if i do have to enable pci, how would i do that in bochs?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Enumerating PCI Devices
There are still some doubleword-size issues (this time versus bytes) in place here. You pass offsets into byte-sized configuration space, while the code you grabbed off the internet treats offsets as entries into doubleword sized configuration space (which is how it works in reality). In the end you are not reading anything near the class code or header type. You may want to compare your version with this.
As for the pci option, may I recommend reading the manual first? (It's most likely on since you do seem to get the right number of devices given your current bug status)
As for the pci option, may I recommend reading the manual first? (It's most likely on since you do seem to get the right number of devices given your current bug status)
Re: Enumerating PCI Devices
Thank you very much for you help.
I seem to get 9 devices right now, 3 of which are "Bridge Devices" (according ot the Base Class code), 1 is a mass storage controller
and 5 are Class code 0xFF.
shouldn't i also be getting the Processor and several other devices?
http://codepad.org/hiKMbk5I
I seem to get 9 devices right now, 3 of which are "Bridge Devices" (according ot the Base Class code), 1 is a mass storage controller
and 5 are Class code 0xFF.
shouldn't i also be getting the Processor and several other devices?
http://codepad.org/hiKMbk5I
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Enumerating PCI Devices
I see you copied random sources again (including mine) - It'd be best if learn to do your own debugging work instead of relying on copy-paste. Especially if you have to do the error-prone translation from language X to Y as well.
Also, why are you only interested in the class codes? The device-vendor pair is usually more interesting. (I only use the class codes to find out which PCI device maps to an ISA function - like whether the video card installed is PCI or ISA)
Also, PCI lists only the devices attached to the PCI bus. The link to the processor is there, only you fail to recognise it. (look up the various device IDs to find out).
Also, why are you only interested in the class codes? The device-vendor pair is usually more interesting. (I only use the class codes to find out which PCI device maps to an ISA function - like whether the video card installed is PCI or ISA)
Also, PCI lists only the devices attached to the PCI bus. The link to the processor is there, only you fail to recognise it. (look up the various device IDs to find out).